Word 2013

 Copy code hover
[image]

Word 2013
Send feedback

Published: July 16, 2012

Word product logo

Use Word 2013 to create professional looking documents.

Explore Word 2013 developer resources

New features and scenarios

New features

What's new for Word 2013 developers

Get started

Get started

Getting Started with VBA in Word 2010

References

Reference

Welcome to the Word 2013 developer reference

Find training and other resources about Office

Email us to suggest content Subscribe to the Office developer RSS Read Office developer blogs Read Office developer forums Visit MSDN Office and SharePoint on Facebook Follow @MSDN_Office on Twitter

Download

Office updates

Office 365

Office code samples

Office scripts and sample files

Office downloads

Office 365 downloads

How To

Train Office 2010 end users

Office developer videos

Office IT pro training

Office IT pro videos

Sites

Office 365 IT pros

Office 2013 Resource Kit

SharePoint developers

SharePoint IT pros

Office.com

Microsoft.com: Office 365

Additional resources

  • Access 2013

  • Excel 2013

  • InfoPath 2013

  • Office 2013

  • OneNote 2013

  • Outlook 2013

  • PowerPoint 2013

  • Project 2013

  • Publisher 2013

  • SharePoint 2013

  • Visio 2013

© 2013 Microsoft Corporation. All rights reserved.


What's new for Word 2013 developers

 Copy code hover
[image]

What's new for Word 2013 developers
Send feedback

Published: July 16, 2012

This document provides a top-level view of the enhancements and additions for developers in Microsoft Word 2013. It also provides links to other articles and references that will enable you to get started programming Word 2013.

In this article
Introduction
Apps for Office in Word
Enhancements to content controls
Specify settings for Reading Mode
UI for XML mappings
Conclusion
Additional resources

Introduction

Microsoft Word 2013 helps you produce professional looking documents by providing a comprehensive set of tools for creating and formatting your document. Rich review, commenting, and comparison capabilities help you quickly gather and manage feedback from colleagues. Advanced data integration ensures that documents stay connected to important sources of business information.

If you develop custom document solutions, you can use the following programmability and feature improvements in Word 2013.

Apps for Office in Word

Microsoft Word 2013 brings the web to the Word 2013. New apps for Office offer a wealth of interesting, new scenarios and solutions in an easy-to-use environment for dynamic web application development. This means that you now can use popular dynamic languages (such as Python, PHP, Perl, and JavaScript) and web development tool features (such as Microsoft Visual Studio 2012) for application development. Web development also enables you to use the strong global developer communities and the availability of various code samples, frameworks, and libraries, which broaden application applicability for different scenarios.

Task pane apps for Office in Word 2013 work side-by-side with a Word document and let developers supply contextual information and functionality to enhance the document viewing and authoring experience. For example, a task pane app for Word 2013 can look up and retrieve product information from a web service based on the product name or part number the users selects in the document. Figure 1 shows one implementation of a task pane app in Word 2013.

Figure 1. Implementation of a task pane app in Word 2013

Task pane app in Word

Enhancements to content controls

You can programmatically use the redesigned content control features in content controls in Word 2013. New features include repeating content controls, color coding, and control over the appearance of the content control in the document. Content controls are bounded and potentially labeled regions in a document that serve as containers for specific types of content, as shown in Figure 2. Individual content controls can contain content such as dates, lists, or paragraphs of formatted text. They enable you to create rich, structured blocks of content. Content controls enable you to create templates that have well-defined blocks so that you can work with documents in a structured way.

Figure 2. Repeating content controls

Repeating Content Control

The following code sample shows how to use repeating content controls programmatically. It sets up a table row that has three XML mappings and uses a repeating content control to repeat that row for each <book> element in a custom XML part in the document.

VBA Copy code Copy code
Sub testRepeatingControl()
Dim objRange As Range
Dim objTable As Table
Dim objCustomPart As CustomXMLPart
Dim objCC As ContentControl
Dim objCustomNode As CustomXMLNode

Set objCustomPart = ActiveDocument.CustomXMLParts.Add
objCustomPart.LoadXML ("<books>" & _
    "<book><title>Code</title>" & _
    "<author>Charles Petzold</author></book>" & _
    "<book><title>JavaScript Step by Step</title>" & _
    "<author>Steve Suehring</author></book>" & _
    "<book><title>Understanding IPv6</title>" & _
    "<author>Joseph Davies</author></book></books>")

Set objRange = ActiveDocument.Paragraphs(1).Range
Set objTable = ActiveDocument.Tables.Add(objRange, 2, 2)

Set objRange = objTable.Cell(1, 1).Range
Set objCustomNode = objCustomPart.SelectSingleNode("/books[1]/book[1]/title[1]")
Set objCC = ActiveDocument.ContentControls.Add(wdContentControlText, objRange)
objCC.XMLMapping.SetMappingByNode objCustomNode

Set objRange = objTable.Cell(1, 2).Range
Set objCustomNode = objCustomPart.SelectSingleNode("/books[1]/book[1]/author[1]")
Set objCC = ActiveDocument.ContentControls.Add(wdContentControlText, objRange)
objCC.XMLMapping.SetMappingByNode objCustomNode

Set objRange = objTable.Rows(1).Range
Set objCC = ActiveDocument.ContentControls.Add(wdContentControlRepeatingSection, objRange)
objCC.XMLMapping.SetMapping ("/books[1]/book")
End Sub

Specify settings for Reading Mode

Settings for Reading Mode can now be set programmatically in Word 2013. These settings include text scaling, layout, and line length.

UI for XML mappings

You can now create XML mappings to content controls natively by means of a task pane available from the ribbon UI, as opposed to the VBA or file format manipulation required in Microsoft Word 2010 and Microsoft Office Word 2007. The task pane enables you to visually set up XML mappings to content controls within the document.

Conclusion

Word 2013 provides a wealth of new features for developers. Apps for Office provide an exciting opportunity for developers to integrate web-based features into Word 2013, side-by-side with the worksheet. Other new features that extend the existing Word 2013 VBA object model include enhancements to content controls NS the ability to specify settings for Reading Mode. In addition, Word 2013 offers new UI for creating XML mappings.

Additional resources

  • Word 2013 Developer Reference

  • Build apps for Office

  • What's New for Office 2013 Developers


What's new with content controls in Word 2013

 Copy code hover
[image]

What's new with content controls in Word 2013
Send feedback

Published: January 15, 2013

Summary: Learn how Microsoft Word 2013 content controls enable a larger range of structured document scenarios.

Applies to: Microsoft Word 2013

In this article
Introduction
Content control improvements in Word 2013
New Word 2013 content control object model members
XML mapping
Repeating section content controls represented in the object model
Conclusion
Additional resources

Introduction

This topic provides information about changes to content controls in Microsoft Word 2013 and the document scenarios that those changes enable.

Structured documents

Structured documents are documents that control where content can appear on a document, what kind of content can appear in the document, and whether that content can be edited.

Here are some common scenarios for structured content in Microsoft Word:

  • A legal firm needs to create documents that contain legal language that should not be changed by the user.

  • A business needs to create a proposal cover page where only the title, author, and date are entered by the user.

  • A business needs to create invoices where the customer data is included in the invoice at predefined regions.

Using content controls to structure a document

Content controls are Microsoft Word entities that act as containers for specific content in a document. Individual content controls can contain content such as dates, lists, or paragraphs of formatted text. Content controls help you to create rich, structured blocks of content and are designed for use in templates that insert well-defined blocks into your documents, creating structured documents.

Content controls are ideal for creating structured documents because content controls help you fix the position of content, specify the kind of content (for example, a date, a picture, or text), restrict or enable editing, and add semantic meaning to content.

Content controls in Word 2010

The following content controls are available in Word 2010:

  • Rich Text

  • Plain Text

  • Picture

  • Building Block Gallery

  • Combo Box

  • Drop-Down List

  • Date

  • Checkbox

  • Group

Word 2010 content controls enable various potential structured document solutions, but in Word 2013 content controls enable a greater range of scenarios.

Content control improvements in Word 2013

In Word 2013, content controls provide three key improvements: improved visualization, support for XML Mapping for Rich Text content controls, and a new content control for repeating content.

Improved visualization

Word 2013 allows an individual content control to appear in one of three possible states:

  • Bounding box

  • Start/End tags

  • None

Note Note

If not stated otherwise, this section discusses the visualization of content controls when the document is not viewed in Design Mode.You set the display mode for a content control by using the Show as drop-down list control in the Content Control Properties dialog box.

Figure 1. Content Control Properties dialog box

Content control properties dialog box

You can also set the display mode for a content control by using the Word 2013 object model (discussed later in New Word 2013 content control object model members).

Bounding box

The default rendering for content controls in Word 2013 is to preserve the look of content controls as they appear in Word 2007 and Word 2010; that is, as a bounding box. When a content control is set to show as Bounding Box, the display changes depending upon the following user interaction:

  • When the content control does not have the focus, no visualization occurs

  • On mouse-over, the content control appears as a shaded rectangle

Figure 2. Content control on mouse-over

Content control on mouse over

  • When the content control has the focus (when the user chooses the content control), the control appears as a "bounding box" (with a line around the content and the title showing, if a title has been set)

Figure 3. Content control with focus

Content control with focus

Start/End tags

When the content control is set to show as Start/End tag, the tags are displayed regardless of user interaction, and the title never appears; but buttons, such as the Drop-Down List button, appear on mouse over.

Figure 4. Content control set to show as start/end tags

Content control set to show as start and end tags

None

When the content control is set to show as None, the content control is not displayed.

Content control colorization

In addition to enabling a different kind of display for a content control, Word 2013 also helps you to set the color for an individual content control. You set the color of a content control by using the Color button in the Content Control Properties dialog box.

You can also set the color of a content control by using the Word 2013 object model (discussed later in New Word 2013 content control object model members).

Figure 5. Content Control Properties dialog box

Content control properties dialog box

Support for XML mapping for rich text content controls

Word 2013 helps you to map the content of rich text content controls and document building block content controls to the XML data store. To do this, you set the XML mapping for the content control. You can set this property by using the existing XMLMapping.SetMapping method in the object model. Within the custom XML part, the custom XML is stored as flat Open XML markup converted into a string (by using standard XML encoding), so that it can be stored as a text node in the custom XML part. However, the mapping continues to have the limitation that it can only successfully map to leaf nodes or attributes.

Note Note

Rich text content controls cannot contain other rich text content controls. If one exists inside of another (for example, because of file format manipulation, copy and paste, and so on), it is unlinked until it is no longer contained inside a mapped rich text control.

For more information about how to set up XML mapping, see the section New Word 2013 content control object model members later in this topic.

Supporting repeating content

In addition to visualization enhancements and support for XML mapping to rich text content controls, Word 2013 also adds a new content control that enables you to repeat content. The repeating section content control repeats the content contained within it, including other content controls.

You insert the repeating section content control around entire paragraphs or table rows. Once the control surrounds a section, you can insert copies of the section above or below the contained section.

Figure 6. Repeating section content control context menu

Repeating section content control context

You can repeat the inserted section by using either the control on the end of the content control (displayed as a button with a plus sign ( Plus sign)) or by choosing a command on the context menu, as shown in Figure 6. The repeated content becomes a separate section of the control that you can assign a title by using the Content Control Properties dialog box.

Figure 7. Assign a section title in the Content Control Properties dialog box

Content control properties dialog box

Once you have given the section a title, if you select Allow users to add and remove sections in the Content Control Properties dialog box, users can add or delete the section by name.

Figure 8. Use the repeating section content control context menu to delete a section

Repeating section content control context

When a repeating section content control surrounds other content controls, the enclosed content controls are repeated in each new item; but any such content controls have their contents reset to placeholder text. There are two exceptions where child control contents are preserved:

  • When a child control is a repeating section control.

  • When a child control is XML-mapped to a node outside the repeating section content control.

Figure 9. Repeating section content control containing child controls before repeat

Repeating section content control before repeat

Figure 10. Repeating section content control containing child controls after repeat

Repeating section content control after repeat

Repeating section content controls around XML-mapped controls

For XML mappings that are contained in a repeating section, Word 2013 maps them as follows.

If the mapping does not intersect with an item in the node set as part of its parent chain, the binding is an "absolute binding" and shows the same content in all repeating section items.

If the mapping does intersect with an item in the node set as part of its parent chain, the binding is a "relative binding", and is remapped as follows:

  • The absolute binding for the node is determined (flattening out any query expressions)─this should happen on initial mapping

  • The axis of the binding that intersects with the node set is removed

  • The remainder of the XPath is evaluated relative to the XPath of the repeating section content item

For example, the following mappings might occur:

  • The repeating section is mapped to \root\next\path

  • The control in the sample item is mapped to \root\next\path[2]\baz

  • Word matches \root\next\path[2] to an item in the node set

The binding is therefore evaluated as .\baz, where the base is the node of the repeating content item.

The following suggestions for working with repeating content controls can help you prevent data loss and avoid frustration.

Working with repeating section content controls that are mapped to XML data

If you insert a repeating section content control that is mapped to XML data, every time your user reopens the document, Word recreates the repeating section items, based on the information in the data store. Even if you save the document, any changes that the user makes in the repeating section items in the document that aren't also mapped into the data store are lost.

To help prevent this from happening, lock the repeating section content control and allow the user to edit only in unlocked child content controls that are mapped to the XML as well.

Binding a repeating section content control to a table

If you want to bind a repeating section content control to a table, insert the table and then the insert repeating section content control, and not the other way around. (Otherwise, you won't be able to select only the table).

Nesting repeating section content controls within a table

Nesting repeating section content controls tightly within a table (for example, when the end of the parent and child repeating section content control is in the same cell) causes the outer repeating section to be deleted when the inner section has an item added or removed.

You can prevent this from happening by adding a paragraph marker between the end of one repeating section content control and the next. To hide the paragraph marker, deselect the Show/Hide option on the Home tab of the ribbon.

Open XML File Format schema additions

The following elements were added to the WordprocessingML Open XML File Format schema.

Table 1. New elements in the WordprocessingML Open XML File Format schema for content controls
Element | Description
<w:appearance> | <w:appearance> is a child element of <w:sdtPr>. The following values are valid for the val attribute: <w:appearance val= boundingBox|tags|hidden. The default value is boundingBox.
<w:color> | <w:color> is a child element of <w:sdtPr>. The content model matches the existing CT_Color complex type. The default value is the color used in Word 2010.

New Word 2013 content control object model members

With the new enhancements and additions to content controls in Word 2013, the object model for Word has been updated to allow for programmatic manipulation of the new feature set. In addition, changes have also been made to the underlying Open XML File Format for word processing documents.

The following sections provide more information about the specific object model changes related to each content control enhancement.

Visualization enhancements

Several object model additions are included in Word 2013 for content control visualization enhancements. The following table list new members of the ContentControl object for visualization.

Table 2. New ContentControl object members
Member | Description
.Appearance as WdContentControlAppearance | Gets or sets the visualization of the content control.
.Color as WdColor | Gets or sets the color of the content control.

The following table lists constants in the new WdContentControlAppearance enumeration.

Table 3. New WdContentControlAppearance enumeration constants
Constant | Description
wdContentControlBoundingBox | Represents a content control shown as a shaded rectangle/bounding box (with optional title).
wdContentControlTags | Represents a content control shown as start/end markers.
wdContentControlHidden | Represents a content control that is not shown.

Code sample

The following code sample shows how to create rich text content controls and set visualization programmatically.

VBA Copy code Copy code
Sub testVisualization()
   Dim objcc As ContentControl
   Dim objRange As Range

   ' Get the first paragraph as a range object.
   Set objRange = ActiveDocument.Paragraphs(1).Range
   ' Create a rich text content control around the first paragraph.
   Set objcc = ActiveDocument.ContentControls.Add(wdContentControlRichText, objRange)
   objcc.Title = "Default Bounding Box"
   ' Set visualization to the default.
   objcc.Appearance = wdContentControlBoundingBox

   ' Create a new paragraph.
   objRange.InsertParagraphAfter
   Set objRange = ActiveDocument.Paragraphs(2).Range
   ' Create a rich text content control around the second paragraph.
   Set objcc = ActiveDocument.ContentControls.Add(wdContentControlRichText, objRange)
   objcc.Title = "Non Bounding"
   ' Set visualization to invisible.
   objcc.Appearance = wdContentControlHidden

   ' Create a new paragraph.
   objRange.InsertParagraphAfter
   Set objRange = ActiveDocument.Paragraphs(3).Range
   ' Create a rich text content control around the third paragraph.
   Set objcc = ActiveDocument.ContentControls.Add(wdContentControlRichText, objRange)
   objcc.Title = "Tags Only with Pink color"
   ' Set visualization to Start/End tags with pink color.
   objcc.Appearance = wdContentControlTags
   objcc.Color = wdColorPink
End Sub

XML mapping

No additions were made to the Word 2013 object model to accommodate rich text mapping to XML nodes in the document data store. Instead, use the existing object model to map a rich text content control to an XML node in the document data store. Additionally, no changes were made to the underlying Open XML File Format WordprocessingML schema as part of the newly included rich text content control support specifically for XML mapping.

Code sample

The following code sample shows how to map a rich text content control to an XML node programmatically.

VBA Copy code Copy code
Sub testRichBinding()
   Dim objRange As Range
   Dim objcc As ContentControl
   Dim objCustomPart As CustomXMLPart
   Dim blnMap As Boolean

   ' Add a custom XML part to the data store.
   Set objCustomPart = ActiveDocument.CustomXMLParts.Add
   ' Load XML fragment into the custom XML part.
   objCustomPart.LoadXML ("<x>Rich Text Databinding</x>")
   ' Get the first paragraph as a range object.
   Set objRange = ActiveDocument.Paragraphs(1).Range
   ' Create a rich text content control around the first paragraph.
   Set objcc = ActiveDocument.ContentControls.Add(wdContentControlRichText, objRange)
   ' Bind the XML node to the rich text content control.
   blnMap = objcc.XMLMapping.SetMapping("/x")
   ' Return whether mapping worked.
   MsgBox objcc.XMLMapping.IsMapped
End Sub

Repeating section content controls represented in the object model

The repeating section content control is available in the object model by using the following additions to the ContentControl object and the new RepeatingSectionItem and RepeatingSectionItemColl objects. Table 4 lists the most important new members of the ContentControl object for repeating section content controls.

Table 4. ContentControl object members
Member | Description
AllowInsertDeleteSection as Boolean | Gets or sets whether users can add or remove sections from the content control by using the UI. If this property is called for a content control that is not of type repeating section, the call fails with the following error message: "This property can only be used with repeating section content controls."
RepeatingSectionItemTitle as String | Gets or sets the name of repeating section items used in the context menu. If this property is called for a content control that is not of type repeating section, the call fails with: "This property can only be used with repeating section content controls."
InsertRepeatingSectionItemBefore as ContentControl | Adds a repeating section item before the current item and returns the new repeating section item. If this method is called for a content control that is not of type repeating section item, the call fails with: "This property can only be used with repeating section item content controls."
InsertRepeatingSectionItemAfter as ContentControl | Adds a repeating section item after the current item and returns the new repeating section item. If this method is called for a content control that is not of type repeating section item, the call fails with: "This property can only be used with repeating section item content controls."

Table 5 lists the most important members of the RepeatingSectionItem object.

Table 5. RepeatingSectionItem object members
Member | Description
Range as Range | Returns the range of the specified repeating section item, excluding the start and end tags.
Delete | Deletes the specified repeating section item.
InsertItemAfter as RepeatingSectionItem | Adds a repeating section item after the specified item and returns the new item.
InsertItemBefore as RepeatingSectionItem | Adds a repeating section item before the specified item and returns the new item.

Table 6 lists the most important members of the RepeatingSectionItemColl object.

Table 6. RepeatingSectionItemColl object members
Member | Description
Item as RepeatingSectionItem | Returns an individual repeating section item.

Table 7 shows the new member of the WdContentControlType enumeration for repeating section content controls.

Table 7. WdContentControlType enumeration addition
Constant | Description
wdContentControlRepeatingSection | Represents a content control that contains a single item in a repeating section.

Code sample

The following code sample shows how to use repeating section content controls programmatically.

VBA Copy code Copy code
Sub testRepeatingSectionControl()
   Dim objRange As Range
   Dim objTable As Table
   Dim objCustomPart As CustomXMLPart
   Dim objCC As ContentControl
   Dim objCustomNode As CustomXMLNode

   Set objCustomPart = ActiveDocument.CustomXMLParts.Add
   objCustomPart.LoadXML ("<books>" & _
       "<book><title>Everyday Italian</title>" & _
       "<author>Giada De Laurentiis</author></book>" & _
       "<book><title>Harry Potter</title>" & _
       "<author>J K. Rowling</author></book>" & _
       "<book><title>Learning XML</title>" & _
       "<author>Erik T. Ray</author></book></books>")

   Set objRange = ActiveDocument.Paragraphs(1).Range
   Set objTable = ActiveDocument.Tables.Add(objRange, 2, 2)
   With objTable.Borders
       .InsideLineStyle = wdLineStyleSingle
       .OutsideLineStyle = wdLineStyleDouble
   End With

   Set objRange = objTable.Cell(1, 1).Range
   Set objCustomNode = objCustomPart.SelectSingleNode("/books[1]/book[1]/title[1]")
   Set objCC = ActiveDocument.ContentControls.Add(wdContentControlText, objRange)
   objCC.XMLMapping.SetMappingByNode objCustomNode

   Set objRange = objTable.Cell(1, 2).Range
   Set objCustomNode = objCustomPart.SelectSingleNode("/books[1]/book[1]/author[1]")
   Set objCC = ActiveDocument.ContentControls.Add(wdContentControlText, objRange)
   objCC.XMLMapping.SetMappingByNode objCustomNode

   Set objRange = objTable.Rows(1).Range
   Set objCC = ActiveDocument.ContentControls.Add(wdContentControlRepeatingSection, objRange)
   objCC.XMLMapping.SetMapping ("/books[1]/book")
End Sub

Open XML File Format changes for repeating section content controls

The file format representation of a repeating section content control generally uses the same element names, values, and so on as the existing XML markup; however, the <sdt> element representing the outer repeating section container exists in the Word 2013 namespace, to ensure compatibility with earlier versions of Word.

The individual repeating items within the repeating section content control (that surround each individual item) are saved as rich text content controls using the existing WordprocessingML representation. Table 8 lists new elements in the WordprocessingML schema for repeating section content controls.

Table 8. New elements in the WordprocessingML schema for repeating section content controls
Element | Description
<w15:repeatingSection> | Specifies a repeating section content control. This element is mutually exclusive with all other control types and has no child elements or attributes.
<w15:repeatingSectionItem> | Specifies a repeating section item content control. This element is mutually exclusive with all other control types, and has no child elements or attributes.
<w15:doNotAllowInsertDeleteSection> | Specifies that the user cannot add or delete sections by using the user interface in Word 2013.
<w15:sectionTitle> | Specifies the name of repeating section items (and is used in the context menu when the control is chosen).

Conclusion

This topic has briefly reviewed changes to content controls in Word 2013.

Additional resources

For more information, see the following resources:

  • Word Developer Resource Center

  • Content Controls Resource Center

  • Office Developer Resource Center


Welcome to the Word 2013 developer reference

 Copy code hover
[image]

Welcome to the Word 2013 developer reference
See also Send feedback

Welcome to the Microsoft Word 2013Developer Reference. This reference contains conceptual overviews, programming tasks, samples, and references to guide you in developing solutions based on Word.

We welcome your comments or questions about this content: docthis@microsoft.com.

Publish date: October 2012

This documentation contains the following sections:

  • How Do I... in Word : Provides a map of how-to topics for developing custom Word solutions.

  • Concepts : Provides important concepts for developing custom Word solutions.

  • Reference : Provides reference materials for the Word object model.

See also

Concepts

Office 2013 documentation copyright notice

Other resources

Word Developer Center
Accessibility in Microsoft Products
Document Conventions
Microsoft Online Privacy Notice


Concepts (Word 2013 developer reference)

 Copy code hover
[image]

Concepts (Word 2013 developer reference)
Send feedback

This section contains the following overviews about programmability in Microsoft Office Word:

  • Adding Controls to a Document

  • Adding Controls to a UserForm

  • Applying Formatting to Text

  • Assigning Ranges

  • Auto Macros

  • Automating Common Word Tasks

  • Built-in Dialog Box Argument Lists

  • Communicating with Other Applications

  • Conceptual Differences Between WordBasic and Visual Basic

  • Control and Dialog Box Events

  • Converting WordBasic Macros to Visual Basic

  • Creating a Custom Dialog Box

  • Creating a UserForm

  • Creating Frames Pages

  • Determining Whether the Application Property Is Necessary

  • Displaying a Custom Dialog Box

  • Displaying Built-in Word Dialog Boxes

  • Editing Text

  • Error Accessing a Table Row or Column

  • Finding and Replacing Text or Formatting

  • Finding Out Which Property or Method to Use

  • Frequently Asked Visual Basic Questions

  • Initializing Control Properties

  • Inserting Text in a Document

  • Looping Through a Collection

  • Miscellaneous Tasks

  • Modifying a Portion of a Document

  • Modifying a Word Command

  • Object Doesn't Support this Property or Method

  • OLE Programmatic Identifiers

  • Predefined Bookmarks

  • Prompting for Information

  • Recording a Macro to Generate Code

  • Referring to the Active Document Element

  • Requested Member of the Collection Does Not Exist

  • Returning a Single Object from a Collection

  • Returning an Object from a Collection

  • Returning Text from a Document

  • Revising Recorded Visual Basic Macros

  • Selecting Text in a Document

  • Setting Control Properties

  • Storing Values When a Macro Ends

  • Understanding Objects, Properties, and Methods

  • Using ActiveX Controls on a Document

  • Using ActiveX Controls on Word Documents

  • Using Control Values While Code Is Running

  • Using DAO from Microsoft Word

  • Using Events with ActiveX Controls

  • Using Events with the Application Object

  • Using Events with the Document Object

  • Working with Bibliographies

  • Working with Building Blocks

  • Working With Charts

  • Working with Content Controls

  • Working with Document Objects

  • Working with Range Objects

  • Working with Tables

  • Working with the Selection Object


Adding Controls to a Document

 Copy code hover
[image]

Adding Controls to a Document
Send feedback

You can add ActiveX controls to a document's drawing layer or text layer. To add a control to the drawing layer, click the control on the Control Toolbox. Drag an adjustment handle of the control until the control's outline is the size and shape you want. To add a control to the text layer, hold down the SHIFT key while you click a control on the Control Toolbox. The control is automatically added to the document at the insertion point.

Note Note

Dragging a control (or a number of "grouped" controls) from the form back to the Control Toolbox creates a template of that control, which can be reused. This is a useful feature for implementing a standard interface for your applications.


Adding Controls to a UserForm

 Copy code hover
[image]

Adding Controls to a UserForm
Send feedback

To add ActiveX controls to a user form, find the control you want to add in the Toolbox, drag the control onto the form, and then drag an adjustment handle on the control until the control's outline is the size and shape you want.

Note Note

Dragging a control (or a number of "grouped" controls) from the form back to the Toolbox creates a template of that control, which can be reused. This is a useful feature for implementing a standard interface for your applications.

When you've added controls to the form, use the commands on the Format menu in the Visual Basic Editor to adjust the control alignment and spacing.


Applying Formatting to Text

 Copy code hover
[image]

Applying Formatting to Text
Send feedback

This topic includes Microsoft Visual Basic examples related to the following tasks:

  • Applying formatting to the selection

  • Applying formatting to a range

  • Inserting text and applying character and paragraph formatting

  • Switching the space before a paragraph between 12 points and none

  • Switching bold formatting on and off

  • Increasing the left margin by 0.5 inch

Applying formatting to the selection

The following example uses the Selection property to apply character and paragraph formatting to the selected text. Use the Font property to access character formatting properties and methods and the ParagraphFormat property to access paragraph formatting properties and methods.

Copy code Copy code
Sub FormatSelection()
 With Selection.Font
 .Name = "Times New Roman"
 .Size = 14
 .AllCaps = True
 End With
 With Selection.ParagraphFormat
 .LeftIndent = InchesToPoints(0.5)
 .Space1
 End With
End Sub

Applying formatting to a range

The following example defines a Range object that refers to the first three paragraphs in the active document. The Range is formatted by applying properties of the Font object and the ParagraphFormat object.

Copy code Copy code
Sub FormatRange()
 Dim rngFormat As Range
 Set rngFormat = ActiveDocument.Range( _
 Start:=ActiveDocument.Paragraphs(1).Range.Start, _
 End:=ActiveDocument.Paragraphs(3).Range.End)
 With rngFormat
 .Font.Name = "Arial"
 .ParagraphFormat.Alignment = wdAlignParagraphJustify
 End With
End Sub

Inserting text and applying character and paragraph formatting

The following example adds the word "Title" at the top of the current document. The first paragraph is center-aligned and one half-inch space is added after the paragraph. The word "Title" is formatted with 24-point Arial font.

Copy code Copy code
Sub InsertFormatText()
 Dim rngFormat As Range
 Set rngFormat = ActiveDocument.Range(Start:=0, End:=0)
 With rngFormat
 .InsertAfter Text:="Title"
 .InsertParagraphAfter
 With .Font
 .Name = "Tahoma"
 .Size = 24
 .Bold = True
 End With
 End With
 With ActiveDocument.Paragraphs(1)
 .Alignment = wdAlignParagraphCenter
 .SpaceAfter = InchesToPoints(0.5)
 End With
End Sub

Switching the space before a paragraph between 12 points and none

The following example toggles the space-before formatting of the first paragraph in the selection. The macro retrieves the current space before value, and if the value is 12 points, the space-before formatting is removed (the SpaceBefore property is set to zero). If the space-before value is anything other than 12, the SpaceBefore property is set to 12 points.

Copy code Copy code
Sub ToggleParagraphSpace()
 With Selection.Paragraphs(1)
 If .SpaceBefore <> 0 Then
 .SpaceBefore = 0
 Else
 .SpaceBefore = 6
 End If
 End With
End Sub

Switching bold formatting on and off

The following example toggles bold formatting of the selected text.

Copy code Copy code
Sub ToggleBold()
 Selection.Font.Bold = wdToggle
End Sub

Increasing the left margin by 0.5 inch

The following example increases the left and right margins by 0.5 inch. The PageSetup object contains all the page setup attributes of a document (such as left margin, bottom margin, and paper size) as properties. The LeftMargin property is used to return and set the left margin setting. The RightMargin property is used to return and set the right margin setting.

Copy code Copy code
Sub FormatMargins()
 With ActiveDocument.PageSetup
 .LeftMargin = .LeftMargin + InchesToPoints(0.5)
 .RightMargin = .RightMargin + InchesToPoints(0.5)
 End With
End Sub


Assigning Ranges

 Copy code hover
[image]

Assigning Ranges
Send feedback

There are several ways to assign an existing Range object to a variable. This topic explains the results of two different techniques. In the following examples, the Range1 and Range2 variables refer to Range objects. For example, the following instructions assign the first and second words in the active document to the Range1 and Range2 variables.

Copy code Copy code
Set Range1 = ActiveDocument.Words(1)
Set Range2 = ActiveDocument.Words(2)

Setting a Range object variable equal to another Range object variable

The following instruction assigns a range variable named Range2 to represent the same location as Range1 .

Copy code Copy code
Set Range2 = Range1

You now have two variables that represent the same range. When you manipulate the start or endpoint or the text of Range2 , it affects Range1 and vice versa.

Note that the following instruction is the same as Range2.Text = Range1.Text . This instruction assigns the default property of Range1 , which is the Text property, to the default property of Range2. It doesn't change what the objects actually refer to.

Copy code Copy code
Range2 = Range1

The ranges (Range2 and and Range1 ) have the same contents, but they may point to different locations in the document or even different documents.

Using the Duplicate property

The following instruction creates a new duplicated Range object, Range2 , which has the same start and endpoints and text as Range1 .

Copy code Copy code
Set Range2 = Range1.Duplicate

If you change the start or endpoint of Range1 , it doesn't affect Range2, and vice versa. Because these two ranges point to the same location in the document, changing the text in one range affects the text in the other range.


Auto Macros

 Copy code hover
[image]

Auto Macros
Send feedback

By giving a macro a special name, you can run it automatically when you perform an operation such as starting Microsoft Office Word or opening a document. Word recognizes the following names as automatic macros, or "auto" macros.

Macro name | When it runs
AutoExec | When you start Word or load a global template
AutoNew | Each time you create a new document
AutoOpen | Each time you open an existing document
AutoClose | Each time you close a document
AutoExit | When you exit Word or unload a global template

Auto macros in code modules are recognized if either of the following conditions are true.

  • The module is named after the auto macro (for example, AutoExec) and it contains a procedure named "Main."

  • A procedure in any module is named after the auto macro.

Just like other macros, auto macros can be stored in the Normal template, another template, or a document. In order for an auto macro to run, it must be either in the Normal template, in the active document, or in the template on which the active document is based. The only exception is the AutoExec macro, which will not run automatically unless it is stored in one of the following: the Normal template, a template that is loaded globally through the Templates and Add-Ins dialog box, or a global template stored in the folder specified as the Startup folder.

In the case of a naming conflict (multiple auto macros with the same name), Word runs the auto macro stored in the closest context. For example, if you create an AutoClose macro in a document and in the attached template, only the auto macro stored in the document will execute. If you create an AutoNew macro in the normal template, the macro will run if a macro named AutoNew does not exist in the document or the attached template.

Note Note

You can hold down the SHIFT key to prevent auto macros from running. For example, if you create a new document based on a template that contains an AutoNew macro, you can prevent the AutoNew macro from running by holding down the SHIFT key when you click OK in the New dialog box (File menu) and continuing to hold down the SHIFT key until the new document is displayed. In a macro that might trigger an auto macro, you can use the following instruction to prevent auto macros from running.
VBA Copy code Copy code
WordBasic.DisableAutoMacros


Automating Common Word Tasks

 Copy code hover
[image]

Automating Common Word Tasks
Send feedback

This topic includes some common Microsoft Word tasks and the Visual Basic code needed to accomplish the tasks.

Applying formatting to text

Editing text

Finding and replacing text or formatting

Miscellaneous tasks

Working with tables

Working with documents


Built-in Dialog Box Argument Lists (Word)

 Copy code hover
[image]

Built-in Dialog Box Argument Lists (Word)
Send feedback

Many of the built-in dialog boxes in Microsoft Office Word have options that you may want to set. To set or return the properties associated with a Word dialog box, use the equivalent Microsoft Visual Basic properties and methods. For example, if you want to print a document, use the Word Visual Basic for Applications PrintOut method. The following code prints the current document using the Print dialog box default settings. However, if you do not want to use the default setting in the print dialog, you can use the arguments associated with the PrintOut method.

Copy code Copy code
Sub PrintCurrentDocument()
 ActiveDocument.PrintOut
End Sub

Although you are encouraged to use VBA keywords to get or set the value of dialog box options, many of the built-in Word dialog boxes have arguments that you can also use to get or set values from a dialog box. For more information, see Displaying Built-in Word Dialog Boxes.

WdWordDialog constant

Argument lists

wdDialogConnect

Drive , Path, Password

wdDialogConsistencyChecker

(none)

wdDialogControlRun

Application

wdDialogConvertObject

IconNumber , ActivateAs, IconFileName, Caption, Class, DisplayIcon, Floating

wdDialogCopyFile

FileName , Directory

wdDialogCreateAutoText

(none)

wdDialogCSSLinks

LinkStyles

wdDialogDocumentStatistics

FileName , Directory, Template, Title, Created, LastSaved, LastSavedBy, Revision, Time, Printed, Pages, Words, Characters, Paragraphs, Lines, FileSize

wdDialogDrawAlign

Horizontal , Vertical, RelativeTo

wdDialogDrawSnapToGrid

SnapToGrid , XGrid, YGrid, XOrigin, YOrigin, SnapToShapes, XGridDisplay, YGridDisplay, FollowMargins, ViewGridLines, DefineLineBasedOnGrid

wdDialogEditAutoText

Name , Context, InsertAs, Insert, Add, Define, InsertAsText, Delete, CompleteAT

wdDialogEditCreatePublisher

(For information about this constant, consult the language reference Help included with Microsoft Office Macintosh Edition.)

wdDialogEditFind

Find , Replace, Direction, MatchCase, WholeWord, PatternMatch, SoundsLike, FindNext, ReplaceOne, ReplaceAll, Format, Wrap, FindAllWordForms, MatchByte, FuzzyFind, Destination, CorrectEnd, MatchKashida, MatchDiacritics, MatchAlefHamza, MatchControl

wdDialogEditFrame

Wrap , WidthRule, FixedWidth, HeightRule, FixedHeight, PositionHorz, PositionHorzRel, DistFromText, PositionVert, PositionVertRel, DistVertFromText, MoveWithText, LockAnchor, RemoveFrame

wdDialogEditGoTo

Find , Replace, Direction, MatchCase, WholeWord, PatternMatch, SoundsLike, FindNext, ReplaceOne, ReplaceAll, Format, Wrap, FindAllWordForms, MatchByte, FuzzyFind, Destination, CorrectEnd, MatchKashida, MatchDiacritics, MatchAlefHamza, MatchControl

wdDialogEditGoToOld

(none)

wdDialogEditLinks

UpdateMode , Locked, SavePictureInDoc, UpdateNow, OpenSource, KillLink, Link, Application, Item, FileName, PreserveFormatLinkUpdate

wdDialogEditObject

Verb

wdDialogEditPasteSpecial

IconNumber , Link, DisplayIcon, Class, DataType, IconFileName, Caption, Floating

wdDialogEditPublishOptions

(For information about this constant, consult the language reference Help included with Microsoft Office Macintosh Edition.)

wdDialogEditReplace

Find , Replace, Direction, MatchCase, WholeWord, PatternMatch, SoundsLike, FindNext, ReplaceOne, ReplaceAll, Format, Wrap, FindAllWordForms, MatchByte, FuzzyFind, Destination, CorrectEnd, MatchKashida, MatchDiacritics, MatchAlefHamza, MatchControl

wdDialogEditStyle

(none)

wdDialogEditSubscribeOptions

(For information about this constant, consult the language reference Help included with Microsoft Office Macintosh Edition.)

wdDialogEditSubscribeTo

(For information about this constant, consult the language reference Help included with Microsoft Office Macintosh Edition.)

wdDialogEditTOACategory

Category , CategoryName

wdDialogEmailOptions

(none)

wdDialogFileDocumentLayout

Tab , PaperSize, TopMargin, BottomMargin, LeftMargin, RightMargin, Gutter, PageWidth, PageHeight, Orientation, FirstPage, OtherPages, VertAlign, ApplyPropsTo, Default, FacingPages, HeaderDistance, FooterDistance, SectionStart, OddAndEvenPages, DifferentFirstPage, Endnotes, LineNum, StartingNum, FromText, CountBy, NumMode, TwoOnOne, GutterPosition, LayoutMode, CharsLine, LinesPage, CharPitch, LinePitch, DocFontName, DocFontSize, PageColumns, TextFlow, FirstPageOnLeft, SectionType, RTLAlignment

wdDialogFileFind

SearchName , SearchPath, Name, SubDir, Title, Author, Keywords, Subject, Options, MatchCase, Text, PatternMatch, DateSavedFrom, DateSavedTo, SavedBy, DateCreatedFrom, DateCreatedTo, View, SortBy, ListBy, SelectedFile, Add, Delete, ShowFolders, MatchByte

wdDialogFileMacPageSetup

(For information about this constant, consult the language reference Help included with Microsoft Office Macintosh Edition.)

wdDialogFileNew

Template , NewTemplate, DocumentType, Visible

wdDialogFileOpen

Name , ConfirmConversions, ReadOnly, LinkToSource, AddToMru, PasswordDoc, PasswordDot, Revert, WritePasswordDoc, WritePasswordDot, Connection, SQLStatement, SQLStatement1, Format, Encoding, Visible, OpenExclusive, OpenAndRepair, SubType, DocumentDirection, NoEncodingDialog, XMLTransform

wdDialogFilePageSetup

Tab , PaperSize, TopMargin, BottomMargin, LeftMargin, RightMargin, Gutter, PageWidth, PageHeight, Orientation, FirstPage, OtherPages, VertAlign, ApplyPropsTo, Default, FacingPages, HeaderDistance, FooterDistance, SectionStart, OddAndEvenPages, DifferentFirstPage, Endnotes, LineNum, StartingNum, FromText, CountBy, NumMode, TwoOnOne, GutterPosition, LayoutMode, CharsLine, LinesPage, CharPitch, LinePitch, DocFontName, DocFontSize, PageColumns, TextFlow, FirstPageOnLeft, SectionType, RTLAlignment, FolioPrint, ReverseFolio, FolioPages

wdDialogFilePrint

Background , AppendPrFile, Range, PrToFileName, From, To, Type, NumCopies, Pages, Order, PrintToFile, Collate, FileName, Printer, OutputPrinter, DuplexPrint, PrintZoomColumn, PrintZoomRow, PrintZoomPaperWidth, PrintZoomPaperHeight, ZoomPaper

wdDialogFilePrintOneCopy

(For information about this constant, consult the language reference Help included with Microsoft Office Macintosh Edition.)

wdDialogFilePrintSetup

Printer , Options, Network, DoNotSetAsSysDefault

wdDialogFileRoutingSlip

Subject , Message, AllAtOnce, ReturnWhenDone, TrackStatus, Protect, AddSlip, RouteDocument, AddRecipient, OldRecipient, ResetSlip, ClearSlip, ClearRecipients, Address

wdDialogFileSaveAs

Name , Format, LockAnnot, Password, AddToMru, WritePassword, RecommendReadOnly, EmbedFonts, NativePictureFormat, FormsData, SaveAsAOCELetter, WriteVersion, VersionDesc, InsertLineBreaks, AllowSubstitutions, LineEnding, AddBiDiMarks

wdDialogFileSaveVersion

(none)

wdDialogFileSummaryInfo

Title , Subject, Author, Keywords, Comments, FileName, Directory, Template, CreateDate, LastSavedDate, LastSavedBy, RevisionNumber, EditTime, LastPrintedDate, NumPages, NumWords, NumChars, NumParas, NumLines, Update, FileSize

wdDialogFileVersions

AutoVersion , VersionDesc

wdDialogFitText

FitTextWidth

wdDialogFontSubstitution

UnavailableFont , SubstituteFont

wdDialogFormatAddrFonts

Points , Underline, Color, StrikeThrough, Superscript, Subscript, Hidden, SmallCaps, AllCaps, Spacing, Position, Kerning, KerningMin, Default, Tab, Font, Bold, Italic, DoubleStrikeThrough, Shadow, Outline, Emboss, Engrave, Scale, Animations, CharAccent, FontMajor, FontLowAnsi, FontHighAnsi, CharacterWidthGrid, ColorRGB, UnderlineColor, PointsBi, ColorBi, FontNameBi, BoldBi, ItalicBi, DiacColor

wdDialogFormatBordersAndShading

ApplyTo , Shadow, TopBorder, LeftBorder, BottomBorder, RightBorder, HorizBorder, VertBorder, TopColor, LeftColor, BottomColor, RightColor, HorizColor, VertColor, FromText, Shading, Foreground, Background, Tab, FineShading, TopStyle, LeftStyle, BottomStyle, RightStyle, HorizStyle, VertStyle, TopWeight, LeftWeight, BottomWeight, RightWeight, HorizWeight, VertWeight, BorderObjectType, BorderArtWeight, BorderArt, FromTextTop, FromTextBottom, FromTextLeft, FromTextRight, OffsetFrom, InFront, SurroundHeader, SurroundFooter, JoinBorder, LineColor, WhichPages, TL2BRBorder, TR2BLBorder, TL2BRColor, TR2BLColor, TL2BRStyle, TR2BLStyle, TL2BRWeight, TR2BLWeight, ForegroundRGB, BackgroundRGB, TopColorRGB, LeftColorRGB, BottomColorRGB, RightColorRGB, HorizColorRGB, VertColorRGB, TL2BRColorRGB, TR2BLColorRGB, LineColorRGB

wdDialogFormatBulletsAndNumbering

(none)

wdDialogFormatCallout

Type , Gap, Angle, Drop, Length, Border, AutoAttach, Accent

wdDialogFormatChangeCase

Type

wdDialogFormatColumns

Columns , ColumnNo, ColumnWidth, ColumnSpacing, EvenlySpaced, ApplyColsTo, ColLine, StartNewCol, FlowColumnsRtl

wdDialogFormatDefineStyleBorders

ApplyTo , Shadow, TopBorder, LeftBorder, BottomBorder, RightBorder, HorizBorder, VertBorder, TopColor, LeftColor, BottomColor, RightColor, HorizColor, VertColor, FromText, Shading, Foreground, Background, Tab, FineShading, TopStyle, LeftStyle, BottomStyle, RightStyle, HorizStyle, VertStyle, TopWeight, LeftWeight, BottomWeight, RightWeight, HorizWeight, VertWeight, BorderObjectType, BorderArtWeight, BorderArt, FromTextTop, FromTextBottom, FromTextLeft, FromTextRight, OffsetFrom, InFront, SurroundHeader, SurroundFooter, JoinBorder, LineColor, WhichPages, TL2BRBorder, TR2BLBorder, TL2BRColor, TR2BLColor, TL2BRStyle, TR2BLStyle, TL2BRWeight, TR2BLWeight, ForegroundRGB, BackgroundRGB, TopColorRGB, LeftColorRGB, BottomColorRGB, RightColorRGB, HorizColorRGB, VertColorRGB, TL2BRColorRGB, TR2BLColorRGB, LineColorRGB

wdDialogFormatDefineStyleFont

Points , Underline, Color, StrikeThrough, Superscript, Subscript, Hidden, SmallCaps, AllCaps, Spacing, Position, Kerning, KerningMin, Default, Tab, Font, Bold, Italic, DoubleStrikeThrough, Shadow, Outline, Emboss, Engrave, Scale, Animations, CharAccent, FontMajor, FontLowAnsi, FontHighAnsi, CharacterWidthGrid, ColorRGB, UnderlineColor, PointsBi, ColorBi, FontNameBi, BoldBi, ItalicBi, DiacColor

wdDialogFormatDefineStyleFrame

Wrap , WidthRule, FixedWidth, HeightRule, FixedHeight, PositionHorz, PositionHorzRel, DistFromText, PositionVert, PositionVertRel, DistVertFromText, MoveWithText, LockAnchor, RemoveFrame

wdDialogFormatDefineStyleLang

Language , CheckLanguage, Default, NoProof

wdDialogFormatDefineStylePara

LeftIndent , RightIndent, Before, After, LineSpacingRule, LineSpacing, Alignment, WidowControl, KeepWithNext, KeepTogether, PageBreak, NoLineNum, DontHyphen, Tab, FirstIndent, OutlineLevel, Kinsoku, WordWrap, OverflowPunct, TopLinePunct, AutoSpaceDE, LineHeightGrid, AutoSpaceDN, CharAlign, CharacterUnitLeftIndent, AdjustRight, CharacterUnitFirstIndent, CharacterUnitRightIndent, LineUnitBefore, LineUnitAfter, NoSpaceBetweenParagraphsOfSameStyle, OrientationBi

wdDialogFormatDefineStyleTabs

Position , DefTabs, Align, Leader, Set, Clear, ClearAll

wdDialogFormatDrawingObject

Left , PositionHorzRel, Top, PositionVertRel, LockAnchor, FloatOverText, LayoutInCell, WrapSide, TopDistanceFromText, BottomDistanceFromText, LeftDistanceFromText, RightDistanceFromText, Wrap, WordWrap, AutoSize, HRWidthType, HRHeight, HRNoshade, HRAlign, Text, AllowOverlap, HorizRule

wdDialogFormatDropCap

Position , Font, DropHeight, DistFromText

wdDialogFormatEncloseCharacters

Style , Text, Enclosure

wdDialogFormatFont

Points , Underline, Color, StrikeThrough, Superscript, Subscript, Hidden, SmallCaps, AllCaps, Spacing, Position, Kerning, KerningMin, Default, Tab, Font, Bold, Italic, DoubleStrikeThrough, Shadow, Outline, Emboss, Engrave, Scale, Animations, CharAccent, FontMajor, FontLowAnsi, FontHighAnsi, CharacterWidthGrid, ColorRGB, UnderlineColor, PointsBi, ColorBi, FontNameBi, BoldBi, ItalicBi, DiacColor

wdDialogFormatFrame

Wrap , WidthRule, FixedWidth, HeightRule, FixedHeight, PositionHorz, PositionHorzRel, DistFromText, PositionVert, PositionVertRel, DistVertFromText, MoveWithText, LockAnchor, RemoveFrame

wdDialogFormatPageNumber

ChapterNumber , NumRestart, NumFormat, StartingNum, Level, Separator, DoubleQuote, PgNumberingStyle

wdDialogFormatParagraph

LeftIndent , RightIndent, Before, After, LineSpacingRule, LineSpacing, Alignment, WidowControl, KeepWithNext, KeepTogether, PageBreak, NoLineNum, DontHyphen, Tab, FirstIndent, OutlineLevel, Kinsoku, WordWrap, OverflowPunct, TopLinePunct, AutoSpaceDE, LineHeightGrid, AutoSpaceDN, CharAlign, CharacterUnitLeftIndent, AdjustRight, CharacterUnitFirstIndent, CharacterUnitRightIndent, LineUnitBefore, LineUnitAfter, NoSpaceBetweenParagraphsOfSameStyle, OrientationBi

wdDialogFormatPicture

SetSize , CropLeft, CropRight, CropTop, CropBottom, ScaleX, ScaleY, SizeX, SizeY

wdDialogFormatRetAddrFonts

Points , Underline, Color, StrikeThrough, Superscript, Subscript, Hidden, SmallCaps, AllCaps, Spacing, Position, Kerning, KerningMin, Default, Tab, Font, Bold, Italic, DoubleStrikeThrough, Shadow, Outline, Emboss, Engrave, Scale, Animations, CharAccent, FontMajor, FontLowAnsi, FontHighAnsi, CharacterWidthGrid, ColorRGB, UnderlineColor, PointsBi, ColorBi, FontNameBi, BoldBi, ItalicBi, DiacColor

wdDialogFormatSectionLayout

SectionStart , VertAlign, Endnotes, LineNum, StartingNum, FromText, CountBy, NumMode, SectionType

wdDialogFormatStyle

Name , Delete, Merge, NewName, BasedOn, NextStyle, Type, FileName, Source, AddToTemplate, Define, Rename, Apply, New, Link

wdDialogFormatStyleGallery

Template , Preview

wdDialogFormatStylesCustom

(none)

wdDialogFormatTabs

Position , DefTabs, Align, Leader, Set, Clear, ClearAll

wdDialogFormatTheme

(none)

wdDialogFormFieldHelp

(none)

wdDialogFormFieldOptions

Entry , Exit, Name, Enable, TextType, TextWidth, TextDefault, TextFormat, CheckSize, CheckWidth, CheckDefault, Type, OwnHelp, HelpText, OwnStat, StatText, Calculate

wdDialogFrameSetProperties

(none)

wdDialogHelpAbout

APPNAME , APPCOPYRIGHT, APPUSERNAME, APPORGANIZATION, APPSERIALNUMBER

wdDialogHelpWordPerfectHelp

WPCommand , HelpText, DemoGuidance

wdDialogHelpWordPerfectHelpOptions

CommandKeyHelp , DocNavKeys, MouseSimulation, DemoGuidance, DemoSpeed, HelpType

wdDialogHorizontalInVertical

(none)

wdDialogIMESetDefault

(none)

wdDialogInsertAddCaption

Name

wdDialogInsertAutoCaption

Clear , ClearAll, Object, Label, Position

wdDialogInsertBookmark

Name , SortBy, Add, Delete, Goto, Hidden

wdDialogInsertBreak

Type

wdDialogInsertCaption

Label , TitleAutoText, Title, Delete, Position, AutoCaption, ExcludeLabel

wdDialogInsertCaptionNumbering

Label , FormatNumber, ChapterNumber, Level, Separator, CapNumberingStyle

wdDialogInsertCrossReference

ReferenceType , ReferenceKind, ReferenceItem, InsertAsHyperLink, InsertPosition, SeparateNumbers, SeparatorCharacters

wdDialogInsertDatabase

Format , Style, LinkToSource, Connection, SQLStatement, SQLStatement1, PasswordDoc, PasswordDot, DataSource, From, To, IncludeFields, WritePasswordDoc, WritePasswordDot

wdDialogInsertDateTime

DateTimePic , InsertAsField, DbCharField, DateLanguage, CalendarType

wdDialogInsertField

Field

wdDialogInsertFile

Name , Range, ConfirmConversions, Link, Attachment

wdDialogInsertFootnote

Reference , NoteType, Symbol, FootNumberAs, EndNumberAs, FootnotesAt, EndnotesAt, FootNumberingStyle, EndNumberingStyle, FootStartingNum, FootRestartNum, EndStartingNum, EndRestartNum, ApplyPropsTo

wdDialogInsertFormField

Entry , Exit, Name, Enable, TextType, TextWidth, TextDefault, TextFormat, CheckSize, CheckWidth, CheckDefault, Type, OwnHelp, HelpText, OwnStat, StatText, Calculate

wdDialogInsertHyperlink

(none)

wdDialogInsertIndex

Outline , Fields, From, To, TableId, AddedStyles, Caption, HeadingSeparator, Replace, MarkEntry, AutoMark, MarkCitation, Type, RightAlignPageNumbers, Passim, KeepFormatting, Columns, Category, Label, ShowPageNumbers, AccentedLetters, Filter, SortBy, Leader, TOCUseHyperlinks, TOCHidePageNumInWeb, IndexLanguage, UseOutlineLevel

wdDialogInsertIndexAndTables

Outline , Fields, From, To, TableId, AddedStyles, Caption, HeadingSeparator, Replace, MarkEntry, AutoMark, MarkCitation, Type, RightAlignPageNumbers, Passim, KeepFormatting, Columns, Category, Label, ShowPageNumbers, AccentedLetters, Filter, SortBy, Leader, TOCUseHyperlinks, TOCHidePageNumInWeb, IndexLanguage, UseOutlineLevel

wdDialogInsertMergeField

MergeField , WordField

wdDialogInsertNumber

NumPic

wdDialogInsertObject

IconNumber , FileName, Link, DisplayIcon, Tab, Class, IconFileName, Caption, Floating

wdDialogInsertPageNumbers

Type , Position, FirstPage

wdDialogInsertPicture

Name , LinkToFile, New, FloatOverText

wdDialogInsertSubdocument

Name , ConfirmConversions, ReadOnly, LinkToSource, AddToMru, PasswordDoc, PasswordDot, Revert, WritePasswordDoc, WritePasswordDot, Connection, SQLStatement, SQLStatement1, Format, Encoding, Visible, OpenExclusive, OpenAndRepair, SubType, DocumentDirection, NoEncodingDialog, XMLTransform

wdDialogInsertSymbol

Font , Tab, CharNum, CharNumLow, Unicode, Hint

wdDialogInsertTableOfAuthorities

Outline , Fields, From, To, TableId, AddedStyles, Caption, HeadingSeparator, Replace, MarkEntry, AutoMark, MarkCitation, Type, RightAlignPageNumbers, Passim, KeepFormatting, Columns, Category, Label, ShowPageNumbers, AccentedLetters, Filter, SortBy, Leader, TOCUseHyperlinks, TOCHidePageNumInWeb, IndexLanguage, UseOutlineLevel

wdDialogInsertTableOfContents

Outline , Fields, From, To, TableId, AddedStyles, Caption, HeadingSeparator, Replace, MarkEntry, AutoMark, MarkCitation, Type, RightAlignPageNumbers, Passim, KeepFormatting, Columns, Category, Label, ShowPageNumbers, AccentedLetters, Filter, SortBy, Leader, TOCUseHyperlinks, TOCHidePageNumInWeb, IndexLanguage, UseOutlineLevel

wdDialogInsertTableOfFigures

Outline , Fields, From, To, TableId, AddedStyles, Caption, HeadingSeparator, Replace, MarkEntry, AutoMark, MarkCitation, Type, RightAlignPageNumbers, Passim, KeepFormatting, Columns, Category, Label, ShowPageNumbers, AccentedLetters, Filter, SortBy, Leader, TOCUseHyperlinks, TOCHidePageNumInWeb, IndexLanguage, UseOutlineLevel

wdDialogInsertWebComponent

IconNumber , FileName, Link, DisplayIcon, Tab, Class, IconFileName, Caption, Floating

wdDialogLetterWizard

SenderCity , DateFormat, IncludeHeaderFooter, LetterStyle, Letterhead, LetterheadLocation, LetterheadSize, RecipientName, RecipientAddress, Salutation, SalutationType, RecipientGender, RecipientReference, MailingInstructions, AttentionLine, LetterSubject, CCList, SenderName, ReturnAddress, Closing, SenderJobTitle, SenderCompany, SenderInitials, EnclosureNumber, PageDesign, InfoBlock, SenderGender, ReturnAddressSF, RecipientCode, SenderCode, SenderReference

wdDialogListCommands

ListType

wdDialogMailMerge

CheckErrors , Destination, MergeRecords, From, To, Suppression, MailMerge, QueryOptions, MailSubject, MailAsAttachment, MailAddress

wdDialogMailMergeCheck

CheckErrors

wdDialogMailMergeCreateDataSource

FileName , PasswordDoc, PasswordDot, HeaderRecord, MSQuery, SQLStatement, SQLStatement1, Connection, LinkToSource, WritePasswordDoc

wdDialogMailMergeCreateHeaderSource

FileName , PasswordDoc, PasswordDot, HeaderRecord, MSQuery, SQLStatement, SQLStatement1, Connection, LinkToSource, WritePasswordDoc

wdDialogMailMergeFieldMapping

(none)

wdDialogMailMergeFindRecipient

(none)

wdDialogMailMergeFindRecord

Find , Field

wdDialogMailMergeHelper

Merge , Options

wdDialogMailMergeInsertAddressBlock

(none)

wdDialogMailMergeInsertAsk

Name , Prompt, DefaultBookmarkText, AskOnce

wdDialogMailMergeInsertFields

(none)

wdDialogMailMergeInsertFillIn

Prompt , DefaultFillInText, AskOnce

wdDialogMailMergeInsertGreetingLine

(none)

wdDialogMailMergeInsertIf

MergeField , Comparison, CompareTo, TrueAutoText, TrueText, FalseAutoText, FalseText

wdDialogMailMergeInsertNextIf

MergeField , Comparison, CompareTo

wdDialogMailMergeInsertSet

Name , ValueText, ValueAutoText

wdDialogMailMergeInsertSkipIf

MergeField , Comparison, CompareTo

wdDialogMailMergeOpenDataSource

Name , ConfirmConversions, ReadOnly, LinkToSource, AddToMru, PasswordDoc, PasswordDot, Revert, WritePasswordDoc, WritePasswordDot, Connection, SQLStatement, SQLStatement1, Format, Encoding, Visible, OpenExclusive, OpenAndRepair, SubType, DocumentDirection, NoEncodingDialog, XMLTransform

wdDialogMailMergeOpenHeaderSource

Name , ConfirmConversions, ReadOnly, LinkToSource, AddToMru, PasswordDoc, PasswordDot, Revert, WritePasswordDoc, WritePasswordDot, Connection, SQLStatement, SQLStatement1, Format, Encoding, Visible, OpenExclusive, OpenAndRepair, SubType, DocumentDirection, NoEncodingDialog, XMLTransform

wdDialogMailMergeQueryOptions

SQLStatement , SQLStatement1

wdDialogMailMergeRecipients

(none)

wdDialogMailMergeSetDocumentType

Type

wdDialogMailMergeUseAddressBook

AddressBookType

wdDialogMarkCitation

LongCitation , LongCitationAutoText, Category, ShortCitation, NextCitation, Mark, MarkAll

wdDialogMarkIndexEntry

MarkAll , Entry, Range, Bold, Italic, CrossReference, EntryAutoText, CrossReferenceAutoText, Yomi

wdDialogMarkTableOfContentsEntry

Entry , EntryAutoText, TableId, Level

wdDialogNewToolbar

Name , Context

wdDialogNoteOptions

FootnotesAt , FootNumberAs, FootStartingNum, FootRestartNum, EndnotesAt, EndNumberAs, EndStartingNum, EndRestartNum, FootNumberingStyle, EndNumberingStyle

wdDialogOrganizer

Copy , Delete, Rename, Source, Destination, Name, NewName, Tab

wdDialogPhoneticGuide

(none)

wdDialogReviewAfmtRevisions

(none)

wdDialogSearch

(none)

wdDialogShowRepairs

Name , SortBy, Add, Delete, GoTo, Hidden

wdDialogTableAutoFormat

HideAutoFit , Preview, Format, Borders, Shading, Font, Color, AutoFit, HeadingRows, FirstColumn, LastRow, LastColumn

wdDialogTableCellOptions

(none)

wdDialogTableColumnWidth

ColumnWidth , SpaceBetweenCols, PrevColumn, NextColumn, AutoFit, RulerStyle

wdDialogTableDeleteCells

ShiftCells

wdDialogTableFormatCell

Category

wdDialogTableFormula

Formula , NumFormat

wdDialogTableInsertCells

ShiftCells

wdDialogTableInsertRow

NumRows

wdDialogTableInsertTable

ConvertFrom , NumColumns, NumRows, InitialColWidth, Wizard, Format, Apply, AutoFit, SetDefault, Word8, Style

wdDialogTableOfCaptionsOptions

(none)

wdDialogTableOfContentsOptions

(none)

wdDialogTableProperties

TableDirection

wdDialogTableRowHeight

RulerStyle , LineSpacingRule, LineSpacing, LeftIndent, AllowRowSplit, Alignment, PrevRow, NextRow, TableDir

wdDialogTableSort

DontSortHdr , FieldNum, Type, Order, FieldNum2, Type2, Order2, FieldNum3, Type3, Order3, Separator, SortColumn, CaseSensitive, SortBiDi, IgnoreHe, Diacritics, IgnoreThe, Kashida, Language, UsingNum, UsingNum2, UsingNum3

wdDialogTableSplitCells

NumColumns , NumRows, MergeBeforeSplit

wdDialogTableTableOptions

(none)

wdDialogTableToText

ConvertTo , NestedTables

wdDialogTableWrapping

PositionHorz , PositionHorzRel, PositionVert, PositionVertRel, TopDistanceFromText, BottomDistanceFromText, LeftDistanceFromText, RightDistanceFromText, MoveWithText, AllowOverlap,

wdDialogTCSCTranslator

Direction , Varients, TranslateCommon

wdDialogTextToTable

ConvertFrom , NumColumns, NumRows, InitialColWidth, Wizard, Format, Apply, AutoFit, SetDefault, Word8, Style

wdDialogToolsAcceptRejectChanges

ShowMarks , HideMarks, Wrap, FindPrevious, FindNext, AcceptRevisions, RejectRevisions, AcceptAll, RejectAll

wdDialogToolsAdvancedSettings

Application , Option, Setting, Delete, Set

wdDialogToolsAutoCorrect

ShowFineTuner , CapTable, InWordMail, InitialCaps, SentenceCaps, Days, CapsLock, ReplaceText, Formatting, Replace, With, Add, Delete, SmartQuotes, CorrectHangulAndAlphabet, ConvBrackets, ConvQuotes, ConvPunct, ReplaceTextFromSpellingChecker

wdDialogToolsAutoCorrectExceptions

Tab , Name, AutoAdd, Add, Delete

wdDialogToolsAutoManager

Tab

wdDialogToolsAutoSummarize

TextSize , Show, Update

wdDialogToolsBulletsNumbers

Replace , Font, CharNum, Type, FormatOutline, AutoUpdate, FormatNumber, Punctuation, StartAt, Points, Hang, Indent, Remove, DoubleQuote

wdDialogToolsCompareDocuments

CompareDestination , DetectFormatting, IgnoreCompareWarn, UseFormatFrom, AddToMru, Merge, FilterPrivacy, FilterDateAndTime, Name, CompareAuthor

wdDialogToolsCreateDirectory

Directory

wdDialogToolsCreateEnvelope

ExtractAddress , LabelListIndex, LabelIndex, LabelDotMatrix, LabelTray, LabelAcross, LabelDown, EnvAddress, EnvOmitReturn, EnvReturn, PrintBarCode, SingleLabel, LabelRow, LabelColumn, PrintEnvLabel, AddToDocument, EnvWidth, EnvHeight, EnvPaperSize, PrintFIMA, UseEnvFeeder, Tab, AddrAutoText, AddrText, AddrFromLeft, AddrFromTop, RetAddrFromLeft, RetAddrFromTop, LabelTopMargin, LabelSideMargin, LabelVertPitch, LabelHorPitch, LabelHeight, LabelWidth, CustomName, RetAddrText, EnvPaperName, DefaultFaceUp, DefaultOrientation, RetAddrAutoText, VerticalEnvelope, VerticalLabel, RecipientNamefromLeft, RecipientNamefromTop, RecipientPostalfromLeft, RecipientPostalfromTop, SenderNamefromLeft, SenderNamefromTop, SenderPostalfromLeft, SenderPostalfromTop, PrintEPostage, PrintEPostageLabel

wdDialogToolsCreateLabels

ExtractAddress , LabelListIndex, LabelIndex, LabelDotMatrix, LabelTray, LabelAcross, LabelDown, EnvAddress, EnvOmitReturn, EnvReturn, PrintBarCode, SingleLabel, LabelRow, LabelColumn, PrintEnvLabel, AddToDocument, EnvWidth, EnvHeight, EnvPaperSize, PrintFIMA, UseEnvFeeder, Tab, AddrAutoText, AddrText, AddrFromLeft, AddrFromTop, RetAddrFromLeft, RetAddrFromTop, LabelTopMargin, LabelSideMargin, LabelVertPitch, LabelHorPitch, LabelHeight, LabelWidth, CustomName, RetAddrText, EnvPaperName, DefaultFaceUp, DefaultOrientation, RetAddrAutoText, VerticalEnvelope, VerticalLabel, RecipientNamefromLeft, RecipientNamefromTop, RecipientPostalfromLeft, RecipientPostalfromTop, SenderNamefromLeft, SenderNamefromTop, SenderPostalfromLeft, SenderPostalfromTop, PrintEPostage, PrintEPostageLabel

wdDialogToolsCustomize

KeyCode , KeyCode2, MenuType, Position, AddAll, Category, Name, Menu, AddBelow, MenuText, Rename, Add, Remove, ResetAll, CommandValue, Context, Tab

wdDialogToolsCustomizeKeyboard

KeyCode , KeyCode2, MenuType, Position, AddAll, Category, Name, Menu, AddBelow, MenuText, Rename, Add, Remove, ResetAll, CommandValue, Context, Tab

wdDialogToolsCustomizeMenuBar

Context , Position, MenuType, MenuText, Menu, Add, Remove, Rename

wdDialogToolsCustomizeMenus

KeyCode , KeyCode2, MenuType, Position, AddAll, Category, Name, Menu, AddBelow, MenuText, Rename, Add, Remove, ResetAll, CommandValue, Context, Tab

wdDialogToolsEnvelopesAndLabels

ExtractAddress , LabelListIndex, LabelIndex, LabelDotMatrix, LabelTray, LabelAcross, LabelDown, EnvAddress, EnvOmitReturn, EnvReturn, PrintBarCode, SingleLabel, LabelRow, LabelColumn, PrintEnvLabel, AddToDocument, EnvWidth, EnvHeight, EnvPaperSize, PrintFIMA, UseEnvFeeder, Tab, AddrAutoText, AddrText, AddrFromLeft, AddrFromTop, RetAddrFromLeft, RetAddrFromTop, LabelTopMargin, LabelSideMargin, LabelVertPitch, LabelHorPitch, LabelHeight, LabelWidth, CustomName, RetAddrText, EnvPaperName, DefaultFaceUp, DefaultOrientation, RetAddrAutoText, VerticalEnvelope, VerticalLabel, RecipientNamefromLeft, RecipientNamefromTop, RecipientPostalfromLeft, RecipientPostalfromTop, SenderNamefromLeft, SenderNamefromTop, SenderPostalfromLeft, SenderPostalfromTop, PrintEPostage, PrintEPostageLabel

wdDialogToolsGrammarSettings

Options

wdDialogToolsHangulHanjaConversion

(none)

wdDialogToolsHighlightChanges

MarkRevisions , ViewRevisions, PrintRevisions, AcceptAll, RejectAll

wdDialogToolsHyphenation

AutoHyphenation , HyphenateCaps, HyphenationZone, LimitConsecutiveHyphens

wdDialogToolsLanguage

Language , CheckLanguage, Default, NoProof

wdDialogToolsMacro

Name , Run, Edit, Show, Delete, Rename, Description, NewName, SetDesc

wdDialogToolsMacroRecord

(This dialog box cannot be called from a macro.)

wdDialogToolsManageFields

FieldName , Add, Remove, Rename, NewName

wdDialogToolsMergeDocuments

Name

wdDialogToolsOptions

Tab

wdDialogToolsOptionsAutoFormat

ApplyStylesLists , ApplyBulletedLists, ApplyStylesOtherParas, ReplaceQuotes, ReplaceOrdinals, ReplaceFractions, ReplaceSymbols, ReplacePlainTextEmphasis, ReplaceHyperlinks, PreserveStyles, PlainTextWordMail, ApplyFirstIndent, MatchParentheses, ReplaceDbDashes, ReplaceAutoSpaces

wdDialogToolsOptionsAutoFormatAsYouType

cmntrInWordMail , ApplyStylesHeadings, ApplyStylesHeadings, ApplyBorders, ApplyTables, ApplyDates, ApplyBulletedLists, ApplyNumberedLists, ApplyFirstIndent, ApplyClosings, ReplaceQuotes, ReplaceOrdinals, ReplaceFractions, ReplaceSymbols, ReplacePlainTextEmphasis, ReplaceHyperlinks, MatchParentheses, ReplaceAutoSpaces, ReplaceDbDashes, FormatListItemBeginning, TabIndent, DefineStyles, InsertOvers, InsertClosings, AutoLetterWizard, ShowOptionsFor, ApplyStylesLists, ApplySkipList, ApplyStylesOtherParas, ReplaceBullets, AdjustParaMarks, AdjustTabsSpaces, AdjustEmptyParas, PreserveStyles

wdDialogToolsOptionsBidi

DocViewDir , AddCtrlCopy, HebDoubleQuote, Numbers, Move, Sel, BiDirectional, ShowDiac, DiffDiacColor, Date, AdvanceHijri, MasterDocDir, OutlineDir, DiacriticColorVal, SequenceCheck, TypeNReplace

wdDialogToolsOptionsCompatibility

Product , Default, NoTabHangIndent, NoSpaceRaiseLower, PrintColBlack, WrapTrailSpaces, NoColumnBalance, ConvMailMergeEsc, SuppressSpBfAfterPgBrk, SuppressTopSpacing, OrigWordTableRules, TransparentMetafiles, ShowBreaksInFrames, SwapBordersFacingPages, LeaveBackslashAlone, ExpandShiftReturn, DontULTrailSpace, DontBalanceSbDbWidth, SuppressTopSpacingMac5, SpacingInWholePoints, PrintBodyTextBeforeHeader, NoLeading, NoSpaceForUL, MWSmallCaps, NoExtraLineSpacing, TruncateFontHeight, SubFontBySize, UsePrinterMetrics, WW6BorderRules, ExactOnTop, SuppressBottomSpacing, WPSpaceWidth, WPJustification, LineWrapLikeWord6, SpLayoutLikeWW8, FtnLayoutLikeWW8, DontUseHTMLParagraphAutoSpacing, DontAdjustLineHeightInTable, ForgetLastTabAlignment, UseAutospaceForFullWidthAlpha, AlignTablesRowByRow, LayoutRawTableWidth, LayoutTableRowsApart, UseWord97LineBreakingRules, DontBreakWrappedTables, DontSnapToGridInCell, DontAllowFieldEndSelect, ApplyBreakingRules, DontWrapTextWithPunct, DontUseAsianBreakRules, UseWord2002TableStyleRules, GrowAutofit

wdDialogToolsOptionsEdit

ReplaceSelection , DragAndDrop, AutoWordSelection, InsForPaste, Overtype, SmartCursoring, SmartCutPaste, AllowAccentedUppercase, PictureEditor, TabIndent, BsParaAlign, InlineConversion, IMELosingFocus, AllowClickAndTypeMouse, ClickAndTypeParagraphStyle, AutoKeyBi, PictureWrapType, SmartParaSelection, HypCtrlClickFollow, PasteRecovery, PromptUpdateStyle, FormatScanning, ShowFormatError

wdDialogToolsOptionsEditCopyPaste

SmartSentenceWordSpacing , SmartParaPaste, SmartTablePaste, SmartStylePaste, FormatPowerpointPaste, FormatExcelPaste, PasteMergeLists, CopyPasteDefaultOptions

wdDialogToolsOptionsFileLocations

Path , Setting

wdDialogToolsOptionsFuzzy

FuzzyCase , FuzzyByte, FuzzyHira, FuzzySmKana, FuzzyMinus, FuzzyRepSymbol, FuzzyKanji, FuzzyOldKana, FuzzyLongVowel, FuzzyDZ, FuzzyBV, FuzzyTC, FuzzyHF, FuzzyZJ, FuzzyAY, FuzzyKIKU, FuzzyPunct, FuzzySpace

wdDialogToolsOptionsGeneral

Pagination , WPHelp, WPDocNavKeys, BlueScreen, ErrorBeeps, Effects3d, UpdateLinks, SendMailAttach, RecentFiles, RecentFileCount, Units, ButtonFieldClicks, ShortMenuNames, RTFInClipboard, ConfirmConversions, TipWizardActive, AnimatedCursors, VirusProtection, SeparateFont, InterpretHIANSIToDBC, ExitWithRestoreSession, AsianText, PixelsInDialogs, UseCharacterUnit, BackgroundOpen, AutoCreateNewDrawings, AllowReadingMode

wdDialogToolsOptionsPrint

Draft , Reverse, UpdateFields, Summary, ShowCodes, Annotations, ShowHidden, EnvFeederInstalled, WidowControl, DfltTrueType, UpdateLinks, Background, DrawingObjects, FormsData, DefaultTray, PSOverText, MapPaperSize, FractionalWidths, PrOrder1, PrOrder2, PrintXmlTags, Backgrounds

wdDialogToolsOptionsSave

CreateBackup , FastSaves, SummaryPrompt, GlobalDotPrompt, NativePictureFormat, EmbedFonts, FormsData, AutoSave, SaveInterval, Password, WritePassword, RecommendReadOnly, SubsetFonts, BackgroundSave, DefaultSaveFormat, AddCtrlSave, DoNotEmbed, LocalNetworkFile, WordCompatibilityList, EmbedSmartTags, SmartTagXML, EmbedLinguisticData

wdDialogToolsOptionsSecurity

WarnMarkup , StoreRsid, ShowMarkupOpenSave

wdDialogToolsOptionsSmartTag

LabelSmartTags , ShowSmartTagOOUI

wdDialogToolsOptionsSpellingAndGrammar

AlwaysSuggest , SuggestFromMainDictOnly, IgnoreAllCaps, IgnoreMixedDigits, ResetIgnoreAll, Type, CustomDict1, CustomDict2, CustomDict3, CustomDict4, CustomDict5, CustomDict6, CustomDict7, CustomDict8, CustomDict9, CustomDict10, AutomaticSpellChecking, FilenamesEmailAliases, UserDict1, AutomaticGrammarChecking, ForegroundGrammar, ShowStatistics, Options, RecheckDocument, IgnoreAuxFind, IgnoreMissDictSearch, HideGrammarErrors, CheckSpelling, GrLidUI, SpLidUI, DictLang1, DictLang2, DictLang3, DictLang4, DictLang5, DictLang6, DictLang7, DictLang8, DictLang9, DictLang10, HideSpellingErrors, HebSpellStart, InitialAlefHamza, FinalYaa, GermanPostReformSpell, AraSpeller, ProcessCompoundNoun

wdDialogToolsOptionsTrackChanges

InsertedTextMark , InsertedTextColor, DeletedTextMark, DeletedTextColor, RevisedLinesMark, RevisedLinesColor, HighlightColor, RevisedPropertiesMark, RevisedPropertiesColor

wdDialogToolsOptionsTypography

KerningPairs , Justification, PunctLevel, FollowingPunct, LeadingPunct, ApplyToTemplate, JapaneseKinsokuStrict, FarEastLineBreakLanguage

wdDialogToolsOptionsUserInfo

Name , Initials, Address

wdDialogToolsOptionsView

DraftFont , WrapToWindow, PicturePlaceHolders, FieldCodes, BookMarks, FieldShading, StatusBar, HScroll, VScroll, StyleAreaWidth, Tabs, Spaces, Paras, Hyphens, Hidden, ShowAll, Drawings, Anchors, TextBoundaries, VRuler, Highlight, ShowAnimation, ScrnTp, LeftScroll, RRuler, OptionalBreak, EnlargeFontsLessThan, BrowseToWindow, PageBoundaries, WindowsInTaskbar, SmartTags, ShowAtStartup, Backgrounds

wdDialogToolsProtectDocument

DocumentPassword , NoReset, Type, UseDRM

wdDialogToolsProtectSection

Protect , Section

wdDialogToolsRevisions

MarkRevisions , ViewRevisions, PrintRevisions, AcceptAll, RejectAll

wdDialogToolsSpellingAndGrammar

SuggestionListBox , ForegroundGrammar

wdDialogToolsTemplates

Store , Template, LinkStyles

wdDialogToolsThesaurus

(none)

wdDialogToolsUnprotectDocument

DocumentPassword

wdDialogToolsWordCount

CountFootnotes , Pages, Words, Characters, DBCs, SBCs, CharactersIncludingSpaces, Paragraphs, Lines

wdDialogTwoLinesInOne

(none)

wdDialogUpdateTOC

(none)

wdDialogViewZoom

AutoFit , TwoPages, FullPage, NumColumns, NumRows, ZoomPercent, TextFit

wdDialogWebOptions

(none)

wdDialogWindowActivate

Window


Communicating with Other Applications

 Copy code hover
[image]

Communicating with Other Applications
Send feedback

In addition to working with Microsoft Word data, you may want your application to exchange data with other applications, such as Microsoft Excel, Microsoft PowerPoint, or Microsoft Access. You can communicate with other applications by using Automation (formerly OLE Automation) or dynamic data exchange (DDE).

Automating Word from another application

Automation allows you to return, edit, and export data by referencing another application's objects, properties, and methods. Application objects that can be referenced by another application are called Automation objects.

The first step toward making Microsoft Word available to another application for Automation is to make a reference to the Word Application object. In Microsoft Visual Basic, you use the Visual Basic CreateObject or GetObject function to return a reference to the Word Application object. For example, in a Microsoft Office Excel procedure, you could use the following instruction.

Copy code Copy code
Set wrd = CreateObject("Word.Application")

This instruction makes the Application object in Word available for Automation. Using the objects, properties, and methods of the Word Application object, you can control Word. For example, the following instruction creates a new Word document.

Copy code Copy code
wrd.Documents.Add

Use the Visible property to make the new document visible after creating it.

Copy code Copy code
wrd.Visible = True

The CreateObject function starts a Word session that Automation will not close when the object variable that references the Application object expires. Setting the object reference to the Visual Basic Nothing keyword will not close Word. Instead, use the Quit method to close the Word application. The following Microsoft Excel example displays the Word startup path. The Quit method is used to close the new instance of Word after the startup path is displayed.

Copy code Copy code
Set wrd = CreateObject("Word.Application")
MsgBox wrd.Options.DefaultFilePath(wdStartupPath)
wrd.Quit

Automating another application from Word

To exchange data with another application using Automation from Word, you first obtain a reference to the application using the CreateObject or GetObject function. Then, using the objects, properties, and methods of the other application, you add, change, or delete information. When you finish making your changes, close the application. The following Word example displays the Microsoft Excel startup path. You can use the Visual Basic Set statement with the Nothing keyword to clear an object variable, which has the same effect as closing the application.

Copy code Copy code
Set myobject = CreateObject("Excel.Application")
MsgBox myobject.StartupPath
Set myobject = Nothing

Using dynamic data exchange (DDE)

If an application does not support Automation, DDE may be an alternative. DDE is a protocol that permits two applications to communicate by continuously and automatically exchanging data through a DDE "channel." To control a DDE conversation between two applications, you establish a channel, select a topic, request and send data, and then close the channel. The following table lists the tasks that Word performs with DDE and the methods used to control each task in Visual Basic.

Security note Security Note
Dynamic data exchange (DDE) is an older technology that is not secure. If possible, use a more secure alternative to DDE, such as object linking and embedding (OLE).

Task | Method
Starting DDE | DDEInitiate
Getting text from another application | DDERequest
Sending text to another application | DDEPoke
Carrying out a command in another application | DDEExecute
Close DDE channel | DDETerminate
Close all DDE channels | DDETerminateAll


Conceptual Differences Between WordBasic and Visual Basic

 Copy code hover
[image]

Conceptual Differences Between WordBasic and Visual Basic
Send feedback

The primary difference between Microsoft Visual Basic for Applications (VBA) and Microsoft WordBasic is that, whereas the WordBasic language consists of a flat list of approximately 900 commands, Visual Basic consists of a hierarchy of objects, each of which exposes a specific set of methods and properties (similar to statements and functions in WordBasic). While most WordBasic commands can be run at any time, Visual Basic only exposes the methods and properties of the available objects at a given time.

Objects are the fundamental building blocks of Visual Basic; almost everything you do in Visual Basic involves modifying objects. Every element of Microsoft Word—such as documents, paragraphs, fields, and bookmarks—can be represented by an object in Visual Basic. Unlike commands in a flat list, there are objects that can only be accessed from other objects. For example, the Font object can be accessed from various objects, including the Style, Selection, and Find objects.

The programming task of applying bold formatting demonstrates the differences between the two programming languages. The following WordBasic instruction applies bold formatting to the selection.

Copy code Copy code
Bold 1

The following example is the Visual Basic equivalent for applying bold formatting to the selection.

Copy code Copy code
Selection.Font.Bold = True

Visual Basic does not include a Bold statement and function. Instead, there is a Bold property. (A property is usually an attribute of an object, such as its size, its color, or whether or not it is bold.) Bold is a property of the Font object. Likewise, Font is a property of the Selection object that returns a Font object. Following the object hierarchy, you can build the instruction to apply bold formatting to the selection.

The Bold property is a read/write Boolean property. This means that the Bold property can be set to True or False (on or off), or the current value can be returned. The following WordBasic instruction returns a value indicating whether bold formatting is applied to the selection.

Copy code Copy code
x = Bold()

The following example is the Visual Basic equivalent for returning the bold formatting status from the selection.

Copy code Copy code
x = Selection.Font.Bold

The Visual Basic thought process

To perform a task in Visual Basic, you need to determine the appropriate object. For example, if you want to apply character formatting found in the Font dialog box, use the Font object. Then you need to determine how to "drill down" through the Word object hierarchy from the Application object to the Font object, through the objects that contain the Font object you want to modify. After you have determined the path to your object (for example, ), use the Object Browser, Help, or the features such as Auto List Members in the Visual Basic Editor to determine what properties and methods can be applied to the object. For more information about drilling down to objects using properties and methods, see Understanding Objects, Properties, and Methods.

Properties and methods are often available to multiple objects in the Word object hierarchy. For example, the following instruction applies bold formatting to the entire document.

Copy code Copy code
ActiveDocument.Content.Bold = True

Also, objects themselves often exist in more than one place in the object hierarchy.

The Selection and Range objects

Most WordBasic commands modify the selection. For example, the Bold command formats the selection with bold formatting. The InsertField command inserts a field at the insertion point. When you want to work with the selection in Visual Basic, you use the Selection property to return the Selection object. The selection can be a block of text or just the insertion point.

The following Visual Basic example inserts text and a new paragraph after the selection.

Copy code Copy code
Selection.InsertAfter Text:="Hello World"
Selection.InsertParagraphAfter

In addition to working with the selection, you can define and work with various ranges of text in a document. A Range object refers to a contiguous area in a document with a starting character position and an ending character position. Similar to the way bookmarks are used in a document, Range objects are used in Visual Basic to identify portions of a document. However, unlike a bookmark, a Range object is invisible to the user unless the Range has been selected using the Select method. For example, you can use Visual Basic to apply bold formatting anywhere in the document without changing the selection. The following example applies bold formatting to the first 10 characters in the active document.

Copy code Copy code
ActiveDocument.Range(Start:=0, End:=10).Bold = True

The following example applies bold formatting to the first paragraph.

Copy code Copy code
ActiveDocument.Paragraphs(1).Range.Bold = True

Both of these example change the formatting in the active document without changing the selection. For more information about the Range object, see Working with Range objects.


Control and Dialog Box Events (Word)

 Copy code hover
[image]

Control and Dialog Box Events (Word)
Send feedback

After you have added ActiveX controls to your dialog box or document, you add event procedures to determine how the controls respond to user actions.

UserForms and controls have a predefined set of events. For example, a command button has a Click event that occurs when the user clicks the command button, and UserForms have an Initialize event that runs when the form is loaded.

To write a control or form event procedure, open a module by double-clicking the form or control, and then select the event from the Procedure drop-down list box.

Event procedures include the name of the control. For example, the name of the Click event procedure for a command button named Command1 is Command1_Click.

If you add code to an event procedure and then change the name of the control, your code remains in procedures with the previous name.

For example, assume you add code to the Click event for Commmand1 and then rename the control to Command2. When you double-click Command2, you will not see any code in the Click event procedure. You will need to move code from Command1_Click to Command2_Click.

To simplify development, it is a good practice to name your controls before writing code.


Converting WordBasic Macros to Visual Basic

 Copy code hover
[image]

Converting WordBasic Macros to Visual Basic
Send feedback

Microsoft Office Word 2003 and Microsoft Office Word 2007 automatically convert the macros in a Word 6.x or Word 95 template the first time you do any of the following:

  • Open the template

  • Create a document based on the template

  • Manually attach the template to a document

A message is displayed on the status bar while the macros are being converted. After the conversion is complete, you must save the template to save the converted macros. If you don't save the template, Word converts the macros again the next time you use the template.

Note Note

Word cannot convert Word 2.x macros directly. Instead, you need to open and save your Word 2.x templates in Word 6.x or Word 95 and then open them in Word.

The conversion process converts each macro to a Microsoft Visual Basic module. To see the converted macros, press Alt-F8. The macro names in the Macros dialog box appear as macroname.Main, where Main refers to the main subroutine in the converted macro (the subroutine that began with Sub MAIN in earlier versions of Word). To edit the converted macro, select a macro name and click Edit to display the Visual Basic module in the Visual Basic Editor.

Each WordBasic statement is modified to work with Visual Basic for Applications. The converted WordBasic macros are functionally equivalent to new Visual Basic for Applications macros you might write or record, but they are not identical. The following example is a WordBasic macro in a Word 95 template.

Copy code Copy code
Sub MAIN
FormatFont .Name = "Arial", .Points = 10
Insert "Hello World"
End Sub

When the template is opened in Word, the macro is converted to the following code.

Copy code Copy code
Public Sub Main()
WordBasic.FormatFont Font:="Arial", Points:=10
WordBasic.Insert "Hello World"
End Sub

Each statement in the converted macro begins with the WordBasic property. WordBasic is a property in the Word object model that returns an object with all the WordBasic statements and functions; this object makes it possible to run WordBasic macros in Word.

Note Note

If you save the template over the original template, the WordBasic macros will be permanently lost and previous versions of Word will not be able to use the converted macros.

The following Visual Basic macro is functionally the same as the preceding WordBasic macro, but does not use the WordBasic property.

Copy code Copy code
Public Sub Main()
 With Selection.Font
 .Name = "Arial"
 .Size = 10
 End With
 Selection.TypeText Text:="Hello World"
End Sub


Creating a Custom Dialog Box

 Copy code hover
[image]

Creating a Custom Dialog Box
Send feedback

Use the following procedure to create a custom dialog box:

  1. Create a UserForm

    On the Insert menu in the Microsoft Visual Basic Editor, click UserForm.

  2. Add controls to the UserForm

    Find the control you want to add in the Toolbox and drag the control onto the form.

  3. Set control properties

    Right-click a control in design mode and click Properties to display the Properties window.

  4. Initialize the controls

    You can initialize controls in a procedure before you show a form, or you can add code to the Initialize event of the form.

  5. Write event procedures

    All controls have a predefined set of events. For example, a command button has a Click event that occurs when the user clicks the command button. You can write event procedures that run when the events occur.

  6. Show the dialog box

    Use the Show method to display a UserForm.

  7. Use control values while code is running

    Some properties can be set at run time. Values the user sets for controls in the dialog box are lost when the dialog box is closed.


Creating a UserForm

 Copy code hover
[image]

Creating a UserForm
Send feedback

To create a custom dialog box, you must create a UserForm. To create a UserForm, click UserForm on the Insert menu in the Visual Basic Editor.

Use the Properties window to change the name, behavior, and appearance of the form. For example, to change the caption on a form, set the Caption property.


Creating Frames Pages

 Copy code hover
[image]

Creating Frames Pages
Send feedback

In Microsoft Word, you can use frames in your Web page design to make your information organized and easy to access. A frames page, also called a frameset, is a Web page that is divided into two or more sections, each of which points to another Web page. A frame on a frames page can also point to another frames page. For information about creating frames and frames pages in the Word user interface, see Microsoft Word Help.

Frames and frames pages are created with a series of HTML tags. The Visual Basic object model for working with frames and frames pages is best understood by examining their HTML tags.

Frames pages in HTML

In HTML, frames pages and the frames they contain are built using a hierarchical set of <FRAMESET> and <FRAME> tags. A frameset can contain both frames and other framesets. For example, the following HTML creates a frameset with a frame on top and a frameset immediately below it. That frameset contains a frame on the left and a frameset on the right. That frameset contains two frames, one on top of the other.

XML Copy code Copy code
<FRAMESET ROWS="100, *">
    <FRAME NAME=top SRC="banner.htm">
    <FRAMESET COLS="20%, *">
        <FRAME NAME=left SRC="contents.htm">
        <FRAMESET ROWS="75%, *">
            <FRAME NAME=main SRC="main.htm">
            <FRAME NAME=bottom SRC="footer.htm">
        </FRAMESET>
    </FRAMESET>
</FRAMESET>
Note Note

To better understand the preceding HTML example, paste the example into a blank text document, rename the document "framespage.htm", and open the document in Word or in a Web browser.

The Frameset Object

The Frameset object encompasses the functionality of both tags. Each Frameset object is either of type wdFramesetTypeFrameset or wdFramesetTypeFrame, which represent the HTML tags <FRAMESET> and <FRAME> respectively. Properties beginning with "Frameset" apply to Frameset objects of type wdFramesetTypeFrameset (FramesetBorderColor and FramesetBorderWidth . Properties beginning with "Frame" apply to Frameset objects of type wdFramesetTypeFrame (FrameDefaultURL, FrameDisplayBorders, FrameLinkToFile, FrameName, FrameResizable, and FrameScrollBarType).

Traversing the Frameset Object Hierarchy

Because frames pages are defined as a hierarchical set of HTML tags, the object model for accessing Frameset objects is also hierarchical. Use the ChildFramesetItem and ParentFrameset properties to traverse the hierarchy of Frameset objects. For example,

VBA Copy code Copy code
MyFrameset.ChildFramesetItem(n)

returns a Frameset object corresponding to the nth first-level <FRAMESET> or <FRAME> tag between the <FRAMESET> and </FRAMESET> tags corresponding to MyFrameset.

If MyFrameset is a Frameset object corresponding to the outermost <FRAMESET> tags in the preceding HTML example, MyFrameset.ChildFramesetItem(1) returns a Frameset object of type wdFramesetTypeFrame that corresponds to the frame named "top." Similarly, MyFrameset.ChildFramesetItem(2) returns a Frameset object of type wdFramesetTypeFrameset, itself containing two Frameset objects: the first object corresponds to the frame named "left," the second is of type wdFramesetTypeFrameset.

Frameset objects of type wdFramesetTypeFrame have no child frames, while objects of wdFramesetTypeFrameset have at least one.

The following Visual Basic example displays the names of the four frames defined in the preceding HTML example.

VBA Copy code Copy code
Dim MyFrameset As Frameset
Dim Name1 As String
Dim Name2 As String
Dim Name3 As String
Dim Name4 As String

Set MyFrameset = ActiveWindow.Document.Frameset

With MyFrameset
    Name1 = .ChildFramesetItem(1).FrameName
    With .ChildFramesetItem(2)
        Name2 = .ChildFramesetItem(1).FrameName
        With .ChildFramesetItem(2)
            Name3 = .ChildFramesetItem(1).FrameName
            Name4 = .ChildFramesetItem(2).FrameName
        End With
    End With
End With

Debug.Print Name1, Name2, Name3, Name4

Individual Frames and the Entire Frames Page

To return the Frameset object associated with a particular frame on a frames page, use the Frameset property of a Pane object. For example,

VBA Copy code Copy code
ActiveWindow.Panes(1).Frameset

returns the Frameset object that corresponds to the first frame of the frames page.

The frames page is itself a document separate from the documents that make up the content of the individual frames. The Frameset object associated with a frames page is accessed from its corresponding Document object, which in turn is accessed from the Window object in which the frames page appears. For example,

VBA Copy code Copy code
ActiveWindow.Document.Frameset

returns the Frameset object for the frames page in the active window.

Note Note

When working with frames pages, the ActiveDocument property returns the Document object associated with the frame in the active pane, not the entire frames page.

Creating a Frames Page and Its Content from Scratch

This example creates a new frames page with three frames, adds text to each frame, and sets the background color for each frame. It inserts two hyperlinks into the Left frame: the first hyperlink opens a document called One.htm in the Main frame, and the second opens a document called Two.htm in the entire window. For these hyperlinks to work, you must create files called One.htm and Two.htm or change the strings to the names of existing files.

Note Note

As each frame is created, Word creates a new document whose content will be loaded into the new frame. The example saves the frames page which automatically saves the documents associated with each of the three frames.
VBA Copy code Copy code
Sub FramesetExample1()

    ' Create new frames page.
    Documents.Add DocumentType:=wdNewFrameset

    With ActiveWindow
        ' Add text and color to first frame.
        Selection.TypeText Text:="BANNER FRAME"
        With ActiveDocument.Background.Fill
            .ForeColor.RGB = RGB(204, 153, 255)
            .Visible = msoTrue
        End With

        ' Add new frame below top frame.
        .ActivePane.Frameset.AddNewFrame _
            wdFramesetNewFrameBelow
        ' Add text and color to bottom frame.
        .ActivePane.Frameset.FrameName = "main"
        Selection.TypeText Text:="MAIN FRAME"
        With ActiveDocument.Background.Fill
            .ForeColor.RGB = RGB(0, 128, 128)
            .Visible = msoTrue
        End With

        ' Add new frame to left of bottom frame.
        .ActivePane.Frameset.AddNewFrame _
            wdFramesetNewFrameLeft
        ' Set the width to 25% of the window width.
        With .ActivePane.Frameset
            .WidthType = wdFramesetSizeTypePercent
            .Width = 25
            .FrameName = "left"
        End With
        ' Add text and color to left frame.
        Selection.TypeText Text:="LEFT FRAME"
        With ActiveDocument.Background.Fill
            .ForeColor.RGB = RGB(204, 255, 255)
            .Visible = msoTrue
        End With
        Selection.TypeParagraph
        Selection.TypeParagraph
        ' Add hyperlinks to left frame.
        With ActiveDocument.Hyperlinks
            .Add Anchor:=Selection.Range, _
                Address:="one.htm", Target:="main"
            Selection.TypeParagraph
            Selection.TypeParagraph
            .Add Anchor:=Selection.Range, _
                Address:="two.htm", Target:="_top"
        End With

        ' Activate top frame.
        .Panes(1).Activate
        ' Set the height to 1 inch.
        With .ActivePane.Frameset
            .HeightType = wdFramesetSizeTypeFixed
            .Height = InchesToPoints(1)
            .FrameName = "top"
        End With

        ' Save the frames page and its associated files.
        .Document.SaveAs FileName:="default.htm", _
            FileFormat:=wdFormatHTML
    End With

End Sub

Creating a Frames Page that Displays Content from Existing Files

This example creates a frames page similar to the one above, but sets the default URL for each frame to an existing document so that the content of that document is displayed in the frame. For this example to work, you must create files called Main.htm, Left.htm, and Banner.htm or change the strings in the example to the names of existing files.

VBA Copy code Copy code
Sub FramesetExample2()

    ' Create new frames page.
    Documents.Add DocumentType:=wdNewFrameset

    With ActiveWindow
        ' Add new frame below top frame.
        .ActivePane.Frameset.AddNewFrame _
            wdFramesetNewFrameBelow
        ' Set the name and initial page for the frame.
        With .ActivePane.Frameset
            .FrameName = "main"
            .FrameDefaultURL = "main.htm"
        End With

        ' Add new frame to left of bottom frame.
        .ActivePane.Frameset.AddNewFrame _
            wdFramesetNewFrameLeft
        With .ActivePane.Frameset
            ' Set the width to 25% of the window width.
            .WidthType = wdFramesetSizeTypePercent
            .Width = 25
            ' Set the name and initial page for the frame.
            .FrameName = "left"
            .FrameDefaultURL = "left.htm"
        End With

        ' Activate top frame.
        .Panes(1).Activate
        With .ActivePane.Frameset
            ' Set the height to 1 inch.
            .HeightType = wdFramesetSizeTypeFixed
            .Height = InchesToPoints(1)
            ' Set the name and initial page for the frame.
            .FrameName = "top"
            .FrameDefaultURL = "banner.htm"
        End With

        ' Save the frameset.
        .Document.SaveAs FileName:="default.htm", _
            FileFormat:=wdFormatHTML
    End With

End Sub


Determining Whether the Application Property Is Necessary

 Copy code hover
[image]

Determining Whether the Application Property Is Necessary
Send feedback

Many of the properties and methods of the Application object can be used without the Application object qualifier. For example the ActiveDocument property can be used without the Application object qualifier. Instead of writing Application.ActiveDocument.PrintOut, you can write ActiveDocument.PrintOut.

Properties and methods that can be used without the Application object qualifier are considered "global." To view the global properties and methods in the Object Browser, click <globals> at the top of the list in the Classes box.


Displaying a Custom Dialog Box (Word)

 Copy code hover
[image]

Displaying a Custom Dialog Box (Word)
Send feedback

To test your dialog box in the Visual Basic Editor, click Run Sub/UserForm on the Run menu.

To display a dialog box from Visual Basic, use the Show method. The following example displays the dialog box named UserForm1.

Copy code Copy code
Private Sub GetUserName()
 UserForm1.Show
End Sub
Note Note

Use the Unload method in an event procedure, such as the Click event procedure for a command button, to close a dialog box.


Displaying Built-in Word Dialog Boxes

 Copy code hover
[image]

Displaying Built-in Word Dialog Boxes
Send feedback

This topic contains the following information and examples:

  • Showing a built-in dialog box

  • Returning and changing dialog box settings

  • Checking how a dialog box was closed

Showing a built-in dialog box

You can display a built-in dialog box to get user input or to control Microsoft Word by using Microsoft Visual Basic for Applications (VBA). The Show method of the Dialog object displays and executes any action taken in a built-in Word dialog box. To access a particular built-in Word dialog box, you specify a WdWordDialog constant with the Dialogs property. For example, the following macro instruction displays the Open dialog box (wdDialogFileOpen).

Copy code Copy code
Sub ShowOpenDialog()
 Dialogs(wdDialogFileOpen).Show
End Sub

If a file is selected and OK is clicked, the file is opened (the action is executed). The following example displays the Print dialog box (wdDialogFilePrint).

Copy code Copy code
Sub ShowPrintDialog()
 Dialogs(wdDialogFilePrint).Show
End Sub

Set the DefaultTab property to access a particular tab in a Word dialog box. The following example displays the Page Border tab in the Borders and Shading dialog box.

Copy code Copy code
Sub ShowBorderDialog()
 With Dialogs(wdDialogFormatBordersAndShading)
 .DefaultTab = wdDialogFormatBordersAndShadingTabPageBorder
 .Show
 End With
End Sub
Note Note

You can also use the VBA properties in Word to display the user information without displaying the dialog box. The following example uses the UserName property for the Application object to display the user name for the application without displaying the User Information dialog box.
Copy code Copy code
Sub DisplayUserInfo()
 MsgBox Application.UserName
End Sub

If the user name is changed in the previous example, the change is not set in the dialog box. Use the Execute method to execute the settings in a dialog box without displaying the dialog box. The following example displays the User Information dialog box, and if the name is not an empty string, the settings are set in the dialog box by using the Execute method.

Copy code Copy code
Sub ShowAndSetUserInfoDialogBox()
 With Dialogs(wdDialogToolsOptionsUserInfo)
 .Display
 If .Name <> "" Then .Execute
 End With
End Sub
Note Note

Use the VBA properties and methods in Word to set the user information without displaying the dialog box. The following code example changes the user name through the UserName property of the Application object, and then it displays the User Information dialog box to show that the change has been made. Note that displaying the dialog box is not necessary to change the value of a dialog box.
Copy code Copy code
Sub SetUserName()
 Application.UserName = "Jeff Smith"
 Dialogs(wdDialogToolsOptionsUserInfo).Display
End Sub

Returning and changing dialog box settings

It is not very efficient to use a Dialog object to return or change a value for a dialog box when you can return or change it using a property or method. Also, in most, if not all, cases, when VBA code is used in place of accessing the Dialog object, code is simpler and shorter. Therefore, the following examples also include examples that use corresponding VBA properties to perform the same tasks.

Prior to returning or changing a dialog box setting using the Dialog object, you need to identify the individual dialog box. This is done by using the Dialogs property with a WdWordDialog constant. After you have instantiated a Dialog object, you can return or set options in the dialog box. The following example displays the right indent from the Paragraphs dialog box.

Copy code Copy code
Sub ShowRightIndent()
 Dim dlgParagraph As Dialog
 Set dlgParagraph = Dialogs(wdDialogFormatParagraph)
 MsgBox "Right indent = " & dlgParagraph.RightIndent
End Sub
Note Note

You can use the VBA properties and methods of Word to display the right indent setting for the paragraph. The following example uses the RightIndent property of the ParagraphFormat object to display the right indent for the paragraph at the insertion point position.
Copy code Copy code
Sub ShowRightIndexForSelectedParagraph()
 MsgBox Selection.ParagraphFormat.RightIndent
End Sub

Just as you can return dialog box settings, you can also set dialog box settings. The following example marks the Keep with next check box in the Paragraph dialog box.

Copy code Copy code
Sub SetKeepWithNext()
 With Dialogs(wdDialogFormatParagraph)
 .KeepWithNext = 1
 .Execute
 End With
End Sub
Note Note

You can also use the VBA properties and methods to change the right indent for the paragraph. The following example uses the KeepWithNext property of the ParagraphFormat object to keep the selected paragraph with the following paragraph.
Copy code Copy code
Sub SetKeepWithNextForSelectedParagraph()
 Selection.ParagraphFormat.KeepWithNext = True
End Sub
Note Note

Use the Update method to ensure that the dialog box values reflect the current values. It may be necessary to use the Update method if you define a dialog box variable early in your macro and later want to return or change the current settings.

Checking how a dialog box was closed

The value returned by the Show and Display methods indicates which button was clicked to close the dialog box. The following example displays the Break dialog box, and if OK is clicked, a message is displayed on the status bar.

Copy code Copy code
Sub DialogBoxButtons()
 If Dialogs(wdDialogInsertBreak).Show = -1 Then
 StatusBar = "Break inserted"
 End If
End Sub

The following table describes the return values associated with buttons in dialogs boxes.

Return value | Description
-2 | The Close button.
-1 | The OK button.
0 (zero) | The Cancel button.
> 0 (zero) | A command button: 1 is the first button, 2 is the second button, and so on.


Editing Text

 Copy code hover
[image]

Editing Text
Send feedback

This topic includes Microsoft Visual Basic examples related to the following tasks:

  • Determining whether text is selected

  • Collapsing a selection or range

  • Extending a selection or range

  • Redefining a selection or range

  • Changing text

For information about, and examples of, other editing tasks, see the following topics:

Returning text from a document

Selecting text in a document

Inserting text in a document

Manipulating a portion of a document

Determining whether text is selected

The Type property of the Selection object returns information about the type of selection. The following example displays a message if the selection is an insertion point.

Copy code Copy code
Sub IsTextSelected()
 If Selection.Type = wdSelectionIP Then MsgBox "Nothing is selected"
End Sub

Collapsing a selection or range

Use the Collapse method to collapse a Selection object or a Range object to its beginning or ending point. The following example collapses the selection to an insertion point at the beginning of the selection.

Copy code Copy code
Sub CollapseToBeginning()
 Selection.Collapse Direction:=wdCollapseStart
End Sub

The following example cancels the range to its ending point (after the first word) and adds new text.

Copy code Copy code
Sub CollapseToEnd()
 Dim rngWords As Range

 Set rngWords = ActiveDocument.Words(1)
 With rngWords
 .Collapse Direction:=wdCollapseEnd
 .Text = "(This is a test.) "
 End With
End Sub

Extending a selection or range

The following example uses the MoveEnd method of the Selection object to extend the end of the selection to include three additional words. The MoveLeft, MoveRight, MoveUp, and MoveDown methods can also be used to extend a Selection object.

Copy code Copy code
Sub ExtendSelection()
 Selection.MoveEnd Unit:=wdWord, Count:=3
End Sub

The following example uses the MoveEnd method of the Range object to extend the range to include the first three paragraphs in the active document.

Copy code Copy code
Sub ExtendRange()
 Dim rngParagraphs As Range

 Set rngParagraphs = ActiveDocument.Paragraphs(1).Range
 rngParagraphs.MoveEnd Unit:=wdParagraph, Count:=2
End Sub

Redefining a selection or range

Use the SetRange method to redefine an existing Selection object or Range object. For more information, see Working with the Selection object or Working with Range objects.

Changing text

You can change existing text by changing the contents of a range. The following instruction changes the first word in the active document by setting the Text property of a Range object to "The ".

Copy code Copy code
Sub ChangeText()
 ActiveDocument.Words(1).Text = "The "
End Sub

You can also use the Delete method or the Selection object or the Range object to delete existing text, and then insert new text using the InsertAfter method or the InsertBefore method. The following example deletes the first paragraph in the active document and inserts new text.

Copy code Copy code
Sub DeleteText()
 Dim rngFirstParagraph As Range

 Set rngFirstParagraph = ActiveDocument.Paragraphs(1).Range
 With rngFirstParagraph
 .Delete
 .InsertAfter Text:="New text"
 .InsertParagraphAfter
 End With
End Sub


Error Accessing a Table Row or Column

 Copy code hover
[image]

Error Accessing a Table Row or Column
Send feedback

When you try to access an individual row or column in a drawn table, a run-time error may occur if the table is not uniform. For example, the following instruction posts an error if the first table in the active document does not have the same number of rows in each column.

Copy code Copy code
Sub RemoveTableBorders()
 ActiveDocument.Tables(1).Rows(1).Borders.Enable = False
End Sub

You can avoid this error by first selecting the cells in a column or row using the SelectColumn method or the SelectRow method. After the selection is made, use the Cells property with the Selection object. The following example selects the first row in the first document table. The Cells property is used to access the selected cells (all the cells in the first row) so that borders can be removed.

Copy code Copy code
Sub RemoveTableBorders()
 ActiveDocument.Tables(1).Cell(1, 1).Select
 With Selection
 .SelectRow
 .Cells.Borders.Enable = False
 End With
End Sub

The following example selects the first column in the first document table. The For Each...Next loop is used to add text to each cell in the selection (all the cells in the first column).

Copy code Copy code
Sub AddTextToTableCells()
 Dim intCell As Integer
 Dim oCell As Cell

 ActiveDocument.Tables(1).Cell(1, 1).Select
 Selection.SelectColumn
 intCell = 1

 For Each oCell In Selection.Cells
 oCell.Range.Text = "Cell " & intCell
 intCell = intCell + 1
 Next oCell
End Sub


Finding and Replacing Text or Formatting

 Copy code hover
[image]

Finding and Replacing Text or Formatting
Send feedback

Finding and replacing is exposed by the Find and Replacement objects. The Find object is available from the Selection object and the Range object. The find action differs slightly depending upon whether you access the Find object from the Selection object or the Range object.

Finding text and selecting it

If the Find object is accessed from the Selection object, the selection is changed when the find criteria is found. The following example selects the next occurrence of the word "Hello." If the end of the document is reached before the word "Hello" is found, the search is stopped.

Copy code Copy code
With Selection.Find
 .Forward = True
 .Wrap = wdFindStop
 .Text = "Hello"
 .Execute
End With

The Find object includes properties that relate to the options in the Find and Replace dialog box. You can set the individual properties of the Find object or use arguments with the Execute method, as shown in the following example.

Copy code Copy code
Selection.Find.Execute FindText:="Hello", _
 Forward:=True, Wrap:=wdFindStop

Finding text without changing the selection

If the Find object is accessed from a Range object, the selection is not changed but the Range is redefined when the find criteria is found. The following example locates the first occurrence of the word "blue" in the active document. If the find operation is successful, the range is redefined and bold formatting is applied to the word "blue."

Copy code Copy code
With ActiveDocument.Content.Find
 .Text = "blue"
 .Forward = True
 .Execute
 If .Found = True Then .Parent.Bold = True
End With

The following example performs the same result as the previous example, using arguments of the Execute method.

Copy code Copy code
Set myRange = ActiveDocument.Content
myRange.Find.Execute FindText:="blue", Forward:=True
If myRange.Find.Found = True Then myRange.Bold = True

Using the Replacement object

The Replacement object represents the replace criteria for a find and replace operation. The properties and methods of the Replacement object correspond to the options in the Find and Replace dialog box (Edit menu).

The Replacement object is available from the Find object. The following example replaces all occurrences of the word "hi" with "hello". The selection changes when the find criteria is found because the Find object is accessed from the Selection object.

Copy code Copy code
With Selection.Find
 .ClearFormatting
 .Text = "hi"
 .Replacement.ClearFormatting
 .Replacement.Text = "hello"
 .Execute Replace:=wdReplaceAll, Forward:=True, _
 Wrap:=wdFindContinue
End With

The following example removes bold formatting in the active document. The Bold property is True for the Find object and False for the Replacement object. To find and replace formatting, set the find and replace text to empty strings ("") and set the Format argument of the Execute method to True. The selection remains unchanged because the Find object is accessed from a Range object (the Content property returns a Range object).

Copy code Copy code
With ActiveDocument.Content.Find
 .ClearFormatting
 .Font.Bold = True
 With .Replacement
 .ClearFormatting
 .Font.Bold = False
 End With
 .Execute FindText:="", ReplaceWith:="", _
 Format:=True, Replace:=wdReplaceAll
End With


Finding Out Which Property or Method to Use

 Copy code hover
[image]

Finding Out Which Property or Method to Use
Send feedback

You can use the macro recorder to learn which methods or properties you need to accomplish a task in Microsoft Word. The macro recorder is a tool that translates your actions into Microsoft Visual Basic instructions. For example, if you turn on the macro recorder and open a document named "Examples.doc", the macro recorder records an instruction similar to the following.

Copy code Copy code
Sub Macro1()
'
' Macro1 Macro
' Macro recorded 9/22/2000 by JeffSmith
'
 Documents.Open FileName:="Examples.doc", ConfirmConversions:=False, _
 ReadOnly:=False, AddToRecentFiles:=False, _
 PasswordDocument:="", PasswordTemplate:="", _
 Revert:=False, WritePasswordDocument:="", _
 WritePasswordTemplate:="", Format:=wdOpenFormatAuto
End Sub

The Documents property returns the Documents collection and the Open method opens the specified file name. When you are first learning Visual Basic, using the macro recorder can help you learn which properties and methods you need to use to accomplish a task.

For more information, see Revising recorded Visual Basic macros.


Frequently Asked Visual Basic Questions

 Copy code hover
[image]

Frequently Asked Visual Basic Questions
Send feedback

General questions

How do I record macros?

What are objects, properties, and methods?

How do I find out which property or method I need?

How do I return a single object from a collection?

Questions about Microsoft Office Word features

How do I refer to the active element (for example, paragraph, table, field)?

What is a Range object?

How do I refer to words, sentences, paragraphs, or sections in a document?

I keep getting the "object doesn't support this property or method" error; how can I avoid it?

How do I create, open, save, and close documents?

How do I select text in a document?

How do I insert text into a document?

I keep getting the "requested member of the collection does not exist" error; how can I avoid it?

How do I loop on a collection?

How do I prompt for information from the user?

How do I return text from a document?

How do I know if the Application property is needed before a top-level property or method?

How do I display a built-in Word dialog box?

I keep getting an error when I try to access a table row or column?

WordBasic questions

How do I convert my WordBasic macros to Microsoft Visual Basic?

How do I find the Visual Basic equivalent for a WordBasic command or function?

General questions

How do I record macros?

What are objects, properties, and methods?

How do I find out which property or method I need?

How do I return a single object from a collection?

Questions about Microsoft Office Word features

How do I refer to the active element (for example, paragraph, table, field)?

What is a Range object?

How do I refer to words, sentences, paragraphs, or sections in a document?

I keep getting the "object doesn't support this property or method" error; how can I avoid it?

How do I create, open, save, and close documents?

How do I select text in a document?

How do I insert text into a document?

I keep getting the "requested member of the collection does not exist" error; how can I avoid it?

How do I loop on a collection?

How do I prompt for information from the user?

How do I return text from a document?

How do I know if the Application property is needed before a top-level property or method?

How do I display a built-in Word dialog box?

I keep getting an error when I try to access a table row or column?

WordBasic questions

How do I convert my WordBasic macros to Microsoft Visual Basic?

How do I find the Visual Basic equivalent for a WordBasic command or function?


Initializing Control Properties (Word)

 Copy code hover
[image]

Initializing Control Properties (Word)
Send feedback

You can initialize ActiveX controls at run time by using Visual Basic code in a macro. For example, you could fill a list box, set text values, or set option buttons.

The following example uses the Visual Basic AddItem method to add data to a list box named lstRegions. Then it sets the value of a text box and displays the form.

Copy code Copy code
Private Sub GetUserName()
 With UserForm1
 .lstRegions.AddItem "North"
 .lstRegions.AddItem "South"
 .lstRegions.AddItem "East"
 .lstRegions.AddItem "West"
 .txtSalesPersonID.Text = "00000"
 .Show
 ' ...
 End With
End Sub

You can also use code in the Visual Basic Initialize event of a form to set initial values for controls on the form. An advantage to setting initial control values in the Initialize event is that the initialization code stays with the form. You can copy the form to another project, and when you run the Show method to display the dialog box, the controls will be initialized.

Copy code Copy code
Private Sub UserForm_Initialize()
 With UserForm1
 With .lstRegions
 .AddItem "North"
 .AddItem "South"
 .AddItem "East"
 .AddItem "West"
 End With
 .txtSalesPersonID.Text = "00000"
 End With
End Sub


Inserting Text in a Document

 Copy code hover
[image]

Inserting Text in a Document
Send feedback

Use the InsertBefore method or the InsertAfter method of the Selection object or the Range object to insert text before or after a selection or range of text. The following example inserts text at the end of the active document.

Copy code Copy code
Sub InsertTextAtEndOfDocument()
 ActiveDocument.Content.InsertAfter Text:=" The end."
End Sub

The following example inserts text before the selection.

Copy code Copy code
Sub AddTextBeforeSelection()
 Selection.InsertBefore Text:="new text "
End Sub

After using the InsertBefore method or the InsertAfter method, the Range or Selection expands to include the new text. Use the Collapse method to collapse a Selection or Range to the beginning or ending point.


Looping Through a Collection

 Copy code hover
[image]

Looping Through a Collection
Send feedback

There are several different ways you can loop on the elements of a collection. However, the recommended method for looping on a collection is to use the For Each...Next loop. In this structure, Microsoft Visual Basic repeats a block of statements for each object in a collection. The following example displays the name of each document in the Documents collection.

Copy code Copy code
Sub LoopThroughOpenDocuments()
 Dim docOpen As Document

 For Each docOpen In Documents
 MsgBox docOpen.Name
 Next docOpen
End Sub

Instead of displaying each element name in a message box, you can use an array to store the information. This example uses an array to store the name of each bookmark contained in the active document.

Copy code Copy code
Sub LoopThroughBookmarks()
 Dim bkMark As Bookmark
 Dim strMarks() As String
 Dim intCount As Integer

 If ActiveDocument.Bookmarks.Count > 0 Then
 ReDim strMarks(ActiveDocument.Bookmarks.Count - 1)
 intCount = 0
 For Each bkMark In ActiveDocument.Bookmarks
 strMarks(intCount) = bkMark.Name
 intCount = intCount + 1
 Next bkMark
 End If
End Sub

You can loop through a collection to conditionally perform a task on members of the collection. For example, the following code updates the DATE fields in the active document.

Copy code Copy code
Sub UpdateDateFields()
 Dim fldDate As Field

 For Each fldDate In ActiveDocument.Fields
 If InStr(1, fldDate.Code, "Date", 1) Then fldDate.Update
 Next fldDate
End Sub

You can loop through a collection to determine if an element exists. For example, the following code displays a message if an AutoText entry named "Filename" is part of the AutoTextEntries collection.

Copy code Copy code
Sub FindAutoTextEntry()
 Dim atxtEntry As AutoTextEntry

 For Each atxtEntry In ActiveDocument.AttachedTemplate.AutoTextEntries
 If atxtEntry.Name = "Filename" Then _
 MsgBox "The Filename AutoText entry exists."
 Next atxtEntry
End Sub


Miscellaneous Tasks

 Copy code hover
[image]

Miscellaneous Tasks
Send feedback

This topic includes Microsoft Visual Basic examples for the following tasks:

  • Changing the view

  • Setting text in a header or footer

  • Setting options

  • Changing the document layout

  • Looping through paragraphs in a document

  • Customizing menus and toolbars

Changing the view

The View object includes properties and methods related to view attributes (such as show all, field shading, and table gridlines) for a window or pane. The following example changes the view to print view.

Copy code Copy code
Sub ChangeView()
    ActiveDocument.ActiveWindow.View.Type = wdPrintView
End Sub

Setting text in a header or footer

The HeaderFooter object is returned by the Headers, Footers, and HeaderFooter properties. The following example changes the text of the current page header.

Copy code Copy code
Sub AddHeaderText()
    With ActiveDocument.ActiveWindow.View
        .SeekView = wdSeekCurrentPageHeader
        Selection.HeaderFooter.Range.Text = "Header text"
        .SeekView = wdSeekMainDocument
    End With
End Sub

This example creates a Range object, rngFooter, that references the primary footer for the first section in the active document. After the Range object is set, the existing footer text is deleted. The FILENAME field is added to the footer along with two tabs and the AUTHOR field.

Copy code Copy code
Sub AddFooterText()
    Dim rngFooter As Range
    Set rngFooter = ActiveDocument.Sections(1) _
        .Footers(wdHeaderFooterPrimary).Range
    With rngFooter
        .Delete
        .Fields.Add Range:=rngFooter, Type:=wdFieldFileName, Text:="\p"
        .InsertAfter Text:=vbTab & vbTab
        .Collapse Direction:=wdCollapseStart
        .Fields.Add Range:=rngFooter, Type:=wdFieldAuthor
    End With
End Sub

Setting options

The Options object includes properties that correspond to optional settings that are available in various menus and dialogs throughout Microsoft Word. The following example sets three application settings for Word.

Copy code Copy code
Sub SetOptions()
    With Options
        .AllowDragAndDrop = True
        .ConfirmConversions = False
        .MeasurementUnit = wdPoints
    End With
End Sub

Changing the document layout

The PageSetup contains all the page setup attributes of a document (such as left margin, bottom margin, and paper size) as properties. The following example sets the margin values for the active document.

Copy code Copy code
Sub ChangeDocumentLayout()
    With ActiveDocument.PageSetup
        .LeftMargin = InchesToPoints(0.75)
        .RightMargin = InchesToPoints(0.75)
        .TopMargin = InchesToPoints(1.5)
        .BottomMargin = InchesToPoints(1)
    End With
End Sub

Looping through paragraphs in a document

This example loops through all of the paragraphs in the active document. If the space-before setting for a paragraph is 6 points, this example changes the spacing to 12 points.

Copy code Copy code
Sub LoopParagraphs()
    Dim parCount As Paragraph
    For Each parCount In ActiveDocument.Paragraphs
        If parCount.SpaceBefore = 12 Then parCount.SpaceBefore = 6
    Next parCount
End Sub

For more information, see Looping through a collection.

Customizing menus and toolbars

The CommandBar object represents both menus and toolbars (in versions of Word that do not use the ribbon). Use the CommandBars property with a menu or toolbar name to return a single CommandBar object. The Controls property returns a CommandBarControls object that refers to the items on the specified command bar. The following example adds the Word Count command to the Standard menu.

Copy code Copy code
Sub AddToolbarItem()
    Dim btnNew As CommandBarButton
    CustomizationContext = NormalTemplate
    Set btnNew = CommandBars("Standard").Controls.Add _
        (Type:=msoControlButton, ID:=792, Before:=6)
    With btnNew
        .BeginGroup = True
        .FaceId = 700
        .TooltipText = "Word Count"
    End With
End Sub

The following example adds the Double Underline command to the Formatting toolbar.

Copy code Copy code
Sub AddDoubleUnderlineButton()
    CustomizationContext = NormalTemplate
    CommandBars("Formatting").Controls.Add _
        Type:=msoControlButton, ID:=60, Before:=7
End Sub

Turn on the macro recorder and customize a menu or toolbar to determine the ID value for a particular command (for example, ID 60 is the Double Underline command).


Modifying a Portion of a Document

 Copy code hover
[image]

Modifying a Portion of a Document
Send feedback

Microsoft Visual Basic includes objects that you can use to modify the following document elements: characters, words, sentences, paragraphs, and sections. The following table includes the properties that correspond to these document elements and the objects they return.

This expression | Returns this object
Words (index) | Range
Characters (index) | Range
Sentences (index) | Range
Paragraphs (index) | Paragraph
Sections (index) | Section

When these properties are used without an index, a collection object with the same name is returned. For example, the Paragraphs property returns the Paragraphs collection object. However, if you identify an item within these collections by index, the object in the second column of the table is returned. For example, Words(1) returns a Range object. After you have a Range object, you can use any of the range properties or methods to modify the Range object. For example, the following instruction copies the first word in the selection to the Clipboard.

Copy code Copy code
Sub CopyWord()
    Selection.Words(1).Copy
End Sub
Note Note

The items in the Paragraphs and Sections collections are singular forms of the collection, specifically Paragraph objects and Section objects, rather than Range objects. In fact, most collections in the Microsoft Word object model have singular form objects with which you can work. However, the Range property (which returns a Range object) is available from both the Paragraph object and the Section object, and from most other objects that are children of collections. For example, the following instruction copies the first paragraph in the active document to the Clipboard.
Copy code Copy code
Sub CopyParagraph()
    ActiveDocument.Paragraphs(1).Range.Copy
End Sub

All of the document element properties in the preceding table are available from the Document, Selection, and Range objects. The following examples demonstrate how you can drill down to these properties from Document, Selection, and Range objects.

The following example sets the case of the first word in the active document.

Copy code Copy code
Sub ChangeCase()
    ActiveDocument.Words(1).Case = wdUpperCase
End Sub

The following example sets the bottom margin of the current section to 0.5 inch.

Copy code Copy code
Sub ChangeSectionMargin()
    Selection.Sections(1).PageSetup.BottomMargin = InchesToPoints(0.5)
End Sub

The following example double spaces the text in the active document (the Content property returns a Range object).

Copy code Copy code
Sub DoubleSpaceDocument()
    ActiveDocument.Content.ParagraphFormat.Space2
End Sub

Modifying a group of document elements

To modify a range of text that consists of a group of document elements (characters, words, sentences, paragraphs, or sections), you need to create a Range object. The Range method creates a Range object given a start and endpoint. For example, the following instruction creates a Range object that refers to the first ten characters in the active document.

Copy code Copy code
Sub SetRangeForFirstTenCharacters()
    Dim rngTenCharacters As Range
    Set rngTenCharacters = ActiveDocument.Range(Start:=0, End:=10)
End Sub

Using the Start and End properties with a Range object, you can create a new Range object that refers to a group of document elements. For example, the following instruction creates a Range object (rngThreeWords) that refers to the first three words in the active document.

Copy code Copy code
Sub SetRangeForFirstThreeWords()
    Dim docActive As Document
    Dim rngThreeWords As Range
    Set docActive = ActiveDocument
    Set rngThreeWords = docActive.Range(Start:=docActive.Words(1).Start, _
        End:=docActive.Words(3).End)
End Sub

The following example creates a Range object (rngParagraphs) beginning at the start of the second paragraph and ending after the third paragraph.

Copy code Copy code
Sub SetParagraphRange()
    Dim docActive As Document
    Dim rngParagraphs As Range
    Set docActive = ActiveDocument
    Set rngParagraphs = docActive.Range(Start:=docActive.Paragraphs(2).Range.Start, _
        End:=docActive.Paragraphs(3).Range.End)
End Sub

For more information about defining Range objects, see Working with Range objects.


Modifying a Word Command

 Copy code hover
[image]

Modifying a Word Command
Send feedback

You can modify most Microsoft Word commands by turning them into macros. For example, you can modify the Open command on the File tab so that instead of displaying a list of Worddocument files (files ending with the .doc file name extension), Word displays every file in the current folder.

To display the list of built-in Word commands in the Macro dialog box (Alt-F8), you select Word Commands in the Macros In box. Every command available on the ribbon or through shortcut keys is listed. Commands begin with the menu name that was associated with the command before menus were replaced with the ribbon. For example, the Save command, which was formerly on the File menu, is listed as FileSave.

You can replace a Word command with a macro by giving a macro the same name as a Word command. For example, if you create a macro named "FileSave," Word runs the macro when you choose Save from the File menu, click the Save toolbar button, or press the Ctrl-S shortcut key combination.

This example takes you through the steps needed to modify the FileSave command.

  1. Press Alt-F8.

  2. In the Macros in box, select Word commands.

  3. In the Macro name box, select "FileSave".

  4. In the Macros in box, select a template or document location to store the macro. For example, select "Normal.dot (Global Template)" to create a global macro (this modifies the FileSave command for all documents that use the normal tempate).

  5. Click Create.

The FileSave macro appears as shown below.

Copy code Copy code
Sub FileSave()
'
' FileSave Macro
' Saves the active document or template
'
    ActiveDocument.Save

End Sub

You can add additional instructions or remove the existing ActiveDocument.Save instruction. Now every time the FileSave command runs, your FileSave macro runs instead of the Word command. To restore the original FileSave functionality, you need to rename or delete your FileSave macro.

Remarks

You can also replace a Word command by creating a code module named after a Word command (for example, FileSave) with a subroutine named Main.


Object Doesn't Support this Property or Method

 Copy code hover
[image]

Object Doesn't Support this Property or Method
Send feedback

The "object doesn't support this property or method" error occurs when you try to use a method or property that the specified object does not support. For example, the following instruction results in an error.

Copy code Copy code
ActiveDocument.Copy

The ActiveDocument property returns a Document object. There is no Copy method or property available for the Document object, therefore an error occurs. To determine what properties and methods are available for an object, do any of the following.

  • Use the Object Browser to determine what members (properties and methods) are available for the selected class (object).

  • Use the Microsoft IntelliSense feature in the Microsoft Visual Basic Editor. When you type a period (.) after a property or method in the Visual Basic Editor, a list of available properties and methods is displayed.

  • Use Microsoft Word Visual Basic for Applications Help to determine which properties and methods can be used with an object. Each object topic in Help includes a page that lists the properties and methods for the object. Press F1 while in the Object Browser or while in a module to display the appropriate Help topic.

  • Use the TypeName function to determine the type of object returned by an expression. The following example displays "Range" because the Content property returns a Range object.

    Copy code Copy code
    MsgBox TypeName(ActiveDocument.Content)


Predefined Bookmarks

 Copy code hover
[image]

Predefined Bookmarks
Send feedback

Microsoft Word sets and automatically updates a number of reserved bookmarks. You can use these predefined bookmarks just as you use bookmarks that you place in documents, except that you do not have to set them and they are not listed on the Go To tab in the Find and Replace dialog box.

You can use predefined bookmarks with the Bookmarks property. The following example sets the bookmark named "currpara" to the location marked by the predefined bookmark named "\Para".

Copy code Copy code
ActiveDocument.Bookmarks("\Para").Copy "currpara"

The following table describes the predefined bookmarks available in Word.

Bookmark | Description
\Sel | Current selection or the insertion point.
\PrevSel1 | Most recent selection where editing occurred; going to this bookmark is equivalent to running the GoBack method once.
\PrevSel2 | Second most recent selection where editing occurred; going to this bookmark is equivalent to running the GoBack method twice.
\StartOfSel | Start of the current selection.
\EndOfSel | End of the current selection.
\Line | Current line or the first line of the current selection. If the insertion point is at the end of a line that is not the last line in the paragraph, the bookmark includes the entire next line.
\Char | Current character, which is the character following the insertion point if there is no selection, or the first character of the selection.
\Para | Current paragraph, which is the paragraph containing the insertion point or, if more than one paragraph is selected, the first paragraph of the selection. Note that if the insertion point or selection is in the last paragraph of the document, the "\Para" bookmark does not include the paragraph mark.
\Section | Current section, including the break at the end of the section, if any. The current section contains the insertion point or selection. If the selection contains more than one section, the "\Section" bookmark is the first section in the selection.
\Doc | Entire contents of the active document, with the exception of the final paragraph mark.
\Page | Current page, including the break at the end of the page, if any. The current page contains the insertion point. If the current selection contains more than one page, the "\Page" bookmark is the first page of the selection. Note that if the insertion point or selection is in the last page of the document, the "\Page" bookmark does not include the final paragraph mark.
\StartOfDoc | Beginning of the document.
\EndOfDoc | End of the document.
\Cell | Current cell in a table, which is the cell containing the insertion point. If one or more cells of a table are included in the current selection, the "\Cell" bookmark is the first cell in the selection.
\Table | Current table, which is the table containing the insertion point or selection. If the selection includes more than one table, the "\Table" bookmark is the entire first table of the selection, even if the entire table is not selected.
\HeadingLevel | The heading that contains the insertion point or selection, plus any subordinate headings and text. If the current selection is body text, the "\HeadingLevel" bookmark includes the preceding heading, plus any headings and text subordinate to that heading.


Prompting for Information

 Copy code hover
[image]

Prompting for Information
Send feedback

There are several different ways you can prompt for information from a user.

  • Use the Microsoft Visual Basic InputBox function to display a dialog box with a message and an edit box. When the user clicks OK, the function returns the text that the user entered.

  • Use the Visual Basic MsgBox function to display a simple message. You can display several different command buttons and icons. This function returns a number that indicates which button was clicked.

  • Use a built-in Microsoft Word dialog box to get user input for a specific Microsoft Office Word feature.

  • Use a custom form to get user input. For information about adding controls to a form, see Add a control to a form.


Recording a Macro to Generate Code

 Copy code hover
[image]

Recording a Macro to Generate Code
Send feedback

If you are unsure of which Microsoft Visual Basic method or property to use, you can turn on the macro recorder and manually perform the action. The macro recorder translates your actions into Visual Basic code. After you record your actions, you can modify the code to do exactly what you want. For example, if you do not know what property or method to use to indent a paragraph, do the following:

  1. On the Developer ribbon, click Record Macro.

  2. Change the default macro name to a name of your choice and click OK to start the recorder.

  3. On the Home menu, click the Increase Indent button.

  4. On the Developer ribbon, click Stop Recording.

  5. On the Developer ribbon, click Macros.

  6. Select the macro name that you assigned in Step 2 and click Edit.

View the Visual Basic code to determine the property that corresponds to the left paragraph indent (the LeftIndent property). Position the cursor within .LeftIndent and press F1 or click the Help button.

Remarks

Recorded macros use the Selection object. The following code example indents the selected paragraphs by one-half inch.

Copy code Copy code
Sub IndentParagraph()
    Selection.ParagraphFormat.LeftIndent = InchesToPoints(0.5)
End Sub

You can, however, modify the recorded macro to work with Range objects. For more information, see Revising Recorded Visual Basic Macros.


Referring to the Active Document Element

 Copy code hover
[image]

Referring to the Active Document Element
Send feedback

To refer to the active paragraph, table, field, or other document element, use the Selection property to return a Selection object. From the Selection object, you can access all paragraphs in the selection or the first paragraph in the selection. The following example applies a border around the first paragraph in the selection.

Copy code Copy code
Sub BorderAroundFirstParagraph()
 Selection.Paragraphs(1).Borders.Enable = True
End Sub

The following example applies a border around each paragraph in the selection.

Copy code Copy code
Sub BorderAroundSelection()
 Selection.Paragraphs.Borders.Enable = True
End Sub

The following example applies shading to the first row of the first table in the selection.

Copy code Copy code
Sub ShadeTableRow()
 Selection.Tables(1).Rows(1).Shading.Texture = wdTexture10Percent
End Sub

An error occurs if the selection doesn't include a table. Use the Count property to determine if the selection includes a table. The following example applies shading to the first row of the first table in the selection.

Copy code Copy code
Sub ShadeTableRow()
 If Selection.Tables.Count >= 1 Then
 Selection.Tables(1).Rows(1).Shading.Texture = wdTexture25Percent
 Else
 MsgBox "Selection doesn't include a table"
 End If
End Sub

The following example applies shading to the first row of every table in the selection. The For Each...Next loop is used to step through the individual tables in the selection.

Copy code Copy code
Sub ShadeAllFirstRowsInTables()
 Dim tblTable As Table
 If Selection.Tables.Count >= 1 Then
 For Each tblTable In Selection.Tables
 tblTable.Rows(1).Shading.Texture = wdTexture30Percent
 Next tblTable
 End If
End Sub


Requested Member of the Collection Does Not Exist

 Copy code hover
[image]

Requested Member of the Collection Does Not Exist
Send feedback

The "requested member of the collection does not exist" error occurs when you try to access an object that does not exist. For example, the following instruction may post an error if the active document does not contain at least one table.

Copy code Copy code
Sub SelectTable()
 ActiveDocument.Tables(1).Select
End Sub

To avoid this error when accessing a member of a collection, ensure that the member exists prior to accessing the collection member. If you are accessing the member by index number, you can use the Count property of the collection to determine if the member exists. The following example selects the first table, if there is at least one table in the active document.

Copy code Copy code
Sub SelectFirstTable()
 If ActiveDocument.Tables.Count > 0 Then
 ActiveDocument.Tables(1).Select
 Else
 MsgBox "Document doesn't contain a table"
 End If
End Sub

If you are accessing a collection member by name, you can loop on the elements in a collection using a For Each...Next loop to determine if the named member is part of the collection. For example, the following deletes the AutoCorrect entry named "acheive" if it is part of the AutoCorrectEntries collection. For more information, see Looping Through a Collection.

Copy code Copy code
Sub DeleteAutoTextEntry()
 Dim aceEntry As AutoCorrectEntry
 For Each aceEntry In AutoCorrect.Entries
 If aceEntry.Name = "acheive" Then aceEntry.Delete
 Next aceEntry
End Sub


Returning a Single Object from a Collection

 Copy code hover
[image]

Returning a Single Object from a Collection
Send feedback

Information about returning a single object is available in the object topic itself and in the collection object topic for the collection that contains the object. Most object topics include information about returning a single object and information about adding an object to the collection of those objects. Most collection object topics include information about returning the collection itself and adding an object to the collection.

For more information, see the specific object or collection with which you want to work.


Returning an Object from a Collection (Word)

 Copy code hover
[image]

Returning an Object from a Collection (Word)
Send feedback

The Item method returns a single object from a collection. The following example sets the docFirst variable to a Document object that represents the first document in the Documents collection.

Copy code Copy code
Sub SetFirstDoc()
    Dim docFirst As Document
    Set docFirst = Documents.Item(1)
End Sub

The Item method is the default method for most collections, so you can write the same statement more concisely by omitting the Item keyword.

Copy code Copy code
Sub SetFirstDoc()
    Dim docFirst As Document
    Set docFirst = Documents(1)
End Sub

Named Objects

Although you can usually specify an integer value with the Item method, it may be more convenient to return an object by name. The following example switches the focus to a document named Sales.doc.

Copy code Copy code
Sub ActivateDocument()
    Documents("Sales.doc").Activate
    MsgBox ActiveDocument.Name
End Sub

The following example selects the text marked by the first bookmark in the active document.

Copy code Copy code
Sub SelectBookmark()
    ActiveDocument.Bookmarks(1).Select
    MsgBox Selection.Text
End Sub

Not all collections can be indexed by name. To determine the valid collection index values, see the collection object topic.

Predefined Index Values

Some collections have predefined index values that you can use to return single objects. Each predefined index value is represented by a constant. For example, you specify a WdBorderType constant with the Borders property to return a single Border object.

The following example adds a single 0.75-point border below the first paragraph in the selection.

Copy code Copy code
Sub AddBorderToFirstParagraphInSelection()
    With Selection.Paragraphs(1).Borders(wdBorderBottom)
        .LineStyle = wdLineStyleSingle
        .LineWidth = wdLineWidth300pt
        .Color = wdColorBlue
    End With
End Sub


Returning Text from a Document

 Copy code hover
[image]

Returning Text from a Document
Send feedback

Use the Text property to return text from a Range object or Selection object. The following example selects the next paragraph formatted with the Heading 1 style. The contents of the Text property are displayed by the MsgBox function.

Copy code Copy code
Sub FindHeadingStyle()
 With Selection.Find
 .ClearFormatting
 .Style = wdStyleHeading1
 .Execute FindText:="", Format:=True, _
 Forward:=True, Wrap:=wdFindStop
 If .Found = True Then MsgBox Selection.Text
 End With
End Sub

The following instruction returns and displays the selected text.

Copy code Copy code
Sub ShowSelection()
 Dim strText As String
 strText = Selection.Text
 MsgBox strText
End Sub

The following example returns the first word in the active document. Each item in the Words collection is a Range object that represents one word.

Copy code Copy code
Sub ShowFirstWord()
 Dim strFirstWord As String
 strFirstWord = ActiveDocument.Words(1).Text
 MsgBox strFirstWord
End Sub

The following example returns the text associated with the first bookmark in the active document.

Copy code Copy code
Sub ShowFirstBookmark()
 Dim strBookmark As String
 If ActiveDocument.Bookmarks.Count > 0 Then
 strBookmark = ActiveDocument.Bookmarks(1).Range.Text
 MsgBox strBookmark
 End If
End Sub


Revising Recorded Visual Basic Macros

 Copy code hover
[image]

Revising Recorded Visual Basic Macros
Send feedback

The macro recorder is a great tool for discovering the Microsoft Visual Basic methods and properties that you want to use. If you do not know what properties or methods to use, turn on the macro recorder and manually perform the action. The macro recorder translates your actions into Visual Basic code. There are, however, some limitations to recording macros. You cannot record the following:

  • Conditional branches

  • Variable assignments

  • Looping structures

  • Custom user forms

  • Error handling

  • Text selections made with the mouse (you must use keyboard combinations)

To enhance your macros, you may want to revise the code recorded into your module.

Removing the Selection property

Macros created using the macro recorder depend on the selection. At the beginning of most recorded macro instructions, you see Selection. Recorded macros use the Selection property to return the Selection object. For example, the following example moves the selection to the Temp bookmark and inserts text after the bookmark.

Copy code Copy code
Sub Macro1()
    Selection.Goto What:=wdGotoBookmark, Name:="Temp"
    Selection.MoveRight Unit:=wdCharacter, Count:=1
    Selection.TypeText Text:="New text"
End Sub

This macro accomplishes the task, but there are a couple of drawbacks. First, if the document does not have a bookmark named Temp, the macro posts an error. Second, the macro moves the selection, which may not be appropriate. Both of these issues can be resolved by revising the macro so that it does not use the Selection object. This is the revised macro.

Copy code Copy code
Sub MyMacro()
    If ActiveDocument.Bookmarks.Exists("Temp") = True Then
        endloc = ActiveDocument.Bookmarks("Temp").End
        ActiveDocument.Range(Start:=endloc, _
        End:=endloc).InsertAfter "New text"
    End If
End Sub

The Exists method is used to check for the existence of the bookmark named Temp. If the bookmark is found, the bookmark's ending character position is returned by using the End property. Finally, the Range method of the Document object is used to return a Range object that refers to the bookmark's ending position, so that text can be inserted using the InsertAfter method of the Range object. For more information about defining Range objects, see Working with Range objects.

Using With…End With

Macro instructions that refer to the same object can be simplified using a With…End With structure. For example, the following macro was recorded when a title was added at the top of a document.

Copy code Copy code
Sub Macro1()
    Selection.HomeKey Unit:=wdStory
    Selection.TypeText Text:="Title"
    Selection.ParagraphAlignment.Alignment = wdAlignParagraphCenter
End Sub

The Selection property is used with each instruction to return a Selection object. The macro can be simplified so that the Selection property is used only once.

Copy code Copy code
Sub MyMacro()
    With Selection
        .HomeKey Unit:=wdStory
        .TypeText Text:="Title"
        .ParagraphAlignment.Alignment = wdAlignParagraphCenter
    End With
End Sub

The same task can also be performed without using the Selection object. The following macro uses a Range object at the beginning of the active document to accomplish the same task.

Copy code Copy code
Sub MyMacro()
    With ActiveDocument.Range(Start:=0, End:=0)
        .InsertAfter "Title"
        .ParagraphFormat.Alignment = wdAlignParagraphCenter
    End With
End Sub

Removing unnecessary properties

If you record a macro that involves selecting an option in a dialog box, the macro recorder records the settings of all the options in the dialog box, even if you only change one or two options. If you do not need to change all of the options, you can remove the unnecessary properties from the recorded macro. The following recorded macro includes a number of options from the Paragraph dialog box (Format menu).

Copy code Copy code
Sub Macro1()
    With Selection.ParagraphFormat
        .LeftIndent = InchesToPoints(0)
        .RightIndent = InchesToPoints(0)
        .SpaceBefore = 6
        .SpaceAfter = 6
        .LineSpacingRule = 0
        .Alignment = wdAlignParagraphLeft
        .WidowControl = True
        .KeepWithNext = False
        .KeepTogether = False
        .PageBreakBefore = False
        .NoLineNumber = False
        .Hyphenation = True
        .FirstLineIndent = InchesToPoints(0)
        .OutlineLevel = 10
    End With
End Sub

However, if you only want to change the spacing before and after the paragraph, you can change the macro to the following.

Copy code Copy code
Sub MyMacro()
    With Selection.ParagraphFormat
        .SpaceBefore = 6
        .SpaceAfter = 6
    End With
End Sub

The simplified macro executes faster because it sets fewer properties. Only the spacing before and after are changed; all of the other settings for the selected paragraphs are unchanged.

Removing unnecessary arguments

When the macro recorder records a method, the values of all of the arguments are included. The following macro was recorded when the document named Test.doc was opened. The resulting macro includes all of the arguments for the Open method.

Copy code Copy code
Sub Macro1()
    Documents.Open FileName:="C:\My Documents\Test.doc", _
        ConfirmConversions:= False, ReadOnly:=False, _
        AddToRecentFiles:=False, PasswordDocument:="", _
        PasswordTemplate:="", Revert:=False, _
        WritePasswordDocument:="", _
        WritePasswordTemplate:="", Format:=wdOpenFormatAuto
End Sub

The arguments that are not needed can be removed from the recorded macro. For example, you could remove all of arguments set to an empty string (for example, WritePasswordDocument:=""), as shown.

Copy code Copy code
Sub MyMacro()
    Documents.Open FileName:="C:\My Documents\Test.doc", _
        ConfirmConversions:= False, _
        ReadOnly:=False, AddToRecentFiles:=False, _
        Revert:=False, Format:=wdOpenFormatAuto
End Sub


Selecting Text in a Document

 Copy code hover
[image]

Selecting Text in a Document
Send feedback

Use the Select method to select an item in a document. The Select method is available from several objects, such as Bookmark, Field, Range, and Table. The following example selects the first table in the active document.

Copy code Copy code
Sub SelectTable()
 ActiveDocument.Tables(1).Select
End Sub

The following example selects the first field in the active document.

Copy code Copy code
Sub SelectField()
 ActiveDocument.Fields(1).Select
End Sub

The following example selects the first four paragraphs in the active document. The Range method is used to create a Range object that refers to the first four paragraphs. The Select method is then applied to the Range object.

Copy code Copy code
Sub SelectRange()
 Dim rngParagraphs As Range
 Set rngParagraphs = ActiveDocument.Range( _
 Start:=ActiveDocument.Paragraphs(1).Range.Start, _
 End:=ActiveDocument.Paragraphs(4).Range.End)
 rngParagraphs.Select
End Sub

For more information, see Working with the Selection object.


Setting Control Properties (Word)

 Copy code hover
[image]

Setting Control Properties (Word)
Send feedback

You can set the properties of some ActiveX controls at design time (before any macro is running). In design mode, right-click a control and click Properties to display the Properties window. Property names are shown in the left column in the window, property values in the right column. You set a property value by entering the new value to the right of the property name.


Storing Values When a Macro Ends

 Copy code hover
[image]

Storing Values When a Macro Ends
Send feedback

When a macro ends, the values stored in its variables are not automatically saved to disk. If a macro needs to preserve a value, it must store that value outside itself before the macro execution is completed. This topic describes five locations where macro values can be easily stored and retrieved.

Document variables

Document variables allow you to store values as part of a document or a template. For example, you might store macro values in the document or template where the macro resides. You can add variables to a document or template using the Add method of the Variables collection. The following example saves a document variable in the same location as the macro that is running (document or template) using the ActiveDocument property.

Copy code Copy code
Sub AddDocumentVariable()
 ActiveDocument.Variables.Add Name:="Age", Value:=12
End Sub

The following example uses the Value property with a Variable object to return the value of a document variable.

Copy code Copy code
Sub UseDocumentVariable()
 Dim intAge As Integer
 intAge = ActiveDocument.Variables("Age").Value
End Sub

Remarks

You can use the DOCVARIABLE field to insert a document variable into a document.

Document properties

Like document variables, document properties allow you to store values as part of a document or a template. Document properties can be viewed in the Properties dialog box.

The Microsoft Office Word object model breaks document properties into two groups: built-in and custom. Custom document properties include the properties shown on the Custom tab in the Properties dialog box. Built-in document properties include the properties on all the tabs in the Properties dialog box, except the Custom tab.

To access built-in properties, use the BuiltInDocumentProperties property to return a DocumentProperties collection that includes the built-in document properties. Use the CustomDocumentProperties property of a Document object or a Template object to return a DocumentProperties collection that includes the custom document properties. The following example creates a custom document property named "YourName" in the same location as the macro that is running (document or template).

Copy code Copy code
Sub AddCustomDocumentProperties()
 ActiveDocument.CustomDocumentProperties.Add Name:="YourName", _
 LinkToContent:=False, Value:="Joe", Type:=msoPropertyTypeString
End Sub

Built-in document properties cannot be added to the DocumentProperties collection returned by the BuiltInDocumentProperties property of a Document object or Template object. You can, however, retrieve the contents of a built-in document property or change the value of a read/write built-in document property.

Remarks

You can use the DOCPROPERTY field to insert document properties into a document.

AutoText entries

AutoText entries can be used to store information in a template. Unlike a document variable or property, AutoText entries can include items beyond macro variables, such as formatted text or a graphic. Use the Add method with the AutoTextEntries collection to create a new AutoText entry. The following example creates an AutoText entry named "MyText" that contains the contents of the selection. If the following instruction is part of a template macro, the new AutoText entry is stored in the template, otherwise, the AutoText entry is stored in the template attached to the document where the instruction resides.

Copy code Copy code
Sub AddAutoTextEntry()
 ActiveDocument.AttachedTemplate.AutoTextEntries.Add Name:="MyText", _
 Range:=Selection.Range
End Sub

Use the Value property with an AutoTextEntry object to retrieve the contents of an AutoText entry object.

Settings files

You can set and retrieve information from a settings file using the PrivateProfileString property of the System object. The structure of a Microsoft Windows settings file is the same as the Windows 3.1 WIN.INI file. The following example sets the DocNum key to 1 under the DocTracker section in the Macro.ini file.

Copy code Copy code
Sub MacroSystemFile()
 System.PrivateProfileString( _
 FileName:="C:\My Documents\Macro.ini", _
 Section:="DocTracker", Key:="DocNum") = 1
End Sub

After running the above instruction, the Macro.ini file includes the following text.

Copy code Copy code
[DocTracker]
DocNum=1

The PrivateProfileString property has three arguments: FileName, Section, and Key. The FileName argument is used to specify a settings file path and file name. The Section argument specifies the section name that appears between brackets before the associated keys (do not include the brackets with the section name). The Key argument specifies the key name, which is followed by an equal sign (=) and the setting.

Use the same PrivateProfileString property to retrieve a setting from a settings file. The following example retrieves the DocNum setting under the DocTracker section in the Macro.ini file.

Copy code Copy code
Sub GetSystemFileInfo()
 Dim intDocNum As Integer
 intDocNum = System.PrivateProfileString( _
 FileName:="C:\My Documents\Macro.ini", _
 Section:="DocTracker", Key:="DocNum")
 MsgBox "DocNum is " & intDocNum
End Sub

Windows registry

You can set and retrieve information from the Windows registry using the PrivateProfileString property. The following example retrieves the Microsoft Office Word 2007 program directory from the Windows registry.

Copy code Copy code
Sub GetRegistryInfo()
 Dim strSection As String
 Dim strPgmDir As String
 strSection = "HKEY_CURRENT_USER\Software\Microsoft" _
 & "\Office\12.0\Word\Options"
 strPgmDir = System.PrivateProfileString(FileName:="", _
 Section:=strSection, Key:="PROGRAMDIR")
 MsgBox "The directory for Word is - " & strPgmDir
End Sub

The PrivateProfileString property has three arguments: FileName, Section, and Key. To return or set a value for a registry entry, specify an empty string ("") for the FileName argument. The Section argument should be the complete path to the registry subkey. The Key argument should be the name of an entry in the subkey specified by Section.

You can also set information in the Windows registry using the following PrivateProfileString syntax.

System.PrivateProfileString(FileName, Section, Key) =value

The following example sets the DOC-PATH entry to "C:\My Documents" in the Options subkey for Office Word 2007 in the Windows registry.

Copy code Copy code
Sub SetDocumentDirectory()
 Dim strDocDirectory As String
 strDocDirectory = "HKEY_CURRENT_USER\Software\Microsoft" _
 & "\Office\10.0\Word\Options"
 System.PrivateProfileString(FileName:="", _
 Section:=strDocDirectory, Key:="DOC-PATH") = "C:\My Documents"
End Sub


Understanding Objects, Properties, and Methods

 Copy code hover
[image]

Understanding Objects, Properties, and Methods
Send feedback

Objects are the fundamental building blocks of Microsoft Visual Basic; almost everything that you do in Visual Basic involves modifying objects. Every element of Microsoft Word—such as documents, tables, paragraphs, bookmarks, and fields—can be represented by an object in Visual Basic.

What are objects and collections?

An object represents an element of Word, such as a document, a paragraph, a bookmark, or a single character. A collection is an object that contains several other objects, usually of the same type; for example, all the bookmark objects in a document are contained in a single collection object. By using properties and methods, you can modify a single object or a whole collection of objects.

What is a property?

A property is an attribute of an object or an aspect of its behavior. For example, properties of a document include its name, its content, and its save status, and whether change tracking is turned on. To change the characteristics of an object, you change the values of its properties.

To set the value of a property, follow the reference to an object with a period, the property name, an equal sign, and the new property value. The following example turns on change tracking in the document named "MyDoc.doc".

Copy code Copy code
Sub TrackChanges()
    Documents("Sales.doc").TrackRevisions = True
End Sub

In this example, Documents refers to the collection of open documents, and the name "Sales.doc" identifies a single document in the collection. The TrackRevisions property is set for that single document.

Some properties cannot be set. The Help topic for a property indicates whether that property can be set (read/write) or can only be read (read-only).

You can return information about an object by returning the value of one of its properties. The following example returns the name of the active document.

Copy code Copy code
Sub GetDocumentName()
    Dim strDocName As String
    strDocName = ActiveDocument.Name
    MsgBox strDocName
End Sub

In this example, ActiveDocument refers to the document in the active window in Word. The name of that document is assigned to the variable refers to the document in the active window in Word. The name of that document is assigned to the variable strDocName.

Remarks

The Help topic for each property indicates whether you can set that property (read/write), only read the property (read-only), or only write the property (write-only). Also, the Object Browser in the Visual Basic Editor displays the read/write status at the bottom of the browser window when the property is selected.

What is a method?

A method is an action that an object can perform. For example, just as a document can be printed, the Document object has a PrintOut method. Methods often have arguments that qualify how the action is performed. The following example prints the first three pages of the active document.

Copy code Copy code
Sub PrintThreePages()
    ActiveDocument.PrintOut Range:=wdPrintRangeOfPages, Pages:="1-3"
End Sub

In most cases, methods are actions and properties are qualities. Using a method causes something to happen to an object, while using a property returns information about the object or causes a quality about the object to change.

Returning an object

Most objects are returned by returning a single object from the collection. For example, the Documents collection contains the open Word documents. You use the Documents property of the Application object (the object at the top of the Word object hierarchy) to return the Documents collection.

After you access the collection, you can return a single object by using an index value in parentheses (this is similar to how you work with arrays). The index value is usually a number or a name. For more information, see Returning an Object from a Collection.

The following example uses the Documents property to access the Documents collection. The index number is used to return the first document in the Documents collection. The Close method is then applied to the Document object to close the first document in the Documents collection.

Copy code Copy code
Sub CloseDocument()
    Documents(1).Close
End Sub

The following example uses a name (specified as a string) to identify a Document object within the Documents collection.

Copy code Copy code
Sub CloseSalesDoc()
    Documents("Sales.doc").Close
End Sub

Collection objects often have methods and properties that you can use to modify the whole collection of objects. The Documents object has a Save method that saves all the documents in the collection. The following example saves the open documents by applying the Save method.

Copy code Copy code
Sub SaveAllOpenDocuments()
    Documents.Save
End Sub

The Document object also has a Save method that is available for saving a single document. The following example saves the document named Sales.doc.

Copy code Copy code
Sub SaveSalesDoc()
    Documents("Sales.doc").Save
End Sub

To return an object that is further down in the Word object hierarchy, you must "drill down" to it by using properties and methods to return objects.

To see how this is done, open the Visual Basic Editor and click Object Browser on the View menu. Click Application in the Classes list on the left. Then click ActiveDocument from the list of members on the right. The text at the bottom of the Object Browser indicates that ActiveDocument is a read-only property that returns a Document object. Click Document at the bottom of the Object Browser; the Document object is automatically selected in the Classes list, and the Members list displays the members of the Document object. Scroll through the list of members until you find Close. Click the Close method. The text at the bottom of the Object Browser window shows the syntax for the method. For more information about the method, press F1 or click the Help button to jump to the Close method Help topic.

Given this information, you can write the following instruction to close the active document.

Copy code Copy code
Sub CloseDocSaveChanges()
    ActiveDocument.Close SaveChanges:=wdSaveChanges
End Sub

The following example maximizes the active document window.

Copy code Copy code
Sub MaximizeDocumentWindow()
    ActiveDocument.ActiveWindow.WindowState = wdWindowStateMaximize
End Sub

The ActiveWindow property returns a Window object that represents the active window. The WindowState property is set to the maximize constant (wdWindowStateMaximize).

The following example creates a document and displays the Save As dialog box so that a name can be provided for the document.

Copy code Copy code
Sub CreateSaveNewDocument()
    Documents.Add.Save
End Sub

The Documents property returns the Documents collection. The Add method creates a new document and returns a Document object. The Save method is then applied to the Document object.

As you can see, you use methods or properties to drill down to an object. That is, you return an object by applying a method or property to an object above it in the object hierarchy. After you return the object that you want, you can apply the methods and control the properties of that object.

Getting Help on objects, methods, and properties

Until you become familiar with the Word object model, there are tools that you can use to help you drill down through the hierarchy.

  • Microsoft IntelliSense. When you type a period (.) after an object in the Visual Basic Editor, a list of available properties and methods is displayed. For example, if you type Application., a drop-down list of methods and properties of the Application object is displayed.

  • Help. You can also use Help to find out which properties and methods can be used with an object. Each object topic in Help includes a See Also jump that displays a list of properties and methods for the object. Press F1 while in the Object Browser or in a module to jump to the appropriate Help topic.

  • Object Browser. The Object Browser in the Visual Basic Editor displays the members (properties and methods) of the Word objects.


Using ActiveX Controls on a Document (Word)

 Copy code hover
[image]

Using ActiveX Controls on a Document (Word)
Send feedback

Just as you can add Microsoft ActiveX controls to custom dialog boxes, you can add controls directly to a document when you want to provide a sophisticated way for the user to interact directly with your macro, without the distraction of dialog boxes. Use the following procedure to add ActiveX controls to your document. For more specific information about using ActiveX controls in Microsoft Word, see Using ActiveX controls on documents.

  1. Add controls to the document

    To add a control to the drawing layer of a document, click the control on the Control Toolbox. To add a control to the text layer of a document, hold down the SHIFT key while you click a control on the Control Toolbox.

  2. Set control properties

    Right-click a control in design mode and click Properties to display the Properties window.

  3. Initialize the controls

    You can initialize controls in a procedure.

  4. Write event procedures

    All controls have a predefined set of events. For example, a command button has a Click event that occurs when the user clicks the command button. You can write event procedures that run when the events occur.

  5. Use control values while code is running

    Some properties can be set at run time.


Using ActiveX Controls on Word Documents

 Copy code hover
[image]

Using ActiveX Controls on Word Documents
Send feedback

You can add controls to your documents to create interactive documents, such as online forms. For general information about adding and working with controls, see Using ActiveX controls on a document and Creating a custom dialog box.

Remember the following points when you work with controls on documents:

  • You can add Microsoft ActiveX controls to the text layer or drawing layer of the document. To add a control to the drawing layer, click the control on the Control Toolbox. To add a control to the text layer, hold down the SHIFT key while you click a control on the Control Toolbox.

  • A control that you add to the text layer is an InlineShape object, to which you gain access programmatically through the InlineShapes collection. A control that you add to the drawing layer is a Shape object, to which you gain access programmatically through the Shapes collection.

  • Controls in the text layer are treated like characters and are positioned as characters within a line of text.

  • In design mode, ActiveX controls in the drawing layer are visible only in print layout view or Web layout view.

  • If you want the user to use the ActiveX controls but not change the layout of the document, protect the document by clicking the Protect Form button on the Forms toolbar.

  • Microsoft Word implements the LostFocus and GotFocus events for ActiveX controls on a document. The other events listed in the Procedure drop-down list box are documented in Microsoft Forms Help. For more information about using events with ActiveX controls, see the Control and dialog box events and the Using events with ActiveX controls topics.

  • If you want to add form fields instead of ActiveX controls to your document to create an online form, use the Forms toolbar.

  • The Me keyword in an event procedure for an ActiveX control on a document refers to the document, not to the control.

Writing event code for controls on documents is very similar to writing event code for controls on forms. The following SpinUp and SpinDown event procedures change the value of the TextBox control named "TextBox1" on the document where the SpinButton control named "SpinButton1" resides. The text box value is decreased by one when the user clicks the lower spin-button arrow or the left spin-button arrow and is incremented by one when the user clicks the upper spin-button arrow or the right spin-button arrow.

Copy code Copy code
Private Sub SpinButton1_SpinDown()
 Me.TextBox1.Value = Me.TextBox1.Value - 1
End Sub
Copy code Copy code
Private Sub SpinButton1_SpinUp()
 Me.TextBox1.Value = Me.TextBox1.Value + 1
End Sub

The following Click event procedure switches to print view and sets the magnification to 100 percent for the document where the command button named "cmdChangeView" resides.

Copy code Copy code
Private Sub cmdChangeView_Click()
 With Me.ActiveWindow.View
 .Type = wdPrintView
 .Zoom.Percentage = 100
 End With
End Sub


Using Control Values While Code Is Running (Word)

 Copy code hover
[image]

Using Control Values While Code Is Running (Word)
Send feedback

You can set and return some properties for ActiveX controls while Microsoft Visual Basic code is running. The following example sets the Text property of a text box to "Hello."

Copy code Copy code
TextBox1.Text = "Hello"

The data entered in a form by a user is lost when the form is closed. If you return the values of controls on a form after the form has been unloaded, you get the initial values for the controls rather than the values the user entered.

If you want to save the data entered in a form, you can save the information to module-level variables while the form is still running. The following example displays a form and saves the form data in public variables prior to unloading the form.

Copy code Copy code
'Code in module to declare public variables
Public strRegion As String
Public intSalesPersonID As Integer
Public blnCancelled As Boolean

'Code in form
Private Sub cmdCancel_Click()
 Module1.blnCancelled = True
 Unload Me
End Sub

Private Sub cmdOK_Click()
 'Save data
 intSalesPersonID = txtSalesPersonID.Text
 strRegion = lstRegions.List(lstRegions.ListIndex)
 Module1.blnCancelled = False
 Unload Me
End Sub

Private Sub UserForm_Initialize()
 Module1.blnCancelled = True
End Sub

'Code in module to display form
Sub LaunchSalesPersonForm()
 frmSalesPeople.Show
 If blnCancelled = True Then
 MsgBox "Operation Cancelled!", vbExclamation
 Else
 MsgBox "The Salesperson's ID is: " & _
 intSalesPersonID & _
 "The Region is: " & strRegion
 End If
End Sub


Using DAO from Microsoft Word

 Copy code hover
[image]

Using DAO from Microsoft Word
Send feedback

You can use Data Access Objects (DAO) properties, objects, and methods the same way that you reference and use Microsoft Word properties, objects, and methods. After you establish a reference to the DAO object library, you can open databases, design and run queries to extract a set of records, and bring the results back to Word.

Referencing DAO

Before you can use DAO, you must establish a reference to the DAO object library. Use the following steps to establish a reference to the DAO object library.

  1. Switch to the Microsoft Visual Basic Editor.

  2. On the Tools menu, click References.

  3. In the Available References box, select Microsoft DAO 3.6 Object Library.

The following example opens the Northwind database and inserts the items from the Shippers table into the active document.

Copy code Copy code
Sub UsingDAOWithWord()
 Dim docNew As Document
 Dim dbNorthwind As DAO.Database
 Dim rdShippers As Recordset
 Dim intRecords As Integer

 Set docNew = Documents.Add
 Set dbNorthwind = OpenDatabase _
 (Name:="C:\Program Files\Microsoft Office\Office11\" _
 & "Samples\Northwind.mdb")
 Set rdShippers = dbNorthwind.OpenRecordset(Name:="Shippers")
 For intRecords = 0 To rdShippers.RecordCount - 1
 docNew.Content.InsertAfter Text:=rdShippers.Fields(1).Value
 rdShippers.MoveNext
 docNew.Content.InsertParagraphAfter
 Next intRecords
 rdShippers.Close
 dbNorthwind.Close
End Sub

Use the OpenDatabase method to connect to a database and open it. After opening the database, use the OpenRecordset method to access a table or query for results. To navigate through the recordset, use the Move method. To find a specific record, use the Seek method. If you need only a subset of records instead of the entire recordset, use the CreateQueryDef method to design a customized query to select records that meet your criteria. When you finish working with a database, it is a good idea to close it using the Close method, to save memory.

Remarks

For more information about a specific DAO object, method, or property, see the information about Data Access Objects on MSDN.


Using Events with ActiveX Controls

 Copy code hover
[image]

Using Events with ActiveX Controls
Send feedback

Microsoft Word documents can contain Microsoft ActiveX controls. Use the Control Toolbox to insert ActiveX controls such as command buttons, check boxes, and list boxes. Use the following steps to add an ActiveX check box control with a LostFocus event.

  1. On the Developer tab, click the Check Box control. A check box control is inserted in the active document.

  2. Right-click the check box control and click View Code. Word switches to the Microsoft Visual Basic Editor and displays the ThisDocument class module with the check box selected in the Object drop-down list box.

  3. Select the LostFocus event from the Procedure drop-down list box. An empty procedure is added to the class module.

  4. Add the Visual Basic instructions you want to run when the event occurs.

The following example shows a LostFocus event procedure that runs when the focus is moved away from CheckBox1. The macro displays the state of CheckBox1 using the Value property (True for selected and False for clear).

Copy code Copy code
Private Sub CheckBox1_LostFocus()
 MsgBox CheckBox1.Value
End Sub

To see your event procedure run, switch back to Word with the document that includes the check box displayed. Click the Exit Design Mode button on the Control Toolbox. Select or clear the check box and then click another element in the document. The check box control loses the focus and your LostFocus procedure runs; a message box is displayed with either "True" or "False."

Word implements the LostFocus and GotFocus events for ActiveX controls in a Word document. The other events listed in the Procedure drop-down list box in are documented in Microsoft Forms Help.


Using Events with the Application Object (Word)

 Copy code hover
[image]

Using Events with the Application Object (Word)
Send feedback

To create an event handler for an event of the Application object, you need to complete the following three steps:

  1. Declare an object variable in a class module to respond to the events.

  2. Write the specific event procedures.

  3. Initialize the declared object from another module.

Declare the Object Variable

Before you can write procedures for the events of the Application object, you must create a new class module and declare an object of type Application with events. For example, assume that a new class module is created and called EventClassModule. The new class module contains the following code.

Copy code Copy code
Public WithEvents App As Word.Application

Write the Event Procedures

After the new object has been declared with events, it appears in the Object drop-down list box in the class module, and you can write event procedures for the new object. (When you select the new object in the Object box, the valid events for that object are listed in the Procedure drop-down list box.) Select an event from the Procedure drop-down list box; an empty procedure is added to the class module.

Copy code Copy code
Private Sub App_DocumentChange()

End Sub

Initialize the Declared Object

Before the procedure will run, you must connect the declared object in the class module (App in this example) with the Application object. You can do this with the following code from any module.

Copy code Copy code
Dim X As New EventClassModule
Sub Register_Event_Handler()
 Set X.App = Word.Application
End Sub

Run the Register_Event_Handler procedure. After the procedure is run, the App object in the class module points to the Microsoft Word Application object, and the event procedures in the class module will run when the events occur.


Using Events with the Document Object

 Copy code hover
[image]

Using Events with the Document Object
Send feedback

The Document object supports several events that enable you to respond to the state of a document. You write procedures to respond to these events in the class module named "ThisDocument." Use the following steps to create an event procedure.

  1. Under your Normal project or document project in the Project Explorer window, double-click ThisDocument. (In Folder view, ThisDocument is located in the Microsoft Word Objects folder.)

  2. Select Document from the Object drop-down list box.An empty subroutine for the New event is added to the class module.

  3. Select an event from the Procedure drop-down list box. An empty subroutine for the selected event is added to the class module.

  4. Add the Visual Basic instructions you want to run when the event occurs.

The following example shows a New event procedure in the Normal project that will run when a new document based on the Normal template is created.

Copy code Copy code
Private Sub Document_New()
 MsgBox "New document was created"
End Sub

The following example shows a Close event procedure in a document project that runs only when that document is closed.

Copy code Copy code
Private Sub Document_Close()
 MsgBox "Closing the document"
End Sub

Unlike auto macros, event procedures in the Normal template do not have a global scope. For example, event procedures in the Normal template occur only if the attached template is the Normal template.

If an auto macro exists in a document and the attached template, only the auto macro stored in the document will execute. If an event procedure for a document event exists in a document and its attached template, both event procedures will run.

Remarks

For information about creating event procedures for the Application object, see Using Events with the Application Object.


Working with Bibliographies

 Copy code hover
[image]

Working with Bibliographies
Send feedback

Introduction

The Microsoft Word 2013 object model includes several objects designed for automating the creation of bibliographies. The following table lists the main objects of the Word Bibliography feature. You can use these objects, and additional proerties and methods in the Word 2013 object model, to add sources to the source lists, cite sources in a document, and manage sources. The objects in the Word 2013 model for that you use for managing bibliography sources are shown in the following table.

Object | Description
Source | An individual source, such as a book, journal article, or interview.
Sources | A collection of Source objects.
Bibliography | The list of sources cited in the document (the current list) or the list of sources available in the application (in the master list).

Understanding the source XML

Sources are added to the source lists programmatically by using XML strings. Depending on the type of source you want to add, the required XML structure changes. To determine the XML structure for a source type, you can add the same source type manually, and then view the XML returned. The following steps describe how to do this.

  1. On the References ribbon, click Manage Sources.

  2. In the Source Manager dialog box, click New.

  3. In the Create Source dialog box, select the type of source to create. For this example, select Book.

  4. Fill out the source fields, as shown in the following table:

    Field

    Value

    Author

    Andrew Dixon

    Title

    Stylish Bibliographies

    Year

    2006

    City

    Chicago

    Publisher

    Adventure Works Press

    Tag name

    And01

  5. You can view and add information to additional fields by checking Show All Bibliography Fields.

  6. Click OK.

  7. Close the Source Manager dialog box.

  8. Start the Microsoft Visual Basic Editor (Alt+F11).

  9. Display the Immediate Window (Ctrl+G).

  10. Paste and run the following code.
Sub GetBibliographyXML()
    Dim strXml As String
    Dim objSource As Source

    Set objSource = Application.Bibliography.Sources( _
        Application.Bibliography.Sources.Count)

    Debug.Print objSource.XML
End Sub

After following the previous steps, the Immediate Window contains the following XML code.

VBA Copy code Copy code
<b:Source xmlns:b="http://schemas.microsoft.com/office/word/2004/10/bibliography">
    <b:Tag>And01</b:Tag>
    <b:SourceType>Book</b:SourceType>
    <b:Guid>{6D86D06C-9022-4932-8D4C-84C2B0843381}</b:Guid>
    <b:LCID>0</b:LCID>
    <b:Author>
        <b:Author>
            <b:NameList>
                <b:Person>
                    <b:Last>Dixon</b:Last>
                    <b:First>Andrew</b:First>
                </b:Person>
            </b:NameList>
        </b:Author>
    </b:Author>
    <b:Title>Stylish Bibliographies</b:Title>
    <b:Year>2006</b:Year>
    <b:City>Chicago</b:City>
    <b:Publisher>Adventure Works Press</b:Publisher>
</b:Source>

The Guid and LCID elements are optional, but you can provide values for them if you want. The Guid element value should be a valid GUID, which you can generate programmatically outside the Word object model. (See the Microsoft Visual Studio documentation or the Microsoft Windows documentation on MSDN for information about programmatically generating ID.) Word generates GUIDs when users add or edit a source. If you do not add a GUID to the XML and a user then edits a source, Word generates a GUID. This enables Word to determine which source is most recent, based on the value of the GUID, and to prompt whether the user wants Word to update the outdated source to maintain continuity between the master list and the current list.

The LCID specifies the language for the source. (See MSDN for valid language identification values.) Word uses the LCID to know how to display a cited source in a document's bibliography. For example, one source may be written in French, one in English, and one in Japanese. From the LCID, Word determines how to display names (for example, Last, First for English), what punctuation to use (for example, using comma in one language and a semicolon in another), and what strings to use (for example, whether to use "et al" or another localized form).

After removing optional elements, you may have a structure similar to the following XML structure. (You can determine which elements are required because they do not have a corresponding editable field in the Create Source dialog box. Omitting one or more required element raises a run-time error.)

VBA Copy code Copy code
<b:Source xmlns:b="http://schemas.microsoft.com/office/word/2004/10/bibliography">
    <b:Tag>And01</b:Tag>
    <b:SourceType></b:SourceType>
    <b:Author>
        <b:Author>
            <b:NameList>
                <b:Person>
                    <b:Last></b:Last>
                    <b:First></b:First>
                </b:Person>
            </b:NameList>
        </b:Author>
    </b:Author>
    <b:Title></b:Title>
    <b:Year></b:Year>
    <b:City></b:City>
    <b:Publisher></b:Publisher>
</b:Source>

Now that you have the basic structure of the source XML for a book, you can add additional book sources to the master source list and the current source list. You can locate additional elements by checking the Show All Bibliography Fields check box.

Note Note

Alternatively, you can obtain the XML from the bibliography source file named "sources.xml" located at C:\Users\<user>\AppData\Roaming\Microsoft\Bibliography. This file stores the master source list for a user.

Adding sources to the master source list and the current source list

Adding sources to the master source list is similar to adding sources to the current source list, with the exception that you access the Sources collection from different main objects. To add a source to the master source list, you access the Sources collection from the Bibliography property of the Application object. To add a source to the current source list, access the Sources collection from the Bibliography property of the Document object.

The following example uses the basic structure determined previously to add another book source to the master source list.

VBA Copy code Copy code
Sub AddBibSource()

    Dim strXml As String

    strXml = "<b:Source xmlns:b=""http://schemas.microsoft.com/" & _
        "office/word/2004/10/bibliography""><b:Tag>Mor01</b:Tag>" & _
        "<b:SourceType>Book</b:SourceType><b:Author><b:Author>" & _
        "<b:NameList><b:Person><b:Last>Hezi</b:Last>" & _
        "<b:First>Mor</b:First></b:Person></b:NameList></b:Author>" & _
        "</b:Author><b:Title>The New Office</b:Title>" & _
        "<b:Year>2006</b:Year><b:City>Seattle</b:City>" & _
        "<b:Publisher>Adventure Works Press</b:Publisher>" & _
        "</b:Source>"

    Application.Bibliography.Sources.Add strXml

End Sub

You can change the line Application.Bibliography.Sources.Add strXml to ActiveDocument.Bibliography.Sources.Add strXml

Inserting a source programmatically into the master source list does not automatically add it to the current source list. However, to add a citation to a document, the source must be listed in the current source list. You can manually copy one or more sources from the master list to the current list by using the Source Manager dialog box, or you can programmatically copy one or more sources from the master list to the current list. The following example copies all sources in the master source to the current source. After the sources are added to your current list, you can insert citations for those sources into a document.

VBA Copy code Copy code
Sub CopyToCurrentList()
    Dim objSource As Source
    Dim strXml As String

    On Error Resume Next

    For Each objSource In Application.Bibliography.Sources
        strXml = objSource.XML
        ActiveDocument.Bibliography.Sources.Add strXml
    Next
End Sub
Note Note

The value of the Tag property must be unique across sources in the current list. Thus the On Error Resume Next line is needed to allow the code to skip over any sources in the master list that have conflicting tag values in the current list. You can modify this code to capture instances when Word cannot copy a source from the master list to the current list.

Sharing your source list

There may be times when you want to share a source list with others in an organization. When you add sources to the master list, Word adds them to a file names "sources.xml" located at C:\Users\<user>\AppData\Roaming\Microsoft\Bibliography\sources.xml. You can share this file with others by giving them the file, which users can then load manually from the Source Manager dialog box or programmatically through code.

Note Note

When a user loads a source file, this is a one-time-only occurence and does not change either the existing master list or their current list. They can manually add the items in the shared source file to the current list by using the Source Manager dialog box.

You can programmatically load a shared source. The following example shows how to load a shared source file that is located on a share on a local computer.

VBA Copy code Copy code
Sub LoadSharedSource()
    Application.LoadMasterList "\\server\public\sources.xml"
End Sub
Note Note

Sharing the source.xml source file shares only sources in the master source list. Sources located in the current source are located in a document's data store. You can access this file by saving a document and opening the resulting DOCX file in a file compression application, such as WinZip. You can find the source file at the path "customXml" with a file name of (or similar to) "item1.xml". If you need to share the sources in a document with other users, you can share this file the same way that you would share the master list source file, as described previously.

Sorting the master source list

You can set the sort order in the Source Manager dialog box by using the BibliographySort property. The BibliographySort property can be a String value of "Author", "Tag", "Title", or "Year". This object does not alter the sorting of sources in the document's bibliography. The following example sorts the sources by title.

VBA Copy code Copy code
Sub SortBibliography()
    Options.BibliographySort = "Title"
End Sub

Inserting citations

You can insert a bibliography citation by using the Add method for the Fields collection. The following example inserts a citation at the cursor for the source that you added previously. The text for the field equals the tag value, or the value of the Tag element, which in this case is "Mor01". (See the XML code in the AddBibSource subroutine shown previously for the XML string "<b:Tag>Mor01</b:Tag>".) The value of the Tag element also corresponds to the Tag property for a Source object.

VBA Copy code Copy code
Sub InsertBibCitation()
    Selection.Fields.Add Selection.Range, _
        wdFieldCitation, "Mor01"
End Sub

Applying a bibliography style

After you insert a bibliography into a document, you can set the bibliography style. Word formats several different styles of bibliographies. You can set the bibliography style by using the BibliographyStyle property. This property can be one of the following String values:

  • APA

  • Chicago

  • GB7714

  • GOST - Name Sort

  • GOST - Title Sort

  • ISO 690 - First Element Date

  • ISO 690 - Numerical Reference

  • MLA

  • SISTO2

  • Turabian

Note Note

These values are included in Word 2013, but new values may be added at any point in the future as new bibliography styles are defined.

The following example sets the default bibliography style to the MLA style.

VBA Copy code Copy code
Sub SetBibliographyStyle()
    Options.BibliographyStyle = "MLA"
End Sub
Note Note

You can also define your own documentation style in XML. The directory C:\Program Files\Microsoft Office\Office15\1033\Bibliography\Style contains one XSL file for every documentation style on your computer. Open any file for a sample of how to create your own XSLT. Any user can share a custom bibliography style XSL file by placing it into the above folder on their computer.

Inserting a bibliography

As with citations, bibliographies use fields. To insert a bibliography, you need to insert a field with a wdFieldBibliography constant specified for the field type. The following code inserts a bibliography into the active document at the cursor. This example assumes that the cursor is located at the end of the document or on a new page.

VBA Copy code Copy code
Sub InsertBibliography()
    Selection.Fields.Add Selection.Range, _
        wdFieldBibliography
End Sub


Working with Building Blocks

 Copy code hover
[image]

Working with Building Blocks
Send feedback

Introduced in Word 2007, building blocks are similar to autotext entries in previous versions. However, with building blocks, you can organize entries in a way that enables you to determine how a user uses them. A custom building block helps users insert rich content anywhere in a document by using a formatted drop-down list. When used together with content controls, building blocks can enable you to develop powerful solutions quickly and easily.

The building blocks object model includes three new objects and four new collections. These enable you to create an organizational structure that works for your specific needs and to modify the structure for a specific solution. The new objects and collections are listed in the following table.

Name | Description
BuildingBlock | A specific building block entry.
BuildingBlocks | A collection of building block entries in a template that are of the same type and category.
BuildingBlockEntries | A collection of all the building blocks in a template.
BuildingBlockType | A building block type.
BuildingBlockTypes | A collection of building block types.
Category | A building block category.
Categories | A collection of building block categories.

Understanding Building Blocks

Building blocks are organized by type and category. Building block types are composed of a limited number of WdBuildingBlockTypes constants. Although there are a limited number of these constants, that number is not small. There are 35 different WdBuildingBlockTypes constants. These types help you to define and organize your building blocks and, although you cannot create additional building block types, you can create an unlimited number of categories for each type.

Categories are composed of an unlimited number of strings that you can define to organize your custom building blocks. Building blocks are stored in templates. By default, the templates that are included with Microsoft Word have building block categories like "General" and "Built-In". However, you are not limited to just the categories that are included in these templates. A category can be any string that you define. Types and categories are explained later in this topic.

Because you can organize building blocks into types and categories, building blocks can be incredibly flexible. For example, you can have a building block named "Title" that has a type of wdTypeBibliography and a category of "Book Titles" and another building block named "Title" that has a type of wdTypeBibliography and a category of "Movie Titles" and then you can have yet another building block named "Title" that has a type of wdTypeCustomHeaders and a category of "Book Titles" and so on. The incredible flexibility that building blocks provide help you to create custom solutions without writing code.

However, building block are also programmable. You can create new building blocks, delete building blocks, and manage building blocks programmatically. You can also watch for when users insert new building blocks into a document by using the BuildingBlockInsert event. Plus, you can use building blocks with content controls to give you even greater control over which building blocks users can insert into their documents. For example, you can use a building block content control to filter the types of building blocks that a user sees, which means that the user cannot insert a building block into a document that is not allowed at a specific place in the document. There are several examples in the following sections that show you how to use the building block objects to work with building blocks programmatically.

Simple Tasks

The following sections provide simple examples of how to do specific tasks using the building block objects. You can find additional code examples in the object topics and in many of the member topics.

Creating a Custom Building Block

Creating a custom building block is as simple as using the Add method for the BuildingBlockEntries collection. You can also use the Add method for the BuildingBlocks collection; however, this method may raise a run-time error if there are currently no building blocks for the specified type or category. As explained in the table of objects, the BuildingBlocks collection is a collection of building blocks for a specific type and category. The BuildingBlocksEntries collection contains all the building blocks for a template. Therefore, the preferred way to add new building blocks programmatically is to use the Add method for the BuildingBlockEntries collection.

The following code example collapses the current selection, creates a range and specifies the text for the range, and then adds the selection as a custom building block to the collection of building block entries in the template attached to the current document.

VBA Copy code Copy code
Sub AddCustomBuildingBlock()

 Dim objTemplate As Template
 Dim objBB As BuildingBlock
 Dim objRange As Range

 ' Set the template to store the building block
 Set objTemplate = ActiveDocument.AttachedTemplate

 ' Collapse the range, set the range, and add the text
 Selection.Collapse
 Set objRange = Selection.Range
 objRange.Text = "Building blocks for the technically challenged"

 ' Add the building block to the template
 Set objBB = objTemplate.BuildingBlockEntries.Add( _
 Name:="Title", _
 Type:=wdTypeCustomHeaders, _
 Category:="Book Titles", _
 Range:=objRange)

End Sub

Adding a New Category

As mentioned previously, you can add an unlimited number of categories. However, there is no Add method for the Categories collection. Therefore, to add a new category to the collection, you need to add a new building block. For example, in the previous code sample, if the "Book Titles" category does not exist when you run the code, Word adds it to the Categories collection.

Accessing an Existing Building Block

At some point you will want to access one of the building blocks that you have, whether that is a custom building block or one of the built-in building blocks. You could use the BuildingBlockEntries collection; however, because building blocks can share the same name, you would need to identify the type and category for the building block before knowing which one you want returned. Therefore, the best way to access existing building blocks is through the BuildingBlocks collection.

The following code example accesses the building block that you added in the previous code example.

VBA Copy code Copy code
Sub GetExistingBuildingBlock()

 Dim objTemplate As Template
 Dim objBB As BuildingBlock

 ' Set the template to store the building block
 Set objTemplate = ActiveDocument.AttachedTemplate

 ' Access the building block through the type and category
 Set objBB = objTemplate.BuildingBlockTypes(wdTypeCustomHeaders) _
 .Categories("Book Titles").BuildingBlocks("Title")

End Sub

Inserting a Building Block into a Document

After you have access to a building block, use the Insert method of the BuildingBlock object to insert it into a document. The following code example expands the previous code sample by adding a line for inserting the building into the active document at the Insertion Point (or for replacing the selected text, if text is selected).

Note Note

When you insert a building block by using the ribbon, Word automatically determines certain things about the building block, such as where to insert it; however, when you insert a buildng block through the object model, none of this built-in intelligence automatically happens. For example, when you insert a header building block by using the ribbon, Word automatically determines to replace the existing header. When inserting the same header building block by using the object model, you need to explicitly specify where to place the building block text.
VBA Copy code Copy code
Sub InsertExistingBuildingBlock()

 Dim objTemplate As Template
 Dim objBB As BuildingBlock

 ' Set the template to store the building block
 Set objTemplate = ActiveDocument.AttachedTemplate

 ' Access the building block through the type and category
 Set objBB = objTemplate.BuildingBlockTypes(wdTypeCustomHeaders) _
 .Categories("Book Titles").BuildingBlocks("Title")

 ' Insert the building block into the document replacing any selected text.
 objBB.Insert Selection.Range

End Sub

Filtering a List of Building Blocks in a Content Control

If you combine building blocks with content controls, you can filter which building blocks a user can access. You do this using a content control and an event. When a user enters a content control, the ContentControlOnEnter event for the Document object fires. This event has a parameter for the active content control. You can determine whether the content control is a building block content control. If it is, you use the BuildingBlockType property and the BuildingBlockCategory property to identify which type and category to use to filter the list of building blocks that are available for the content control. This specifies which building blocks show up in the drop-down list in the content control header.

The following code example assumes that there is at least one content control in the document. If the content control is a building block content control, the list of building blocks displayed in the building block list in the content control header includes only those added by using the AddCustomBuildingBlock subroutine shown earlier in this topic. For more information about content controls, see Working with Content Controls.

VBA Copy code Copy code
Private Sub Document_ContentControlOnEnter(ByVal ContentControl As ContentControl)
 Dim objCC As ContentControl

 Set objCC = ContentControl

 If objCC.Type = wdContentControlBuildingBlockGallery Then
 objCC.BuildingBlockType = wdTypeCustomHeaders
 objCC.BuildingBlockCategory = "Book Titles"
 End If
End Sub


Working with Charts

 Copy code hover
[image]

Working with Charts
Send feedback

In Word 2007 Service Pack 2 (SP2) and later, you can programmatically access and manipulate charts using the VBA object model in Word. The chart object in Word is drawn by the same shared Office drawing layer implementation used by Excel, so if you are familiar with the charting object model in Excel, you can easily migrate Excel VBA code that manipulates charts into Word VBA code.

Using the Chart Object

In Word, a chart is represented by a Chart object. The Chart object is contained by an InlineShape or Shape. You can use either the InlineShapes collection or the Shapes collection of the Document object to add new or access existing charts. You use the AddChart method for both collections, specifying the chart type and location within the document, to add a new chart.

You can use the HasChart property to determine if an InlineShape object or Shape object contains a chart. If HasChart returns True, you can then use the Chart property to get a reference to a Chart object that represents the chart. At this point, the implementation is virtually identical as that of Excel and VBA code can be transferred between the two programs in most cases.

For example, the following VBA code example adds a new 2-D stacked column chart to the active worksheet in Excel and sets the chart's source data to the range A1:C3 from the Sheet1 worksheet.

VBA Copy code Copy code
Sub AddChart_Excel()
    Dim objShape As Shape

    ' Create a chart and return a Shape object reference.
    ' The Shape object reference contains the chart.
    Set objShape = ActiveSheet.Shapes.AddChart(XlChartType.xlColumnStacked100)

    ' Ensure the Shape object contains a chart. If so,
    ' set the source data for the chart to the range A1:C3.
    If objShape.HasChart Then
        objShape.Chart.SetSourceData Source:=Range("'Sheet1'!$A$1:$C$3")
    End If
End Sub

By comparison, the following VBA code example adds a new 2-D stacked column chart to the active document in and sets the chart's source data to the range A1:C3 from the chart data associated with the chart.

VBA Copy code Copy code
Sub AddChart_Word()
    Dim objShape As InlineShape

    ' Create a chart and return a Shape object reference.
    ' The Shape object reference contains the chart.
    Set objShape = ActiveDocument.InlineShapes.AddChart(XlChartType.xlColumnStacked100)

    ' Ensure the Shape object contains a chart. If so,
    ' set the source data for the chart to the range A1:C3.
    If objShape.HasChart Then
        objShape.Chart.SetSourceData Source:="'Sheet1'!$A$1:$C$3"
    End If
End Sub

Key Differences Between the Chart object in Word and the ChartObject object in Excel

Even though how you work with charts between Excel and Word is nearly identical in most cases, it is helpful to identify important areas where the two implementations differ:

  • Programmatically creating or manipulating a ChartData object in Word requires Excel to run.

  • Chart properties and methods for manipulating the chart sheet are not implemented. The concept of a chart sheet is specific to Excel. Chart sheets are not used in Word, so methods and properties used to reference or manipulate a chart sheet have been disabled for those applications.

  • Properties and methods that, in Excel normally take a Range object reference now take a range address in Word. The Range object in Word is different than the Range object in Excel. To prevent confusion, the charting object model in Word accepts range address strings, such as "='Sheet1'!$A$1:$D$5", in those properties and methods (such as the SetSourceData method of the Chart object) that accept Range objects in Excel.

  • A new object, ChartData, has been added to the VBA object models for Word to provide access to the underlying linked or embedded data for a chart. Each chart has, associated with it, the data used to draw the chart in Word. The chart data can either be linked from an external Excel workbook, or embedded as part of the chart itself. The ChartData object encapsulates access to the data for a given chart in Word. For example, the following VBA code example displays, and then minimizes, the chart data for each chart contained by the active document in Word.

VBA Copy code Copy code
Sub ShowWorkbook_Word()
    Dim objShape As InlineShape

    ' Iterates each inline shape in the active document.
    ' If the inline shape contains a chart, then display the
    ' data associated with that chart and minimize the application
    ' used to display the data.
    For Each objShape In ActiveDocument.InlineShapes
        If objShape.HasChart Then

            ' Activate the topmost window of the application used to
            ' display the data for the chart.
            objShape.Chart.ChartData.Activate

            ' Minimize the application used to display the data for
            ' the chart.
            objShape.Chart.ChartData.Workbook.Application.WindowState = -4140
        End If
    Next
End Sub


Working with Content Controls

 Copy code hover
[image]

Working with Content Controls
Send feedback

What Are Content Controls?

Content controls are bounded and potentially labeled regions in a document that serve as containers for specific types of content. Individual content controls can contain content such as dates, lists, or paragraphs of formatted text. In some cases, content controls might remind you of forms. However, they are much more powerful, flexible, and useful because they enable you to create rich, structured blocks of content. Content controls enable you to author templates that insert well-defined blocks into your documents. Content controls enable you to:

  • Specify structured regions in a template. Each structured region has its own unique ID so that you can read from and write to it. Examples of types of structured regions (or content controls) are combo boxes, pictures, text blocks, and calendars.

  • Determine the behavior of content controls. Each content control takes up a portion of a document and, as the template author, you can specify what each region does. For example, if you want a region of your template to be a calendar, you insert a calendar content control in that area of the document, which automatically determines what that block of content does. Similarly, if you want a section of a template to display an image, create a picture content control in that area. In this way, you can build a template with predefined block types.

  • Restrict the ability to modify content controls within a document. Each content control can be restricted, so that it cannot be deleted or edited. This is useful if, for example, you have copyright information in a template that the user should be able to read but not edit. Or, as another example, you can also lock a content control that you have placed within a template document so that a user does not accidentally delete the content contained in the content control. This makes templates more robust than in previous versions.

  • Map the contents of a content control to data in a custom XML part. For example, if you insert plain text content controls into cells of a table of stock prices, you can map the content controls in the table cells to nodes in an XML file that contain the current stock prices. When the prices change, an add-in can programmatically update the attached XML file, which is bound to each plain text content control, and the new, updated prices automatically appear in the table.

The easiest way to create a content control is through the user interface (although you can also create them programmatically). To create a content control through the user interface (UI), select the content that you want to turn into a content control (for example, some text or a picture) and then choose the content control type you want from the content controls section of the Developer ribbon. This creates a content control around the selected content.

Content Controls in the Word Object Model

The following table shows the objects in the Word object model that relate to content controls.

Name | Description
ContentControl | Each ContentControl object represents an individual content control within a document. Use the ContentControls collection to access individual ContentControl objects.
ContentControls | You can use the ContentControls properties of the Document, Range, and Selection objects to access the collection of content controls. You can also use the SelectContentControlsByTitle method and the SelectContentControlsByTag method of the Document object to access a ContentControls collection that includes specific content controls that all have the same title or tag value.
ContentControlListEntry | When a content control is a drop-down list or combo box, the ContentControlListEntry object represents individual items within the list.
ContentControlListEntries | Use the DropdownListEntries property of the ContentControl object to access all the items in an individual drop-down list or combo box.

Each of these objects or collections has methods and properties that allow you to work with the content controls both individually and as a collection. Because there are various types of content controls (see the following section "Types of Content Controls"), the ContentControl object has members that might not apply to all the different types of content controls. The following table shows those properties and methods of the ContentControl object that only apply to certain types of content controls.

Note Note

For a complete list of all properties and methods of the ContentControl object, see ContentControl Members.

Property/Method | Applies To
BuildingBlockCategory property | BuildingBlock Gallery content controls (wdContentControlBuildingBlockGallery)
BuildingBlockType property | BuildingBlock Gallery content controls (wdContentControlBuildingBlockGallery)
DateDisplayFormat property | Date content controls (wdContentControlDate)
DateDisplayLocale property | Date content controls (wdContentControlDate)
DateStorageFormat property | Date content controls (wdContentControlDate)
DropdownListEntries property | Combo box and drop-down list content controls (wdContentControlComboBox and wdContentControlDropdownList)
MultiLine property | Plain-text content controls (wdContentControlText)
Ungroup method | Group content controls (wdContentControlGroup)
SetCheckedSymbol method | Check Box content control (wdContentControlCheckBox)
SetUncheckedSymbol method | Check Box content control (wdContentControlCheckBox)

Types of Content Controls

There are eight different types of content controls that you can add to a document, each of which is represented in a new enumeration called WdContentControlType.

Content Control Type | Description | WdContentControlType Constant
 | A checkbox. | wdContentControlCheckBox
Calendar | A date-time picker. | wdContentControlDate
Building Block | Enables the user to choose from specified building blocks. | wdContentControlBuildingBlockGallery
Drop-Down List | A drop-down list. | wdContentControlDropDownList
Group | Defines a protected region of a document that users cannot edit or delete. A group control can contain any document items, such as text, tables, graphics, and other content controls. | wdContentControlGroup
Combo Box | A combo box. | wdContentControlComboBox
Picture | A picture. | wdContentControlBlockPicture
Rich Text | A block of rich text. | wdContentControlRichText
Plain Text | A block of plain text. | wdContentControlText

Content Control Events

In addition to the properties and methods available with the content control object model in Word, you can also use several events that allow you to run code when adding or removing a content control or when a user edits a content control. The following list describes each of the events and when the event code runs. All of these events are members of the Document object.

Event Name | Description
ContentControlAfterAdd | Occurs after adding a new content control to a document. This event runs whether the user adds the content control by using the tools in the UI or adds them by using code.
ContentControlBeforeContentUpdate | Occurs before Word updates the content in a content control.
ContentControlBeforeDelete | Occurs before a user deletes a content control. This event runs whether the user deletes the content control by using the tools in the UI or deletes them by using code.
ContentControlBeforeStoreUpdate | Occurs before Word updates the contents of a content control from data in the document's data store.
ContentControlOnEnter | Occurs when a user enters a content control.
ContentControlOnExit | Occurs when a user exits a content control.

Working with the Code

Whether you want to add a content control, delete a content control, or access and manipulate existing content controls, you can do it with code. The following sections are just a few samples of what you can do.

Adding a Content Control

As mentioned previously, there are eight different types of content controls that you can add to your documents. Use the Add method of the ContentControls collection to add a content control to a document. The following example adds a date picker to the active document and sets the date value to the current date.

VBA Copy code Copy code
Sub AddDatePicker()

    Dim objCC As ContentControl
    Dim objDate As Date

    Set objCC = ActiveDocument.ContentControls _
        .Add(wdContentControlDate)
    objDate = Date
    objCC.Range.Text = objDate

End Sub

You can use the same basic construction to add any of the different types of content controls to a document.

Adding a Title to a Content Control

Use the Title property to add a title to a content control. This is text that users see, and it can help them to know what type of data to enter into the content control. The following example adds a new plain-text content control to the active document and sets the title, or display text, for the control.

VBA Copy code Copy code
Sub SetTitleForContentControl()

    Dim objCC As ContentControl

    Set objCC = ActiveDocument.ContentControls _
        .Add(wdContentControlText)

    objCC.Title = "Please enter your name"

End Sub

Modifying Placeholder Text to a Content Control

Placeholder text is temporary text. It can be a simple one-word or two-word description (similar to the title) or it can be a more thorough description (such as numbered steps). Modifying the placeholder text is the same regardless of the type of content control or the expected contents of the content control. The following example adds a drop-down list to the active document, sets the placeholder text for the control, and then fills the list with the names of several animals.

VBA Copy code Copy code
Sub SetPlaceholderText()

    Dim objCC As ContentControl

    Set objCC = Selection.ContentControls _
        .Add(wdContentControlComboBox)
    objCC.Title = "Favorite Animal"
    objCC.SetPlaceholderText _
        Text:="Please select your favorite animal "

    'List entries
    objCC.DropdownListEntries.Add "Cat"
    objCC.DropdownListEntries.Add "Dog"
    objCC.DropdownListEntries.Add "Horse"
    objCC.DropdownListEntries.Add "Monkey"
    objCC.DropdownListEntries.Add "Snake"
    objCC.DropdownListEntries.Add "Other"

End Sub

These are just a few of the ways that you can use the object model to manipulate content controls in your documents. For more examples, see the How To section.


Working with Document Objects

 Copy code hover
[image]

Working with Document Objects
Send feedback

In Microsoft Visual Basic, the methods for modifying files are methods of the Document object or the Documents collection. This topic includes Visual Basic examples related to the following tasks:

  • Creating a new document

  • Opening a document

  • Saving an existing document

  • Saving a new document

  • Activating a document

  • Determining if a document is open

  • Referring to the active document

Creating a new document

The Documents collection includes all of the open documents. To create a new document, use the Add method to add a Document object to the Documents collection. The following instruction creates a document.

Copy code Copy code
Documents.Add

A better way to create a document is to assign the return value to an object variable. The Add method returns a Document object that refers to the new document. In the following example, the Document object returned by the Add method is assigned to an object variable. Then, several properties and methods of the Document object are set. You can easily control the new document using an object variable.

Copy code Copy code
Sub NewSampleDoc()
    Dim docNew As Document
    Set docNew = Documents.Add
    With docNew
        .Content.Font.Name = "Tahoma"
        .SaveAs FileName:="Sample.doc"
    End With
End Sub

Opening a document

To open an existing document, use the Open method with the Documents collection. The following instruction opens a document named Sample.doc located in the MyFolder folder.

Copy code Copy code
Sub OpenDocument()
    Documents.Open FileName:="C:\MyFolder\Sample.doc"
End Sub

Saving an existing document

To save a single document, use the Save method with the Document object. The following instruction saves the document named Sales.doc.

Copy code Copy code
Sub SaveDocument()
    Documents("Sales.doc").Save
End Sub

You can save all open documents by applying the Save method to the Documents collection. The following instruction saves all open documents.

Copy code Copy code
Sub SaveAllOpenDocuments()
    Documents.Save
End Sub

Saving a new document

To save a single document, use the SaveAs2 method with a Document object. The following instruction saves the active document as "Temp.doc" in the current folder.

Copy code Copy code
Sub SaveNewDocument()
    ActiveDocument.SaveAs FileName:="Temp.doc"
End Sub

The FileName argument can include only the file name or the complete path (for example, "C:\Documents\Temporary File.doc").

Closing documents

To close a single document, use the Close method with a Document object. The following instruction closes and saves the document named Sales.doc.

Copy code Copy code
Sub CloseDocument()
    Documents("Sales.doc").Close SaveChanges:=wdSaveChanges
End Sub

You can close all open documents by applying the Close method of the Documents collection. The following instruction closes all documents without saving changes.

Copy code Copy code
Sub CloseAllDocuments()
    Documents.Close SaveChanges:=wdDoNotSaveChanges
End Sub

The following example prompts the user to save each document before the document is closed.

Copy code Copy code
Sub PromptToSaveAndClose()
    Dim doc As Document
    For Each doc In Documents
        doc.Close SaveChanges:=wdPromptToSaveChanges
    Next
End Sub

Activating a document

To change the active document, use the Activate method with a Document object. The following instruction activates the open document named Sales.doc.

Copy code Copy code
Sub ActivateDocument()
    Documents("Sales.doc").Activate
End Sub

Determining if a document is open

To determine if a document is open, you can enumerate the Documents collection by using a For Each...Next statement. The following example activates the document named Sample.doc if the document is open, or opens Sample.doc if it is not currently open.

Copy code Copy code
Sub ActivateOrOpenDocument()
    Dim doc As Document
    Dim docFound As Boolean

    For Each doc In Documents
        If InStr(1, doc.Name, "sample.doc", 1) Then
            doc.Activate
            docFound = True
            Exit For
        Else
            docFound = False
        End If
    Next doc

    If docFound = False Then Documents.Open FileName:="Sample.doc"
End Sub

Referring to the active document

Instead of referring to a document by name or by index number—for example, Documents("Sales.doc") —the ActiveDocument property returns a Document object that refers to the active document (the document with the focus). The following example displays the name of the active document, or if there are no documents open, it displays a message.

Copy code Copy code
Sub ActiveDocumentName()
    If Documents.Count >= 1 Then
        MsgBox ActiveDocument.Name
    Else
        MsgBox "No documents are open"
    End If
End Sub


Working with Range Objects

 Copy code hover
[image]

Working with Range Objects
Send feedback

A common task when using Microsoft Visual Basic is to specify an area in a document and then do something with it, such as insert text or apply formatting. For example, you may want to write a macro that locates a word or phrase within a portion of a document. The portion of the document can be represented by a Range object. After the Range object is identified, methods and properties of the Range object can be applied to modify the contents of the range.

A Range object refers to a contiguous area in a document. Each Range object is defined by a starting and ending character position. Similar to the way bookmarks are used in a document, Range objects are used in Visual Basic procedures to identify specific portions of a document. A Range object can be as small as the insertion point or as large as the entire document. However, unlike a bookmark, a Range object exists only while the procedure that defined it is running.

The Start, End, and StoryType properties uniquely identify a Range object. The Start and End properties return or set the starting and ending character positions of the Range object. The character position at the beginning of the document is zero, the position after the first character is one, and so on. There are 11 different story types represented by the WdStoryType constants of the StoryType property.

Note Note

Range objects are independent of the selection. That is, you can define and modify a range without changing the current selection. You can also define multiple ranges in a document, but there is only one selection per document pane.

Using the Range method

Use the Range method of the Document object to create a Range object that is located in the main story and has a given start and endpoint. The following example creates a Range object that starts at the beginning of the first character and extends through the tenth character.

Copy code Copy code
Sub SetNewRange()
 Dim rngDoc As Range
 Set rngDoc = ActiveDocument.Range(Start:=0, End:=10)
End Sub

You can see that the Range object is created when you apply a property or method to the Range object. For example, the following applies bold formatting to the first 10 characters in the active document.

Copy code Copy code
Sub SetBoldRange()
 Dim rngDoc As Range
 Set rngDoc = ActiveDocument.Range(Start:=0, End:=10)
 rngDoc.Bold = True
End Sub

When you need to refer to a Range object multiple times, you can use the Set statement to set a variable equal to the Range object. However, if you only need to perform a single action on a Range object, you do not need to store the object in a variable. The same result can be achieved using just one instruction that identifies the range and changes the Bold property.

Copy code Copy code
Sub BoldRange()
 ActiveDocument.Range(Start:=0, End:=10).Bold = True
End Sub

Like a bookmark, a range can span a group of characters or mark a location in a document. The Range object in the following example has the same starting and ending points. The range does not include any text. The following example inserts text at the beginning of the active document.

Copy code Copy code
Sub InsertTextBeforeRange()
 Dim rngDoc As Range
 Set rngDoc = ActiveDocument.Range(Start:=0, End:=0)
 rngDoc.InsertBefore "Hello "
End Sub

You can define the beginning and endpoints of a range using the character position numbers, as shown above, or use the Start and End properties with objects such as Selection, Bookmark, or Range objects. The following example creates a Range object beginning at the start of the second paragraph and ending after the third paragraph.

Copy code Copy code
Sub NewRange()
 Dim doc As Document
 Dim rngDoc As Range

 Set doc = ActiveDocument
 Set rngDoc = doc.Range(Start:=doc.Paragraphs(2).Range.Start, _
 End:=doc.Paragraphs(3).Range.End)
End Sub

For additional information and examples, see the Range method.

Using the Range property

The Range property appears on multiple objects—such as Paragraph, Bookmark, and Cell—and is used to return a Range object. The following example returns a Range object that refers to the first paragraph in the active document.

Copy code Copy code
Sub SetParagraphRange()
 Dim rngParagraph As Range
 Set rngParagraph = ActiveDocument.Paragraphs(1).Range
End Sub

After you have a Range object, you can use any of its properties or methods to modify the Range object. The following example selects the second paragraph in the active document and then centers the selection.

Copy code Copy code
Sub FormatRange()
 ActiveDocument.Paragraphs(2).Range.Select
 Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
End Sub

If you need to apply numerous properties or methods to the same Range object, you can use the With…End With structure. The following example formats the text in the first paragraph of the active document.

Copy code Copy code
Sub FormatFirstParagraph()
 Dim rngParagraph As Range
 Set rngParagraph = ActiveDocument.Paragraphs(1).Range
 With rngParagraph
 .Bold = True
 .ParagraphFormat.Alignment = wdAlignParagraphCenter
 With .Font
 .Name = "Stencil"
 .Size = 15
 End With
 End With
End Sub

For additional information and examples, see the Range property topic.

Redefining a Range object

Use the SetRange method to redefine an existing Range object. The following example defines a range as the current selection. The SetRange method then redefines the range so that it refers to the current selection plus the next 10 characters.

Copy code Copy code
Sub ExpandRange()
 Dim rngParagraph As Range
 Set rngParagraph = Selection.Range
 rngParagraph.SetRange Start:=rngParagraph.Start, _
 End:=rngParagraph.End + 10
End Sub

For additional information and examples, see the Range method for the Document.

Note Note

When debugging your macros, you can use the Select method to ensure that a Range object is referring to the correct range of text. For example, the following selects a Range object that refers to the second and third paragraphs in the active document, and then formats the font of the selection.
Copy code Copy code
Sub SelectRange()
 Dim rngParagraph As Range

 Set rngParagraph = ActiveDocument.Paragraphs(2).Range

 rngParagraph.SetRange Start:=rngParagraph.Start, _
 End:=ActiveDocument.Paragraphs(3).Range.End
 rngParagraph.Select

 Selection.Font.Italic = True
End Sub


Working with Tables

 Copy code hover
[image]

Working with Tables
Send feedback

This topic includes Microsoft Visual Basic examples related to the following tasks:

  • Creating a table, inserting text, and applying formatting

  • Inserting text into a table cell

  • Returning text from a table cell without returning the end of cell marker

  • Converting text to a table

  • Returning the contents of each table cell

  • Copying all tables in the active document into a new document

Creating a table, inserting text, and applying formatting

The following example inserts a four-column, three-row table at the beginning of the active document. The For Each...Next structure is used to step through each cell in the table. Within the For Each...Next structure, the InsertAfter method of the Range object is used to add text to the table cells (Cell 1, Cell 2, and so on).

Copy code Copy code
Sub CreateNewTable()
 Dim docActive As Document
 Dim tblNew As Table
 Dim celTable As Cell
 Dim intCount As Integer

 Set docActive = ActiveDocument
 Set tblNew = docActive.Tables.Add( _
 Range:=docActive.Range(Start:=0, End:=0), NumRows:=3, _
 NumColumns:=4)
 intCount = 1

 For Each celTable In tblNew.Range.Cells
 celTable.Range.InsertAfter "Cell " & intCount
 intCount = intCount + 1
 Next celTable

 tblNew.AutoFormat Format:=wdTableFormatColorful2, _
 ApplyBorders:=True, ApplyFont:=True, ApplyColor:=True
End Sub

Inserting text into a table cell

The following example inserts text into the first cell of the first table in the active document. The Cell method returns a single Cell object. The Range property returns a Range object. The Delete method is used to delete the existing text and the InsertAfter method inserts the "Cell 1,1" text.

Copy code Copy code
Sub InsertTextInCell()
 If ActiveDocument.Tables.Count >= 1 Then
 With ActiveDocument.Tables(1).Cell(Row:=1, Column:=1).Range
 .Delete
 .InsertAfter Text:="Cell 1,1"
 End With
 End If
End Sub

Returning text from a table cell without returning the end of cell marker

The following example returns and displays the contents of each cell in the first row of the first document table.

Copy code Copy code
Sub ReturnTableText()
 Dim tblOne As Table
 Dim celTable As Cell
 Dim rngTable As Range

 Set tblOne = ActiveDocument.Tables(1)
 For Each celTable In tblOne.Rows(1).Cells
 Set rngTable = ActiveDocument.Range(Start:=celTable.Range.Start, _
 End:=celTable.Range.End - 1)
 MsgBox rngTable.Text
 Next celTable
End Sub
Copy code Copy code
Sub ReturnCellText()
 Dim tblOne As Table
 Dim celTable As Cell
 Dim rngTable As Range

 Set tblOne = ActiveDocument.Tables(1)
 For Each celTable In tblOne.Rows(1).Cells
 Set rngTable = celTable.Range
 rngTable.MoveEnd Unit:=wdCharacter, Count:=-1
 MsgBox rngTable.Text
 Next celTable
End Sub

Converting existing text to a table

The following example inserts tab-delimited text at the beginning of the active document and then converts the text to a table.

Copy code Copy code
Sub ConvertExistingText()
 With Documents.Add.Content
 .InsertBefore "one" & vbTab & "two" & vbTab & "three" & vbCr
 .ConvertToTable Separator:=Chr(9), NumRows:=1, NumColumns:=3
 End With
End Sub

Returning the contents of each table cell

The following example defines an array equal to the number of cells in the first document table (assuming Option Base 1). The For Each...Next structure is used to return the contents of each table cell and assign the text to the corresponding array element.

Copy code Copy code
Sub ReturnCellContentsToArray()
 Dim intCells As Integer
 Dim celTable As Cell
 Dim strCells() As String
 Dim intCount As Integer
 Dim rngText As Range

 If ActiveDocument.Tables.Count >= 1 Then
 With ActiveDocument.Tables(1).Range
 intCells = .Cells.Count
 ReDim strCells(intCells)
 intCount = 1
 For Each celTable In .Cells
 Set rngText = celTable.Range
 rngText.MoveEnd Unit:=wdCharacter, Count:=-1
 strCells(intCount) = rngText
 intCount = intCount + 1
 Next celTable
 End With
 End If
End Sub

Copying all tables in the active document into a new document

This example copies the tables from the current document into a new document.

Copy code Copy code
Sub CopyTablesToNewDoc()
 Dim docOld As Document
 Dim rngDoc As Range
 Dim tblDoc As Table

 If ActiveDocument.Tables.Count >= 1 Then
 Set docOld = ActiveDocument
 Set rngDoc = Documents.Add.Range(Start:=0, End:=0)
 For Each tblDoc In docOld.Tables
 tblDoc.Range.Copy
 With rngDoc
 .Paste
 .Collapse Direction:=wdCollapseEnd
 .InsertParagraphAfter
 .Collapse Direction:=wdCollapseEnd
 End With
 Next
 End If
End Sub


Working with the Selection Object

 Copy code hover
[image]

Working with the Selection Object
Send feedback

When you work on a document in Microsoft Word, you usually select text and then perform an action, such as formatting the text or typing text. In Microsoft Visual Basic, it is usually not necessary to select text before modifying the text. Instead, you create a Range object that refers to a specific portion of the document. For information about defining Range objects, see Working with Range objects. However, when you want your code to respond to or change a selection, you can do so by using the Selection object.

If text is not already selected, use the Select method to select the text that is associated with a specific object and create a Selection object. For example, the following instruction selects the first word in the active document.

Copy code Copy code
Sub SelectFirstWord()
 ActiveDocument.Words(1).Select
End Sub

For more information, see Selecting text in a document.

If text is already selected, use the Selection property to return a Selection object that represents the current selection in a document. There can be only one Selection object per document, and it always accesses the current selection. The following example changes the formatting of the paragraphs in the current selection.

Copy code Copy code
Sub FormatSelection()
 Selection.Paragraphs.LeftIndent = InchesToPoints(0.5)
End Sub

This example inserts the word "Hello" after the current selection.

Copy code Copy code
Sub InsertTextAfterSelection()
 Selection.InsertAfter Text:="Hello "
End Sub

This example applies bold formatting to the selected text.

Copy code Copy code
Sub BoldSelectedText()
 Selection.Font.Bold = True
End Sub

The macro recorder often creates a macro that uses the Selection object. The following example was created using the macro recorder. This macro selects the first two words in the active document and applies bold formatting to them.

Copy code Copy code
Sub Macro()
 Selection.HomeKey Unit:=wdStory
 Selection.MoveRight Unit:=wdWord, Count:=2, Extend:=wdExtend
 Selection.Font.Bold = wdToggle
End Sub

The following example accomplishes the same task without selecting the text or using the Selection object.

Copy code Copy code
Sub WorkingWithRanges()
 ActiveDocument.Range(Start:=0, _
 End:=ActiveDocument.Words(2).End).Bold = True
End Sub


Working with the UndoRecord Object

 Copy code hover
[image]

Working with the UndoRecord Object
Send feedback

As end users work in Microsoft Word, the actions they take that can be undone are recorded in a queue—the "undo stack"—so that if the user decides to reverse the action, Word can recall the action taken and undo it. The undo stack is visible through the Word user interface on the ribbon through the Undo button, where each action is listed as a discrete record in the stack. Automation using the Word object model also writes these "undo records" to the undo stack, but working with undo stack using can be problematic.

Developers sometimes write code that performs one logical task using a series of actions, where each action is recorded as a separate entry on the undo stack. However, even though the end user can undo each action separately, sometimes it is logical to undo all the steps of the task as a unit and not individually.

For example, a developer might write code that performs the task of inserting document metadata into the footer of a Word document as shown in the following code example.

VBA Copy code Copy code
Sub AddDocMetadata()
Dim rngFooter As Range

    Set rngFooter = ActiveDocument.Sections(1) _
        .Footers(wdHeaderFooterPrimary).Range

    With rngFooter
        .Delete
        .Fields.Add Range:=rngFooter, Type:=wdFieldFileName, Text:="\p"
        .InsertAfter Text:=vbTab & vbTab
        .Collapse Direction:=wdCollapseStart
        .Fields.Add Range:=rngFooter, Type:=wdFieldAuthor
    End With
End Sub

The resulting undo records appear on the undo stack for the actions performed by the code.

Undo button expanded with several entries.

If the end user then needs to rollback or undo the "insert metadata" task, each action associated with the task must be undone individually (by pressing CTRL+Z or clicking the dropdown arrow on the Undo button and then selecting the actions to undo). In this situation, the potential exists for the end user to only partially undo the series of actions associated with the single task, possibly leaving the document in an undesired state.

The Word object model offers a way to avoid this problem by providing developers the ability to link a series of individual actions into a custom undo record that can then be used to undo the actions as a single unit. A custom undo record is represented in the Word object model by the UndoRecord object.

Using the UndoRecord Object

The UndoRecord object is a property of the Application object in Word. You create a custom undo record using the StartCustomRecord and EndCustomRecord methods of the UndoRecord object. Consider the following code example which modifies the previous example to include a custom undo record.

VBA Copy code Copy code
Dim objUndo As UndoRecord

Sub AddDocMetadata()
Dim rngFooter As Range

Set objUndo = Application.UndoRecord

'Begin the custom undo record and provide a name for the record
objUndo.StartCustomRecord ("Add Doc Metadata")

 Set rngFooter = ActiveDocument.Sections(1) _
        .Footers(wdHeaderFooterPrimary).Range

 With rngFooter
        .Delete
        .Fields.Add Range:=rngFooter, Type:=wdFieldFileName, Text:="\p"
        .InsertAfter Text:=vbTab & vbTab
        .Collapse Direction:=wdCollapseStart
        .Fields.Add Range:=rngFooter, Type:=wdFieldAuthor
 End With

'End the custom undo record
objUndo.EndCustomRecord

End Sub

The StartCustomRecord method begins recording the actions that are included in the custom undo record. You can give the custom undo record a name as an argument to the StartCustomRecord method, but this is optional. If you do not specify a name, Word uses the Visual Basic name of the first command executed as the name of the record. The name of the custom undo record is the string that appears in the user interface in the dropdown next to the Undo button.

The EndCustomRecord method stops recording the custom undo record. All the actions taken by the code between the StartCustomRecord call and the EndCustomRecord call are linked into one UndoRecord object. When you run code that creates a custom undo record, as in the previous code example, the custom undo record is listed in the undo stack as a single entry.

Undo button expanded with one entry.

UndoRecord Object Members

The following table lists other important members of the UndoRecord.

Name | Member Type | Description
CustomRecordLevel | Property | Returns a Long that specifies the number of custom undo action calls that are currently active. Read-only.
CustomRecordName | Property | Returns a String that specifies the entry that appears on the undo stack when all custom undo actions have completed. Read-only.
IsRecordingCustomRecord | Property | Returns a Boolean that specifies whether a custom undo action is being recorded. Read-only.

Best Practices

  • Close each custom undo record with a call to EndCustomRecord. Word will attempt to determine where to end the record, but it may not be at the desired point of code execution.

  • Call the Document object's Undo method in the right order when calling from within a custom undo record. Calling the Undo method in the wrong order within a custom undo record can have undesired effects on your code execution. The following code example shows the Undo method being called from inside a custom undo record.

    VBA Copy code Copy code
    Sub UndoInUndoRecord()

Set objUndo = Application.UndoRecord

objUndo.StartCustomRecord ("New Paragraph")

ActiveDocument.Content.InsertAfter Text:=" The end."
ActiveDocument.Undo
ActiveDocument.Content.InsertAfter Text:=" The end, again."
ActiveDocument.Content.InsertAfter Text:=" The last end."

objUndo.EndCustomRecord

End Sub

    When this code is run, each action in the custom undo record prior to the Undo method call is undone. Each action in the custom undo record after the Undo method call is placed the undo stack.

  • Avoid switching documents inside a custom undo record. The following code example switches from one document to another inside a custom undo record.

    VBA Copy code Copy code
    Dim objUndo As UndoRecord

Sub SwitchDocsInsideUndo()
Set objUndo = Application.UndoRecord objUndo.StartCustomRecord ("New Paragraph")

'Insert some text into the first document Documents(1).Content.InsertAfter "A new paragraph in doc1."

'Switch documents to the second document
'The custom undo record will terminate here Documents(2).Content.InsertAfter "A new paragraph in doc2."

objUndo.EndCustomRecord
End Sub

    When this code is run, Word 2010 terminates the custom undo record when the code begins to write to the second document. When the procedure is finished, only the first document will have a custom undo record with the name "New Paragraph."

  • Avoid using Breaks when running code that contains custom undo records in Debug mode. When code that contains undo records is run in Debug mode in the Visual Basic editor and the code encounters a breakpoint, Word automatically ends all custom records that are currently in progress.


How do I... (Word 2013 developer reference)

 Copy code hover
[image]

How do I... (Word 2013 developer reference)
Send feedback

This topic links to programming tasks (how-to and walkthrough topics) for common Microsoft Word scenarios. The Microsoft Office Developer Documentation team welcomes your task ideas and code samples! To submit task ideas and code samples, contact us at docthis@microsoft.com.

How Do I is your gateway to key task-based topics about programming and application development using Microsoft Word. The essential categories for what you can do with Word are listed in this topic. The following list provides links to important procedure-based Help topics:

  • How to: Bind a Content Control to a Node in the Data Store

  • How to: Bind Controls to a Specific Row in the Data Store When Inserting a Building Block

  • How to: Capture and Respond to Events in the Data Store

  • How to: Change a Content Control from One Type to Another

  • How to: Change the Editability of a Content Control

  • How to: Create a Custom Building Block Gallery

  • How to: Filter the Building Block List in a Content Control

  • How to: Insert a Content Control into a Building Block

  • How to: Remove Data from the Data Store When Deleting a Content Control

  • How to: Set the Building Blocks That You Can Use for a Content Control

  • Walkthrough: Connect an Item in the Data Store to a SQL Server Database


How to: Bind a Content Control to a Node in the Data Store

 Copy code hover
[image]

How to: Bind a Content Control to a Node in the Data Store
Send feedback

XML mapping is a feature of Word that enables you to create a link between a document and an XML file. This creates true data/view separation between the document formatting and the custom XML data.

XML mapping enables you to map an element in a custom XML part that is attached to the document. The data store provides access to all of the custom XML parts that are stored in an open file. You can refer to any node within any custom XML part inside the data store.

For more information about content controls, see Working with Content Controls.

The objects used in this sample are:

  • ContentControl

  • ContentControls

  • CustomXMLPart (Microsoft Office core object model)

  • CustomXMLParts (Microsoft Office core object model)

  • XMLMapping

Sample

The following steps enable you to bind a content control to a node in the document's data store.

  1. Create the content control to bind to a node in the data store.Content controls are predefined pieces of content. There are several types of content controls, including text blocks, drop-down menus, combo boxes, calendar controls, and pictures. You can map these content controls to an element in an XML file. By using XML Path Language (XPath), you can programmatically map content in an XML file to a content control. This enables you to write a simple and short application to manipulate and modify data in a document. For more information about content controls, see Working with Content Controls. The following code sample creates a plain-text content control and gives it a title of "MyTitle".

    VBA Copy code Copy code
    Dim strTitle As String
strTitle = "MyTitle"
Dim oContentControl As Word.ContentControl
Set oContentControl = ActiveDocument.ContentControls.Add(wdContentControlText)
oContentControl.Title = strTitle

  2. Set the XML mapping on the content control.The data store in a document in the Word object model is contained in the CustomXMLParts property of the Document object. The CustomXMLParts property returns a CustomXMLParts collection that contains CustomXMLPart objects. It points to all the custom XML parts that are stored in a document. A CustomXMLPart object represents a single custom XML part in the data store. To load custom XML data, you must first add a new custom XML part to a Document object by using the Add method of the CustomXMLParts collection. This appends a new, empty custom XML part to the document. Because it is empty, there is no XML to map to. Next, you must load XML into the newly defined part by calling the Load method of the CustomXMLPart object, using a valid path to an XML file as the parameter, or by calling the LoadXML method of the CustomXMLPart and passing the XML directly. The default custom XML parts stored with a Word document contain the document's standard document properties; you cannot delete these parts. You can always view the contents of a custom XML part by calling the read-only XML property on it. If you call the XML property of a CustomXMLPart object, a string is returned, which contains the XML in that data store. Build a valid custom XML file and save it to your hard disk drive. Add a custom XML part to the document that contains the content control you want to map to custom XML data. Suppose the content control will be mapped to the following sample custom XML file.

    XML Copy code Copy code
    <?xml version="1.0" encoding="utf-8" ?>
<tree>
  <fruit>
    <fruitType>peach</fruitType>
    <fruitType>pear</fruitType>
    <fruitType>banana</fruitType>
  </fruit>
</tree>

    Now, suppose the content control is mapped to a <fruitType> node of the previous custom XML part.

    The following sample code demonstrates how to attach an XML file to a document, so that it becomes an available data store item.

    VBA Copy code Copy code
    ActiveDocument.CustomXMLParts.Add
ActiveDocument.CustomXMLParts(ActiveDocument.CustomXMLParts.Count).Load ("c:\mySampleCustomXMLFile.xml")

    To create an XML mapping, you use an XPath expression to specify the node in the custom XML data part to which you want to map a content control. Setting an XML mapping on a content control then specifies the node in the added custom XML part, using that XPath expression. After you add a custom XML part to your document (and after the custom XML part contains XML), you are ready to map one of its nodes to a content control. To do this, pass a String containing a valid XPath to a ContentControl object by using the SetMapping method of the XMLMapping object (using the XMLMapping property of the ContentControl object). The following is an example of doing this with an XPath that refers to a data store node containing the value of the first fruitType element.

    VBA Copy code Copy code
    Dim strXPath As String
strXPath = "tree/fruit/fruitType[1]"
ActiveDocument.ContentControls(1).XMLMapping.SetMapping strXPath

If you omit the optional PrefixMappings and CustomXMLPart arguments, Word searches each of the custom XML parts in order and maps the control to the first part that successfully retrieves a custom XML node using the specified XPath.


How to: Bind Controls to a Specific Row in the Data Store When Inserting a Building Block

 Copy code hover
[image]

How to: Bind Controls to a Specific Row in the Data Store When Inserting a Building Block
Send feedback

A document building block is a predesigned piece of content, such as a cover page, a header, a footer, or a custom-built clause in a contract. Custom building blocks make it easier for you to quickly create professional-looking Microsoft Word documents.

You can use content controls within custom building blocks that have been mapped to XML that contains data. The contents of those content controls are then automatically linked to the appropriate custom XML part (if present) when the part is inserted. Alternatively, as the following sample shows, you can dynamically add the custom XML part and the XML mappings when the part is inserted. For example, to construct a cover page, you can place a picture content control that displays an image retrieved from an element in an attached CustomXMLPart object. Similarly, you can create the project name using a text content control that you map to an element in a CustomXMLPart object containing the project name.

This makes it easier to update your data. To update one of these items, you can write a few lines of code to update every document stored on the server that uses this cover page building block. For example, you can replace an old logo with a new one. Or, if the project title changes, you can update the text in the XML element that you mapped to the text content control containing the project name, thereby automatically updating all the documents stored on the server.

The objects used in these samples are:

  • ContentControl

  • ContentControls

  • CustomXMLPart (Microsoft Office core object model)

  • CustomXMLParts (Microsoft Office core object model)

  • XMLMapping

Sample

Suppose the user has inserted your custom document building block into a document, and based on that action, you want to insert and map to the custom XML part.

VBA Copy code Copy code
<?xml version="1.0" encoding="utf-8" ?>
<projects>
  <project>
    <title>Data-Driven Document Generation</title>
    <manager>Frank Martinez</manager>
    <customer>Northwind Traders</customer>
  </project>
</projects>

The following sample code loads the previous XML file and maps each content control to the appropriate XML node in that new custom XML part, when the document building block called "Company Report" is added.

VBA Copy code Copy code
Private Sub Document_BuildingBlockInsert(ByVal Range As Range, _
        ByVal Name As String, ByVal Category As String, _
        ByVal Type As String, ByVal Template As String)

    Dim cc As ContentControl
    Dim part As CustomXMLPart

    If Name = "Company Report" Then
        'add the custom XML
        ActiveDocument.CustomXMLParts.Add
        Set part = ActiveDocument.CustomXMLParts(ActiveDocument.CustomXMLParts.Count).Load("c:\myProjects.xml")

        'map the controls
        For Each cc In Range.ContentControls
            cc.XMLMapping.SetMapping cc.XMLMapping.XPath, cc.XMLMapping.PrefixMappings, part
        Next cc
    End If

End Sub


How to: Capture and Respond to Events in the Data Store

 Copy code hover
[image]

How to: Capture and Respond to Events in the Data Store
Send feedback

The client can listen for and respond to changes on a node or on a node and on all of its children. An add-in can respond to the following events.

On the CustomXMLParts collection:

  • StreamAfterAdd. Allows a client to respond after a new store is added to the document.

  • StreamBeforeDelete. Allows a client to respond before a store is removed from the document.

  • StreamAfterLoad. Allows a client to respond after a store item is loaded with XML.

On the CustomXMLPart object:

  • NodeAfterInsert. Allows a client to respond after a new node is added to a store. If the added node contains a subtree, the event fires only once , for the top-most node.

  • NodeAfterDelete. Allows a client to respond after a node is deleted. If the deleted node contains a subtree, the event fires only once, for the top-most node.

  • NodeAfterReplace. Allows a client to respond after an XML node is replaced in the store.

Sample

Assume that there is an XML file, C:\test.xml, and two text content controls. The XML file looks like this:

VBA Copy code Copy code
<?xml version="1.0" standalone="no"?>
<root xmlns="urn:test">
  <a>NodeA</a>
  <b>NodeB</b>
</root>

One of the powerful things that you can accomplish with XML mapping is to have one mapped text content control update immediately when a user updates another text content control. This is accomplished using events. To do this, create a method with events and run it.

VBA Copy code Copy code
Dim WithEvents objStream As CustomXMLPart

Sub Demo()
  Set objStream = ThisDocument.CustomXMLParts(4)
End Sub

Running the Demo subroutine sets up the objStream variable to listen to events.

Remember, from the previous scenario, that the document has two text content controls, one data mapped to the <a> node and the other data mapped to the <b> node. Suppose you want to set up events so that when the text in the <a> node is modified, the <b> node automatically does something. The following objStream_NodeAfterReplace event subroutine accomplishes this.

VBA Copy code Copy code
Private Sub objStream_NodeAfterReplace( _
        ByVal OldNode As Office.CustomXMLNode, _
        ByVal NewNode As Office.CustomXMLNode, _
        ByVal InUndoRedo As Boolean)

    ' Check if NewNode, which is the node after the change, is
    ' the "a" node by checking the BaseName of its ParentNode
  If NewNode.ParentNode.BaseName = "a" Then
    objStream.DocumentElement.LastChild.Text = "You changed a!"
  End If

End Sub

This routine is triggered after the user changes the text in the first text content control, mapped to element <a>. If the text in the <a> node changes, then the text of the last child in the custom XML part is updated. Because the stream has only two nodes, the last node is the <b> node. After the text of <b> node is updated, the updated text of "You changed a!" automatically appears in the second text content control.

This example is very simple, but it shows what you can do with events, XML mapping, and content controls. You can use code such as this to update any text in a document when one text content control is changed. This is powerful because it assumes nothing about the document formatting, and it does not work with the document formatting. Instead, it works against the schema that you attach to the document.

Bind a Content Control to a Node in the Data Store

Bind a Content Control to a Node in the Data Store


How to: Change a Content Control from One Type to Another

 Copy code hover
[image]

How to: Change a Content Control from One Type to Another
Send feedback

The content controls that you can create in documents in Microsoft Office Word 2007 and later are extremely flexible. In most cases, you can easily switch a content control from one type to another. For example, if you have a date content control, you can change it to be a text content control, or if you have a text content control, you can change it to be a rich-text content control. To do this, you use the Type property and set it to a WdContentControlType constant.

Note Note

Depending on the contents of a content control, you may not be able to change the content control type. For example, if you have a rich-text content control that contains formatted text, you may not be able to change the control to be a plain-text content control. In this case, Word raises a run-time error.

The objects used in this sample are:

  • ContentControl

  • ContentControls

  • ContentControlListEntries

The following example inserts a new date content control that contains the current date and then changes it to be a text content control.

VBA Copy code Copy code
Sub ChangeTypeOfControl()
 Dim objCC As ContentControl
 Dim strDate As Date

 strDate = Date
 Set objCC = Selection.ContentControls.Add(wdContentControlDate)
 objCC.Range.Text = strDate

 objCC.Type = wdContentControlText
End Sub

The following example inserts a drop-down list content control and then changes it to be a rich-text content control.

VBA Copy code Copy code
Sub ChangeContentControlType()
 Dim objCC As ContentControl

 Set objCC = ActiveDocument.ContentControls.Add(Type:=wdContentControlDropdownList)
 objCC.SetPlaceholderText Text:="My Favorite Animal"

 'List entries
 objCC.DropdownListEntries.Add "Cat"
 objCC.DropdownListEntries.Add "Dog"
 objCC.DropdownListEntries.Add "Horse"
 objCC.DropdownListEntries.Add "Monkey"
 objCC.DropdownListEntries.Add "Snake"
 objCC.DropdownListEntries.Add "Other"

 Stop

 ' Switch to view the new content control in the active document.
 ' Notice that the content control is a drop-down list.

 objCC.Type = wdContentControlRichText

 ' After running the above code, the content control is no longer
 ' a drop-down; it is a text content control. Only the placeholder
 ' text remains; Word removes the items in the list.
End Sub


How to: Change the Editability of a Content Control

 Copy code hover
[image]

How to: Change the Editability of a Content Control
Send feedback

Sometimes you might want to limit how a user works with a content control. Microsoft Word gives you several ways to do this. For example, you can limit the text that a user can insert into a content control, force a user to insert content into a content control, or lock a content control. There are two ways that you can lock a content control. One prohibits a user from deleting the content control. Another prohibits a user from editing the content control.

You can set these restrictions programmatically. For example, you might want to prohibit a user from editing a content control based on the value that a user inserts into another control. Use the LockContentControl property to prohibit a user from deleting a content control, and use the LockContents property to prohibit a user from editing the contents of a content control.

The objects used in this sample are:

  • ContentControl

  • ContentControls

The following example uses the LockContentControl property and the LockContents property to prohibit a user from deleting or editing the content control.

VBA Copy code Copy code
Sub LockcontentControl()
 Dim objCC As ContentControl

 Set objCC = ActiveDocument.ContentControls _
 .Add(wdContentControlRichText)

 objCC.LockcontentControl = True
 objCC.LockContents = True
End Sub

Using these properties with one of the events for content controls, such as the ContentControlOnExit event, gives you control over how content controls are used in documents and how users work with them.


How to: Create a Custom Building Block Gallery

 Copy code hover
[image]

How to: Create a Custom Building Block Gallery
Send feedback

A building block gallery is a collection of building blocks that are of the same type. There are 32 different types of building block collections that you can create (by using the WdBuildingBlockTypes enumeration). Each of these types is a gallery. Microsoft Word provides some of these galleries as built-in building block collections, but most of them are provided so that you can organize your own building blocks. To provide added flexibility with your custom galleries, you can create categories within each gallery to further organize your custom building blocks.

The objects used in this sample are:

  • Template

  • Range

  • BuildingBlockEntries

  • BuildingBlock

Sample

The following example creates a building block gallery that contains three building blocks.

Note Note

This example assumes that there are at least three paragraphs in the document.
VBA Copy code Copy code
Sub CreateBuildingBlockGallery()
 Dim objTemplate As Template
 Dim conType As WdBuildingBlockTypes
 Dim objRange As Range

 Set objTemplate = ActiveDocument.AttachedTemplate
 conType = wdTypeCustom1

 Set objRange = ActiveDocument.Paragraphs(1).Range
 objTemplate.BuildingBlockEntries.Add _
 "Heading 1", conType, "Main Headings", objRange

 Set objRange = ActiveDocument.Paragraphs(2).Range
 objTemplate.BuildingBlockEntries.Add _
 "Heading 2", conType, "Secondary Headings", objRange

 Set objRange = ActiveDocument.Paragraphs(3).Range
 objTemplate.BuildingBlockEntries.Add _
 "Heading 3", conType, "Tertiary Headings", objRange
End Sub

Additional Resources

  • Working with Building Blocks


How to: Create Custom Bibliography Styles

 Copy code hover
[image]

How to: Create Custom Bibliography Styles
Send feedback

Learn how to create a custom bibliography style in Microsoft Word 2013

In this article

Building a basic bibliography style

Design the layout

Create a complex style

Conclusion

Additional resources

Learn the steps (and XML code) you need to construct a simple custom style. Also, learn to make a more complex style file. Before we start, there is some information that you need to know:

The bibliography sources you create are all listed in the following file: %APPDATA%\Microsoft\Bibliography\Sources.xml

Note Note

The \Bibliography\Sources.xml file won't exist until you create your first bibliography source in Word 2013.

All the bibliography styles are stored in %APPDATA%\Microsoft\Bibliography\Style.

Building a basic bibliography style

First, create a basic bibliography style that the custom style will follow.

Set up the bibliography style

To create a bibliography style, we will create an XML style sheet; that is, an .xsl file called MyBookStyle.xsl, using your favorite XML editor. Notepad will do fine. As the name suggests, our example is going to be a style for a "book" source type.

At the top of the file, add the following code:

XML Copy code Copy code
<?xml version="1.0" ?>

<!--List of the external resources that we are referencing-->

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:b="http://schemas.openxmlformats.org/officeDocument/2006/bibliography">

<!--When the bibliography or citation is in your document, it's just HTML-->

<xsl:output method="html" encoding="us-ascii"/>

<!--Match the root element, and dispatch to its children-->

<xsl:template match="/">

<xsl:apply-templates select="*" />

</xsl:template>

As the comments indicate, Word 2013 uses HTML to represent a bibliography or citation within a document. Most of the preceding XML code is just preparation for the more interesting parts of the style. For example, you can give your style a version number to track the changes you make, as shown in the following example.

XML Copy code Copy code
<!--Set an optional version number for this style-->

<xsl:template match="b:version">

   <xsl:text>2006.5.07</xsl:text>

</xsl:template>

More importantly, you can give your style a name. Add this tag: <xsl:when test="b:StyleNameLocalized">; and then give your style a name, in the language of your choice, by using the following code.

XML Copy code Copy code
<xsl:when test="b:StyleNameLocalized/b:Lcid='1033'">

   <xsl:text>[Your Style Name]</xsl:text>

</xsl:when>

This section contains the locale name of your style. In the case of our example file, we want our custom bibliography style name, "Simple Book Style," to appear in the Style drop-down list on the References tab. To do so, add the following XML code to specify that the style name be in the English locale (Lcid determines the language).

XML Copy code Copy code
<!--Defines the name of the style in the References dropdown list-->
<xsl:when test="b:StyleNameLocalized">
   <xsl:choose>
      <xsl:when test="b:StyleNameLocalized/b:Lcid='1033'">
         <xsl:text>Simple Book Style</xsl:text>
      </xsl:when>
</xsl:when>

Your style will now appear under its own name in the Bibliography Style dropdown list-box in the application.

Now, examine the style details. Each source type in Word (for example, book, film, article in a periodical, and so forth) has a built-in list of fields that you can use for the bibliography. To see all the fields available for a given source type, on the References tab, choose Manage Sources, and then in the Source Manager dialog box, choose New to open the Create Source dialog box. Then select Show All Bibliography Fields.

A book source type has the following fields available:

  • Author

  • Title

  • Year

  • City

  • State/Province

  • Country/Region

  • Publisher

  • Editor

  • Volume

  • Number of Volumes

  • Translator

  • Short Title

  • Standard Number

  • Pages

  • Edition

  • Comments

In the code, you can specify the fields that are important for your bibliography style. Even when Show All Bibliography Fields is cleared, these fields will appear and have a red asterisk next to them. For our book example, I want to ensure that the author, title, year, city, and publisher are entered, so I want a red asterisk to appear next to these fields to alert the user that these are recommended fields that should be filled out.

XML Copy code Copy code
<!--Specifies which fields should appear in the Create Source dialog box when in a collapsed state (The Show All Bibliography Fields check box is cleared)-->

<xsl:template match="b:GetImportantFields[b:SourceType = 'Book']">
   <b:ImportantFields>
      <b:ImportantField>
         <xsl:text>b:Author/b:Author/b:NameList</xsl:text>
      </b:ImportantField>
      <b:ImportantField>
         <xsl:text>b:Title</xsl:text>
      </b:ImportantField>
     <b:ImportantField>
         <xsl:text>b:Year</xsl:text>
      </b:ImportantField>
      <b:ImportantField>
         <xsl:text>b:City</xsl:text>
      </b:ImportantField>
      <b:ImportantField>
         <xsl:text>b:Publisher</xsl:text>
      </b:ImportantField>
   </b:ImportantFields>
</xsl:template>

The text in the <xsl:text> tags are references to the Sources.xml file. These references pull out the data that will populate each of the fields. Examine Sources.xml (%APPDATA%\Microsoft\Bibliography\Sources.xml) to get a better idea about how these references match up to what is in the XML file.

Design the layout

Output for bibliographies and citations is represented in a Word document as HTML, so to define how our custom bibliography and citation styles should look in Word, we'll have to add some HTML to our style sheet.

Suppose you want to format each entry in your bibliography in this manner:

Last Name, First Name. (Year). Title. City: Publisher

The HTML required to do this would be embedded in your style sheet as follows.

XML Copy code Copy code
<!--Defines the output format for a simple Book (in the Bibliography) with important fields defined-->

<xsl:template match="b:Source[b:SourceType = 'Book']">

<!--Label the paragraph as an Office Bibliography paragraph-->

   <p>
      <xsl:value-of select="b:Author/b:Author/b:NameList/b:Person/b:Last"/>
      <xsl:text>, </xsl:text>
      <xsl:value-of select="b:Author/b:Author/b:NameList/b:Person/b:First"/>
      <xsl:text>. (</xsl:text>
      <xsl:value-of select="b:Year"/>
      <xsl:text>). </xsl:text>
      <i>
         <xsl:value-of select="b:Title"/>
         <xsl:text>. </xsl:text>
      </i>
      <xsl:value-of select="b:City"/>
      <xsl:text>: </xsl:text>
      <xsl:value-of select="b:Publisher"/>
      <xsl:text>.</xsl:text>
   </p>
</xsl:template>

When you reference a book source in your Word document, Word needs to access this HTML so that it can use the custom style to display the source, so you'll have to add code to your custom style sheet to enable Word to do this.

XML Copy code Copy code
<!--Defines the output of the entire Bibliography-->

<xsl:template match="b:Bibliography">

   <html xmlns="http://www.w3.org/TR/REC-html40">

      <body>

         <xsl:apply-templates select ="b:Source[b:SourceType = 'Book']">

         </xsl:apply-templates>

      </body>

   </html>
</xsl:template>

In a similar fashion, you'll need to do the same thing for the citation output. Follow the pattern (Author, Year) for a single citation in the document.

XML Copy code Copy code
<!--Defines the output of the Citation-->
<xsl:template match="b:Citation/b:Source[b:SourceType = 'Book']">
   <html xmlns="http://www.w3.org/TR/REC-html40">
      <body>
         <!-- Defines the output format as (Author, Year)-->
         <xsl:text>(</xsl:text>
            <xsl:value-of select="b:Author/b:Author/b:NameList/b:Person/b:Last"/>
         <xsl:text>, </xsl:text>
         <xsl:value-of select="b:Year"/>
         <xsl:text>)</xsl:text>
      </body>
   </html>
</xsl:template>

Close up the file with the following lines.

Copy code Copy code
<xsl:template match="text()" /> </xsl:stylesheet>

Save the file as MyBookStyle.XSL and drop it into the Styles directory (%appdata%\Microsoft\Bibliography\Style). Restart Word, and your style is now under the style dropdown list. You can start using your new style.

Create a complex style

One of the issues that complicate bibliography styles is that they often need to have a significant amount of conditional logic. For example, if the date is specified, you need to show the date, whereas if the date is not specified, you may need to use an abbreviation to indicate that there is no date for that source.

For a more specific example, in the APA style, if a date is not specified for a website source, the abbreviation "n.d." is used to denote no date, and the style should do this automatically. Here's an example:

APA website source with no date entered: Kwan, Y. (n.d.). Retrieved from www.microsoft.com APA website source with date entered: Kwan, Y. (2006, Jan 18). Retrieved from www.microsoft.com

As you can see, what is displayed is dependent upon on the data entered.

The output of virtually every style needs to change depending on whether you have a "Corporate Author" or a "Normal Author." You will see how to use one of the most common rules for implementing such logic into your style, allowing you to display a corporate author if the corporate author is specified, and a normal author if the corporate author is not specified.

Solution overview

To display a corporate author only if appropriate, use the following procedure.

To display a corporate author

  1. Add a variable to count the number of corporate authors in the citation section of the code.

  2. Display the corporate author in the citation if the corporate author is filled in. Display the normal author in the citation if the corporate author is not filled in.

  3. Add a variable to count the number of corporate authors in the bibliography section of the code.

  4. Display the corporate author in the bibliography if the corporate author is filled in. Display the normal author in the bibliography if the corporate author is not filled in.

Getting started

Let's start by changing the citation. Here is the code for citations from last time.

XML Copy code Copy code
<!--Defines the output of the Citation-->
<xsl:template match="b:Citation/b:Source[b:SourceType = 'Book']">
   <html xmlns="http://www.w3.org/TR/REC-html40">
      <body>
         <!--Defines the output format as (Author, Year)-->
         <xsl:text>(</xsl:text>
         <xsl:value-of select="b:Author/b:Author/b:NameList/b:Person/b:Last"/>
         <xsl:text>, </xsl:text>
         <xsl:value-of select="b:Year"/>
         <xsl:text>)</xsl:text>
      </body>
   </html>
</xsl:template>

Step 1: Define a new variable in the citation section to count the number of corporate authors

Declare a new variable to help determine whether a corporate author is available. This variable is a count of the number of times the corporate author field exists in the source.

Copy code Copy code
<!--Defines the output of the Citation-->
<html xmlns="http://www.w3.org/TR/REC-html40">
   <!--Count the number of Corporate Authors (can only be 0 or 1)-->
      <xsl:variable name="cCorporateAuthors">
         <xsl:value-of select="count(b:Author/b:Author/b:Corporate)" />
      </xsl:variable>

Step 2: Verify that the corporate author has been filled in

Verify that the corporate author has been filled in. You can do this by determining if the count of corporate authors is non-zero. If a corporate author exists, display it. If it does not exist, display the normal author.

XML Copy code Copy code
<xsl:text>(</xsl:text>
<xsl:choose>
<!--When the corporate author exists, display the corporate author-->
<xsl:when test ="$cCorporateAuthors!=0">
<xsl:value-of select="b:Author/b:Author/b:Corporate"/>
</xsl:when>
<!-- When the corporate author does not exist, display the normal author-->
<xsl:otherwise>
<xsl:value-of select="b:Author/b:Author/b:NameList/b:Person/b:Last"/>
</xsl:otherwise>
</xsl:choose>
<xsl:text>, </xsl:text>

Now that you've made the change for citations, make the change for the bibliography. Here's the bibliography section from earlier in this article.

XML Copy code Copy code
<!--Defines the output format for a simple Book (in the Bibliography) with important fields defined-->
<xsl: template match="b:Source[b:SourceType = 'Book']">
<!--Label the paragraph as an Office Bibliography paragraph-->
<p>
<xsl:value-of select="b:Author/b:Author/b:NameList/b:Person/b:Last"/>
<xsl:text>, </xsl:text>
<xsl:value-of select="b:Author/b:Author/b:NameList/b:Person/b:First"/>
<xsl:text>. (</xsl:text>
<xsl:value-of select="b:Year"/>
<xsl:text>). </xsl:text>
<i>

Step 3: Define a new variable in the bibliography section

Once again, let's start by adding a counting variable.

XML Copy code Copy code
<!--Defines the output format for a simple Book (in the Bibliography) with important fields defined-->
<xsl: template match="b:Source[b:SourceType = 'Book']">
<!--Count the number of Corporate Authors (can only be 0 or 1)-->
<xsl:variable name="cCorporateAuthors">
<xsl:value-of select="count(b:Author/b:Author/b:Corporate)" />
</xsl:variable>

Step 4: Verify that the corporate author has been filled in

Verify that a corporate author exists.

XML Copy code Copy code
…..
<xsl:variable name="cCorporateAuthors">
<xsl:value-of select="count(b:Author/b:Author/b:Corporate)" />
</xsl:variable>
<p>
<xsl:choose>
<!--When the corporate author exists display the corporate author-->
<xsl:when test ="$cCorporateAuthors!=0">
<xsl:value-of select="b:Author/b:Author/b:Corporate"/>
<xsl:text>. (</xsl:text>
</xsl:when>
<xsl:otherwise>
<!--When the corporate author does not exist, display the normal author-->
<xsl:value-of select="b:Author/b:Author/b:NameList/b:Person/b:Last"/>
<xsl:text>, </xsl:text>
<xsl:value-of select="b:Author/b:Author/b:NameList/b:Person/b:First"/>
<xsl:text>. (</xsl:text>
</xsl:otherwise>
</xsl:choose>

Here's the complete final code.

XML Copy code Copy code
<?xml version="1.0" ?>
<!--List of the external resources that we are referencing-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:b="http://schemas.openxmlformats.org/officeDocument/2006/bibliography">
   <!--When the bibliography or citation is in your document, it's just HTML-->
   <xsl:output method="html" encoding="us-ascii"/>
   <!--Match the root element, and dispatch to its children-->
   <xsl:template match="/">
      <xsl:apply-templates select="*" />
   </xsl:template>
   <!--Set an optional version number for this style-->
   <xsl:template match="b:version">
      <xsl:text>2006.5.07</xsl:text>
   </xsl:template>
   <!--Defines the name of the style in the References dropdown-->
   <xsl:template match="b:StyleName">
      <xsl:text>Simple Book Style</xsl:text>
   </xsl:template>
   <!--Specifies which fields should appear in the Create Source dialog when in a collapsed state (The Show All Bibliography Fieldscheckbox is cleared)-->
   <xsl:template match="b:GetImportantFields[b:SourceType = 'Book']">
      <b:ImportantFields>
         <b:ImportantField><xsl:text>b:Author/b:Author/b:NameList</xsl:text> </b:ImportantField>
         <b:ImportantField> <xsl:text>b:Title</xsl:text> </b:ImportantField>
         <b:ImportantField> <xsl:text>b:Year</xsl:text> </b:ImportantField>
         <b:ImportantField> <xsl:text>b:City</xsl:text> </b:ImportantField>
         <b:ImportantField> <xsl:text>b:Publisher</xsl:text> </b:ImportantField>
      </b:ImportantFields>
   </xsl:template>
   <!--Defines the output format for a simple Book (in the Bibliography) with important fields defined-->
   <xsl:template match="b:Source[b:SourceType = 'Book']">
   <!--Count the number of Corporate Authors (can only be 0 or 1-->
   <xsl:variable name="cCorporateAuthors">
      <xsl:value-of select="count(b:Author/b:Author/b:Corporate)" />
   </xsl:variable>
   <!--Label the paragraph as an Office Bibliography paragraph-->
   <p>
      <xsl:choose>
         <xsl:when test ="$cCorporateAuthors!=0">
         <!--When the corporate author exists display the corporate author-->
            <xsl:value-of select="b:Author/b:Author/b:Corporate"/>
            <xsl:text>. (</xsl:text>
         </xsl:when>
         <xsl:otherwise>
            <!--When the corporate author does not exist, display the normal author-->
            <xsl:value-of select="b:Author/b:Author/b:NameList/b:Person/b:Last"/>
            <xsl:text>, </xsl:text>
            <xsl:value-of select="b:Author/b:Author/b:NameList/b:Person/b:First"/>
            <xsl:text>. (</xsl:text>
         </xsl:otherwise>
      </xsl:choose>
      <xsl:value-of select="b:Year"/>
      <xsl:text>). </xsl:text>
      <i>
         <xsl:value-of select="b:Title"/>
         <xsl:text>. </xsl:text>
      </i>
         <xsl:value-of select="b:City"/>
         <xsl:text>: </xsl:text>
         <xsl:value-of select="b:Publisher"/>
         <xsl:text>.</xsl:text>
      </p>
   </xsl:template>
   <!--Defines the output of the entire Bibliography-->
   <xsl:template match="b:Bibliography">
      <html xmlns="http://www.w3.org/TR/REC-html40">
         <body>
            <xsl:apply-templates select ="*">
            </xsl:apply-templates>
         </body>
      </html>
   </xsl:template>
   <!--Defines the output of the Citation-->
   <xsl:template match="b:Citation/b:Source[b:SourceType = 'Book']">
      <html xmlns="http://www.w3.org/TR/REC-html40">
         <xsl:variable name="cCorporateAuthors">
            <xsl:value-of select="count(b:Author/b:Author/b:Corporate)" />
         </xsl:variable>
         <body>
         <!--Defines the output format as (Author, Year-->
            <xsl:text>(</xsl:text>
            <xsl:choose>
            <!--When the corporate author exists display the corporate author-->
               <xsl:when test ="$cCorporateAuthors!=0">
                  <xsl:value-of select="b:Author/b:Author/b:Corporate"/>
               </xsl:when>
               <!--When the corporate author does not exist, display the normal author-->
               <xsl:otherwise>
                  <xsl:value-of select="b:Author/b:Author/b:NameList/b:Person/b:Last"/>
               </xsl:otherwise>
               </xsl:choose>
               <xsl:text>, </xsl:text>
               <xsl:value-of select="b:Year"/>
               <xsl:text>)</xsl:text>
            </body>
         </html>
   </xsl:template>
   <xsl:template match="text()" />
</xsl:stylesheet>

Conclusion

This article showed how to create a custom bibliography style in Word 2013, first by creating a simple style, and then by using conditional statements to create a more complex style.

Additional resources

  • What's new for Word 2013 developers

  • Office and Office 365 Developer Blog

  • Word for developers website


How to: Filter the Building Block List in a Content Control

 Copy code hover
[image]

How to: Filter the Building Block List in a Content Control
Send feedback

When you use content controls together with building blocks, you can help users by indicating what content they can insert and by limiting their choices. You can do this is by filtering the list of building blocks that are shown for a content control. To filter a building block list for a content control, you use the BuildingBlockType property for the content control. You can further filter the list of building blocks by setting the BuildingBlockCategory property for the content control.

You can filter the list of building blocks for a content control when you create the content control. However, you can also programmatically filter the list of building blocks based on the position of the cursor or on the value of another content control. To start, you need a custom building block gallery. To learn how to create a custom building block gallery, see Create a Custom Building Block Gallery.

  • BuildingBlock

  • ContentControl

Sample 1

The following example shows how to filter a building block list to a specific gallery.

Note Note

Run the code in the "Create a Custom Building Block Gallery" topic before running the code in this topic.
VBA Copy code Copy code
Sub CreateFilteredContentControl_SampleOneA()
 Dim objCC As ContentControl

 Set objCC = ActiveDocument.ContentControls.Add( _
 wdContentControlBuildingBlockGallery, Selection.Range)

 objCC.BuildingBlockType = wdTypeCustom1
End Sub

You can filter a building block list even further by specifying a specific category within the gallery. The following example shows how to filter a building block list to include only the building blocks within a category of a specified gallery.

VBA Copy code Copy code
Sub CreateFilteredContentControl_SampleOneB()
 Dim objCC As ContentControl

 Set objCC = ActiveDocument.ContentControls.Add( _
 wdContentControlBuildingBlockGallery, Selection.Range)

 objCC.BuildingBlockType = wdTypeCustom1
 objCC.BuildingBlockCategory = "Tertiary Headings"
End Sub

Sample 2

To filter a building block list based on the position of the cursor, you need to use the ContentControlOnEnter event. For example, if you have a content control named Report Type that can be set to "financial" or "marketing", you can have a building block content control that shows a list of possible disclaimers. The content control for the disclaimers would show all disclaimers if the Report Type is not set, and only the appropriate subset if the property is set. The following example filters the list of building blocks for a content control based on the value of another content control in the document.

VBA Copy code Copy code
Private Sub Document_ContentControlOnEnter(ByVal ContentControl As ContentControl)
 Dim objCC As ContentControl
 Dim objType As ContentControl

 Set objCC = ContentControl
 Set objType = ActiveDocument.ContentControls.Item("Report Type")

 If objCC.Title = "Disclaimer" Then
 Select Case objType.Range.Text
 Case "Financial"
 objCC.BuildingBlockType = wdTypeCustom1
 objCC.BuildingBlockCategory = "Financial Disclaimers"

 Case "Marketing"
 objCC.BuildingBlockType = wdTypeCustom1
 objCC.BuildingBlockCategory = "Marketing Disclaimers"

 End Select
 End If
End Sub

Additional Resources

  • Working with Building Blocks

  • Working with Content Controls


How to: Insert a Content Control into a Building Block

 Copy code hover
[image]

How to: Insert a Content Control into a Building Block
Send feedback

Building blocks and content controls are extremely flexible. You can create building blocks that contain content controls, or you can create content controls that use building blocks to present rich content selections to the user. This topic shows how to insert a content control into a building block, which users can then insert into their documents.

The objects used in this sample are:

  • Template

  • BuildingBlock

  • Range

  • ContentControl

The following code inserts a content control into the active document, and then adds the content control to the collection of building blocks in the template attached to the active document.

VBA Copy code Copy code
Sub InsertContentControlIntoBuildingBlock()
 Dim objCC As ContentControl
 Dim objBB As BuildingBlock
 Dim objTemplate As Template
 Dim objRange As Range

 Set objTemplate = ActiveDocument.AttachedTemplate
 Set objCC = ActiveDocument.Range.ContentControls _
 .Add(wdContentControlComboBox)

 objCC.DropdownListEntries.Add "Outstanding"
 objCC.DropdownListEntries.Add "Good"
 objCC.DropdownListEntries.Add "Fair"

 Set objRange = ActiveDocument.Range
 Set objBB = objTemplate.BuildingBlockEntries.Add("OGF Rating Scale", _
 wdTypeCustom1, "Ratings", objRange)
End Sub

Additional Resources

  • Working with Building Blocks

  • Working with Content Controls


How to: Remove Data from the Data Store When Deleting a Content Control

 Copy code hover
[image]

How to: Remove Data from the Data Store When Deleting a Content Control
Send feedback

You can delete a content control by calling the Delete method of the ContentControl object. For example, the following code deletes the content control with the title "MyTitle".

VBA Copy code Copy code
ActiveDocument.ContentControls.Item("MyTitle").Delete

You can also delete a single node by calling the Delete method of the CustomDataXMLNode object that you want to remove. You can delete an entire custom XML part by calling the Delete method of the CustomXMLPart object that you want to remove.

For more information about content controls, see Working with Content Controls.

The objects used in these samples are:

  • ContentControl

  • ContentControls

  • CustomXMLPart (Microsoft Office system core object model)

  • CustomXMLParts (Microsoft Office system core object model)

  • XMLMapping

Sample 1

The first code sample creates a content control and sets an XML mapping on a content control.

Build a valid custom XML file, save it to your hard disk drive, and add a data store to the document that contains the information you want to map to.

Suppose the content control is mapped to the following sample custom XML file.

VBA Copy code Copy code
<?xml version="1.0" encoding="utf-8" ?>
<tree>
  <fruit>
    <fruitType>peach</fruitType>
    <fruitType>pear</fruitType>
    <fruitType>banana</fruitType>
  </fruit>
</tree>

Now, suppose the content control is mapped to a <fruitType> node of the previous custom XML part.

VBA Copy code Copy code
Sub AddContentControlAndCustomXMLPart()

    Dim strTitle As String
    strTitle = "MyTitle"
    Dim oContentControl As Word.ContentControl

    Set oContentControl = ActiveDocument.ContentControls.Add(wdContentControlText)
    oContentControl.Title = strTitle

    ActiveDocument.CustomXMLParts.Add
    ActiveDocument.CustomXMLParts(4).Load ("c:\mySampleCustomXMLFile.xml")

    Dim strXPath As String
    strXPath = "tree/fruit/fruitType"
    oContentControl.XMLMapping.SetMapping strXPath

End Sub

Sample 2

The second code sample removes the entire CustomXMLPart object when the content control is deleted.

VBA Copy code Copy code
Private Sub Document_ContentControlBeforeDelete( _
        ByVal OldContentControl As ContentControl, _
        ByVal InUndoRedo As Boolean)

    Dim objPart As CustomXMLPart

    'Always void changing the Word document surface during undo!
    If InUndoRedo Then
        Return
    End If

    'Also delete the part with a root element called 'tree'
    If OldContentControl.Title = "MyTitle" Then
        For Each objPart In ActiveDocument.CustomXMLParts
            If objPart.DocumentElement.BaseName = "tree" Then
                objPart.Delete
            End If
        Next part
    End If

End Sub

Bind a Content Control to a Node in the Data Store


How to: Set the Building Blocks That You Can Use for a Content Control

 Copy code hover
[image]

How to: Set the Building Blocks That You Can Use for a Content Control
Send feedback

A document building block is a predesigned piece of content, such as a cover page or a header or footer. Microsoft Word includes a library of document building blocks that users can choose from to insert into a document.

A ContentControl Object (Word) object with a ContentControl.Type Property (Word) property value of wdContentControlBuildingBlockGallery specifies a content control that can contain document building blocks.

The WdBuildingBlockTypes enumeration contains each building block type. You can only use the following building block types within a building block gallery content control:

  • AutoText

  • Tables

  • Equations

  • Quick Parts

  • Custom 1 though Custom 5

  • Custom AutoText

  • Custom Tables

  • Custom Equations

  • Custom Quick Parts

For more information about content controls, see Working with Content Controls.

The objects used in this sample are:

  • ContentControl

  • ContentControls

Sample

The following code sample instantiates a building block gallery content control and then adds a building block to the content control.

VBA Copy code Copy code
Sub SetBuildingBlock()

    Dim strTitle As String
    strTitle = "My Equation"
    Dim objContentControl As ContentControl

    Set objContentControl = ActiveDocument.ContentControls _
        .Add(wdContentControlBuildingBlockGallery)
    objContentControl.Title = strTitle
    objContentControl.BuildingBlockType = wdTypeEquations

End Sub


Walkthrough: Connect an Item in the Data Store to a SQL Server Database

 Copy code hover
[image]

Walkthrough: Connect an Item in the Data Store to a SQL Server Database
Send feedback

Microsoft Word enables you to generate documents by creating data-driven solutions. You can create a template document that includes a custom XML part and use content controls to bind to custom XML data by using XML mapping. Although the term template is used in this context, this document is not a Word template, but shares some characteristics of a Word template document. Then you can create a managed web-based application to build a new document based on the template document. The managed web-based application opens the template document, retrieves data from a Microsoft SQL Server database to build a new custom XML part, replaces the template document's custom XML part with the new part, and saves the template document as a new Word document.

This walkthrough explains how to build a new template document and how to create a server-side application that generates documents that display data that is stored in a Microsoft SQL Server database. To build this application, you will complete the following two tasks:

  1. Create a Word template document.

  2. Create a server-side web-based application that pulls data from a Microsoft SQL Server database and generates new documents based on the Word template document.

The programmatic objects that are used in this sample are as follows:

  • ContentControl

  • ContentControls

  • CustomXMLPart (in the Microsoft Office system core object model)

  • CustomXMLParts (in the Microsoft Office system core object model)

  • XMLMapping

For more information about content controls, see Working with Content Controls.

Business Scenario: Create a Customer Document Generator

To create a Word document generator that connects an item in the data store to a Microsoft SQL Server database, you first build a template customer letter-generator document that contains content controls that map to an XML file. Next, you create a document-generation web-based application that enables you to select a company name to generate a custom document. The application retrieves customer data from a Microsoft SQL Server database and uses the customer letter generator to build a new document that displays customer data based on a user selection. The document displays the following information:

  • Company Name

  • Contact Name

  • Contact Title

  • Phone Number

Use the following general steps to create a Word document generator.

To create a custom document generator and define the XML mappings for each content control

  1. Open Word and create a blank document.

  2. Add plain-text content controls to the document to bind to nodes in the data store.

    Content controls are predefined pieces of content. Word offers several kinds of content controls. This includes text blocks, check boxes, drop-down menus, combo boxes, calendar controls, and pictures. You can map these content controls to an element in an XML file. By using XPath expressions, you can programmatically map content in an XML file to a content control. This enables you to write a simple and short application to manipulate and modify data in a document.

    To add a content control, on the Developer tab, in the Controls group, click Plain Text Content Control.

    Add four plain-text content controls to the document. After you add each control, assign each one a title: Click the control; in the Controls group, click Properties; in the Title box, type a title for the control, as shown in the following list; and then click OK.

    • Company Name

    • Contact Name

    • Contact Title

    • Phone Number

    You can also use the following Visual Basic for Applications (VBA) code to add content controls to the document. Press ALT+F11 to open the Microsoft Visual Basic editor, paste the code into the code window, click anywhere in the procedure, and then press F5 to run the code and add four content controls to your template document.

    VBA Copy code Copy code
    Sub AddContentControls()

    Selection.Range.ContentControls.Add (wdContentControlText)
    Selection.ParentContentControl.Title = "Company Name"
    Selection.ParentContentControl.Tag = "Company Name"
    Selection.MoveDown Unit:=wdLine, Count:=1
    Selection.TypeParagraph

    Selection.Range.ContentControls.Add (wdContentControlText)
    Selection.ParentContentControl.Title = "Contact Name"
    Selection.ParentContentControl.Tag = "Contact Name"
    Selection.MoveDown Unit:=wdLine, Count:=1
    Selection.TypeParagraph

    Selection.Range.ContentControls.Add (wdContentControlText)
    Selection.ParentContentControl.Title = "Contact Title"
    Selection.ParentContentControl.Tag = "Contact Title"
    Selection.MoveDown Unit:=wdLine, Count:=1
    Selection.TypeParagraph

    Selection.Range.ContentControls.Add (wdContentControlText)
    Selection.ParentContentControl.Title = "Phone Number"
    Selection.ParentContentControl.Tag = "Phone Number"
    Selection.MoveDown Unit:=wdLine, Count:=1
    Selection.TypeParagraph

End Sub

  3. Set the XML mapping on the content controls.

    XML mapping is a feature of Word that enables you to create a link between a document and an XML file. This creates true data/view separation between the document formatting and the custom XML data.

    To load a custom XML part, you must first add a new data store to a Document object by using the Add method of the CustomXMLParts collection. This appends a new, empty data store to the document. Because it is empty, you cannot use it yet. Next, you must load a custom XML part from an XML file into the data store, by calling the Load method of the CustomXMLPart object that uses a valid path to an XML file as the parameter.

  4. Save the document, naming it CustomerLetterGenerator.docm.

    Note Note

    Because it contains VBA code, you must save the document as a macro-enabled document file (.docm).

The following procedure explains how to map a content control to a sample custom XML file. You create a valid custom XML file, save the file, and then you use Visual Basic for Applications (VBA) code to add to the template document a data store that contains the information to which you want to map.

To set an XML mapping on a content control

  1. Create a text file and save it as CustomerData.xml.

  2. Copy the following XML code into the text file and save the file.

    XML Copy code Copy code
    <?xml version="1.0"?>
<Customer>
  <CompanyName>Alfreds Futterkiste</CompanyName>
  <ContactName>Maria Anders</ContactName>
  <ContactTitle>Sales Representative</ContactTitle>
  <Phone>030-0074321</Phone>
</Customer>

  3. Open .

  4. Press ALT+F11 to open the Microsoft Visual Basic editor, paste the following code into the code window, click anywhere in the procedure, and then press F5 to run the code and attach an XML file to your template document so that it becomes an available data store item.

    VBA Copy code Copy code
    Public Sub LoadXML()

  ' Load CustomerData.xml file
   ActiveDocument.CustomXMLParts.Add
   ActiveDocument.CustomXMLParts(ActiveDocument.CustomXMLParts.Count).Load ("C:\CustomerData.xml")
End Sub

    Note Note

    There are at least three default custom XML parts that are always created with a document. These are 'Cover pages', 'Doc properties' and 'App properties'. In addition, various other custom XML parts may be created on a given computer, depending on several factors. These include which add-ons are installed, connections with Microsoft SharePoint, and so on. Calling the Add method on the CustomXMLParts collection in the previous code adds an additional XML part, into which the XML file is loaded. It is on that part that the Load method is called, in the next line of code. To determine the index number of the part into which to load the XML file, it is necessary to pass the count of custom XML parts to the Load method.

    ActiveDocument.CustomXMLParts(ActiveDocument.CustomXMLParts.Count).Load ("C:\CustomerData.xml")

  5. Set an XML mapping on a content control that refers to a node in the added data store. To create an XML mapping, use an XPath expression that points to the node in the custom XML data part to which you want to map a content control. After you add a data store to your document (and the data store points to a valid XML file), you are ready to map one of its nodes to a content control. To do this, pass a String that contains a valid XPath to a ContentControl object by using the SetMapping method of the XMLMapping object (by using the XMLMapping property of the ContentControl object). Open the Visual Basic editor and run the following VBA code to bind content controls to items in the data store.

    VBA Copy code Copy code
    Public Sub MapXML()

    Dim strXPath1 As String
    strXPath1 = "/Customer/CompanyName"
    ActiveDocument.ContentControls(1).XMLMapping.SetMapping strXPath1

    Dim strXPath2 As String
    strXPath2 = "/Customer/ContactName"
    ActiveDocument.ContentControls(2).XMLMapping.SetMapping strXPath2

    Dim strXPath3 As String
    strXPath3 = "/Customer/ContactTitle"
    ActiveDocument.ContentControls(3).XMLMapping.SetMapping strXPath3

    Dim strXPath4 As String
    strXPath4 = "/Customer/Phone"
    ActiveDocument.ContentControls(4).XMLMapping.SetMapping strXPath4

Create a Server-Side Application That Pulls Data from a SQL Server Database and Generates a New Document

You can create a Web-based application that enables users to select a company name and generate a custom letter. The Web-based application retrieves customer data from a Microsoft SQL Server database, opens the customer letter template document, and creates a new document that displays customer data based on a user selection. This Web-based application does not require the use of Word or VBA. You can use your favorite managed code (Microsoft Visual Basic .NET or C#) language to build this application.

Note Note

The Web-based application shown here gets its data from the Northwind.mdf database. This database was installed with previous versions of SQL Server and Microsoft Office. If you do not have the Northwind database on your computer, you can download it from the following site: http://code.msdn.microsoft.com/northwind/Release/ProjectReleases.aspx?ReleaseId=1401

To build this application, do the following:

To create a server-side application that pulls data from a SQL Server database and generates a new document

  1. Open Microsoft Visual Studio or Microsoft Visual Web Developer.

  2. Create an ASP.NET Web application and name it SqlServerSample.

    In the following steps, you'll connect the ASP.NET Web application to a Microsoft SQL Server database.

  3. Add the following connection string to the Web.config file in your Visual Studio project.

    XML Copy code Copy code
    <connectionStrings>
 <add name="NorthwindConnectionString"
     connectionString="data source=(local);database=Northwind; integrated security=SSPI;persist security info=false;"
     providerName="System.Data.SqlClient" />
</connectionStrings>

  4. In your Visual Studio project, add the CustomerLetterGenerator.docm document to the App_Data folder: Right-click App_Data, point to Add, click Existing Item, browse to the location where you saved the document, select it, and then click Add.

  5. Add a reference to WindowsBase.dll to your project: Right-click References, click Add Reference, click the .NET tab, select WindowsBase, and then click OK.

  6. Download and install the Microsoft .NET Framework 4.0

  7. Configure the assembly in the Web.config file as follows.

    XML Copy code Copy code
    <compilation debug="false">
  <assemblies>
    <add assembly="WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
   </assemblies>
 </compilation>

  8. Add a Web Form to your project: On the Project menu, click Add New Item; under Installed Templates, click Web; select Web Form, and then click Add.

  9. In the Solution Explorer, right-click Properties, and then click Open.

  10. On the Web tab, under Start Action, select Specific Page, click the browse button, and navigate to the page WebForm1.aspx.

  11. Add the following code to the WebForm1.aspx file, overwriting the part of the file bounded by the opening and closing <html> tags.

    HTML Copy code Copy code
    <html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
     <title>Data-Driven Document Generation - SQL Server Sample</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
     <h1>Customer Letter Generator</h1>
            <table border="0" cellpadding="0" cellspacing="0" style="width: 100%; height: 12%">
                <tr>
                    <td>
                        Choose a customer:</td>
                    <td>
                        <asp:DropDownList
                           ID="ddlCustomer"
                           runat="server"
                           AutoPostBack="True"
                           DataSourceID="CustomerData"
                           DataTextField="CompanyName"
                           DataValueField="CustomerID"
                           Width="301px">
                        </asp:DropDownList>
                        <asp:SqlDataSource
                          ID="CustomerData"
                          runat="server"
                          ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
                          SelectCommand="SELECT [CustomerID], [CompanyName] FROM [Customers]" ProviderName="<%$ ConnectionStrings:NorthwindConnectionString.ProviderName %>">
                        </asp:SqlDataSource>
                    </td>
                </tr>
          </table>
        </div>
        <br />
        <asp:Button
          ID="Button1"
          runat="server"
          OnClick="SubmitBtn_Click"
          Text="Create Letter"
          Width="123px" />
    </form>
</body>
</html>

  12. Depending on the coding language you use, add the following Visual Basic .NET or C# code to the appropriate WebForm1.aspx code-behind page in your project.

Sample Code: Microsoft Visual Basic .NET

The following Microsoft Visual Basic .NET sample shows how to bind to a Microsoft SQL Server database to retrieve data based on a customer selection and create a new document based on the CustomerLetterGenerator.docm template document. Add the following code to the WebForm1.aspx.vb file, overwriting the existing code in the file.

Visual Basic Copy code Copy code
Imports System.Collections.Generic
Imports System.Data
Imports System.Data.SqlClient
Imports System.IO
Imports System.IO.Packaging
Imports System.Linq
Imports System.Xml
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls

Public Class WebForm1

    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    Private Const strRelRoot As String = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"

    Private Sub CreateDocument()
        ' Get the template document file and create a stream from it
        Const DocumentFile As String = "~/App_Data/CustomerLetterGenerator.docm"

        ' Read the file into memory
        Dim buffer() As Byte = File.ReadAllBytes(Server.MapPath(DocumentFile))
        Dim memoryStream As MemoryStream = New MemoryStream(buffer, True)
        buffer = Nothing

        ' Open the document in the stream and replace the custom XML part
        Dim pkgFile As Package = Package.Open(memoryStream, FileMode.Open, FileAccess.ReadWrite)
        Dim pkgrcOfficeDocument As PackageRelationshipCollection = pkgFile.GetRelationshipsByType(strRelRoot)
        For Each pkgr As PackageRelationship In pkgrcOfficeDocument
            If (pkgr.SourceUri.OriginalString = "/") Then

                ' Get the root part
                Dim pkgpRoot As PackagePart = pkgFile.GetPart(New Uri(("/" + pkgr.TargetUri.ToString), UriKind.Relative))

                ' Add a custom XML part to the package
                Dim uriData As Uri = New Uri("/customXML/item1.xml", UriKind.Relative)
                If pkgFile.PartExists(uriData) Then

                    ' Delete part "/customXML/item1.xml" part
                    pkgFile.DeletePart(uriData)
                End If

                ' Load the custom XML data
                Dim pkgprtData As PackagePart = pkgFile.CreatePart(uriData, "application/xml")
                GetDataFromSQLServer(pkgprtData.GetStream, ddlCustomer.SelectedValue)
            End If
        Next

        ' Close the file
        pkgFile.Close()

        ' Return the result
        Response.ClearContent()
        Response.ClearHeaders()
        Response.AddHeader("content-disposition", "attachment; filename=document.docx")
        Response.ContentEncoding = System.Text.Encoding.UTF8
        memoryStream.WriteTo(Response.OutputStream)
        memoryStream.Close()
        Response.End()
    End Sub

    Private Sub GetDataFromSQLServer(ByVal stream As Stream, ByVal customerID As String)

        'Connect to a Microsoft SQL Server database and get data
        Dim source As String = ConfigurationManager.ConnectionStrings("NorthwindConnectionString").ConnectionString
        Const SqlStatement As String = "SELECT CompanyName, ContactName, ContactTitle, Phone FROM Customers WHERE CustomerID=@customerID"
        Dim conn As SqlConnection = New SqlConnection(source)
        conn.Open()
        Dim cmd As SqlCommand = New SqlCommand(SqlStatement, conn)
        cmd.Parameters.AddWithValue("@customerID", customerID)
        Dim dr As SqlDataReader = cmd.ExecuteReader
        If dr.Read Then
            Dim writer As XmlWriter = XmlWriter.Create(stream)
            writer.WriteStartElement("Customer")
            writer.WriteElementString("CompanyName", CType(dr("CompanyName"), String))
            writer.WriteElementString("ContactName", CType(dr("ContactName"), String))
            writer.WriteElementString("ContactTitle", CType(dr("ContactTitle"), String))
            writer.WriteElementString("Phone", CType(dr("Phone"), String))
            writer.WriteEndElement()
            writer.Close()
        End If
        dr.Close()
        conn.Close()
    End Sub

    Protected Sub SubmitBtn_Click(ByVal sender As Object, ByVal e As EventArgs)
        CreateDocument()
    End Sub

End Class

Sample Code: C#

The following C# sample shows how to bind to a Microsoft SQL Server database to retrieve data based on a customer selection and create a new document based on the CustomerLetterGenerator.docm template document. Add the following code to the WebForm1.Aspx.cs file, copying over the existing code.

C# Copy code Copy code
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.IO.Packaging;
using System.Linq;
using System.Xml;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace SQLServerSample
{
    public partial class WebForm1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        private const string strRelRoot = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument";

        private void CreateDocument()
        {
            // Get the template document file and create a stream from it
            const string DocumentFile = @"~/App_Data/CustomerLetterGenerator.docm";

            // Read the file into memory
            byte[] buffer = File.ReadAllBytes(Server.MapPath(DocumentFile));
            MemoryStream memoryStream = new MemoryStream(buffer, true);
            buffer = null;

            // Open the document in the stream and replace the custom XML part
            Package pkgFile = Package.Open(memoryStream, FileMode.Open, FileAccess.ReadWrite);
            PackageRelationshipCollection pkgrcOfficeDocument = pkgFile.GetRelationshipsByType(strRelRoot);
            foreach (PackageRelationship pkgr in pkgrcOfficeDocument)
            {
                if (pkgr.SourceUri.OriginalString == "/")
                {
                    // Get the root part
                    PackagePart pkgpRoot = pkgFile.GetPart(new Uri("/" + pkgr.TargetUri.ToString(), UriKind.Relative));

                    // Add a custom XML part to the package
                    Uri uriData = new Uri("/customXML/item1.xml", UriKind.Relative);

                    if (pkgFile.PartExists(uriData))
                    {
                        // Delete document "/customXML/item1.xml" part
                        pkgFile.DeletePart(uriData);
                    }
                    // Load the custom XML data
                    PackagePart pkgprtData = pkgFile.CreatePart(uriData, "application/xml");
                    GetDataFromSQLServer(pkgprtData.GetStream(), ddlCustomer.SelectedValue);
                }
            }

            // Close the file
            pkgFile.Close();

            // Return the result
            Response.ClearContent();
            Response.ClearHeaders();
            Response.AddHeader("content-disposition", "attachment; filename=CustomLetter.docx");
            Response.ContentEncoding = System.Text.Encoding.UTF8;

            memoryStream.WriteTo(Response.OutputStream);

            memoryStream.Close();

            Response.End();
        }

        private void GetDataFromSQLServer(Stream stream, string customerID)
        {
            // Connect to a Microsoft SQL Server database and get data
            String source = System.Configuration.ConfigurationManager.ConnectionStrings["NorthwindConnectionString"].ConnectionString;
            const string SqlStatement =
                "SELECT CompanyName, ContactName, ContactTitle, Phone FROM Customers WHERE CustomerID=@customerID";

            using (SqlConnection conn = new SqlConnection(source))
            {
                conn.Open();
                SqlCommand cmd = new SqlCommand(SqlStatement, conn);
                cmd.Parameters.AddWithValue("@customerID", customerID);
                SqlDataReader dr = cmd.ExecuteReader();

                if (dr.Read())
                {
                    XmlWriter writer = XmlWriter.Create(stream);
                    writer.WriteStartElement("Customer");
                    writer.WriteElementString("CompanyName", (string)dr["CompanyName"]);
                    writer.WriteElementString("ContactName", (string)dr["ContactName"]);
                    writer.WriteElementString("ContactTitle", (string)dr["ContactTitle"]);
                    writer.WriteElementString("Phone", (string)dr["Phone"]);
                    writer.WriteEndElement();
                    writer.Close();
                }
                dr.Close();
                conn.Close();
            }
        }

        protected void SubmitBtn_Click(object sender, EventArgs e)
        {
            CreateDocument();
        }
    }
}

For more information about working with ASP.NET 2.0, see http://www.asp.net/get-started/

This article explains how to extract data from a SQL Server database and insert it into your template document. You can also extract the data from other data sources, including, for example, Microsoft Access and Microsoft Excel. For more information about how to connect to data in those applications programmatically, see the Access and Excel developer documentation.


Object model reference (Word 2013 developer reference)

 Copy code hover
[image]

Object model reference (Word 2013 developer reference)
Send feedback

This section of the Microsoft Word 2013 Developer Reference contains documentation for all the objects, properties, methods, and events contained in the Word object model.

Are You Viewing Help in a Microsoft Office Product?

If you are viewing Help from inside your installed version of the documentation, you can use the table of contents to navigate through the topics. To open the table of contents, click the Show Table of Contents toolbar window. Click a topic in the table of contents to view it.

Are You Viewing the Content in the MSDN Library?

If you are viewing the content on MSDN, you can use the table of contents to navigate through the documentation.


AddIn Object (Word)

 Copy code hover
[image]

AddIn Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a single add-in, either installed or not installed. The AddIn object is a member of the AddIns collection. The AddIns collection contains all the add-ins available to Microsoft Word, regardless of whether they are currently loaded. The AddIns collection includes global templates or Word add-in libraries (WLLs) displayed in the Templates and Add-ins dialog box.

Remarks

Use AddIns(index), where index is the add-in name or index number, to return a single AddIn object. You must exactly match the spelling (but not necessarily the capitalization) of the name, as it is shown in the Templates and Add-Ins dialog box. The following example loads the Letter.dot template as a global template.

VBA Copy code Copy code
AddIns("Letter.dot").Installed = True

The index number represents the position of the add-in in the list of add-ins in the Templates and Add-ins dialog box. The following instruction displays the path of the first available add-in.

VBA Copy code Copy code
If Addins.Count >= 1 Then MsgBox Addins(1).Path

The following example creates a list of add-ins at the beginning of the active document. The list contains the name, path, and installed state of each available add-in.

VBA Copy code Copy code
With ActiveDocument.Range(Start:=0, End:=0)
 .InsertAfter "Name" & vbTab & "Path" & vbTab & "Installed"
 .InsertParagraphAfter
 For Each oAddIn In AddIns
 .InsertAfter oAddIn.Name & vbTab & oAddIn.Path & vbTab _
 & oAddIn.Installed
 .InsertParagraphAfter
 Next oAddIn
 .ConvertToTable
End With

Use the Add method to add an add-in to the list of available add-ins and (optionally) install it using the Install argument.

VBA Copy code Copy code
AddIns.Add FileName:="C:\Templates\Other\Letter.dot", Install:=True

To install an add-in shown in the list of available add-ins, use the Installed property.

VBA Copy code Copy code
AddIns("Letter.dot").Installed = True
Note Note

Use the Compiled property to determine whether an AddIn object is a template or a WLL.

See also

Concepts

Word Object Model Reference

Other resources

AddIn Object Members


AddIn Members (Word)

 Copy code hover
[image]

AddIn Members (Word)
Send feedback

Published: July 16, 2012

Represents a single add-in, either installed or not installed. The AddIn object is a member of the AddIns collection. The AddIns collection contains all the add-ins available to Microsoft Word, regardless of whether they are currently loaded. The AddIns collection includes global templates or Word add-in libraries (WLLs) displayed in the Templates and Add-ins dialog box.

Methods

Name | Description
Delete | Deletes the specified add-in.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Autoload | True if the specified add-in is automatically loaded when Word is started. Add-ins located in the Startup folder in the Word program folder are automatically loaded. Read-only Boolean.
Compiled | True if the specified add-in is a Word add-in library (WLL). False if the add-in is a template. Read-only Boolean.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
Index | Returns a Long that represents the position of an item in a collection. Read-only.
Installed | True if the specified add-in is installed (loaded). Add-ins that are loaded are selected in the Templates and Add-ins dialog box. Read/write Boolean.
Name | Returns the name of an add-in. Read-only String.
Parent | Returns an Object that represents the parent object of the specified AddIn object.
Path | Returns the location of an installed add-in. Read-only String.


AddIn Properties (Word)

 Copy code hover
[image]

AddIn Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Autoload | True if the specified add-in is automatically loaded when Word is started. Add-ins located in the Startup folder in the Word program folder are automatically loaded. Read-only Boolean.
Compiled | True if the specified add-in is a Word add-in library (WLL). False if the add-in is a template. Read-only Boolean.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
Index | Returns a Long that represents the position of an item in a collection. Read-only.
Installed | True if the specified add-in is installed (loaded). Add-ins that are loaded are selected in the Templates and Add-ins dialog box. Read/write Boolean.
Name | Returns the name of an add-in. Read-only String.
Parent | Returns an Object that represents the parent object of the specified AddIn object.
Path | Returns the location of an installed add-in. Read-only String.


AddIn.Application Property (Word)

 Copy code hover
[image]

AddIn.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression An expression that returns an AddIn object.

See also

Concepts

AddIn Object

Other resources

AddIn Object Members


AddIn.Autoload Property (Word)

 Copy code hover
[image]

AddIn.Autoload Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified add-in is automatically loaded when Word is started. Add-ins located in the Startup folder in the Word program folder are automatically loaded. Read-only Boolean.

Syntax

expression .Autoload

expression A variable that represents a AddIn object.

Example

This example displays the name of each add-in that is automatically loaded when Word is started.

VBA Copy code Copy code
Dim addinLoop as AddIn
Dim blnFound as Boolean

blnFound = False

For Each addinLoop In AddIns
 With addinLoop
 If .Autoload = True Then
 MsgBox .Name
 blnFound = True
 End If
 End With
Next addinLoop

If blnFound <> True Then _
 MsgBox "No add-ins were loaded automatically."

This example determines whether the add-in named "Gallery.dot" was automatically loaded.

VBA Copy code Copy code
Dim addinLoop as AddIn

For Each addinLoop In AddIns
 If InStr(LCase$(addinLoop.Name), "gallery.dot") > 0 Then
 If addinLoop.Autoload = True Then Msgbox "Autoload"
 End If
Next addinLoop

See also

Concepts

AddIn Object

Other resources

AddIn Object Members


AddIn.Compiled Property (Word)

 Copy code hover
[image]

AddIn.Compiled Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified add-in is a Word add-in library (WLL). False if the add-in is a template. Read-only Boolean.

Syntax

expression .Compiled

expression A variable that represents a AddIn object.

Example

This example determines how many WLLs are currently loaded.

VBA Copy code Copy code
count = 0
For Each aAddin in Addins
 If aAddin.Compiled = True And aAddin.Installed = True Then
 count = count + 1
 End If
Next aAddin
MsgBox Str(count) & " WLL's are loaded"

If the first add-in is a template, this example unloads the template and opens it.

VBA Copy code Copy code
If Addins(1).Compiled = False Then
 Addins(1).Installed = False
 Documents.Open FileName:=AddIns(1).Path _
 & Application.PathSeparator _
 & AddIns(1).Name
End If

See also

Concepts

AddIn Object

Other resources

AddIn Object Members


AddIn.Creator Property (Word)

 Copy code hover
[image]

AddIn.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.

Syntax

expression .Creator

expression An expression that returns an AddIn object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

AddIn Object

Other resources

AddIn Object Members


AddIn.Index Property (Word)

 Copy code hover
[image]

AddIn.Index Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the position of an item in a collection. Read-only.

Syntax

expression .Index

expression Required. A variable that represents an AddIn object.

See also

Concepts

AddIn Object

Other resources

AddIn Object Members


AddIn.Installed Property (Word)

 Copy code hover
[image]

AddIn.Installed Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified add-in is installed (loaded). Add-ins that are loaded are selected in the Templates and Add-ins dialog box. Read/write Boolean.

Syntax

expression .Installed

expression An expression that returns an AddIn object.

Remarks

Uninstalled add-ins are included in the AddIns collection. To remove a template or WLL from the AddIns collection, apply the Delete method to the AddIn object (the add-in name is removed from the Templates and Add-ins dialog box). To unload all templates and WLLs, apply the Unload method to the AddIns collection.

Example

This example unloads the global template named "Gallery.dot."

VBA Copy code Copy code
Addins("Gallery.dot").Installed = False

This example loads FindAll.wll.

VBA Copy code Copy code
Addins("C:\Templates\FindAll.wll").Installed = True

This example loads Custom.dot.

VBA Copy code Copy code
AddIns("C:\Program Files\Microsoft Office\" _
 & "Templates\Custom.dot").Installed = True

This example displays a message on the status bar if Dot1.dot is loaded as a global template.

VBA Copy code Copy code
If AddIns("Dot1.dot").Installed = True Then _
 StatusBar = "Dot1.dot is loaded"

See also

Concepts

AddIn Object

Other resources

AddIn Object Members


AddIn.Name Property (Word)

 Copy code hover
[image]

AddIn.Name Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the name of an add-in. Read-only String.

Syntax

expression .Name

expression An expression that returns an AddIn object.

See also

Concepts

AddIn Object

Other resources

AddIn Object Members


AddIn.Parent Property (Word)

 Copy code hover
[image]

AddIn.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified AddIn object.

Syntax

expression .Parent

expression A variable that represents a AddIn object.

See also

Concepts

AddIn Object

Other resources

AddIn Object Members


AddIn.Path Property (Word)

 Copy code hover
[image]

AddIn.Path Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the location of an installed add-in. Read-only String.

Syntax

expression .Path

expression An expression that returns an AddIn object.

Remarks

The path doesn't include a trailing character— for example, "C:\MSOffice" or "http://MyServer". Use the PathSeparator property to add the character that separates folders and drive letters. Use the Name property to return the file name without the path and use the FullName property to return the file name and the path together.

Note Note

You can use the PathSeparator property to build Web addresses even though they contain forward slashes (/) and the PathSeparator property defaults to a backslash (\).

Example

This example displays the path of the first add-in in the AddIns collection.

VBA Copy code Copy code
If AddIns.Count >= 1 Then MsgBox AddIns(1).Path

See also

Concepts

AddIn Object

Other resources

AddIn Object Members


AddIn Methods (Word)

 Copy code hover
[image]

AddIn Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the specified add-in.


AddIn.Delete Method (Word)

 Copy code hover
[image]

AddIn.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the specified add-in.

Syntax

expression .Delete

expression Required. A variable that represents an AddIn object.

See also

Concepts

AddIn Object

Other resources

AddIn Object Members


AddIns Object (Word)

 Copy code hover
[image]

AddIns Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of AddIn objects that represents all the add-ins available to Word, regardless of whether or not they are currently loaded. The AddIns collection includes global templates or Word add-in libraries (WLLs) displayed in the Templates and Add-ins dialog box.

Remarks

Use the AddIns property to return the AddIns collection. The following example displays the name and the installed state of each available add-in.

VBA Copy code Copy code
For Each ad In AddIns
 If ad.Installed = True Then
 MsgBox ad.Name & " is installed"
 Else
 MsgBox ad.Name & " is available but not installed"
 End If
Next ad

Use the Add method to add an add-in to the list of available add-ins and (optionally) install it using the Install argument.

VBA Copy code Copy code
AddIns.Add FileName:="C:\Templates\Other\Letter.dot", Install:=True

To install an add-in shown in the list of available add-ins, use the Installed property.

VBA Copy code Copy code
AddIns("Letter.dot").Installed = True

Use AddIns(index), where index is the add-in name or index number, to return a single AddIn object. You must exactly match the spelling (but not necessarily the capitalization) of the name, as it is shown in the Templates and Add-ins dialog box. To install an add-in shown in the list of available add-ins, use the Installed property. The following example loads the Letter.dot template as a global template.

VBA Copy code Copy code
AddIns("Letter.dot").Installed = True
Note Note

If the add-in is not located in the User Templates, Workgroup Templates, or Startup folder, you must specify the full path and file name when indexing an add-in by name.

Use the Compiled property to determine whether an AddIn object is a template or a WLL.

See also

Concepts

Word Object Model Reference

Other resources

AddIns Object Members


AddIns Members (Word)

 Copy code hover
[image]

AddIns Members (Word)
Send feedback

Published: July 16, 2012

A collection of AddIn objects that represents all the add-ins available to Word, regardless of whether or not they are currently loaded. The AddIns collection includes global templates or Word add-in libraries (WLLs) displayed in the Templates and Add-ins dialog box.

Methods

Name | Description
Add | Returns an AddIn object that represents an add-in added to the list of available add-ins.
Item | Returns an individual object in a collection.
Unload | Unloads all loaded add-ins and, depending on the value of the RemoveFromList argument, removes them from the AddIns collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns the number of AddIn objects in the AddIns collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the Addins collection. This is usually an Application object.


AddIns Properties (Word)

 Copy code hover
[image]

AddIns Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns the number of AddIn objects in the AddIns collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the Addins collection. This is usually an Application object.


AddIns.Application Property (Word)

 Copy code hover
[image]

AddIns.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression An expression that returns an AddIns collection.

See also

Concepts

AddIns Collection Object

Other resources

AddIns Object Members


AddIns.Count Property (Word)

 Copy code hover
[image]

AddIns.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the number of AddIn objects in the AddIns collection. Read-only Long.

Syntax

expression .Count

expression An expression that returns an AddIns collection.

See also

Concepts

AddIns Collection Object

Other resources

AddIns Object Members


AddIns.Creator Property (Word)

 Copy code hover
[image]

AddIns.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression An expression that returns an AddIns collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

AddIns Collection Object

Other resources

AddIns Object Members


AddIns.Parent Property (Word)

 Copy code hover
[image]

AddIns.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the Addins collection. This is usually an Application object.

Syntax

expression .Parent

expression An expression that returns an AddIns collection.

See also

Concepts

AddIns Collection Object

Other resources

AddIns Object Members


AddIns Methods (Word)

 Copy code hover
[image]

AddIns Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Returns an AddIn object that represents an add-in added to the list of available add-ins.
Item | Returns an individual object in a collection.
Unload | Unloads all loaded add-ins and, depending on the value of the RemoveFromList argument, removes them from the AddIns collection.


AddIns.Add Method (Word)

 Copy code hover
[image]

AddIns.Add Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an AddIn object that represents an add-in added to the list of available add-ins.

Syntax

expression .Add(FileName, Install)

expression Required. A variable that represents an AddIns collection.

Parameters

Name | Required/Optional | Data Type | Description
FileName | Required | String | The path for the template or WLL.
Install | Optional | Variant | True to install the add-in. False to add the add-in to the list of add-ins but not install it. The default value is True.

Remarks

Use the Installed property of an add-in to see whether it is already installed.

Example

This example installs a template named MyFax.dot and adds it to the list of add-ins in the Templates and Add-ins dialog box.

VBA Copy code Copy code
Sub AddTemplate()
 ' For this example to work correctly, verify that the
 ' path is correct and the file exists.

 AddIns.Add FileName:="C:\Program Files\Microsoft Office" _
 & "\Templates\Letters & Faxes\MyFax.dot", Install:=True
End Sub

See also

Concepts

AddIns Collection Object

Other resources

AddIns Object Members


AddIns.Item Method (Word)

 Copy code hover
[image]

AddIns.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents an AddIns collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The individual add-in to be returned. Index can be an Long indicating the ordinal position of the add-in in the collection or a String representing the name of the individual add-in.

See also

Concepts

AddIns Collection Object

Other resources

AddIns Object Members


AddIns.Unload Method (Word)

 Copy code hover
[image]

AddIns.Unload Method (Word)
See also Send feedback

Published: July 16, 2012

Unloads all loaded add-ins and, depending on the value of the RemoveFromList argument, removes them from the AddIns collection.

Syntax

expression .Unload(RemoveFromList)

expression An expression that returns an AddIns collection.

Parameters

Name | Required/Optional | Data Type | Description
RemoveFromList | Required | Boolean | True to remove the unloaded add-ins from the AddIns collection (the names are removed from the Templates and Add-ins dialog box). False to leave the unloaded add-ins in the collection. If the Autoload property for an unloaded add-in returns True, Unload cannot remove that add-in from the AddIns collection, regardless of the value of RemoveFromList.

Remarks

To unload a single template or WLL, set the Installed property of the AddIn object to False. To remove a single template or WLL from the AddIns collection, apply the Delete method to the AddIn object.

Example

This example unloads all the add-ins listed in the Templates and Add-ins dialog box. The add-in names remain in the AddIns collection.

VBA Copy code Copy code
If AddIns.Count > 0 Then AddIns.UnLoad RemoveFromList:=False

See also

Concepts

AddIns Collection Object

Other resources

AddIns Object Members


Adjustments Object (Word)

 Copy code hover
[image]

Adjustments Object (Word)
See also Send feedback

Published: July 16, 2012

Contains a collection of adjustment values for the specified AutoShape or WordArt object. Each adjustment value represents one way an adjustment handle can be adjusted. Because some adjustment handles can be adjusted in two ways — for instance, some handles can be adjusted both horizontally and vertically — a shape can have more adjustment values than it has adjustment handles. A shape can have up to eight adjustments.

Remarks

Use the Adjustments property to return an Adjustments object. Use Adjustments(index), where index is the adjustment value's index number, to return a single adjustment value.

Different shapes have different numbers of adjustment values, different kinds of adjustments change the geometry of a shape in different ways, and different kinds of adjustments have different ranges of valid values.

Note Note

Because each adjustable shape has a different set of adjustments, the best way to verify the adjustment behavior for a specific shape is to manually create an instance of the shape, make adjustments with the macro recorder turned on, and then examine the recorded code.

The following table summarizes the ranges of valid adjustment values for different types of adjustments. In most cases, if you specify a value that's beyond the range of valid values, the closest valid value will be assigned to the adjustment.

Type of Adjustment | Valid values
Linear (horizontal or vertical) | Generally the value 0.0 represents the left or top edge of the shape and the value 1.0 represents the right or bottom edge of the shape. Valid values correspond to valid adjustments you can make to the shape manually. For example, if you can only pull an adjustment handle half way across the shape manually, the maximum value for the corresponding adjustment will be 0.5. For shapes such as callouts, where the values 0.0 and 1.0 represent the limits of the rectangle defined by the starting and ending points of the callout line, negative numbers and numbers greater than 1.0 are valid values.
Radial | An adjustment value of 1.0 corresponds to the width of the shape. The maximum value is 0.5, or half way across the shape.
Angle | Values are expressed in degrees. If you specify a value outside the range - 180 to 180, it will be normalized to be within that range.

The following example adds a right-arrow callout to the active document and sets adjustment values for the callout. Note that although the shape has only three adjustment handles, it has four adjustments. Adjustments three and four both correspond to the handle between the head and neck of the arrow.

VBA Copy code Copy code
Set rac = ActiveDocument.Shapes _
 .AddShape(msoShapeRightArrowCallout, 10, 10, 250, 190)
With rac.Adjustments
 .Item(1) = 0.5 'adjusts width of text box
 .Item(2) = 0.15 'adjusts width of arrow head
 .Item(3) = 0.8 'adjusts length of arrow head
 .Item(4) = 0.4 'adjusts width of arrow neck
End With

See also

Concepts

Word Object Model Reference

Other resources

Adjustments Object Members


Adjustments Members (Word)

 Copy code hover
[image]

Adjustments Members (Word)
Send feedback

Published: July 16, 2012

Contains a collection of adjustment values for the specified AutoShape or WordArt object. Each adjustment value represents one way an adjustment handle can be adjusted. Because some adjustment handles can be adjusted in two ways — for instance, some handles can be adjusted both horizontally and vertically — a shape can have more adjustment values than it has adjustment handles. A shape can have up to eight adjustments.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns the number of items in the Adjustments collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Item | Returns or sets the adjustment value specified by the Index argument. Read/write Single.
Parent | Returns an Object that represents the parent object of the specified object. This is usually a Shape or ShapeRange object.


Adjustments Properties (Word)

 Copy code hover
[image]

Adjustments Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns the number of items in the Adjustments collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Item | Returns or sets the adjustment value specified by the Index argument. Read/write Single.
Parent | Returns an Object that represents the parent object of the specified object. This is usually a Shape or ShapeRange object.


Adjustments.Application Property (Word)

 Copy code hover
[image]

Adjustments.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression A variable that represents a Adjustments object.

See also

Concepts

Adjustments Object

Other resources

Adjustments Object Members


Adjustments.Count Property (Word)

 Copy code hover
[image]

Adjustments.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the number of items in the Adjustments collection. Read-only Long.

Syntax

expression .Count

expression A variable that represents an Adjustments collection.

See also

Concepts

Adjustments Object

Other resources

Adjustments Object Members


Adjustments.Creator Property (Word)

 Copy code hover
[image]

Adjustments.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents an Adjustments object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

Adjustments Object

Other resources

Adjustments Object Members


Adjustments.Item Property (Word)

 Copy code hover
[image]

Adjustments.Item Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the adjustment value specified by the Index argument. Read/write Single.

Syntax

expression .Item(Index)

expression An expression that returns an Adjustments object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The index number of the adjustment.

Remarks

For linear adjustments, an adjustment value of 0.0 generally corresponds to the left or top edge of the shape, and a value of 1.0 generally corresponds to the right or bottom edge of the shape. However, adjustments can pass beyond shape boundaries for some shapes. For radial adjustments, an adjustment value of 1.0 corresponds to the width of the shape. For angular adjustments, the adjustment value is specified in degrees. The Item property applies only to shapes that have adjustments. AutoShapes and WordArt have up to eight adjustments.

Example

This example adds two crosses to the active document and then sets the value for adjustment one (the only one for this type of AutoShape) on each cross.

VBA Copy code Copy code
Dim docActive As Document

Set docActive = ActiveDocument
With docActive.Shapes
 .AddShape(msoShapeCross, _
 10, 10, 100, 100).Adjustments.Item(1) = 0.4
 .AddShape(msoShapeCross, _
 150, 10, 100, 100).Adjustments.Item(1) = 0.2
End With

This example has the same result as the previous example even though it doesn't explicitly use the Item property.

VBA Copy code Copy code
Dim docActive As Document

Set docActive = ActiveDocument
With docActive.Shapes
 .AddShape(msoShapeCross, _
 10, 10, 100, 100).Adjustments(1) = 0.4
 .AddShape(msoShapeCross, _
 150, 10, 100, 100).Adjustments(1) = 0.2
End With

See also

Concepts

Adjustments Object

Other resources

Adjustments Object Members


Adjustments.Parent Property (Word)

 Copy code hover
[image]

Adjustments.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified object. This is usually a Shape or ShapeRange object.

Syntax

expression .Parent

expression A variable that represents a Adjustments object.

See also

Concepts

Adjustments Object

Other resources

Adjustments Object Members


Application Object (Word)

 Copy code hover
[image]

Application Object (Word)
See also Send feedback

Published: July 16, 2012

Represents the Microsoft Word application. The Application object includes properties and methods that return top-level objects. For example, the ActiveDocument property returns a Document object.

Remarks

Use the Application property to return the Application object. The following example displays the user name for Word.

VBA Copy code Copy code
MsgBox Application.UserName

Many of the properties and methods that return the most common user-interface objects — such as the active document (ActiveDocument property) — can be used without the Application object qualifier. For example, instead of writing Application.ActiveDocument.PrintOut, you can write ActiveDocument.PrintOut. Properties and methods that can be used without the Application object qualifier are considered "global." To view the global properties and methods in the Object Browser, click <globals> at the top of the list in the Classes box. (Also see the Global object.)

Remarks

To use Automation (formerly OLE Automation) to control Word from another application, use the Microsoft Visual Basic CreateObject or GetObject function to return a Word Application object. The following Microsoft Office Excel example starts Word (if it is not already running) and opens an existing document.

VBA Copy code Copy code
Set wrd = GetObject(, "Word.Application")
wrd.Visible = True
wrd.Documents.Open "C:\My Documents\Temp.doc"
Set wrd = Nothing

See also

Concepts

Word Object Model Reference

Other resources

Application Object Members


Application Members (Word)

 Copy code hover
[image]

Application Members (Word)
Send feedback

Published: July 16, 2012

Represents the Microsoft Word application. The Application object includes properties and methods that return top-level objects. For example, the ActiveDocument property returns a Document object.

Events

Name | Description
DocumentBeforeClose | Occurs immediately before any open document closes.
DocumentBeforePrint | Occurs before any open document is printed.
DocumentBeforeSave | Occurs before any open document is saved.
DocumentChange | Occurs when a new document is created, when an existing document is opened, or when another document is made the active document.
DocumentOpen | Occurs when a document is opened.
DocumentSync | This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.
EPostageInsert | Occurs when a user inserts electronic postage into a document.
EPostageInsertEx | Occurs when a user inserts electronic postage into a document.
EPostagePropertyDialog | Occurs when a user clicks the E-postage Properties (Labels and Envelopes dialog box) button or Print Electronic Postage button.
MailMergeAfterMerge | Occurs after all records in a mail merge have merged successfully.
MailMergeAfterRecordMerge | Occurs after each record in the data source successfully merges in a mail merge.
MailMergeBeforeMerge | Occurs when a merge is executed before any records merge.
MailMergeBeforeRecordMerge | Occurs as a merge is executed for the individual records in a merge.
MailMergeDataSourceLoad | Occurs when the data source is loaded for a mail merge.
MailMergeDataSourceValidate | Occurs when a user validates mail merge recipients by clicking Validate in the Mail Merge Recipients dialog box.
MailMergeDataSourceValidate2 | Occurs when a user validates mail merge recipients by clicking the Validate addresses link button in the Mail Merge Recipients dialog box.
MailMergeWizardSendToCustom | Occurs when the custom button is clicked during step six of the Mail Merge Wizard.
MailMergeWizardStateChange | Occurs when a user changes from a specified step to a specified step in the Mail Merge Wizard.
NewDocument | Occurs when a new document is created.
ProtectedViewWindowActivate | Occurs when any protected view window is activated.
ProtectedViewWindowBeforeClose | Occurs immediately before a protected view window or a document in a protected view window closes.
ProtectedViewWindowBeforeEdit | Occurs immediately before editing is enabled on the document in the specified protected view window.
ProtectedViewWindowDeactivate | Occurs when a protected view window is deactivated.
ProtectedViewWindowOpen | Occurs when a protected view window is opened.
ProtectedViewWindowSize |
Quit | Occurs when the user exits Microsoft Word.
WindowActivate | Occurs when any document window is activated.
WindowBeforeDoubleClick | Occurs when the editing area of a document window is double-clicked, before the default double-click action.
WindowBeforeRightClick | Occurs when the editing area of a document window is right-clicked, before the default right-click action.
WindowDeactivate | Occurs when any document window is deactivated.
WindowSelectionChange | Occurs when the selection changes in the active document window.
WindowSize | Occurs when the application window is resized or moved.
XMLSelectionChange | Occurs when the parent XML node of the current selection changes.
XMLValidationError | Occurs when there is a validation error in the document.

Methods

Name | Description
Activate | Activates the specified object.
AddAddress | Adds an entry to the address book. Each entry has values for one or more tag IDs.
AutomaticChange | Performs an AutoFormat action when there is a change suggested by the Office Assistant. If no AutoFormat action is active, this method generates an error.
BuildKeyCode | Returns a unique number for the specified key combination.
CentimetersToPoints | Converts a measurement from centimeters to points (1 cm = 28.35 points). Returns the converted measurement as a Single.
ChangeFileOpenDirectory | Sets the folder in which Word searches for documents.
CheckGrammar | Checks a string for grammatical errors. Returns a Boolean to indicate whether the string contains grammatical errors. True if the string contains no errors.
CheckSpelling | Checks a string for spelling errors. Returns a Boolean to indicate whether the string contains spelling errors. True if the string has no spelling errors.
CleanString | Removes nonprinting characters (character codes 1 - 29) and special Word characters from the specified string or changes them to spaces (character code 32). Returns the result as a String.
CompareDocuments | Compares two documents and returns a Document object that represents the document that contains the differences between the two documents, marked using tracked changes.
DDEExecute | Sends a command or series of commands to an application through the specified dynamic data exchange (DDE) channel.
DDEInitiate | Opens a dynamic data exchange (DDE) channel to another application, and returns the channel number.
DDEPoke | Uses an open dynamic data exchange (DDE) channel to send data to an application.
DDERequest | Uses an open dynamic data exchange (DDE) channel to request information from the receiving application, and returns the information as a String.
DDETerminate | Closes the specified dynamic data exchange (DDE) channel to another application.
DDETerminateAll | Closes all dynamic data exchange (DDE) channels opened by Microsoft Word.
DefaultWebOptions | Returns the DefaultWebOptions object that contains global application-level attributes used by Microsoft Word whenever you save a document as a Web page or open a Web page.
GetAddress | Returns an address from the default address book.
GetDefaultTheme | Returns a String that represents the name of the default theme plus the theme formatting options Microsoft Word uses for new documents, e-mail messages, or Web pages.
GetSpellingSuggestions | Returns a SpellingSuggestions collection that represents the words suggested as spelling replacements for a given word.
GoBack | Moves the insertion point among the last three locations where editing occurred in the active document (the same as pressing SHIFT+F5).
GoForward | Moves the insertion point forward among the last three locations where editing occurred in the active document.
Help | Displays installed Help information.
HelpTool |
InchesToPoints | Converts a measurement from inches to points (1 inch = 72 points). Returns the converted measurement as a Single.
Keyboard | Returns or sets the keyboard language and layout settings.
KeyboardBidi | Sets the keyboard language to a right-to-left language and the text entry direction to right-to-left.
KeyboardLatin | Sets the keyboard language to a left-to-right language and the text entry direction to left-to-right.
KeyString | Returns the key combination string for the specified keys (for example, CTRL+SHIFT+A).
LinesToPoints | Converts a measurement from lines to points (1 line = 12 points). Returns the converted measurement as a Single.
ListCommands | Creates a new document and then inserts a table of Word commands along with their associated shortcut keys and menu assignments.
LoadMasterList | Loads a bibliography source file.
LookupNameProperties | Looks up a name in the global address book list and displays the Properties dialog box, which includes information about the specified name.
MergeDocuments | Compares two documents and returns a Document object that represents the document that contains the differences between the two documents, marked using tracked changes.
MillimetersToPoints | Converts a measurement from millimeters to points (1 mm = 2.85 points). Returns the converted measurement as a Single.
Move | Positions a task window or the active document window.
NewWindow | Opens a new window with the same document as the specified window. Returns a Window object.
NextLetter | You have requested Help for a Visual Basic keyword used only on the Macintosh. For information about the NextLetter method of the Application object, consult the language reference Help included with Microsoft Office Macintosh Edition.
OnTime | Starts a background timer that runs a macro at a specified time.
OrganizerCopy | Copies the specified AutoText entry, toolbar, style, or macro project item from the source document or template to the destination document or template.
OrganizerDelete | Deletes the specified style, AutoText entry, toolbar, or macro project item from a document or template.
OrganizerRename | Renames the specified style, AutoText entry, toolbar, or macro project item in a document or template.
PicasToPoints | Converts a measurement from picas to points (1 pica = 12 points). Returns the converted measurement as a Single.
PixelsToPoints | Converts a measurement from pixels to points. Returns the converted measurement as a Single.
PointsToCentimeters | Converts a measurement from points to centimeters (1 centimeter = 28.35 points). Returns the converted measurement as a Single.
PointsToInches | Converts a measurement from points to inches (1 inch = 72 points). Returns the converted measurement as a Single.
PointsToLines | Converts a measurement from points to lines (1 line = 12 points). Returns the converted measurement as a Single.
PointsToMillimeters | Converts a measurement from points to millimeters (1 millimeter = 2.835 points). Returns the converted measurement as a Single.
PointsToPicas | Converts a measurement from points to picas (1 pica = 12 points). Returns the converted measurement as a Single.
PointsToPixels | Converts a measurement from points to pixels. Returns the converted measurement as a Single.
PrintOut | Prints all or part of the specified document.
ProductCode | Returns the Microsoft Word globally unique identifier (GUID) as a String.
PutFocusInMailHeader | Places the insertion point in the To line of the mail header if the document in the active window is an e-mail document.
Quit | Quits Microsoft Word and optionally saves or routes the open documents.
Repeat | Repeats the most recent editing action one or more times. Returns True if the commands were repeated successfully.
ResetIgnoreAll | Clears the list of words that were previously ignored during a spelling check.
Resize | Sizes the Word application window or the specified task window.
Run | Runs a Visual Basic macro.
ScreenRefresh | Updates the display on the monitor with the current information in the video memory buffer.
SetDefaultTheme | Sets a default theme for Microsoft Word to use with new documents, e-mail messages, or Web pages.
ShowClipboard | Displays the Clipboard task pane.
ShowMe |
SubstituteFont | Sets font-mapping options.
ToggleKeyboard | Switches the keyboard language setting between right-to-left and left-to-right languages.

Properties

Name | Description
ActiveDocument | Returns a Document object that represents the active document (the document with the focus). If there are no documents open, an error occurs. Read-only.
ActiveEncryptionSession | Returns a Long that represents the encryption session associated with the active document. Read-only.
ActivePrinter | Returns or sets the name of the active printer. Read/write String.
ActiveProtectedViewWindow | Returns a ProtectedViewWindow object that represents the active protected view window. Read-only.
ActiveWindow | Returns a Window object that represents the active window (the window with the focus). If there are no windows open, an error occurs. Read-only.
AddIns | Returns an AddIns collection that represents all available add-ins, regardless of whether they're currently loaded. Read-only.
Application | Returns an Application object that represents the Microsoft Word application.
ArbitraryXMLSupportAvailable | Returns a Boolean that represents whether Microsoft Word accepts custom XML schemas. True indicates that Word accepts custom XML schemas.
Assistance | Returns an Assistance object that represents the Microsoft Office Help Viewer. Read-only.
AutoCaptions | Returns an AutoCaptions collection that represents the captions that are automatically added when items such as tables and pictures are inserted into a document. Read-only.
AutoCorrect | Returns an AutoCorrect object that contains the current AutoCorrect options, entries, and exceptions. Read-only.
AutoCorrectEmail | Returns an AutoCorrect object that represents automatic corrections made to e-mail messages.
AutomationSecurity | Returns or sets an MsoAutomationSecurity constant that represents the security setting Microsoft Word uses when programmatically opening files. .
BackgroundPrintingStatus | Returns the number of print jobs in the background printing queue. Read-only Long.
BackgroundSavingStatus | Returns the number of files queued up to be saved in the background. Read-only Long.
Bibliography | Returns a Bibliography object that represents the bibliography references sources stored in Microsoft Word. Read-only.
BrowseExtraFileTypes | Set this property to "text/html" to allow hyperlinked HTML files to be opened in Microsoft Word (instead of the default Internet browser). Read/write String.
Browser | Returns a Browser object that represents the Select Browse Object tool on the vertical scroll bar. Read-only.
Build | Returns the version and build number of the Word application. Read-only String.
CapsLock | True if the CAPS LOCK key is turned on. Read-only Boolean.
Caption | Returns or sets the text displayed in the Title bar of the application window. Read/write String.
CaptionLabels | Returns a CaptionLabels collection that represents all the available caption labels. Read-only.
ChartDataPointTrack | Returns or sets a Boolean that specifies whether charts use cell-reference data-point tracking. Read-write.
CheckLanguage | True if Microsoft Word automatically detects the language you are using as you type. Read/write Boolean.
COMAddIns | Returns a reference to the COMAddIns collection that represents all the Component Object Model (COM) add-ins currently loaded in Microsoft Word.
CommandBars | Returns a CommandBars collection that represents the menu bar and all the toolbars in Microsoft Word.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
CustomDictionaries | Returns a Dictionaries object that represents the collection of active custom dictionaries. Read-only.
CustomizationContext | Returns or sets a Template or Document object that represents the template or document in which changes to menu bars, toolbars, and key bindings are stored. Read/write.
DefaultLegalBlackline | True for Microsoft Word to compare and merge documents using the Legal blackline option in the Compare and Merge Documents dialog box. Read/write Boolean.
DefaultSaveFormat | Returns or sets the default format that will appear in the Save as type box in the Save As dialog box. Read/write String.
DefaultTableSeparator | Returns or sets the single character used to separate text into cells when text is converted to a table. Read/write String.
Dialogs | Returns a Dialogs collection that represents all the built-in dialog boxes in Word.Read-only.
DisplayAlerts | Returns or sets the way certain alerts and messages are handled while a macro is running. Read/write WdAlertLevel.
DisplayAutoCompleteTips | True if Word displays tips that suggest text for completing words, dates, or phrases as you type. Read/write Boolean.
DisplayDocumentInformationPanel | Returns or sets a Boolean that represents whether the document properties panel is displayed. Read/write.
DisplayRecentFiles | True if the names of recently used files are displayed on the File menu. Read/write Boolean.
DisplayScreenTips | True if comments, footnotes, endnotes, and hyperlinks are displayed as tips. Text marked as having comments is highlighted. Read/write Boolean.
DisplayScrollBars | True if Word displays a scroll bar in at least one document window. False if there are no scroll bars displayed in any window. Read/write Boolean.
Documents | Returns a Documents collection that represents all the open documents. Read-only.
DontResetInsertionPointProperties | Returns or sets a Boolean that represents whether Microsoft Word maintains the formatting properties of the text at that position of the Insertion Point after running other code. Read/write.
EmailOptions | Returns an EmailOptions object that represents the global preferences for e-mail authoring. Read-only.
EmailTemplate | Returns or sets a String that represents the document template to use when sending e-mail messages. Read/write.
EnableCancelKey | Returns or sets the way that Word handles CTRL+BREAK user interruptions. Read/write WdEnableCancelKey.
FeatureInstall | Returns or sets how Microsoft Word handles calls to methods and properties that require features not yet installed. Read/write MsoFeatureInstall.
FileConverters | Returns a FileConverters collection that represents all the file converters available to Microsoft Word. Read-only.
FileDialog | Returns a FileDialog object which represents a single instance of a file dialog box.
FileValidation | Returns or sets how Word will validate files before opening them. Read/write MsoFileValidationMode.
FindKey | Returns a KeyBinding object that represents the specified key combination. Read-only.
FocusInMailHeader | True if the insertion point is in an e-mail header field (the To: field, for example). Read-only Boolean.
FontNames | Returns a FontNames object that includes the names of all the available fonts. Read-only.
HangulHanjaDictionaries | Returns a HangulHanjaConversionDictionaries collection that represents all the active custom conversion dictionaries.
Height | Returns or sets the height of the active document window. Read/write Long.
International | Returns information about the current country/region and international settings. Read-only Variant.
IsObjectValid | True if the specified variable that references an object is valid. Read-only Boolean.
IsSandboxed | True if the application window is a protected view window. Read-only.
KeyBindings | Returns a KeyBindings collection that represents customized key assignments, which include a key code, a key category, and a command.
KeysBoundTo | Returns a KeysBoundTo object that represents all the key combinations assigned to the specified item.
LandscapeFontNames | Returns a FontNames object that includes the names of all the available landscape fonts.
Language | Returns an MsoLanguageID constant that represents the language selected for the Microsoft Word user interface.
Languages | Returns a Languages collection that represents the proofing languages listed in the Language dialog box.
LanguageSettings | Returns a LanguageSettings object, which contains information about the language settings in Microsoft Word.
Left | Returns or sets a Long that represents the horizontal position of the active document, measured in points. Read/write.
ListGalleries | Returns a ListGalleries collection that represents the three list template galleries. .
MacroContainer | Returns a Template or Document object that represents the template or document in which the module that contains the running procedure is stored.
MailingLabel | Returns a MailingLabel object that represents a mailing label.
MailMessage | Returns a MailMessage object that represents the active e-mail message.
MailSystem | Returns the mail system (or systems) installed on the host computer. Read-only WdMailSystem.
MAPIAvailable | True if MAPI is installed. Read-only Boolean.
MathCoprocessorAvailable | True if a math coprocessor is installed and available to Microsoft Word. Read-only Boolean.
MouseAvailable | True if there is a mouse available for the system. Read-only Boolean.
Name | Returns the name of the specified object. Read-only String.
NewDocument | Returns a NewFile object that represents a document listed on the New tab.
NormalTemplate | Returns a Template object that represents the Normal template.
NumLock | Returns the state of the NUM LOCK key. True if the keys on the numeric keypad insert numbers, False if the keys move the insertion point. Read-only Boolean.
OMathAutoCorrect | Returns an OMathAutoCorrect object that represents the auto correct entries for equations. Read-only.
OpenAttachmentsInFullScreen | Returns or sets a Boolean that represents whether Microsoft Word opens e-mail attachments in Reading mode. Read/write.
Options | Returns an Options object that represents application settings in Microsoft Word.
Parent | Returns an Object that represents the parent object of the specified Application object.
Path | Returns the disk or Web path to the specified object. Read-only String.
PathSeparator | Returns the character used to separate folder names. This property returns a backslash (\). Read-only String.
PickerDialog | Returns a PickerDialog object that provides the functionality to select people or data in a dialog box. Read-only.
PortraitFontNames | Returns a FontNames object that includes the names of all the available portrait fonts.
PrintPreview | True if print preview is the current view. Read/write Boolean.
ProtectedViewWindows | Returns a ProtectedViewWindows collection that represents all protected view windows. Read-only.
RecentFiles | Returns a RecentFiles collection that represents the most recently accessed files.
RestrictLinkedStyles | Returns or sets a Boolean that represents whether Microsoft Word allows linked styles. Read/write.
ScreenUpdating | True if screen updating is turned on. Read/write Boolean.
Selection | Returns the Selection object that represents a selected range or the insertion point. Read-only.
ShowAnimation | This object or member is deprecated and is not intended to be used in your code.
ShowStartupDialog | True to display the Task Pane when starting Microsoft Word. Read/write Boolean.
ShowStylePreviews | Returns or sets a Boolean that represents whether Microsoft Word shows a preview of the formatting for styles in the Styles dialog box. Read/write.
ShowVisualBasicEditor | True if the Visual Basic Editor window is visible. Read/write Boolean.
SmartArtColors | Returns a SmartArtColors object that represents the set of color styles that are currently loaded in the application. Read-only.
SmartArtLayouts | Returns a SmartArtLayouts object that represents the set of SmartArt layouts that are currently loaded in the application. Read-only.
SmartArtQuickStyles | Returns a SmartArtQuickStyles object that represents the set of SmartArt styles that are currently loaded in the application. Read-only.
SpecialMode | True if Microsoft Word is in a special mode (for example, CopyText mode, or MoveText mode). Read-only Boolean.
StartupPath | Returns or sets the complete path of the startup folder, excluding the final separator. Read/write String.
StatusBar | This property is no longer supported in Microsoft Word Visual Basic for Applications.
SynonymInfo | Returns a SynonymInfo object that contains information from the thesaurus on synonyms, antonyms, or related words and expressions for the specified word or phrase.
System | Returns a System object, which can be used to return system-related information and perform system-related tasks.
TaskPanes | Returns a TaskPanes collection that represents the most commonly performed tasks in Microsoft Word.
Tasks | Returns a Tasks collection that represents all the applications that are running.
Templates | Returns a Templates collection that represents all the available templates—global templates and those attached to open documents.
Top | Returns or sets the vertical position of the active document. Read/write Long.
UndoRecord | Returns an UndoRecord object that provides a custom entry point into the undo stack. Read-only.
UsableHeight | Returns the maximum height (in points) to which you can set the height of a Microsoft Word document window. Read-only Long.
UsableWidth | Returns the maximum width (in points) to which you can set the width of a Microsoft Word document window. Read-only Long.
UserAddress | Returns or sets the user's mailing address. Read/write String.
UserControl | True if the document or application was created or opened by the user. Read-only Boolean.
UserInitials | Returns or sets the user's initials, which Microsoft Word uses to construct comment marks. Read/write String.
UserName | Returns or sets the user's name, which is used on envelopes and for the Author document property. Read/write String.
VBE | Returns a VBE object that represents the Visual Basic Editor.
Version | Returns the Microsoft Word version number. Read-only String.
Visible | True if the specified object is visible. Read/write Boolean.
Width | Returns or sets the width of the application window, in points. Read/write Long.
Windows | Returns a Windows collection that represents all document windows. Read-only.
WindowState | Returns or sets the state of the specified document window or task window. Read/write WdWindowState.
WordBasic | Returns an automation object (Word.Basic) that includes methods for all the WordBasic statements and functions available in Word version 6.0 and Word for Windows 95. Read-only.
XMLNamespaces | Returns an XMLNamespaces collection that represents the XML schemas in the Schema Library.


Application Properties (Word)

 Copy code hover
[image]

Application Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
ActiveDocument | Returns a Document object that represents the active document (the document with the focus). If there are no documents open, an error occurs. Read-only.
ActiveEncryptionSession | Returns a Long that represents the encryption session associated with the active document. Read-only.
ActivePrinter | Returns or sets the name of the active printer. Read/write String.
ActiveProtectedViewWindow | Returns a ProtectedViewWindow object that represents the active protected view window. Read-only.
ActiveWindow | Returns a Window object that represents the active window (the window with the focus). If there are no windows open, an error occurs. Read-only.
AddIns | Returns an AddIns collection that represents all available add-ins, regardless of whether they're currently loaded. Read-only.
Application | Returns an Application object that represents the Microsoft Word application.
ArbitraryXMLSupportAvailable | Returns a Boolean that represents whether Microsoft Word accepts custom XML schemas. True indicates that Word accepts custom XML schemas.
Assistance | Returns an Assistance object that represents the Microsoft Office Help Viewer. Read-only.
AutoCaptions | Returns an AutoCaptions collection that represents the captions that are automatically added when items such as tables and pictures are inserted into a document. Read-only.
AutoCorrect | Returns an AutoCorrect object that contains the current AutoCorrect options, entries, and exceptions. Read-only.
AutoCorrectEmail | Returns an AutoCorrect object that represents automatic corrections made to e-mail messages.
AutomationSecurity | Returns or sets an MsoAutomationSecurity constant that represents the security setting Microsoft Word uses when programmatically opening files. .
BackgroundPrintingStatus | Returns the number of print jobs in the background printing queue. Read-only Long.
BackgroundSavingStatus | Returns the number of files queued up to be saved in the background. Read-only Long.
Bibliography | Returns a Bibliography object that represents the bibliography references sources stored in Microsoft Word. Read-only.
BrowseExtraFileTypes | Set this property to "text/html" to allow hyperlinked HTML files to be opened in Microsoft Word (instead of the default Internet browser). Read/write String.
Browser | Returns a Browser object that represents the Select Browse Object tool on the vertical scroll bar. Read-only.
Build | Returns the version and build number of the Word application. Read-only String.
CapsLock | True if the CAPS LOCK key is turned on. Read-only Boolean.
Caption | Returns or sets the text displayed in the Title bar of the application window. Read/write String.
CaptionLabels | Returns a CaptionLabels collection that represents all the available caption labels. Read-only.
ChartDataPointTrack | Returns or sets a Boolean that specifies whether charts use cell-reference data-point tracking. Read-write.
CheckLanguage | True if Microsoft Word automatically detects the language you are using as you type. Read/write Boolean.
COMAddIns | Returns a reference to the COMAddIns collection that represents all the Component Object Model (COM) add-ins currently loaded in Microsoft Word.
CommandBars | Returns a CommandBars collection that represents the menu bar and all the toolbars in Microsoft Word.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
CustomDictionaries | Returns a Dictionaries object that represents the collection of active custom dictionaries. Read-only.
CustomizationContext | Returns or sets a Template or Document object that represents the template or document in which changes to menu bars, toolbars, and key bindings are stored. Read/write.
DefaultLegalBlackline | True for Microsoft Word to compare and merge documents using the Legal blackline option in the Compare and Merge Documents dialog box. Read/write Boolean.
DefaultSaveFormat | Returns or sets the default format that will appear in the Save as type box in the Save As dialog box. Read/write String.
DefaultTableSeparator | Returns or sets the single character used to separate text into cells when text is converted to a table. Read/write String.
Dialogs | Returns a Dialogs collection that represents all the built-in dialog boxes in Word.Read-only.
DisplayAlerts | Returns or sets the way certain alerts and messages are handled while a macro is running. Read/write WdAlertLevel.
DisplayAutoCompleteTips | True if Word displays tips that suggest text for completing words, dates, or phrases as you type. Read/write Boolean.
DisplayDocumentInformationPanel | Returns or sets a Boolean that represents whether the document properties panel is displayed. Read/write.
DisplayRecentFiles | True if the names of recently used files are displayed on the File menu. Read/write Boolean.
DisplayScreenTips | True if comments, footnotes, endnotes, and hyperlinks are displayed as tips. Text marked as having comments is highlighted. Read/write Boolean.
DisplayScrollBars | True if Word displays a scroll bar in at least one document window. False if there are no scroll bars displayed in any window. Read/write Boolean.
Documents | Returns a Documents collection that represents all the open documents. Read-only.
DontResetInsertionPointProperties | Returns or sets a Boolean that represents whether Microsoft Word maintains the formatting properties of the text at that position of the Insertion Point after running other code. Read/write.
EmailOptions | Returns an EmailOptions object that represents the global preferences for e-mail authoring. Read-only.
EmailTemplate | Returns or sets a String that represents the document template to use when sending e-mail messages. Read/write.
EnableCancelKey | Returns or sets the way that Word handles CTRL+BREAK user interruptions. Read/write WdEnableCancelKey.
FeatureInstall | Returns or sets how Microsoft Word handles calls to methods and properties that require features not yet installed. Read/write MsoFeatureInstall.
FileConverters | Returns a FileConverters collection that represents all the file converters available to Microsoft Word. Read-only.
FileDialog | Returns a FileDialog object which represents a single instance of a file dialog box.
FileValidation | Returns or sets how Word will validate files before opening them. Read/write MsoFileValidationMode.
FindKey | Returns a KeyBinding object that represents the specified key combination. Read-only.
FocusInMailHeader | True if the insertion point is in an e-mail header field (the To: field, for example). Read-only Boolean.
FontNames | Returns a FontNames object that includes the names of all the available fonts. Read-only.
HangulHanjaDictionaries | Returns a HangulHanjaConversionDictionaries collection that represents all the active custom conversion dictionaries.
Height | Returns or sets the height of the active document window. Read/write Long.
International | Returns information about the current country/region and international settings. Read-only Variant.
IsObjectValid | True if the specified variable that references an object is valid. Read-only Boolean.
IsSandboxed | True if the application window is a protected view window. Read-only.
KeyBindings | Returns a KeyBindings collection that represents customized key assignments, which include a key code, a key category, and a command.
KeysBoundTo | Returns a KeysBoundTo object that represents all the key combinations assigned to the specified item.
LandscapeFontNames | Returns a FontNames object that includes the names of all the available landscape fonts.
Language | Returns an MsoLanguageID constant that represents the language selected for the Microsoft Word user interface.
Languages | Returns a Languages collection that represents the proofing languages listed in the Language dialog box.
LanguageSettings | Returns a LanguageSettings object, which contains information about the language settings in Microsoft Word.
Left | Returns or sets a Long that represents the horizontal position of the active document, measured in points. Read/write.
ListGalleries | Returns a ListGalleries collection that represents the three list template galleries. .
MacroContainer | Returns a Template or Document object that represents the template or document in which the module that contains the running procedure is stored.
MailingLabel | Returns a MailingLabel object that represents a mailing label.
MailMessage | Returns a MailMessage object that represents the active e-mail message.
MailSystem | Returns the mail system (or systems) installed on the host computer. Read-only WdMailSystem.
MAPIAvailable | True if MAPI is installed. Read-only Boolean.
MathCoprocessorAvailable | True if a math coprocessor is installed and available to Microsoft Word. Read-only Boolean.
MouseAvailable | True if there is a mouse available for the system. Read-only Boolean.
Name | Returns the name of the specified object. Read-only String.
NewDocument | Returns a NewFile object that represents a document listed on the New tab.
NormalTemplate | Returns a Template object that represents the Normal template.
NumLock | Returns the state of the NUM LOCK key. True if the keys on the numeric keypad insert numbers, False if the keys move the insertion point. Read-only Boolean.
OMathAutoCorrect | Returns an OMathAutoCorrect object that represents the auto correct entries for equations. Read-only.
OpenAttachmentsInFullScreen | Returns or sets a Boolean that represents whether Microsoft Word opens e-mail attachments in Reading mode. Read/write.
Options | Returns an Options object that represents application settings in Microsoft Word.
Parent | Returns an Object that represents the parent object of the specified Application object.
Path | Returns the disk or Web path to the specified object. Read-only String.
PathSeparator | Returns the character used to separate folder names. This property returns a backslash (\). Read-only String.
PickerDialog | Returns a PickerDialog object that provides the functionality to select people or data in a dialog box. Read-only.
PortraitFontNames | Returns a FontNames object that includes the names of all the available portrait fonts.
PrintPreview | True if print preview is the current view. Read/write Boolean.
ProtectedViewWindows | Returns a ProtectedViewWindows collection that represents all protected view windows. Read-only.
RecentFiles | Returns a RecentFiles collection that represents the most recently accessed files.
RestrictLinkedStyles | Returns or sets a Boolean that represents whether Microsoft Word allows linked styles. Read/write.
ScreenUpdating | True if screen updating is turned on. Read/write Boolean.
Selection | Returns the Selection object that represents a selected range or the insertion point. Read-only.
ShowAnimation | This object or member is deprecated and is not intended to be used in your code.
ShowStartupDialog | True to display the Task Pane when starting Microsoft Word. Read/write Boolean.
ShowStylePreviews | Returns or sets a Boolean that represents whether Microsoft Word shows a preview of the formatting for styles in the Styles dialog box. Read/write.
ShowVisualBasicEditor | True if the Visual Basic Editor window is visible. Read/write Boolean.
SmartArtColors | Returns a SmartArtColors object that represents the set of color styles that are currently loaded in the application. Read-only.
SmartArtLayouts | Returns a SmartArtLayouts object that represents the set of SmartArt layouts that are currently loaded in the application. Read-only.
SmartArtQuickStyles | Returns a SmartArtQuickStyles object that represents the set of SmartArt styles that are currently loaded in the application. Read-only.
SpecialMode | True if Microsoft Word is in a special mode (for example, CopyText mode, or MoveText mode). Read-only Boolean.
StartupPath | Returns or sets the complete path of the startup folder, excluding the final separator. Read/write String.
StatusBar | This property is no longer supported in Microsoft Word Visual Basic for Applications.
SynonymInfo | Returns a SynonymInfo object that contains information from the thesaurus on synonyms, antonyms, or related words and expressions for the specified word or phrase.
System | Returns a System object, which can be used to return system-related information and perform system-related tasks.
TaskPanes | Returns a TaskPanes collection that represents the most commonly performed tasks in Microsoft Word.
Tasks | Returns a Tasks collection that represents all the applications that are running.
Templates | Returns a Templates collection that represents all the available templates—global templates and those attached to open documents.
Top | Returns or sets the vertical position of the active document. Read/write Long.
UndoRecord | Returns an UndoRecord object that provides a custom entry point into the undo stack. Read-only.
UsableHeight | Returns the maximum height (in points) to which you can set the height of a Microsoft Word document window. Read-only Long.
UsableWidth | Returns the maximum width (in points) to which you can set the width of a Microsoft Word document window. Read-only Long.
UserAddress | Returns or sets the user's mailing address. Read/write String.
UserControl | True if the document or application was created or opened by the user. Read-only Boolean.
UserInitials | Returns or sets the user's initials, which Microsoft Word uses to construct comment marks. Read/write String.
UserName | Returns or sets the user's name, which is used on envelopes and for the Author document property. Read/write String.
VBE | Returns a VBE object that represents the Visual Basic Editor.
Version | Returns the Microsoft Word version number. Read-only String.
Visible | True if the specified object is visible. Read/write Boolean.
Width | Returns or sets the width of the application window, in points. Read/write Long.
Windows | Returns a Windows collection that represents all document windows. Read-only.
WindowState | Returns or sets the state of the specified document window or task window. Read/write WdWindowState.
WordBasic | Returns an automation object (Word.Basic) that includes methods for all the WordBasic statements and functions available in Word version 6.0 and Word for Windows 95. Read-only.
XMLNamespaces | Returns an XMLNamespaces collection that represents the XML schemas in the Schema Library.


Application.ActiveDocument Property (Word)

 Copy code hover
[image]

Application.ActiveDocument Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Document object that represents the active document (the document with the focus). If there are no documents open, an error occurs. Read-only.

Note Note

The document in the active protected view window cannot be accessed using this property. Instead, use the Document property of the ActiveProtectedViewWindow object.

Syntax

expression .ActiveDocument

expression A variable that represents an Application object.

Example

This example displays the name of the active document, or if there are no documents open, it displays a message.

VBA Copy code Copy code
If Application.Documents.Count >= 1 Then
    MsgBox ActiveDocument.Name
Else
    MsgBox "No documents are open"
End If

This example collapses the selection to an insertion point and then creates a range for the next five characters in the selection.

VBA Copy code Copy code
Dim rngTemp As Range

Selection.Collapse Direction:=wdCollapseStart
Set rngTemp = ActiveDocument.Range(Start:=Selection.Start, _
    End:=Selection.Start + 5)

This example inserts texts at the beginning of the active document and then prints the document.

VBA Copy code Copy code
Dim rngTemp As Range

Set rngTemp = ActiveDocument.Range(Start:=0, End:=0)
With rngTemp
    .InsertBefore "Company Report"
    .Font.Name = "Arial"
    .Font.Size = 24
    .InsertParagraphAfter
End With

ActiveDocument.PrintOut

See also

Concepts

Application Object

Other resources

Application Object Members


Application.ActiveEncryptionSession Property (Word)

 Copy code hover
[image]

Application.ActiveEncryptionSession Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the encryption session associated with the active document. Read-only.

Syntax

expression .ActiveEncryptionSession

expression An expression that returns an Application object.

Remarks

The encryption provider mechanism manages each file on a separate process, so each file is associated with a separate encryption session.

Note Note

This property applies only when a document implements custom encryption.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.ActivePrinter Property (Word)

 Copy code hover
[image]

Application.ActivePrinter Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the name of the active printer. Read/write String.

Syntax

expression .ActivePrinter

expression A variable that represents an Application object.

Remarks

Setting the printer using the ActivePrinter property changes the default printer. For more information, see Setting ActivePrinter Changes System Default Printer .

Example

This example displays the name of the active printer.

VBA Copy code Copy code
MsgBox "The name of the active printer is " & ActivePrinter

This example makes a network HP LaserJet IIISi printer the active printer.

VBA Copy code Copy code
Application.ActivePrinter = "HP LaserJet IIISi on \\printers\laser"

This example makes a local HP LaserJet 4 printer on LPT1 the active printer.

VBA Copy code Copy code
Application.ActivePrinter = "HP LaserJet 4 local on LPT1:"

See also

Concepts

Application Object

Other resources

Application Object Members


Application.ActiveProtectedViewWindow Property (Word)

 Copy code hover
[image]

Application.ActiveProtectedViewWindow Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a ProtectedViewWindow object that represents the active protected view window. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .ActiveProtectedViewWindow

expression An expression that returns a Application object.

Example

The following code example displays the caption text for the active protected view window.

VBA Copy code Copy code
MsgBox ActiveProtectedViewWindow.Caption

See also

Concepts

Application Object

Other resources

Application Object Members


Application.ActiveWindow Property (Word)

 Copy code hover
[image]

Application.ActiveWindow Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Window object that represents the active window (the window with the focus). If there are no windows open, an error occurs. Read-only.

Syntax

expression .ActiveWindow

expression A variable that represents an Application object.

Example

This example displays the caption text for the active window.

VBA Copy code Copy code
Sub WindowCaption()
 MsgBox ActiveWindow.Caption
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.AddIns Property (Word)

 Copy code hover
[image]

Application.AddIns Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an AddIns collection that represents all available add-ins, regardless of whether they're currently loaded. Read-only.

Syntax

expression .AddIns

expression A variable that represents an Application object.

Remarks

The AddIns collection includes the global templates and Word add-in libraries (WLLs) listed in the Templates and Add-ins dialog box. For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example returns the total number of add-ins.

VBA Copy code Copy code
Dim intAddIns as Integer

intAddIns = AddIns.Count

This example displays the name of each add-in in the Addins collection.

VBA Copy code Copy code
Dim addinLoop as AddIn

For Each addinLoop In AddIns
 MsgBox addinLoop.Name
Next addinLoop

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Application Property (Word)

 Copy code hover
[image]

Application.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression A variable that represents an Application object.

Example

This example displays scroll bars, screen tips, and the status bar for Microsoft Word.

VBA Copy code Copy code
With Application
 .DisplayScrollBars = True
 .DisplayScreenTips = True
 .DisplayStatusBar = True
End With

See also

Concepts

Application Object

Other resources

Application Object Members


Application.ArbitraryXMLSupportAvailable Property (Word)

 Copy code hover
[image]

Application.ArbitraryXMLSupportAvailable Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Boolean that represents whether Microsoft Word accepts custom XML schemas. True indicates that Word accepts custom XML schemas.

Syntax

expression .ArbitraryXMLSupportAvailable

expression An expression that returns an Application object.

Remarks

Microsoft Office Standard Edition 2003 includes XML support using the Word XML schema, but it does not provide support for custom XML schemas. Support for custom XML schemas is available only in the stand-alone release of Office Word 2003 or greater and in Office Professional Edition 2003 or greater. Use the ArbitraryXMLSupportAvailable property to determine which release is installed.

Example

The following code displays a message if the installed version of Word does not support custom XML schemas.

VBA Copy code Copy code
If Application.ArbitraryXMLSupportAvailable = False Then
 MsgBox "Custom XML schemas are not " & _
 "supported in this version of Microsoft Word."

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Assistance Property (Word)

 Copy code hover
[image]

Application.Assistance Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Assistance object that represents the Microsoft Office Help Viewer. Read-only.

Syntax

expression .Assistance

expression An expression that returns an Application object.

Remarks

The Assistance object allows developers to show custom help and help that is installed with Office in the Office Help Viewer.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.AutoCaptions Property (Word)

 Copy code hover
[image]

Application.AutoCaptions Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an AutoCaptions collection that represents the captions that are automatically added when items such as tables and pictures are inserted into a document. Read-only.

Syntax

expression .AutoCaptions

expression A variable that represents an Application object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example displays the name of each item that automatically gets a caption when inserted into the document.

VBA Copy code Copy code
Dim captionLoop as AutoCaption

For Each captionLoop In AutoCaptions
 If captionLoop.AutoInsert Then MsgBox captionLoop.Name
Next captionLoop

See also

Concepts

Application Object

Other resources

Application Object Members


Application.AutoCorrect Property (Word)

 Copy code hover
[image]

Application.AutoCorrect Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an AutoCorrect object that contains the current AutoCorrect options, entries, and exceptions. Read-only.

Syntax

expression .AutoCorrect

expression A variable that represents an Application object.

Example

This example adds an AutoCorrect replacement entry. After this code runs, every instance of "sr" that's typed in a document will automatically be replaced with "Stella Richards."

VBA Copy code Copy code
AutoCorrect.Entries.Add Name:= "sr", Value:= "Stella Richards"

This example deletes the specified AutoCorrect entry it if it exists.

VBA Copy code Copy code
Dim strInput as String
Dim aceLoop as AutoCorrectEntry
Dim blnMatch as Boolean
Dim intConfirm as Integer

blnMatch = False

strInput = InputBox("Enter the AutoCorrect entry to delete.")

For Each aceLoop in AutoCorrect.Entries
 With aceLoop
 If .Name = strInput Then
 blnMatch = True
 intConfirm = _
 MsgBox("Are you sure you want to delete " & _
 .Name, 4)
 If intConfirm = vbYes Then
 .Delete
 End If
 End If
 End With
Next aceLoop

If blnMatch <> True Then
 MsgBox "There was no AutoCorrect entry: " & strInput
End If

See also

Concepts

Application Object

Other resources

Application Object Members


Application.AutoCorrectEmail Property (Word)

 Copy code hover
[image]

Application.AutoCorrectEmail Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an AutoCorrect object that represents automatic corrections made to e-mail messages.

Syntax

expression .AutoCorrectEmail

expression An expression that returns an Application object.

Example

This example adds AutoCorrect entries for e-mail messages. After this code runs, every instance of "allways," "hte," and "hwen" that's typed in an e-mail message will be replaced with "always," "the," and "when," respectively.

VBA Copy code Copy code
Sub AutoCorrectEMailAddress()
 With Application.AutoCorrectEmail
 .Entries.Add Name:="allways", Value:="always"
 .Entries.Add Name:="hte", Value:="the"
 .Entries.Add Name:="hwen", Value:="when"
 End With
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.AutomationSecurity Property (Word)

 Copy code hover
[image]

Application.AutomationSecurity Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets an MsoAutomationSecurity constant that represents the security setting Microsoft Word uses when programmatically opening files. .

Syntax

expression .AutomationSecurity

expression Required. A variable that represents an Application object.

Remarks

The default setting of the AutomationSecurity property is msoAutomationSecurityLow. Therefore, to avoid changing the users security settings or breaking solutions that rely on the default setting, you should be careful to set this property back to its original setting after programmatically opening a file.

Setting ScreenUpdating to False does not affect alerts and will not affect security warnings. The DisplayAlerts setting will not apply to security warnings. For example, if the user sets DisplayAlerts equal to False and AutomationSecurity to msoAutomationSecurityByUI, while the user is on Medium security level, then there will be security warnings while a macro is running. This allows the macro to trap file open errors, while still showing the security warning if the file open succeeds.

Example

This example changes the setting to disable macros, displays the Open dialog box, and then sets the AutomationSecurity property back to its original setting.

VBA Copy code Copy code
Sub Security()
 Dim lngAutomation As MsoAutomationSecurity

 With Application
 lngAutomation = .AutomationSecurity
 .AutomationSecurity = msoAutomationSecurityForceDisable
 With .FileDialog(msoFileDialogOpen)
 .Show
 .Execute
 End With
 .AutomationSecurity = lngAutomation
 End With

End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.BackgroundPrintingStatus Property (Word)

 Copy code hover
[image]

Application.BackgroundPrintingStatus Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the number of print jobs in the background printing queue. Read-only Long.

Syntax

expression .BackgroundPrintingStatus

expression A variable that represents an Application object.

Example

This example returns the number of Word print jobs currently queued up for background printing.

VBA Copy code Copy code
Dim lngStatus As Long

If Options.PrintBackground = True Then
 lngStatus = Application.BackgroundPrintingStatus
End If

If the number of print jobs is greater than 0 (zero), this example displays a message in the status bar.

VBA Copy code Copy code
If Application.BackgroundPrintingStatus > 0 Then
 StatusBar = Application.BackgroundPrintingStatus _
 & " print jobs are queued up"
End If

See also

Concepts

Application Object

Other resources

Application Object Members


Application.BackgroundSavingStatus Property (Word)

 Copy code hover
[image]

Application.BackgroundSavingStatus Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the number of files queued up to be saved in the background. Read-only Long.

Syntax

expression .BackgroundSavingStatus

expression A variable that represents an Application object.

Example

This example displays in the status bar the number of documents currently being saved.

VBA Copy code Copy code
Options.BackgroundSave = True
Documents.Add
ActiveDocument.SaveAs
 While Application.BackgroundSavingStatus <> 0
 StatusBar = "Documents remaining to save: " _
 & Application.BackgroundSavingStatus
 DoEvents
Wend

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Bibliography Property (Word)

 Copy code hover
[image]

Application.Bibliography Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Bibliography object that represents the bibliography references sources stored in Microsoft Word. Read-only.

Syntax

expression .Bibliography

expression An expression that returns an Application object.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.BrowseExtraFileTypes Property (Word)

 Copy code hover
[image]

Application.BrowseExtraFileTypes Property (Word)
See also Send feedback

Published: July 16, 2012

Set this property to "text/html" to allow hyperlinked HTML files to be opened in Microsoft Word (instead of the default Internet browser). Read/write String.

Syntax

expression .BrowseExtraFileTypes

expression A variable that represents an Application object.

Example

This example allows hyperlinked HTML files to be opened in Word (instead of the default Internet browser).

VBA Copy code Copy code
Application.BrowseExtraFileTypes = "text/html"

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Browser Property (Word)

 Copy code hover
[image]

Application.Browser Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Browser object that represents the Select Browse Object tool on the vertical scroll bar. Read-only.

Syntax

expression .Browser

expression A variable that represents an Application object.

Example

This example moves to the next footnote reference mark in the active document.

VBA Copy code Copy code
With Application.Browser
 .Target = wdBrowseFootnote
 .Next
End With

This example moves to the next field in the active document. The text from the initial selection to the next field is formatted as bold.

VBA Copy code Copy code
Selection.ExtendMode = True
With Application.Browser
 .Target = wdBrowseField
 .Next
End With
With Selection
 .Font.Bold = True
 .ExtendMode = False
 .Collapse Direction:=wdCollapseEnd
End With

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Build Property (Word)

 Copy code hover
[image]

Application.Build Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the version and build number of the Word application. Read-only String.

Syntax

expression .Build

expression A variable that represents an Application object.

Example

This example displays the version and build number of Word.

VBA Copy code Copy code
MsgBox Prompt:=Application.Build, _
 Title:="Microsoft Word Version"

See also

Concepts

Application Object

Other resources

Application Object Members


Application.CapsLock Property (Word)

 Copy code hover
[image]

Application.CapsLock Property (Word)
See also Send feedback

Published: July 16, 2012

True if the CAPS LOCK key is turned on. Read-only Boolean.

Syntax

expression .CapsLock

expression A variable that represents an Application object.

Example

This example retrieves the current state of the CAPS LOCK key.

VBA Copy code Copy code
Dim blnCapsLock As Boolean

blnCapsLock
= Application.CapsLock

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Caption Property (Word)

 Copy code hover
[image]

Application.Caption Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the text displayed in the Title bar of the application window. Read/write String.

Syntax

expression .Caption

expression A variable that represents an Application object.

Remarks

To change the caption of the application window to the default text, set this property to an empty string ("").

Example

This example resets the caption of the application window.

VBA Copy code Copy code
Application.Caption = ""

This example changes the caption of the Word application window to include the user name.

VBA Copy code Copy code
Application.Caption = UserName & "'s copy of Word"

See also

Concepts

Application Object

Other resources

Application Object Members


Application.CaptionLabels Property (Word)

 Copy code hover
[image]

Application.CaptionLabels Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a CaptionLabels collection that represents all the available caption labels. Read-only.

Syntax

expression .CaptionLabels

expression A variable that represents an Application object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example sets the numbering style for table captions.

VBA Copy code Copy code
CaptionLabels(wdCaptionTable).NumberStyle = _
 wdCaptionNumberStyleLowercaseRoman

This example adds a new caption label named "Photo" and then inserts a photo caption.

VBA Copy code Copy code
CaptionLabels.Add Name:="Photo"
With Selection
 .InsertParagraphAfter
 .InsertCaption Label:="Photo"
End With

See also

Concepts

Application Object

Other resources

Application Object Members


Application.ChartDataPointTrack Property (Word)

 Copy code hover
[image]

Application.ChartDataPointTrack Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that specifies whether charts use cell-reference data-point tracking. Read-write.

Version information

Version Added: Word 2013

Syntax

expression .ChartDataPointTrack

expression A variable that represents a Application object.

Remarks

In cell-reference data-point tracking, data labels track the cell reference that contains the value of the data point, rather than the index number of the data point. Doing so helps to preserve custom formatting applied by the user, even when a chart is sorted or filtered. Setting ChartDataPointTrack to True specifies that charts use cell-reference data-point tracking.

Property value

BOOL

See also

Concepts

Application Object

Other resources

Application Object Members


Application.CheckLanguage Property (Word)

 Copy code hover
[image]

Application.CheckLanguage Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word automatically detects the language you are using as you type. Read/write Boolean.

Syntax

expression .CheckLanguage

expression An expression that returns an Application object.

Remarks

If you haven't set up Word for multilingual editing, the CheckLanguage property always returns False.

Example

This example checks to see if automatic language detection has been activated.

VBA Copy code Copy code
If Application.CheckLanguage = True Then
 MsgBox "Automatic language detection is activated!"
End If

See also

Concepts

Application Object

Other resources

Application Object Members


Application.COMAddIns Property (Word)

 Copy code hover
[image]

Application.COMAddIns Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a reference to the COMAddIns collection that represents all the Component Object Model (COM) add-ins currently loaded in Microsoft Word.

Syntax

expression .COMAddIns

expression An expression that returns an Application object.

Remarks

COM add-ins are listed in the COM Add-Ins dialog box.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.CommandBars Property (Word)

 Copy code hover
[image]

Application.CommandBars Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a CommandBars collection that represents the menu bar and all the toolbars in Microsoft Word.

Syntax

expression .CommandBars

expression A variable that represents an Application object.

Remarks

Use the CustomizationContext property to set the template or document context prior to accessing the CommandBars collection.

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example enlarges all command bar buttons and enables ToolTips.

VBA Copy code Copy code
With CommandBars
 .LargeButtons = True
 .DisplayTooltips = True
End With

This example displays the Drawing toolbar at the bottom of the application window.

VBA Copy code Copy code
With CommandBars("Drawing")
 .Visible = True
 .Position = msoBarBottom
End With

This example adds the Versions command button to the Standard toolbar.

VBA Copy code Copy code
CustomizationContext = NormalTemplate
CommandBars("Standard").Controls.Add Type:=msoControlButton, _
 ID:=2522, Before:=4

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Creator Property (Word)

 Copy code hover
[image]

Application.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents an Application object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.CustomDictionaries Property (Word)

 Copy code hover
[image]

Application.CustomDictionaries Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Dictionaries object that represents the collection of active custom dictionaries. Read-only.

Syntax

expression .CustomDictionaries

expression A variable that represents an Application object.

Remarks

Active custom dictionaries are marked with a check in the Custom Dictionaries dialog box. For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example adds a new, blank custom dictionary to the collection. The path and file name of the new custom dictionary are then displayed in a message box.

VBA Copy code Copy code
Dim dicHome As Dictionary
Set dicHome = CustomDictionaries.Add(Filename:="Home.dic")
Msgbox dicHome.Path & Application.PathSeparator & dicHome.Name

This example removes all custom dictionaries so that no custom dictionaries are active. The custom dictionary files aren't deleted, though.

VBA Copy code Copy code
CustomDictionaries.ClearAll

This example displays the name of each custom dictionary in the collection.

VBA Copy code Copy code
Dim dicLoop As Dictionary

For Each dicLoop In CustomDictionaries
 MsgBox dicLoop.Name
Next dicLoop

See also

Concepts

Application Object

Other resources

Application Object Members


Application.CustomizationContext Property (Word)

 Copy code hover
[image]

Application.CustomizationContext Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Template or Document object that represents the template or document in which changes to menu bars, toolbars, and key bindings are stored. Read/write.

Syntax

expression .CustomizationContext

expression A variable that represents an Application object.

Remarks

Corresponds to the value of the Save in box on the Commands tab in the Customize dialog box (Tools menu).

Example

This example adds the ALT+CTRL+W key combination to the FileClose command. The keyboard customization is saved in the Normal template.

VBA Copy code Copy code
CustomizationContext = NormalTemplate
KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyControl, _
 wdKeyAlt, wdKeyW), _
 KeyCategory:=wdKeyCategoryCommand, Command:="FileClose"

This example adds the File Versions button to the Standard toolbar. The command bar customization is saved in the template attached to the active document.

VBA Copy code Copy code
CustomizationContext = ActiveDocument.AttachedTemplate
Application.CommandBars("Standard").Controls.Add _
 Type:=msoControlButton, _
 ID:=2522, Before:=8

See also

Concepts

Application Object

Other resources

Application Object Members


Application.DefaultLegalBlackline Property (Word)

 Copy code hover
[image]

Application.DefaultLegalBlackline Property (Word)
See also Send feedback

Published: July 16, 2012

True for Microsoft Word to compare and merge documents using the Legal blackline option in the Compare and Merge Documents dialog box. Read/write Boolean.

Syntax

expression .DefaultLegalBlackline

expression A variable that represents an Application object.

Example

This example enables Word's Legal blackline option for comparing and merging legal documents.

VBA Copy code Copy code
Sub CreateLegalBlackline()
 Application.DefaultLegalBlackline = True
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.DefaultSaveFormat Property (Word)

 Copy code hover
[image]

Application.DefaultSaveFormat Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the default format that will appear in the Save as type box in the Save As dialog box. Read/write String.

Syntax

expression .DefaultSaveFormat

expression An expression that represents a Application object.

Remarks

The string used with this property is the file converter class name. The class names for internal Word formats are listed in the following table.

Word format | File converter class name
Word Document | ""
Document Template | "Dot"
Text Only | "Text"
Text Only with Line Breaks | "CRText"
MS-DOS Text | "8Text"
MS-DOS Text with Line Breaks | "8CRText"
Rich Text Format | "Rtf"
Unicode Text | "Unicode"

Use the ClassName property of the FileConverter object to determine the class name of an external file converter.

Example

This example sets the Word document format as the default save format.

VBA Copy code Copy code
Application.DefaultSaveFormat = ""

This example returns the current setting that Word uses for saving a document.

VBA Copy code Copy code
Msgbox Application.DefaultSaveFormat

See also

Concepts

Application Object

Other resources

Application Object Members


Application.DefaultTableSeparator Property (Word)

 Copy code hover
[image]

Application.DefaultTableSeparator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the single character used to separate text into cells when text is converted to a table. Read/write String.

Syntax

expression .DefaultTableSeparator

expression A variable that represents an Application object.

Remarks

The value of the DefaultTableSeparator property is used if the Separator argument is omitted from the ConvertToTable method or the Range or Selection object.

Example

This example changes the default table separator character.

VBA Copy code Copy code
Application.DefaultTableSeparator = "%"

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Dialogs Property (Word)

 Copy code hover
[image]

Application.Dialogs Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Dialogs collection that represents all the built-in dialog boxes in Word.Read-only.

Syntax

expression .Dialogs

expression A variable that represents an Application object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example displays the built-in Find dialog box, with "Hello" in the Find What box.

VBA Copy code Copy code
Dim dlgFind As Dialog

Set dlgFind = Dialogs(wdDialogEditFind)

With dlgFind
 .Find = "Hello"
 .Show
End With

This example displays the built-in Open dialog box showing all file types.

VBA Copy code Copy code
With Dialogs(wdDialogFileOpen)
 .Name = "*.*"
 .Show
End With

This example prints the active document, using the settings from the Print dialog box.

VBA Copy code Copy code
Dialogs(wdDialogFilePrint).Execute

See also

Concepts

Application Object

Other resources

Application Object Members


Application.DisplayAlerts Property (Word)

 Copy code hover
[image]

Application.DisplayAlerts Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the way certain alerts and messages are handled while a macro is running. Read/write WdAlertLevel.

Syntax

expression .DisplayAlerts

expression Required. A variable that represents an Application object.

Example

This example sets Word to display all alerts and message boxes when it is running macros.

VBA Copy code Copy code
Application.DisplayAlerts = wdAlertsAll

This example returns the current setting of the DisplayAlerts property.

VBA Copy code Copy code
Dim lngTemp As Long

lngTemp = Application.DisplayAlerts

See also

Concepts

Application Object

Other resources

Application Object Members


Application.DisplayAutoCompleteTips Property (Word)

 Copy code hover
[image]

Application.DisplayAutoCompleteTips Property (Word)
See also Send feedback

Published: July 16, 2012

True if Word displays tips that suggest text for completing words, dates, or phrases as you type. Read/write Boolean.

Syntax

expression .DisplayAutoCompleteTips

expression A variable that represents an Application object.

Example

This example sets Word to display tips that suggest text for completing words, dates, or phrases as you type.

VBA Copy code Copy code
Application.DisplayAutoCompleteTips = True

This example returns the status of the Suggest the rest of the word or date with a tip as you type option on the AutoText tab in the AutoCorrect dialog box (Tools menu).

VBA Copy code Copy code
Dim blnTemp As Boolean

blnTemp = Application.DisplayAutoCompleteTips

See also

Concepts

Application Object

Other resources

Application Object Members


Application.DisplayDocumentInformationPanel Property (Word)

 Copy code hover
[image]

Application.DisplayDocumentInformationPanel Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents whether the document properties panel is displayed. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .DisplayDocumentInformationPanel

expression An expression that returns an Application object.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.DisplayRecentFiles Property (Word)

 Copy code hover
[image]

Application.DisplayRecentFiles Property (Word)
See also Send feedback

Published: July 16, 2012

True if the names of recently used files are displayed on the File menu. Read/write Boolean.

Syntax

expression .DisplayRecentFiles

expression A variable that represents an Application object.

Example

This example sets Word to display a maximum of six file names on the File menu.

VBA Copy code Copy code
Application.DisplayRecentFiles = True
RecentFiles.Maximum = 6

This example removes the list of recently used files from the File menu.

VBA Copy code Copy code
Application.DisplayRecentFiles = False

See also

Concepts

Application Object

Other resources

Application Object Members


Application.DisplayScreenTips Property (Word)

 Copy code hover
[image]

Application.DisplayScreenTips Property (Word)
See also Send feedback

Published: July 16, 2012

True if comments, footnotes, endnotes, and hyperlinks are displayed as tips. Text marked as having comments is highlighted. Read/write Boolean.

Syntax

expression .DisplayScreenTips

expression A variable that represents an Application object.

Example

This example enables Word to display comments, footnotes, and endnotes as tips. Also, text marked as having comments is highlighted.

VBA Copy code Copy code
Application.DisplayScreenTips = True

This example returns the current status of the ScreenTips checkbox in the Show area on the View tab in the Options dialog box.

VBA Copy code Copy code
temp = Application.DisplayScreenTips

See also

Concepts

Application Object

Other resources

Application Object Members


Application.DisplayScrollBars Property (Word)

 Copy code hover
[image]

Application.DisplayScrollBars Property (Word)
See also Send feedback

Published: July 16, 2012

True if Word displays a scroll bar in at least one document window. False if there are no scroll bars displayed in any window. Read/write Boolean.

Syntax

expression .DisplayScrollBars

expression A variable that represents an Application object.

Remarks

Setting the DisplayScrollBars property to True displays horizontal and vertical scroll bars in all windows. Setting this property to False turns off all scroll bars in all windows.

Use the DisplayHorizontalScrollBar and DisplayVerticalScrollBar properties to display individual scroll bars in the specified window.

Example

This example displays horizontal and vertical scroll bars in all windows.

VBA Copy code Copy code
Application.DisplayScrollBars = True

This example returns True if there is a scroll bar currently displayed in any window.

VBA Copy code Copy code
Dim blnTemp As Boolean

blnTemp = Application.DisplayScrollBars

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Documents Property (Word)

 Copy code hover
[image]

Application.Documents Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Documents collection that represents all the open documents. Read-only.

Syntax

expression .Documents

expression A variable that represents an Application object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Note Note

A document displayed in a protected view window is not a member of the Documents collection. Instead, use the Document property of the ProtectedViewWindow object to access a document that is displayed in a protected view window.

Example

This example creates a new document based on the Normal template and then displays the Save As dialog box.

VBA Copy code Copy code
Documents.Add.Save

This example saves open documents that have changed since they were last saved.

VBA Copy code Copy code
Dim docLoop As Document

For Each docLoop In Documents
   If docLoop.Saved = False Then docLoop.Save
Next docLoop

This example prints each open document after setting the left and right margins to 0.5 inch.

VBA Copy code Copy code
Dim docLoop As Document

For Each docLoop In Documents
    With docLoop
        .PageSetup.LeftMargin = InchesToPoints(0.5)
        .PageSetup.RightMargin = InchesToPoints(0.5)
        .PrintOut
    End With
Next docLoop

This example opens Doc.doc as a read-only document.

VBA Copy code Copy code
Documents.Open FileName:="C:\Files\Doc.doc", ReadOnly:=True

See also

Concepts

Application Object

Other resources

Application Object Members


Application.DontResetInsertionPointProperties Property (Word)

 Copy code hover
[image]

Application.DontResetInsertionPointProperties Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents whether Microsoft Word maintains the formatting properties of the text at that position of the Insertion Point after running other code. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .DontResetInsertionPointProperties

expression An expression that returns an Application object.

Remarks

In some cases, Word loses the formatting at the Insertion Point after running other Microsoft Visual Basic for Applications (VBA) code. When this happens, it can cause difficulty for users who rely on a screen reader application. They lose the formatting when their assistive application performs what seems like unrelated tasks. This property prevents Word from losing or changing the formatting that has been applied to the text at the position of the Insertion Point when other code runs that contains properties or methods in the Word object model.

Important note Important

Do not use this property unless you specifically need it to make a solution function correctly.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.EmailOptions Property (Word)

 Copy code hover
[image]

Application.EmailOptions Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an EmailOptions object that represents the global preferences for e-mail authoring. Read-only.

Syntax

expression .EmailOptions

expression A variable that represents an Application object.

Example

This example sets Microsoft Word to mark comments in e-mail messages.

VBA Copy code Copy code
Application.EmailOptions.MarkComments = True

See also

Concepts

Application Object

Other resources

Application Object Members


Application.EmailTemplate Property (Word)

 Copy code hover
[image]

Application.EmailTemplate Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a String that represents the document template to use when sending e-mail messages. Read/write.

Syntax

expression .EmailTemplate

expression An expression that returns an Application object.

Remarks

Use the EmailTemplate property when Microsoft Word is specified as your e-mail editor, which you must do inside Microsoft Outlook.

Example

This example instructs Word to use the template named "Email" for all new e-mail messages. This example assumes that you have a template named "Email" and that it is stored in the default template location.

VBA Copy code Copy code
Sub MessageTemplate()
 Application.EmailTemplate = "Email"
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.EnableCancelKey Property (Word)

 Copy code hover
[image]

Application.EnableCancelKey Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the way that Word handles CTRL+BREAK user interruptions. Read/write WdEnableCancelKey.

Syntax

expression .EnableCancelKey

expression Required. A variable that represents an Application object.

Remarks

Use this property very carefully. If you use wdCancelDisabled, there is no way to interrupt a runaway loop or other non - self-terminating code. Also, the EnableCancelKey property is not reset to wdCancelInterrupt when your code stops running; unless you explicitly reset its value, it will remain set to wdCancelDisabled for the duration of the Word session.

Example

This example disables CTRL+BREAK from interrupting a counter loop.

VBA Copy code Copy code
Dim intWait As Integer

Application.EnableCancelKey = wdCancelDisabled
For intWait = 1 To 10000
 StatusBar = intWait
Next intWait
Application.EnableCancelKey = wdCancelInterrupt

See also

Concepts

Application Object

Other resources

Application Object Members


Application.FeatureInstall Property (Word)

 Copy code hover
[image]

Application.FeatureInstall Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets how Microsoft Word handles calls to methods and properties that require features not yet installed. Read/write MsoFeatureInstall.

Syntax

expression .FeatureInstall

expression Required. A variable that represents an Application object.

Remarks

You can use the msoFeatureInstallOnDemandWithUI constant to prevent users from believing that the application isn't responding while a feature is being installed. Use the msoFeatureInstallNone constant if you want the developer to be the only one who can install features.

If you have the DisplayAlerts property set to False, users will not be prompted to install new features even if the FeatureInstall property is set to msoFeatureInstallOnDemand. If the DisplayAlerts property is set to True, an installation progress meter will appear if the FeatureInstall property is set to msoFeatureInstallOnDemand.

Example

This example activates a new instance of Microsoft Excel and checks the value of the FeatureInstall property. If the property is set to msoFeatureInstallNone, the code displays a message box that asks the user whether they want to change the property setting. If the user responds "Yes," the property is set to msoFeatureInstallOnDemand.

Note Note

For this example to function properly, you must add a reference to Microsoft Excel Object Library.

VBA Copy code Copy code
Dim ExcelApp As New Excel.Application
Dim intReply As Integer

With ExcelApp
 If .FeatureInstall = msoFeatureInstallNone Then
 intReply = MsgBox("Uninstalled features for " _
 & "this application may " & vbCrLf _
 & "cause a run-time error when called." _
 & vbCrLf & vbCrLf _
 & "Would you like to change this setting" & vbCrLf _
 & "to automatically install missing features?", _
 vbYesNo, "Feature Install Setting")
 If intReply = vbYes Then
 .FeatureInstall = msoFeatureInstallOnDemand
 End If
 End If
End With

See also

Concepts

Application Object

Other resources

Application Object Members


Application.FileConverters Property (Word)

 Copy code hover
[image]

Application.FileConverters Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a FileConverters collection that represents all the file converters available to Microsoft Word. Read-only.

Syntax

expression .FileConverters

expression A variable that represents an Application object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example displays the path of the WordPerfect 5.0 file converter.

VBA Copy code Copy code
MsgBox FileConverters("WrdPrfctDOS50").Path

This example displays a message that indicates whether the third converter in the FileConverters collection can save files.

VBA Copy code Copy code
If FileConverters(3).CanSave = True Then
 MsgBox FileConverters(3).FormatName & " can save files"
Else
 MsgBox FileConverters(3).FormatName & " cannot save files"
End If

This example displays the name of the last file converter.

VBA Copy code Copy code
Dim fcTemp As FileConverter

Set fcTemp = FileConverters(FileConverters.Count)
MsgBox "The file name extensions for " & fcTemp.FormatName & _
 " files are: " & fcTemp.Extensions

See also

Concepts

Application Object

Other resources

Application Object Members


Application.FileDialog Property (Word)

 Copy code hover
[image]

Application.FileDialog Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a FileDialog object which represents a single instance of a file dialog box.

Syntax

expression .FileDialog(FileDialogType)

expression Required. A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
FileDialogType | Required | MsoFileDialogType | The type of dialog.

Example

This example displays the Save As dialog box.

VBA Copy code Copy code
Sub ShowSaveAsDialog()
 Dim dlgSaveAs As FileDialog
 Set dlgSaveAs = Application.FileDialog( _
 FileDialogType:=msoFileDialogSaveAs)
 dlgSaveAs.Show
End Sub

This example displays the Open dialog box and allows a user to select multiple files to open.

VBA Copy code Copy code
Sub ShowFileDialog()
 Dim dlgOpen As FileDialog
 Set dlgOpen = Application.FileDialog( _
 FileDialogType:=msoFileDialogOpen)
 With dlgOpen
 .AllowMultiSelect = True
 .Show
 End With
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.FileValidation Property (Word)

 Copy code hover
[image]

Application.FileValidation Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets how Word will validate files before opening them. Read/write MsoFileValidationMode.

Version Information

Version Added: Word 2010

Syntax

expression .FileValidation

expression A variable that represents an Application object.

Return Value

MsoFileValidationMode

Remarks

Files that do not pass validation will be opened in a Protected View window. The FileValidation property is per session only. If you set the FileValidation property, that setting will remain in effect for the entire session the application is open.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.FindKey Property (Word)

 Copy code hover
[image]

Application.FindKey Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a KeyBinding object that represents the specified key combination. Read-only.

Syntax

expression .FindKey(KeyCode, KeyCode2)

expression Optional. An expression that returns an Application object.

Parameters

Name | Required/Optional | Data Type | Description
KeyCode | Required | Long | A key you specify by using one of the WdKey constants.
KeyCode2 | Optional | Variant | A second key you specify by using one of the WdKey constants.

Remarks

You can use the BuildKeyCode method to create the KeyCode or KeyCode2 argument.

Example

This example disables the ALT+SHIFT+F12 key combination in the template attached to the active document. To return a KeyBinding object that includes more than two keys, use the BuildKeyCode method, as shown in the example.

VBA Copy code Copy code
CustomizationContext = ActiveDocument.AttachedTemplate
FindKey(KeyCode:=BuildKeyCode(wdKeyAlt, wdKeyShift, _
 wdKeyF12)).Disable

This example displays the command assigned to the F1 key.

VBA Copy code Copy code
CustomizationContext = NormalTemplate
MsgBox FindKey(KeyCode:=wdKeyF1).Command

See also

Concepts

Application Object

Other resources

Application Object Members


Application.FocusInMailHeader Property (Word)

 Copy code hover
[image]

Application.FocusInMailHeader Property (Word)
See also Send feedback

Published: July 16, 2012

True if the insertion point is in an e-mail header field (the To: field, for example). Read-only Boolean.

Syntax

expression .FocusInMailHeader

expression A variable that represents an Application object.

Example

This example displays a message in the status bar if the insertion point is in an e-mail header field.

VBA Copy code Copy code
If Application.FocusInMailHeader = True Then
 StatusBar = "Selection is in message header"
End If

See also

Concepts

Application Object

Other resources

Application Object Members


Application.FontNames Property (Word)

 Copy code hover
[image]

Application.FontNames Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a FontNames object that includes the names of all the available fonts. Read-only.

Syntax

expression .FontNames

expression A variable that represents an Application object.

Example

This example displays the font names in the FontNames collection.

VBA Copy code Copy code
Dim strFont As String
Dim intResponse As Integer

For Each strFont In FontNames
 intResponse = MsgBox(Prompt:=strFont, Buttons:=vbOKCancel)
 If intResponse = vbCancel Then Exit For
Next strFont

See also

Concepts

Application Object

Other resources

Application Object Members


Application.HangulHanjaDictionaries Property (Word)

 Copy code hover
[image]

Application.HangulHanjaDictionaries Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a HangulHanjaConversionDictionaries collection that represents all the active custom conversion dictionaries.

Syntax

expression .HangulHanjaDictionaries

expression A variable that represents an Application object.

Remarks

Active custom conversion dictionaries are marked with a check in the Custom Dictionaries dialog box. Click Options, click the Spelling & Grammar tab, and then click the Custom Dictionaries button.

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example adds a new, blank custom dictionary to the collection. The path and file name of the new custom dictionary are then displayed in a message box.

VBA Copy code Copy code
Set myHome = _
 HangulHanjaDictionaries.Add(Filename:="Home.hhd")
Msgbox myHome.Path & Application.PathSeparator _
 & myHome.Name

This example deactivates all custom dictionaries but does not delete the custom dictionary files.

VBA Copy code Copy code
HangulHanjaDictionaries.ClearAll

This example displays the name of each custom dictionary in the collection.

VBA Copy code Copy code
For Each di In HangulHanjaDictionaries
 MsgBox di.Name
Next di

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Height Property (Word)

 Copy code hover
[image]

Application.Height Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the height of the active document window. Read/write Long.

Syntax

expression .Height

expression A variable that represents an Application object.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.International Property (Word)

 Copy code hover
[image]

Application.International Property (Word)
See also Send feedback

Published: July 16, 2012

Returns information about the current country/region and international settings. Read-only Variant.

Syntax

expression .International(Index)

expression Required. A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | WdInternationalIndex | The current country/region and/or international setting.

Example

This example displays the currency format in the status bar.

VBA Copy code Copy code
StatusBar = "Currency Format: " _
 & Application.International(wdCurrencyCode)

See also

Concepts

Application Object

Other resources

Application Object Members


Application.IsObjectValid Property (Word)

 Copy code hover
[image]

Application.IsObjectValid Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified variable that references an object is valid. Read-only Boolean.

Syntax

expression .IsObjectValid(Object)

expression Optional. A variable that represents an Application object.

Remarks

The IsObjectValid property returns False if the object referenced by the variable has been deleted.

Example

This example adds a table to the active document and assigns it to the variable aTable. The example then deletes the first table from the document. If the table that aTable refers to was not the first table in the document (that is, if aTable is still a valid object), the example also removes any borders from that table.

VBA Copy code Copy code
Dim aTable As Table

Set aTable = ActiveDocument.Tables.Add(Range:=Selection.Range, _
 NumRows:=2, NumColumns:=3)

ActiveDocument.Tables(1).Delete
If IsObjectValid(aTable) = True Then _
 aTable.Borders.Enable = False

See also

Concepts

Application Object

Other resources

Application Object Members


Application.IsSandboxed Property (Word)

 Copy code hover
[image]

Application.IsSandboxed Property (Word)
See also Send feedback

Published: July 16, 2012

True if the application window is a protected view window. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .IsSandboxed

expression An expression that returns a Application object.

Remarks

Use the IsSandboxed property to determine if a document is open within a protected view window.

Example

The following code example displays whether the specified document is open in a protected view window.

VBA Copy code Copy code
Sub CheckIfSandboxed(doc As Document)
 MsgBox doc.Application.IsSandboxed
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.KeyBindings Property (Word)

 Copy code hover
[image]

Application.KeyBindings Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a KeyBindings collection that represents customized key assignments, which include a key code, a key category, and a command.

Syntax

expression .KeyBindings

expression A variable that represents an Application object.

Example

This example assigns the CTRL+ALT+W key combination to the FileClose command. This keyboard customization is saved in the Normal template.

VBA Copy code Copy code
CustomizationContext = NormalTemplate
KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyControl, wdKeyAlt, _
 wdKeyW), KeyCategory:=wdKeyCategoryCommand, _
 Command:="FileClose"

This example inserts the command name and key combination string for each item in the KeyBindings collection.

VBA Copy code Copy code
Dim kbLoop As KeyBinding

CustomizationContext = NormalTemplate
For Each kbLoop In KeyBindings
 Selection.InsertAfter kbLoop.Command & vbTab _
 & kbLoop.KeyString & vbCr
 Selection.Collapse Direction:=wdCollapseEnd
Next kbLoop

See also

Concepts

Application Object

Other resources

Application Object Members


Application.KeysBoundTo Property (Word)

 Copy code hover
[image]

Application.KeysBoundTo Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a KeysBoundTo object that represents all the key combinations assigned to the specified item.

Syntax

expression .KeysBoundTo(KeyCategory, Command, CommandParameter)

expression A variable that represents an Application object. Optional.

Parameters

Name | Required/Optional | Data Type | Description
KeyCategory | Required | WdKeyCategory | The category of the key combination.
Command | Required | String | The name of the command.
CommandParameter | Optional | Variant | Additional text, if any, required for the command specified by Command. For more information, see the "Remarks" section in the Add method for the KeyBindings object.

Example

This example displays all the key combinations assigned to the FileOpen command in the template attached to the active document.

VBA Copy code Copy code
Dim kbLoop As KeyBinding
Dim strOutput As String

CustomizationContext = ActiveDocument.AttachedTemplate

For Each kbLoop In _
 KeysBoundTo(KeyCategory:=wdKeyCategoryCommand, _
 Command:="FileOpen")
 strOutput = strOutput & kbLoop.KeyString & vbCr
Next kbLoop

MsgBox strOutput

This example removes all key assignments from Macro1 in the Normal template.

VBA Copy code Copy code
Dim aKey As KeyBinding

CustomizationContext = NormalTemplate
For Each aKey In _
 KeysBoundTo(KeyCategory:=wdKeyCategoryMacro, _
 Command:="Macro1")
 aKey.Disable
Next aKey

See also

Concepts

Application Object

Other resources

Application Object Members


Application.LandscapeFontNames Property (Word)

 Copy code hover
[image]

Application.LandscapeFontNames Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a FontNames object that includes the names of all the available landscape fonts.

Syntax

expression .LandscapeFontNames

expression A variable that represents an Application object.

Example

This example creates a sorted list in a new document of the landscape font names in the FontNames object.

VBA Copy code Copy code
Sub ListLandscapeFonts()
 Dim docNew As Document
 Dim intCount As Integer

 Set docNew = Documents.Add
 docNew.Content.InsertAfter "Landscape Fonts" & vbLf

 For intCount = 1 To LandscapeFontNames.Count
 docNew.Content.InsertAfter LandscapeFontNames(intCount) _
 & vbLf
 Next

 With docNew
 .Range(Start:=.Paragraphs(2).Range.Start, End:=.Paragraphs _
 (docNew.Paragraphs.Count).Range.End).Select
 End With

 Selection.Sort
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Language Property (Word)

 Copy code hover
[image]

Application.Language Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an MsoLanguageID constant that represents the language selected for the Microsoft Word user interface.

Syntax

expression .Language

expression Required. A variable that represents an Application object.

Remarks

The value of this property is the same as the value returned by the following expression:

VBA Copy code Copy code
Application.LanguageSettings _
 .LanguageID(msoLanguageIDUI)

Example

This example displays a message stating whether the language selected for the Microsoft Word user interface is U.S. English.

VBA Copy code Copy code
Sub LangSetting()
 If Application.Language = msoLanguageIDEnglishUS Then
 MsgBox "The user interface language is U.S. English."
 Else
 MsgBox "The user interface language is not U.S. English."
 End If
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Languages Property (Word)

 Copy code hover
[image]

Application.Languages Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Languages collection that represents the proofing languages listed in the Language dialog box.

Syntax

expression .Languages

expression A variable that represents an Application object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example returns the full path and file name of the active spelling dictionary.

VBA Copy code Copy code
Dim dicSpell As Dictionary

Set dicSpell = _
 Languages(Selection.LanguageID).ActiveSpellingDictionary

MsgBox dicSpell.Path & Application.PathSeparator & dicSpell.Name

This example uses the aLang() array to store the proofing language names.

VBA Copy code Copy code
Dim intCount As Integer
Dim langLoop As Language
Dim aLang(Languages.Count - 1) As String

intCount = 0
For Each langLoop In Languages
 aLang(intCount) = langLoop.NameLocal
 intCount = intCount + 1
Next langLoop

See also

Concepts

Application Object

Other resources

Application Object Members


Application.LanguageSettings Property (Word)

 Copy code hover
[image]

Application.LanguageSettings Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a LanguageSettings object, which contains information about the language settings in Microsoft Word.

Syntax

expression .LanguageSettings

expression A variable that represents an Application object.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Left Property (Word)

 Copy code hover
[image]

Application.Left Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Long that represents the horizontal position of the active document, measured in points. Read/write.

Syntax

expression .Left

expression Required. A variable that represents an Application object.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.ListGalleries Property (Word)

 Copy code hover
[image]

Application.ListGalleries Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a ListGalleries collection that represents the three list template galleries. .

Syntax

expression .ListGalleries

expression A variable that represents an Application object.

Remarks

Each template gallery (Bulleted, Numbered, and Outline Numbered) corresponds to a tab in the Bullets and Numbering dialog box (Format menu). For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example sets the variable mylsttmp to the second list template on the Outline Numbered tab in the Bullets and Numbering dialog box. The example then applies that template to the first list in the active document.

VBA Copy code Copy code
Set mylsttmp = _
 ListGalleries(wdOutlineNumberGallery).ListTemplates(2)
ActiveDocument.Lists(1).ApplyListTemplate ListTemplate:=mylsttmp

This example cycles through the ListGalleries collection and changes the templates in each list template gallery back to the built-in template.

VBA Copy code Copy code
For Each listgal In ListGalleries
 For i = 1 To 7
 listgal.Reset(i)
 Next i
Next listgal

See also

Concepts

Application Object

Other resources

Application Object Members


Application.MacroContainer Property (Word)

 Copy code hover
[image]

Application.MacroContainer Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Template or Document object that represents the template or document in which the module that contains the running procedure is stored.

Syntax

expression .MacroContainer

expression A variable that represents an Application object.

Example

This example displays the name of the document or template in which the running procedure is stored.

VBA Copy code Copy code
Set cntnr = MacroContainer
MsgBox cntnr.Name

See also

Concepts

Application Object

Other resources

Application Object Members


Application.MailingLabel Property (Word)

 Copy code hover
[image]

Application.MailingLabel Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a MailingLabel object that represents a mailing label.

Syntax

expression .MailingLabel

expression An expression that returns an Application object.

Example

This example creates a new Avery 2160 mini-label document for a specified address.

VBA Copy code Copy code
addr = "Dave Edson" & vbCr & "123 Skye St." _
 & vbCr & "Our Town, WA 98004"
Application.MailingLabel.CreateNewDocument _
 Name:="2160 mini", Address:=addr, ExtractAddress:=False

See also

Concepts

Application Object

Other resources

Application Object Members


Application.MailMessage Property (Word)

 Copy code hover
[image]

Application.MailMessage Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a MailMessage object that represents the active e-mail message.

Syntax

expression .MailMessage

expression An expression that returns an Application object.

Example

This example displays the Select Names dialog box for the active e-mail message.

VBA Copy code Copy code
Application.MailMessage.DisplaySelectNamesDialog

See also

Concepts

Application Object

Other resources

Application Object Members


Application.MailSystem Property (Word)

 Copy code hover
[image]

Application.MailSystem Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the mail system (or systems) installed on the host computer. Read-only WdMailSystem.

Syntax

expression .MailSystem

expression Required. A variable that represents an Application object.

Remarks

Some of the WdMailSystem constants are available only in Microsoft Office Macintosh Edition. For additional information about these constants, consult the language reference Help included with Microsoft Office Macintosh Edition.

Example

This example displays a message that indicates whether a mail system is installed on the computer.

VBA Copy code Copy code
ms = Application.MailSystem
If ms <> wdNoMailSystem Then
 MsgBox "This computer has a mail system installed."
Else
 MsgBox "This computer has no mail system installed."
End If

See also

Concepts

Application Object

Other resources

Application Object Members


Application.MAPIAvailable Property (Word)

 Copy code hover
[image]

Application.MAPIAvailable Property (Word)
See also Send feedback

Published: July 16, 2012

True if MAPI is installed. Read-only Boolean.

Syntax

expression .MAPIAvailable

expression An expression that returns an Application object.

Example

This example displays a message if MAPI is installed.

VBA Copy code Copy code
If Application.MAPIAvailable = True Then
 MsgBox "MAPI is available"
End If

See also

Concepts

Application Object

Other resources

Application Object Members


Application.MathCoprocessorAvailable Property (Word)

 Copy code hover
[image]

Application.MathCoprocessorAvailable Property (Word)
See also Send feedback

Published: July 16, 2012

True if a math coprocessor is installed and available to Microsoft Word. Read-only Boolean.

Syntax

expression .MathCoprocessorAvailable

expression An expression that returns an Application object.

Example

This example displays a message indicating whether a math coprocessor is installed and available to Word.

VBA Copy code Copy code
If Application.MathCoprocessorAvailable = True Then
 MsgBox "A math coprocessor is available."
Else
 MsgBox "A math coprocessor is not installed."
End If

See also

Concepts

Application Object

Other resources

Application Object Members


Application.MouseAvailable Property (Word)

 Copy code hover
[image]

Application.MouseAvailable Property (Word)
See also Send feedback

Published: July 16, 2012

True if there is a mouse available for the system. Read-only Boolean.

Syntax

expression .MouseAvailable

expression An expression that returns an Application object.

Example

This example displays a message that no mouse is available.

VBA Copy code Copy code
If Application.MouseAvailable = False Then
 Msgbox "Make sure your mouse is plugged in."
Else
 Msgbox "Mouse is available"
End If

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Name Property (Word)

 Copy code hover
[image]

Application.Name Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the name of the specified object. Read-only String.

Syntax

expression .Name

expression Required. A variable that represents an Application object.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.NewDocument Property (Word)

 Copy code hover
[image]

Application.NewDocument Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a NewFile object that represents a document listed on the New tab.

Syntax

expression .NewDocument

expression A variable that represents an Application object.

Example

This example creates a document list item on the New Document task pane in the New From Existing File section.

VBA Copy code Copy code
Sub CreateNewDocument()
 Application.NewDocument.Add FileName:="C:\NewFile.doc", _
 Section:=msoNewfromExistingFile, DisplayName:="New File", _
 Action:=msoCreateNewFile
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.NormalTemplate Property (Word)

 Copy code hover
[image]

Application.NormalTemplate Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Template object that represents the Normal template.

Syntax

expression .NormalTemplate

expression A variable that represents an Application object.

Example

This example inserts the AutoText entry named "Test" from the Normal template, if this entry is contained in the AutoTextEntries collection.

VBA Copy code Copy code
For Each entry In NormalTemplate.AutoTextEntries
 If entry.Name = "Test" Then entry.Insert Where:=Selection.Range
Next entry

This example saves the Normal template if changes have been made to it.

VBA Copy code Copy code
If NormalTemplate.Saved = False Then NormalTemplate.Save

See also

Concepts

Application Object

Other resources

Application Object Members


Application.NumLock Property (Word)

 Copy code hover
[image]

Application.NumLock Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the state of the NUM LOCK key. True if the keys on the numeric keypad insert numbers, False if the keys move the insertion point. Read-only Boolean.

Syntax

expression .NumLock

expression An expression that returns an Application object.

Example

This example returns the current state of the NUM LOCK key.

VBA Copy code Copy code
theState = Application.NumLock

See also

Concepts

Application Object

Other resources

Application Object Members


Application.OMathAutoCorrect Property (Word)

 Copy code hover
[image]

Application.OMathAutoCorrect Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMathAutoCorrect object that represents the auto correct entries for equations. Read-only.

Syntax

expression .OMathAutoCorrect

expression An expression that returns an Application object.

Return Value

OMathAutoCorrect

See also

Concepts

Application Object

Other resources

Application Object Members


Application.OpenAttachmentsInFullScreen Property (Word)

 Copy code hover
[image]

Application.OpenAttachmentsInFullScreen Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents whether Microsoft Word opens e-mail attachments in Reading mode. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .OpenAttachmentsInFullScreen

expression An expression that returns an Application object.

Remarks

This property corresponds to the Open e-mail attachments in Reading mode check box in the Word Options dialog box.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Options Property (Word)

 Copy code hover
[image]

Application.Options Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Options object that represents application settings in Microsoft Word.

Syntax

expression .Options

expression A variable that represents an Application object.

Example

This example disables fast saves and then saves the active document.

VBA Copy code Copy code
Options.AllowFastSave = False
ActiveDocument.Save

This example prints Sales.doc with comments and field results.

VBA Copy code Copy code
With Options
 .PrintFieldCodes = False
 .PrintComments = True
End With
Documents("Sales.doc").PrintOut

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Parent Property (Word)

 Copy code hover
[image]

Application.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Application object.

Syntax

expression .Parent

expression A variable that represents an Application object.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Path Property (Word)

 Copy code hover
[image]

Application.Path Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the disk or Web path to the specified object. Read-only String.

Syntax

expression .Path

expression A variable that represents an Application object.

Remarks

The path doesn't include a trailing character — for example, "C:\MSOffice" or "http://MyServer". Use the PathSeparator property to add the character that separates folders and drive letters. Use the Name property of the Document object to return the file name without the path and use the FullName property to return the file name and the path together.

Note Note

You can use the PathSeparator property to build Web addresses even though they contain forward slashes (/) and the PathSeparator property defaults to a backslash (\).

Example

This example displays the path and file name of the active document.

VBA Copy code Copy code
MsgBox ActiveDocument.Path & Application.PathSeparator & _
 ActiveDocument.Name

This example changes the current folder to the path of the template attached to the active document.

VBA Copy code Copy code
ChDir ActiveDocument.AttachedTemplate.Path

This example displays the path of the first add-in in the AddIns collection.

VBA Copy code Copy code
If AddIns.Count >= 1 Then MsgBox AddIns(1).Path

See also

Concepts

Application Object

Other resources

Application Object Members


Application.PathSeparator Property (Word)

 Copy code hover
[image]

Application.PathSeparator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the character used to separate folder names. This property returns a backslash (\). Read-only String.

Syntax

expression .PathSeparator

expression An expression that returns an Application object.

Remarks

You can use PathSeparator property to build Web addresses even though they contain forward slashes (/).

Note Note

The FullName property returns the path and file name, including the path separator, as a single string.

Example

This example displays the path and file name of the active document.

VBA Copy code Copy code
MsgBox ActiveDocument.Path & Application.PathSeparator & _
 ActiveDocument.Name

If the first add-in is a template, this example unloads the template and opens it.

VBA Copy code Copy code
If Addins(1).Compiled = False Then
 Addins(1).Installed = False
 Documents.Open FileName:=AddIns(1).Path _
 & Application.PathSeparator _
 & AddIns(1).Name
End If

See also

Concepts

Application Object

Other resources

Application Object Members


Application.PickerDialog Property (Word)

 Copy code hover
[image]

Application.PickerDialog Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a PickerDialog object that provides the functionality to select people or data in a dialog box. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .PickerDialog

expression An expression that returns a Application object.

Remarks

The PickerDialog object is available in the Microsoft Office type library. For more information, see the following objects and their members:

  • PickerDialog

  • PickerField

  • PickerFields

  • PickerProperties

  • PickerProperty

  • PickerResult

  • PickerResults

See also

Concepts

Application Object

Other resources

Application Object Members


Application.PortraitFontNames Property (Word)

 Copy code hover
[image]

Application.PortraitFontNames Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a FontNames object that includes the names of all the available portrait fonts.

Syntax

expression .PortraitFontNames

expression A variable that represents an Application object.

Example

This example inserts a list of portrait fonts at the insertion point.

VBA Copy code Copy code
For Each aFont In PortraitFontNames
 With Selection
 .Collapse Direction:=wdCollapseEnd
 .InsertAfter aFont
 .InsertParagraphAfter
 .Collapse Direction:=wdCollapseEnd
 End With
Next aFont

See also

Concepts

Application Object

Other resources

Application Object Members


Application.PrintPreview Property (Word)

 Copy code hover
[image]

Application.PrintPreview Property (Word)
See also Send feedback

Published: July 16, 2012

True if print preview is the current view. Read/write Boolean.

Syntax

expression .PrintPreview

expression A variable that represents an Application object.

Example

This example switches the view to print preview.

VBA Copy code Copy code
PrintPreview = True

This example switches the active window from print preview to normal view.

VBA Copy code Copy code
PrintPreview = False
ActiveDocument.ActiveWindow.View.Type = wdNormalView

See also

Concepts

Application Object

Other resources

Application Object Members


Application.ProtectedViewWindows Property (Word)

 Copy code hover
[image]

Application.ProtectedViewWindows Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a ProtectedViewWindows collection that represents all protected view windows. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .ProtectedViewWindows

expression An expression that returns an Application object.

Example

The following code example displays the number of protected view windows that are open.

VBA Copy code Copy code
MsgBox "There are " & ProtectedViewWindows.Count & _
 " protected view windows open."

See also

Concepts

Application Object

Other resources

Application Object Members


Application.RecentFiles Property (Word)

 Copy code hover
[image]

Application.RecentFiles Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a RecentFiles collection that represents the most recently accessed files.

Syntax

expression .RecentFiles

expression A variable that represents an Application object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example opens the first item in the RecentFiles collection (the first document name listed on the File menu).

VBA Copy code Copy code
If RecentFiles.Count >= 1 Then RecentFiles(1).Open

This example displays the name of each file in the RecentFiles collection.

VBA Copy code Copy code
For Each rFile In RecentFiles
 MsgBox rFile.Name
Next rFile

See also

Concepts

Application Object

Other resources

Application Object Members


Application.RestrictLinkedStyles Property (Word)

 Copy code hover
[image]

Application.RestrictLinkedStyles Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents whether Microsoft Word allows linked styles. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .RestrictLinkedStyles

expression An expression that returns an Application object.

Remarks

Linked styles are styles that can be applied either as character styles or as paragraph styles. This property corresponds to the Disable Linked Styles check box in the Styles dialog box.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.ScreenUpdating Property (Word)

 Copy code hover
[image]

Application.ScreenUpdating Property (Word)
See also Send feedback

Published: July 16, 2012

True if screen updating is turned on. Read/write Boolean.

Syntax

expression .ScreenUpdating

expression An expression that returns an Application object.

Remarks

The ScreenUpdating property controls most display changes on the monitor while a procedure is running. When screen updating is turned off, toolbars remain visible and Word still allows the procedure to display or retrieve information using status bar prompts, input boxes, dialog boxes, and message boxes. You can increase the speed of some procedures by keeping screen updating turned off. You must set the ScreenUpdating property to True when the procedure finishes or when it stops after an error.

Example

This example turns off screen updating and then adds a new document. Five hundred lines of text are added to the document. At every fiftieth line, the macro selects the line and refreshes the screen.

VBA Copy code Copy code
Application.ScreenUpdating = False
Documents.Add
For x = 1 To 500
 With ActiveDocument.Content
 .InsertAfter "This is line " & x & "."
 .InsertParagraphAfter
 End With
If x Mod 50 = 0 Then
 ActiveDocument.Paragraphs(x).Range.Select
 Application.ScreenRefresh
End If
Next x
Application.ScreenUpdating = True

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Selection Property (Word)

 Copy code hover
[image]

Application.Selection Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the Selection object that represents a selected range or the insertion point. Read-only.

Syntax

expression .Selection

expression A variable that represents an Application object.

Example

This example displays the selected text.

VBA Copy code Copy code
If Selection.Type = wdSelectionNormal Then MsgBox Selection.Text

This example applies the Arial font and bold formatting to the selection.

VBA Copy code Copy code
With Selection.Font
 .Bold = True
 .Italic = False
 .Name = "Arial"
End With

If the insertion point isn't located in a table, the selection is moved to the next table.

VBA Copy code Copy code
If Selection.Information(wdWithInTable) = False Then
 Selection.GoToNext What:=wdGoToTable
End If

See also

Concepts

Application Object

Other resources

Application Object Members


Application.ShowAnimation Property (Word)

 Copy code hover
[image]

Application.ShowAnimation Property (Word)
Send feedback

This object or member is deprecated and is not intended to be used in your code.

Property value

BOOL


Application.ShowStartupDialog Property (Word)

 Copy code hover
[image]

Application.ShowStartupDialog Property (Word)
See also Send feedback

Published: July 16, 2012

True to display the Task Pane when starting Microsoft Word. Read/write Boolean.

Syntax

expression .ShowStartupDialog

expression A variable that represents an Application object.

Remarks

The ShowStartupDialog property is a global option, and the new setting will take effect only after you restart Word. Use the Visible property of the CommandBars collection show or hide the Task Pane without restarting Word.

Example

This example turns off the Task Pane, so it won't display upon starting Word. This will not take effect until the next time the user starts Word.

VBA Copy code Copy code
Sub HideStartUpDlg()
 Application.ShowStartupDialog = False
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.ShowStylePreviews Property (Word)

 Copy code hover
[image]

Application.ShowStylePreviews Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents whether Microsoft Word shows a preview of the formatting for styles in the Styles dialog box. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .ShowStylePreviews

expression An expression that returns an Application object.

Remarks

This property corresponds to the Show Preview check box in the Styles dialog box.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.ShowVisualBasicEditor Property (Word)

 Copy code hover
[image]

Application.ShowVisualBasicEditor Property (Word)
See also Send feedback

Published: July 16, 2012

True if the Visual Basic Editor window is visible. Read/write Boolean.

Syntax

expression .ShowVisualBasicEditor

expression A variable that represents an Application object.

Example

This example makes the Visual Basic Editor window visible.

VBA Copy code Copy code
Application.ShowVisualBasicEditor = True

See also

Concepts

Application Object

Other resources

Application Object Members


Application.SmartArtColors Property (Word)

 Copy code hover
[image]

Application.SmartArtColors Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a SmartArtColors object that represents the set of color styles that are currently loaded in the application. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .SmartArtColors

expression An expression that returns a Application object.

Remarks

The set of colors represented by the SmartArtColors property correspond to the available color styles on the Change Colors button on the Design tab on the SmartArt Tools contextual tab in Word 2010.

Example

The following code example adds a SmartArt graphic to the active document and then sets the SmartArt graphic color to "Dark 2 Outline".

VBA Copy code Copy code
Dim myShape As Shape
Dim mySmartArt As SmartArt

Set myShape = ActiveDocument.Shapes.AddSmartArt(Application.SmartArtLayouts(1), 50, 50, 200, 200)
Set mySmartArt = myShape.SmartArt

mySmartArt.Color = Application.SmartArtColors(2)

See also

Concepts

Application Object

Other resources

Application Object Members


Application.SmartArtLayouts Property (Word)

 Copy code hover
[image]

Application.SmartArtLayouts Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a SmartArtLayouts object that represents the set of SmartArt layouts that are currently loaded in the application. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .SmartArtLayouts

expression An expression that returns a Application object.

Remarks

The set of layouts represented by the SmartArtLayouts property correspond to the available layouts in the Layouts group on the Design tab on the SmartArt Tools contextual tab in Word 2010.

Example

The following code example adds a SmartArt graphic to the active document and then sets the SmartArt graphic layout to "Grouped List".

VBA Copy code Copy code
Dim myShape As Shape
Dim mySmartArt As SmartArt

Set myShape = ActiveDocument.Shapes.AddSmartArt(Application.SmartArtLayouts(1), 50, 50, 200, 200)
Set mySmartArt = myShape.SmartArt

mySmartArt.Layout = Application.SmartArtLayouts(15)

See also

Concepts

Application Object

Other resources

Application Object Members


Application.SmartArtQuickStyles Property (Word)

 Copy code hover
[image]

Application.SmartArtQuickStyles Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a SmartArtQuickStyles object that represents the set of SmartArt styles that are currently loaded in the application. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .SmartArtQuickStyles

expression An expression that returns a Application object.

Remarks

The set of styles represented by the SmartArtQuickStyles property correspond to the available styles in the Styles group on the Design tab on the SmartArt Tools contextual tab in Word 2010.

Example

The following code example adds a SmartArt graphic to the active document and then sets the SmartArt graphic style to "Polished".

VBA Copy code Copy code
Dim myShape As Shape
Dim mySmartArt As SmartArt

Set myShape = ActiveDocument.Shapes.AddSmartArt(Application.SmartArtLayouts(1), 50, 50, 200, 200)
Set mySmartArt = myShape.SmartArt

mySmartArt.QuickStyle = Application.SmartArtQuickStyles.Item(6)

See also

Concepts

Application Object

Other resources

Application Object Members


Application.SpecialMode Property (Word)

 Copy code hover
[image]

Application.SpecialMode Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word is in a special mode (for example, CopyText mode, or MoveText mode). Read-only Boolean.

Syntax

expression .SpecialMode

expression An expression that returns an Application object.

Remarks

Word enters a special copy or move mode if you press F2 or SHIFT+F2 while text is selected.

Example

This example checks to see whether Word is in a special mode. If it is, ESC is activated before the current selection is deleted and pasted.

VBA Copy code Copy code
If Application.SpecialMode = True Then SendKeys "ESC"
With Selection
 .Cut
 .EndKey Unit:=wdStory
 .Paste
End With

See also

Concepts

Application Object

Other resources

Application Object Members


Application.StartupPath Property (Word)

 Copy code hover
[image]

Application.StartupPath Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the complete path of the startup folder, excluding the final separator. Read/write String.

Syntax

expression .StartupPath

expression An expression that returns an Application object.

Remarks

Templates and add-ins located in the Startup folder are automatically loaded when you start Word.

Example

This example displays the complete path of the Startup folder.

VBA Copy code Copy code
MsgBox Application.StartupPath

This example enables the user to change the path of the Startup folder.

VBA Copy code Copy code
x = MsgBox("Do you want to change the startup path?", vbYesNo, _
 "Current path = " & Application.StartupPath)
If x = vbYes Then
 newStartup = InputBox("Type a startup path")
 Application.StartupPath = newStartup
End If

See also

Concepts

Application Object

Other resources

Application Object Members


Application.StatusBar Property (Word)

 Copy code hover
[image]

Application.StatusBar Property (Word)
See also Send feedback

Published: July 16, 2012

This property is no longer supported in Microsoft Word Visual Basic for Applications.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.SynonymInfo Property (Word)

 Copy code hover
[image]

Application.SynonymInfo Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a SynonymInfo object that contains information from the thesaurus on synonyms, antonyms, or related words and expressions for the specified word or phrase.

Syntax

expression .SynonymInfo(Word, LanguageID)

expression Required. A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Word | Required | String | The specified word or phrase.
LanguageID | Optional | Variant | The language used for the thesaurus. Can be one of the WdLanguageID constants (although some of the constants may not be available to you, depending on the language support (U.S. English, for example) that you have selected or installed).

Example

This example returns a list of antonyms for the word "big" in U.S. English.

VBA Copy code Copy code
Alist = SynonymInfo(Word:="big", _
 LanguageID:=wdEnglishUS).AntonymList
For i = 1 To UBound(Alist)
 Msgbox Alist(i)
Next i

See also

Concepts

Application Object

Other resources

Application Object Members


Application.System Property (Word)

 Copy code hover
[image]

Application.System Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a System object, which can be used to return system-related information and perform system-related tasks.

Syntax

expression .System

expression An expression that returns an Application object.

Example

This example returns information about the system.

VBA Copy code Copy code
processor = System.ProcessorType
enviro = System.OperatingSystem

This example establishes a connection to a network drive.

VBA Copy code Copy code
System.Connect Path:="\\Project\Info"

See also

Concepts

Application Object

Other resources

Application Object Members


Application.TaskPanes Property (Word)

 Copy code hover
[image]

Application.TaskPanes Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a TaskPanes collection that represents the most commonly performed tasks in Microsoft Word.

Syntax

expression .TaskPanes

expression An expression that returns an Application object.

Example

The following example displays the task pane that contains information about formatting in a document.

VBA Copy code Copy code
Sub showFormatting()
 Application.TaskPanes.Item(wdTaskPaneFormatting).Visible = True
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Tasks Property (Word)

 Copy code hover
[image]

Application.Tasks Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Tasks collection that represents all the applications that are running.

Syntax

expression .Tasks

expression An expression that returns an Application object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example displays the calculator. If the calculator is not already running, then Word starts the task and then displays the calculator.

VBA Copy code Copy code
If Tasks.Exists("Calculator") Then
 With Tasks("Calculator")
 .Activate
 .WindowState = wdWindowStateNormal
 End With
Else
 Shell "calc.exe"
 Tasks("Calculator").WindowState = wdWindowStateNormal
End If

This example checks to see whether Microsoft Excel is currently running. If the task is running, the example activates Microsoft Excel; otherwise, a message box is displayed.

VBA Copy code Copy code
If Tasks.Exists("Microsoft Excel") = True Then
 With Tasks("Microsoft Excel")
 .Activate
 .WindowState = wdWindowStateMaximize
 End With
Else
 Msgbox "Microsoft Excel is not currently running."
End If

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Templates Property (Word)

 Copy code hover
[image]

Application.Templates Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Templates collection that represents all the available templates—global templates and those attached to open documents.

Syntax

expression .Templates

expression An expression that returns an Application object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example displays the name of each template in the Templates collection.

VBA Copy code Copy code
Count = 1
For Each aTemplate In Templates
 MsgBox aTemplate.Name & " is template number " & Count
 Count = Count + 1
Next aTemplate

In this example, if template one is a global template, its path is stored in thePath. The ChDir statement is used to make the folder with the path stored in thePath the current folder. When this change is made, the Open dialog box is displayed.

VBA Copy code Copy code
If Templates(1).Type = wdGlobalTemplate Then
 thePath = Templates(1).Path
 If thePath <> "" Then ChDir thePath
 Dialogs(wdDialogFileOpen).Show
End If

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Top Property (Word)

 Copy code hover
[image]

Application.Top Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the vertical position of the active document. Read/write Long.

Syntax

expression .Top

expression Required. A variable that represents an Application object.

Example

This example positions the Word application window 100 points from the top of the screen.

VBA Copy code Copy code
Application.WindowState = wdWindowStateNormal
Application.Top = 100

See also

Concepts

Application Object

Other resources

Application Object Members


Application.UndoRecord Property (Word)

 Copy code hover
[image]

Application.UndoRecord Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an UndoRecord object that provides a custom entry point into the undo stack. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .UndoRecord

expression A variable that represents an Application object.

Remarks

Use the UndoRecord object to create and modify custom undo records in the Word 2013 undo stack.

Example

The following code example instantiates an UndoRecord object.

VBA Copy code Copy code
Dim objUndo As UndoRecord
Set objUndo = Application.UndoRecord

See also

Concepts

Application Object

Other resources

Application Object Members


Application.UsableHeight Property (Word)

 Copy code hover
[image]

Application.UsableHeight Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the maximum height (in points) to which you can set the height of a Microsoft Word document window. Read-only Long.

Syntax

expression .UsableHeight

expression A variable that represents an Application object.

Example

This example sets the size of the active document window to one quarter of the maximum allowable screen area.

VBA Copy code Copy code
With ActiveDocument.ActiveWindow
 .WindowState = wdWindowStateNormal
 .Top = 5
 .Left = 5
 .Height = (Application.UsableHeight*0.5)
 .Width = (Application.UsableWidth*0.5)
End With

This example displays the size of the working area in the active document window.

VBA Copy code Copy code
With ActiveDocument.ActiveWindow
 MsgBox "Working area height = " _
 & .UsableHeight & vbLf _
 & "Working area width = " _
 & .UsableWidth
End With

See also

Concepts

Application Object

Other resources

Application Object Members


Application.UsableWidth Property (Word)

 Copy code hover
[image]

Application.UsableWidth Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the maximum width (in points) to which you can set the width of a Microsoft Word document window. Read-only Long.

Syntax

expression .UsableWidth

expression A variable that represents an Application object.

Example

This example sets the size of the active document window to one quarter of the maximum allowable screen area.

VBA Copy code Copy code
With ActiveDocument.ActiveWindow
 .WindowState = wdWindowStateNormal
 .Top = 5
 .Left = 5
 .Height = (Application.UsableHeight*0.5)
 .Width = (Application.UsableWidth*0.5)
End With

This example displays the size of the working area in the active document window.

VBA Copy code Copy code
With ActiveDocument.ActiveWindow
 MsgBox "Working area height = " _
 & .UsableHeight & vbLf _
 & "Working area width = " _
 & .UsableWidth
End With

See also

Concepts

Application Object

Other resources

Application Object Members


Application.UserAddress Property (Word)

 Copy code hover
[image]

Application.UserAddress Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the user's mailing address. Read/write String.

Syntax

expression .UserAddress

expression An expression that returns an Application object.

Remarks

The mailing address is used as a return address on envelopes.

Example

This example sets the user's return address. The Chr function is used to return a line feed character.

VBA Copy code Copy code
Application.UserAddress = "4200 Third Street NE" & Chr(10) _
 & "Anytown, WA 98999"

This example returns the address found in the Mailing address box on the User Information tab in the Options dialog box (Tools menu).

VBA Copy code Copy code
Msgbox Application.UserAddress

See also

Concepts

Application Object

Other resources

Application Object Members


Application.UserControl Property (Word)

 Copy code hover
[image]

Application.UserControl Property (Word)
See also Send feedback

Published: July 16, 2012

True if the document or application was created or opened by the user. Read-only Boolean.

Syntax

expression .UserControl

expression A variable that represents an Application object.

Remarks

The UserControl property returns False if the application was created or opened programmatically from another Microsoft Office application with the Open method or the CreateObject or GetObject method.

Note Note

If Word is visible to the user, or if you call the UserControl property of an Application object from within a code module, this property will always return True.

Example

This example displays the status of the UserControl property for the active document. This example will only work correctly when run from another Office application with the Word object library loaded.

VBA Copy code Copy code
Set wd = New Word.Application
Set wdDoc = _
 wd.Documents.Open("C:\My Documents\doc1.doc")
If wdDoc.UserControl = True Then
 MsgBox "This document was created or opened by the user."
Else
 MsgBox "This document was created programmatically."
End If

See also

Concepts

Application Object

Other resources

Application Object Members


Application.UserInitials Property (Word)

 Copy code hover
[image]

Application.UserInitials Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the user's initials, which Microsoft Word uses to construct comment marks. Read/write String.

Syntax

expression .UserInitials

expression An expression that returns an Application object.

Example

This example sets the user's initials.

VBA Copy code Copy code
Application.UserInitials = "baa"

This example returns the letters found in the Initials box on the User Information tab in the Options dialog box (Tools menu).

VBA Copy code Copy code
Msgbox Application.UserInitials

See also

Concepts

Application Object

Other resources

Application Object Members


Application.UserName Property (Word)

 Copy code hover
[image]

Application.UserName Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the user's name, which is used on envelopes and for the Author document property. Read/write String.

Syntax

expression .UserName

expression An expression that returns an Application object.

Example

This example sets the user's name.

VBA Copy code Copy code
Application.UserName = "Andrew Fuller"

This example returns the name found in the Name box on the User Information tab in the Options dialog box (Tools menu).

VBA Copy code Copy code
Msgbox Application.UserName

See also

Concepts

Application Object

Other resources

Application Object Members


Application.VBE Property (Word)

 Copy code hover
[image]

Application.VBE Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a VBE object that represents the Visual Basic Editor.

Syntax

expression .VBE

expression An expression that returns an Application object.

Example

This example displays the number of references available for the active project.

VBA Copy code Copy code
MsgBox "References = " & VBE.ActiveVBProject.References.Count

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Version Property (Word)

 Copy code hover
[image]

Application.Version Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the Microsoft Word version number. Read-only String.

Syntax

expression .Version

expression A variable that represents an Application object.

Example

This example displays the Word version number in a message box.

VBA Copy code Copy code
Msgbox "The version of Word is " & Application.Version

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Visible Property (Word)

 Copy code hover
[image]

Application.Visible Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified object is visible. Read/write Boolean.

Syntax

expression .Visible

expression Required. A variable that represents an Application object.

Example

This example hides Microsoft Word.

VBA Copy code Copy code
Application.Visible = False

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Width Property (Word)

 Copy code hover
[image]

Application.Width Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the width of the application window, in points. Read/write Long.

Syntax

expression .Width

expression A variable that represents an Application object.

Example

This example sets the width and height of the Microsoft Word application window.

VBA Copy code Copy code
With Application
 .WindowState = wdWindowStateNormal
 .Width = 500
 .Height = 400
End With

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Windows Property (Word)

 Copy code hover
[image]

Application.Windows Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Windows collection that represents all document windows. Read-only.

Syntax

expression .Windows

expression A variable that represents an Application object.

Remarks

The collection corresponds to the window names that appear at the bottom of the Window menu. For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example arranges all open windows so that they don't overlap.

VBA Copy code Copy code
Windows.Arrange ArrangeStyle:=wdTiled

See also

Concepts

Application Object

Other resources

Application Object Members


Application.WindowState Property (Word)

 Copy code hover
[image]

Application.WindowState Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the state of the specified document window or task window. Read/write WdWindowState.

Syntax

expression .WindowState

expression Required. A variable that represents an Application object.

Remarks

The wdWindowStateNormal constant indicates a window that's not maximized or minimized. The state of an inactive window cannot be set. Use the Activate method to activate a window prior to setting the window state.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.WordBasic Property (Word)

 Copy code hover
[image]

Application.WordBasic Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an automation object (Word.Basic) that includes methods for all the WordBasic statements and functions available in Word version 6.0 and Word for Windows 95. Read-only.

Syntax

expression .WordBasic

expression A variable that represents an Application object.

Remarks

In Word 2000 and later, when you open a Word version 6.0 or Word for Windows 95 template that contains WordBasic macros, the macros are automatically converted to Visual Basic modules. Each WordBasic statement and function in the macro is converted to the corresponding Word.Basic method.

For information about WordBasic statements and functions, see the WordBasic Help in Word version 6.0 or Word for Windows 95. For information about converting WordBasic to Visual Basic, see Converting WordBasic Macros to Visual Basic. For general information, see Conceptual Differences Between WordBasic and Visual Basic.

Example

This example uses the Word.Basic object to create a new document in Word version 6.0 or Word for Windows 95 and insert the available font names. Each font name is formatted in its corresponding font.

VBA Copy code Copy code
With WordBasic
 .FileNewDefault
 For aCount = 1 To .CountFonts()
 .Font .[Font$](aCount)
 .Insert .[Font$](aCount)
 .InsertPara
 Next
End With

See also

Concepts

Application Object

Other resources

Application Object Members


Application.XMLNamespaces Property (Word)

 Copy code hover
[image]

Application.XMLNamespaces Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an XMLNamespaces collection that represents the XML schemas in the Schema Library.

Syntax

expression .XMLNamespaces

expression An expression that returns an Application object.

Example

The following example returns the first schema in the Schema Library.

VBA Copy code Copy code
Dim objSchema As XMLNamespace

Set objSchema = Application.XMLNamespaces.Item(1)

See also

Concepts

Application Object

Other resources

Application Object Members


Application Methods (Word)

 Copy code hover
[image]

Application Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Activate | Activates the specified object.
AddAddress | Adds an entry to the address book. Each entry has values for one or more tag IDs.
AutomaticChange | Performs an AutoFormat action when there is a change suggested by the Office Assistant. If no AutoFormat action is active, this method generates an error.
BuildKeyCode | Returns a unique number for the specified key combination.
CentimetersToPoints | Converts a measurement from centimeters to points (1 cm = 28.35 points). Returns the converted measurement as a Single.
ChangeFileOpenDirectory | Sets the folder in which Word searches for documents.
CheckGrammar | Checks a string for grammatical errors. Returns a Boolean to indicate whether the string contains grammatical errors. True if the string contains no errors.
CheckSpelling | Checks a string for spelling errors. Returns a Boolean to indicate whether the string contains spelling errors. True if the string has no spelling errors.
CleanString | Removes nonprinting characters (character codes 1 - 29) and special Word characters from the specified string or changes them to spaces (character code 32). Returns the result as a String.
CompareDocuments | Compares two documents and returns a Document object that represents the document that contains the differences between the two documents, marked using tracked changes.
DDEExecute | Sends a command or series of commands to an application through the specified dynamic data exchange (DDE) channel.
DDEInitiate | Opens a dynamic data exchange (DDE) channel to another application, and returns the channel number.
DDEPoke | Uses an open dynamic data exchange (DDE) channel to send data to an application.
DDERequest | Uses an open dynamic data exchange (DDE) channel to request information from the receiving application, and returns the information as a String.
DDETerminate | Closes the specified dynamic data exchange (DDE) channel to another application.
DDETerminateAll | Closes all dynamic data exchange (DDE) channels opened by Microsoft Word.
DefaultWebOptions | Returns the DefaultWebOptions object that contains global application-level attributes used by Microsoft Word whenever you save a document as a Web page or open a Web page.
GetAddress | Returns an address from the default address book.
GetDefaultTheme | Returns a String that represents the name of the default theme plus the theme formatting options Microsoft Word uses for new documents, e-mail messages, or Web pages.
GetSpellingSuggestions | Returns a SpellingSuggestions collection that represents the words suggested as spelling replacements for a given word.
GoBack | Moves the insertion point among the last three locations where editing occurred in the active document (the same as pressing SHIFT+F5).
GoForward | Moves the insertion point forward among the last three locations where editing occurred in the active document.
Help | Displays installed Help information.
HelpTool |
InchesToPoints | Converts a measurement from inches to points (1 inch = 72 points). Returns the converted measurement as a Single.
Keyboard | Returns or sets the keyboard language and layout settings.
KeyboardBidi | Sets the keyboard language to a right-to-left language and the text entry direction to right-to-left.
KeyboardLatin | Sets the keyboard language to a left-to-right language and the text entry direction to left-to-right.
KeyString | Returns the key combination string for the specified keys (for example, CTRL+SHIFT+A).
LinesToPoints | Converts a measurement from lines to points (1 line = 12 points). Returns the converted measurement as a Single.
ListCommands | Creates a new document and then inserts a table of Word commands along with their associated shortcut keys and menu assignments.
LoadMasterList | Loads a bibliography source file.
LookupNameProperties | Looks up a name in the global address book list and displays the Properties dialog box, which includes information about the specified name.
MergeDocuments | Compares two documents and returns a Document object that represents the document that contains the differences between the two documents, marked using tracked changes.
MillimetersToPoints | Converts a measurement from millimeters to points (1 mm = 2.85 points). Returns the converted measurement as a Single.
Move | Positions a task window or the active document window.
NewWindow | Opens a new window with the same document as the specified window. Returns a Window object.
NextLetter | You have requested Help for a Visual Basic keyword used only on the Macintosh. For information about the NextLetter method of the Application object, consult the language reference Help included with Microsoft Office Macintosh Edition.
OnTime | Starts a background timer that runs a macro at a specified time.
OrganizerCopy | Copies the specified AutoText entry, toolbar, style, or macro project item from the source document or template to the destination document or template.
OrganizerDelete | Deletes the specified style, AutoText entry, toolbar, or macro project item from a document or template.
OrganizerRename | Renames the specified style, AutoText entry, toolbar, or macro project item in a document or template.
PicasToPoints | Converts a measurement from picas to points (1 pica = 12 points). Returns the converted measurement as a Single.
PixelsToPoints | Converts a measurement from pixels to points. Returns the converted measurement as a Single.
PointsToCentimeters | Converts a measurement from points to centimeters (1 centimeter = 28.35 points). Returns the converted measurement as a Single.
PointsToInches | Converts a measurement from points to inches (1 inch = 72 points). Returns the converted measurement as a Single.
PointsToLines | Converts a measurement from points to lines (1 line = 12 points). Returns the converted measurement as a Single.
PointsToMillimeters | Converts a measurement from points to millimeters (1 millimeter = 2.835 points). Returns the converted measurement as a Single.
PointsToPicas | Converts a measurement from points to picas (1 pica = 12 points). Returns the converted measurement as a Single.
PointsToPixels | Converts a measurement from points to pixels. Returns the converted measurement as a Single.
PrintOut | Prints all or part of the specified document.
ProductCode | Returns the Microsoft Word globally unique identifier (GUID) as a String.
PutFocusInMailHeader | Places the insertion point in the To line of the mail header if the document in the active window is an e-mail document.
Quit | Quits Microsoft Word and optionally saves or routes the open documents.
Repeat | Repeats the most recent editing action one or more times. Returns True if the commands were repeated successfully.
ResetIgnoreAll | Clears the list of words that were previously ignored during a spelling check.
Resize | Sizes the Word application window or the specified task window.
Run | Runs a Visual Basic macro.
ScreenRefresh | Updates the display on the monitor with the current information in the video memory buffer.
SetDefaultTheme | Sets a default theme for Microsoft Word to use with new documents, e-mail messages, or Web pages.
ShowClipboard | Displays the Clipboard task pane.
ShowMe |
SubstituteFont | Sets font-mapping options.
ToggleKeyboard | Switches the keyboard language setting between right-to-left and left-to-right languages.


Application.Activate Method (Word)

 Copy code hover
[image]

Application.Activate Method (Word)
See also Send feedback

Published: July 16, 2012

Activates the specified object.

Syntax

expression .Activate

expression Required. A variable that represents an Application object.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.AddAddress Method (Word)

 Copy code hover
[image]

Application.AddAddress Method (Word)
See also Send feedback

Published: July 16, 2012

Adds an entry to the address book. Each entry has values for one or more tag IDs.

Syntax

expression .AddAddress(TagID, Value)

expression Required. A variable that represents an Application object.

Parameters

Name

Required/Optional

Data Type

Description

TagID

Required

String array

The tag ID values for the new address entry. Each element in the array can contain one of the strings listed in the following table. Only the display name is required; the remaining entries are optional.

Tag ID | Description
PR_DISPLAY_NAME | Name displayed in the Address Book dialog box
PR_DISPLAY_NAME_PREFIX | Title (for example, "Ms." or "Dr.")
PR_GIVEN_NAME | First name
PR_SURNAME | Last name
PR_STREET_ADDRESS | Street address
PR_LOCALITY | City or locality
PR_STATE_OR_PROVINCE | State or province
PR_POSTAL_CODE | Postal code
PR_COUNTRY | Country/Region
PR_TITLE | Job title
PR_COMPANY_NAME | Company name
PR_DEPARTMENT_NAME | Department name within the company
PR_OFFICE_LOCATION | Office location
PR_PRIMARY_TELEPHONE_NUMBER | Primary telephone number
PR_PRIMARY_FAX_NUMBER | Primary fax number
PR_OFFICE_TELEPHONE_NUMBER | Office telephone number
PR_OFFICE2_TELEPHONE_NUMBER | Second office telephone number
PR_HOME_TELEPHONE_NUMBER | Home telephone number
PR_CELLULAR_TELEPHONE_NUMBER | Cellular telephone number
PR_BEEPER_TELEPHONE_NUMBER | Beeper telephone number
PR_COMMENT | Text included on the Notes tab for the address entry
PR_EMAIL_ADDRESS | Electronic mail address
PR_ADDRTYPE | Electronic mail address type
PR_OTHER_TELEPHONE_NUMBER | Alternate telephone number (other than home or office)
PR_BUSINESS_FAX_NUMBER | Business fax number
PR_HOME_FAX_NUMBER | Home fax number
PR_RADIO_TELEPHONE_NUMBER | Radio telephone number
PR_INITIALS | Initials
PR_LOCATION | Location, in the format buildingnumber/roomnumber (for example, 7/3007 represents room 3007 in building 7)
PR_CAR_TELEPHONE_NUMBER | Car telephone number

Value

Required

String array

The values for the new address entry. Each element corresponds to an element in the TagID array. For more information, see the example.

Example

This example adds an entry to the address book.

VBA Copy code Copy code
Dim tagIDArray(0 To 3) As String
Dim valueArray(0 To 3) As String

tagIDArray(0) = "PR_DISPLAY_NAME"
tagIDArray(1) = "PR_GIVEN_NAME"
tagIDArray(2) = "PR_SURNAME"
tagIDArray(3) = "PR_COMMENT"
valueArray(0) = "Kim Buhler"
valueArray(1) = "Kim"
valueArray(2) = "Buhler"
valueArray(3) = "This is a comment"

Application.AddAddress TagID:=tagIDArray(), Value:=valueArray()

See also

Concepts

Application Object

Other resources

Application Object Members


Application.AutomaticChange Method (Word)

 Copy code hover
[image]

Application.AutomaticChange Method (Word)
See also Send feedback

Published: July 16, 2012

Performs an AutoFormat action when there is a change suggested by the Office Assistant. If no AutoFormat action is active, this method generates an error.

Syntax

expression .AutomaticChange

expression Required. A variable that represents an Application object.

Example

This example completes an Office Assistant AutoFormat action if one is active.

VBA Copy code Copy code
Application.AutomaticChange

See also

Concepts

Application Object

Other resources

Application Object Members


Application.BuildKeyCode Method (Word)

 Copy code hover
[image]

Application.BuildKeyCode Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a unique number for the specified key combination.

Syntax

expression .BuildKeyCode(Arg1, Arg2, Arg3, Arg4)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | WdKey | A key you specify by using one of the WdKey constants.
Arg2 - Arg4 | Optional | WdKey | A key you specify by using one of the WdKey constants.

Example

This example assigns the ALT + F1 key combination to the Organizer command.

VBA Copy code Copy code
CustomizationContext = NormalTemplate
KeyBindings.Add KeyCode:=BuildKeyCode(Arg1:=wdKeyAlt, _
 Arg2:=wdKeyF1), KeyCategory:=wdKeyCategoryCommand, _
 Command:="Organizer"

This example removes the ALT+F1 key assignment from the Normal template.

VBA Copy code Copy code
CustomizationContext = NormalTemplate
FindKey(BuildKeyCode(Arg1:=wdKeyAlt, Arg2:=wdKeyF1)).Clear

This example displays the command assigned to the F1 key.

VBA Copy code Copy code
CustomizationContext = NormalTemplate
MsgBox FindKey(BuildKeyCode(Arg1:=wdKeyF1)).Command

See also

Concepts

Application Object

Other resources

Application Object Members


Application.CentimetersToPoints Method (Word)

 Copy code hover
[image]

Application.CentimetersToPoints Method (Word)
See also Send feedback

Published: July 16, 2012

Converts a measurement from centimeters to points (1 cm = 28.35 points). Returns the converted measurement as a Single.

Syntax

expression .CentimetersToPoints(Centimeters)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Centimeters | Required | Single | The centimeter value to be converted to points.

Example

This example adds a centered tab stop to all the paragraphs in the selection. The tab stop is positioned at 1.5 centimeters from the left margin.

VBA Copy code Copy code
Selection.Paragraphs.TabStops.Add _
 Position:=Application.CentimetersToPoints(1.5), _
 Alignment:=wdAlignTabCenter

This example sets a first-line indent of 2.5 centimeters for the first paragraph in the active document.

VBA Copy code Copy code
ActiveDocument.Paragraphs(1).FirstLineIndent = _
 Application.CentimetersToPoints(2.5)

See also

Concepts

Application Object

Other resources

Application Object Members


Application.ChangeFileOpenDirectory Method (Word)

 Copy code hover
[image]

Application.ChangeFileOpenDirectory Method (Word)
See also Send feedback

Published: July 16, 2012

Sets the folder in which Word searches for documents.

Syntax

expression .ChangeFileOpenDirectory(Path)

expression A variable that represents an Application object. Optional.

Parameters

Name | Required/Optional | Data Type | Description
Path | Required | String | The path to the folder in which Word searches for documents.

Remarks

The specified folder's contents are listed the next time the Open dialog box (File tab) is displayed. Word searches the specified folder for documents until the user changes the folder in the Open dialog box or the current Word session ends. Use the DefaultFilePath property to change the default folder for documents in every Word session.

Example

This example changes the folder in which Word searches for documents, and then opens a file named "Test.doc."

VBA Copy code Copy code
ChangeFileOpenDirectory "C:\Documents"
Documents.Open FileName:="Test.doc"

This example changes the folder in which Word searches for documents, and then displays the Open dialog box.

VBA Copy code Copy code
ChangeFileOpenDirectory "C:\"
Dialogs(wdDialogFileOpen).Show

See also

Concepts

Application Object

Other resources

Application Object Members


Application.CheckGrammar Method (Word)

 Copy code hover
[image]

Application.CheckGrammar Method (Word)
See also Send feedback

Published: July 16, 2012

Checks a string for grammatical errors. Returns a Boolean to indicate whether the string contains grammatical errors. True if the string contains no errors.

Syntax

expression .CheckGrammar(String)

expression Required. A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
String | Required | String | The string you want to check for grammatical errors.

Return Value

Boolean

Example

This example displays the result of a grammar check on the selection.

VBA Copy code Copy code
strPass = Application.CheckGrammar(String:=Selection.Text)
MsgBox "Selection is grammatically correct: " & strPass

See also

Concepts

Application Object

Other resources

Application Object Members


Application.CheckSpelling Method (Word)

 Copy code hover
[image]

Application.CheckSpelling Method (Word)
See also Send feedback

Published: July 16, 2012

Checks a string for spelling errors. Returns a Boolean to indicate whether the string contains spelling errors. True if the string has no spelling errors.

Syntax

expression .CheckSpelling(Word, CustomDictionary, IgnoreUppercase, MainDictionary, CustomDictionary2, CustomDictionary3, CustomDictionary4, CustomDictionary5, CustomDictionary6, CustomDictionary7, CustomDictionary8, CustomDictionary9, CustomDictionary10)

expression Required. A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Word | Required | String | The text whose spelling is to be checked.
CustomDictionary | Optional | Variant | Either an expression that returns a Dictionary object or the file name of the custom dictionary.
IgnoreUppercase | Optional | Variant | True if capitalization is ignored. If this argument is omitted, the current value of the IgnoreUppercase property is used.
MainDictionary | Optional | Variant | Either an expression that returns a Dictionary object or the file name of the main dictionary.
CustomDictionary2 | Optional | Variant | Either an expression that returns a Dictionary object or the file name of an additional custom dictionary.
CustomDictionary3 | Optional | Variant | Either an expression that returns a Dictionary object or the file name of an additional custom dictionary.
CustomDictionary4 | Optional | Variant | Either an expression that returns a Dictionary object or the file name of an additional custom dictionary.
CustomDictionary5 | Optional | Variant | Either an expression that returns a Dictionary object or the file name of an additional custom dictionary.
CustomDictionary6 | Optional | Variant | Either an expression that returns a Dictionary object or the file name of an additional custom dictionary.
CustomDictionary7 | Optional | Variant | Either an expression that returns a Dictionary object or the file name of an additional custom dictionary.
CustomDictionary8 | Optional | Variant | Either an expression that returns a Dictionary object or the file name of an additional custom dictionary.
CustomDictionary9 | Optional | Variant | Either an expression that returns a Dictionary object or the file name of an additional custom dictionary.
CustomDictionary10 | Optional | Variant | Either an expression that returns a Dictionary object or the file name of an additional custom dictionary.

Return Value

Boolean

See also

Concepts

Application Object

Other resources

Application Object Members


Application.CleanString Method (Word)

 Copy code hover
[image]

Application.CleanString Method (Word)
See also Send feedback

Published: July 16, 2012

Removes nonprinting characters (character codes 1 - 29) and special Word characters from the specified string or changes them to spaces (character code 32). Returns the result as a String.

Syntax

expression .CleanString(String)

expression A variable that represents an Application object. Optional.

Parameters

Name | Required/Optional | Data Type | Description
String | Required | String | The source string.

Remarks

The following characters are converted as described in this table.

Character code | Description
7 (beep) | Removed unless preceded by character 13 (paragraph), then converted to character 9 (tab).
10 (line feed) | Converted to character 13 (paragraph) unless preceded by character 13, then removed.
13 (paragraph) | Unchanged.
31 (optional hyphen) | Removed.
160 (nonbreaking space) | Converted to character 32 (space).
172 (optional hyphen) | Removed.
176 (nonbreaking space) | Converted to character 32 (space).
182 (paragraph mark) | Removed.
183 (bullet) | Converted to character 32 (space).

Example

This example removes nonprinting characters from the selected text and inserts the result into a new document.

VBA Copy code Copy code
Dim strClean As String
Dim docNew As Document

strClean = Application.CleanString(Selection.Text)
Set docNew = Documents.Add
docNew.Content.InsertAfter strClean

This example removes nonprinting characters from the selected field code and then displays the result.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.View.ShowFieldCodes = True
ActiveDocument.Fields(1).Select
MsgBox Application.CleanString(Selection.Text)

See also

Concepts

Application Object

Other resources

Application Object Members


Application.CompareDocuments Method (Word)

 Copy code hover
[image]

Application.CompareDocuments Method (Word)
See also Send feedback

Published: July 16, 2012

Compares two documents and returns a Document object that represents the document that contains the differences between the two documents, marked using tracked changes.

Syntax

expression .CompareDocuments(OriginalDocument, RevisedDocument, Destination, Granularity, CompareFormatting, CompareCaseChanges, CompareWhitespace, CompareTables, CompareHeaders, CompareFootnotes, CompareTextboxes, CompareFields, CompareComments, RevisedAuthor, IgnoreAllComparisonWarnings)

expression An expression that returns an Application object.

Parameters

Name | Required/Optional | Data Type | Description
OriginalDocument | Required | Document | Specifies the path and file name of the original document.
RevisedDocument | Required | Document | Specifies the path and file name of the revised document to which to compare the original document.
Destination | Optional | WdCompareDestination | Specifies whether to create a new file or whether to mark the differences between the two documents in the original document or in the revised document. Default value is wdCompareDestinationNew.
Granularity | Optional | WdGranularity | Specifies whether changes are tracked by character or by word. Default value is wdGranularityWordLevel.
CompareFormatting | Optional | Boolean | Specifies whether to mark differences in formatting between the two documents. Default value is True.
CompareCaseChanges | Optional | Boolean | Specifies whether to mark differences in case between the two documents. Default value is True.
CompareWhitespace | Optional | Boolean | Specifies whether to mark differences in white space, such as paragraphs or spaces, between the two documents. Default value is True.
CompareTables | Optional | Boolean | Specifies whether to compare the differences in data contained in tables between the two documents. Default value is True.
CompareHeaders | Optional | Boolean | Specifies whether to compare differences in headers and footers between the two documents. Default value is True.
CompareFootnotes | Optional | Boolean | Specifies whether to compare differences in footnotes and endnotes between the two documents. Default value is True.
CompareTextboxes | Optional | Boolean | Specifies whether to compare differences in the data contained within text boxes between the two documents. Default value is True.
CompareFields | Optional | Boolean | Specifies whether to compare differences in fields between the two documents. Default value is True.
CompareComments | Optional | Boolean | Specifies whether to compare differences in comments between the two documents. Default value is True.
RevisedAuthor | Optional | String | Specifies the name of the person to whom to attribute changes when comparing the two documents.
IgnoreAllComparisonWarnings | Optional | Boolean | Specifies whether to ignore warnings when comparing the two documents.

Return Value

Document

See also

Concepts

Application Object

Other resources

Application Object Members


Application.DDEExecute Method (Word)

 Copy code hover
[image]

Application.DDEExecute Method (Word)
See also Send feedback

Published: July 16, 2012

Sends a command or series of commands to an application through the specified dynamic data exchange (DDE) channel.

Syntax

expression .DDEExecute(Channel, Command)

expression A variable that represents an Application object. Optional.

Parameters

Name | Required/Optional | Data Type | Description
Channel | Required | Long | The channel number returned by the DDEInitiate method.
Command | Required | String | A command or series of commands recognized by the receiving application (the DDE server). If the receiving application cannot perform the specified command, an error occurs.

Remarks

Security note Security Note
Dynamic data exchange (DDE) is an older technology that is not secure. If possible, use a more secure alternative to DDE, such as object linking and embedding (OLE).

Example

This example creates a new worksheet in Microsoft Excel. The XLM macro instruction to create a new worksheet is New(1).

VBA Copy code Copy code
Dim lngChannel As Long

lngChannel = DDEInitiate(App:="Excel", Topic:="System")
DDEExecute Channel:=lngChannel, Command:="[New(1)]"
DDETerminate Channel:=lngChannel

This example runs the Microsoft Excel macro named "Macro1" in Personal.xls.

VBA Copy code Copy code
Dim lngChannel As Long

lngChannel = DDEInitiate(App:="Excel", Topic:="System")
DDEExecute Channel:=lngChannel, Command:="[Run(" & Chr(34) & _
 "Personal.xls!Macro1" & Chr(34) & ")]"
DDETerminate Channel:=lngChannel

See also

Concepts

Application Object

Other resources

Application Object Members


Application.DDEInitiate Method (Word)

 Copy code hover
[image]

Application.DDEInitiate Method (Word)
See also Send feedback

Published: July 16, 2012

Opens a dynamic data exchange (DDE) channel to another application, and returns the channel number.

Syntax

expression .DDEInitiate(App, Topic)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
App | Required | String | The name of the application.
Topic | Required | String | The name of a DDE topic—for example, the name of an open document—recognized by the application to which you are opening a channel.

Remarks

Security note Security Note
Dynamic data exchange (DDE) is an older technology that is not secure. If possible, use a more secure alternative to DDE, such as object linking and embedding (OLE).

If it is successful, the DDEInitiate method returns the number of the open channel. All subsequent DDE functions use this number to specify the channel.

Example

This example initiates a DDE conversation with the System topic and opens the Microsoft Office Excel workbook Sales.xls. The example terminates the DDE channel, initiates a channel to Sales.xls, and then inserts text into cell R1C1.

VBA Copy code Copy code
Dim lngChannel As Long

lngChannel = DDEInitiate(App:="Excel", Topic:="System")
DDEExecute Channel:=lngChannel, Command:="[OPEN(" & Chr(34) _
 & "C:\Sales.xls" & Chr(34) & ")]
DDETerminate Channel:=lngChannel
lngChannel = DDEInitiate(App:="Excel", Topic:="Sales.xls")
DDEPoke Channel:=lngChannel, Item:="R1C1", Data:="1996 Sales"
DDETerminate Channel:=lngChannel

See also

Concepts

Application Object

Other resources

Application Object Members


Application.DDEPoke Method (Word)

 Copy code hover
[image]

Application.DDEPoke Method (Word)
See also Send feedback

Published: July 16, 2012

Uses an open dynamic data exchange (DDE) channel to send data to an application.

Syntax

expression .DDEPoke(Channel, Item, Data)

expression A variable that represents an Application object. Optional.

Parameters

Name | Required/Optional | Data Type | Description
Channel | Required | Long | The channel number returned by the DDEInitiate method.
Item | Required | String | The item within a DDE topic to which the specified data is to be sent.
Data | Required | String | The data to be sent to the receiving application (the DDE server).

Remarks

Security note Security Note
Dynamic data exchange (DDE) is an older technology that is not secure. If possible, use a more secure alternative to DDE, such as object linking and embedding (OLE).

If the DDEPoke method isn't successful, an error occurs.

Example

This example opens the Microsoft Excel workbook Sales.xls and inserts "1996 Sales" into cell R1C1.

VBA Copy code Copy code
Dim lngChannel As Long

lngChannel = DDEInitiate(App:="Excel", Topic:="System")
DDEExecute Channel:=lngChannel, Command:="[OPEN(" & Chr(34) _
 & "C:\Sales.xls" & Chr(34) & ")]
DDETerminate Channel:=lngChannel
lngChannel = DDEInitiate(App:="Excel", Topic:="Sales.xls")
DDEPoke Channel:=lngChannel, Item:="R1C1", Data:="1996 Sales"
DDETerminate Channel:=lngChannel

See also

Concepts

Application Object

Other resources

Application Object Members


Application.DDERequest Method (Word)

 Copy code hover
[image]

Application.DDERequest Method (Word)
See also Send feedback

Published: July 16, 2012

Uses an open dynamic data exchange (DDE) channel to request information from the receiving application, and returns the information as a String.

Syntax

expression .DDERequest(Channel, Item)

expression A variable that represents an Application object. Optional.

Parameters

Name | Required/Optional | Data Type | Description
Channel | Required | Long | The channel number returned by the DDEInitiate method.
Item | Required | String | The item to be requested.

Remarks

Security note Security Note
Dynamic data exchange (DDE) is an older technology that is not secure. If possible, use a more secure alternative to DDE, such as object linking and embedding (OLE).

When you request information from the topic in the server application, you must specify the item in that topic whose contents you are requesting. In Microsoft Office Excel, for example, cells are valid items, and you refer to them by using either the "R1C1" format or named references.

Microsoft Excel and other applications that support DDE recognize a topic named "System." Three standard items in the System topic are described in the following table. Note that you can get a list of the other items in the System topic by using the SysItems item.

Item in System topic | Effect
SysItems | Returns a list of all the items in the System topic.
Topics | Returns a list of all the available topics.
Formats | Returns a list of all the Clipboard formats supported by Word.

Example

This example opens the Excel workbook Book1.xls and retrieves the contents of cell R1C1.

VBA Copy code Copy code
Dim lngChannel As Long

lngChannel = DDEInitiate(App:="Excel", Topic:="System")
DDEExecute Channel:=lngChannel, Command:="[OPEN(" & Chr(34) _
 & "C:\Documents\Book1.xls" & Chr(34) & ")]"
DDETerminate Channel:=lngChannel
lngChannel = DDEInitiate(App:="Excel", Topic:="Book1.xls")
MsgBox DDERequest(Channel:=lngChannel, Item:="R1C1")
DDETerminateAll

This example opens a channel to the System topic in Excel and then uses the Topics item to return a list of available topics. The example inserts the topic list, which includes all open workbooks, after the selection.

VBA Copy code Copy code
Dim lngChannel As Long
Dim strTopicList As String

lngChannel = DDEInitiate(App:="Excel", Topic:="System")
strTopicList = DDERequest(Channel:=lngChannel, Item:="Topics")
Selection.InsertAfter strTopicList
DDETerminate Channel:=lngChannel

See also

Concepts

Application Object

Other resources

Application Object Members


Application.DDETerminate Method (Word)

 Copy code hover
[image]

Application.DDETerminate Method (Word)
See also Send feedback

Published: July 16, 2012

Closes the specified dynamic data exchange (DDE) channel to another application.

Syntax

expression .DDETerminate(Channel)

expression A variable that represents an Application object. Optional.

Parameters

Name | Required/Optional | Data Type | Description
Channel | Required | Long | The channel number returned by the DDEInitiate method.

Remarks

Security note Security Note
Dynamic data exchange (DDE) is an older technology that is not secure. If possible, use a more secure alternative to DDE, such as object linking and embedding (OLE).

Example

This example creates a new workbook in Microsoft Excel and then terminates the DDE conversation.

VBA Copy code Copy code
Dim lngChannel As Long

lngChannel = DDEInitiate(App:="Excel", Topic:="System")
DDEExecute Channel:=lngChannel, Command:="[New(1)]"
DDETerminate Channel:=lngChannel

See also

Concepts

Application Object

Other resources

Application Object Members


Application.DDETerminateAll Method (Word)

 Copy code hover
[image]

Application.DDETerminateAll Method (Word)
See also Send feedback

Published: July 16, 2012

Closes all dynamic data exchange (DDE) channels opened by Microsoft Word.

Syntax

expression .DDETerminateAll

expression A variable that represents an Application object. Optional.

Remarks

This method does not close channels opened to Word by client applications. Using this method is the same as using the DDETerminate method for each open channel.

Security note Security Note
Dynamic data exchange (DDE) is an older technology that is not secure. If possible, use a more secure alternative to DDE, such as object linking and embedding (OLE).

If you interrupt a macro that opens a DDE channel, you may inadvertently leave a channel open. Open channels are not closed automatically when a macro ends, and each open channel uses system resources. For this reason, it is a good idea to use this method when you are debugging a macro that opens one or more DDE channels.

Example

This example opens the Microsoft Excel workbook Book1.xls, inserts text into cell R2C3, saves the workbook, and then terminates all DDE channels.

VBA Copy code Copy code
Dim lngChannel As Long

lngChannel = DDEInitiate(App:="Excel", Topic:="System")
DDEExecute Channel:=lngChannel, Command:="[OPEN(" & Chr(34) & _
 "C:\Documents\Book1.xls" & Chr(34) & ")]"
DDETerminate Channel:=lngChannel
lngChannel = DDEInitiate(App:="Excel", Topic:="Book1.xls")
DDEPoke Channel:=lngChannel, Item:="R2C3", Data:="Hello World"
DDEExecute Channel:=lngChannel, Command:="[Save]"
DDETerminateAll

See also

Concepts

Application Object

Other resources

Application Object Members


Application.DefaultWebOptions Method (Word)

 Copy code hover
[image]

Application.DefaultWebOptions Method (Word)
See also Send feedback

Published: July 16, 2012

Returns the DefaultWebOptions object that contains global application-level attributes used by Microsoft Word whenever you save a document as a Web page or open a Web page.

Syntax

expression .DefaultWebOptions

expression Required. A variable that represents an Application object.

Return Value

DefaultWebOptions

Example

This example checks to see whether the default setting for document encoding is Western, and then it sets the string strDocEncoding accordingly.

VBA Copy code Copy code
Dim strDocEncoding As String

If Application.DefaultWebOptions.Encoding _
 = msoEncodingWestern Then
 strDocEncoding = "Western"
Else
 strDocEncoding = "Other"
End If

See also

Concepts

Application Object

Other resources

Application Object Members


Application.GetAddress Method (Word)

 Copy code hover
[image]

Application.GetAddress Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an address from the default address book.

Syntax

expression .GetAddress(Name, AddressProperties, UseAutoText, DisplaySelectDialog, SelectDialog, CheckNamesDialog, RecentAddressesChoice, UpdateRecentAddresses)

expression Required. A variable that represents an Application object.

Parameters

Name

Required/Optional

Data Type

Description

Name

Optional

Variant

The name of the addressee, as specified in the Search Name dialog box in the address book.

AddressProperties

Optional

Variant

If UseAutoText is True, this argument denotes the name of an AutoText entry that defines a sequence of address book properties.

If UseAutoText is False or omitted, this argument defines a custom layout. Valid address book property names or sets of property names are surrounded by angle brackets ("<" and ">") and separated by a space or a paragraph mark (for example, "<PR_GIVEN_NAME> <PR_SURNAME>" & vbCr & "<PR_OFFICE_TELEPHONE_NUMBER>").

If the AddressProperties parameter is omitted, default AutoText entry named "AddressLayout" is used. If "AddressLayout" hasn't been defined, the following address layout definition is used: "<PR_GIVEN_NAME> <PR_SURNAME>" & vbCr & "<PR_STREET_ADDRESS>" & vbCr & "<PR_LOCALITY>" & ", " & "<PR_STATE_OR_PROVINCE>" & " " & "<PR_POSTAL_CODE>" & vbCr & "<PR_COUNTRY>".

For a list of the valid address book property names, see the AddAddress method.

UseAutoText

Optional

Variant

True if AddressProperties specifies the name of an AutoText entry that defines a sequence of address book properties; False if it specifies a custom layout.

DisplaySelectDialog

Optional

Variant

Specifies whether the Select Name dialog box is displayed, as shown in the following table.

Value | Result
0 (zero) | The Select Name dialog box isn't displayed.
1 or omitted | The Select Name dialog box is displayed.
2 | The Select Name dialog box isn't displayed, and no search for a specific name is performed. The address returned by this method will be the previously selected address.

SelectDialog

Optional

Variant

Specifies how the Select Name dialog box should be displayed (that is, in what mode), as shown in the following table.

Value | Display mode
0 (zero) or omitted | Browse mode
1 | Compose mode, with only the To: box
2 | Compose mode, with both the To: and CC: boxes

CheckNamesDialog

Optional

Variant

True to display the Check Names dialog box when the value of the Name argument isn't specific enough.

RecentAddressesChoice

Optional

Variant

True to use the list of recently used return addresses.

UpdateRecentAddresses

Optional

Variant

True to add an address to the list of recently used addresses; False to not add the address. If SelectDialog is set to 1 or 2, this argument is ignored.

Return Value

String

Example

This example sets the variable strAddress to John Smith's address, moves the insertion point to the beginning of the document, and inserts the address. The inserted address will include the default address book properties.

VBA Copy code Copy code
Dim strAddress

strAddress = Application.GetAddress(Name:="John Smith", _
    CheckNamesDialog:=True)
ActiveDocument.Range(Start:=0, End:=0).InsertAfter strAddress

The following example returns John Smith's address, using the "My Address Layout" AutoText entry as the layout definition. "My Address Layout" is defined in the active template and contains a set of address properties assigned to the text$ variable. The example also adds John Smith's address to the list of recently used addresses.

VBA Copy code Copy code
Dim TagIDArray(0 To 3) As String
Dim ValueArray(0 To 3) As String
Dim strAddress As String

TagIDArray(0) = "PR_DISPLAY_NAME"
TagIDArray(1) = "PR_GIVEN_NAME"
TagIDArray(2) = "PR_SURNAME"
TagIDArray(3) = "PR_COMMENT"
ValueArray(0) = "Display_Name"
ValueArray(1) = "John"
ValueArray(2) = "Smith"
ValueArray(3) = "This is a comment"

Application.AddAddress TagID:=TagIDArray(), Value:=ValueArray()
strAddress = Application.GetAddress(Name:="John Smith", _
    UpdateRecentAddresses:=True)

See also

Concepts

Application Object

Other resources

Application Object Members


Application.GetDefaultTheme Method (Word)

 Copy code hover
[image]

Application.GetDefaultTheme Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a String that represents the name of the default theme plus the theme formatting options Microsoft Word uses for new documents, e-mail messages, or Web pages.

Syntax

expression .GetDefaultTheme(DocumentType)

expression Required. A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
DocumentType | Required | WdDocumentMedium | The type of new document for which you want to retrieve the default theme name.

Remarks

You can also use the ThemeName property to return and set the default theme for new e-mail messages.

Example

This example displays the name of the theme Word uses for new Web pages.

VBA Copy code Copy code
MsgBox Application.GetDefaultTheme(wdWebPage)

See also

Concepts

Application Object

Other resources

Application Object Members


Application.GetSpellingSuggestions Method (Word)

 Copy code hover
[image]

Application.GetSpellingSuggestions Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a SpellingSuggestions collection that represents the words suggested as spelling replacements for a given word.

Syntax

expression .GetSpellingSuggestions(Word, CustomDictionary, IgnoreUppercase, MainDictionary, SuggestionMode, CustomDictionary2, CustomDictionary3, CustomDictionary4, CustomDictionary5, CustomDictionary6, CustomDictionary7, CustomDictionary8, CustomDictionary9, CustomDictionary10)

expression Required. A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Word | Required | String | The word whose spelling is to be checked.
IgnoreUppercase | Optional | Variant | True to ignore words in all uppercase letters. If this argument is omitted, the current value of the IgnoreUppercase property is used.
SuggestionMode | Optional | Variant | Specifies the way Word makes spelling suggestions. Can be one of the following WdSpellingWordType constants: wdAnagram, wdSpellword, orwdWildcard. The default value is WdSpellword.

Remarks

If the word is spelled correctly, the Count property of the SpellingSuggestions object returns 0 (zero).

See also

Concepts

Application Object

Other resources

Application Object Members


Application.GoBack Method (Word)

 Copy code hover
[image]

Application.GoBack Method (Word)
See also Send feedback

Published: July 16, 2012

Moves the insertion point among the last three locations where editing occurred in the active document (the same as pressing SHIFT+F5).

Syntax

expression .GoBack

expression Required. A variable that represents an Application object.

Example

This example opens the most recently used file and then moves the insertion point to the location where editing last occurred.

VBA Copy code Copy code
RecentFiles(1).Open
Application.GoBack

See also

Concepts

Application Object

Other resources

Application Object Members


Application.GoForward Method (Word)

 Copy code hover
[image]

Application.GoForward Method (Word)
See also Send feedback

Published: July 16, 2012

Moves the insertion point forward among the last three locations where editing occurred in the active document.

Syntax

expression .GoForward

expression Required. A variable that represents an Application object.

Example

This example moves the insertion point to the next location where editing occurred.

VBA Copy code Copy code
Application.GoForward

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Help Method (Word)

 Copy code hover
[image]

Application.Help Method (Word)
See also Send feedback

Published: July 16, 2012

Displays installed Help information.

Syntax

expression .Help(HelpType)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
HelpType | Required | Variant | The on-line Help topic or window. Can be any of these WdHelpType constants: wdHelp, wdHelpAbout, wdHelpActiveWindow, wdHelpContents, wdHelpHWP, wdHelpIchitaro, wdHelpIndex, wdHelpPE2, wdHelpPSSHelp, wdHelpSearch, wdHelpUsingHelp. (Some of the constants listed here may not be available to you, depending on the language that you have selected or installed.)

Example

This example displays the Help Topics dialog box.

VBA Copy code Copy code
Help HelpType:=wdHelp

This example displays a list of Help topics that describe how to use Help.

VBA Copy code Copy code
Help HelpType:=wdHelpUsingHelp

See also

Concepts

Application Object

Other resources

Application Object Members


Application.HelpTool Method (Word)

 Copy code hover
[image]

Application.HelpTool Method (Word)
See also Send feedback

Published: July 16, 2012

Caution note Caution

This object, member, or enumeration is deprecated and is not intended to be used in your code.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.InchesToPoints Method (Word)

 Copy code hover
[image]

Application.InchesToPoints Method (Word)
See also Send feedback

Published: July 16, 2012

Converts a measurement from inches to points (1 inch = 72 points). Returns the converted measurement as a Single.

Syntax

expression .InchesToPoints(Inches)

expression A variable that represents an Application object. Optional.

Parameters

Name | Required/Optional | Data Type | Description
Inches | Required | Single | The inch value to be converted to points.

Example

This example sets the space before for the selected paragraphs to 0.25 inch.

VBA Copy code Copy code
Selection.ParagraphFormat.SpaceBefore = InchesToPoints(0.25)

This example prints each open document after setting the left and right margins to 0.65 inch.

VBA Copy code Copy code
Dim docLoop As Document

For Each docLoop in Documents
 With docLoop
 .PageSetup.LeftMargin = InchesToPoints(0.65)
 .PageSetup.RightMargin = InchesToPoints(0.65)
 .PrintOut
 End With
Next docLoop

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Keyboard Method (Word)

 Copy code hover
[image]

Application.Keyboard Method (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the keyboard language and layout settings.

Syntax

expression .Keyboard(LangId)

expression Required. A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
LangId | Optional | Long | The language and layout combination to which Microsoft Word sets the keyboard. If this argument is omitted, the method returns the current language and layout setting.

Remarks

Microsoft Windows tracks keyboard language and layout settings using a variable type called an input language handle, often referred to as an HKL. The low word of the handle is a language ID, and the high word is a handle to a keyboard layout.

Example

This example assigns the current keyboard language and layout setting to a variable.

VBA Copy code Copy code
Dim lngKeyboard As Long

lng
VBA Copy code Copy code
Keyboard = Application.Keyboard

See also

Concepts

Application Object

Other resources

Application Object Members


Application.KeyboardBidi Method (Word)

 Copy code hover
[image]

Application.KeyboardBidi Method (Word)
See also Send feedback

Published: July 16, 2012

Sets the keyboard language to a right-to-left language and the text entry direction to right-to-left.

Syntax

expression .KeyboardBidi

expression Required. A variable that represents an Application object.

Example

This example configures the keyboard for right-to-left language entry.

VBA Copy code Copy code
Application.KeyboardBidi

See also

Concepts

Application Object

Other resources

Application Object Members


Application.KeyboardLatin Method (Word)

 Copy code hover
[image]

Application.KeyboardLatin Method (Word)
See also Send feedback

Published: July 16, 2012

Sets the keyboard language to a left-to-right language and the text entry direction to left-to-right.

Syntax

expression .KeyboardLatin

expression Required. A variable that represents an Application object.

Example

This example configures the keyboard for left-to-right language entry.

VBA Copy code Copy code
Application.KeyboardLatin

See also

Concepts

Application Object

Other resources

Application Object Members


Application.KeyString Method (Word)

 Copy code hover
[image]

Application.KeyString Method (Word)
See also Send feedback

Published: July 16, 2012

Returns the key combination string for the specified keys (for example, CTRL+SHIFT+A).

Syntax

expression .KeyString(KeyCode, KeyCode2)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
KeyCode | Required | Long | A key you specify by using one of the WdKey constants.
KeyCode2 | Optional | Variant | A second key you specify by using one of the WdKey constants.

Return Value

String

Remarks

You can use the BuildKeyCode method to create the KeyCode or KeyCode2 argument.

Example

This example displays the key combination string (CTRL+SHIFT+A) for the following WdKey constants: wdKeyControl, wdKeyShift, and wdKeyA.

VBA Copy code Copy code
CustomizationContext = ActiveDocument.AttachedTemplate
MsgBox KeyString(KeyCode:=BuildKeyCode(wdKeyControl, _
 wdKeyShift, wdKeyA))

See also

Concepts

Application Object

Other resources

Application Object Members


Application.LinesToPoints Method (Word)

 Copy code hover
[image]

Application.LinesToPoints Method (Word)
See also Send feedback

Published: July 16, 2012

Converts a measurement from lines to points (1 line = 12 points). Returns the converted measurement as a Single.

Syntax

expression .LinesToPoints(Lines)

expression A variable that represents an Application object. Optional.

Parameters

Name | Required/Optional | Data Type | Description
Lines | Required | Single | The line value to be converted to points.

Return Value

Single

Example

This example sets the paragraph line spacing in the selection to three lines.

VBA Copy code Copy code
With Selection.ParagraphFormat
 .LineSpacingRule = wdLineSpaceMultiple
 .LineSpacing = LinesToPoints(3)
End With

See also

Concepts

Application Object

Other resources

Application Object Members


Application.ListCommands Method (Word)

 Copy code hover
[image]

Application.ListCommands Method (Word)
See also Send feedback

Published: July 16, 2012

Creates a new document and then inserts a table of Word commands along with their associated shortcut keys and menu assignments.

Syntax

expression .ListCommands(ListAllCommands)

expression Required. A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
ListAllCommands | Required | Boolean | True to include all Word commands and their assignments (whether customized or built-in). False to include only commands with customized assignments.

Example

This example creates a new document that lists all Word commands along with their associated shortcut keys and menu assignments. The example then prints and closes the new document without saving changes.

VBA Copy code Copy code
Application.ListCommands ListAllCommands:=True
With ActiveDocument
 .PrintOut
 .Close SaveChanges:=wdDoNotSaveChanges
End With

See also

Concepts

Application Object

Other resources

Application Object Members


Application.LoadMasterList Method (Word)

 Copy code hover
[image]

Application.LoadMasterList Method (Word)
See also Send feedback

Published: July 16, 2012

Loads a bibliography source file.

Syntax

expression .LoadMasterList(FileName)

expression An expression that returns an Application object.

Parameters

Name | Required/Optional | Data Type | Description
FileName | Required | String | The path and file name of the bibliography source file.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.LookupNameProperties Method (Word)

 Copy code hover
[image]

Application.LookupNameProperties Method (Word)
See also Send feedback

Published: July 16, 2012

Looks up a name in the global address book list and displays the Properties dialog box, which includes information about the specified name.

Syntax

expression .LookupNameProperties(Name)

expression Required. A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Name | Required | String | A name in the global address book.

Remarks

If this method finds more than one match, it displays the Check Names dialog box.

Example

This example looks up the name Don Funk in the address book and displays the Properties dialog box for Don Funk.

VBA Copy code Copy code
Application.LookupNameProperties Name:="Don Funk"

See also

Concepts

Application Object

Other resources

Application Object Members


Application.MergeDocuments Method (Word)

 Copy code hover
[image]

Application.MergeDocuments Method (Word)
See also Send feedback

Published: July 16, 2012

Compares two documents and returns a Document object that represents the document that contains the differences between the two documents, marked using tracked changes.

Syntax

expression .MergeDocuments(OriginalDocument, RevisedDocument, Destination, Granularity, CompareFormatting, CompareCaseChanges, CompareWhitespace, CompareTables, CompareHeaders, CompareFootnotes, CompareTextboxes, CompareFields, CompareComments, OriginalAuthor, RevisedAuthor, FormatFrom)

expression An expression that returns an Application object.

Parameters

Name | Required/Optional | Data Type | Description
OriginalDocument | Required | Document | Specifies the path and file name of the original document.
RevisedDocument | Required | Document | Specifies the path and file name of the revised document to which to compare the original document.
Destination | Optional | WdCompareDestination | Specifies whether to create a new file or whether to mark the differences between the two documents in the original document or in the revised document. Default value is wdCompareDestinationNew.
Granularity | Optional | WdGranularity | Specifies whether changes are tracked by character or by word. Default value is wdGranularityWordLevel.
CompareFormatting | Optional | Boolean | Specifies whether to mark differences in formatting between the two documents. Default value is True.
CompareCaseChanges | Optional | Boolean | Specifies whether to mark differences in case between the two documents. Default value is True.
CompareWhitespace | Optional | Boolean | Specifies whether to mark differences in white space, such as paragraphs or spaces, between the two documents. Default value is True.
CompareTables | Optional | Boolean | Specifies whether to compare the differences in data contained in tables between the two documents. Default value is True.
CompareHeaders | Optional | Boolean | Specifies whether to compare differences in headers and footers between the two documents. Default value is True.
CompareFootnotes | Optional | Boolean | Specifies whether to compare differences in footnotes and endnotes between the two documents. Default value is True.
CompareTextboxes | Optional | Boolean | Specifies whether to compare differences in the data contained within text boxes between the two documents. Default value is True.
CompareFields | Optional | Boolean | Specifies whether to compare differences in fields between the two documents. Default value is True.
CompareComments | Optional | Boolean | Specifies whether to compare differences in comments between the two documents. Default value is True.
OriginalAuthor | Optional | String | Specifies the name of the author of the original document.
RevisedAuthor | Optional | String | Specifies the name of the person to use for unattributed changes after merging two documents.
FormatFrom | Optional | WdMergeFormatFrom | Specifies the document from which to retain formatting.

Return Value

Document

See also

Concepts

Application Object

Other resources

Application Object Members


Application.MillimetersToPoints Method (Word)

 Copy code hover
[image]

Application.MillimetersToPoints Method (Word)
See also Send feedback

Published: July 16, 2012

Converts a measurement from millimeters to points (1 mm = 2.85 points). Returns the converted measurement as a Single.

Syntax

expression .MillimetersToPoints(Millimeters)

expression A variable that represents an Application object. Optional.

Parameters

Name | Required/Optional | Data Type | Description
Millimeters | Required | Single | The millimeter value to be converted to points.

Return Value

Single

Example

This example sets the hyphenation zone in the active document to 8.8 millimeters.

VBA Copy code Copy code
ActiveDocument.HyphenationZone = MillimetersToPoints(8.8)

This example expands the spacing of the selected characters to 2.8 points.

VBA Copy code Copy code
Selection.Font.Spacing = MillimetersToPoints(1)

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Move Method (Word)

 Copy code hover
[image]

Application.Move Method (Word)
See also Send feedback

Published: July 16, 2012

Positions a task window or the active document window.

Syntax

expression .Move(Left, Top)

expression Required. A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Left | Required | Long | The horizontal screen position of the specified window.
Top | Required | Long | The vertical screen position of the specified window.

Example

This example starts the Calculator application (Calc.exe) and uses the Move method to reposition the application window.

VBA Copy code Copy code
Shell "Calc.exe"
With Tasks("Calculator")
 .WindowState = wdWindowStateNormal
 .Move Top:=50, Left:=50
End With

See also

Concepts

Application Object

Other resources

Application Object Members


Application.NewWindow Method (Word)

 Copy code hover
[image]

Application.NewWindow Method (Word)
See also Send feedback

Published: July 16, 2012

Opens a new window with the same document as the specified window. Returns a Window object.

Syntax

expression .NewWindow

expression Required. A variable that represents an Application object.

Return Value

Window

Remarks

A colon (:) and a number appear in the window caption when more than one window is open for a document. If the NewWindow method is used with the Application object, a new window is opened for the active window. The following two instructions are functionally equivalent.

VBA Copy code Copy code
Set myWindow = ActiveDocument.ActiveWindow.NewWindow
Set myWindow = NewWindow

Example

This example posts a message that indicates the number of windows that exist before and after you open a new window for Document1.

VBA Copy code Copy code
MsgBox Windows.Count & " windows open"
Windows("Document1").NewWindow
MsgBox Windows.Count & " windows open"

This example opens a new window, arranges all the open windows, closes the new window, and then rearranges the open windows.

VBA Copy code Copy code
Set myWindow = NewWindow
Windows.Arrange ArrangeStyle:=wdTiled
myWindow.Close
Windows.Arrange ArrangeStyle:=wdTiled

See also

Concepts

Application Object

Other resources

Application Object Members


Application.NextLetter Method (Word)

 Copy code hover
[image]

Application.NextLetter Method (Word)
See also Send feedback

Published: July 16, 2012

You have requested Help for a Visual Basic keyword used only on the Macintosh. For information about the NextLetter method of the Application object, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.OnTime Method (Word)

 Copy code hover
[image]

Application.OnTime Method (Word)
See also Send feedback

Published: July 16, 2012

Starts a background timer that runs a macro at a specified time.

Syntax

expression .OnTime(When, Name, Tolerance)

expression Required. A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
When | Required | Variant | The time at which the macro is to be run.
Name | Required | String | The name of the macro to be run.
Tolerance | Optional | Variant | The maximum time (in seconds) that can elapse before a macro that was not run at the time specified by When is canceled. Macros may not always run at the specified time. For example, if a sort operation is under way or a dialog box is being displayed, the macro will be delayed until Word has completed the task. If this argument is 0 (zero) or omitted, the macro is run regardless of how much time has elapsed since the time specified by When.

Remarks

The When parameter can be a string that specifies a time (for example, "4:30 pm" or "16:30"), or it can be a serial number returned by a function such as TimeValue or TimeSerial (for example, TimeValue("2:30 pm") or TimeSerial(14, 30, 00)). You can also include the date (for example, "6/30 4:15 pm" or TimeValue("6/30 4:15 pm")).

For the Name parameter, use the complete macro path to ensure that the correct macro is run (for example, "Project.Module1.Macro1"). For the macro to run, the document or template must be available both when the OnTime instruction is run and when the time specified by When arrives. For this reason, it is best to store the macro in Normal.dot or another global template that's loaded automatically.

Use the sum of the return values of the Now function and either the TimeValue or TimeSerial function to set a timer to run a macro a specified amount of time after the statement is run. For example, use Now+TimeValue("00:05:30") to run a macro 5 minutes and 30 seconds after the statement is run.

Word can maintain only one background timer set by OnTime. If you start another timer before an existing timer runs, the existing timer is canceled.

Example

This example runs the macro named "Macro1" in the current module at 3:55 P.M.

VBA Copy code Copy code
Application.OnTime When:="15:55:00", Name:="Macro1"

This example runs the macro named "Macro1" 15 seconds from the time the example is run. The macro name includes the project and module name.

VBA Copy code Copy code
Application.OnTime When:=Now + TimeValue("00:00:15"), _
 Name:="Project1.Module1.Macro1"

This example runs the macro named "Start" at 1:30 P.M. The macro name includes the project and module name.

VBA Copy code Copy code
Application.OnTime When:=TimeValue("1:30 pm"), _
 Name:="VBAProj.Module1.Start"

See also

Concepts

Application Object

Other resources

Application Object Members


Application.OrganizerCopy Method (Word)

 Copy code hover
[image]

Application.OrganizerCopy Method (Word)
See also Send feedback

Published: July 16, 2012

Copies the specified AutoText entry, toolbar, style, or macro project item from the source document or template to the destination document or template.

Syntax

expression .OrganizerCopy(Source, Destination, Name, Object)

expression Required. A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Source | Required | String | The document or template file name that contains the item you want to copy.
Destination | Required | String | The document or template file name to which you want to copy an item.
Name | Required | String | The name of the AutoText entry, toolbar, style, or macro you want to copy.
Object | Required | WdOrganizerObject | The kind of item you want to copy.

Example

This example copies all the AutoText entries in the template attached to the active document to the Normal template.

VBA Copy code Copy code
Dim atEntry As AutoTextEntry

For Each atEntry In _
 ActiveDocument.AttachedTemplate.AutoTextEntries
 Application.OrganizerCopy _
 Source:=ActiveDocument.AttachedTemplate.FullName, _
 Destination:=NormalTemplate.FullName, Name:=atEntry.Name, _
 Object:=wdOrganizerObjectAutoText
Next atEntry

If the style named "SubText" exists in the active document, this example copies the style to C:\Templates\Template1.dot.

VBA Copy code Copy code
Dim styleLoop As Style

For Each styleLoop In ActiveDocument.Styles
 If styleLoop = "SubText" Then
 Application.OrganizerCopy Source:=ActiveDocument.Name, _
 Destination:="C:\Templates\Template1.dot", _
 Name:="SubText", _
 Object:=wdOrganizerObjectStyles
 End If
Next styleLoop

See also

Concepts

Application Object

Other resources

Application Object Members


Application.OrganizerDelete Method (Word)

 Copy code hover
[image]

Application.OrganizerDelete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the specified style, AutoText entry, toolbar, or macro project item from a document or template.

Syntax

expression .OrganizerDelete(Source, Name, Object)

expression Required. A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Source | Required | String | The file name of the document or template that contains the item you want to delete.
Name | Required | String | The name of the style, AutoText entry, toolbar, or macro you want to delete.
Object | Required | WdOrganizerObject | The kind of item you want to copy.

Example

This example deletes the toolbar named "Custom 1" from the Normal template.

VBA Copy code Copy code
Dim cbLoop As CommandBar

For Each cbLoop In CommandBars
 If cbLoop.Name = "Custom 1" Then
 Application.OrganizerDelete Source:=NormalTemplate.Name, _
 Name:="Custom 1", _
 Object:=wdOrganizerObjectCommandBars
 End If
Next cbLoop

This example prompts the user to delete each AutoText entry in the template attached to the active document. If the user clicks the Yes button, the AutoText entries are deleted.

VBA Copy code Copy code
Dim atEntry As AutoTextEntry
Dim intResponse As Integer

For Each atEntry In _
 ActiveDocument.AttachedTemplate.AutoTextEntries
 intResponse = _
 MsgBox("Do you want to delete the " & atEntry.Name _
 & " AutoText entry?", vbYesNoCancel)
 If intResponse = vbYes Then
 With ActiveDocument.AttachedTemplate
 Application.OrganizerDelete _
 Source:= .Path & "\" & .Name, _
 Name:=atEntry.Name, _
 Object:=wdOrganizerObjectAutoText
 End With
 ElseIf intResponse = vbCancel Then
 Exit For
 End If
Next atEntry

See also

Concepts

Application Object

Other resources

Application Object Members


Application.OrganizerRename Method (Word)

 Copy code hover
[image]

Application.OrganizerRename Method (Word)
See also Send feedback

Published: July 16, 2012

Renames the specified style, AutoText entry, toolbar, or macro project item in a document or template.

Syntax

expression .OrganizerRename(Source, Name, NewName, Object)

expression Required. A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Source | Required | String | The file name of the document or template that contains the item you want to rename.
Name | Required | String | The name of the style, AutoText entry, toolbar, or macro you want to rename.
NewName | Required | String | The new name for the item.
Object | Required | WdOrganizerObject | The kind of item you want to copy.

Example

This example changes the name of the style named "SubText" in the active document to "SubText2."

VBA Copy code Copy code
Dim styleLoop as Style

For Each styleLoop In ActiveDocument.Styles
 If styleLoop.NameLocal = "SubText" Then
 Application.OrganizerRename _
 Source:=ActiveDocument.Name, Name:="SubText", _
 NewName:="SubText2", _
 Object:=wdOrganizerObjectStyles
 End If
Next styleLoop

This example changes the name of the macro module named "Module1" in the attached template to "Macros1."

VBA Copy code Copy code
Dim dotTemp As Template

dotTemp = ActiveDocument.AttachedTemplate.Name
Application.OrganizerRename Source:=dotTemp, Name:="Module1", _
 NewName:="Macros1", Object:=wdOrganizerObjectProjectItems

See also

Concepts

Application Object

Other resources

Application Object Members


Application.PicasToPoints Method (Word)

 Copy code hover
[image]

Application.PicasToPoints Method (Word)
See also Send feedback

Published: July 16, 2012

Converts a measurement from picas to points (1 pica = 12 points). Returns the converted measurement as a Single.

Syntax

expression .PicasToPoints(Picas)

expression A variable that represents an Application object. Optional.

Parameters

Name | Required/Optional | Data Type | Description
Picas | Required | Single | The pica value to be converted to points.

Return Value

Single

Example

This example adds line numbers to the active document and sets the distance between the line numbers and the document text to 4 picas.

VBA Copy code Copy code
With ActiveDocument.PageSetup.LineNumbering
 .Active = True
 .DistanceFromText = PicasToPoints(4)
End With

This example sets the first-line indent for the selected paragraphs to 3 picas.

VBA Copy code Copy code
Selection.ParagraphFormat.FirstLineIndent = PicasToPoints(3)

See also

Concepts

Application Object

Other resources

Application Object Members


Application.PixelsToPoints Method (Word)

 Copy code hover
[image]

Application.PixelsToPoints Method (Word)
See also Send feedback

Published: July 16, 2012

Converts a measurement from pixels to points. Returns the converted measurement as a Single.

Syntax

expression .PixelsToPoints(Pixels, fVertical)

expression Required. A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Pixels | Required | Single | The pixel value to be converted to points.
fVertical | Optional | Variant | True to convert vertical pixels; False to convert horizontal pixels.

Return Value

Single

Example

This example displays the height and width in points of an object measured in pixels.

VBA Copy code Copy code
MsgBox "320x240 pixels is equivalent to " _
 & PixelsToPoints(320, False) & "x" _
 & PixelsToPoints(240, True) _
 & " points on this display."

See also

Concepts

Application Object

Other resources

Application Object Members


Application.PointsToCentimeters Method (Word)

 Copy code hover
[image]

Application.PointsToCentimeters Method (Word)
See also Send feedback

Published: July 16, 2012

Converts a measurement from points to centimeters (1 centimeter = 28.35 points). Returns the converted measurement as a Single.

Syntax

expression .PointsToCentimeters(Points)

expression A variable that represents an Application object. Optional.

Parameters

Name | Required/Optional | Data Type | Description
Points | Required | Single | The measurement, in points.

Return Value

Single

Example

This example converts a measurement of 30 points to the corresponding number of centimeters.

VBA Copy code Copy code
MsgBox PointsToCentimeters(30) & " centimeters"

This example converts the value of the variable sngData (a measurement in points) to centimeters, inches, lines, millimeters, or picas, depending on the value of the variable intUnit (a value from 1 through 5 that indicates the resulting unit of measurement).

VBA Copy code Copy code
Function ConvertPoints(ByVal intUnit As Integer, _
 sngData As Single) As Single

 Select Case intUnit
 Case 1
 ConvertPoints = PointsToCentimeters(sngData)
 Case 2
 ConvertPoints = PointsToInches(sngData)
 Case 3
 ConvertPoints = PointsToLines(sngData)
 Case 4
 ConvertPoints = PointsToMillimeters(sngData)
 Case 5
 ConvertPoints = PointsToPicas(sngData)
 Case Else
 Error 5
 End Select

End Function

See also

Concepts

Application Object

Other resources

Application Object Members


Application.PointsToInches Method (Word)

 Copy code hover
[image]

Application.PointsToInches Method (Word)
See also Send feedback

Published: July 16, 2012

Converts a measurement from points to inches (1 inch = 72 points). Returns the converted measurement as a Single.

Syntax

expression .PointsToInches(Points)

expression A variable that represents an Application object. Optional.

Parameters

Name | Required/Optional | Data Type | Description
Points | Required | Single | The measurement, in points.

Return Value

Single

Example

This example converts the measurement of the top margin for the active document to inches and displays the result in a message box.

VBA Copy code Copy code
MsgBox PointsToInches(ActiveDocument.Sections(1) _
 .PageSetup.TopMargin)

This example converts the value of the variable sngData (a measurement in points) to centimeters, inches, lines, millimeters, or picas, depending on the value of the variable intUnit (a value from 1 through 5 that indicates the resulting unit of measurement).

VBA Copy code Copy code
Function ConvertPoints(ByVal intUnit As Integer, _
 sngData As Single) As Single

 Select Case intUnit
 Case 1
 ConvertPoints = PointsToCentimeters(sngData)
 Case 2
 ConvertPoints = PointsToInches(sngData)
 Case 3
 ConvertPoints = PointsToLines(sngData)
 Case 4
 ConvertPoints = PointsToMillimeters(sngData)
 Case 5
 ConvertPoints = PointsToPicas(sngData)
 Case Else
 Error 5
 End Select

End Function

See also

Concepts

Application Object

Other resources

Application Object Members


Application.PointsToLines Method (Word)

 Copy code hover
[image]

Application.PointsToLines Method (Word)
See also Send feedback

Published: July 16, 2012

Converts a measurement from points to lines (1 line = 12 points). Returns the converted measurement as a Single.

Syntax

expression .PointsToLines(Points)

expression A variable that represents an Application object. Optional.

Parameters

Name | Required/Optional | Data Type | Description
Points | Required | Single | The measurement, in points.

Return Value

Single

Example

This example converts the line spacing value of the first paragraph in the selection from points to lines.

VBA Copy code Copy code
MsgBox PointsToLines(Selection.Paragraphs(1).LineSpacing) _
 & " lines"

This example converts the value of the variable sngData (a measurement in points) to centimeters, inches, lines, millimeters, or picas, depending on the value of the variable intUnit (a value from 1 through 5 that indicates the resulting unit of measurement).

VBA Copy code Copy code
Function ConvertPoints(ByVal intUnit As Integer, _
 sngData As Single) As Single

 Select Case intUnit
 Case 1
 ConvertPoints = PointsToCentimeters(sngData)
 Case 2
 ConvertPoints = PointsToInches(sngData)
 Case 3
 ConvertPoints = PointsToLines(sngData)
 Case 4
 ConvertPoints = PointsToMillimeters(sngData)
 Case 5
 ConvertPoints = PointsToPicas(sngData)
 Case Else
 Error 5
 End Select

End Function

See also

Concepts

Application Object

Other resources

Application Object Members


Application.PointsToMillimeters Method (Word)

 Copy code hover
[image]

Application.PointsToMillimeters Method (Word)
See also Send feedback

Published: July 16, 2012

Converts a measurement from points to millimeters (1 millimeter = 2.835 points). Returns the converted measurement as a Single.

Syntax

expression .PointsToMillimeters(Points)

expression A variable that represents an Application object. Optional.

Parameters

Name | Required/Optional | Data Type | Description
Points | Required | Single | The measurement, in points.

Return Value

Single

Example

This example converts 72 points to the corresponding number of millimeters.

VBA Copy code Copy code
MsgBox PointsToMillimeters(72) & " millimeters"

This example converts the value of the variable sngData (a measurement in points) to centimeters, inches, lines, millimeters, or picas, depending on the value of the variable intUnit (a value from 1 through 5 that indicates the resulting unit of measurement).

VBA Copy code Copy code
Function ConvertPoints(ByVal intUnit As Integer, _
 sngData As Single) As Single

 Select Case intUnit
 Case 1
 ConvertPoints = PointsToCentimeters(sngData)
 Case 2
 ConvertPoints = PointsToInches(sngData)
 Case 3
 ConvertPoints = PointsToLines(sngData)
 Case 4
 ConvertPoints = PointsToMillimeters(sngData)
 Case 5
 ConvertPoints = PointsToPicas(sngData)
 Case Else
 Error 5
 End Select

End Function

See also

Concepts

Application Object

Other resources

Application Object Members


Application.PointsToPicas Method (Word)

 Copy code hover
[image]

Application.PointsToPicas Method (Word)
See also Send feedback

Published: July 16, 2012

Converts a measurement from points to picas (1 pica = 12 points). Returns the converted measurement as a Single.

Syntax

expression .PointsToPicas(Points)

expression A variable that represents an Application object. Optional.

Parameters

Name | Required/Optional | Data Type | Description
Points | Required | Single | The measurement, in points.

Return Value

Single

Example

This example converts 36 points to the corresponding number of picas.

VBA Copy code Copy code
MsgBox PointsToPicas(36) & " picas"

This example converts the value of the variable sngData (a measurement in points) to centimeters, inches, lines, millimeters, or picas, depending on the value of the variable intUnit (a value from 1 through 5 that indicates the resulting unit of measurement).

VBA Copy code Copy code
Function ConvertPoints(ByVal intUnit As Integer, _
 sngData As Single) As Single

 Select Case intUnit
 Case 1
 ConvertPoints = PointsToCentimeters(sngData)
 Case 2
 ConvertPoints = PointsToInches(sngData)
 Case 3
 ConvertPoints = PointsToLines(sngData)
 Case 4
 ConvertPoints = PointsToMillimeters(sngData)
 Case 5
 ConvertPoints = PointsToPicas(sngData)
 Case Else
 Error 5
 End Select

End Function

See also

Concepts

Application Object

Other resources

Application Object Members


Application.PointsToPixels Method (Word)

 Copy code hover
[image]

Application.PointsToPixels Method (Word)
See also Send feedback

Published: July 16, 2012

Converts a measurement from points to pixels. Returns the converted measurement as a Single.

Syntax

expression .PointsToPixels(Points, fVertical)

expression Required. A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Points | Required | Single | The point value to be converted to pixels.
fVertical | Optional | Variant | True to return the result as vertical pixels; False to return the result as horizontal pixels.

Return Value

Single

Example

This example displays the height and width in pixels of an object measured in points.

VBA Copy code Copy code
MsgBox "180x120 points is equivalent to " _
 & PointsToPixels(180, False) & "x" _
 & PointsToPixels(120, True) _
 & " pixels on this display."

See also

Concepts

Application Object

Other resources

Application Object Members


Application.PrintOut Method (Word)

 Copy code hover
[image]

Application.PrintOut Method (Word)
See also Send feedback

Published: July 16, 2012

Prints all or part of the specified document.

Syntax

expression .PrintOut(Background, Append, Range, OutputFileName, From, To, Item, Copies, Pages, PageType, PrintToFile, Collate, FileName, ActivePrinterMacGX, ManualDuplexPrint, PrintZoomColumn, PrintZoomRow, PrintZoomPaperWidth, PrintZoomPaperHeight)

expression Required. A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Background | Optional | Variant | Set to True to have the macro continue while Microsoft Word prints the document.
Append | Optional | Variant | Set to True to append the specified document to the file name specified by the OutputFileName argument. False to overwrite the contents of OutputFileName.
Range | Optional | Variant | The page range. Can be any WdPrintOutRange constant.
OutputFileName | Optional | Variant | If PrintToFile is True, this argument specifies the path and file name of the output file.
From | Optional | Variant | The starting page number when Range is set to wdPrintFromTo.
To | Optional | Variant | The ending page number when Range is set to wdPrintFromTo.
Item | Optional | Variant | The item to be printed. Can be any WdPrintOutItem constant.
Copies | Optional | Variant | The number of copies to be printed.
Pages | Optional | Variant | The page numbers and page ranges to be printed, separated by commas. For example, "2, 6-10" prints page 2 and pages 6 through 10.
PageType | Optional | Variant | The type of pages to be printed. Can be any WdPrintOutPages constant.
PrintToFile | Optional | Variant | True to send printer instructions to a file. Make sure to specify a file name with OutputFileName.
Collate | Optional | Variant | When printing multiple copies of a document, True to print all pages of the document before printing the next copy.
FileName | Optional | Variant | The path and file name of the document to be printed. If this argument is omitted, Word prints the active document. (Available only with the Application object.)
ActivePrinterMacGX | Optional | Variant | This argument is available only in Microsoft Office Macintosh Edition. For additional information about this argument, consult the language reference Help included with Microsoft Office Macintosh Edition.
ManualDuplexPrint | Optional | Variant | True to print a two-sided document on a printer without a duplex printing kit. If this argument is True, the PrintBackground and PrintReverse properties are ignored. Use the PrintOddPagesInAscendingOrder and PrintEvenPagesInAscendingOrder properties to control the output during manual duplex printing. This argument may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.
PrintZoomColumn | Optional | Variant | The number of pages you want Word to fit horizontally on one page. Can be 1, 2, 3, or 4. Use with the PrintZoomRow argument to print multiple pages on a single sheet.
PrintZoomRow | Optional | Variant | The number of pages you want Word to fit vertically on one page. Can be 1, 2, or 4. Use with the PrintZoomColumn argument to print multiple pages on a single sheet.
PrintZoomPaperWidth | Optional | Variant | The width to which you want Word to scale printed pages, in twips (20 twips = 1 point; 72 points = 1 inch).
PrintZoomPaperHeight | Optional | Variant | The height to which you want Word to scale printed pages, in twips (20 twips = 1 point; 72 points = 1 inch).

Example

This example prints the current page of the active document.

VBA Copy code Copy code
ActiveDocument.PrintOut Range:=wdPrintCurrentPage

This example prints all the documents in the current folder. The Dir function is used to return all file names that have the file name extension ".doc".

VBA Copy code Copy code
adoc = Dir("*.DOC")
Do While adoc <> ""
 Application.PrintOut FileName:=adoc
 adoc = Dir()
Loop

This example prints the first three pages of the document in the active window.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.PrintOut _
 Range:=wdPrintFromTo, From:="1", To:="3"

This example prints the comments in the active document.

VBA Copy code Copy code
If ActiveDocument.Comments.Count >= 1 Then
 ActiveDocument.PrintOut Item:=wdPrintComments
End If

This example prints the active document, fitting six pages on each sheet.

VBA Copy code Copy code
ActiveDocument.PrintOut PrintZoomColumn:=3, _
 PrintZoomRow:=2

This example prints the active document at 75% of actual size.

VBA Copy code Copy code
ActiveDocument.PrintOut _
 PrintZoomPaperWidth:=0.75 * (8.5 * 1440), _
 PrintZoomPaperHeight:=0.75 * (11 * 1440)

See also

Concepts

Application Object

Other resources

Application Object Members


Application.ProductCode Method (Word)

 Copy code hover
[image]

Application.ProductCode Method (Word)
See also Send feedback

Published: July 16, 2012

Returns the Microsoft Word globally unique identifier (GUID) as a String.

Syntax

expression .ProductCode

expression Required. A variable that represents an Application object.

Return Value

String

Example

This example displays the GUID for Microsoft Word.

VBA Copy code Copy code
MsgBox Application.ProductCode

See also

Concepts

Application Object

Other resources

Application Object Members


Application.PutFocusInMailHeader Method (Word)

 Copy code hover
[image]

Application.PutFocusInMailHeader Method (Word)
See also Send feedback

Published: July 16, 2012

Places the insertion point in the To line of the mail header if the document in the active window is an e-mail document.

Syntax

expression .PutFocusInMailHeader

expression Required. A variable that represents an Application object.

Remarks

For best results, use the PutFocusInMailHeader method with the EnvelopeVisible property. When the EnvelopeVisible property is set to True, the PutFocusInMailHeader method will place the insertion point in the mail header.

Example

The following example displays the mail header for the active document and then place the insertion point in the To line of the mail header.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.EnvelopeVisible = True
Application.PutFocusInMailHeader

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Quit Method (Word)

 Copy code hover
[image]

Application.Quit Method (Word)
See also Send feedback

Published: July 16, 2012

Quits Microsoft Word and optionally saves or routes the open documents.

Syntax

expression .Quit(SaveChanges, Format, RouteDocument)

expression Required. A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
SaveChanges | Optional | Variant | Specifies whether Word saves changed documents before closing. Can be one of the WdSaveOptions constants.
OriginalFormat | Optional | Variant | Specifies the way Word saves documents whose original format was not Word Document format. Can be one of the WdOriginalFormat constants.
RouteDocument | Optional | Variant | True to route the document to the next recipient. If the document does not have a routing slip attached, this argument is ignored.

Example

This example closes Word and prompts the user to save each document that has changed since it was last saved.

VBA Copy code Copy code
Application.Quit SaveChanges:=wdPromptToSaveChanges

This example prompts the user to save all documents. If the user clicks Yes, all documents are saved in the Word format before Word closes.

VBA Copy code Copy code
Dim intResponse As Integer

intResponse = _
 MsgBox("Do you want to save all documents?", vbYesNo)
If intResponse = vbYes Then Application.Quit _
 SaveChanges:=wdSaveChanges, OriginalFormat:=wdWordDocument

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Repeat Method (Word)

 Copy code hover
[image]

Application.Repeat Method (Word)
See also Send feedback

Published: July 16, 2012

Repeats the most recent editing action one or more times. Returns True if the commands were repeated successfully.

Syntax

expression .Repeat(Times)

expression A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Times | Optional | Variant | The number of times you want to repeat the last command.

Return Value

Boolean

Remarks

Using this method is the equivalent to using the Repeat command on the Edit menu.

Example

This example inserts the text "Hello" followed by two paragraphs (the second typing action is repeated once).

VBA Copy code Copy code
Selection.TypeText "Hello"
Selection.TypeParagraph
Repeat

This example repeats the last command three times (if it can be repeated).

VBA Copy code Copy code
On Error Resume Next
If Repeat(3) = True Then StatusBar = "Action repeated"

See also

Concepts

Application Object

Other resources

Application Object Members


Application.ResetIgnoreAll Method (Word)

 Copy code hover
[image]

Application.ResetIgnoreAll Method (Word)
See also Send feedback

Published: July 16, 2012

Clears the list of words that were previously ignored during a spelling check.

Syntax

expression .ResetIgnoreAll

expression Required. A variable that represents an Application object.

Remarks

After you run this method, previously ignored words are checked along with all the other words. In order for the ResetIgnoreAll method to work, you must first set the SpellingChecked property to False.

Example

This example clears the list of words that were ignored during a previous spelling check and then begins a new spelling check on the active document.

VBA Copy code Copy code
Application.ResetIgnoreAll
ActiveDocument.SpellingChecked = False
ActiveDocument.CheckSpelling

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Resize Method (Word)

 Copy code hover
[image]

Application.Resize Method (Word)
See also Send feedback

Published: July 16, 2012

Sizes the Word application window or the specified task window.

Syntax

expression .Resize(Width, Height)

expression Required. A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
Width | Required | Long | The width of the window, in points.
Height | Required | Long | The height of the window, in points.

Remarks

If the window is maximized or minimized, an error occurs. Use the Width or Height property to set the window width and height independently.

Example

This example resizes the Microsoft Excel application window to 6 inches wide by 4 inches high.

VBA Copy code Copy code
If Tasks.Exists("Microsoft Excel") = True Then
 With Tasks("Microsoft Excel")
 .WindowState = wdWindowStateNormal
 .Resize Width:=InchesToPoints(6), Height:=InchesToPoints(4)
 End With
End If

This example resizes the Word application window to 7 inches wide by 6 inches high.

VBA Copy code Copy code
With Application
 .WindowState = wdWindowStateNormal
 .Resize Width:=InchesToPoints(7), Height:=InchesToPoints(6)
End With

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Run Method (Word)

 Copy code hover
[image]

Application.Run Method (Word)
See also Send feedback

Published: July 16, 2012

Runs a Visual Basic macro.

Syntax

expression .Run(MacroName, varg1, varg2, varg3, varg4, varg5, varg6, varg7, varg8, varg9, varg10, varg11, varg12, varg13, varg14, varg15, varg16, varg17, varg18, varg19, varg20, varg21, varg22, varg23, varg24, varg25, varg26, varg27, varg28, varg29, varg30)

expression Required. A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
MacroName | Required | String | The name of the macro.
varg1...varg30 | Optional | Variant | Macro parameter values. You can pass up to 30 parameter values to the specified macro.

Remarks

The MacroName parameter can be any combination of template, module, and macro name. For example, the following statements are all valid.

VBA Copy code Copy code
Application.Run "Normal.Module1.MAIN"
Application.Run "MyProject.MyModule.MyProcedure"
Application.Run "'My Document.doc'!ThisModule.ThisProcedure"

If you specify the document name, your code can only run macros in documents related to the current context — not just any macro in any document.

Although Visual Basic code can call a macro directly (without using the Run method), this method is useful when the macro name is stored in a variable. (For more information, see the example for this topic). The following three statements are functionally equivalent. The first two statements require a reference to Normal.dot, the project in which the called macro resides; the third statement, which uses the Run method, does not require a reference to the Normal.dot project.

VBA Copy code Copy code
Normal.Module2.Macro1
Call Normal.Module2.Macro1
Application.Run MacroName:="Normal.Module2.Macro1"

Example

This example prompts the user to enter a template name, module name, macro name, and parameter value, and then it runs that macro.

VBA Copy code Copy code
Dim strTemplate As String
Dim strModule As String
Dim strMacro As String
Dim strParameter As String

strTemplate = InputBox("Enter the template name")
strModule = InputBox("Enter the module name")
strMacro = InputBox("Enter the macro name")
strParameter = InputBox("Enter a parameter value")
Application.Run MacroName:=strTemplate & "." _
 & strModule & "." & strMacro, _
 varg1:=strParameter

See also

Concepts

Application Object

Other resources

Application Object Members


Application.ScreenRefresh Method (Word)

 Copy code hover
[image]

Application.ScreenRefresh Method (Word)
See also Send feedback

Published: July 16, 2012

Updates the display on the monitor with the current information in the video memory buffer.

Syntax

expression .ScreenRefresh

expression Required. A variable that represents an Application object.

Remarks

You can use this method after using the ScreenUpdating property to disable screen updates. ScreenRefresh turns on screen updating for just one instruction and then immediately turns it off. Subsequent instructions don't update the screen until screen updating is turned on again with the ScreenUpdating property.

Example

This example turns off screen updating, opens Test.doc, inserts text, refreshes the screen, and then closes the document (with changes saved).

VBA Copy code Copy code
Dim rngTemp As Range

ScreenUpdating = False
Documents.Open FileName:="C:\DOCS\TEST.DOC"

Set rngTemp = ActiveDocument.Range(Start:=0, End:=0)

rngTemp.InsertBefore "new"
Application.ScreenRefresh
ActiveDocument.Close SaveChanges:=wdSaveChanges
ScreenUpdating = True

See also

Concepts

Application Object

Other resources

Application Object Members


Application.SetDefaultTheme Method (Word)

 Copy code hover
[image]

Application.SetDefaultTheme Method (Word)
See also Send feedback

Published: July 16, 2012

Sets a default theme for Microsoft Word to use with new documents, e-mail messages, or Web pages.

Syntax

expression .SetDefaultTheme(Name, DocumentType)

expression Required. A variable that represents an Application object.

Parameters

Name

Required/Optional

Data Type

Description

Name

Required

String

The name of the theme you want to assign as the default theme plus any theme formatting options you want to apply. The format of this string is "themennn" where theme and nnn are defined as follows:

String | Description
theme | The name of the folder that contains the data for the requested theme. (The default location for theme data folders is C:\Program Files\Common Files\Microsoft Shared\Themes.) You must use the folder name for the theme rather than the display name that appears in the Theme dialog box (Theme command, Format menu).
nnn | A three-digit string that indicates which theme formatting options to activate (1 to activate, 0 to deactivate). The digits correspond to the Vivid Colors, Active Graphics, and Background Image check boxes in the Theme dialog box (Theme command, Format menu). If this string is omitted, the default value for nnn is "011" (Active Graphics and Background Image are activated).

DocumentType

Required

WdDocumentMedium

The type of new document to which you are assigning a default theme.

Remarks

Setting a default theme will not apply that theme to the blank document automatically created when you start Word. Any new documents you create after that will have the default theme.

You can also use the ThemeName property to return and set the default theme for new e-mail messages.

Example

This example specifies that Microsoft Word use the Blueprint theme for all new e-mail messages.

VBA Copy code Copy code
Application.SetDefaultTheme "blueprnt", wdEmailMessage

This example specifies that Word use the Expedition theme with Active Graphics for all new Web pages.

VBA Copy code Copy code
Application.SetDefaultTheme "expeditn 010", wdWebPage

See also

Concepts

Application Object

Other resources

Application Object Members


Application.ShowClipboard Method (Word)

 Copy code hover
[image]

Application.ShowClipboard Method (Word)
See also Send feedback

Published: July 16, 2012

Displays the Clipboard task pane.

Syntax

expression .ShowClipboard

expression Required. A variable that represents an Application object.

Example

The following example shows the Clipboard task pane.

VBA Copy code Copy code
Application.ShowClipboard

See also

Concepts

Application Object

Other resources

Application Object Members


Application.ShowMe Method (Word)

 Copy code hover
[image]

Application.ShowMe Method (Word)
See also Send feedback

Published: July 16, 2012

Caution note Caution

This object, member, or enumeration is deprecated and is not intended to be used in your code.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.SubstituteFont Method (Word)

 Copy code hover
[image]

Application.SubstituteFont Method (Word)
See also Send feedback

Published: July 16, 2012

Sets font-mapping options.

Syntax

expression .SubstituteFont(UnavailableFont, SubstituteFont)

expression Required. A variable that represents an Application object.

Parameters

Name | Required/Optional | Data Type | Description
UnavailableFont | Required | String | The name of a font not available on your computer that you want to map to a different font for display and printing.
SubstituteFont | Required | String | The name of a font available on your computer that you want to substitute for the unavailable font.

Remarks

You can find font-mapping options in the Font Substitution dialog box.

Example

This example substitutes Courier for CustomFont1.

VBA Copy code Copy code
Application.SubstituteFont UnavailableFont:= "CustomFont1", _
 SubstituteFont:= "Courier"

See also

Concepts

Application Object

Other resources

Application Object Members


Application.ToggleKeyboard Method (Word)

 Copy code hover
[image]

Application.ToggleKeyboard Method (Word)
See also Send feedback

Published: July 16, 2012

Switches the keyboard language setting between right-to-left and left-to-right languages.

Syntax

expression .ToggleKeyboard

expression Required. A variable that represents an Application object.

Example

This example asks the user whether to switch the keyboard language setting between right-to-left and left-to-right languages.

VBA Copy code Copy code
x = MsgBox("Switch the keyboard language setting?", vbYesNo)
If x = vbYes Then Application.ToggleKeyboard

See also

Concepts

Application Object

Other resources

Application Object Members


Application Events (Word)

 Copy code hover
[image]

Application Events (Word)
Send feedback

Published: July 16, 2012

This object has the following events:

Events

Name | Description
DocumentBeforeClose | Occurs immediately before any open document closes.
DocumentBeforePrint | Occurs before any open document is printed.
DocumentBeforeSave | Occurs before any open document is saved.
DocumentChange | Occurs when a new document is created, when an existing document is opened, or when another document is made the active document.
DocumentOpen | Occurs when a document is opened.
DocumentSync | This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.
EPostageInsert | Occurs when a user inserts electronic postage into a document.
EPostageInsertEx | Occurs when a user inserts electronic postage into a document.
EPostagePropertyDialog | Occurs when a user clicks the E-postage Properties (Labels and Envelopes dialog box) button or Print Electronic Postage button.
MailMergeAfterMerge | Occurs after all records in a mail merge have merged successfully.
MailMergeAfterRecordMerge | Occurs after each record in the data source successfully merges in a mail merge.
MailMergeBeforeMerge | Occurs when a merge is executed before any records merge.
MailMergeBeforeRecordMerge | Occurs as a merge is executed for the individual records in a merge.
MailMergeDataSourceLoad | Occurs when the data source is loaded for a mail merge.
MailMergeDataSourceValidate | Occurs when a user validates mail merge recipients by clicking Validate in the Mail Merge Recipients dialog box.
MailMergeDataSourceValidate2 | Occurs when a user validates mail merge recipients by clicking the Validate addresses link button in the Mail Merge Recipients dialog box.
MailMergeWizardSendToCustom | Occurs when the custom button is clicked during step six of the Mail Merge Wizard.
MailMergeWizardStateChange | Occurs when a user changes from a specified step to a specified step in the Mail Merge Wizard.
NewDocument | Occurs when a new document is created.
ProtectedViewWindowActivate | Occurs when any protected view window is activated.
ProtectedViewWindowBeforeClose | Occurs immediately before a protected view window or a document in a protected view window closes.
ProtectedViewWindowBeforeEdit | Occurs immediately before editing is enabled on the document in the specified protected view window.
ProtectedViewWindowDeactivate | Occurs when a protected view window is deactivated.
ProtectedViewWindowOpen | Occurs when a protected view window is opened.
ProtectedViewWindowSize |
Quit | Occurs when the user exits Microsoft Word.
WindowActivate | Occurs when any document window is activated.
WindowBeforeDoubleClick | Occurs when the editing area of a document window is double-clicked, before the default double-click action.
WindowBeforeRightClick | Occurs when the editing area of a document window is right-clicked, before the default right-click action.
WindowDeactivate | Occurs when any document window is deactivated.
WindowSelectionChange | Occurs when the selection changes in the active document window.
WindowSize | Occurs when the application window is resized or moved.
XMLSelectionChange | Occurs when the parent XML node of the current selection changes.
XMLValidationError | Occurs when there is a validation error in the document.


Application.DocumentBeforeClose Event (Word)

 Copy code hover
[image]

Application.DocumentBeforeClose Event (Word)
Send feedback

Published: July 16, 2012

Occurs immediately before any open document closes.

Syntax

Private Sub expression _DocumentBeforeClose(ByVal Doc As Document, Cancel As Boolean)

expression A variable that represents an Application object declared with events in a class module.

Parameters

Name | Required/Optional | Data Type | Description
Doc | Required | Document | The document that's being closed.
Cancel | Required | Boolean | False when the event occurs. If the event procedure sets this argument to True, the document doesn't close when the procedure is finished.

Remarks

For more information about using events with the Application object, see Using Events with the Application Object.

Example

This example prompts the user for a yes or no response before closing any document. This code must be placed in a class module, and an instance of the class must be correctly initialized to see this example work; see Using Events with the Application Object for directions on how to accomplish this.

VBA Copy code Copy code
Public WithEvents appWord as Word.Application

Private Sub appWord_DocumentBeforeClose _
        (ByVal Doc As Document, _
        Cancel As Boolean)

    Dim intResponse As Integer

    intResponse = MsgBox("Do you really " _
        & "want to close the document?", _
        vbYesNo)

    If intResponse = vbNo Then Cancel = True
End Sub


Application.DocumentBeforePrint Event (Word)

 Copy code hover
[image]

Application.DocumentBeforePrint Event (Word)
See also Send feedback

Published: July 16, 2012

Occurs before any open document is printed.

Syntax

Private Sub expression _DocumentBeforePrint(ByVal Doc As Document, Cancel As Boolean)

expression A variable that represents an Application object declared with events in a class module.

Parameters

Name | Required/Optional | Data Type | Description
Doc | Required | Document | The document that's being printed.
Cancel | Required | Boolean | False when the event occurs. If the event procedure sets this argument to True, the document isn't printed when the procedure is finished.

Remarks

For more information about using events with the Application object, see Using Events with the Application Object.

Example

This example prompts the user for a yes or no response before printing any document. This code must be placed in a class module, and an instance of the class must be correctly initialized to see this example work; see Using Events with the Application Object for directions on how to accomplish this.

VBA Copy code Copy code
Public WithEvents appWord as Word.Application

Private Sub appWord_DocumentBeforePrint _
 (ByVal Doc As Document, _
 Cancel As Boolean)

 Dim intResponse As Integer

 intResponse = MsgBox("Have you checked the " _
 & "printer for letterhead?", _
 vbYesNo)

 If intResponse = vbNo Then Cancel = True
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.DocumentBeforeSave Event (Word)

 Copy code hover
[image]

Application.DocumentBeforeSave Event (Word)
See also Send feedback

Published: July 16, 2012

Occurs before any open document is saved.

Syntax

Private Sub expression _DocumentBeforeSave(ByVal DocAs Document, SaveAsUIAs Boolean, CancelAs Boolean)

expression A variable that represents an Application object declared with events in a class module.

Parameters

Name | Required/Optional | Data Type | Description
Doc | Required | Document | The document that is being saved.
SaveAsUI | Required | Boolean | True if the Save As dialog box is displayed, whether to save a new document, in response to the Save command; or in response to the Save As command; or in response to the SaveAs or SaveAs2 method.
Cancel | Required | Boolean | False when the event occurs. If the event procedure sets this argument to True, the document is not saved when the procedure is finished.

Remarks

For more information about using events with the Application object, see Using Events with the Application Object.

Example

This example prompts the user for a yes or no response before saving any document. This code must be placed in a class module, and an instance of the class must be correctly initialized to see this example work; see Using Events with the Application Object for directions on how to accomplish this.

VBA Copy code Copy code
Public WithEvents appWord as Word.Application

Private Sub appWord_DocumentBeforeSave _
 (ByVal Doc As Document, _
 SaveAsUI As Boolean, _
 Cancel As Boolean)

 Dim intResponse As Integer

 intResponse = MsgBox("Do you really want to " _
 & "save the document?", _
 vbYesNo)

 If intResponse = vbNo Then Cancel = True
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.DocumentChange Event (Word)

 Copy code hover
[image]

Application.DocumentChange Event (Word)
See also Send feedback

Published: July 16, 2012

Occurs when a new document is created, when an existing document is opened, or when another document is made the active document.

Syntax

Private Sub expression _DocumentChange()

expression A variable that represents an Application object declared with events in a class module.

Remarks

For information about using events with the Application object, see Using Events with the Application Object.

Example

This example asks the user whether to save all the other open documents when the document focus changes. This code must be placed in a class module, and an instance of the class must be correctly initialized to see this example work; see Using Events with the Application Object for directions on how to accomplish this.

VBA Copy code Copy code
Public WithEvents appWord as Word.Application

Private Sub appWord_DocumentChange()
 Dim intResponse As Integer
 Dim strName As String
 Dim docLoop As Document

 intResponse = MsgBox("Save all other documents?", vbYesNo)

 If intResponse = vbYes Then
 strName = ActiveDocument.Name
 For Each docLoop In Documents
 With docLoop
 If .Name <> strName Then
 .Save
 End If
 End With
 Next docLoop
 End If
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.DocumentOpen Event (Word)

 Copy code hover
[image]

Application.DocumentOpen Event (Word)
See also Send feedback

Published: July 16, 2012

Occurs when a document is opened.

Syntax

Private Sub expression _DocumentOpen(ByVal Doc As Document)

expression A variable that represents an Application object declared with events in a class module.

Parameters

Name | Required/Optional | Data Type | Description
Doc | Required | Document | The document that's being opened.

Remarks

For more information about using events with the Application object, see Using Events with the Application Object.

Example

This example asks the user whether to save all other open documents when a document is opened. This code must be placed in a class module, and an instance of the class must be correctly initialized to see this example work; see Using Events with the Application Object for directions on how to accomplish this.

VBA Copy code Copy code
Public WithEvents appWord as Word.Application

Private Sub appWord_DocumentOpen(ByVal Doc As Document)
 Dim intResponse As Integer
 Dim strName As String
 Dim docLoop As Document

 intResponse = MsgBox("Save all other documents?", vbYesNo)

 If intResponse = vbYes Then
 strName = ActiveDocument.Name
 For Each docLoop In Documents
 With docLoop
 If .Name <> strName Then
 .Save
 End If
 End With
 Next docLoop
 End If
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.DocumentSync Event (Word)

 Copy code hover
[image]

Application.DocumentSync Event (Word)
See also Send feedback

Published: July 16, 2012

This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.

Syntax

Private Sub_DocumentSync(Doc, SyncEventType)

expression A variable that represents an Application object declared using the WithEvents keyword in a class module.

Parameters

Name | Required/Optional | Data Type | Description
Doc | Required | Document | The document being synchronized.
SyncEventType | Required | MsoSyncEventType | The status of the document synchronization.

Remarks

For information about using events with the Application object, see Using Events with the Application Object.

Example

The following example displays a message if the synchronization of a document in a Document Workspace fails.

VBA Copy code Copy code
Private Sub app_DocumentSync(ByVal Doc As Document, _
 ByVal SyncEventType As Office.MsoSyncEventType)

 If SyncEventType = msoSyncEventDownloadFailed Or _
 SyncEventType = msoSyncEventUploadFailed Then

 MsgBox "Document synchronization failed. " & _
 "Please contact your administrator " & vbCrLf & _
 "or try again later."

 End If

End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.EPostageInsert Event (Word)

 Copy code hover
[image]

Application.EPostageInsert Event (Word)
See also Send feedback

Published: July 16, 2012

Occurs when a user inserts electronic postage into a document.

Syntax

expression .Private Sub object_EPostageInsert(ByVal Doc As Document)

expression A variable that represents an Application object that has been declared with events in a class module. For information about using events with the Application object, see Using Events with the Application Object.

Parameters

Name | Required/Optional | Data Type | Description
Doc | Required | Document | The name of the document to which to add electronic postage.

Example

This example displays a message when electronic postage is inserted into a document.

VBA Copy code Copy code
Private Sub AppWord_EPostageInsert(ByVal Doc As Document)
 MsgBox "You just inserted electronic postage into your document."
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.EPostageInsertEx Event (Word)

 Copy code hover
[image]

Application.EPostageInsertEx Event (Word)
See also Send feedback

Published: July 16, 2012

Occurs when a user inserts electronic postage into a document.

Syntax

expression .EPostageInsertEx(Doc, cpDeliveryAddrStart, cpDeliveryAddrEnd, cpReturnAddrStart, cpReturnAddrEnd, xaWidth, yaHeight, bstrPrinterName, bstrPaperFeed, fPrint, fCancel)

expression A variable that represents an Application object that has been declared with events in a class module. For information about using events with the Application object, see Using Events with the Application Object.

Parameters

Name | Required/Optional | Data Type | Description
Doc | Required | Document | The document to which electronic postage is being added.
cpDeliveryAddrStart | Required | Long | The starting position in the document for the delivery address. Positioning corresponds to the value of the Start property for a Range object.
cpDeliveryAddrEnd | Required | Long | The ending position in the document for the delivery address. Positioning corresponds to the value of the End property for a Range object.
cpReturnAddrStart | Required | Long | The starting position in the document for the return address. Positioning corresponds to the value of the Start property for a Range object.
cpReturnAddrEnd | Required | Long | The ending position in the document for the return address. Positioning corresponds to the value of the End property for a Range object.
xaWidth | Required | Long | The width of the envelope in 1/1440-inch units.
yaHeight | Required | Long | The height of the envelope in 1/1440-inch units.
bstrPrinterName | Required | String | The name of the printer as specified on the Printing Options tab of the Envelope Options dialog box.
bstrPaperFeed | Required | String | The feed method as specified on the Printing Options tab of the Envelope Options dialog box.
fPrint | Required | Boolean | True if the user has specified to print the envelope. False if the user has specified to insert the envelope into the document.
fCancel | Required | Boolean | True cancels inserting the postage.

Example

The following example displays a message to the user. If the user cancels the message, then the action specified by the user is canceled.

VBA Copy code Copy code
Private Sub App_EPostageInsertEx(ByVal Doc As Document, ByVal cpDeliveryAddrStart As Long, _
 ByVal cpDeliveryAddrEnd As Long, ByVal cpReturnAddrStart As Long, _
 ByVal cpReturnAddrEnd As Long, ByVal xaWidth As Long, ByVal yaHeight As Long, _
 ByVal bstrPrinterName As String, ByVal bstrPaperFeed As String, _
 ByVal fPrint As Boolean, fCancel As Boolean)

 Dim intResponse As Integer

 If fPrint = True Then
 intResponse = MsgBox("Make sure the printer is ready to print an envelope." & vbCrLf & _
 "When the printer is ready, click OK.", vbOKCancel)

 If intResponse = vbCancel Then
 fCancel = True
 End If
 End If
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.EPostagePropertyDialog Event (Word)

 Copy code hover
[image]

Application.EPostagePropertyDialog Event (Word)
See also Send feedback

Published: July 16, 2012

Occurs when a user clicks the E-postage Properties (Labels and Envelopes dialog box) button or Print Electronic Postage button.

Syntax

expression .Private Sub object_EPostagePropertyDialog(ByVal Doc As Document)

expression A variable that represents an Application object that has been declared with events in a class module. For information about using events with the Application object, see Using Events with the Application Object.

Parameters

Name | Required/Optional | Data Type | Description
Doc | Required | Document | The name of the document to which to add electronic postage.

Remarks

This event allows a third-party software application to intercept and show their properties dialog box.

Example

This example displays a message when a user clicks either the Add Electronic Postage button or the Print Electronic Postage button.

VBA Copy code Copy code
Private Sub AppWord_EPostagePropertyDialog(ByVal Doc As Document)
 MsgBox "You have clicked a button to " & _
 "display the ePostage property dialog box."
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.MailMergeAfterMerge Event (Word)

 Copy code hover
[image]

Application.MailMergeAfterMerge Event (Word)
See also Send feedback

Published: July 16, 2012

Occurs after all records in a mail merge have merged successfully.

Syntax

expression .Private Sub object_MailMergeAfterMerge(ByVal Doc As Document, ByVal DocResult As Document)

expression A variable that represents an Application object that has been declared with events in a class module. For information about using events with the Application object, see Using Events with the Application Object.

Parameters

Name | Required/Optional | Data Type | Description
Doc | Required | Document | The mail merge main document.
DocResult | Required | Document | The document created from the mail merge

Example

This example displays a message stating that all records in the specified document are finished merging. If the document has been merged to a second document, the message includes the name of the new document. This example assumes that you have declared an application variable called MailMergeApp in your general declarations and have set the variable equal to the Word Application object.

VBA Copy code Copy code
Private Sub MailMergeApp_MailMergeAfterMerge(ByVal Doc As Document, _
 ByVal DocResult As Document)
 If DocResult Is Nothing Then
 MsgBox "Your mail merge on " & _
 Doc.Name & " is now finished."

 Else
 MsgBox "Your mail merge on " & _
 Doc.Name & " is now finished and " & _
 DocResult.Name & " has been created."
 End If
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.MailMergeAfterRecordMerge Event (Word)

 Copy code hover
[image]

Application.MailMergeAfterRecordMerge Event (Word)
See also Send feedback

Published: July 16, 2012

Occurs after each record in the data source successfully merges in a mail merge.

Syntax

expression .Private Sub object_MailMergeAfterRecordMerge(ByVal Doc As Document)

expression A variable that represents an Application object that has been declared with events in a class module. For information about using events with the Application object, see Using Events with the Application Object.

Parameters

Name | Required/Optional | Data Type | Description
Doc | Required | Document | The mail merge main document.

Example

This example displays a message with the value of the first and second fields in the record that has just finished merging. This example assumes that you have declared an application variable called MailMergeApp in your general declarations and have set the variable equal to the Word Application object.

VBA Copy code Copy code
Private Sub MailMergeApp_MailMergeAfterRecordMerge(ByVal Doc As Document)

 With Doc.MailMerge.DataSource
 MsgBox .DataFields(1).Value & " " & _
 .DataFields(2).Value & " is finished merging."
 End With

End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.MailMergeBeforeMerge Event (Word)

 Copy code hover
[image]

Application.MailMergeBeforeMerge Event (Word)
See also Send feedback

Published: July 16, 2012

Occurs when a merge is executed before any records merge.

Syntax

expression .Private Sub object_MailMergeBeforeMerge(ByVal Doc As Document, ByVal StartRecord As Long, ByVal EndRecord As Long, Cancel As Boolean)

expression A variable that represents an Application object that has been declared with events in a class module. For information about using events with the Application object, see Using Events with the Application Object.

Parameters

Name | Required/Optional | Data Type | Description
Doc | Required | Document | The mail merge main document.
StartRecord | Required | Long | The first record in the data source to include in the mail merge.
EndRecord | Required | Long | The last record in the data source to include in the mail merge.
EndRecord | Required | Boolean | True stops the mail merge process before it starts.

Example

This example displays a message before the mail merge process begins, asking the user if they want to continue. If the user clicks No, the merge process is canceled. This example assumes that you have declared an application variable called MailMergeApp in your general declarations and have set the variable equal to the Microsoft Word Application object.

VBA Copy code Copy code
Private Sub MailMergeApp_MailMergeBeforeMerge(ByVal Doc As Document, _
 ByVal StartRecord As Long, ByVal EndRecord As Long, _
 Cancel As Boolean)

 Dim intVBAnswer As Integer

 'Request whether the user wants to continue with the merge
 intVBAnswer = MsgBox("Mail Merge for " & _
 Doc.Name & " is now starting. " & _
 "Do you want to continue?", vbYesNo, "MailMergeBeforeMerge Event")

 'If users response to question is No, cancel the merge process
 'and deliver a message to the user stating the merge is canceled
 If intVBAnswer = vbNo Then
 Cancel = True
 MsgBox "You have canceled mail merge for " & _
 Doc.Name & "."
 End If

End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.MailMergeBeforeRecordMerge Event (Word)

 Copy code hover
[image]

Application.MailMergeBeforeRecordMerge Event (Word)
See also Send feedback

Published: July 16, 2012

Occurs as a merge is executed for the individual records in a merge.

Syntax

expression .Private Sub object_MailMergeBeforeRecordMerge(ByVal Doc As Document, Cancel As Boolean)

expression A variable that represents an Application object that has been declared with events in a class module. For information about using events with the Application object, see Using Events with the Application Object.

Parameters

Name | Required/Optional | Data Type | Description
Doc | Required | Document | The mail merge main document.
Cancel | Required | Boolean | True stops the mail merge process, for the current record only, before it starts.

Example

This example verifies that the length of the postal code, which in this example is field number six, is fewer than five digits and, if it is, cancels the merge only for that record. This example assumes that you have declared an application variable called MailMergeApp in your general declarations and have set the variable equal to the Microsoft Word Application object.

VBA Copy code Copy code
Private Sub MailMergeApp_MailMergeBeforeRecordMerge(ByVal _
 Doc As Document, Cancel As Boolean)

 Dim intZipLength As Integer

 intZipLength = Len(ActiveDocument.MailMerge _
 .DataSource.DataFields(6).Value)

 'Cancel merge of this record only if
 'the ZIP Code is fewer than five digits
 If intZipLength < 5 Then
 Cancel = True
 End If

End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.MailMergeDataSourceLoad Event (Word)

 Copy code hover
[image]

Application.MailMergeDataSourceLoad Event (Word)
See also Send feedback

Published: July 16, 2012

Occurs when the data source is loaded for a mail merge.

Syntax

expression .Private Sub object_MailMergeDataSourceLoad(ByVal Doc As Document)

expression A variable that represents an Application object that has been declared with events in a class module. For information about using events with the Application object, see Using Events with the Application Object.

Parameters

Name | Required/Optional | Data Type | Description
Doc | Required | Document | The mail merge main document.

Example

This example displays a message with the data source file name when the data source starts loading. This example assumes that you have declared an application variable called MailMergeApp in your general declarations and have set the variable equal to the Word Application object.

VBA Copy code Copy code
Private Sub MailMergeApp_MailMergeDataSourceLoad(ByVal Doc As Document)
 Dim strDSName As String
 Dim intDSLength As Integer
 Dim intDSStart As Integer

 'Extract from the Name property only the file name
 intDSLength = Len(Doc.MailMerge.DataSource.Name)
 intDSStart = InStrRev(Doc.MailMerge.DataSource.Name, "\")
 intDSStart = intDSLength - intDSStart
 strDSName = Right(Doc.MailMerge.DataSource.Name, intDSStart)

 'Deliver a message to user when data source is loading
 MsgBox "Your data source, " & strDSName & ", is now loading."
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.MailMergeDataSourceValidate Event (Word)

 Copy code hover
[image]

Application.MailMergeDataSourceValidate Event (Word)
See also Send feedback

Published: July 16, 2012

Occurs when a user validates mail merge recipients by clicking Validate in the Mail Merge Recipients dialog box.

Syntax

Private Sub expression _MailMergeDataSourceValidate(ByVal Doc As Document, Handled As Boolean)

expression A variable that represents an Application object that has been declared with events in a class module.

Parameters

Name | Required/Optional | Data Type | Description
Doc | Required | Document | The mail merge main document.
Handled | Required | Boolean | True if the add-in has handled the validation event. This is a forward-only parameter and cannot be set in code. To set this value, you must use the MailMergeDataSourceValidate2 event.

Remarks

If you do not have address verification software installed on your computer, the MailMergeDataSourceValidate event allows you to create simple filtering routines, such as looping through records to check the postal codes and removing any that are non-U.S.

Note Note

The Handled parameter does not function correctly in this version of the event; use the MailMergeDataSourceValidate2 event. In addition, you cannot raise this event from within a Microsoft Visual Basic for Applications (VBA) project. This event functions correctly only in COM add-ins. For managed add-ins and external applications, use the MailMergeDataSourceValidate2 event.

For information about using events with the Application object, see Using Events with the Application Object.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.MailMergeDataSourceValidate2 Event (Word)

 Copy code hover
[image]

Application.MailMergeDataSourceValidate2 Event (Word)
See also Send feedback

Published: July 16, 2012

Occurs when a user validates mail merge recipients by clicking the Validate addresses link button in the Mail Merge Recipients dialog box.

Version Information

Version Added: Word 2007

Syntax

expression .MailMergeDataSourceValidate2(Doc, Handled)

expression A variable that represents an Application object declared with events in a class module.

Parameters

Name | Required/Optional | Data Type | Description
Doc | Required | Document | The mail merge main document.
Handled | Required | Boolean | True if the add-in has handled the validation event.

Remarks

If you do not have address verification software installed on your computer, the MailMergeDataSourceValidate2 event allows you to create simple filtering routines, such as looping through records to check the postal codes and removing any that are non-U.S.

Note Note

You cannot raise this event from within a Microsoft Visual Basic for Applications (VBA) project. This event functions correctly only in managed add-ins and external applications. For COM add-ins, use the MailMergeDataSourceValidate event.

See also

Concepts

Application Object

Other resources

Application Object Members


Application.MailMergeWizardSendToCustom Event (Word)

 Copy code hover
[image]

Application.MailMergeWizardSendToCustom Event (Word)
See also Send feedback

Published: July 16, 2012

Occurs when the custom button is clicked during step six of the Mail Merge Wizard.

Syntax

Private Sub expression _MailMergeWizardSendToCustom(ByVal Doc As Document)

expression A variable that represents an Application object that has been declared with events in a class module.

Parameters

Name | Required/Optional | Data Type | Description
Doc | Required | Document | The mail merge main document.

Remarks

Use the ShowSendToCustom property to create a custom button on the sixth step of the Mail Merge Wizard.

For information about using events with the Application object, see Using Events with the Application Object.

Example

This example executes a merge to a fax machine when a user clicks the custom destination button. This example assumes that the user has access to a custom destination button, fax numbers are included for each record in the data source, and an application variable called MailMergeApp has been declared and set equal to the Word Application object.

VBA Copy code Copy code
Private Sub MailMergeApp_MailMergeWizardSendToCustom(ByVal Doc As Document)
 With Doc.MailMerge
 .Destination = wdSendToFax
 .Execute
 End With
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.MailMergeWizardStateChange Event (Word)

 Copy code hover
[image]

Application.MailMergeWizardStateChange Event (Word)
See also Send feedback

Published: July 16, 2012

Occurs when a user changes from a specified step to a specified step in the Mail Merge Wizard.

Syntax

expression .Private Sub object_MailMergeWizardStateChange(ByVal Doc As Document, FromState As Long, ToState As Long, Handled As Boolean)

expression A variable that represents an Application object that has been declared with events in a class module. For information about using events with the Application object, see Using Events with the Application Object.

Parameters

Name | Required/Optional | Data Type | Description
Doc | Required | Document | The mail merge main document.
FromState | Required | Long | The Mail Merge Wizard step from which a user is moving.
ToState | Required | Long | The Mail Merge Wizard step to which a user is moving.
Handled | Required | Boolean | True moves the user to the next step. False for the user to remain at the current step.

Example

This example displays a message when a user moves from step three of the Mail Merge Wizard to step four. Based on the answer to the message, the user will either move to step four or remain at step three. This example assumes that you have declared an application variable called MailMergeApp in your general declarations and have set the variable equal to the Word Application object.

VBA Copy code Copy code
Private Sub MailMergeApp_MailMergeWizardStateChange(ByVal Doc As Document, _
 FromState As Long, ToState As Long, Handled As Boolean)

 Dim intVBAnswer As Integer
 FromState = 3
 ToState = 4

 'Display a message when moving from step three to step four
 intVBAnswer = MsgBox("Have you selected all of your recipients?", _
 vbYesNo, "Wizard State Event!")

 If intVBAnswer = vbYes Then
 'Continue on to step four
 Handled = True
 Else
 'Return to step three
 MsgBox "Please select all recipients to whom " & _
 "you want to send this letter."
 Handled = False
 End If

End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.NewDocument Event (Word)

 Copy code hover
[image]

Application.NewDocument Event (Word)
See also Send feedback

Published: July 16, 2012

Occurs when a new document is created.

Syntax

Private Sub Application_NewDocument(ByVal Doc As Document)

expression A variable that represents an Application object that has been declared with events in a class module.

Parameters

Name | Required/Optional | Data Type | Description
Doc | Required | Document | The new document.

Remarks

For more information about using events with the Application object, see Using Events with the Application Object.

Example

This example asks the user whether to save all other open documents when a new document is created. This code must be placed in a class module, and an instance of the class must be correctly initialized to see this example work; see Using Events with the Application Object for directions on how to accomplish this.

VBA Copy code Copy code
Public WithEvents appWord as Word.Application

Private Sub appWord_NewDocument(ByVal Doc As Document)
 Dim intResponse As Integer
 Dim strName As String
 Dim docLoop As Document

 intResponse = MsgBox("Save all other documents?", vbYesNo)

 If intResponse = vbYes Then
 strName = ActiveDocument.Name
 For Each docLoop In Documents
 With docLoop
 If .Name <> strName Then
 .Save
 End If
 End With
 Next docLoop
 End If
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.ProtectedViewWindowActivate Event (Word)

 Copy code hover
[image]

Application.ProtectedViewWindowActivate Event (Word)
See also Send feedback

Published: July 16, 2012

Occurs when any protected view window is activated.

Version Information

Version Added: Word 2010

Syntax

expression .ProtectedViewWindowActivate(PvWindow, )

expression An expression that returns a Application object.

Parameters

Name | Required/Optional | Data Type | Description
PvWindow | Required | ProtectedViewWindow | The protected view window that is activated.

Example

The following code example maximizes any protected view window when it is activated. This code must be placed in a class module, and an instance of the class must be correctly initialized to see this example work. For more information about how to do this, see Using Events with the Application Object.

The following code example assumes that you have declared an application variable called "App" in your general declarations and have set the variable equal to the Word Application object.

VBA Copy code Copy code
Private Sub App_ProtectedViewWindowActivate(ByVal PvWindow As ProtectedViewWindow)
 PvWindow.WindowState = wdWindowStateMaximize
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.ProtectedViewWindowBeforeClose Event (Word)

 Copy code hover
[image]

Application.ProtectedViewWindowBeforeClose Event (Word)
See also Send feedback

Published: July 16, 2012

Occurs immediately before a protected view window or a document in a protected view window closes.

Version Information

Version Added: Word 2010

Syntax

expression .ProtectedViewWindowBeforeClose(PvWindow, CloseReason, Cancel)

expression An expression that returns an Application object.

Parameters

Name

Required/Optional

Data Type

Description

PvWindow

Required

ProtectedViewWindow

The protected view window that is closed.

CloseReason

Required

[INT]

A constant in the WdProtectedViewCloseReason enumeration that specifies the reason the protected view window is closed.

Cancel

Required

Boolean

False when the event occurs. If the event procedure sets this argument to True, the window does not close when the procedure is finished.

Note Note

If the ProtectedViewWindowsBeforeClose event is called as part of the ProtectedView.Edit method, setting Cancel to True produces no action.

Example

The following code example prompts the user for a yes or no response before closing any document. This code must be placed in a class module, and an instance of the class must be correctly initialized to see this example work. For more information about how to do this, see Using Events with the Application Object.

The following code example assumes that you have declared an application variable called "App" in your general declarations and have set the variable equal to the Word Application object.

VBA Copy code Copy code
Private Sub App_ProtectedViewWindowBeforeClose(ByVal PvWindow As ProtectedViewWindow, ByVal CloseReason As Long, Cancel As Boolean)
Dim intResponse As Integer

    intResponse = MsgBox("Do you really " _
        & "want to close the document?", _
        vbYesNo)

    If intResponse = vbNo Then Cancel = True

End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.ProtectedViewWindowBeforeEdit Event (Word)

 Copy code hover
[image]

Application.ProtectedViewWindowBeforeEdit Event (Word)
See also Send feedback

Published: July 16, 2012

Occurs immediately before editing is enabled on the document in the specified protected view window.

Version Information

Version Added: Word 2010

Syntax

expression .ProtectedViewWindowBeforeEdit(PvWindow, Cancel)

expression An expression that returns an Application object.

Parameters

Name | Required/Optional | Data Type | Description
PvWindow | Required | ProtectedViewWindow | The protected view window that contains the document that is enabled for editing.
Cancel | Required | Boolean | False when the event occurs. If the event procedure sets this argument to True, editing is not enabled on the document.

Example

The following code example prompts the user for a yes or no response before enabling editing on a document in a protected view window. This code must be placed in a class module, and an instance of the class must be correctly initialized for this code example to work correctly. For more information about how to do this, see Using Events with the Application Object.

The following code example assumes that you have declared an application variable called "App" in your general declarations and have set the variable equal to the Word Application object.

VBA Copy code Copy code
Private Sub App_ProtectedViewWindowBeforeEdit(ByVal PvWindow As ProtectedViewWindow, Cancel As Boolean)
 Dim intResponse As Integer

 intResponse = MsgBox("Do you really " _
 & "want to edit the document?", _
 vbYesNo)

 If intResponse = vbNo Then Cancel = True
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.ProtectedViewWindowDeactivate Event (Word)

 Copy code hover
[image]

Application.ProtectedViewWindowDeactivate Event (Word)
See also Send feedback

Published: July 16, 2012

Occurs when a protected view window is deactivated.

Version Information

Version Added: Word 2010

Syntax

expression .ProtectedViewWindowDeactivate(PvWindow, )

expression An expression that returns a Application object.

Parameters

Name | Required/Optional | Data Type | Description
PvWindow | Required | ProtectedViewWindow | The deactivated protected view window.

Example

The following code example minimizes an open protected view window when it is deactivated. This code must be placed in a class module, and an instance of the class must be correctly initialized for this code example to work correctly. For more information about how to do this, see Using Events with the Application Object.

The following code example assumes that you have declared an application variable called "App" in your general declarations and have set the variable equal to the Word Application object.

VBA Copy code Copy code
Private Sub App_ProtectedViewWindowDeactivate(ByVal PvWindow As ProtectedViewWindow)
 PvWindow.WindowState = wdWindowStateMinimize
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.ProtectedViewWindowOpen Event (Word)

 Copy code hover
[image]

Application.ProtectedViewWindowOpen Event (Word)
See also Send feedback

Published: July 16, 2012

Occurs when a protected view window is opened.

Version Information

Version Added: Word 2010

Syntax

expression .ProtectedViewWindowOpen(PvWindow, )

expression An expression that returns a Application object.

Parameters

Name | Required/Optional | Data Type | Description
PvWindow | Required | ProtectedViewWindow | The protected view window that is opened.

Example

The following code example informs the user that the document will be opened in a protected view window. This code must be placed in a class module, and an instance of the class must be correctly initialized for this code example to work correctly. For more information about how to do this, see Using Events with the Application Object.

The following code example assumes that you have declared an application variable called "App" in your general declarations and have set the variable equal to the Word Application object.

VBA Copy code Copy code
Private Sub App_ProtectedViewWindowOpen(ByVal PvWindow As ProtectedViewWindow)
Dim intResponse As Integer

 MsgBox "You are opening a document in " _
 & "protected view window mode."

End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.ProtectedViewWindowSize Event (Word)

 Copy code hover
[image]

Application.ProtectedViewWindowSize Event (Word)
See also Send feedback

Published: July 16, 2012

Version Information

Version Added: Word 2010

Syntax

expression .ProtectedViewWindowSize(PvWindow, )

expression An expression that returns a Application object.

Parameters

Name | Required/Optional | Data Type | Description
PvWindow | Required | ProtectedViewWindow | The protected view window that is sized.

Example

The following code example displays a message every time a protected view window is moved or resized. This code must be placed in a class module, and an instance of the class must be correctly initialized for this code example to work correctly. For more information about how to do this, see Using Events with the Application Object.

The following code example assumes that you have declared an application variable called "App" in your general declarations and have set the variable equal to the Word Application object.

VBA Copy code Copy code
Private Sub App_ProtectedViewWindowSize(ByVal PvWindow As ProtectedViewWindow)
MsgBox "You resized a window!"
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.Quit Event (Word)

 Copy code hover
[image]

Application.Quit Event (Word)
See also Send feedback

Published: July 16, 2012

Occurs when the user exits Microsoft Word.

Syntax

Private Sub Application_Quit()

expression A variable that represents an Application object that has been declared with events in a class module.

Remarks

For information about using events with the Application object, see Using Events with the Application Object.

Example

This example ensures that the Standard and Formatting toolbars are visible before the user exits Word. As a result, when Word is started again, the Standard and Formatting toolbars are visible.

This code must be placed in a class module, and an instance of the class must be correctly initialized to see this example work; see Using Events with the Application Object for directions on how to accomplish this.

VBA Copy code Copy code
Public WithEvents appWord as Word.Application

Private Sub appWord_Quit()
 CommandBars("Standard").Visible = True
 CommandBars("Formatting").Visible = True
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.WindowActivate Event (Word)

 Copy code hover
[image]

Application.WindowActivate Event (Word)
See also Send feedback

Published: July 16, 2012

Occurs when any document window is activated.

Syntax

expression .Private Sub object_WindowActivate(ByVal Doc As Document, ByVal Wn As Window)

expression A variable that represents an Application object that has been declared with events in a class module. For more information about using events with the Application object, see Using Events with the Application Object.

Parameters

Name | Required/Optional | Data Type | Description
Doc | Required | Document | The document displayed in the activated window.
Wn | Required | Window | The window that's being activated.

Example

This example maximizes any document window when it is activated. This code must be placed in a class module, and an instance of the class must be correctly initialized to see this example work; see Using Events with the Application Object for directions on how to accomplish this.

VBA Copy code Copy code
Public WithEvents appWord as Word.Application

Private Sub appWord_WindowActivate _
 (ByVal Wn As Word.Window)
 Wn.WindowState = wdWindowStateMaximize
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.WindowBeforeDoubleClick Event (Word)

 Copy code hover
[image]

Application.WindowBeforeDoubleClick Event (Word)
See also Send feedback

Published: July 16, 2012

Occurs when the editing area of a document window is double-clicked, before the default double-click action.

Syntax

expression .Private Sub object_WindowBeforeDoubleClick(ByVal Sel As Selection, Cancel As Boolean)

expression A variable that represents an Application object that has been declared with events in a class module. For more information about using events with the Application object, see Using Events with the Application Object.

Parameters

Name | Required/Optional | Data Type | Description
Sel | Required | Selection | The current selection.
Cancel | Required | Boolean | False when the event occurs. If the event procedure sets this argument to True, the default double-click action does not occur when the procedure is finished.

Example

This example prompts the user for a yes or no response before executing the default double-click action. This code must be placed in a class module, and an instance of the class must be correctly initialized to see this example work; see Using Events with the Application Object for directions on how to accomplish this.

VBA Copy code Copy code
Public WithEvents appWord as Word.Application

Private Sub appWord_WindowBeforeDoubleClick _
 (ByVal Sel As Selection, Cancel As Boolean)
 Dim intResponse As Integer
 intResponse = MsgBox("Selection = " & Sel & vbLf & vbLf _
 & "Continue with operation on this selection?", _
 vbYesNo)
 If intResponse = vbNo Then Cancel = True
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.WindowBeforeRightClick Event (Word)

 Copy code hover
[image]

Application.WindowBeforeRightClick Event (Word)
See also Send feedback

Published: July 16, 2012

Occurs when the editing area of a document window is right-clicked, before the default right-click action.

Syntax

Private Sub expression ._WindowBeforeRightClick(ByVal Sel As Selection, Cancel As Boolean)

expression A variable that represents an Application object that has been declared with events in a class module.

Parameters

Name | Required/Optional | Data Type | Description
Sel | Required | Selection | The current selection.
Cancel | Required | Boolean | False when the event occurs. If the event procedure sets this argument to True, the default right-click action does not occur when the procedure is finished.

Remarks

For more information about using events with the Application object, see Using Events with the Application Object.

Example

This example prompts the user for a yes or no response before executing the default right-click action. This code must be placed in a class module, and an instance of the class must be correctly initialized to see this example work; see Using Events with the Application Object for directions on how to accomplish this.

VBA Copy code Copy code
Public WithEvents appWord as Word.Application

Private Sub appWord_WindowBeforeRightClick _
 (ByVal Sel As Selection, Cancel As Boolean)
 Dim intResponse As Integer

 intResponse = MsgBox("Selection = " & Sel & vbLf & vbLf _
 & "Continue with operation on this selection?", _
 vbYesNo)
 If intResponse = vbNo Then Cancel = True
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.WindowDeactivate Event (Word)

 Copy code hover
[image]

Application.WindowDeactivate Event (Word)
See also Send feedback

Published: July 16, 2012

Occurs when any document window is deactivated.

Syntax

expression .Private Sub object_WindowDeactivate(ByVal Doc As Document, ByVal Wn As Window)

expression A variable that represents an Application object that has been declared with events in a class module. For more information about using events with the Application object or the Document object, see Using Events with the Application Object or Using Events with the Document Object.

Parameters

Name | Required/Optional | Data Type | Description
Doc | Required | Document | The document displayed in the deactivated window.
Wn | Required | Window | The deactivated window.

Example

This example minimizes any document window when it is deactivated. This code must be placed in a class module, and an instance of the class must be correctly initialized to see this example work; see Using Events with the Application Object for directions on how to accomplish this.

VBA Copy code Copy code
Public WithEvents appWord as Word.Application

Private Sub appWord_WindowDeactivate _
 (ByVal Wn As Word.Window)
 Wn.WindowState = wdWindowStateMinimize
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.WindowSelectionChange Event (Word)

 Copy code hover
[image]

Application.WindowSelectionChange Event (Word)
See also Send feedback

Published: July 16, 2012

Occurs when the selection changes in the active document window.

Syntax

expression .Private Sub object_WindowSelectionChange(ByVal Sel As Selection)

expression A variable that represents an Application object that has been declared with events in a class module. For more information about using events with the Application object, see Using Events with the Application Object.

Parameters

Name | Required/Optional | Data Type | Description
Sel | Required | Selection | The text selected. If no text is selected, the Sel parameter returns either nothing or the first character to the right of the insertion point.

Example

This example applies bold formatting to the new selection. This code must be placed in a class module, and an instance of the class must be correctly initialized to see this example work; see Using Events with the Application Object for directions on how to accomplish this.

VBA Copy code Copy code
Public WithEvents appWord as Word.Application

Private Sub appWord_WindowSelectionChange _
 (ByVal Sel As Selection)
 Sel.Font.Bold = True
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.WindowSize Event (Word)

 Copy code hover
[image]

Application.WindowSize Event (Word)
See also Send feedback

Published: July 16, 2012

Occurs when the application window is resized or moved.

Syntax

expression .Private Sub object_WindowSize(ByVal Doc As Document, ByVal Wn As Window)

expression A variable that represents an Application object that has been declared with events in a class module. For information about using events with the Application object, see Using Events with the Application Object.

Parameters

Name | Required/Optional | Data Type | Description
Doc | Required | Document | The document in the window being sized.
Wn | Required | Window | The window being sized.

Example

This example displays a message every time the Microsoft Word application window is moved or resized. This example assumes that you have declared an application variable called "WordApp" in your general declarations and have set the variable equal to the Word Application object.

VBA Copy code Copy code
Private Sub WordApp_WindowSize(ByVal Doc As Document, _
 ByVal Wn As Window)
 MsgBox "You have just resized or moved your window."
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.XMLSelectionChange Event (Word)

 Copy code hover
[image]

Application.XMLSelectionChange Event (Word)
See also Send feedback

Published: July 16, 2012

Occurs when the parent XML node of the current selection changes.

Syntax

Private Sub expression _XMLSelectionChange(Sel, OldXMLNode, NewXMLNode, Reason)

expression A variable that represents an Application object that has been declared in a class module by using the WithEvents keyword. For more information about using events with the Application object, see Using Events with the Application Object.

Parameters

Name | Required/Optional | Data Type | Description
Sel | Required | Selection | The text selected, including XML elements. If no text is selected, the Sel parameter returns either nothing or the first character to the right of the insertion point.
OldXMLNode | Required | XMLNode | The XML node from which the insertion point is moving.
NewXMLNode | Required | XMLNode | The XML node to which the insertion point is moving.

Example

The following example validates a newly added XML element when a new element is inserted into the document.

VBA Copy code Copy code
Private Sub Wrd_XMLSelectionChange(ByVal Sel As Selection, _
 ByVal OldXMLNode As XMLNode, ByVal NewXMLNode As XMLNode, _
 Reason As Long)

 Dim intResponse As Integer

 If Reason = wdXMLSelectionChangeReasonInsert Then
 If Not NewXMLNode Is Nothing Then
 NewXMLNode.Validate
 End If
 End If

End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


Application.XMLValidationError Event (Word)

 Copy code hover
[image]

Application.XMLValidationError Event (Word)
See also Send feedback

Published: July 16, 2012

Occurs when there is a validation error in the document.

Syntax

Private Sub expression _XMLValidationError(XMLNode As XMLNode)

expression A variable that represents an Application object. An object of type Application that has been declared in a class module by using the WithEvents keyword. For more information about using events with the Application object, see Using Events with the Application Object.

Parameters

Name | Required/Optional | Data Type | Description
XMLNode | Required | XMLNode | The XML element that is invalid.

Example

The following example displays an error message to the user when a node is invalid.

VBA Copy code Copy code
Private Sub Wrd_XMLValidationError(ByVal XMLNode As XMLNode)
 MsgBox "The " & UCase(XMLNode.BaseName) & " element is invalid." & _
 vbCrLf & XMLNode.ValidationErrorText
End Sub

See also

Concepts

Application Object

Other resources

Application Object Members


AutoCaption Object (Word)

 Copy code hover
[image]

AutoCaption Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a single caption that can be automatically added when items such as tables, pictures, or OLE objects are inserted into a document. The AutoCaption object is a member of the AutoCaptions collection. The AutoCaptions collection contains all the captions listed in the AutoCaption dialog box.

Remarks

Use AutoCaptions(index), where index is the caption name or index number, to return a single AutoCaption object. The caption names correspond to the items listed in the AutoCaption dialog box. You must exactly match the spelling (but not necessarily the capitalization) of the name, as it is shown in the AutoCaption dialog box. The following example enables autocaptions for Word tables.

VBA Copy code Copy code
AutoCaptions("Microsoft Word Table").AutoInsert = True

The index number represents the position of the AutoCaption object in the list of items in the AutoCaption dialog box. The following example displays the name of the first item listed in the AutoCaption dialog box.

VBA Copy code Copy code
MsgBox AutoCaptions(1).Name

AutoCaption objects cannot be programmatically added to or deleted from the AutoCaptions collection.

See also

Concepts

Word Object Model Reference

Other resources

AutoCaption Object Members


AutoCaption Members (Word)

 Copy code hover
[image]

AutoCaption Members (Word)
Send feedback

Published: July 16, 2012

Represents a single caption that can be automatically added when items such as tables, pictures, or OLE objects are inserted into a document. The AutoCaption object is a member of the AutoCaptions collection. The AutoCaptions collection contains all the captions listed in the AutoCaption dialog box.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
AutoInsert | True if a caption is automatically added when the item is inserted into a document. Read/write Boolean.
CaptionLabel | Returns or sets the caption label ("Figure," "Table," or "Equation," for example) of the specified caption. Read/write Variant.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Index | Returns a Long that represents the position of an item in a collection. Read-only.
Name | Returns or sets the name of the specified object. Read-only String.
Parent | Returns an Object that represents the parent object of the specified AutoCaption object.


AutoCaption Properties (Word)

 Copy code hover
[image]

AutoCaption Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
AutoInsert | True if a caption is automatically added when the item is inserted into a document. Read/write Boolean.
CaptionLabel | Returns or sets the caption label ("Figure," "Table," or "Equation," for example) of the specified caption. Read/write Variant.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Index | Returns a Long that represents the position of an item in a collection. Read-only.
Name | Returns or sets the name of the specified object. Read-only String.
Parent | Returns an Object that represents the parent object of the specified AutoCaption object.


AutoCaption.Application Property (Word)

 Copy code hover
[image]

AutoCaption.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression A variable that represents an AutoCaption object.

See also

Concepts

AutoCaption Object

Other resources

AutoCaption Object Members


AutoCaption.AutoInsert Property (Word)

 Copy code hover
[image]

AutoCaption.AutoInsert Property (Word)
See also Send feedback

Published: July 16, 2012

True if a caption is automatically added when the item is inserted into a document. Read/write Boolean.

Syntax

expression .AutoInsert

expression A variable that represents an AutoCaption object.

Example

This example enables Word to add captions to tables automatically. Then the example collapses the selection to an insertion point, and inserts a table. A caption is automatically added to the new table.

VBA Copy code Copy code
AutoCaptions("Microsoft Word Table").AutoInsert = True
Selection.Collapse Direction:=wdCollapseStart
ActiveDocument.Tables.Add Range:=Selection.Range, _
 NumRows:=2, NumColumns:=2

See also

Concepts

AutoCaption Object

Other resources

AutoCaption Object Members


AutoCaption.CaptionLabel Property (Word)

 Copy code hover
[image]

AutoCaption.CaptionLabel Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the caption label ("Figure," "Table," or "Equation," for example) of the specified caption. Read/write Variant.

Syntax

expression .CaptionLabel

expression A variable that represents an AutoCaption object.

Remarks

This property can be set to a string or a WdCaptionLabelID constant.

Example

This example displays the name ("Microsoft Excel Worksheet," for example) and caption label ("Figure," for example) for each item that has a caption added automatically when inserted.

VBA Copy code Copy code
Dim acLoop As AutoCaption

For Each acLoop In AutoCaptions
 If acLoop.AutoInsert = True Then MsgBox acLoop.Name _
 & vbCr & "Label = " & acLoop.CaptionLabel.Name
Next acLoop

This example sets the caption label for Word tables to "Table" and then inserts a new table immediately after the selection.

VBA Copy code Copy code
With AutoCaptions("Microsoft Word Table")
 .AutoInsert = True
 .CaptionLabel = wdCaptionTable
End With
Selection.Collapse Direction:=wdCollapseEnd
ActiveDocument.Tables.Add Range:=Selection.Range, NumRows:=2, _
 NumColumns:=3

See also

Concepts

AutoCaption Object

Other resources

AutoCaption Object Members


AutoCaption.Creator Property (Word)

 Copy code hover
[image]

AutoCaption.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents an AutoCaption object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

AutoCaption Object

Other resources

AutoCaption Object Members


AutoCaption.Index Property (Word)

 Copy code hover
[image]

AutoCaption.Index Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the position of an item in a collection. Read-only.

Syntax

expression .Index

expression Required. A variable that represents an AutoCaption object.

See also

Concepts

AutoCaption Object

Other resources

AutoCaption Object Members


AutoCaption.Name Property (Word)

 Copy code hover
[image]

AutoCaption.Name Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the name of the specified object. Read-only String.

Syntax

expression .Name

expression A variable that represents an AutoCaption object.

See also

Concepts

AutoCaption Object

Other resources

AutoCaption Object Members


AutoCaption.Parent Property (Word)

 Copy code hover
[image]

AutoCaption.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified AutoCaption object.

Syntax

expression .Parent

expression A variable that represents an AutoCaption object.

See also

Concepts

AutoCaption Object

Other resources

AutoCaption Object Members


AutoCaptions Object (Word)

 Copy code hover
[image]

AutoCaptions Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of AutoCaption objects that represent the captions that can be automatically added when items such as tables, pictures, or OLE objects are inserted into a document.

Remarks

Use the AutoCaptions property to return the AutoCaptions collection. The following example displays the names of the selected items in the AutoCaption dialog box.

VBA Copy code Copy code
For Each autoCap In AutoCaptions
 If autoCap.AutoInsert = True Then
 MsgBox autoCap.Name & " is configured for auto insert"
 End If
Next autoCap

The AutoCaptions collection contains all the captions listed in the AutoCaption dialog box. AutoCaption objects cannot be programmatically added to or deleted from the AutoCaptions collection.

Use AutoCaptions(index), where index is the caption name or index number, to return a single AutoCaption object. The caption names correspond to the items listed in the AutoCaption dialog box. You must exactly match the spelling (but not necessarily the capitalization) of the name, as it is shown in the AutoCaption dialog box. The following example displays the caption text "Microsoft Word Table."

VBA Copy code Copy code
MsgBox AutoCaptions("Microsoft Word Table").CaptionLabel.Name

The index number represents the position of the AutoCaption object in the list of captions in the AutoCaption dialog box. The following example displays the name of the first item selected in the AutoCaption dialog box.

VBA Copy code Copy code
MsgBox AutoCaptions(1).Name

See also

Concepts

Word Object Model Reference

Other resources

AutoCaptions Object Members


AutoCaptions Members (Word)

 Copy code hover
[image]

AutoCaptions Members (Word)
Send feedback

Published: July 16, 2012

A collection of AutoCaption objects that represent the captions that can be automatically added when items such as tables, pictures, or OLE objects are inserted into a document.

Methods

Name | Description
CancelAutoInsert | Prevents Word from automatically adding captions to any type of item.
Item | Returns an individual AutoCaption object in a collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns the number of items in the AutoCaptions collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified AutoCaptions collection.


AutoCaptions Properties (Word)

 Copy code hover
[image]

AutoCaptions Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns the number of items in the AutoCaptions collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified AutoCaptions collection.


AutoCaptions.Application Property (Word)

 Copy code hover
[image]

AutoCaptions.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression A variable that represents a AutoCaptions object.

See also

Concepts

AutoCaptions Collection Object

Other resources

AutoCaptions Object Members


AutoCaptions.Count Property (Word)

 Copy code hover
[image]

AutoCaptions.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the number of items in the AutoCaptions collection. Read-only Long.

Syntax

expression .Count

expression A variable that represents a AutoCaptions object.

See also

Concepts

AutoCaptions Collection Object

Other resources

AutoCaptions Object Members


AutoCaptions.Creator Property (Word)

 Copy code hover
[image]

AutoCaptions.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents an AutoCaptions object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

AutoCaptions Collection Object

Other resources

AutoCaptions Object Members


AutoCaptions.Parent Property (Word)

 Copy code hover
[image]

AutoCaptions.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified AutoCaptions collection.

Syntax

expression .Parent

expression A variable that represents an AutoCaptions object.

See also

Concepts

AutoCaptions Collection Object

Other resources

AutoCaptions Object Members


AutoCaptions Methods (Word)

 Copy code hover
[image]

AutoCaptions Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
CancelAutoInsert | Prevents Word from automatically adding captions to any type of item.
Item | Returns an individual AutoCaption object in a collection.


AutoCaptions.CancelAutoInsert Method (Word)

 Copy code hover
[image]

AutoCaptions.CancelAutoInsert Method (Word)
See also Send feedback

Published: July 16, 2012

Prevents Word from automatically adding captions to any type of item.

Syntax

expression .CancelAutoInsert

expression An expression that returns an AutoCaptions object.

Example

This example prevents Word from automatically adding captions to any type of item.

VBA Copy code Copy code
AutoCaptions.CancelAutoInsert

See also

Concepts

AutoCaptions Collection Object

Other resources

AutoCaptions Object Members


AutoCaptions.Item Method (Word)

 Copy code hover
[image]

AutoCaptions.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual AutoCaption object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents an AutoCaptions collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The individual object to be returned. Can be a Long indicating the ordinal position or a String representing the name of the individual object.

Return Value

AutoCaption

See also

Concepts

AutoCaptions Collection Object

Other resources

AutoCaptions Object Members


AutoCorrect Object (Word)

 Copy code hover
[image]

AutoCorrect Object (Word)
See also Send feedback

Published: July 16, 2012

Represents the AutoCorrect functionality in Word.

Remarks

Use the AutoCorrect property to return the AutoCorrect object. The following example enables the AutoCorrect options and creates an AutoCorrect entry.

VBA Copy code Copy code
With AutoCorrect
 .CorrectCapsLock = True
 .CorrectDays = True
 .Entries.Add Name:="usualy", Value:="usually"
End With

The Entries property returns the Entries object that represents the AutoCorrect entries in the AutoCorrect dialog box.

See also

Concepts

Word Object Model Reference

Other resources

AutoCorrect Object Members


AutoCorrect Members (Word)

 Copy code hover
[image]

AutoCorrect Members (Word)
Send feedback

Published: July 16, 2012

Represents the AutoCorrect functionality in Word.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
CorrectCapsLock | True if Word automatically corrects instances in which you use the CAPS LOCK key inadvertently as you type. Read/write Boolean.
CorrectDays | True if Word automatically capitalizes the first letter of days of the week. Read/write Boolean.
CorrectHangulAndAlphabet | True if Microsoft Word automatically applies the correct font to Latin words typed in the middle of Hangul text or vice versa. Read/write Boolean.
CorrectInitialCaps | True if Word automatically makes the second letter lowercase if the first two letters of a word are typed in uppercase. For example, "WOrd" is corrected to "Word." Read/write Boolean.
CorrectKeyboardSetting | True if Microsoft Word automatically transposes words to their native alphabet if you type text in a language other than the current keyboard language. Read/write Boolean.
CorrectSentenceCaps | True if Word automatically capitalizes the first letter in each sentence. Read/write Boolean.
CorrectTableCells | True to automatically capitalize the first letter of table cells. Read/write Boolean.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
DisplayAutoCorrectOptions | True for Microsoft Word to display the AutoCorrect Options button. Read/write Boolean.
Entries | Returns an AutoCorrectEntries collection that represents the current list of AutoCorrect entries.
FirstLetterAutoAdd | True if Word automatically adds abbreviations to the list of AutoCorrect First Letter exceptions. Read/write Boolean.
FirstLetterExceptions | Returns a FirstLetterExceptions collection that represents the list of abbreviations after which Word won't automatically capitalize the next letter. Read-only.
HangulAndAlphabetAutoAdd | True if Microsoft Word automatically adds words to the list of Hangul and alphabet AutoCorrect exceptions. Read/write Boolean.
HangulAndAlphabetExceptions | Returns a HangulAndAlphabetExceptions collection that represents the list of Hangul and alphabet AutoCorrect exceptions.
OtherCorrectionsAutoAdd | True if Microsoft Word automatically adds words to the list of AutoCorrect exceptions on the Other Corrections tab in the AutoCorrect Exceptions dialog box (AutoCorrect Options command, Tools menu). Word adds a word to this list if you delete and then retype a word that you didn't want Word to correct. Read/write Boolean.
OtherCorrectionsExceptions | Returns an OtherCorrectionsExceptions collection that represents the list of words that Microsoft Word won't correct automatically.
Parent | Returns an Object that represents the parent object of the specified AutoCorrect object.
ReplaceText | True if Microsoft Word automatically replaces specified text with entries from the AutoCorrect list. Read/write Boolean.
ReplaceTextFromSpellingChecker | True if Microsoft Word automatically replaces misspelled text with suggestions from the spelling checker as the user types. Word only replaces words that contain a single misspelling and for which the spelling dictionary only lists one alternative. Read/write Boolean.
TwoInitialCapsAutoAdd | True if Microsoft Word automatically adds words to the list of AutoCorrect Initial Caps exceptions. A word is added to this list if you delete and then retype the uppercase letter (following the initial uppercase letter) that Word changed to lowercase. Read/write Boolean.
TwoInitialCapsExceptions | Returns a TwoInitialCapsExceptions collection that represents the list of terms containing mixed capitalization that Word won't correct automatically.


AutoCorrect Properties (Word)

 Copy code hover
[image]

AutoCorrect Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
CorrectCapsLock | True if Word automatically corrects instances in which you use the CAPS LOCK key inadvertently as you type. Read/write Boolean.
CorrectDays | True if Word automatically capitalizes the first letter of days of the week. Read/write Boolean.
CorrectHangulAndAlphabet | True if Microsoft Word automatically applies the correct font to Latin words typed in the middle of Hangul text or vice versa. Read/write Boolean.
CorrectInitialCaps | True if Word automatically makes the second letter lowercase if the first two letters of a word are typed in uppercase. For example, "WOrd" is corrected to "Word." Read/write Boolean.
CorrectKeyboardSetting | True if Microsoft Word automatically transposes words to their native alphabet if you type text in a language other than the current keyboard language. Read/write Boolean.
CorrectSentenceCaps | True if Word automatically capitalizes the first letter in each sentence. Read/write Boolean.
CorrectTableCells | True to automatically capitalize the first letter of table cells. Read/write Boolean.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
DisplayAutoCorrectOptions | True for Microsoft Word to display the AutoCorrect Options button. Read/write Boolean.
Entries | Returns an AutoCorrectEntries collection that represents the current list of AutoCorrect entries.
FirstLetterAutoAdd | True if Word automatically adds abbreviations to the list of AutoCorrect First Letter exceptions. Read/write Boolean.
FirstLetterExceptions | Returns a FirstLetterExceptions collection that represents the list of abbreviations after which Word won't automatically capitalize the next letter. Read-only.
HangulAndAlphabetAutoAdd | True if Microsoft Word automatically adds words to the list of Hangul and alphabet AutoCorrect exceptions. Read/write Boolean.
HangulAndAlphabetExceptions | Returns a HangulAndAlphabetExceptions collection that represents the list of Hangul and alphabet AutoCorrect exceptions.
OtherCorrectionsAutoAdd | True if Microsoft Word automatically adds words to the list of AutoCorrect exceptions on the Other Corrections tab in the AutoCorrect Exceptions dialog box (AutoCorrect Options command, Tools menu). Word adds a word to this list if you delete and then retype a word that you didn't want Word to correct. Read/write Boolean.
OtherCorrectionsExceptions | Returns an OtherCorrectionsExceptions collection that represents the list of words that Microsoft Word won't correct automatically.
Parent | Returns an Object that represents the parent object of the specified AutoCorrect object.
ReplaceText | True if Microsoft Word automatically replaces specified text with entries from the AutoCorrect list. Read/write Boolean.
ReplaceTextFromSpellingChecker | True if Microsoft Word automatically replaces misspelled text with suggestions from the spelling checker as the user types. Word only replaces words that contain a single misspelling and for which the spelling dictionary only lists one alternative. Read/write Boolean.
TwoInitialCapsAutoAdd | True if Microsoft Word automatically adds words to the list of AutoCorrect Initial Caps exceptions. A word is added to this list if you delete and then retype the uppercase letter (following the initial uppercase letter) that Word changed to lowercase. Read/write Boolean.
TwoInitialCapsExceptions | Returns a TwoInitialCapsExceptions collection that represents the list of terms containing mixed capitalization that Word won't correct automatically.


AutoCorrect.Application Property (Word)

 Copy code hover
[image]

AutoCorrect.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression A variable that represents an AutoCorrect object.

See also

Concepts

AutoCorrect Object

Other resources

AutoCorrect Object Members


AutoCorrect.CorrectCapsLock Property (Word)

 Copy code hover
[image]

AutoCorrect.CorrectCapsLock Property (Word)
See also Send feedback

Published: July 16, 2012

True if Word automatically corrects instances in which you use the CAPS LOCK key inadvertently as you type. Read/write Boolean.

Syntax

expression .CorrectCapsLock

expression A variable that represents an AutoCorrect object.

Example

This example determines whether Word is set to automatically correct CAPS LOCK key errors.

VBA Copy code Copy code
If AutoCorrect.CorrectCapsLock = True Then
 MsgBox "Correct CAPS LOCK is active."
Else
 MsgBox "Correct CAPS LOCK is not active."
End If

See also

Concepts

AutoCorrect Object

Other resources

AutoCorrect Object Members


AutoCorrect.CorrectDays Property (Word)

 Copy code hover
[image]

AutoCorrect.CorrectDays Property (Word)
See also Send feedback

Published: July 16, 2012

True if Word automatically capitalizes the first letter of days of the week. Read/write Boolean.

Syntax

expression .CorrectDays

expression A variable that represents an AutoCorrect object.

Example

This example sets Word to automatically capitalize the first letter of days of the week.

VBA Copy code Copy code
AutoCorrect.CorrectDays = True

This example toggles the value of the CorrectDays property.

VBA Copy code Copy code
AutoCorrect.CorrectDays = Not AutoCorrect.CorrectDays

See also

Concepts

AutoCorrect Object

Other resources

AutoCorrect Object Members


AutoCorrect.CorrectHangulAndAlphabet Property (Word)

 Copy code hover
[image]

AutoCorrect.CorrectHangulAndAlphabet Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word automatically applies the correct font to Latin words typed in the middle of Hangul text or vice versa. Read/write Boolean.

Syntax

expression .CorrectHangulAndAlphabet

expression An expression that returns an AutoCorrect object.

Example

This example sets Microsoft Word to automatically apply the correct font to Latin words typed in the middle of Hangul text or vice versa.

VBA Copy code Copy code
AutoCorrect.CorrectHangulAndAlphabet = True

See also

Concepts

AutoCorrect Object

Other resources

AutoCorrect Object Members


AutoCorrect.CorrectInitialCaps Property (Word)

 Copy code hover
[image]

AutoCorrect.CorrectInitialCaps Property (Word)
See also Send feedback

Published: July 16, 2012

True if Word automatically makes the second letter lowercase if the first two letters of a word are typed in uppercase. For example, "WOrd" is corrected to "Word." Read/write Boolean.

Syntax

expression .CorrectInitialCaps

expression A variable that represents an AutoCorrect object.

Example

This example sets Word to automatically correct errors in initial capitalization.

VBA Copy code Copy code
AutoCorrect.CorrectInitialCaps = True

See also

Concepts

AutoCorrect Object

Other resources

AutoCorrect Object Members


AutoCorrect.CorrectKeyboardSetting Property (Word)

 Copy code hover
[image]

AutoCorrect.CorrectKeyboardSetting Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word automatically transposes words to their native alphabet if you type text in a language other than the current keyboard language. Read/write Boolean.

Syntax

expression .CorrectKeyboardSetting

expression An expression that returns an AutoCorrect object.

Remarks

The CheckLanguage property must be set to True to use the CorrectKeyboardSetting property.

Example

This example displays a dialog box where the user can choose whether or not Word automatically transposes foreign words to their native alphabets.

VBA Copy code Copy code
x = MsgBox("Do you want Microsoft Word to tranpose " _
 & "foreign words to their native alphabet?", _
 vbYesNo)
If x = vbYes Then
 Application.CheckLanguage = True
 AutoCorrect.CorrectKeyboardSetting = True
 MsgBox "Automatic keyboard correction enabled!"
End If

See also

Concepts

AutoCorrect Object

Other resources

AutoCorrect Object Members


AutoCorrect.CorrectSentenceCaps Property (Word)

 Copy code hover
[image]

AutoCorrect.CorrectSentenceCaps Property (Word)
See also Send feedback

Published: July 16, 2012

True if Word automatically capitalizes the first letter in each sentence. Read/write Boolean.

Syntax

expression .CorrectSentenceCaps

expression A variable that represents an AutoCorrect object.

Example

This example toggles the value of the CorrectSentenceCaps property.

VBA Copy code Copy code
AutoCorrect.CorrectSentenceCaps = Not _
 AutoCorrect.CorrectSentenceCaps

See also

Concepts

AutoCorrect Object

Other resources

AutoCorrect Object Members


AutoCorrect.CorrectTableCells Property (Word)

 Copy code hover
[image]

AutoCorrect.CorrectTableCells Property (Word)
See also Send feedback

Published: July 16, 2012

True to automatically capitalize the first letter of table cells. Read/write Boolean.

Syntax

expression .CorrectTableCells

expression An expression that returns an AutoCorrect object.

Example

This example disables automatic capitalization of the first letter typed within table cells.

VBA Copy code Copy code
Sub AutoCorrectFirstLetterOfTableCells()
 Application.AutoCorrect.CorrectTableCells = False
End Sub

See also

Concepts

AutoCorrect Object

Other resources

AutoCorrect Object Members


AutoCorrect.Creator Property (Word)

 Copy code hover
[image]

AutoCorrect.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents an AutoCorrect object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

AutoCorrect Object

Other resources

AutoCorrect Object Members


AutoCorrect.DisplayAutoCorrectOptions Property (Word)

 Copy code hover
[image]

AutoCorrect.DisplayAutoCorrectOptions Property (Word)
See also Send feedback

Published: July 16, 2012

True for Microsoft Word to display the AutoCorrect Options button. Read/write Boolean.

Syntax

expression .DisplayAutoCorrectOptions

expression An expression that returns an AutoCorrect object.

Example

This example disables display of the AutoCorrect Options button.

VBA Copy code Copy code
Sub HideAutoCorrectOpButton()
 AutoCorrect.DisplayAutoCorrectOptions = False
End Sub

See also

Concepts

AutoCorrect Object

Other resources

AutoCorrect Object Members


AutoCorrect.Entries Property (Word)

 Copy code hover
[image]

AutoCorrect.Entries Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an AutoCorrectEntries collection that represents the current list of AutoCorrect entries.

Syntax

expression .Entries

expression A variable that represents an AutoCorrect object.

Remarks

This list corresponds to the list of AutoCorrect entries on the AutoCorrect tab in the AutoCorrect dialog box. Read-only. For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example displays the total number of AutoCorrect entries.

VBA Copy code Copy code
MsgBox AutoCorrect.Entries.Count

This example deletes the specified AutoCorrect entry if it exists.

VBA Copy code Copy code
Dim strEntry As String
Dim acEntry As AutoCorrectEntry
Dim blnMatch As Boolean
Dim intResponse As Integer

strEntry = InputBox("Enter the AutoCorrect entry to delete.")
blnMatch = False

For Each acEntry in AutoCorrect.Entries
 If acEntry.Name = strEntry Then
 blnMatch = True
 intResponse = _
 MsgBox("Are you sure you want to delete " _
 & acEntry.Name, 4)
 If intResponse = vbYes Then
 acEntry.Delete
 End If
 End If
Next acEntry

If blnMatch <> True Then
 MsgBox "There was no AutoCorrect entry: " & strEntry
End If

See also

Concepts

AutoCorrect Object

Other resources

AutoCorrect Object Members


AutoCorrect.FirstLetterAutoAdd Property (Word)

 Copy code hover
[image]

AutoCorrect.FirstLetterAutoAdd Property (Word)
See also Send feedback

Published: July 16, 2012

True if Word automatically adds abbreviations to the list of AutoCorrect First Letter exceptions. Read/write Boolean.

Syntax

expression .FirstLetterAutoAdd

expression A variable that represents an AutoCorrect object.

Remarks

Word adds an abbreviation to this list if you delete and then retype the letter that Word capitalized immediately after the period following the abbreviation.

Example

This example prevents Word from automatically adding abbreviations to the list of AutoCorrect First Letter exceptions.

VBA Copy code Copy code
AutoCorrect.FirstLetterAutoAdd = False

See also

Concepts

AutoCorrect Object

Other resources

AutoCorrect Object Members


AutoCorrect.FirstLetterExceptions Property (Word)

 Copy code hover
[image]

AutoCorrect.FirstLetterExceptions Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a FirstLetterExceptions collection that represents the list of abbreviations after which Word won't automatically capitalize the next letter. Read-only.

Syntax

expression .FirstLetterExceptions

expression A variable that represents an AutoCorrect object.

Remarks

This list corresponds to the list of AutoCorrect exceptions on the First Letter tab in the AutoCorrect Exceptions dialog box. For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example adds "apt." to the list of AutoCorrect First Letter exceptions.

VBA Copy code Copy code
AutoCorrect.FirstLetterExceptions.Add "apt."

This example deletes the specified AutoCorrect First Letter exception if it exists.

VBA Copy code Copy code
Dim strException As String
Dim fleLoop As FirstLetterException
Dim blnMatch As Boolean
Dim intConfirm As Integer

strException = _
 InputBox("Enter the First Letter exception to delete.")
blnMatch = False

For Each fleLoop in AutoCorrect.FirstLetterExceptions
 If fleLoop.Name = strException Then
 blnMatch = True
 intConfirm = MsgBox("Are you sure you want to delete " _
 & fleLoop.Name, 4)
 If intConfirm = vbYes Then
 fleLoop.Delete
 End If
 End If
Next fleLoop

If blnMatch <> True Then
 MsgBox "There was no First Letter exception: " _
 & strException
End If

See also

Concepts

AutoCorrect Object

Other resources

AutoCorrect Object Members


AutoCorrect.HangulAndAlphabetAutoAdd Property (Word)

 Copy code hover
[image]

AutoCorrect.HangulAndAlphabetAutoAdd Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word automatically adds words to the list of Hangul and alphabet AutoCorrect exceptions. Read/write Boolean.

Syntax

expression .HangulAndAlphabetAutoAdd

expression An expression that returns an AutoCorrect object.

Remarks

The list of Hangul and alphabet AutoCorrect exceptions is located on the Korean tab in the AutoCorrect Exceptions dialog box. Word adds a word to this list if you delete and then retype a word that you didn't want Word to correct.

Example

This example sets Microsoft Word to automatically add words to the list of Hangul and alphabet AutoCorrect exceptions.

VBA Copy code Copy code
AutoCorrect.HangulAndAlphabetAutoAdd = True

See also

Concepts

AutoCorrect Object

Other resources

AutoCorrect Object Members


AutoCorrect.HangulAndAlphabetExceptions Property (Word)

 Copy code hover
[image]

AutoCorrect.HangulAndAlphabetExceptions Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a HangulAndAlphabetExceptions collection that represents the list of Hangul and alphabet AutoCorrect exceptions.

Syntax

expression .HangulAndAlphabetExceptions

expression An expression that returns an AutoCorrect object.

Remarks

This list corresponds to the list of Hangul and alphabet AutoCorrect exceptions on the Korean tab in the AutoCorrect Exceptions dialog box.

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example prompts the user to delete or keep each hangul and alphabet AutoCorrect exception on the Korean tab in the AutoCorrect Exceptions dialog box.

VBA Copy code Copy code
For Each anEntry In _
 AutoCorrect.HangulAndAlphabetExceptions
 response = MsgBox("Delete entry: " _
 & anEntry.Name, vbYesNoCancel)
 If response = vbYes Then
 anEntry.Delete
 Else
 If response = vbCancel Then End
 End If
Next anEntry

See also

Concepts

AutoCorrect Object

Other resources

AutoCorrect Object Members


AutoCorrect.OtherCorrectionsAutoAdd Property (Word)

 Copy code hover
[image]

AutoCorrect.OtherCorrectionsAutoAdd Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word automatically adds words to the list of AutoCorrect exceptions on the Other Corrections tab in the AutoCorrect Exceptions dialog box (AutoCorrect Options command, Tools menu). Word adds a word to this list if you delete and then retype a word that you didn't want Word to correct. Read/write Boolean.

Syntax

expression .OtherCorrectionsAutoAdd

expression An expression that returns an AutoCorrect object.

Example

This example sets Word to automatically add words to the list of AutoCorrect exceptions.

VBA Copy code Copy code
AutoCorrect.OtherCorrectionsAutoAdd = True

See also

Concepts

AutoCorrect Object

Other resources

AutoCorrect Object Members


AutoCorrect.OtherCorrectionsExceptions Property (Word)

 Copy code hover
[image]

AutoCorrect.OtherCorrectionsExceptions Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an OtherCorrectionsExceptions collection that represents the list of words that Microsoft Word won't correct automatically.

Syntax

expression .OtherCorrectionsExceptions

expression An expression that returns an AutoCorrect object.

Remarks

This list that this property returns corresponds to the list of AutoCorrect exceptions on the Other Corrections tab in the AutoCorrect Exceptions dialog box.

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example prompts the user to delete or keep each AutoCorrect exception on the Other Corrections tab in the AutoCorrect Exceptions dialog box.

VBA Copy code Copy code
For Each anEntry In _
 AutoCorrect.OtherCorrectionsExceptions
 response = MsgBox("Delete entry: " _
 & anEntry.Name, vbYesNoCancel)
 If response = vbYes Then
 anEntry.Delete
 Else
 If response = vbCancel Then End
 End If
Next anEntry

See also

Concepts

AutoCorrect Object

Other resources

AutoCorrect Object Members


AutoCorrect.Parent Property (Word)

 Copy code hover
[image]

AutoCorrect.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified AutoCorrect object.

Syntax

expression .Parent

expression A variable that represents an AutoCorrect object.

See also

Concepts

AutoCorrect Object

Other resources

AutoCorrect Object Members


AutoCorrect.ReplaceText Property (Word)

 Copy code hover
[image]

AutoCorrect.ReplaceText Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word automatically replaces specified text with entries from the AutoCorrect list. Read/write Boolean.

Syntax

expression .ReplaceText

expression An expression that returns an AutoCorrect object.

Example

This example sets Word to automatically replace specified text with entries from the AutoCorrect list as you type.

VBA Copy code Copy code
AutoCorrect.ReplaceText = True

This example toggles the value of the ReplaceText property.

VBA Copy code Copy code
AutoCorrect.ReplaceText = Not AutoCorrect.ReplaceText

See also

Concepts

AutoCorrect Object

Other resources

AutoCorrect Object Members


AutoCorrect.ReplaceTextFromSpellingChecker Property (Word)

 Copy code hover
[image]

AutoCorrect.ReplaceTextFromSpellingChecker Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word automatically replaces misspelled text with suggestions from the spelling checker as the user types. Word only replaces words that contain a single misspelling and for which the spelling dictionary only lists one alternative. Read/write Boolean.

Syntax

expression .ReplaceTextFromSpellingChecker

expression An expression that returns an AutoCorrect object.

Example

This example sets Word to automatically replace misspelled text with suggestions from the spelling checker.

VBA Copy code Copy code
AutoCorrect.ReplaceTextFromSpellingChecker = True

See also

Concepts

AutoCorrect Object

Other resources

AutoCorrect Object Members


AutoCorrect.TwoInitialCapsAutoAdd Property (Word)

 Copy code hover
[image]

AutoCorrect.TwoInitialCapsAutoAdd Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word automatically adds words to the list of AutoCorrect Initial Caps exceptions. A word is added to this list if you delete and then retype the uppercase letter (following the initial uppercase letter) that Word changed to lowercase. Read/write Boolean.

Syntax

expression .TwoInitialCapsAutoAdd

expression An expression that returns an AutoCorrect object.

Example

This example sets Word to automatically add words to the list of AutoCorrect Initial Caps exceptions.

VBA Copy code Copy code
AutoCorrect.TwoInitialCapsAutoAdd = True

See also

Concepts

AutoCorrect Object

Other resources

AutoCorrect Object Members


AutoCorrect.TwoInitialCapsExceptions Property (Word)

 Copy code hover
[image]

AutoCorrect.TwoInitialCapsExceptions Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a TwoInitialCapsExceptions collection that represents the list of terms containing mixed capitalization that Word won't correct automatically.

Syntax

expression .TwoInitialCapsExceptions

expression An expression that returns an AutoCorrect object.

Remarks

This list corresponds to the list of AutoCorrect exceptions on the INitial CAps tab in the AutoCorrect Exceptions dialog box (AutoCorrect Options command, Tools menu). For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example prompts the user to delete or keep each AutoCorrect Initial Caps exception.

VBA Copy code Copy code
For Each anEntry In AutoCorrect.TwoInitialCapsExceptions
 response = MsgBox ("Delete entry: " _
 & anEntry.Name, vbYesNoCancel)
 If response = vbYes Then
 anEntry.Delete
 Else
 If response = vbCancel Then End
 End If
Next anEntry

See also

Concepts

AutoCorrect Object

Other resources

AutoCorrect Object Members


AutoCorrectEntries Object (Word)

 Copy code hover
[image]

AutoCorrectEntries Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of AutoCorrectEntry objects that represent all the AutoCorrect entries available to Word. The AutoCorrectEntries collection includes all the entries in the AutoCorrect dialog box.

Remarks

Use the Entries property to return the AutoCorrectEntries collection. The following example displays the number of AutoCorrectEntry objects in the AutoCorrectEntries collection.

VBA Copy code Copy code
MsgBox AutoCorrect.Entries.Count

Use the Add or AddRichText method to add an AutoCorrect entry to the list of available entries. The following example adds a plain-text AutoCorrect entry for the misspelling of the word "their."

VBA Copy code Copy code
AutoCorrect.Entries.Add Name:="thier", Value:="their"

The following example creates an AutoCorrect entry named "PMO" based on the text and formatting of the selection.

VBA Copy code Copy code
AutoCorrect.Entries.AddRichText Name:="PMO", Range:=Selection.Range

Use Entries(index), where index is the AutoCorrect entry name or index number, to return a single AutoCorrectEntry object. You must exactly match the spelling (but not necessarily the capitalization) of the name, as it is shown under Replace in the AutoCorrect dialog box. The following example sets the value of an existing AutoCorrect entry named "teh."

VBA Copy code Copy code
AutoCorrect.Entries("teh").Value = "the"

The following example displays the name and value of the first AutoCorrent entry.

VBA Copy code Copy code
MsgBox "Name = " & AutoCorrect.Entries(1).Name & vbCr & _
 "Value " & AutoCorrect.Entries(1).Value

See also

Concepts

Word Object Model Reference

Other resources

AutoCorrectEntries Object Members


AutoCorrectEntries Members (Word)

 Copy code hover
[image]

AutoCorrectEntries Members (Word)
Send feedback

Published: July 16, 2012

A collection of AutoCorrectEntry objects that represent all the AutoCorrect entries available to Word. The AutoCorrectEntries collection includes all the entries in the AutoCorrect dialog box.

Methods

Name | Description
Add | Returns an AutoCorrectEntry object that represents a plain-text AutoCorrect entry added to the list of available AutoCorrect entries.
AddRichText | Creates a formatted AutoCorrect entry, preserving all text attributes of the specified range. Returns an AutoCorrectEntry object.
Item | Returns an individual AutoCorrectEntry object in a collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns the number of items in the AutoCorrectEntries collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified AutoCorrectEntries collection, which is usually an AutoCorrect object.


AutoCorrectEntries Properties (Word)

 Copy code hover
[image]

AutoCorrectEntries Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns the number of items in the AutoCorrectEntries collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified AutoCorrectEntries collection, which is usually an AutoCorrect object.


AutoCorrectEntries.Application Property (Word)

 Copy code hover
[image]

AutoCorrectEntries.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression A variable that represents an AutoCorrectEntries object.

See also

Concepts

AutoCorrectEntries Collection Object

Other resources

AutoCorrectEntries Object Members


AutoCorrectEntries.Count Property (Word)

 Copy code hover
[image]

AutoCorrectEntries.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the number of items in the AutoCorrectEntries collection. Read-only Long.

Syntax

expression .Count

expression A variable that represents an AutoCorrectEntries object.

See also

Concepts

AutoCorrectEntries Collection Object

Other resources

AutoCorrectEntries Object Members


AutoCorrectEntries.Creator Property (Word)

 Copy code hover
[image]

AutoCorrectEntries.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents an AutoCorrectEntries object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

AutoCorrectEntries Collection Object

Other resources

AutoCorrectEntries Object Members


AutoCorrectEntries.Parent Property (Word)

 Copy code hover
[image]

AutoCorrectEntries.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified AutoCorrectEntries collection, which is usually an AutoCorrect object.

Syntax

expression .Parent

expression A variable that represents an AutoCorrectEntries collection.

See also

Concepts

AutoCorrectEntries Collection Object

Other resources

AutoCorrectEntries Object Members


AutoCorrectEntries Methods (Word)

 Copy code hover
[image]

AutoCorrectEntries Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Returns an AutoCorrectEntry object that represents a plain-text AutoCorrect entry added to the list of available AutoCorrect entries.
AddRichText | Creates a formatted AutoCorrect entry, preserving all text attributes of the specified range. Returns an AutoCorrectEntry object.
Item | Returns an individual AutoCorrectEntry object in a collection.


AutoCorrectEntries.Add Method (Word)

 Copy code hover
[image]

AutoCorrectEntries.Add Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an AutoCorrectEntry object that represents a plain-text AutoCorrect entry added to the list of available AutoCorrect entries.

Syntax

expression .Add(Name, Value)

expression Required. A variable that represents an AutoCorrectEntries collection.

Parameters

Name | Required/Optional | Data Type | Description
Name | Required | String | The text you want to have automatically replaced with the text specified by Value.
Value | Required | String | The text you want to have automatically inserted whenever the text specified by Name is typed.

Remarks

Use the AddRichText method to create a formatted AutoCorrect entry.

Example

This example adds a plain-text AutoCorrect entry for a common misspelling of the word their.

VBA Copy code Copy code
AutoCorrect.Entries.Add Name:="thier", Value:="their"

See also

Concepts

AutoCorrectEntries Collection Object

Other resources

AutoCorrectEntries Object Members


AutoCorrectEntries.AddRichText Method (Word)

 Copy code hover
[image]

AutoCorrectEntries.AddRichText Method (Word)
See also Send feedback

Published: July 16, 2012

Creates a formatted AutoCorrect entry, preserving all text attributes of the specified range. Returns an AutoCorrectEntry object.

Syntax

expression .AddRichText(Name, Range)

expression Required. A variable that represents an AutoCorrectEntries collection.

Parameters

Name | Required/Optional | Data Type | Description
Name | Required | String | The text to replace automatically with Range.
Range | Required | Range | The formatted text that Word will insert automatically whenever Name is typed.

Return Value

AutoCorrectEntry

Remarks

The RichText property for entries added by using this method returns True. If AddRichText isn't used, inserted AutoCorrect entries conform to the current style.

Example

This example stores the selected text as a formatted AutoCorrect entry that will be inserted automatically whenever "NewText" is typed.

VBA Copy code Copy code
If Selection.Type = wdSelectionNormal Then
 AutoCorrect.Entries.AddRichText "NewText", Selection.Range
Else
 MsgBox "You need to select some text."
End If

This example stores the third word in the active document as a formatted AutoCorrect entry that will be inserted automatically whenever "NewText" is typed.

VBA Copy code Copy code
AutoCorrect.Entries.AddRichText "NewText", ActiveDocument.Words(3)

See also

Concepts

AutoCorrectEntries Collection Object

Other resources

AutoCorrectEntries Object Members


AutoCorrectEntries.Item Method (Word)

 Copy code hover
[image]

AutoCorrectEntries.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual AutoCorrectEntry object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents an AutoCorrectEntries collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The individual object to be returned. Can be a Long indicating the ordinal position or a String representing the name of the individual object.

Return Value

AutoCorrectEntry

See also

Concepts

AutoCorrectEntries Collection Object

Other resources

AutoCorrectEntries Object Members


AutoCorrectEntry Object (Word)

 Copy code hover
[image]

AutoCorrectEntry Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a single AutoCorrect entry. The AutoCorrectEntry object is a member of the AutoCorrectEntries collection. The AutoCorrectEntries collection includes the entries in the AutoCorrect dialog box.

Remarks

Use Entries(index), where index is the AutoCorrect entry name or index number, to return a single AutoCorrectEntry object. You must exactly match the spelling (but not necessarily the capitalization) of the name, as it is shown under Replace in the AutoCorrect dialog box. The following example sets the value of the AutoCorrect entry named "teh."

VBA Copy code Copy code
AutoCorrect.Entries("teh").Value = "the"

Use the Apply method to insert an AutoCorrect entry at the specified range. The following example adds an AutoCorrect entry and then inserts it in place of the selection.

VBA Copy code Copy code
AutoCorrect.Entries.Add Name:="hellp", Value:="hello"
AutoCorrect.Entries("hellp").Apply Range:=Selection.Range

Use either the Add or AddRichText method to add an AutoCorrect entry to the list of available entries. The following example adds a plain-text AutoCorrect entry for the misspelling of the word "their.'

VBA Copy code Copy code
AutoCorrect.Entries.Add Name:="thier", Value:="their"

The following example creates an AutoCorrect entry named "PMO" based on the text and formatting of the selection.

VBA Copy code Copy code
AutoCorrect.Entries.AddRichText Name:="PMO", Range:=Selection.Range

See also

Concepts

Word Object Model Reference

Other resources

AutoCorrectEntry Object Members


AutoCorrectEntry Members (Word)

 Copy code hover
[image]

AutoCorrectEntry Members (Word)
Send feedback

Published: July 16, 2012

Represents a single AutoCorrect entry. The AutoCorrectEntry object is a member of the AutoCorrectEntries collection. The AutoCorrectEntries collection includes the entries in the AutoCorrect dialog box.

Methods

Name | Description
Apply | Replaces a range with the value of the specified AutoCorrect entry.
Delete | Deletes the specified AutoCorrect entry.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Index | Returns a Long that represents the position of an item in a collection. Read-only.
Name | Returns or sets the name of the specified object. Read/write String.
Parent | Returns an Object that represents the parent object of the specified AutoCorrectEntry object.
RichText | True if formatting is stored with the AutoCorrect entry replacement text. Read-only Boolean.
Value | Returns or sets the value of the AutoCorrect entry. Read/write String.


AutoCorrectEntry Properties (Word)

 Copy code hover
[image]

AutoCorrectEntry Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Index | Returns a Long that represents the position of an item in a collection. Read-only.
Name | Returns or sets the name of the specified object. Read/write String.
Parent | Returns an Object that represents the parent object of the specified AutoCorrectEntry object.
RichText | True if formatting is stored with the AutoCorrect entry replacement text. Read-only Boolean.
Value | Returns or sets the value of the AutoCorrect entry. Read/write String.


AutoCorrectEntry.Application Property (Word)

 Copy code hover
[image]

AutoCorrectEntry.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression A variable that represents an AutoCorrectEntry object.

See also

Concepts

AutoCorrectEntry Object

Other resources

AutoCorrectEntry Object Members


AutoCorrectEntry.Creator Property (Word)

 Copy code hover
[image]

AutoCorrectEntry.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents an AutoCorrectEntry object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

AutoCorrectEntry Object

Other resources

AutoCorrectEntry Object Members


AutoCorrectEntry.Index Property (Word)

 Copy code hover
[image]

AutoCorrectEntry.Index Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the position of an item in a collection. Read-only.

Syntax

expression .Index

expression Required. A variable that represents an AutoCorrectEntry object.

See also

Concepts

AutoCorrectEntry Object

Other resources

AutoCorrectEntry Object Members


AutoCorrectEntry.Name Property (Word)

 Copy code hover
[image]

AutoCorrectEntry.Name Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the name of the specified object. Read/write String.

Syntax

expression .Name

expression A variable that represents an AutoCorrectEntry object.

See also

Concepts

AutoCorrectEntry Object

Other resources

AutoCorrectEntry Object Members


AutoCorrectEntry.Parent Property (Word)

 Copy code hover
[image]

AutoCorrectEntry.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified AutoCorrectEntry object.

Syntax

expression .Parent

expression A variable that represents an AutoCorrectEntry object.

See also

Concepts

AutoCorrectEntry Object

Other resources

AutoCorrectEntry Object Members


AutoCorrectEntry.RichText Property (Word)

 Copy code hover
[image]

AutoCorrectEntry.RichText Property (Word)
See also Send feedback

Published: July 16, 2012

True if formatting is stored with the AutoCorrect entry replacement text. Read-only Boolean.

Syntax

expression .RichText

expression An expression that returns an AutoCorrectEntry object.

Example

This example determines whether AutoCorrect entry one is formatted.

VBA Copy code Copy code
MsgBox AutoCorrect.Entries(1).RichText

See also

Concepts

AutoCorrectEntry Object

Other resources

AutoCorrectEntry Object Members


AutoCorrectEntry.Value Property (Word)

 Copy code hover
[image]

AutoCorrectEntry.Value Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the value of the AutoCorrect entry. Read/write String.

Syntax

expression .Value

expression Required. A variable that represents an AutoCorrectEntry object.

Remarks

The Value property only returns the first 255 characters of the object's value.

Example

This example creates an AutoCorrect entry and then displays the value of the new entry.

VBA Copy code Copy code
AutoCorrect.Entries.Add Name:="i.e.", Value:="that is"
MsgBox AutoCorrect.Entries("i.e.").Value

See also

Concepts

AutoCorrectEntry Object

Other resources

AutoCorrectEntry Object Members


AutoCorrectEntry Methods (Word)

 Copy code hover
[image]

AutoCorrectEntry Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Apply | Replaces a range with the value of the specified AutoCorrect entry.
Delete | Deletes the specified AutoCorrect entry.


AutoCorrectEntry.Apply Method (Word)

 Copy code hover
[image]

AutoCorrectEntry.Apply Method (Word)
See also Send feedback

Published: July 16, 2012

Replaces a range with the value of the specified AutoCorrect entry.

Syntax

expression .Apply(Range)

expression Required. A variable that represents an AutoCorrectEntry object.

Parameters

Name | Required/Optional | Data Type | Description
Range | Required | Range | The range to which to apply the AutoCorrect entry.

Example

This example adds an AutoCorrect replacement entry, then applies the "sr" AutoCorrect entry to the selected text.

VBA Copy code Copy code
AutoCorrect.Entries.Add Name:= "sr", Value:= "Stella Richards"
AutoCorrect.Entries("sr").Apply Selection.Range

This example applies the "sr" AutoCorrect entry to the first word in the active document.

VBA Copy code Copy code
AutoCorrect.Entries("sr").Apply ActiveDocument.Words(1)

See also

Concepts

AutoCorrectEntry Object

Other resources

AutoCorrectEntry Object Members


AutoCorrectEntry.Delete Method (Word)

 Copy code hover
[image]

AutoCorrectEntry.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the specified AutoCorrect entry.

Syntax

expression .Delete

expression Required. A variable that represents an AutoCorrectEntry object.

See also

Concepts

AutoCorrectEntry Object

Other resources

AutoCorrectEntry Object Members


AutoTextEntries Object (Word)

 Copy code hover
[image]

AutoTextEntries Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of AutoCorrectEntry objects that represent the AutoText entries in a template. The AutoTextEntries collection includes all the entries listed on the AutoText tab in the AutoCorrect dialog box.

Remarks

Use the AutoTextEntries property to return the AutoTextEntries collection. The following example determines whether an AutoTextEntry object named "test" is in the AutoTextEntries collection.

VBA Copy code Copy code
For Each i In NormalTemplate.AutoTextEntries
 If LCase(i.Name) = "test" Then MsgBox "AutoText entry exists"
Next i

Use the Add method to add an AutoText entry to the AutoTextEntries collection. The following example adds an AutoText entry named "Blue" based on the text of the selection.

VBA Copy code Copy code
NormalTemplate.AutoTextEntries.Add Name:="Blue", _
 Range:=Selection.Range

Use AutoTextEntries(index), where index is the AutoText entry name or index number, to return a single AutoTextEntry object. You must exactly match the spelling (but not necessarily the capitalization) of the name, as it is shown on the AutoText tab in the AutoCorrect dialog box. The following example sets the value of an existing AutoText entry named "cName."

VBA Copy code Copy code
NormalTemplate.AutoTextEntries("cName").Value = _
 "The Johnson Company"

The following example displays the name and value of the first AutoText entry in the template attached to the active document.

VBA Copy code Copy code
Set myTemplate = ActiveDocument.AttachedTemplate
MsgBox "Name = " & myTemplate.AutoTextEntries(1).Name & vbCr _
 & "Value " & myTemplate.AutoTextEntries(1).Value

See also

Concepts

Word Object Model Reference

Other resources

AutoTextEntries Object Members


AutoTextEntries Members (Word)

 Copy code hover
[image]

AutoTextEntries Members (Word)
Send feedback

Published: July 16, 2012

A collection of AutoCorrectEntry objects that represent the AutoText entries in a template. The AutoTextEntries collection includes all the entries listed on the AutoText tab in the AutoCorrect dialog box.

Methods

Name | Description
Add | Returns an AutoTextEntry object that represents an AutoText entry added to the list of available AutoText entries.
AppendToSpike | Deletes the specified range and adds the contents of the range to the Spike (a built-in AutoText entry). This method returns the Spike as an AutoTextEntry object.
Item | Returns an individual AutoTextEntry object in a collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns the number of items in the AutoTextEntries collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified AutoTextEntries collection.


AutoTextEntries Properties (Word)

 Copy code hover
[image]

AutoTextEntries Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns the number of items in the AutoTextEntries collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified AutoTextEntries collection.


AutoTextEntries.Application Property (Word)

 Copy code hover
[image]

AutoTextEntries.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression A variable that represents a AutoTextEntries object.

See also

Concepts

AutoTextEntries Collection Object

Other resources

AutoTextEntries Object Members


AutoTextEntries.Count Property (Word)

 Copy code hover
[image]

AutoTextEntries.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the number of items in the AutoTextEntries collection. Read-only Long.

Syntax

expression .Count

expression A variable that represents a AutoTextEntries object.

See also

Concepts

AutoTextEntries Collection Object

Other resources

AutoTextEntries Object Members


AutoTextEntries.Creator Property (Word)

 Copy code hover
[image]

AutoTextEntries.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents an AutoTextEntries object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

AutoTextEntries Collection Object

Other resources

AutoTextEntries Object Members


AutoTextEntries.Parent Property (Word)

 Copy code hover
[image]

AutoTextEntries.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified AutoTextEntries collection.

Syntax

expression .Parent

expression A variable that represents an AutoTextEntries collection.

See also

Concepts

AutoTextEntries Collection Object

Other resources

AutoTextEntries Object Members


AutoTextEntries Methods (Word)

 Copy code hover
[image]

AutoTextEntries Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Returns an AutoTextEntry object that represents an AutoText entry added to the list of available AutoText entries.
AppendToSpike | Deletes the specified range and adds the contents of the range to the Spike (a built-in AutoText entry). This method returns the Spike as an AutoTextEntry object.
Item | Returns an individual AutoTextEntry object in a collection.


AutoTextEntries.Add Method (Word)

 Copy code hover
[image]

AutoTextEntries.Add Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an AutoTextEntry object that represents an AutoText entry added to the list of available AutoText entries.

Syntax

expression .Add(Name, Range)

expression Required. A variable that represents an AutoTextEntries collection.

Parameters

Name | Required/Optional | Data Type | Description
Name | Required | String | The text that, when typed, initiates an AutoText entry.
Range | Required | Range | A range of text that will be inserted whenever Name is typed.

Example

This example adds an AutoText entry named Sample Text that contains the text in the selection. This example assumes you have text selected in the active document.

VBA Copy code Copy code
Sub AutoTxt()
 NormalTemplate.AutoTextEntries.Add Name:="Sample Text", _
 Range:=Selection.Range
End Sub

See also

Concepts

AutoTextEntries Collection Object

Other resources

AutoTextEntries Object Members


AutoTextEntries.AppendToSpike Method (Word)

 Copy code hover
[image]

AutoTextEntries.AppendToSpike Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the specified range and adds the contents of the range to the Spike (a built-in AutoText entry). This method returns the Spike as an AutoTextEntry object.

Syntax

expression .AppendToSpike(Range)

expression Required. A variable that represents an AutoTextEntries collection.

Parameters

Name | Required/Optional | Data Type | Description
Range | Required | Range | The range that's deleted and appended to the Spike.

Return Value

AutoTextEntry

Remarks

The AppendToSpike method is only valid for the AutoTextEntries collection in the Normal template.

Example

This example deletes the selection and adds its contents to the Spike in the Normal template.

VBA Copy code Copy code
If Len(Selection.Range.Text) > 1 Then
 NormalTemplate.AutoTextEntries.AppendToSpike _
 Range:=Selection.Range
End If

This example clears the Spike and adds the first and third words in the active document to the Spike in the Normal template. The contents of the Spike are then inserted at the insertion point.

VBA Copy code Copy code
Dim atEntry As AutoTextEntry
Selection.Collapse Direction:=wdCollapseStart
For Each atEntry In NormalTemplate.AutoTextEntries
 If atEntry.Name = "Spike" Then atEntry.Delete
Next atEntry
With NormalTemplate.AutoTextEntries
 .AppendToSpike Range:=ActiveDocument.Words(3)
 .AppendToSpike Range:=ActiveDocument.Words(1)
 .Item("Spike").Insert Where:=Selection.Range
End With

See also

Concepts

AutoTextEntries Collection Object

Other resources

AutoTextEntries Object Members


AutoTextEntries.Item Method (Word)

 Copy code hover
[image]

AutoTextEntries.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual AutoTextEntry object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents an AutoTextEntries collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The individual object to be returned. Can be a Long indicating the ordinal position or a String representing the name of the individual object.

Return Value

AutoTextEntry

See also

Concepts

AutoTextEntries Collection Object

Other resources

AutoTextEntries Object Members


AutoTextEntry Object (Word)

 Copy code hover
[image]

AutoTextEntry Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a single AutoText entry. The AutoTextEntry object is a member of the AutoTextEntries collection. The AutoTextEntries collection contains all the AutoText entries in the specified template. The entries are listed on the AutoText tab in the AutoCorrect dialog box.

Remarks

Use AutoTextEntries(index), where index is the AutoText entry name or index number, to return a single AutoTextEntry object. You must exactly match the spelling (but not necessarily the capitalization) of the name, as it is shown on the AutoText tab in the AutoCorrect dialog box. The following example sets the value of an existing AutoText entry named "cName."

VBA Copy code Copy code
NormalTemplate.AutoTextEntries("cName").Value = _
 "The Johnson Company"

The following example displays the name and value of the first AutoText entry in the template attached to the active document.

VBA Copy code Copy code
Set myTemplate = ActiveDocument.AttachedTemplate
MsgBox "Name = " & myTemplate.AutoTextEntries(1).Name & vbCr _
 & "Value " & myTemplate.AutoTextEntries(1).Value

The following example inserts the global AutoText entry named "TheWorld" at the insertion point.

VBA Copy code Copy code
Selection.Collapse Direction:=wdCollapseEnd
NormalTemplate.AutoTextEntries("TheWorld").Insert _
 Where:=Selection.Range

Use the Add method to add an AutoTextEntry object to the AutoTextEntries collection. The following example adds an AutoText entry named "Blue" based on the text of the selection.

VBA Copy code Copy code
NormalTemplate.AutoTextEntries.Add Name:="Blue", _
 Range:=Selection.Range

See also

Concepts

Word Object Model Reference

Other resources

AutoTextEntry Object Members


AutoTextEntry Members (Word)

 Copy code hover
[image]

AutoTextEntry Members (Word)
Send feedback

Published: July 16, 2012

Represents a single AutoText entry. The AutoTextEntry object is a member of the AutoTextEntries collection. The AutoTextEntries collection contains all the AutoText entries in the specified template. The entries are listed on the AutoText tab in the AutoCorrect dialog box.

Methods

Name | Description
Delete | Deletes the specified object.
Insert | Inserts the AutoText entry in place of the specified range. Returns a Range object that represents the AutoText entry.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Index | Returns a Long that represents the position of an item in a collection. Read-only.
Name | Returns or sets the name of the specified object.Read/write String.
Parent | Returns an Object that represents the parent object of the specified AutoTextEntries collection.
StyleName | Returns the name of the style applied to the specified AutoText entry. Read-only String.
Value | Returns or sets the value of the AutoText entry. Read/write String.


AutoTextEntry Properties (Word)

 Copy code hover
[image]

AutoTextEntry Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Index | Returns a Long that represents the position of an item in a collection. Read-only.
Name | Returns or sets the name of the specified object.Read/write String.
Parent | Returns an Object that represents the parent object of the specified AutoTextEntries collection.
StyleName | Returns the name of the style applied to the specified AutoText entry. Read-only String.
Value | Returns or sets the value of the AutoText entry. Read/write String.


AutoTextEntry.Application Property (Word)

 Copy code hover
[image]

AutoTextEntry.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression A variable that represents a AutoTextEntry object.

See also

Concepts

AutoTextEntry Object

Other resources

AutoTextEntry Object Members


AutoTextEntry.Creator Property (Word)

 Copy code hover
[image]

AutoTextEntry.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents an AutoTextEntry object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

AutoTextEntry Object

Other resources

AutoTextEntry Object Members


AutoTextEntry.Index Property (Word)

 Copy code hover
[image]

AutoTextEntry.Index Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the position of an item in a collection. Read-only.

Syntax

expression .Index

expression Required. A variable that represents an AutoTextEntry object.

See also

Concepts

AutoTextEntry Object

Other resources

AutoTextEntry Object Members


AutoTextEntry.Name Property (Word)

 Copy code hover
[image]

AutoTextEntry.Name Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the name of the specified object.Read/write String.

Syntax

expression .Name

expression A variable that represents a AutoTextEntry object.

See also

Concepts

AutoTextEntry Object

Other resources

AutoTextEntry Object Members


AutoTextEntry.Parent Property (Word)

 Copy code hover
[image]

AutoTextEntry.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified AutoTextEntries collection.

Syntax

expression .Parent

expression A variable that represents an AutoTextEntry object.

See also

Concepts

AutoTextEntry Object

Other resources

AutoTextEntry Object Members


AutoTextEntry.StyleName Property (Word)

 Copy code hover
[image]

AutoTextEntry.StyleName Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the name of the style applied to the specified AutoText entry. Read-only String.

Syntax

expression .StyleName

expression A variable that represents a AutoTextEntry object.

Example

This example creates an AutoText entry and then displays the style name of the entry.

VBA Copy code Copy code
Set myentry = NormalTemplate.AutoTextEntries.Add(Name:="rsvp", _
 Range:=Selection.Range)
MsgBox myentry.StyleName

See also

Concepts

AutoTextEntry Object

Other resources

AutoTextEntry Object Members


AutoTextEntry.Value Property (Word)

 Copy code hover
[image]

AutoTextEntry.Value Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the value of the AutoText entry. Read/write String.

Syntax

expression .Value

expression Required. A variable that represents an AutoTextEntry object.

Remarks

Setting the Value property only returns the first 255 characters of the object's value.

See also

Concepts

AutoTextEntry Object

Other resources

AutoTextEntry Object Members


AutoTextEntry Methods (Word)

 Copy code hover
[image]

AutoTextEntry Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the specified object.
Insert | Inserts the AutoText entry in place of the specified range. Returns a Range object that represents the AutoText entry.


AutoTextEntry.Delete Method (Word)

 Copy code hover
[image]

AutoTextEntry.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the specified object.

Syntax

expression .Delete

expression Required. A variable that represents an AutoTextEntry object.

See also

Concepts

AutoTextEntry Object

Other resources

AutoTextEntry Object Members


AutoTextEntry.Insert Method (Word)

 Copy code hover
[image]

AutoTextEntry.Insert Method (Word)
See also Send feedback

Published: July 16, 2012

Inserts the AutoText entry in place of the specified range. Returns a Range object that represents the AutoText entry.

Syntax

expression .Insert(Where, RichText)

expression Required. A variable that represents an AutoTextEntry object.

Parameters

Name | Required/Optional | Data Type | Description
Where | Required | Range | The location for the AutoText entry.
RichText | Optional | Variant | True to insert the AutoText entry with its original formatting.

Return Value

Range

Remarks

If you don't want to replace the range, use the Collapse method before using this method.

Example

This example inserts the formatted AutoText entry named "one" after the selection.

VBA Copy code Copy code
Sub InsertAutoTextEntry()
 ActiveDocument.Content.Select
 Selection.Collapse Direction:=wdCollapseEnd
 ActiveDocument.AttachedTemplate.AutoTextEntries("one").Insert _
 Where:=Selection.Range, RichText:=True
End Sub

See also

Concepts

AutoTextEntry Object

Other resources

AutoTextEntry Object Members


Axes Object (Word)

 Copy code hover
[image]

Axes Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a collection of all the Axis objects in the specified chart.

Version Information

Version Added: Word 2007

Remarks

Use the Axes method to return the Axes collection.

Use Axes(Type, AxisGroup), where Type is the axis type and AxisGroup is the axis group, to return an Axes collection that contains a single Axis object. Type can be one of the following XlAxisType constants: xlCategory, xlSeries, or xlValue. AxisGroup can be one of the following XlAxisGroup constants: xlPrimary or xlSecondary.

Example

The following example displays the number of axes for the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 MsgBox .Chart.Axes.Count
 End If
End With

The following example sets the category axis title text for the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.Axes(xlCategory)
 .HasTitle = True
 .AxisTitle.Caption = "1994"
 End With
 End If
End With

See also

Concepts

Word Object Model Reference

Other resources

Axes Object Members


Axes Members (Word)

 Copy code hover
[image]

Axes Members (Word)
Send feedback

Published: July 16, 2012

Represents a collection of all the Axis objects in the specified chart.

Methods

Name | Description
Item | Returns a single Axis object from an Axes collection.

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
Count | Returns the number of objects in the collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns the parent for the specified object. Read-only Object.


Axes Properties (Word)

 Copy code hover
[image]

Axes Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
Count | Returns the number of objects in the collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns the parent for the specified object. Read-only Object.


Axes.Application Property (Word)

 Copy code hover
[image]

Axes.Application Property (Word)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Application

expression A variable that represents an Axes object.

Example

The following example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveDocument
If myObject.Application.Value = "Microsoft Word" Then
 MsgBox "This is a Word Application object."
Else
 MsgBox "This is not a Word Application object."
End If

See also

Concepts

Axes Object

Other resources

Axes Object Members


Axes.Count Property (Word)

 Copy code hover
[image]

Axes.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the number of objects in the collection. Read-only Long.

Version Information

Version Added: Word 2007

Syntax

expression .Count

expression A variable that represents an Axes object.

See also

Concepts

Axes Object

Other resources

Axes Object Members


Axes.Creator Property (Word)

 Copy code hover
[image]

Axes.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version Information

Version Added: Word 2007

Syntax

expression .Creator

expression A variable that represents an Axes object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office for Mac.

See also

Concepts

Axes Object

Other resources

Axes Object Members


Axes.Parent Property (Word)

 Copy code hover
[image]

Axes.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the parent for the specified object. Read-only Object.

Version Information

Version Added: Word 2007

Syntax

expression .Parent

expression A variable that represents an Axes object.

See also

Concepts

Axes Object

Other resources

Axes Object Members


Axes Methods (Word)

 Copy code hover
[image]

Axes Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Item | Returns a single Axis object from an Axes collection.


Axes.Item Method (Word)

 Copy code hover
[image]

Axes.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a single Axis object from an Axes collection.

Version Information

Version Added: Word 2007

Syntax

expression .Item(Type, AxisGroup)

expression A variable that represents an Axes object.

Parameters

Name | Required/Optional | Data Type | Description
Type | Required | XlAxisType | One of the enumeration values that specifies the axis type.
AxisGroup | Optional | XlAxisGroup | One of the enumeration values that specifies the axis.

Example

The following example sets the title text for the category axis for the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.Axes.Item(xlCategory)
 .HasTitle = True
 .AxisTitle.Caption = "1994"
 End With
 End If
End With

See also

Concepts

Axes Object

Other resources

Axes Object Members


Axis Object (Word)

 Copy code hover
[image]

Axis Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a single axis in a chart.

Version Information

Version Added: Word 2007

Remarks

The Axis object is a member of the Axes collection.

Use Axes(Type, AxisGroup) where Type is the axis type and AxisGroup is the axis group to return a single Axis object. Type can be one of the following XlAxisType constants: xlCategory, xlSeries, or xlValue. AxisGroup can be one of the following XlAxisGroup constants: xlPrimary or xlSecondary. For more information, see the Axes method.

Example

The following example sets the category axis title text for the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.Axes(xlCategory)
 .HasTitle = True
 .AxisTitle.Caption = "1994"
 End With
 End If
End With

See also

Concepts

Word Object Model Reference

Other resources

Axis Object Members


Axis Members (Word)

 Copy code hover
[image]

Axis Members (Word)
Send feedback

Published: July 16, 2012

Represents a single axis in a chart.

Methods

Name | Description
Delete | Deletes the object.
Select | Selects the object.

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
AxisBetweenCategories | True if the value axis crosses the category axis between categories. Read/write Boolean.
AxisGroup | Returns the type of axis group. Read-only XlAxisGroup.
AxisTitle | Returns the title of the specified axis. Read-only AxisTitle.
BaseUnit | Returns or sets the base unit for the specified category axis. Read/write XlTimeUnit.
BaseUnitIsAuto | True if Microsoft Word chooses appropriate base units for the specified category axis. The default is True. Read/write Boolean.
Border | Returns the border of the object. Read-only ChartBorder.
CategoryNames | Returns or sets all the category names as a text array for the specified axis. Read/write Variant.
CategoryType | Returns or sets the category axis type. Read/write XlCategoryType.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Crosses | Returns or sets the point on the specified axis where the other axis crosses. Read/write Long.
CrossesAt | Returns or sets the point on the value axis where the category axis crosses it. Applies only to the value axis. Read/write Double.
DisplayUnit | Returns or sets the unit label for the value axis. Read/write XlDisplayUnit, xlCustom, or xlNone.
DisplayUnitCustom | If the value of the DisplayUnit property is xlCustom, returns or sets the value of the displayed units. Read/write Double.
DisplayUnitLabel | Returns the DisplayUnitLabel object for the specified axis. Returns null if the HasDisplayUnitLabel property is set to False. Read-only.
Format | Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.
HasDisplayUnitLabel | True if the label specified by the DisplayUnit or DisplayUnitCustom property is displayed on the specified axis. The default is True. Read/write Boolean.
HasMajorGridlines | True if the axis has major gridlines. Read/write Boolean.
HasMinorGridlines | True if the axis has minor gridlines. Read/write Boolean.
HasTitle | True if the axis or chart has a visible title. Read/write Boolean.
Height | Returns the height, in points, of the object. Read-only Double.
Left | Returns the distance, in points, from the left edge of the object to the left edge of the chart area. Read-only Double.
LogBase | Returns or sets the base of the logarithm when you are using log scales. Read/write Double.
MajorGridlines | Returns the major gridlines for the specified axis. Read-only Gridlines.
MajorTickMark | Returns or sets the type of major tick mark for the specified axis. Read/write XlTickMark.
MajorUnit | Returns or sets the major units for the value axis. Read/write Double.
MajorUnitIsAuto | True if Microsoft Word calculates the major units for the value axis. Read/write Boolean.
MajorUnitScale | Returns or sets the major unit scale value for the category axis when the CategoryType property is set to xlTimeScale. Read/write XlTimeUnit.
MaximumScale | Returns or sets the maximum value on the value axis. Read/write Double.
MaximumScaleIsAuto | True if Microsoft Word calculates the maximum value for the value axis. Read/write Boolean.
MinimumScale | Returns or sets the minimum value on the value axis. Read/write Double.
MinimumScaleIsAuto | True if Microsoft Word calculates the minimum value for the value axis. Read/write Boolean.
MinorGridlines | Returns the minor gridlines for the specified axis. Read-only Gridlines.
MinorTickMark | Returns or sets the type of minor tick mark for the specified axis. Read/write XlTickMark.
MinorUnit | Returns or sets the minor units on the value axis. Read/write Double.
MinorUnitIsAuto | True if Microsoft Word calculates minor units for the value axis. Read/write Boolean.
MinorUnitScale | Returns or sets the minor unit scale value for the category axis when the CategoryType property is set to xlTimeScale. Read/write XlTimeUnit.
Parent | Returns the parent for the specified object. Read-only Object.
ReversePlotOrder | True if Microsoft Word plots data points from last to first. Read/write Boolean.
ScaleType | Returns or sets the value axis scale type. Read/write XlScaleType.
TickLabelPosition | Describes the position of tick-mark labels on the specified axis. Read/write XlTickLabelPosition.
TickLabels | Returns the tick-mark labels for the specified axis. Read-only TickLabels.
TickLabelSpacing | Returns or sets the number of categories or series between tick-mark labels. Read/write Long.
TickLabelSpacingIsAuto | Returns or sets a value that indicates whether the tick label spacing is automatic. Read/write Boolean.
TickMarkSpacing | Returns or sets the number of categories or series between tick marks. Read/write Long.
Top | Returns the distance, in points, from the top edge of the object to the top of row 1 (on a worksheet) or the top of the chart area (on a chart). Read-only Double.
Type | Returns the axis type. Read-only XlAxisType.
Width | Returns the width, in points, of the object. Read-only Double.


Axis Properties (Word)

 Copy code hover
[image]

Axis Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
AxisBetweenCategories | True if the value axis crosses the category axis between categories. Read/write Boolean.
AxisGroup | Returns the type of axis group. Read-only XlAxisGroup.
AxisTitle | Returns the title of the specified axis. Read-only AxisTitle.
BaseUnit | Returns or sets the base unit for the specified category axis. Read/write XlTimeUnit.
BaseUnitIsAuto | True if Microsoft Word chooses appropriate base units for the specified category axis. The default is True. Read/write Boolean.
Border | Returns the border of the object. Read-only ChartBorder.
CategoryNames | Returns or sets all the category names as a text array for the specified axis. Read/write Variant.
CategoryType | Returns or sets the category axis type. Read/write XlCategoryType.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Crosses | Returns or sets the point on the specified axis where the other axis crosses. Read/write Long.
CrossesAt | Returns or sets the point on the value axis where the category axis crosses it. Applies only to the value axis. Read/write Double.
DisplayUnit | Returns or sets the unit label for the value axis. Read/write XlDisplayUnit, xlCustom, or xlNone.
DisplayUnitCustom | If the value of the DisplayUnit property is xlCustom, returns or sets the value of the displayed units. Read/write Double.
DisplayUnitLabel | Returns the DisplayUnitLabel object for the specified axis. Returns null if the HasDisplayUnitLabel property is set to False. Read-only.
Format | Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.
HasDisplayUnitLabel | True if the label specified by the DisplayUnit or DisplayUnitCustom property is displayed on the specified axis. The default is True. Read/write Boolean.
HasMajorGridlines | True if the axis has major gridlines. Read/write Boolean.
HasMinorGridlines | True if the axis has minor gridlines. Read/write Boolean.
HasTitle | True if the axis or chart has a visible title. Read/write Boolean.
Height | Returns the height, in points, of the object. Read-only Double.
Left | Returns the distance, in points, from the left edge of the object to the left edge of the chart area. Read-only Double.
LogBase | Returns or sets the base of the logarithm when you are using log scales. Read/write Double.
MajorGridlines | Returns the major gridlines for the specified axis. Read-only Gridlines.
MajorTickMark | Returns or sets the type of major tick mark for the specified axis. Read/write XlTickMark.
MajorUnit | Returns or sets the major units for the value axis. Read/write Double.
MajorUnitIsAuto | True if Microsoft Word calculates the major units for the value axis. Read/write Boolean.
MajorUnitScale | Returns or sets the major unit scale value for the category axis when the CategoryType property is set to xlTimeScale. Read/write XlTimeUnit.
MaximumScale | Returns or sets the maximum value on the value axis. Read/write Double.
MaximumScaleIsAuto | True if Microsoft Word calculates the maximum value for the value axis. Read/write Boolean.
MinimumScale | Returns or sets the minimum value on the value axis. Read/write Double.
MinimumScaleIsAuto | True if Microsoft Word calculates the minimum value for the value axis. Read/write Boolean.
MinorGridlines | Returns the minor gridlines for the specified axis. Read-only Gridlines.
MinorTickMark | Returns or sets the type of minor tick mark for the specified axis. Read/write XlTickMark.
MinorUnit | Returns or sets the minor units on the value axis. Read/write Double.
MinorUnitIsAuto | True if Microsoft Word calculates minor units for the value axis. Read/write Boolean.
MinorUnitScale | Returns or sets the minor unit scale value for the category axis when the CategoryType property is set to xlTimeScale. Read/write XlTimeUnit.
Parent | Returns the parent for the specified object. Read-only Object.
ReversePlotOrder | True if Microsoft Word plots data points from last to first. Read/write Boolean.
ScaleType | Returns or sets the value axis scale type. Read/write XlScaleType.
TickLabelPosition | Describes the position of tick-mark labels on the specified axis. Read/write XlTickLabelPosition.
TickLabels | Returns the tick-mark labels for the specified axis. Read-only TickLabels.
TickLabelSpacing | Returns or sets the number of categories or series between tick-mark labels. Read/write Long.
TickLabelSpacingIsAuto | Returns or sets a value that indicates whether the tick label spacing is automatic. Read/write Boolean.
TickMarkSpacing | Returns or sets the number of categories or series between tick marks. Read/write Long.
Top | Returns the distance, in points, from the top edge of the object to the top of row 1 (on a worksheet) or the top of the chart area (on a chart). Read-only Double.
Type | Returns the axis type. Read-only XlAxisType.
Width | Returns the width, in points, of the object. Read-only Double.


Axis.Application Property (Word)

 Copy code hover
[image]

Axis.Application Property (Word)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Application

expression A variable that represents an Axis object.

Example

The following example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveDocument
If myObject.Application.Value = "Microsoft Word" Then
 MsgBox "This is a Word Application object."
Else
 MsgBox "This is not a Word Application object."
End If

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.AxisBetweenCategories Property (Word)

 Copy code hover
[image]

Axis.AxisBetweenCategories Property (Word)
See also Send feedback

Published: July 16, 2012

True if the value axis crosses the category axis between categories. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .AxisBetweenCategories

expression A variable that represents an Axis object.

Remarks

This property applies only to category axes, and it does not apply to 3-D charts.

Example

The following example causes the value axis for the first chart in the active document to cross the category axis between categories.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.Axes(xlCategory). _
 AxisBetweenCategories = True
 End If
End With

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.AxisGroup Property (Word)

 Copy code hover
[image]

Axis.AxisGroup Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the type of axis group. Read-only XlAxisGroup.

Version Information

Version Added: Word 2007

Syntax

expression .AxisGroup

expression A variable that represents an Axis object.

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.AxisTitle Property (Word)

 Copy code hover
[image]

Axis.AxisTitle Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the title of the specified axis. Read-only AxisTitle.

Version Information

Version Added: Word 2007

Syntax

expression .AxisTitle

expression A variable that represents an Axis object.

Example

The following example adds an axis label to the category axis for the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.Axes(xlCategory)
 .HasTitle = True
 .AxisTitle.Text = "July Sales"
 End With
 End If
End With

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.BaseUnit Property (Word)

 Copy code hover
[image]

Axis.BaseUnit Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the base unit for the specified category axis. Read/write XlTimeUnit.

Version Information

Version Added: Word 2007

Syntax

expression .BaseUnit

expression A variable that represents an Axis object.

Remarks

Setting this property has no visible effect if the CategoryType property for the specified axis is set to xlCategoryScale. The set value is retained, however, and takes effect when the CategoryType property is set to xlTimeScale.

You cannot set this property for a value axis.

Example

The following example sets the category axis for the first chart in the active document to use a time scale, using months as the base unit.

VBA Copy code Copy code

With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart
 .Axes(xlCategory).CategoryType = xlTimeScale
 .Axes(xlCategory).BaseUnit = xlMonths
 End With
 End If
End With

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.BaseUnitIsAuto Property (Word)

 Copy code hover
[image]

Axis.BaseUnitIsAuto Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word chooses appropriate base units for the specified category axis. The default is True. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .BaseUnitIsAuto

expression A variable that represents an Axis object.

Remarks

You cannot set this property for a value axis.

Example

The following example sets the category axis for the first chart in the active document to use a time scale, with the base unit automatically chosen by Word.

VBA Copy code Copy code

With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart
 .Axes(xlCategory).CategoryType = xlTimeScale
 .Axes(xlCategory).BaseUnitIsAuto = True
 End With
 End If
End With

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.Border Property (Word)

 Copy code hover
[image]

Axis.Border Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the border of the object. Read-only ChartBorder.

Version Information

Version Added: Word 2007

Syntax

expression .Border

expression A variable that represents an Axis object.

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.CategoryNames Property (Word)

 Copy code hover
[image]

Axis.CategoryNames Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets all the category names as a text array for the specified axis. Read/write Variant.

Version Information

Version Added: Word 2007

Syntax

expression .CategoryNames

expression A variable that represents an Axis object.

Example

The following example uses an array to set individual category names for the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.Axes(xlCategory).CategoryNames = _
 Array ("1985", "1986", "1987", "1988", "1989")
 End If
End With

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.CategoryType Property (Word)

 Copy code hover
[image]

Axis.CategoryType Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the category axis type. Read/write XlCategoryType.

Version Information

Version Added: Word 2007

Syntax

expression .CategoryType

expression A variable that represents an Axis object.

Remarks

You cannot set this property for a value axis.

Example

The following example sets the category axis for the first chart in the active document to use a time scale, using months as the base unit.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.Axes(xlCategory)
 .CategoryType = xlTimeScale
 .BaseUnit = xlMonths
 End With
 End If
End With

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.Creator Property (Word)

 Copy code hover
[image]

Axis.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version Information

Version Added: Word 2007

Syntax

expression .Creator

expression A variable that represents an Axis object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Word has the creator code MSWD. For more information about this property, consult the language reference Help included with Microsoft Office for Mac.

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.Crosses Property (Word)

 Copy code hover
[image]

Axis.Crosses Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the point on the specified axis where the other axis crosses. Read/write Long.

Version Information

Version Added: Word 2007

Syntax

expression .Crosses

expression A variable that represents an Axis object.

Remarks

This property is not available for radar charts. For 3-D charts, this property can be applied only to the value axis and indicates where the plane defined by the category axes crosses the value axis.

You can use this property for both category and value axes. On the category axis, xlMinimum sets the value axis to cross at the first category, and xlMaximum sets the value axis to cross at the last category. xlMinimum and xlMaximum are constants in the XlAxisCrosses enumeration.

Note that xlMinimum and xlMaximum can have different meanings, depending on the axis.

Example

The following example sets the value axis in for the first chart in the active document to cross the category axis at the maximum x-axis value.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.Axes(xlCategory).Crosses = xlMaximum
 End If
End With

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.CrossesAt Property (Word)

 Copy code hover
[image]

Axis.CrossesAt Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the point on the value axis where the category axis crosses it. Applies only to the value axis. Read/write Double.

Version Information

Version Added: Word 2007

Syntax

expression .CrossesAt

expression A variable that represents an Axis object.

Remarks

Setting this property causes the Crosses property to change to xlAxisCrossesCustom. xlAxisCrossesCustom is a constant in the XlAxisCrosses enumeration.

You cannot use this property on radar charts. For 3-D charts, this property indicates where the plane defined by the category axes crosses the value axis.

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.DisplayUnit Property (Word)

 Copy code hover
[image]

Axis.DisplayUnit Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the unit label for the value axis. Read/write XlDisplayUnit, xlCustom, or xlNone.

Version Information

Version Added: Word 2007

Syntax

expression .DisplayUnit

expression A variable that represents an Axis object.

Remarks

Using unit labels when charting large values makes your tick-mark labels easier to read. For example, if you label your value axis in units of hundreds, thousands, or millions, you can use smaller numeric values at the tick marks on the axis.

Example

The following example sets the units displayed on the value axis of the first chart in the active document to hundreds.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.Axes(xlValue)
 .DisplayUnit = xlHundreds
 .HasTitle = True
 .AxisTitle.Caption = "Rebate Amounts"
 End With
 End If
End With

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.DisplayUnitCustom Property (Word)

 Copy code hover
[image]

Axis.DisplayUnitCustom Property (Word)
See also Send feedback

Published: July 16, 2012

If the value of the DisplayUnit property is xlCustom, returns or sets the value of the displayed units. Read/write Double.

Version Information

Version Added: Word 2007

Syntax

expression .DisplayUnitCustom

expression A variable that represents an Axis object.

Remarks

The value of this property must be from 0 through 10E307.

Using unit labels when charting large values makes your tick-mark labels easier to read. For example, if you label your value axis in units of hundreds, thousands, or millions, you can use smaller numeric values at the tick marks on the axis.

Example

The following example sets the units displayed on the value axis of the first chart in the active document to increments of 500.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.Axes(xlValue)
 .DisplayUnit = xlCustom
 .DisplayUnitCustom = 500
 .HasTitle = True
 .AxisTitle.Caption = "Rebate Amounts"
 End With
 End If
End With

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.DisplayUnitLabel Property (Word)

 Copy code hover
[image]

Axis.DisplayUnitLabel Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the DisplayUnitLabel object for the specified axis. Returns null if the HasDisplayUnitLabel property is set to False. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .DisplayUnitLabel

expression A variable that represents an Axis object.

Example

The following example sets the label caption to "Millions" for the value axis of the first chart in the active document, and then it turns off automatic font scaling.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.Axes(xlValue).DisplayUnitLabel
 .Caption = "Millions"
 .AutoScaleFont = False
 End With
 End If
End With

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.Format Property (Word)

 Copy code hover
[image]

Axis.Format Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.

Version Information

Version Added: Word 2007

Syntax

expression .Format

expression A variable that represents an Axis object.

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.HasDisplayUnitLabel Property (Word)

 Copy code hover
[image]

Axis.HasDisplayUnitLabel Property (Word)
See also Send feedback

Published: July 16, 2012

True if the label specified by the DisplayUnit or DisplayUnitCustom property is displayed on the specified axis. The default is True. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .HasDisplayUnitLabel

expression A variable that represents an Axis object.

Example

The following example sets the units on the value axis of the first chart in the active document to increments of 500 but keeps the unit label hidden.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.Axes(xlValue)
 .DisplayUnit = xlCustom
 .DisplayUnitCustom = 500
 .AxisTitle.Caption = "Rebate Amounts"
 .HasDisplayUnitLabel = False
 End With
 End If
End With

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.HasMajorGridlines Property (Word)

 Copy code hover
[image]

Axis.HasMajorGridlines Property (Word)
See also Send feedback

Published: July 16, 2012

True if the axis has major gridlines. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .HasMajorGridlines

expression A variable that represents an Axis object.

Remarks

Only axes in the primary axis group can have gridlines.

Example

The following example sets the color of the major gridlines for the value axis of the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.Axes(xlValue)
 If .HasMajorGridlines Then
 ' Set the color to red.
 .MajorGridlines.Border.ColorIndex = 3
 End If
 End With
 End If
End With

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.HasMinorGridlines Property (Word)

 Copy code hover
[image]

Axis.HasMinorGridlines Property (Word)
See also Send feedback

Published: July 16, 2012

True if the axis has minor gridlines. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .HasMinorGridlines

expression A variable that represents an Axis object.

Remarks

Only axes in the primary axis group can have gridlines.

Example

The following example sets the color of the minor gridlines for the value axis of the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.Axes(xlValue)
 If .HasMinorGridlines Then
 ' Set the color to green.
 .MinorGridlines.Border.ColorIndex = 4
 End If
 End With
 End If
End With

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.HasTitle Property (Word)

 Copy code hover
[image]

Axis.HasTitle Property (Word)
See also Send feedback

Published: July 16, 2012

True if the axis or chart has a visible title. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .HasTitle

expression A variable that represents an Axis object.

Remarks

An axis title is represented by an AxisTitle object.

Example

The following example adds an axis label to the category axis for the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.Axis(xlCategory)
 .HasTitle = True
 .AxisTitle.Text = "July Sales"
 End With
 End If
End With

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.Height Property (Word)

 Copy code hover
[image]

Axis.Height Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the height, in points, of the object. Read-only Double.

Version Information

Version Added: Word 2007

Syntax

expression .Height

expression A variable that represents an Axis object.

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.Left Property (Word)

 Copy code hover
[image]

Axis.Left Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the distance, in points, from the left edge of the object to the left edge of the chart area. Read-only Double.

Version Information

Version Added: Word 2007

Syntax

expression .Left

expression A variable that represents an Axis object.

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.LogBase Property (Word)

 Copy code hover
[image]

Axis.LogBase Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the base of the logarithm when you are using log scales. Read/write Double.

Version Information

Version Added: Word 2007

Syntax

expression .LogBase

expression A variable that represents an Axis object.

Remarks

Attempting to set this property to a value less than or equal to zero (0) raises an error. The default value is 10.

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.MajorGridlines Property (Word)

 Copy code hover
[image]

Axis.MajorGridlines Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the major gridlines for the specified axis. Read-only Gridlines.

Version Information

Version Added: Word 2007

Syntax

expression .MajorGridlines

expression A variable that represents an Axis object.

Remarks

Only axes in the primary axis group can have gridlines.

Example

The following example sets the color of the major gridlines for the value axis of the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.Axes(xlValue)
 If .HasMajorGridlines Then
 ' Set the color to blue.
 .MajorGridlines.Border.ColorIndex = 5
 End If
 End With
 End If
End With

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.MajorTickMark Property (Word)

 Copy code hover
[image]

Axis.MajorTickMark Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the type of major tick mark for the specified axis. Read/write XlTickMark.

Version Information

Version Added: Word 2007

Syntax

expression .MajorTickMark

expression A variable that represents an Axis object.

Remarks

MajorTickMark can be set to one of the following XlTickMark constants:

  • xlTickMarkInside

  • xlTickMarkOutside

  • xlTickMarkCross

  • xlTickMarkNone

Example

The following example sets the major tick marks for the value axis for the first chart in the active document to be outside the axis.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.Axes(xlValue).MajorTickMark = xlTickMarkOutside
 End If
End With

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.MajorUnit Property (Word)

 Copy code hover
[image]

Axis.MajorUnit Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the major units for the value axis. Read/write Double.

Version Information

Version Added: Word 2007

Syntax

expression .MajorUnit

expression A variable that represents an Axis object.

Remarks

Setting this property sets the MajorUnitIsAuto property to False.

Use the TickMarkSpacing property to set tick mark spacing on the category axis.

Example

The following example sets the major and minor units for the value axis of the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.Axes(xlValue)
 .MajorUnit = 100
 .MinorUnit = 20
 End With
 End If
End With

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.MajorUnitIsAuto Property (Word)

 Copy code hover
[image]

Axis.MajorUnitIsAuto Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word calculates the major units for the value axis. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .MajorUnitIsAuto

expression A variable that represents an Axis object.

Remarks

Setting the MajorUnit property sets this property to False.

Example

The following example automatically sets the major and minor units for the value axis of the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.Axes(xlValue)
 .MajorUnitIsAuto = True
 .MinorUnitIsAuto = True
 End With
 End If
End With

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.MajorUnitScale Property (Word)

 Copy code hover
[image]

Axis.MajorUnitScale Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the major unit scale value for the category axis when the CategoryType property is set to xlTimeScale. Read/write XlTimeUnit.

Version Information

Version Added: Word 2007

Syntax

expression .MajorUnitScale

expression A variable that represents an Axis object.

Remarks

MajorUnitScale can be one of the following XlTimeUnit constants:

  • xlMonths

  • xlDays

  • xlYears

Example

The following example sets the category axis on the first chart in the active document to use a time scale and sets the major and minor units.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.Axes(xlCategory)
 .CategoryType = xlTimeScale
 .MajorUnit = 5
 .MajorUnitScale = xlDays
 .MinorUnit = 1
 .MinorUnitScale = xlDays
 End With
 End If
End With

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.MaximumScale Property (Word)

 Copy code hover
[image]

Axis.MaximumScale Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the maximum value on the value axis. Read/write Double.

Version Information

Version Added: Word 2007

Syntax

expression .MaximumScale

expression A variable that represents an Axis object.

Remarks

Setting this property sets the MaximumScaleIsAuto property to False.

Example

The following example sets the minimum and maximum values for the value axis of the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.Axes(xlValue)
 .MinimumScale = 10
 .MaximumScale = 120
 End With
 End If
End With

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.MaximumScaleIsAuto Property (Word)

 Copy code hover
[image]

Axis.MaximumScaleIsAuto Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word calculates the maximum value for the value axis. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .MaximumScaleIsAuto

expression A variable that represents an Axis object.

Remarks

Setting the MaximumScale property sets this property to False.

Example

The following example automatically calculates the minimum scale and the maximum scale for the value axis of the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.Axes(xlValue)
 .MinimumScaleIsAuto = True
 .MaximumScaleIsAuto = True
 End With
 End If
End With

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.MinimumScale Property (Word)

 Copy code hover
[image]

Axis.MinimumScale Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the minimum value on the value axis. Read/write Double.

Version Information

Version Added: Word 2007

Syntax

expression .MinimumScale

expression A variable that represents an Axis object.

Remarks

Setting this property sets the MinimumScaleIsAuto property to False.

Example

The following example sets the minimum and maximum values for the value axis of the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.Axes(xlValue)
 .MinimumScale = 10
 .MaximumScale = 120
 End With
 End If
End With

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.MinimumScaleIsAuto Property (Word)

 Copy code hover
[image]

Axis.MinimumScaleIsAuto Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word calculates the minimum value for the value axis. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .MinimumScaleIsAuto

expression A variable that represents an Axis object.

Remarks

Setting the MinimumScale property sets this property to False.

Example

The following example automatically calculates the minimum scale and the maximum scale for the value axis of the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.Axes(xlValue)
 .MinimumScaleIsAuto = True
 .MaximumScaleIsAuto = True
 End With
 End If
End With

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.MinorGridlines Property (Word)

 Copy code hover
[image]

Axis.MinorGridlines Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the minor gridlines for the specified axis. Read-only Gridlines.

Version Information

Version Added: Word 2007

Syntax

expression .MinorGridlines

expression A variable that represents an Axis object.

Remarks

Only axes in the primary axis group can have gridlines.

Example

The following example sets the color of the minor gridlines for the value axis of the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.Axes(xlValue)
 If .HasMinorGridlines Then
 ' Set the color to blue.
 .MinorGridlines.Border.ColorIndex = 5
 End If
 End With
 End If
End With

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.MinorTickMark Property (Word)

 Copy code hover
[image]

Axis.MinorTickMark Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the type of minor tick mark for the specified axis. Read/write XlTickMark.

Version Information

Version Added: Word 2007

Syntax

expression .MinorTickMark

expression A variable that represents an Axis object.

Remarks

MinorTickMark can be one of the following XlTickMark constants:

  • xlTickMarkInside

  • xlTickMarkOutside

  • xlTickMarkCross

  • xlTickMarkNone

Example

The following example sets the minor tick marks for the value axis of the first chart in the active document to be inside the axis.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.Axes(xlValue).MinorTickMark = xlTickMarkInside
 End If
End With

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.MinorUnit Property (Word)

 Copy code hover
[image]

Axis.MinorUnit Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the minor units on the value axis. Read/write Double.

Version Information

Version Added: Word 2007

Syntax

expression .MinorUnit

expression A variable that represents an Axis object.

Remarks

Setting this property sets the MinorUnitIsAuto property to False.

Use the TickMarkSpacing property to set tick-mark spacing on the category axis.

Example

The following example sets the major and minor units for the value axis of the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.Axes(xlValue)
 .MajorUnit = 100
 .MinorUnit = 20
 End With
 End If
End With

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.MinorUnitIsAuto Property (Word)

 Copy code hover
[image]

Axis.MinorUnitIsAuto Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word calculates minor units for the value axis. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .MinorUnitIsAuto

expression A variable that represents an Axis object.

Remarks

Setting the MinorUnit property sets this property to False.

Example

The following example automatically calculates major and minor units for the value axis of the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.Axes(xlValue)
 .MajorUnitIsAuto = True
 .MinorUnitIsAuto = True
 End With
 End If
End With

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.MinorUnitScale Property (Word)

 Copy code hover
[image]

Axis.MinorUnitScale Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the minor unit scale value for the category axis when the CategoryType property is set to xlTimeScale. Read/write XlTimeUnit.

Version Information

Version Added: Word 2007

Syntax

expression .MinorUnitScale

expression A variable that represents an Axis object.

Remarks

MinorUnitScale can be one of the following XlTimeUnit constants:

  • xlMonths

  • xlDays

  • xlYears

Example

The following example sets the category axis to use a time scale and sets the major and minor units.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.Axes(xlCategory)
 .CategoryType = xlTimeScale
 .MajorUnit = 5
 .MajorUnitScale = xlDays
 .MinorUnit = 1
 .MinorUnitScale = xlDays
 End With
 End If
End With

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.Parent Property (Word)

 Copy code hover
[image]

Axis.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the parent for the specified object. Read-only Object.

Version Information

Version Added: Word 2007

Syntax

expression .Parent

expression A variable that represents an Axis object.

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.ReversePlotOrder Property (Word)

 Copy code hover
[image]

Axis.ReversePlotOrder Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word plots data points from last to first. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .ReversePlotOrder

expression A variable that represents an Axis object.

Remarks

You cannot use this property on radar charts.

Example

The following example plots data points from last to first on the value axis for the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.Axes(xlValue).ReversePlotOrder = True
 End If
End With

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.ScaleType Property (Word)

 Copy code hover
[image]

Axis.ScaleType Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the value axis scale type. Read/write XlScaleType.

Version Information

Version Added: Word 2007

Syntax

expression .ScaleType

expression A variable that represents an Axis object.

Example

The following example sets the value axis for the first chart in the active document to use a logarithmic scale.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.Axes(xlValue).ScaleType = xlScaleLogarithmic
 End If
End With

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.TickLabelPosition Property (Word)

 Copy code hover
[image]

Axis.TickLabelPosition Property (Word)
See also Send feedback

Published: July 16, 2012

Describes the position of tick-mark labels on the specified axis. Read/write XlTickLabelPosition.

Version Information

Version Added: Word 2007

Syntax

expression .TickLabelPosition

expression A variable that represents an Axis object.

Example

The following example sets tick-mark labels to the high position (above the chart) on the category axis for the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.Axes(xlCategory) _
 .TickLabelPosition = xlTickLabelPositionHigh
 End If
End With

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.TickLabels Property (Word)

 Copy code hover
[image]

Axis.TickLabels Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the tick-mark labels for the specified axis. Read-only TickLabels.

Version Information

Version Added: Word 2007

Syntax

expression .TickLabels

expression A variable that represents an Axis object.

Example

The following example sets the color of the tick-mark label font for the value axis of the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.Axes(xlValue).TickLabels.Font.ColorIndex = 3
 End If
End With

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.TickLabelSpacing Property (Word)

 Copy code hover
[image]

Axis.TickLabelSpacing Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the number of categories or series between tick-mark labels. Read/write Long.

Version Information

Version Added: Word 2007

Syntax

expression .TickLabelSpacing

expression A variable that represents an Axis object.

Remarks

This property applies only to category and series axes. It can be a value from 1 through 31999.

Tick-mark label spacing on the value axis is always calculated by Microsoft Word.

Example

The following example sets the number of categories between tick-mark labels on the category axis of the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.Axes(xlCategory).TickLabelSpacing = 10
 End If
End With

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.TickLabelSpacingIsAuto Property (Word)

 Copy code hover
[image]

Axis.TickLabelSpacingIsAuto Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a value that indicates whether the tick label spacing is automatic. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .TickLabelSpacingIsAuto

expression A variable that represents an Axis object.

Remarks

The TickLabelSpacing property returns the current tick label spacing, whether or not the setting is automatic.

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.TickMarkSpacing Property (Word)

 Copy code hover
[image]

Axis.TickMarkSpacing Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the number of categories or series between tick marks. Read/write Long.

Version Information

Version Added: Word 2007

Syntax

expression .TickMarkSpacing

expression A variable that represents an Axis object.

Remarks

This property applies only to category and series axes. It can be a value from 1 through 31999.

Use the MajorUnit and MinorUnit properties to set tick-mark spacing on the value axis.

Example

The following example sets the number of categories between tick marks on the category axis of the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.Axes(xlCategory).TickMarkSpacing = 10
 End If
End With

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.Top Property (Word)

 Copy code hover
[image]

Axis.Top Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the distance, in points, from the top edge of the object to the top of row 1 (on a worksheet) or the top of the chart area (on a chart). Read-only Double.

Version Information

Version Added: Word 2007

Syntax

expression .Top

expression A variable that represents an Axis object.

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.Type Property (Word)

 Copy code hover
[image]

Axis.Type Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the axis type. Read-only XlAxisType.

Version Information

Version Added: Word 2007

Syntax

expression .Type

expression A variable that represents an Axis object.

Remarks

When you use this property for the horizontal axis of scatter charts, xlCategory will be returned as the axis type.

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.Width Property (Word)

 Copy code hover
[image]

Axis.Width Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the width, in points, of the object. Read-only Double.

Version Information

Version Added: Word 2007

Syntax

expression .Width

expression A variable that represents an Axis object.

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis Methods (Word)

 Copy code hover
[image]

Axis Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the object.
Select | Selects the object.


Axis.Delete Method (Word)

 Copy code hover
[image]

Axis.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Version Information

Version Added: Word 2007

Syntax

expression .Delete

expression A variable that represents an Axis object.

See also

Concepts

Axis Object

Other resources

Axis Object Members


Axis.Select Method (Word)

 Copy code hover
[image]

Axis.Select Method (Word)
See also Send feedback

Published: July 16, 2012

Selects the object.

Version Information

Version Added: Word 2007

Syntax

expression .Select

expression A variable that represents an Axis object.

See also

Concepts

Axis Object

Other resources

Axis Object Members


AxisTitle Object (Word)

 Copy code hover
[image]

AxisTitle Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a chart axis title.

Version Information

Version Added: Word 2007

Remarks

Use the AxisTitle property to return an AxisTitle object.

The AxisTitle object does not exist and cannot be used unless the HasTitle property for the axis is True.

Example

The following example sets the caption, sets the font to Bookman 10 point, and formats the word "millions" as italic for the axis title of the value axis for the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.Axes(xlValue)
 .HasTitle = True
 With .AxisTitle
 .Caption = "Revenue (millions)"
 .Font.Name = "bookman"
 .Font.Size = 10
 .Characters(10, 8).Font.Italic = True
 End With
 End With
 End If
End With

See also

Concepts

Word Object Model Reference

Other resources

AxisTitle Object Members


AxisTitle Members (Word)

 Copy code hover
[image]

AxisTitle Members (Word)
Send feedback

Published: July 16, 2012

Represents a chart axis title.

Methods

Name | Description
Delete | Deletes the object.
Select | Selects the object.

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
Caption | Returns or sets a String value that represents the axis title text.
Characters | Returns a ChartCharacters object that represents a range of characters within the object text. You can use the ChartCharacters object to format characters within a text string.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Format | Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.
Formula | Gets or sets a String value that represents the formula of the object using A1-style notation, in English. Read/write.
FormulaLocal | Returns or sets the formula for the object, using A1-style references in the language of the user. Read/write String.
FormulaR1C1 | Returns or sets the formula for the object, using R1C1-style notation in the language of the macro. Read/write String.
FormulaR1C1Local | Returns or sets the formula for the object, using R1C1-style notation in the language of the user. Read/write String.
Height | Returns the height, in points, of the object. Read-only.
HorizontalAlignment | Returns or sets the horizontal alignment for the specified object. Read/write Variant.
IncludeInLayout | True if an axis title will occupy the chart layout space when a chart layout is being determined. The default is True. Read/write Boolean.
Left | Returns or sets the distance, in points, from the left edge of the object to the left edge of the chart area. Read/write Double.
Name | Returns a String value that represents the name of the object.
Orientation | Returns or sets the text orientation. Read/write Long.
Parent | Returns the parent for the specified object. Read-only Object.
Position | Returns or sets the position of the axis title on the chart. Read/write XlChartElementPosition.
ReadingOrder | Returns or sets an XlReadingOrder constant that represents the reading order for the specified object. Read/write Long.
Shadow | Returns or sets a value that determines whether the object has a shadow. Read/write Boolean.
Text | Returns or sets the text for the specified object. Read/write String.
Top | Returns or sets the distance, in points, from the top edge of the object to the top of row 1 (on a worksheet) or the top of the chart area (on a chart). Read/write Double.
VerticalAlignment | Returns or sets the vertical alignment of the specified object. Read/write Variant.
Width | Returns the width, in points, of the object. Read-only.


AxisTitle Properties (Word)

 Copy code hover
[image]

AxisTitle Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
Caption | Returns or sets a String value that represents the axis title text.
Characters | Returns a ChartCharacters object that represents a range of characters within the object text. You can use the ChartCharacters object to format characters within a text string.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Format | Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.
Formula | Gets or sets a String value that represents the formula of the object using A1-style notation, in English. Read/write.
FormulaLocal | Returns or sets the formula for the object, using A1-style references in the language of the user. Read/write String.
FormulaR1C1 | Returns or sets the formula for the object, using R1C1-style notation in the language of the macro. Read/write String.
FormulaR1C1Local | Returns or sets the formula for the object, using R1C1-style notation in the language of the user. Read/write String.
Height | Returns the height, in points, of the object. Read-only.
HorizontalAlignment | Returns or sets the horizontal alignment for the specified object. Read/write Variant.
IncludeInLayout | True if an axis title will occupy the chart layout space when a chart layout is being determined. The default is True. Read/write Boolean.
Left | Returns or sets the distance, in points, from the left edge of the object to the left edge of the chart area. Read/write Double.
Name | Returns a String value that represents the name of the object.
Orientation | Returns or sets the text orientation. Read/write Long.
Parent | Returns the parent for the specified object. Read-only Object.
Position | Returns or sets the position of the axis title on the chart. Read/write XlChartElementPosition.
ReadingOrder | Returns or sets an XlReadingOrder constant that represents the reading order for the specified object. Read/write Long.
Shadow | Returns or sets a value that determines whether the object has a shadow. Read/write Boolean.
Text | Returns or sets the text for the specified object. Read/write String.
Top | Returns or sets the distance, in points, from the top edge of the object to the top of row 1 (on a worksheet) or the top of the chart area (on a chart). Read/write Double.
VerticalAlignment | Returns or sets the vertical alignment of the specified object. Read/write Variant.
Width | Returns the width, in points, of the object. Read-only.


AxisTitle.Application Property (Word)

 Copy code hover
[image]

AxisTitle.Application Property (Word)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Application

expression A variable that represents an AxisTitle object.

Example

The following example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveDocument
If myObject.Application.Value = "Microsoft Word" Then
 MsgBox "This is a Word Application object."
Else
 MsgBox "This is not a Word Application object."
End If

See also

Concepts

AxisTitle Object

Other resources

AxisTitle Object Members


AxisTitle.Caption Property (Word)

 Copy code hover
[image]

AxisTitle.Caption Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a String value that represents the axis title text.

Version Information

Version Added: Word 2007

Syntax

expression .Caption

expression A variable that represents an AxisTitle object.

See also

Concepts

AxisTitle Object

Other resources

AxisTitle Object Members


AxisTitle.Characters Property (Word)

 Copy code hover
[image]

AxisTitle.Characters Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a ChartCharacters object that represents a range of characters within the object text. You can use the ChartCharacters object to format characters within a text string.

Version Information

Version Added: Word 2007

Syntax

expression .Characters(Start, Length)

expression A variable that represents an AxisTitle object.

Parameters

Name | Required/Optional | Data Type | Description
Start | Optional | Variant | The first character to be returned. If this argument is either 1 or omitted, this property returns a range of characters starting with the first character.
Length | Optional | Variant | The number of characters to be returned. If this argument is omitted, this property returns the remainder of the string (everything after the Start character).

Remarks

The ChartCharacters object is not a collection.

See also

Concepts

AxisTitle Object

Other resources

AxisTitle Object Members


AxisTitle.Creator Property (Word)

 Copy code hover
[image]

AxisTitle.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version Information

Version Added: Word 2007

Syntax

expression .Creator

expression A variable that represents an AxisTitle object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Word has the creator code MSWD. For more information about this property, consult the language reference Help included with Microsoft Office for Mac.

See also

Concepts

AxisTitle Object

Other resources

AxisTitle Object Members


AxisTitle.Format Property (Word)

 Copy code hover
[image]

AxisTitle.Format Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.

Version Information

Version Added: Word 2007

Syntax

expression .Format

expression A variable that represents an AxisTitle object.

See also

Concepts

AxisTitle Object

Other resources

AxisTitle Object Members


AxisTitle.Formula Property (Word)

 Copy code hover
[image]

AxisTitle.Formula Property (Word)
See also Send feedback

Published: July 16, 2012

Gets or sets a String value that represents the formula of the object using A1-style notation, in English. Read/write.

Version Information

Version Added: Word 2010

Syntax

expression .Formula

expression A variable that represents an AxisTitle object.

Return Value

String

Remarks

For more information about A1-style notation, see How to: Refer to Cells and Ranges by Using A1 Notation.

See also

Concepts

AxisTitle Object

Other resources

AxisTitle Object Members


AxisTitle.FormulaLocal Property (Word)

 Copy code hover
[image]

AxisTitle.FormulaLocal Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the formula for the object, using A1-style references in the language of the user. Read/write String.

Version Information

Version Added: Word 2010

Syntax

expression .FormulaLocal

expression A variable that represents an AxisTitle object.

Remarks

If the cell contains a constant, this property returns that constant. If the cell is empty, the property returns an empty string. If the cell contains a formula, the property returns the formula as a string, in the same format in which it would be displayed in the formula bar (including the equal sign (=)).

If you set the value or formula of a cell to a date, Microsoft Excel checks to see whether that cell is already formatted with one of the date or time number formats. If not, the number format is changed to the default short date number format.

If the range is a one- or two-dimensional range, you can set the formula to a Visual Basic array of the same dimensions. Similarly, you can put the formula into a Visual Basic array.

Setting the formula of a multiple-cell range fills all cells in the range with the formula.

See also

Concepts

AxisTitle Object

Other resources

AxisTitle Object Members


AxisTitle.FormulaR1C1 Property (Word)

 Copy code hover
[image]

AxisTitle.FormulaR1C1 Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the formula for the object, using R1C1-style notation in the language of the macro. Read/write String.

Version Information

Version Added: Word 2010

Syntax

expression .FormulaR1C1

expression A variable that represents an AxisTitle object.

Remarks

If the cell contains a constant, this property returns the constant. If the cell is empty, the property returns an empty string. If the cell contains a formula, the property returns the formula as a string, in the same format in which it would be displayed in the formula bar (including the equal sign).

If you set the value or formula of a cell to a date, Microsoft Excel checks to see whether that cell is already formatted with one of the date or time number formats. If not, the number format is changed to the default short date number format.

If the range is a one- or two-dimensional range, you can set the formula to a Visual Basic array of the same dimensions. Similarly, you can put the formula into a Visual Basic array.

Setting the formula of a multiple-cell range fills all cells in the range with the formula.

See also

Concepts

AxisTitle Object

Other resources

AxisTitle Object Members


AxisTitle.FormulaR1C1Local Property (Word)

 Copy code hover
[image]

AxisTitle.FormulaR1C1Local Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the formula for the object, using R1C1-style notation in the language of the user. Read/write String.

Version Information

Version Added: Word 2010

Syntax

expression .FormulaR1C1Local

expression A variable that represents an AxisTitle object.

See also

Concepts

AxisTitle Object

Other resources

AxisTitle Object Members


AxisTitle.Height Property (Word)

 Copy code hover
[image]

AxisTitle.Height Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the height, in points, of the object. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .Height

expression A variable that represents an AxisTitle object.

Return Value

Double

See also

Concepts

AxisTitle Object

Other resources

AxisTitle Object Members


AxisTitle.HorizontalAlignment Property (Word)

 Copy code hover
[image]

AxisTitle.HorizontalAlignment Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the horizontal alignment for the specified object. Read/write Variant.

Version Information

Version Added: Word 2007

Syntax

expression .HorizontalAlignment

expression A variable that represents an AxisTitle object.

Remarks

The value of this property can be set to one of the following XlConstants constants:

  • xlCenter

  • xlDistributed

  • xlJustify

  • xlLeft

  • xlRight

Some of these constants may not be available to you, depending on the language support (for example, U.S. English) that you have selected or installed.

See also

Concepts

AxisTitle Object

Other resources

AxisTitle Object Members


AxisTitle.IncludeInLayout Property (Word)

 Copy code hover
[image]

AxisTitle.IncludeInLayout Property (Word)
See also Send feedback

Published: July 16, 2012

True if an axis title will occupy the chart layout space when a chart layout is being determined. The default is True. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .IncludeInLayout

expression An expression that returns a AxisTitle object.

Remarks

This property does not affect whether a chart is in autolayout mode or not. If the user adds a title by using the Above Chart command, the chart will resize smaller, as in previous versions of Microsoft Office. If the user then removes the title or selects one of the overlay title options, the chart will resize larger, as if the title were not on the chart.

See also

Concepts

AxisTitle Object

Other resources

AxisTitle Object Members


AxisTitle.Left Property (Word)

 Copy code hover
[image]

AxisTitle.Left Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the distance, in points, from the left edge of the object to the left edge of the chart area. Read/write Double.

Version Information

Version Added: Word 2007

Syntax

expression .Left

expression A variable that represents an AxisTitle object.

See also

Concepts

AxisTitle Object

Other resources

AxisTitle Object Members


AxisTitle.Name Property (Word)

 Copy code hover
[image]

AxisTitle.Name Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a String value that represents the name of the object.

Version Information

Version Added: Word 2007

Syntax

expression .Name

expression A variable that represents an AxisTitle object.

See also

Concepts

AxisTitle Object

Other resources

AxisTitle Object Members


AxisTitle.Orientation Property (Word)

 Copy code hover
[image]

AxisTitle.Orientation Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the text orientation. Read/write Long.

Version Information

Version Added: Word 2007

Syntax

expression .Orientation

expression A variable that represents an AxisTitle object.

Remarks

The value of this property can be an integer value from -90 to 90 degrees or one of the XlOrientation constants.

See also

Concepts

AxisTitle Object

Other resources

AxisTitle Object Members


AxisTitle.Parent Property (Word)

 Copy code hover
[image]

AxisTitle.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the parent for the specified object. Read-only Object.

Version Information

Version Added: Word 2007

Syntax

expression .Parent

expression A variable that represents an AxisTitle object.

See also

Concepts

AxisTitle Object

Other resources

AxisTitle Object Members


AxisTitle.Position Property (Word)

 Copy code hover
[image]

AxisTitle.Position Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the position of the axis title on the chart. Read/write XlChartElementPosition.

Version Information

Version Added: Word 2007

Syntax

expression .Position

expression A variable that represents an AxisTitle object.

See also

Concepts

AxisTitle Object

Other resources

AxisTitle Object Members


AxisTitle.ReadingOrder Property (Word)

 Copy code hover
[image]

AxisTitle.ReadingOrder Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets an XlReadingOrder constant that represents the reading order for the specified object. Read/write Long.

Version Information

Version Added: Word 2007

Syntax

expression .ReadingOrder

expression A variable that represents an AxisTitle object.

See also

Concepts

AxisTitle Object

Other resources

AxisTitle Object Members


AxisTitle.Shadow Property (Word)

 Copy code hover
[image]

AxisTitle.Shadow Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a value that determines whether the object has a shadow. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .Shadow

expression A variable that represents an AxisTitle object.

See also

Concepts

AxisTitle Object

Other resources

AxisTitle Object Members


AxisTitle.Text Property (Word)

 Copy code hover
[image]

AxisTitle.Text Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the text for the specified object. Read/write String.

Version Information

Version Added: Word 2007

Syntax

expression .Text

expression A variable that represents an AxisTitle object.

Example

The following example sets the axis title text for the category axis of the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.Axes(xlCategory)
 .HasTitle = True
 .AxisTitle.Text = "Month"
 End With
 End If
End With

See also

Concepts

AxisTitle Object

Other resources

AxisTitle Object Members


AxisTitle.Top Property (Word)

 Copy code hover
[image]

AxisTitle.Top Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the distance, in points, from the top edge of the object to the top of row 1 (on a worksheet) or the top of the chart area (on a chart). Read/write Double.

Version Information

Version Added: Word 2007

Syntax

expression .Top

expression A variable that represents an AxisTitle object.

See also

Concepts

AxisTitle Object

Other resources

AxisTitle Object Members


AxisTitle.VerticalAlignment Property (Word)

 Copy code hover
[image]

AxisTitle.VerticalAlignment Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the vertical alignment of the specified object. Read/write Variant.

Version Information

Version Added: Word 2007

Syntax

expression .VerticalAlignment

expression A variable that represents an AxisTitle object.

Remarks

The value of this property can be set to one of the following XlConstants constants:

  • xlBottom

  • xlCenter

  • xlDistributed

  • xlJustify

  • xlTop

See also

Concepts

AxisTitle Object

Other resources

AxisTitle Object Members


AxisTitle.Width Property (Word)

 Copy code hover
[image]

AxisTitle.Width Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the width, in points, of the object. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .Width

expression A variable that represents an AxisTitle object.

See also

Concepts

AxisTitle Object

Other resources

AxisTitle Object Members


AxisTitle Methods (Word)

 Copy code hover
[image]

AxisTitle Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the object.
Select | Selects the object.


AxisTitle.Delete Method (Word)

 Copy code hover
[image]

AxisTitle.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Version Information

Version Added: Word 2007

Syntax

expression .Delete

expression A variable that represents an AxisTitle object.

See also

Concepts

AxisTitle Object

Other resources

AxisTitle Object Members


AxisTitle.Select Method (Word)

 Copy code hover
[image]

AxisTitle.Select Method (Word)
See also Send feedback

Published: July 16, 2012

Selects the object.

Version Information

Version Added: Word 2007

Syntax

expression .Select

expression A variable that represents an AxisTitle object.

See also

Concepts

AxisTitle Object

Other resources

AxisTitle Object Members


Bibliography Object (Word)

 Copy code hover
[image]

Bibliography Object (Word)
See also Send feedback

Published: July 16, 2012

Represents the list of sources available attached to the document (in the current list) or the list of sources available in the application (in the master list).

Version Information

Version Added: Word 2007

Remarks

Biblographies are composed of sources. Also see the Source object and the Sources collection. For more information, see Working with Bibliographies.

See also

Concepts

Word Object Model Reference

Other resources

Bibliography Object Members


Bibliography Members (Word)

 Copy code hover
[image]

Bibliography Members (Word)
Send feedback

Published: July 16, 2012

Represents the list of sources available attached to the document (in the current list) or the list of sources available in the application (in the master list).

Methods

Name | Description
GenerateUniqueTag | Generates a unique identification tag for a bibliography source and returns a String that represents the tag.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
BibliographyStyle | Returns or sets a String that represents the name of the active style to use for a bibliography. Read/write.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified Bibliography object.
Sources | Returns a Sources collection that represents all the sources contained in a bibliography. Read-only.


Bibliography Properties (Word)

 Copy code hover
[image]

Bibliography Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
BibliographyStyle | Returns or sets a String that represents the name of the active style to use for a bibliography. Read/write.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified Bibliography object.
Sources | Returns a Sources collection that represents all the sources contained in a bibliography. Read-only.


Bibliography.Application Property (Word)

 Copy code hover
[image]

Bibliography.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a Bibliography object.

See also

Concepts

Bibliography Object

Other resources

Bibliography Object Members


Bibliography.BibliographyStyle Property (Word)

 Copy code hover
[image]

Bibliography.BibliographyStyle Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a String that represents the name of the active style to use for a bibliography. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .BibliographyStyle

expression An expression that returns a Bibliography object.

Remarks

For more information, see Working with Bibliographies.

See also

Concepts

Bibliography Object

Other resources

Bibliography Object Members


Bibliography.Creator Property (Word)

 Copy code hover
[image]

Bibliography.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.

Syntax

expression .Creator

expression An expression that returns an Bibliography object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

Bibliography Object

Other resources

Bibliography Object Members


Bibliography.Parent Property (Word)

 Copy code hover
[image]

Bibliography.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Bibliography object.

Syntax

expression .Parent

expression A variable that represents a Bibliography object.

See also

Concepts

Bibliography Object

Other resources

Bibliography Object Members


Bibliography.Sources Property (Word)

 Copy code hover
[image]

Bibliography.Sources Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Sources collection that represents all the sources contained in a bibliography. Read-only.

Syntax

expression .Sources

expression An expression that returns a Bibliography object.

See also

Concepts

Bibliography Object

Other resources

Bibliography Object Members


Bibliography Methods (Word)

 Copy code hover
[image]

Bibliography Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
GenerateUniqueTag | Generates a unique identification tag for a bibliography source and returns a String that represents the tag.


Bibliography.GenerateUniqueTag Method (Word)

 Copy code hover
[image]

Bibliography.GenerateUniqueTag Method (Word)
See also Send feedback

Published: July 16, 2012

Generates a unique identification tag for a bibliography source and returns a String that represents the tag.

Syntax

expression .GenerateUniqueTag

expression An expression that returns a Bibliography object.

Return Value

String

Remarks

For more information, see Working with Bibliographies.

See also

Concepts

Bibliography Object

Other resources

Bibliography Object Members


Bookmark Object (Word)

 Copy code hover
[image]

Bookmark Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a single bookmark in a document, selection, or range. The Bookmark object is a member of the Bookmarks collection. The Bookmarks collection includes all the bookmarks listed in the Bookmark dialog box (Insert menu).

Remarks

Using the Bookmark Object

Use Bookmarks(index), where index is the bookmark name or index number, to return a single Bookmark object. You must exactly match the spelling (but not necessarily the capitalization) of the bookmark name. The following example selects the bookmark named "temp" in the active document.

VBA Copy code Copy code
ActiveDocument.Bookmarks("temp").Select

The index number represents the position of the bookmark in the Selection or Range object. For the Document object, the index number represents the position of the bookmark in the alphabetical list of bookmarks in the Bookmarks dialog box (click Name to sort the list of bookmarks alphabetically). The following example displays the name of the second bookmark in the Bookmarks collection.

VBA Copy code Copy code
MsgBox ActiveDocument.Bookmarks(2).Name

Use the Add method to add a bookmark to a document range. The following example marks the selection by adding a bookmark named "temp."

VBA Copy code Copy code
ActiveDocument.Bookmarks.Add Name:="temp", Range:=Selection.Range

Remarks

Use the BookmarkID property with a range or selection object to return the index number of a Bookmark object in the Bookmarks collection. The following example displays the index number of the bookmark named "temp" in the active document.

VBA Copy code Copy code
MsgBox ActiveDocument.Bookmarks("temp").Range.BookmarkID

You can use predefined bookmarks with the Bookmarks property. The following example sets the bookmark named "currpara" to the location marked by the predefined bookmark named "\Para".

VBA Copy code Copy code
ActiveDocument.Bookmarks("\Para").Copy "currpara"

Use the Exists method to determine whether a bookmark already exists in the selection, range, or document. The following example ensures that the bookmark named "temp" exists in the active document before selecting the bookmark.

VBA Copy code Copy code
If ActiveDocument.Bookmarks.Exists("temp") = True Then
 ActiveDocument.Bookmarks("temp").Select
End If

See also

Concepts

Word Object Model Reference

Other resources

Bookmark Object Members


Bookmark Members (Word)

 Copy code hover
[image]

Bookmark Members (Word)
Send feedback

Published: July 16, 2012

Represents a single bookmark in a document, selection, or range. The Bookmark object is a member of the Bookmarks collection. The Bookmarks collection includes all the bookmarks listed in the Bookmark dialog box (Insert menu).

Methods

Name | Description
Copy | Copies a bookmark to the new bookmark specified in the Name argument, and returns a Bookmark object.
Delete | Deletes the specified bookmark.
Select | Selects the specified bookmark.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Column | True if the specified bookmark is a table column. Read-only Boolean.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Empty | True if the specified bookmark is empty. Read-only Boolean.
End | Returns or sets the ending character position of a selection, range, or bookmark. Read/write Long.
Name | Returns the name of the specified object. Read-only String.
Parent | Returns an Object that represents the parent object of the specified Bookmark object.
Range | Returns a Range object that represents the portion of a document that's contained in the specified object.
Start | Returns or sets the starting character position of a bookmark. Read/write Long.
StoryType | Returns the story type for the specified range, selection, or bookmark. Read-only WdStoryType.


Bookmark Properties (Word)

 Copy code hover
[image]

Bookmark Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Column | True if the specified bookmark is a table column. Read-only Boolean.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Empty | True if the specified bookmark is empty. Read-only Boolean.
End | Returns or sets the ending character position of a selection, range, or bookmark. Read/write Long.
Name | Returns the name of the specified object. Read-only String.
Parent | Returns an Object that represents the parent object of the specified Bookmark object.
Range | Returns a Range object that represents the portion of a document that's contained in the specified object.
Start | Returns or sets the starting character position of a bookmark. Read/write Long.
StoryType | Returns the story type for the specified range, selection, or bookmark. Read-only WdStoryType.


Bookmark.Application Property (Word)

 Copy code hover
[image]

Bookmark.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression A variable that represents a Bookmark object.

See also

Concepts

Bookmark Object

Other resources

Bookmark Object Members


Bookmark.Column Property (Word)

 Copy code hover
[image]

Bookmark.Column Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified bookmark is a table column. Read-only Boolean.

Syntax

expression .Column

expression Required. A variable that represents a Bookmark object.

Example

This example creates a table with a bookmark and then displays a message box that confirms that the bookmark is a table column.

VBA Copy code Copy code
Dim docNew As Document
Dim tableNew As Table
Dim rangeCell As Range

Set docNew = Documents.Add
Set tableNew = docNew.Tables.Add(Selection.Range, 3, 5)
Set rangeCell = tableNew.Cell(3,5).Range

rangeCell.InsertAfter "Cell(3,5)"
docNew.Bookmarks.Add Name:="BKMK_Cell35", Range:=rangeCell
MsgBox docNew.Bookmarks(1).Column

See also

Concepts

Bookmark Object

Other resources

Bookmark Object Members


Bookmark.Creator Property (Word)

 Copy code hover
[image]

Bookmark.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents an Bookmark object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

Bookmark Object

Other resources

Bookmark Object Members


Bookmark.Empty Property (Word)

 Copy code hover
[image]

Bookmark.Empty Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified bookmark is empty. Read-only Boolean.

Syntax

expression .Empty

expression A variable that represents a Bookmarks object.

Remarks

An empty bookmark marks a location (a collapsed selection); it doesn't mark any text. An error occurs if the specified bookmark doesn't exist. Use the Exists property to determine whether the bookmark exists.

Example

This example determines whether the bookmark named "temp" exists and whether it is empty.

VBA Copy code Copy code
If ActiveDocument.Bookmarks.Exists("temp") = True Then
 If ActiveDocument.Bookmarks("temp").Empty = True Then _
 MsgBox "The Temp bookmark is empty"
End If

See also

Concepts

Bookmark Object

Other resources

Bookmark Object Members


Bookmark.End Property (Word)

 Copy code hover
[image]

Bookmark.End Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the ending character position of a selection, range, or bookmark. Read/write Long.

Syntax

expression .End

expression A variable that represents a Bookmark object.

Remarks

If this property is set to a value smaller than the Start property, the Start property is set to the same value (that is, the Start and End properties are equal).

This property returns the ending character position relative to the beginning of the story. The main document story (wdMainTextStory) begins with character position 0 (zero). You can change the size of a bookmark by setting this property.

Example

This example compares the ending position of the "temp" bookmark with the starting position of the "begin" bookmark.

VBA Copy code Copy code
Set Book1 = ActiveDocument.Bookmarks("begin")
Set Book2 = ActiveDocument.Bookmarks("temp")
If Book2.End > Book1.Start Then Book1.Select

See also

Concepts

Bookmark Object

Other resources

Bookmark Object Members


Bookmark.Name Property (Word)

 Copy code hover
[image]

Bookmark.Name Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the name of the specified object. Read-only String.

Syntax

expression .Name

expression Required. A variable that represents a Bookmark object.

See also

Concepts

Bookmark Object

Other resources

Bookmark Object Members


Bookmark.Parent Property (Word)

 Copy code hover
[image]

Bookmark.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Bookmark object.

Syntax

expression .Parent

expression A variable that represents an Bookmark object.

See also

Concepts

Bookmark Object

Other resources

Bookmark Object Members


Bookmark.Range Property (Word)

 Copy code hover
[image]

Bookmark.Range Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the portion of a document that's contained in the specified object.

Syntax

expression .Range

expression A variable that represents a Bookmark object.

Remarks

For information about returning a range from a document or returning a shape range from a collection of shapes, see the Range method.

See also

Concepts

Bookmark Object

Other resources

Bookmark Object Members


Bookmark.Start Property (Word)

 Copy code hover
[image]

Bookmark.Start Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the starting character position of a bookmark. Read/write Long.

Syntax

expression .Start

expression A variable that represents a Bookmark object.

Remarks

If this property is set to a value larger than that of the End property, the End property is set to the same value as that of Start property.

Bookmark objects have starting and ending character positions. The starting position refers to the character position closest to the beginning of the story.

This property returns the starting character position relative to the beginning of the story. The main text story (wdMainTextStory) begins with character position 0 (zero). You can change the size of a bookmark by setting this property.

Example

This example compares the ending position of the "temp" bookmark with the starting position of the "begin" bookmark.

VBA Copy code Copy code
Set Book1 = ActiveDocument.Bookmarks("begin")
Set Book2 = ActiveDocument.Bookmarks("temp")
If Book2.End > Book1.Start Then Book1.Select

See also

Concepts

Bookmark Object

Other resources

Bookmark Object Members


Bookmark.StoryType Property (Word)

 Copy code hover
[image]

Bookmark.StoryType Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the story type for the specified range, selection, or bookmark. Read-only WdStoryType.

Syntax

expression .StoryType

expression Required. A variable that represents a Bookmark object.

Example

This example selects the bookmark named "temp" if the bookmark is contained in the main story of the active document.

VBA Copy code Copy code
If ActiveDocument.Bookmarks.Exists("temp") = True Then
 Set myBookmark = ActiveDocument.Bookmarks("temp")
 If myBookmark.StoryType = wdMainTextStory _
 Then myBookmark.Select
End If

See also

Concepts

Bookmark Object

Other resources

Bookmark Object Members


Bookmark Methods (Word)

 Copy code hover
[image]

Bookmark Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Copy | Copies a bookmark to the new bookmark specified in the Name argument, and returns a Bookmark object.
Delete | Deletes the specified bookmark.
Select | Selects the specified bookmark.


Bookmark.Copy Method (Word)

 Copy code hover
[image]

Bookmark.Copy Method (Word)
See also Send feedback

Published: July 16, 2012

Copies a bookmark to the new bookmark specified in the Name argument, and returns a Bookmark object.

Syntax

expression .Copy(Name)

expression Required. A variable that represents a Bookmark object.

Parameters

Name | Required/Optional | Data Type | Description
Name | Required | String | The name of the new bookmark.

See also

Concepts

Bookmark Object

Other resources

Bookmark Object Members


Bookmark.Delete Method (Word)

 Copy code hover
[image]

Bookmark.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the specified bookmark.

Syntax

expression .Delete

expression Required. A variable that represents a Bookmark object.

Example

If a bookmark named "temp" exists in the active document, this example deletes the bookmark.

VBA Copy code Copy code
Sub DeleteBookmark()
 Dim intResponse As Integer
 Dim strBookmark As String

 strBookmark = "temp"

 intResponse = MsgBox("Are you sure you want to delete " _
 & "the bookmark named """ & strBookmark & """?", vbYesNo)

 If intResponse = vbYes Then
 If ActiveDocument.Bookmarks.Exists(Name:=strBookmark) Then
 ActiveDocument.Bookmarks(Index:=strBookmark).Delete
 End If
 End If
End Sub

See also

Concepts

Bookmark Object

Other resources

Bookmark Object Members


Bookmark.Select Method (Word)

 Copy code hover
[image]

Bookmark.Select Method (Word)
See also Send feedback

Published: July 16, 2012

Selects the specified bookmark.

Syntax

expression .Select

expression Required. A variable that represents a Bookmark object.

Remarks

After using this method, use the Selection object to work with the selected items. For more information, see Working with the Selection object.

See also

Concepts

Bookmark Object

Other resources

Bookmark Object Members


Bookmarks Object (Word)

 Copy code hover
[image]

Bookmarks Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of Bookmark objects that represent the bookmarks in the specified selection, range, or document.

Remarks

Use the Bookmarks property to return the Bookmarks collection for a document, range, or selection. The following example ensures that the bookmark named "temp" exists in the active document before selecting the bookmark.

VBA Copy code Copy code
If ActiveDocument.Bookmarks.Exists("temp") = True Then
 ActiveDocument.Bookmarks("temp").Select
End If

Use the Add method to set a bookmark for a range in a document. The following example marks the selection by adding a bookmark named "temp".

VBA Copy code Copy code
ActiveDocument.Bookmarks.Add Name:="temp", Range:=Selection.Range

Use Bookmarks(index), where index is the bookmark name or index number, to return a single Bookmark object. You must exactly match the spelling (but not necessarily the capitalization) of the bookmark name. The following example selects the bookmark named "temp" in the active document.

VBA Copy code Copy code
ActiveDocument.Bookmarks("temp").Select

The index number represents the position of the bookmark in the Selection or Range object. For the Document object, the index number represents the position of the bookmark in the alphabetical list of bookmarks in the Bookmarks dialog box (click Name to sort the list of bookmarks alphabetically). The following example displays the name of the second bookmark in the Bookmarks collection.

VBA Copy code Copy code
MsgBox ActiveDocument.Bookmarks(2).Name

Remarks

The ShowHidden property effects the number of elements in the Bookmarks collection. If ShowHidden is True, hidden bookmarks are included in the Bookmarks collection.

See also

Concepts

Word Object Model Reference

Other resources

Bookmarks Object Members


Bookmarks Members (Word)

 Copy code hover
[image]

Bookmarks Members (Word)
Send feedback

Published: July 16, 2012

A collection of Bookmark objects that represent the bookmarks in the specified selection, range, or document.

Methods

Name | Description
Add | Returns a Bookmark object that represents a bookmark added to a range.
Exists | Determines whether the specified bookmark exists. Returns True if the bookmark exists.
Item | Returns an individual Bookmark object in a collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns the number of items in the Bookmarks collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
DefaultSorting | Returns or sets the sorting option for bookmark names displayed in the Bookmark dialog box (Insert menu). Read/write WdBookmarkSortBy.
Parent | Returns an Object that represents the parent object of the specified Bookmarks collection.
ShowHidden | True if hidden bookmarks are included in the Bookmarks collection. Read/write Boolean.


Bookmarks Properties (Word)

 Copy code hover
[image]

Bookmarks Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns the number of items in the Bookmarks collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
DefaultSorting | Returns or sets the sorting option for bookmark names displayed in the Bookmark dialog box (Insert menu). Read/write WdBookmarkSortBy.
Parent | Returns an Object that represents the parent object of the specified Bookmarks collection.
ShowHidden | True if hidden bookmarks are included in the Bookmarks collection. Read/write Boolean.


Bookmarks.Application Property (Word)

 Copy code hover
[image]

Bookmarks.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression A variable that represents a Bookmarks object.

See also

Concepts

Bookmarks Collection Object

Other resources

Bookmarks Object Members


Bookmarks.Count Property (Word)

 Copy code hover
[image]

Bookmarks.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the number of items in the Bookmarks collection. Read-only Long.

Syntax

expression .Count

expression A variable that represents a Bookmarks object.

See also

Concepts

Bookmarks Collection Object

Other resources

Bookmarks Object Members


Bookmarks.Creator Property (Word)

 Copy code hover
[image]

Bookmarks.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents an Bookmarks object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

Bookmarks Collection Object

Other resources

Bookmarks Object Members


Bookmarks.DefaultSorting Property (Word)

 Copy code hover
[image]

Bookmarks.DefaultSorting Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the sorting option for bookmark names displayed in the Bookmark dialog box (Insert menu). Read/write WdBookmarkSortBy.

Syntax

expression .DefaultSorting

expression Required. A variable that represents a Bookmarks collection.

Remarks

This property doesn't affect the order of Bookmark objects in the Bookmarks collection.

Example

This example sorts bookmarks by location and then displays the Bookmark dialog box.

VBA Copy code Copy code
ActiveDocument.Bookmarks.DefaultSorting = wdSortByLocation
Dialogs(wdDialogInsertBookmark).Show

See also

Concepts

Bookmarks Collection Object

Other resources

Bookmarks Object Members


Bookmarks.Parent Property (Word)

 Copy code hover
[image]

Bookmarks.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Bookmarks collection.

Syntax

expression .Parent

expression A variable that represents an Bookmarks collection.

See also

Concepts

Bookmarks Collection Object

Other resources

Bookmarks Object Members


Bookmarks.ShowHidden Property (Word)

 Copy code hover
[image]

Bookmarks.ShowHidden Property (Word)
See also Send feedback

Published: July 16, 2012

True if hidden bookmarks are included in the Bookmarks collection. Read/write Boolean.

Syntax

expression .ShowHidden

expression An expression that returns a Bookmarks collection object.

Remarks

The ShowHidden property also controls whether hidden bookmarks are listed in the Bookmark dialog box (Insert menu). Hidden bookmarks are automatically inserted when cross-references are inserted into the document.

Example

This example displays the Bookmark dialog box with both visible and hidden bookmarks listed.

VBA Copy code Copy code
ActiveDocument.Bookmarks.ShowHidden = True
Dialogs(wdDialogInsertBookmark).Show

This example displays the name of each hidden bookmark in the document. Hidden bookmarks in a Word document begin with an underscore ( _ ).

VBA Copy code Copy code
ActiveDocument.Bookmarks.ShowHidden = True
For Each aBookmark In ActiveDocument.Bookmarks
 If Left(aBookmark.Name, 1) = "_" Then MsgBox aBookmark.Name
Next aBookmark

See also

Concepts

Bookmarks Collection Object

Other resources

Bookmarks Object Members


Bookmarks Methods (Word)

 Copy code hover
[image]

Bookmarks Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Returns a Bookmark object that represents a bookmark added to a range.
Exists | Determines whether the specified bookmark exists. Returns True if the bookmark exists.
Item | Returns an individual Bookmark object in a collection.


Bookmarks.Add Method (Word)

 Copy code hover
[image]

Bookmarks.Add Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a Bookmark object that represents a bookmark added to a range.

Syntax

expression .Add(Name, Range)

expression Required. A variable that represents a Bookmarks collection.

Parameters

Name | Required/Optional | Data Type | Description
Name | Required | String | The name of the bookmark. The name cannot be more than one word.
Range | Optional | Variant | The range of text marked by the bookmark. A bookmark can be set to a collapsed range (the insertion point).

Return Value

Bookmark

Example

This example adds a bookmark named myplace to the selection in the active document.

VBA Copy code Copy code
Sub BMark()
 ' Select some text in the active document prior
 ' to execution.
 ActiveDocument.Bookmarks.Add _
 Name:="myplace", Range:=Selection.Range
End Sub

This example adds a bookmark named mark at the insertion point.

VBA Copy code Copy code
Sub Mark()
 ActiveDocument.Bookmarks.Add Name:="mark"
End Sub

This example adds a bookmark named third_para to the third paragraph in Letter.doc, and then it displays all the bookmarks for the document in the active window.

VBA Copy code Copy code
Sub ThirdPara()
 Dim myDoc As Document

 ' To best illustrate this example,
 ' Letter.doc must be opened, not active,
 ' and contain more than 3 paragraphs.
 Set myDoc = Documents("Letter.doc")
 myDoc.Bookmarks.Add Name:="third_para", _
 Range:=myDoc.Paragraphs(3).Range
 myDoc.ActiveWindow.View.ShowBookmarks = True
End Sub

See also

Concepts

Bookmarks Collection Object

Other resources

Bookmarks Object Members


Bookmarks.Exists Method (Word)

 Copy code hover
[image]

Bookmarks.Exists Method (Word)
See also Send feedback

Published: July 16, 2012

Determines whether the specified bookmark exists. Returns True if the bookmark exists.

Syntax

expression .Exists(Name)

expression A variable that represents a Bookmarks object.

Parameters

Name | Required/Optional | Data Type | Description
Name | Required | String | A bookmark name.

Example

This example determines whether the bookmark named "start" exists in the active document. If the bookmark exists, it is deleted.

VBA Copy code Copy code
If ActiveDocument.Bookmarks.Exists("start") = True Then
 ActiveDocument.Bookmarks("start").Delete
End If

See also

Concepts

Bookmarks Collection Object

Other resources

Bookmarks Object Members


Bookmarks.Item Method (Word)

 Copy code hover
[image]

Bookmarks.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual Bookmark object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents a Bookmarks collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The individual object to be returned. Can be a Long indicating the ordinal position or a String representing the name of the individual object.

Return Value

Bookmark

Example

This example selects the bookmark named "temp" in the active document.

VBA Copy code Copy code
Sub BookmarkItem()
 If ActiveDocument.Bookmarks.Exists("temp") = True Then
 ActiveDocument.Bookmarks.Item("temp").Select
 End If
End Sub

See also

Concepts

Bookmarks Collection Object

Other resources

Bookmarks Object Members


Border Object (Word)

 Copy code hover
[image]

Border Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a border of an object. The Border object is a member of the Borders collection.

Remarks

Use Borders(index), where index identifies the border, to return a single Border object. Index can be one of the WdBorderType constants. Some of the WdBorderType constants may not be available to you, depending on the language support (U.S. English, for example) that you have selected or installed.

Use the LineStyle property to apply a border line to a Border object. The following example applies a double-line border below the first paragraph in the active document.

VBA Copy code Copy code
With ActiveDocument.Paragraphs(1).Borders(wdBorderBottom)
 .LineStyle = wdLineStyleDouble
 .LineWidth = wdLineWidth025pt
End With

The following example applies a single-line border around the first character in the selection.

VBA Copy code Copy code
With Selection.Characters(1)
 .Font.Size = 36
 .Borders.Enable = True
End With

The following example adds an art border around each page in the first section.

VBA Copy code Copy code
For Each aBorder In ActiveDocument.Sections(1).Borders
 With aBorder
 .ArtStyle = wdArtSeattle
 .ArtWidth = 20
 End With
Next aBorder

Border objects cannot be added to the Borders collection. The number of members in the Borders collection is finite and varies depending on the type of object. For example, a table has six elements in the Borders collection, whereas a paragraph has four.

See also

Concepts

Word Object Model Reference

Other resources

Border Object Members


Border Members (Word)

 Copy code hover
[image]

Border Members (Word)
Send feedback

Published: July 16, 2012

Represents a border of an object. The Border object is a member of the Borders collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
ArtStyle | Returns or sets the graphical page-border design for a document. Read/write WdPageBorderArt.
ArtWidth | Returns or sets the width (in points) of the specified graphical page border. Read/write Long.
Color | Returns or sets the 24-bit color for the specified Border object.
ColorIndex | Returns or sets the color for the specified border or font object. Read/write WdColorIndex.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Inside | True if an inside border can be applied to the specified object. Read-only Boolean.
LineStyle | Returns or sets the border line style for the specified object. Read/write WdLineStyle.
LineWidth | Returns or sets the line width of an object's border. Read/write.
Parent | Returns an Object that represents the parent object of the specified Border object.
Visible | True if the specified object is visible. Read/write Boolean.


Border Properties (Word)

 Copy code hover
[image]

Border Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
ArtStyle | Returns or sets the graphical page-border design for a document. Read/write WdPageBorderArt.
ArtWidth | Returns or sets the width (in points) of the specified graphical page border. Read/write Long.
Color | Returns or sets the 24-bit color for the specified Border object.
ColorIndex | Returns or sets the color for the specified border or font object. Read/write WdColorIndex.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Inside | True if an inside border can be applied to the specified object. Read-only Boolean.
LineStyle | Returns or sets the border line style for the specified object. Read/write WdLineStyle.
LineWidth | Returns or sets the line width of an object's border. Read/write.
Parent | Returns an Object that represents the parent object of the specified Border object.
Visible | True if the specified object is visible. Read/write Boolean.


Border.Application Property (Word)

 Copy code hover
[image]

Border.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression A variable that represents a Border object.

See also

Concepts

Border Object

Other resources

Border Object Members


Border.ArtStyle Property (Word)

 Copy code hover
[image]

Border.ArtStyle Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the graphical page-border design for a document. Read/write WdPageBorderArt.

Syntax

expression .ArtStyle

expression Required. A variable that represents a Border object.

Example

This example adds a border of black dots around each page in first section in the selection.

VBA Copy code Copy code
Dim borderLoop As Border

For Each borderLoop In Selection.Sections(1).Borders
 With borderLoop
 .ArtStyle = wdArtBasicBlackDots
 .ArtWidth = 6
 End With
Next borderLoop

This example adds a picture border around each page in section one in the active document.

VBA Copy code Copy code
Dim borderLoop As Border

With ActiveDocument.Sections(1)
 .Borders.AlwaysInFront = True
 For Each borderLoop In .Borders
 With borderLoop
 .ArtStyle = wdArtPeople
 .ArtWidth = 15
 End With
 Next borderLoop
End With

See also

Concepts

Border Object

Other resources

Border Object Members


Border.ArtWidth Property (Word)

 Copy code hover
[image]

Border.ArtWidth Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the width (in points) of the specified graphical page border. Read/write Long.

Syntax

expression .ArtWidth

expression A variable that represents a Border object.

Example

This example adds a 6-point dotted border around each page in the first section in the selection.

VBA Copy code Copy code
Dim borderLoop As Border

For Each borderLoop In Selection.Sections(1).Borders
 With borderLoop
 .ArtStyle = wdArtBasicBlackDots
 .ArtWidth = 6
 End With
Next borderLoop

See also

Concepts

Border Object

Other resources

Border Object Members


Border.Color Property (Word)

 Copy code hover
[image]

Border.Color Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the 24-bit color for the specified Border object.

Syntax

expression .Color

expression Required. A variable that represents a Border object.

Remarks

This property can be any valid WdColor constant or a value returned by Visual Basic's RGB function.

Example

This example adds a dotted indigo border around each cell in the first table.

VBA Copy code Copy code
If ActiveDocument.Tables.Count >= 1 Then
 For Each aBorder In ActiveDocument.Tables(1).Borders
 aBorder.Color = wdColorIndigo
 aBorder.LineStyle = wdLineStyleDashDot
 aBorder.LineWidth = wdLineWidth075pt
 Next aBorder
End If

See also

Concepts

Border Object

Other resources

Border Object Members


Border.ColorIndex Property (Word)

 Copy code hover
[image]

Border.ColorIndex Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the color for the specified border or font object. Read/write WdColorIndex.

Syntax

expression .ColorIndex

expression Required. A variable that represents a Border object.

Remarks

The wdByAuthor constant is not valid for border and font objects.

Example

This example adds a dotted red border around each cell in the first table.

VBA Copy code Copy code
Dim borderLoop As Border

If ActiveDocument.Tables.Count >= 1 Then
 For Each borderLoop In ActiveDocument.Tables(1).Borders
 With borderLoop
 .ColorIndex = wdRed
 .LineStyle = wdLineStyleDashDot
 .LineWidth = wdLineWidth075pt
 End With
 Next borderLoop
End If

See also

Concepts

Border Object

Other resources

Border Object Members


Border.Creator Property (Word)

 Copy code hover
[image]

Border.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents an Border object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

Border Object

Other resources

Border Object Members


Border.Inside Property (Word)

 Copy code hover
[image]

Border.Inside Property (Word)
See also Send feedback

Published: July 16, 2012

True if an inside border can be applied to the specified object. Read-only Boolean.

Syntax

expression .Inside

expression An expression that returns a Border object.

Example

If the current selection supports inside borders (that is, if multiple paragraphs or cells are selected), this example applies a single inside border.

VBA Copy code Copy code
Dim borderLoop As Border

For Each borderLoop In Selection.Borders
 If borderLoop.Inside = True Then _
 borderLoop.LineStyle = wdLineStyleSingle
Next borderLoop

See also

Concepts

Border Object

Other resources

Border Object Members


Border.LineStyle Property (Word)

 Copy code hover
[image]

Border.LineStyle Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the border line style for the specified object. Read/write WdLineStyle.

Syntax

expression .LineStyle

expression Required. A variable that represents a Border object.

Remarks

Setting the LineStyle property for a range that refers to individual characters or words applies a character border.

Setting the LineStyle property for a paragraph or range of paragraphs applies a paragraph border. Use the InsideLineStyle property to apply a border between consecutive paragraphs.

Setting the LineStyle property for a section applies a page border around the pages in the section.

Example

If the selection is a paragraph or a collapsed selection, this example adds a single 0.75-point paragraph border above the selection. If the selection doesn't include a paragraph, a border is applied around the selected text.

VBA Copy code Copy code
With Selection.Borders(wdBorderTop)
 .LineStyle = wdLineStyleSingle
 .LineWidth = wdLineWidth075pt
End With

This example adds a double 1.5-point border below each frame in the active document.

VBA Copy code Copy code
For Each aFrame In ActiveDocument.Frames
 With aFrame.Borders(wdBorderBottom)
 .LineStyle = wdLineStyleDouble
 .LineWidth = wdLineWidth150pt
 End With
Next aFrame

The following example applies a border around the fourth word in the active document. Applying a single border (in this example, a top border) to text applies a border around the text.

VBA Copy code Copy code
ActiveDocument.Words(4).Borders(wdBorderTop) _
 .LineStyle = wdLineStyleSingle

See also

Concepts

Border Object

Other resources

Border Object Members


Border.LineWidth Property (Word)

 Copy code hover
[image]

Border.LineWidth Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the line width of an object's border. Read/write.

Syntax

expression .LineWidth

expression Required. A variable that represents a Border object.

Remarks

Returns a WdLineWidth constant or wdUndefined if the object either has no borders or has borders with more than one line width. If the specified line width isn't available for the border's line style, this property generates an error. To determine the line widths available for a particular line style, see the Borders and Shading dialog box (Format menu).

Example

This example adds a border below the first row in the first table of the active document.

VBA Copy code Copy code
If ActiveDocument.Tables.Count >= 1 Then
 With ActiveDocument.Tables(1).Rows(1).Borders(wdBorderBottom)
 .LineStyle = wdLineStyleSingle
 .LineWidth = wdLineWidth050pt
 End With
End If

This example adds a wavy, red line to the left of the selection.

VBA Copy code Copy code
With Selection.Borders(wdBorderLeft)
 .LineStyle = wdLineStyleSingleWavy
 .LineWidth = wdLineWidth075pt
 .ColorIndex = wdRed
End With

See also

Concepts

Border Object

Other resources

Border Object Members


Border.Parent Property (Word)

 Copy code hover
[image]

Border.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Border object.

Syntax

expression .Parent

expression A variable that represents an Border object.

See also

Concepts

Border Object

Other resources

Border Object Members


Border.Visible Property (Word)

 Copy code hover
[image]

Border.Visible Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified object is visible. Read/write Boolean.

Syntax

expression .Visible

expression Required. A variable that represents a Border object.

Remarks

For any object, some methods and properties may be unavailable if the Visible property is False.

Example

This example creates a table in the active document and removes the default borders from the table.

VBA Copy code Copy code
Set myTable = ActiveDocument.Tables.Add(Range:=Selection.Range, _
 NumRows:=12, NumColumns:=5)
For Each aBorder In myTable.Borders
 aBorder.Visible = False
Next aBorder

See also

Concepts

Border Object

Other resources

Border Object Members


Borders Object (Word)

 Copy code hover
[image]

Borders Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of Border objects that represent the borders of an object.

Remarks

Use the Borders property to return the Borders collection. The following example applies the default border around the first paragraph in the active document.

VBA Copy code Copy code
ActiveDocument.Paragraphs(1).Borders.Enable = True

Border objects cannot be added to the Borders collection. The number of members in the Borders collection is finite and varies depending on the type of object. For example, a table has six elements in the Borders collection, whereas a paragraph has four.

Use Borders(index), where index identifies the border, to return a single Border object. Index can be one of the WdBorderType constants. Some of the WdBorderType constants may not be available to you, depending on the language support (U.S. English, for example) that you have selected or installed.

Use the LineStyle property to apply a border line to a Border object. The following example applies a double-line border below the first paragraph in the active document.

VBA Copy code Copy code
With ActiveDocument.Paragraphs(1).Borders(wdBorderBottom)
 .LineStyle = wdLineStyleDouble
 .LineWidth = wdLineWidth025pt
End With

The following example applies a single-line border around the first character in the selection.

VBA Copy code Copy code
With Selection.Characters(1)
 .Font.Size = 36
 .Borders.Enable = True
End With

The following example adds an art border around each page in the first section.

VBA Copy code Copy code
For Each aBorder In ActiveDocument.Sections(1).Borders
 With aBorder
 .ArtStyle = wdArtSeattle
 .ArtWidth = 20
 End With
Next aBorder

See also

Concepts

Word Object Model Reference

Other resources

Borders Object Members


Borders Members (Word)

 Copy code hover
[image]

Borders Members (Word)
Send feedback

Published: July 16, 2012

A collection of Border objects that represent the borders of an object.

Methods

Name | Description
ApplyPageBordersToAllSections | Applies the specified page-border formatting to all sections in a document.
Item | Returns a border in a range or selection.

Properties

Name | Description
AlwaysInFront | True if page borders are displayed in front of the document text. Read/write Boolean.
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns the number of items in the Borders collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
DistanceFrom | Returns or sets a value that indicates whether the specified page border is measured from the edge of the page or from the text it surrounds. Read/write WdBorderDistanceFrom.
DistanceFromBottom | Returns or sets the space (in points) between the text and the bottom border. Read/write Long.
DistanceFromLeft | Returns or sets the space (in points) between the text and the left border. Read/write Long.
DistanceFromRight | Returns or sets the space (in points) between the right edge of the text and the right border. Read/write Long.
DistanceFromTop | Returns or sets the space (in points) between the text and the top border. Read/write Long.
Enable | Returns or sets border formatting for the specified object. Read/write Long.
EnableFirstPageInSection | True if page borders are enabled for the first page in the section. Read/write Boolean.
EnableOtherPagesInSection | True if page borders are enabled for all pages in the section except for the first page. Read/write Boolean.
HasHorizontal | True if a horizontal border can be applied to the object. Read-only Boolean.
HasVertical | True if a vertical border can be applied to the specified object. Read-only Boolean.
InsideColor | Returns or sets the 24-bit color of the inside borders. Read/write.
InsideColorIndex | Returns or sets the color of the inside borders. Read/write WdColorIndex.
InsideLineStyle | Returns or sets the inside border for the specified object. .
InsideLineWidth | Returns or sets the line width of the inside border of an object. .
JoinBorders | True if vertical borders at the edges of paragraphs and tables are removed so that the horizontal borders can connect to the page border. Read/write Boolean.
OutsideColor | Returns or sets the 24-bit color of the outside borders. .
OutsideColorIndex | Returns or sets the color of the outside borders. Read/write WdColorIndex.
OutsideLineStyle | Returns or sets the outside border for the specified object. .
OutsideLineWidth | Returns or sets the line width of the outside border of an object. Read/write.
Parent | Returns an Object that represents the parent object of the specified Borders collection.
Shadow | True if the specified border is formatted as shadowed. Read/write Boolean.
SurroundFooter | True if a page border encompasses the document footer. Read/write Boolean.
SurroundHeader | True if a page border encompasses the document header. Read/write Boolean.


Borders Properties (Word)

 Copy code hover
[image]

Borders Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
AlwaysInFront | True if page borders are displayed in front of the document text. Read/write Boolean.
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns the number of items in the Borders collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
DistanceFrom | Returns or sets a value that indicates whether the specified page border is measured from the edge of the page or from the text it surrounds. Read/write WdBorderDistanceFrom.
DistanceFromBottom | Returns or sets the space (in points) between the text and the bottom border. Read/write Long.
DistanceFromLeft | Returns or sets the space (in points) between the text and the left border. Read/write Long.
DistanceFromRight | Returns or sets the space (in points) between the right edge of the text and the right border. Read/write Long.
DistanceFromTop | Returns or sets the space (in points) between the text and the top border. Read/write Long.
Enable | Returns or sets border formatting for the specified object. Read/write Long.
EnableFirstPageInSection | True if page borders are enabled for the first page in the section. Read/write Boolean.
EnableOtherPagesInSection | True if page borders are enabled for all pages in the section except for the first page. Read/write Boolean.
HasHorizontal | True if a horizontal border can be applied to the object. Read-only Boolean.
HasVertical | True if a vertical border can be applied to the specified object. Read-only Boolean.
InsideColor | Returns or sets the 24-bit color of the inside borders. Read/write.
InsideColorIndex | Returns or sets the color of the inside borders. Read/write WdColorIndex.
InsideLineStyle | Returns or sets the inside border for the specified object. .
InsideLineWidth | Returns or sets the line width of the inside border of an object. .
JoinBorders | True if vertical borders at the edges of paragraphs and tables are removed so that the horizontal borders can connect to the page border. Read/write Boolean.
OutsideColor | Returns or sets the 24-bit color of the outside borders. .
OutsideColorIndex | Returns or sets the color of the outside borders. Read/write WdColorIndex.
OutsideLineStyle | Returns or sets the outside border for the specified object. .
OutsideLineWidth | Returns or sets the line width of the outside border of an object. Read/write.
Parent | Returns an Object that represents the parent object of the specified Borders collection.
Shadow | True if the specified border is formatted as shadowed. Read/write Boolean.
SurroundFooter | True if a page border encompasses the document footer. Read/write Boolean.
SurroundHeader | True if a page border encompasses the document header. Read/write Boolean.


Borders.AlwaysInFront Property (Word)

 Copy code hover
[image]

Borders.AlwaysInFront Property (Word)
See also Send feedback

Published: July 16, 2012

True if page borders are displayed in front of the document text. Read/write Boolean.

Syntax

expression .AlwaysInFront

expression A variable that represents a Borders object.

Example

This example adds a graphical page border in front of text in the first section in the active document.

VBA Copy code Copy code
Dim borderLoop as Border

With ActiveDocument.Sections(1)
 .Borders.AlwaysInFront = True
 For Each borderLoop In .Borders
 With borderLoop
 .ArtStyle = wdArtPeople
 .ArtWidth = 15
 End With
 Next borderLoop
End With

See also

Concepts

Borders Collection Object

Other resources

Borders Object Members


Borders.Application Property (Word)

 Copy code hover
[image]

Borders.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression A variable that represents a Borders collection.

See also

Concepts

Borders Collection Object

Other resources

Borders Object Members


Borders.Count Property (Word)

 Copy code hover
[image]

Borders.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the number of items in the Borders collection. Read-only Long.

Syntax

expression .Count

expression A variable that represents a Borders collection.

See also

Concepts

Borders Collection Object

Other resources

Borders Object Members


Borders.Creator Property (Word)

 Copy code hover
[image]

Borders.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a Borders collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

Borders Collection Object

Other resources

Borders Object Members


Borders.DistanceFrom Property (Word)

 Copy code hover
[image]

Borders.DistanceFrom Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a value that indicates whether the specified page border is measured from the edge of the page or from the text it surrounds. Read/write WdBorderDistanceFrom.

Syntax

expression .DistanceFrom

expression Required. A variable that represents a Borders collection.

Example

This example adds a single border around each page in section one in the active document and then sets the distance between each border and the corresponding edge of the page.

VBA Copy code Copy code
Dim borderLoop As Border

With ActiveDocument.Sections(1)
 For Each borderLoop In .Borders
 borderLoop.LineStyle = wdLineStyleSingle
 borderLoop.LineWidth = wdLineWidth050pt
 Next borderLoop
 With .Borders
 .DistanceFrom = wdBorderDistanceFromPageEdge
 .DistanceFromTop = 20
 .DistanceFromLeft = 22
 .DistanceFromBottom = 20
 .DistanceFromRight = 22
 End With
End With

This example adds a border around each page in the first section in the selection, and then it sets the distance between the text and the page border to 6 points.

VBA Copy code Copy code
Dim borderLoop As Border

With Selection.Sections(1)
 For Each borderLoop In .Borders
 borderLoop.ArtStyle = wdArtSeattle
 borderLoop.ArtWidth = 22
 Next borderLoop
 With .Borders
 .DistanceFrom = wdBorderDistanceFromText
 .DistanceFromTop = 6
 .DistanceFromLeft = 6
 .DistanceFromBottom = 6
 .DistanceFromRight = 6
 End With
End With

See also

Concepts

Borders Collection Object

Other resources

Borders Object Members


Borders.DistanceFromBottom Property (Word)

 Copy code hover
[image]

Borders.DistanceFromBottom Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the space (in points) between the text and the bottom border. Read/write Long.

Syntax

expression .DistanceFromBottom

expression A variable that represents a Borders object.

Remarks

Using this property with a page border, you can set either the space between the text and the bottom page border or the space between the bottom edge of the page and the bottom page border. Where the distance is measured from depends on the value of the DistanceFrom property.

Example

This example adds a border around the first paragraph in the active document and sets the distance between the text and the bottom border to 6 points.

VBA Copy code Copy code
With ActiveDocument.Paragraphs(1).Borders
 .Enable = True
 .DistanceFromBottom = 6
End With

This example adds a border around each table in Sales.doc. The example also sets the distance between the text and the border to 3 points for the top and bottom borders, and 6 points for the left and right borders.

VBA Copy code Copy code
Dim tableLoop As Table

For Each tableLoop In Documents("Sales.doc").Tables
 With tableLoop.Borders
 .OutsideLineStyle = wdLineStyleSingle
 .OutsideLineWidth = wdLineWidth150pt
 .DistanceFromBottom = 3
 .DistanceFromTop = 3
 .DistanceFromLeft = 6
 .DistanceFromRight = 6
 End With
Next tableLoop

See also

Concepts

Borders Collection Object

Other resources

Borders Object Members


Borders.DistanceFromLeft Property (Word)

 Copy code hover
[image]

Borders.DistanceFromLeft Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the space (in points) between the text and the left border. Read/write Long.

Syntax

expression .DistanceFromLeft

expression A variable that represents a Borders object.

Remarks

Using this property with a page border, you can set either the space between the text and the left page border or the space between the left edge of the page and the left page border. Where the distance is measured from depends on the value of the DistanceFrom property.

Example

This example adds a border around each frame in the active document and sets the distance between the frame and the border to 5 points.

VBA Copy code Copy code
Dim frameLoop As Frame

For Each frameLoop In ActiveDocument.Frames
 With frameLoop.Borders
 .Enable = True
 .DistanceFromLeft = 5
 .DistanceFromRight = 5
 .DistanceFromTop = 5
 .DistanceFromBottom = 5
 End With
Next frameLoop

This example adds a border around the first paragraph in the active document and sets the distance between the text and the left border to 3 points.

VBA Copy code Copy code
With ActiveDocument.Paragraphs(1).Borders
 .Enable = True
 .DistanceFromLeft = 3
End With

See also

Concepts

Borders Collection Object

Other resources

Borders Object Members


Borders.DistanceFromRight Property (Word)

 Copy code hover
[image]

Borders.DistanceFromRight Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the space (in points) between the right edge of the text and the right border. Read/write Long.

Syntax

expression .DistanceFromRight

expression A variable that represents a Borders object.

Remarks

Using this property with a page border, you can set either the space between the text and the right border or the space between the right edge of the page and the right border. Where the distance is measured from depends on the value of the DistanceFrom property.

Example

This example adds a border around each paragraph in the selection and sets the distance between the text and the right border to 3 points.

VBA Copy code Copy code
With Selection.Paragraphs.Borders
 .Enable = True
 .DistanceFromRight = 3
End With

This example adds a single border around each page in section one in the active document. The example also sets the distance between the right and left border and the corresponding edges of the page to 22 points.

VBA Copy code Copy code
Dim borderLoop As Border

With ActiveDocument.Sections(1)
 For Each borderLoop In .Borders
 borderLoop.LineStyle = wdLineStyleSingle
 borderLoop.LineWidth = wdLineWidth050pt
 Next borderLoop
 With .Borders
 .DistanceFrom = wdBorderDistanceFromPageEdge
 .DistanceFromLeft = 22
 .DistanceFromRight = 22
 End With
End With

See also

Concepts

Borders Collection Object

Other resources

Borders Object Members


Borders.DistanceFromTop Property (Word)

 Copy code hover
[image]

Borders.DistanceFromTop Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the space (in points) between the text and the top border. Read/write Long.

Syntax

expression .DistanceFromTop

expression A variable that represents a Borders object.

Remarks

Using this property with a page border, you can set either the space between the text and the top page border or the space between the top edge of the page and the top page border. Where the distance is measured from depends on the value of the DistanceFrom property.

Example

This example adds a border around each paragraph in the selection and sets the distance between the text and the top border to 3 points.

VBA Copy code Copy code
With Selection.Borders
 .Enable = True
 .DistanceFromTop = 3
End With

This example adds a border around each page in the first section in the selection. The example also sets the distance between the text and the page border to 6 points.

VBA Copy code Copy code
Dim borderLoop As Border

With Selection.Sections(1)
 For Each borderLoop In .Borders
 borderLoop.ArtStyle = wdArtSeattle
 borderLoop.ArtWidth = 22
 Next borderLoop
 With .Borders
 .DistanceFrom = wdBorderDistanceFromText
 .DistanceFromTop = 6
 .DistanceFromLeft = 6
 .DistanceFromBottom = 6
 .DistanceFromRight = 6
 End With
End With

See also

Concepts

Borders Collection Object

Other resources

Borders Object Members


Borders.Enable Property (Word)

 Copy code hover
[image]

Borders.Enable Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets border formatting for the specified object. Read/write Long.

Syntax

expression .Enable

expression A variable that represents a Borders collection.

Remarks

The Enable property returns True or wdUndefined if border formatting is applied to all or part of the specified object. Can be set to True, False, or a WdLineStyle constant.

The Enable property applies to all borders for the specified object. True sets the line style to the default line style and sets the line width to the default line width. The default line style and line width can be set using the DefaultBorderLineWidth and DefaultBorderLineStyle properties.

To remove all the borders from an object, set the Enable property to False, as shown in the following example.

VBA Copy code Copy code
ActiveDocument.Tables(1).Borders.Enable = False

To remove or apply a single border, use Borders(index), where index is a WdBorderType constant, to return a single border, and then set the LineStyle property. The following example removes the bottom border from rngTemp.

VBA Copy code Copy code
Dim rngTemp

rngTemp.Borders(wdBorderBottom).LineStyle = wdLineStyleNone

Example

This example removes all borders from the first cell in table one.

VBA Copy code Copy code
If ActiveDocument.Tables.Count >= 1 Then
 ActiveDocument.Tables(1).Cell(1, 1).Borders.Enable = False
End If

This example applies a dashed border around the first paragraph in the selection.

VBA Copy code Copy code
Options.DefaultBorderLineWidth = wdLineWidth025pt
Selection.Paragraphs(1).Borders.Enable = _
 wdLineStyleDashSmallGap

This example applies a border around the first character in the selection. If nothing is selected, the border is applied to the first character after the insertion point.

VBA Copy code Copy code
Selection.Characters(1).Borders.Enable = True

See also

Concepts

Borders Collection Object

Other resources

Borders Object Members


Borders.EnableFirstPageInSection Property (Word)

 Copy code hover
[image]

Borders.EnableFirstPageInSection Property (Word)
See also Send feedback

Published: July 16, 2012

True if page borders are enabled for the first page in the section. Read/write Boolean.

Syntax

expression .EnableFirstPageInSection

expression A variable that represents a Borders object.

Example

This example adds a border around the first page in the first section in the selection.

VBA Copy code Copy code
Dim borderLoop As Border

With Selection.Sections(1)
 .Borders.EnableFirstPageInSection = True
 .Borders.EnableOtherPagesInSection = False
 For Each borderLoop In .Borders
 borderLoop.ArtStyle = wdArtPeople
 borderLoop.ArtWidth = 15
 Next borderLoop
End With

See also

Concepts

Borders Collection Object

Other resources

Borders Object Members


Borders.EnableOtherPagesInSection Property (Word)

 Copy code hover
[image]

Borders.EnableOtherPagesInSection Property (Word)
See also Send feedback

Published: July 16, 2012

True if page borders are enabled for all pages in the section except for the first page. Read/write Boolean.

Syntax

expression .EnableOtherPagesInSection

expression A variable that represents a Borders object.

Example

This example adds a border around each page in the first section in the selection except for the first page.

VBA Copy code Copy code
Dim borderLoop As Border

With Selection.Sections(1)
 .Borders.EnableFirstPageInSection = False
 .Borders.EnableOtherPagesInSection = True
 For Each borderLoop In .Borders
 borderLoop.ArtStyle = wdArtBabyRattle
 borderLoop.ArtWidth = 22
 Next borderLoop
End With

See also

Concepts

Borders Collection Object

Other resources

Borders Object Members


Borders.HasHorizontal Property (Word)

 Copy code hover
[image]

Borders.HasHorizontal Property (Word)
See also Send feedback

Published: July 16, 2012

True if a horizontal border can be applied to the object. Read-only Boolean.

Syntax

expression .HasHorizontal

expression A variable that represents a Borders object.

Remarks

Horizontal borders can be applied to ranges that contain cells in two or more rows of a table or ranges that contain two or more paragraphs.

Example

This example applies single-line horizontal borders, if the selection supports horizontal borders.

VBA Copy code Copy code
If Selection.Borders.HasHorizontal = True Then
 Selection.Borders(wdBorderHorizontal).LineStyle = _
 wdLineStyleSingle
End If

See also

Concepts

Borders Collection Object

Other resources

Borders Object Members


Borders.HasVertical Property (Word)

 Copy code hover
[image]

Borders.HasVertical Property (Word)
See also Send feedback

Published: July 16, 2012

True if a vertical border can be applied to the specified object. Read-only Boolean.

Syntax

expression .HasVertical

expression A variable that represents a Borders object.

Remarks

Vertical borders can be applied to ranges that contain cells in two or more columns of a table.

Example

If the selection supports vertical borders, this example applies a single vertical border.

VBA Copy code Copy code
If Selection.Borders.HasVertical = True Then
 Selection.Borders(wdBorderVertical).LineStyle = _
 wdLineStyleSingle
End If

See also

Concepts

Borders Collection Object

Other resources

Borders Object Members


Borders.InsideColor Property (Word)

 Copy code hover
[image]

Borders.InsideColor Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the 24-bit color of the inside borders. Read/write.

Syntax

expression .InsideColor

expression Required. A variable that represents a Borders collection.

Remarks

This property can be any valid WdColor constant or a value returned by Visual Basic's RGB function. If the InsideLineStyle property is set to either wdLineStyleNone or False, setting this property has no effect.

Example

This example adds dark red borders between the first four paragraphs in the active document.

VBA Copy code Copy code
Set myDoc = ActiveDocument
Set myRange = myDoc.Range(Start:=myDoc.Paragraphs(1).Range.Start, _
 End:=myDoc.Paragraphs(4).Range.End)
With myRange.Borders
 .InsideLineStyle = wdLineStyleSingle
 .InsideLineWidth = wdLineWidth150pt
 .InsideColor = wdDarkRed
End With

See also

Concepts

Borders Collection Object

Other resources

Borders Object Members


Borders.InsideColorIndex Property (Word)

 Copy code hover
[image]

Borders.InsideColorIndex Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the color of the inside borders. Read/write WdColorIndex.

Syntax

expression .InsideColorIndex

expression Required. A variable that represents a Borders collection.

Remarks

If the InsideLineStyle property is set to either wdLineStyleNone or False, setting this property has no effect.

Example

This example adds red borders between the first four paragraphs in the active document.

VBA Copy code Copy code
Dim docActive As Document
Dim rngTemp As Range

Set docActive = ActiveDocument
Set rngTemp = docActive.Range( _
 Start:=docActive.Paragraphs(1).Range.Start, _
 End:=docActive.Paragraphs(4).Range.End)

With rngTemp.Borders
 .InsideLineStyle = wdLineStyleSingle
 .InsideLineWidth = wdLineWidth150pt
 .InsideColorIndex = wdRed
End With

See also

Concepts

Borders Collection Object

Other resources

Borders Object Members


Borders.InsideLineStyle Property (Word)

 Copy code hover
[image]

Borders.InsideLineStyle Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the inside border for the specified object. .

Syntax

expression .InsideLineStyle

expression Required. A variable that represents a Borders collection.

Remarks

This property returns wdUndefined if more than one kind of border is applied to the specified object; otherwise, returns False or a WdLineStyle constant. Can be set to True, False, or a WdLineStyle constant.

True sets the line style to the default line style and the line width to the default line width. The default line style and line width can be set using the DefaultBorderLineWidth and DefaultBorderLineStyle properties.

Use either of the following instructions to remove the inside border from the first table in the active document.

VBA Copy code Copy code
ActiveDocument.Tables(1).Borders.InsideLineStyle = wdLineStyleNone
ActiveDocument.Tables(1).Borders.InsideLineStyle = False

Example

This example adds borders between rows and between columns in the first table of the active document.

VBA Copy code Copy code
Dim tableTemp As Table

If ActiveDocument.Tables.Count >= 1 Then
 Set tableTemp = ActiveDocument.Tables(1)
 tableTemp.Borders.InsideLineStyle = True
End If

This example adds borders between the first four paragraphs in the document.

VBA Copy code Copy code
Dim docActive As Document
Dim rngTemp As Range

Set docActive = ActiveDocument
Set rngTemp = docActive .Range( _
 Start:= docActive .Paragraphs(1).Range.Start, _
 End:= docActive .Paragraphs(4).Range.End)

With rngTemp.Borders
 .InsideLineStyle = wdLineStyleSingle
 .InsideLineWidth = wdLineWidth150pt
End With

See also

Concepts

Borders Collection Object

Other resources

Borders Object Members


Borders.InsideLineWidth Property (Word)

 Copy code hover
[image]

Borders.InsideLineWidth Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the line width of the inside border of an object. .

Syntax

expression .InsideLineWidth

expression Required. A variable that represents a Borders collection.

Remarks

This property returns wdUndefined if the object has inside borders with more than one line width; otherwise, returns False or a WdLineWidth constant. Can be set to True, False, or one of the following WdLineWidth constants.

Example

This example adds borders between rows and between columns in the first table in the active document.

VBA Copy code Copy code
Dim tableTemp As Table

If ActiveDocument.Tables.Count >= 1 Then
 Set tableTemp = ActiveDocument.Tables(1)
 tableTemp.Borders.InsideLineStyle = wdLineStyleDot
 tableTemp.Borders.InsideLineWidth = wdLineWidth050pt
End If

This example adds dotted borders between the first four paragraphs of the active document.

VBA Copy code Copy code
Dim docActive As Document
Dim rngTemp As Range

Set docActive = ActiveDocument
Set rngTemp=docActive.Range( _
 Start:=docActive.Paragraphs(1).Range.Start, _
 End:=docActive.Paragraphs(4).Range.End)

rngTemp.Borders.InsideLineStyle = wdLineStyleDot
rngTemp.Borders.InsideLineWidth = wdLineWidth075pt

See also

Concepts

Borders Collection Object

Other resources

Borders Object Members


Borders.JoinBorders Property (Word)

 Copy code hover
[image]

Borders.JoinBorders Property (Word)
See also Send feedback

Published: July 16, 2012

True if vertical borders at the edges of paragraphs and tables are removed so that the horizontal borders can connect to the page border. Read/write Boolean.

Syntax

expression .JoinBorders

expression An expression that returns a Borders object.

Example

This example adds a border around each page in the first section of the selection. The example also removes the horizontal borders at the edges of tables and paragraphs, thus connecting the horizontal borders to the page border.

VBA Copy code Copy code
Dim borderLoop As Border

With Selection.Sections(1)
 For Each borderLoop In .Borders
 borderLoop.ArtStyle = wdArtBalloonsHotAir
 borderLoop.ArtWidth = 15
 Next borderLoop
 With .Borders
 .DistanceFromLeft = 2
 .DistanceFromRight = 2
 .DistanceFrom = wdBorderDistanceFromText
 .JoinBorders = True
 End With
End With

See also

Concepts

Borders Collection Object

Other resources

Borders Object Members


Borders.OutsideColor Property (Word)

 Copy code hover
[image]

Borders.OutsideColor Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the 24-bit color of the outside borders. .

Syntax

expression .OutsideColor

expression Required. A variable that represents a Borders collection.

Remarks

This property can be any valid WdColor constant or a value returned by Visual Basic's RGB function.

If the OutsideLineStyle property is set to either wdLineStyleNone or False, setting this property has no effect.

Example

This example adds borders between rows and between columns in the first table of the active document, and then it sets the colors for both the inside and outside borders.

VBA Copy code Copy code
If ActiveDocument.Tables.Count >= 1 Then
 Set myTable = ActiveDocument.Tables(1)
 With myTable.Borders
 .InsideLineStyle = True
 .InsideColor = wdColorBrightGreen
 .OutsideColor = wdColorDarkTeal
 End With
End If

This example adds a dark red, 0.75-point double border around the first paragraph in the active document.

VBA Copy code Copy code
With ActiveDocument.Paragraphs(1).Borders
 .OutsideLineStyle = wdLineStyleDouble
 .OutsideLineWidth = wdLineWidth075pt
 .OutsideColor = wdColorDarkRed
End With

See also

Concepts

Borders Collection Object

Other resources

Borders Object Members


Borders.OutsideColorIndex Property (Word)

 Copy code hover
[image]

Borders.OutsideColorIndex Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the color of the outside borders. Read/write WdColorIndex.

Syntax

expression .OutsideColorIndex

expression Required. A variable that represents a Borders collection.

Remarks

If the OutsideLineStyle property is set to either wdLineStyleNone or False, setting this property has no effect.

Example

This example adds borders between rows and between columns in the first table of the active document, and then it sets the colors for both the inside and outside borders.

VBA Copy code Copy code
If ActiveDocument.Tables.Count >= 1 Then
 Set myTable = ActiveDocument.Tables(1)
 With myTable.Borders
 .InsideLineStyle = True
 .InsideColorIndex = wdBrightGreen
 .OutsideColorIndex = wdPink
 End With
End If

This example adds a red, 0.75-point double border around the first paragraph in the active document.

VBA Copy code Copy code
With ActiveDocument.Paragraphs(1).Borders
 .OutsideLineStyle = wdLineStyleDouble
 .OutsideLineWidth = wdLineWidth075pt
 .OutsideColorIndex = wdRed
End With

See also

Concepts

Borders Collection Object

Other resources

Borders Object Members


Borders.OutsideLineStyle Property (Word)

 Copy code hover
[image]

Borders.OutsideLineStyle Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the outside border for the specified object. .

Syntax

expression .OutsideLineStyle

expression Required. A variable that represents a Borders collection.

Remarks

This property returns wdUndefined if more than one kind of border is applied to the specified object; otherwise, returns False or a WdLineStyle constant. Can be set to True, False, or a WdLineStyle constant.

True sets the line style to the default line style and the line width to the default line width. The default line style and width can be set using the DefaultBorderLineWidth and DefaultBorderLineStyle properties.

Use either of the following instructions to remove the outside border from the first table in the active document.

VBA Copy code Copy code
ActiveDocument.Tables(1).Borders.OutsideLineStyle = wdLineStyleNone
ActiveDocument.Tables(1).Borders.OutsideLineStyle = False

Example

This example adds a double 0.75-point border around the first paragraph in the active document.

VBA Copy code Copy code
With ActiveDocument.Paragraphs(1).Borders
 .OutsideLineStyle = wdLineStyleDouble
 .OutsideLineWidth = wdLineWidth075pt
End With

This example adds a border around the first table in the active document.

VBA Copy code Copy code
If ActiveDocument.Tables.Count >= 1 Then
 Set myTable = ActiveDocument.Tables(1)
 myTable.Borders.OutsideLineStyle = wdLineStyleSingle
End If

See also

Concepts

Borders Collection Object

Other resources

Borders Object Members


Borders.OutsideLineWidth Property (Word)

 Copy code hover
[image]

Borders.OutsideLineWidth Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the line width of the outside border of an object. Read/write.

Syntax

expression .OutsideLineWidth

expression Required. A variable that represents a Borders collection.

Remarks

This property returns wdUndefined if the object has outside borders with more than one line width; otherwise, returns False or a WdLineWidth constant. Can be set to True, False, or a WdLineWidth constant.

Example

This example adds a wavy border around the first table in the active document.

VBA Copy code Copy code
If ActiveDocument.Tables.Count >= 1 Then
 With ActiveDocument.Tables(1).Borders
 .OutsideLineStyle = wdLineStyleSingleWavy
 .OutsideLineWidth = wdLineWidth075pt
 End With
End If

This example adds dotted borders around the first four paragraphs in the active document.

VBA Copy code Copy code
Set myDoc = ActiveDocument
Set myRange = myDoc.Range(Start:=myDoc.Paragraphs(1).Range.Start, _
 End:=myDoc.Paragraphs(4).Range.End)
myRange.Borders.OutsideLineStyle = wdLineStyleDot
myRange.Borders.OutsideLineWidth = wdLineWidth075pt

See also

Concepts

Borders Collection Object

Other resources

Borders Object Members


Borders.Parent Property (Word)

 Copy code hover
[image]

Borders.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Borders collection.

Syntax

expression .Parent

expression A variable that represents a Borders collection.

See also

Concepts

Borders Collection Object

Other resources

Borders Object Members


Borders.Shadow Property (Word)

 Copy code hover
[image]

Borders.Shadow Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified border is formatted as shadowed. Read/write Boolean.

Syntax

expression .Shadow

expression Required. A variable that represents a Borders collection.

Example

This example demonstrates two different border styles in a new document.

VBA Copy code Copy code
Set myRange = Documents.Add.Content
With myRange
 .InsertAfter "Demonstration of border with shadow."
 .InsertParagraphAfter
 .InsertParagraphAfter
 .InsertAfter "Demonstration of border without shadow."
End With
With ActiveDocument
 .Paragraphs(1).Borders.Shadow = True
 .Paragraphs(3).Borders.Enable = True
End With

See also

Concepts

Borders Collection Object

Other resources

Borders Object Members


Borders.SurroundFooter Property (Word)

 Copy code hover
[image]

Borders.SurroundFooter Property (Word)
See also Send feedback

Published: July 16, 2012

True if a page border encompasses the document footer. Read/write Boolean.

Syntax

expression .SurroundFooter

expression An expression that returns a Borders collection object.

Example

This example formats the page border in section one of the active document so that it encompasses the header and footer on each page in the section.

VBA Copy code Copy code
With ActiveDocument.Sections(1).Borders
 .SurroundFooter = True
 .SurroundHeader = True
End With

This example adds a graphical page border around each page in section one. The page border doesn't encompass the header and footer areas.

VBA Copy code Copy code
With ActiveDocument.Sections(1)
 .Borders.SurroundFooter = False
 .Borders.SurroundHeader = False
 For Each aBord In .Borders
 aBord.ArtStyle = wdArtPeople
 aBord.ArtWidth = 15
 Next aBord
End With

See also

Concepts

Borders Collection Object

Other resources

Borders Object Members


Borders.SurroundHeader Property (Word)

 Copy code hover
[image]

Borders.SurroundHeader Property (Word)
See also Send feedback

Published: July 16, 2012

True if a page border encompasses the document header. Read/write Boolean.

Syntax

expression .SurroundHeader

expression An expression that returns a Borders collection object.

Example

This example formats the page border in section one of the active document to exclude the header and footer areas on each page.

VBA Copy code Copy code
With ActiveDocument.Sections(1).Borders
 .SurroundFooter = False
 .SurroundHeader = False
End With

See also

Concepts

Borders Collection Object

Other resources

Borders Object Members


Borders Methods (Word)

 Copy code hover
[image]

Borders Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
ApplyPageBordersToAllSections | Applies the specified page-border formatting to all sections in a document.
Item | Returns a border in a range or selection.


Borders.ApplyPageBordersToAllSections Method (Word)

 Copy code hover
[image]

Borders.ApplyPageBordersToAllSections Method (Word)
See also Send feedback

Published: July 16, 2012

Applies the specified page-border formatting to all sections in a document.

Syntax

expression .ApplyPageBordersToAllSections

expression Required. A variable that represents a Borders collection.

Example

This example adds a single-line page border to all sections in the active document.

VBA Copy code Copy code
Dim borderLoop As Border

With ActiveDocument.Sections(1)
 For Each borderLoop In .Borders
 With borderLoop
 .LineStyle = wdLineStyleSingle
 .LineWidth = wdLineWidth050pt
 End With
 Next borderLoop
 .Borders.ApplyPageBordersToAllSections
End With

See also

Concepts

Borders Collection Object

Other resources

Borders Object Members


Borders.Item Method (Word)

 Copy code hover
[image]

Borders.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a border in a range or selection.

Syntax

expression .Item(Index)

expression Required. A variable that represents a Borders collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | WdBorderType | The border to be returned.

Return Value

Border

Example

This example inserts a double border above the first paragraph in the active document.

VBA Copy code Copy code
Sub BorderItem()
 ActiveDocument.Paragraphs(1).Borders.Item(wdBorderTop) _
 .LineStyle = wdLineStyleDouble
End Sub

See also

Concepts

Borders Collection Object

Other resources

Borders Object Members


Break Object (Word)

 Copy code hover
[image]

Break Object (Word)
See also Send feedback

Published: July 16, 2012

Represents individual page, column, and section breaks in a page. Use the Break object and the related methods and properties for programmatically defining page layout in a document.

Remarks

Use the Item method of the Breaks collection to return a specific Break object. The following example returns the first break in the first page of the active document.

VBA Copy code Copy code
Dim objBreak As Break

Set objBreak = ActiveDocument.ActiveWindow _
 .Panes(1).Pages(1).Breaks.Item(1)

See also

Concepts

Word Object Model Reference

Other resources

Break Object Members


Break Members (Word)

 Copy code hover
[image]

Break Members (Word)
Send feedback

Published: July 16, 2012

Represents individual page, column, and section breaks in a page. Use the Break object and the related methods and properties for programmatically defining page layout in a document.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
PageIndex | Returns a Long that represents the page number on which the specified break occurs.
Parent | Returns an Object that represents the parent object of the specified Break object.
Range | Returns a Range object that represents the portion of a document that's contained in the specified object.


Break Properties (Word)

 Copy code hover
[image]

Break Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
PageIndex | Returns a Long that represents the page number on which the specified break occurs.
Parent | Returns an Object that represents the parent object of the specified Break object.
Range | Returns a Range object that represents the portion of a document that's contained in the specified object.


Break.Application Property (Word)

 Copy code hover
[image]

Break.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression A variable that represents a Break object.

See also

Concepts

Break Object

Other resources

Break Object Members


Break.Creator Property (Word)

 Copy code hover
[image]

Break.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a Break object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

Break Object

Other resources

Break Object Members


Break.PageIndex Property (Word)

 Copy code hover
[image]

Break.PageIndex Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the page number on which the specified break occurs.

Syntax

expression .PageIndex

expression An expression that returns a Break object.

Example

The following code returns the page number on which the specified break occurs.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.Panes(1).Pages(1).Breaks(1).PageIndex

See also

Concepts

Break Object

Other resources

Break Object Members


Break.Parent Property (Word)

 Copy code hover
[image]

Break.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Break object.

Syntax

expression .Parent

expression Required. A variable that represents a Break object.

See also

Concepts

Break Object

Other resources

Break Object Members


Break.Range Property (Word)

 Copy code hover
[image]

Break.Range Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the portion of a document that's contained in the specified object.

Syntax

expression .Range

expression Required. A variable that represents a Break object.

See also

Concepts

Break Object

Other resources

Break Object Members


Breaks Object (Word)

 Copy code hover
[image]

Breaks Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of page, column, or section breaks in a page. Use the Breaks collection and the related objects and properties to programmatically define page layout in a document.

Remarks

Use the Breaks property to return a Breaks collection. The following example returns the breaks in the first page of the active document.

VBA Copy code Copy code
Dim objBreaks As Breaks

Set objBreaks = ActiveDocument.ActiveWindow _
 .Panes(1).Pages(1).Breaks

See also

Concepts

Word Object Model Reference

Other resources

Breaks Object Members


Breaks Members (Word)

 Copy code hover
[image]

Breaks Members (Word)
Send feedback

Published: July 16, 2012

A collection of page, column, or section breaks in a page. Use the Breaks collection and the related objects and properties to programmatically define page layout in a document.

Methods

Name | Description
Item | Returns an individual Break object in a collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns the number of items in the Breaks collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified Breaks collection.


Breaks Properties (Word)

 Copy code hover
[image]

Breaks Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns the number of items in the Breaks collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified Breaks collection.


Breaks.Application Property (Word)

 Copy code hover
[image]

Breaks.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression A variable that represents a Breaks object.

See also

Concepts

Breaks Collection

Other resources

Breaks Object Members


Breaks.Count Property (Word)

 Copy code hover
[image]

Breaks.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the number of items in the Breaks collection. Read-only Long.

Syntax

expression .Count

expression A variable that represents a Breaks object.

See also

Concepts

Breaks Collection

Other resources

Breaks Object Members


Breaks.Creator Property (Word)

 Copy code hover
[image]

Breaks.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents an Breaks object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

Breaks Collection

Other resources

Breaks Object Members


Breaks.Parent Property (Word)

 Copy code hover
[image]

Breaks.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Breaks collection.

Syntax

expression .Parent

expression A variable that represents an Breaks collection.

See also

Concepts

Breaks Collection

Other resources

Breaks Object Members


Breaks Methods (Word)

 Copy code hover
[image]

Breaks Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Item | Returns an individual Break object in a collection.


Breaks.Item Method (Word)

 Copy code hover
[image]

Breaks.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual Break object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents a Breaks collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The individual object to be returned. Can be a Long indicating the ordinal position of the individual object.

Return Value

Break

See also

Concepts

Breaks Collection

Other resources

Breaks Object Members


Broadcast Object (Word)

 Copy code hover
[image]

Broadcast Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a Windows Live 2012 Broadcast Service broadcast session.

Version information

Version Added: Word 2013

See also

Other resources

Broadcast Members


Broadcast Members (Word)

 Copy code hover
[image]

Broadcast Members (Word)
Send feedback

Published: July 16, 2012

Represents a Windows Live 2012 Broadcast Service broadcast session.

Methods

Name | Description
AddMeetingNotes | Adds shared meeting notes for the specified broadcast that are accessible to attendees who use either Microsoft OneNote 2013 rich client or web app.
End | Ends the specified broadcast session.
Pause | Pauses the specified broadcast.
Resume | Resumes the specified broadcast.
Start | Initiates the specified broadcast session.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
AttendeeUrl | If a broadcast is in progress, returns a String that represents the URL of the attendee link. Read-only.
Capabilities | Returns a Long that represents the capabilities of the specified broadcast. Read-only.
Parent | Returns an Object that represents the parent object of the specified Broadcast object.
PresenterServiceUrl | If a broadcast is in progress, returns a String that represents the URL of the presenter service hosting the broadcast. Read-only.
SessionID | If a broadcast is in progress, returns a String that specifies the ID of the session. Read-only.
State | Returns an MSOBroadcastState constant that describes the current broadcast state. Read-only.


Broadcast Properties (Word)

 Copy code hover
[image]

Broadcast Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
AttendeeUrl | If a broadcast is in progress, returns a String that represents the URL of the attendee link. Read-only.
Capabilities | Returns a Long that represents the capabilities of the specified broadcast. Read-only.
Parent | Returns an Object that represents the parent object of the specified Broadcast object.
PresenterServiceUrl | If a broadcast is in progress, returns a String that represents the URL of the presenter service hosting the broadcast. Read-only.
SessionID | If a broadcast is in progress, returns a String that specifies the ID of the session. Read-only.
State | Returns an MSOBroadcastState constant that describes the current broadcast state. Read-only.


Broadcast.Application Property (Word)

 Copy code hover
[image]

Broadcast.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Version information

Version Added: Word 2013

Syntax

expression .Application

expression A variable that represents a Broadcast object.

Property value

APPLICATION

See also

Other resources

Broadcast Object Members


Broadcast.AttendeeUrl Property (Word)

 Copy code hover
[image]

Broadcast.AttendeeUrl Property (Word)
See also Send feedback

Published: July 16, 2012

If a broadcast is in progress, returns a String that represents the URL of the attendee link. Read-only.

Version information

Version Added: Word 2013

Syntax

expression .AttendeeUrl

expression A variable that represents a Broadcast object.

Remarks

If a broadcast is not in progress, AttendeeUrl returns an empty string.

Property value

STRING

See also

Other resources

Broadcast Object
Broadcast Members


Broadcast.Capabilities Property (Word)

 Copy code hover
[image]

Broadcast.Capabilities Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the capabilities of the specified broadcast. Read-only.

Version information

Version Added: Word 2013

Syntax

expression .Capabilities

expression A variable that represents a Broadcast object.

Remarks

The Capabilities property can return the following MSOBroadcastCapabilities values:

Name | Value | Description
MSOBroadcastCapFileSizeLimited | 1 | File size limited
MSOBroadcastCapSupportsMeetingNotes | 2 | Supports meeting notes
MSOBroadcastCapSupportsUpdateDoc | 4 | Supports document update

The values returned correspond to either Microsoft Office 2013 or Microsoft Office 2010 broadcast presentation service capabilities.

Property value

INT32

See also

Other resources

Broadcast Object
Broadcast Members


Broadcast.Parent Property (Word)

 Copy code hover
[image]

Broadcast.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Broadcast object.

Version information

Version Added: Word 2013

Syntax

expression .Parent

expression A variable that represents a Broadcast object.

Property value

OBJECT

See also

Other resources

Broadcast Object
Broadcast Object Members


Broadcast.PresenterServiceUrl Property (Word)

 Copy code hover
[image]

Broadcast.PresenterServiceUrl Property (Word)
See also Send feedback

Published: July 16, 2012

If a broadcast is in progress, returns a String that represents the URL of the presenter service hosting the broadcast. Read-only.

Version information

Version Added: Word 2013

Syntax

expression .PresenterServiceUrl

expression A variable that represents a Broadcast object.

Remarks

If a broadcast is not in progress, PresenterServiceUrl returns an empty string.

Property value

STRING

See also

Other resources

Broadcast Object
Broadcast Members


Broadcast.SessionID Property (Word)

 Copy code hover
[image]

Broadcast.SessionID Property (Word)
See also Send feedback

Published: July 16, 2012

If a broadcast is in progress, returns a String that specifies the ID of the session. Read-only.

Version information

Version Added: Word 2013

Syntax

expression .SessionID

expression A variable that represents a Broadcast object.

Remarks

If a broadcast is not in progress, SessionID returns an empty string.

Property value

STRING

See also

Other resources

Broadcast Object
Broadcast Members


Broadcast.State Property (Word)

 Copy code hover
[image]

Broadcast.State Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an MSOBroadcastState constant that describes the current broadcast state. Read-only.

Version information

Version Added: Word 2013

Syntax

expression .State

expression A variable that represents a Broadcast object.

Remarks

The State property can return one of the following three states:

  • No broadcast (0)

  • Broadcast started (1)

  • Broadcast paused (2)

Property value

MSOBROADCASTSTATE

See also

Other resources

Broadcast Object
Broadcast Members


Broadcast Methods (Word)

 Copy code hover
[image]

Broadcast Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
AddMeetingNotes | Adds shared meeting notes for the specified broadcast that are accessible to attendees who use either Microsoft OneNote 2013 rich client or web app.
End | Ends the specified broadcast session.
Pause | Pauses the specified broadcast.
Resume | Resumes the specified broadcast.
Start | Initiates the specified broadcast session.


Broadcast.AddMeetingNotes Method (Word)

 Copy code hover
[image]

Broadcast.AddMeetingNotes Method (Word)
See also Send feedback

Published: July 16, 2012

Adds shared meeting notes for the specified broadcast that are accessible to attendees who use either Microsoft OneNote 2013 rich client or web app.

Version information

Version Added: Word 2013

Syntax

expression .AddMeetingNotes(notesUrl,notesWacUrl)

expression A variable that represents a Broadcast object.

Parameters

Name | Required/Optional | Data type | Description
notesUrl | Required | STRING | Specifies the URL where the shared meeting notes are stored, for attendees using the Microsoft OneNote 2013 rich client.
notesWacUrl | Required | STRING | Specifies the URL where the shared meeting notes are stored, for attendees using the Microsoft OneNote 2013 web access client.

Return value

VOID

Remarks

If you fail to pass a string for either of the two parameters, the AddMeetingNotes method returns an Invalid Parameter error. If for any reason the method call fails, Word 2013 returns a generic broadcast error.

See also

Other resources

Broadcast Object
Broadcast Members


Broadcast.End Method (Word)

 Copy code hover
[image]

Broadcast.End Method (Word)
See also Send feedback

Published: July 16, 2012

Ends the specified broadcast session.

Version information

Version Added: Word 2013

Syntax

expression .End

expression A variable that represents a Broadcast object.

Return value

VOID

Remarks

Calling the End method terminates the broadcast session without displaying a confirmation prompt to the user. It also sets the value of the Broadcast.AttendeeURL property to an empty string.

If the document is not being broadcast, the method returns runtime error 4702.

See also

Other resources

Broadcast Object
Broadcast Members


Broadcast.Pause Method (Word)

 Copy code hover
[image]

Broadcast.Pause Method (Word)
See also Send feedback

Published: July 16, 2012

Pauses the specified broadcast.

Version information

Version Added: Word 2013

Syntax

expression .Pause

expression A variable that represents a Broadcast object.

Return value

VOID

Remarks

If the specified broadcast is not in progress, Pause returns runtime error 4702.

See also

Other resources

Broadcast Object
Broadcast Members


Broadcast.Resume Method (Word)

 Copy code hover
[image]

Broadcast.Resume Method (Word)
See also Send feedback

Published: July 16, 2012

Resumes the specified broadcast.

Version information

Version Added: Word 2013

Syntax

expression .Resume

expression A variable that represents a Broadcast object.

Return value

VOID

Remarks

The Resume method returns an error (#4700) if the document is DRM protected, is already being broadcast (#4698), is not being broadcast at all (#4702), or has conflicting edits (is in merge mode, #4701).

See also

Other resources

Broadcast Object
Broadcast Members


Broadcast.Start Method (Word)

 Copy code hover
[image]

Broadcast.Start Method (Word)
See also Send feedback

Published: July 16, 2012

Initiates the specified broadcast session.

Version information

Version Added: Word 2013

Syntax

expression .Start(serverUrl)

expression A variable that represents a Broadcast object.

Parameters

Name | Required/Optional | Data type | Description
serverUrl | Required | STRING | The URL of the broadcast server.

Return value

VOID

Remarks

Calling the Start method sets up the server, authenticates the user, and uploads the presentation.

If the value passed for serverUrl has invalid formatting, Start returns an "Invalid Parameter" error. Additionally, the method returns an error if the document is DRM protected, is already being broadcast, or has conflicting edits (is in merge mode).

See also

Other resources

Broadcast Object
Broadcast Members


Browser Object (Word)

 Copy code hover
[image]

Browser Object (Word)
See also Send feedback

Published: July 16, 2012

Represents the browser tool used to move the insertion point to objects in a document. This tool is composed of the three buttons at the bottom of the vertical scroll bar.

Remarks

Use the Browser property to return the Browser object. The following example moves the insertion point just before the next field in the active document.

VBA Copy code Copy code
With Application.Browser
 .Target = wdBrowseField
 .Next
End With

The following example moves the insertion point to the previous table and selects it.

VBA Copy code Copy code
With Application.Browser
 .Target = wdBrowseTable
 .Previous
End With
If Selection.Information(wdWithInTable) = True Then
 Selection.Tables(1).Select
End If

See also

Concepts

Word Object Model Reference

Other resources

Browser Object Members


Browser Members (Word)

 Copy code hover
[image]

Browser Members (Word)
Send feedback

Published: July 16, 2012

Represents the browser tool used to move the insertion point to objects in a document. This tool is composed of the three buttons at the bottom of the vertical scroll bar.

Methods

Name | Description
Next | Moves the selection to the next item indicated by the browser target. Use the Target property to change the browser target.
Previous | Moves the selection to the previous item indicated by the browser target. Use the Target property to change the browser target.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified Browser object.
Target | Returns or sets the document item that the Previous and Next methods locate. Read/write WdBrowseTarget.


Browser Properties (Word)

 Copy code hover
[image]

Browser Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified Browser object.
Target | Returns or sets the document item that the Previous and Next methods locate. Read/write WdBrowseTarget.


Browser.Application Property (Word)

 Copy code hover
[image]

Browser.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression A variable that represents a Browser object.

See also

Concepts

Browser Object

Other resources

Browser Object Members


Browser.Creator Property (Word)

 Copy code hover
[image]

Browser.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents an Browser object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

Browser Object

Other resources

Browser Object Members


Browser.Parent Property (Word)

 Copy code hover
[image]

Browser.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Browser object.

Syntax

expression .Parent

expression A variable that represents an Browser object.

See also

Concepts

Browser Object

Other resources

Browser Object Members


Browser.Target Property (Word)

 Copy code hover
[image]

Browser.Target Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the document item that the Previous and Next methods locate. Read/write WdBrowseTarget.

Syntax

expression .Target

expression Required. A variable that represents a Browser object.

Example

This example moves the insertion point to the next comment in the active document.

VBA Copy code Copy code
With Application.Browser
 .Target = wdBrowseComment
 .Next
End With

See also

Concepts

Browser Object

Other resources

Browser Object Members


Browser Methods (Word)

 Copy code hover
[image]

Browser Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Next | Moves the selection to the next item indicated by the browser target. Use the Target property to change the browser target.
Previous | Moves the selection to the previous item indicated by the browser target. Use the Target property to change the browser target.


Browser.Next Method (Word)

 Copy code hover
[image]

Browser.Next Method (Word)
See also Send feedback

Published: July 16, 2012

Moves the selection to the next item indicated by the browser target. Use the Target property to change the browser target.

Syntax

expression .Next

expression Required. A variable that represents a Browser object.

Example

This example moves the insertion point just before the next comment reference marker in the active document.

VBA Copy code Copy code
With Application.Browser
 .Target = wdBrowseComment
 .Next
End With

See also

Concepts

Browser Object

Other resources

Browser Object Members


Browser.Previous Method (Word)

 Copy code hover
[image]

Browser.Previous Method (Word)
See also Send feedback

Published: July 16, 2012

Moves the selection to the previous item indicated by the browser target. Use the Target property to change the browser target.

Syntax

expression .Previous

expression Required. A variable that represents a Browser object.

Example

This example moves the insertion point into the first cell (the cell in the upper-left corner) of the previous table.

VBA Copy code Copy code
With Application.Browser
 .Target = wdBrowseTable
 .Previous
End With

See also

Concepts

Browser Object

Other resources

Browser Object Members


BuildingBlock Object (Word)

 Copy code hover
[image]

BuildingBlock Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a building block in a template. A building block is pre-built content, similar to autotext, that may contain text, images, and formatting.

Version Information

Version Added: Word 2007

Remarks

Each BuildingBlock object is a member of the BuildingBlocks and BuildingBlockEntries collections. Building blocks are stored in Microsoft Word templates. Therefore, to access the building blocks available for a document, you need to access an attached template. Built-in building blocks are stored in the template named "Building Blocks.dotx".

Use the Item method of the collection or the BuildingBlocks collection to return an individual building block. The following example accesses the first building block in the first template in the Templates collection.

VBA Copy code Copy code
Dim objTemplate As Template
Dim objBB As BuildingBlock

Set objTemplate = Templates(1)
Set objBB = objTemplate.BuildingBlockEntries.Item(1)
Note Note

Depending on how you access the collection, the collection returned may change. For example, if you access a collection of building blocks with a type of wdTypeAutoText with a category of "General", the returned collection may be different from the collection returned if you access a collection of building blocks with a type of wdTypeAutoText with a category of "Custom". It is also different from the collection returned if you access the collection of building blocks with a type of wdTypeCustomAutoText with a category of "General". Therefore, the first item in a collection accessed from the BuildingBlockEntries collection may be different from the first item in the collection accessed from the BuildingBlocks collection.

To create a new building block, you can use the Add method for either the BuildingBlockEntries collection or the BuildingBlocks collection. However, the recommended way to create a new building block is by using the Add method for the BuildingBlockEntries collection. The following example adds the selected text to the watermarks building block gallery of the first template in the Templates collection.

VBA Copy code Copy code
Dim objTemplate As Template
Dim objBB As BuildingBlock

Set objTemplate = Templates(1)

Set objBB = objTemplate.BuildingBlockEntries _
 .Add(Name:="New Building Block Entry", _
 Type:=wdTypeWatermarks, _
 Category:="General", _
 Range:=Selection.Range)

Use the Insert method to insert a new building block into a document. The following example inserts the first building block in the first template into the active document at the Insertion Point.

VBA Copy code Copy code
Dim objTemplate As Template
Dim objBB As BuildingBlock

Set objTemplate = Templates(1)
Set objBB = objTemplate.BuildingBlockEntries.Item(1)

objBB.Insert Selection.Range

Use the Delete method to remove a building block from a template. The following example deletes the first building block from the first template in the Templates collection.

VBA Copy code Copy code
Dim objTemplate As Template

Set objTemplate = Templates(1)

objTemplate.BuildingBlockEntries(1).Delete

Building blocks are organized by category and type. Use the BuildingBlockTypes collection to access individual BuildingBlockType objects. Use the Categories collection to access individual Category objects. Then use the BuildingBlocks propery to access the BuildingBlocks collection for a Category object. The following example prints the type and category names of all the building blocks in the first template to the Immediate Window. (This example assumes that the Immediate Window is visible.)

VBA Copy code Copy code
Dim objTemplate As Template
Dim objBBT As BuildingBlockType
Dim objCat As Category
Dim intCount As Integer
Dim intCountCat As Integer

Set objTemplate = Templates(1)

For intCount = 1 To objTemplate.BuildingBlockTypes.Count
 Set objBBT = objTemplate.BuildingBlockTypes(intCount)
 If objBBT.Categories.Count > 0 Then
 Debug.Print objBBT.Name
 For intCountCat = 1 To objBBT.Categories.Count
 Set objCat = objBBT.Categories(intCountCat)
 Debug.Print vbTab & objCat.Name
 Next
 End If
Next

Each building block has properties that contain information that applies uniquely to it, such as Name, Description, Type, and Value.

For more information about building blocks, see Working with Building Blocks.

See also

Concepts

Word Object Model Reference

Other resources

BuildingBlock Object Members


BuildingBlock Members (Word)

 Copy code hover
[image]

BuildingBlock Members (Word)
Send feedback

Published: July 16, 2012

Represents a building block in a template. A building block is pre-built content, similar to autotext, that may contain text, images, and formatting.

Methods

Name | Description
Delete | Deletes the specified building block.
Insert | Inserts the value of a building block into a document and returns a Range object that represents the contents of the building block within the document.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Category | Returns a Category object that represents the category for a building block. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
Description | Returns or sets a String that represents the description for a building block. Read/write.
ID | Returns a String that represents the internal identification number for a building block. Read-only.
Index | Returns a Long that represents the position of an item in a collection. Read-only.
InsertOptions | Returns or sets a Long that represents how to insert the contents of a building block into a document. Read/write.
Name | Returns or sets a String that represents the name of a building block. Read/write.
Parent | Returns an Object that represents the parent object of the specified BuildingBlock object.
Type | Returns a BuildingBlockType object that represents the type for a building block. Read-only.
Value | Returns or sets a String that represents the contents of a building block. Read/write.


BuildingBlock Properties (Word)

 Copy code hover
[image]

BuildingBlock Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Category | Returns a Category object that represents the category for a building block. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
Description | Returns or sets a String that represents the description for a building block. Read/write.
ID | Returns a String that represents the internal identification number for a building block. Read-only.
Index | Returns a Long that represents the position of an item in a collection. Read-only.
InsertOptions | Returns or sets a Long that represents how to insert the contents of a building block into a document. Read/write.
Name | Returns or sets a String that represents the name of a building block. Read/write.
Parent | Returns an Object that represents the parent object of the specified BuildingBlock object.
Type | Returns a BuildingBlockType object that represents the type for a building block. Read-only.
Value | Returns or sets a String that represents the contents of a building block. Read/write.


BuildingBlock.Application Property (Word)

 Copy code hover
[image]

BuildingBlock.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a BuildingBlock object.

See also

Concepts

BuildingBlock Object

Other resources

BuildingBlock Object Members


BuildingBlock.Category Property (Word)

 Copy code hover
[image]

BuildingBlock.Category Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Category object that represents the category for a building block. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Category

expression An expression that returns a BuildingBlock object.

See also

Concepts

BuildingBlock Object

Other resources

BuildingBlock Object Members


BuildingBlock.Creator Property (Word)

 Copy code hover
[image]

BuildingBlock.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.

Syntax

expression .Creator

expression An expression that returns an BuildingBlock object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

BuildingBlock Object

Other resources

BuildingBlock Object Members


BuildingBlock.Description Property (Word)

 Copy code hover
[image]

BuildingBlock.Description Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a String that represents the description for a building block. Read/write.

Syntax

expression .Description

expression An expression that returns a BuildingBlock object.

See also

Concepts

BuildingBlock Object

Other resources

BuildingBlock Object Members


BuildingBlock.ID Property (Word)

 Copy code hover
[image]

BuildingBlock.ID Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a String that represents the internal identification number for a building block. Read-only.

Syntax

expression .ID

expression An expression that returns a BuildingBlock object.

Remarks

The ID property returns an identification string that is in the form of a GUID.

See also

Concepts

BuildingBlock Object

Other resources

BuildingBlock Object Members


BuildingBlock.Index Property (Word)

 Copy code hover
[image]

BuildingBlock.Index Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the position of an item in a collection. Read-only.

Syntax

expression .Index

expression An expression that returns a BuildingBlock object.

See also

Concepts

BuildingBlock Object

Other resources

BuildingBlock Object Members


BuildingBlock.InsertOptions Property (Word)

 Copy code hover
[image]

BuildingBlock.InsertOptions Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Long that represents how to insert the contents of a building block into a document. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .InsertOptions

expression An expression that returns a BuildingBlock object.

Remarks

The value of the InsertOptions property can be any WdDocPartInsertOptions constant.

See also

Concepts

BuildingBlock Object

Other resources

BuildingBlock Object Members


BuildingBlock.Name Property (Word)

 Copy code hover
[image]

BuildingBlock.Name Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a String that represents the name of a building block. Read/write.

Syntax

expression .Name

expression An expression that returns a BuildingBlock object.

See also

Concepts

BuildingBlock Object

Other resources

BuildingBlock Object Members


BuildingBlock.Parent Property (Word)

 Copy code hover
[image]

BuildingBlock.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified BuildingBlock object.

Syntax

expression .Parent

expression A variable that represents a BuildingBlock object.

See also

Concepts

BuildingBlock Object

Other resources

BuildingBlock Object Members


BuildingBlock.Type Property (Word)

 Copy code hover
[image]

BuildingBlock.Type Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a BuildingBlockType object that represents the type for a building block. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Type

expression An expression that returns a BuildingBlock object.

See also

Concepts

BuildingBlock Object

Other resources

BuildingBlock Object Members


BuildingBlock.Value Property (Word)

 Copy code hover
[image]

BuildingBlock.Value Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a String that represents the contents of a building block. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .Value

expression An expression that returns a BuildingBlock object.

See also

Concepts

BuildingBlock Object

Other resources

BuildingBlock Object Members


BuildingBlock Methods (Word)

 Copy code hover
[image]

BuildingBlock Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the specified building block.
Insert | Inserts the value of a building block into a document and returns a Range object that represents the contents of the building block within the document.


BuildingBlock.Delete Method (Word)

 Copy code hover
[image]

BuildingBlock.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the specified building block.

Syntax

expression .Delete

expression An expression that returns a BuildingBlock object.

See also

Concepts

BuildingBlock Object

Other resources

BuildingBlock Object Members


BuildingBlock.Insert Method (Word)

 Copy code hover
[image]

BuildingBlock.Insert Method (Word)
See also Send feedback

Published: July 16, 2012

Inserts the value of a building block into a document and returns a Range object that represents the contents of the building block within the document.

Syntax

expression .Insert(Where, RichText)

expression An expression that returns a BuildingBlock object.

Parameters

Name | Required/Optional | Data Type | Description
Where | Required | Range | The location of where to place the contents of the building block.
RichText | Optional | Variant | True inserts the building block as rich, formatted text. False inserts the building block as plain text.

Return Value

Range

Example

The following example inserts the first building block from the first template into the first paragraph of the active document.

VBA Copy code Copy code
Dim objTemplate As Template
Dim objBB As BuildingBlock

Set objTemplate = Templates(1)
Set objBB = objTemplate.BuildingBlockEntries(1)

objBB.Insert ActiveDocument.Paragraphs(1).Range

See also

Concepts

BuildingBlock Object

Other resources

BuildingBlock Object Members


BuildingBlockEntries Object (Word)

 Copy code hover
[image]

BuildingBlockEntries Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a collection of all BuildingBlock objects in a template.

Version Information

Version Added: Word 2007

Remarks

Use the Add method to create a new building block and add it to a template. The following example adds the selected text to the watermarks building block gallery of the first template in the Templates collection.

VBA Copy code Copy code
Dim objTemplate As Template
Dim objBB As BuildingBlock

Set objTemplate = Templates(1)

Set objBB = objTemplate.BuildingBlockEntries _
 .Add(Name:="New Building Block Entry", _
 Type:=wdTypeWatermarks, _
 Category:="General", _
 Range:=Selection.Range)

Unlike the Add method for the BuildingBlocks collection, you need to specify the type and category when you add a building block using the Add method of the BuildingBlockEntries collection. This is because building blocks are organized by using types and categories. When you use the BuildingBlockEntries collection, you are accessing the entire collection of building blocks in a template; however, when you use the BuildingBlocks collection, you are accessing the collection of building blocks for a specific type and category in a template.

Note Note

Using the Category and Type properties for the BuildingBlock object enables you to determine the category and type for a building block.

For more information about building blocks, see Working with Building Blocks.

See also

Concepts

Word Object Model Reference

Other resources

BuildingBlockEntries Object Members


BuildingBlockEntries Members (Word)

 Copy code hover
[image]

BuildingBlockEntries Members (Word)
Send feedback

Published: July 16, 2012

Represents a collection of all BuildingBlock objects in a template.

Methods

Name | Description
Add | Creates a new building block entry in a template and returns a BuildingBlock object that represents the new building block entry.
Item | Returns a BuildingBlock object that represents the specified item in the collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns the number of items in the BuildingBlockEntries collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified BuildingBlockEntries object.


BuildingBlockEntries Properties (Word)

 Copy code hover
[image]

BuildingBlockEntries Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns the number of items in the BuildingBlockEntries collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified BuildingBlockEntries object.


BuildingBlockEntries.Application Property (Word)

 Copy code hover
[image]

BuildingBlockEntries.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a BuildingBlockEntries collection.

See also

Concepts

BuildingBlockEntries Collection

Other resources

BuildingBlockEntries Object Members


BuildingBlockEntries.Count Property (Word)

 Copy code hover
[image]

BuildingBlockEntries.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the number of items in the BuildingBlockEntries collection. Read-only Long.

Syntax

expression .Count

expression A variable that represents a BuildingBlockEntries object.

See also

Concepts

BuildingBlockEntries Collection

Other resources

BuildingBlockEntries Object Members


BuildingBlockEntries.Creator Property (Word)

 Copy code hover
[image]

BuildingBlockEntries.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.

Syntax

expression .Creator

expression An expression that returns an BuildingBlockEntries object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

BuildingBlockEntries Collection

Other resources

BuildingBlockEntries Object Members


BuildingBlockEntries.Parent Property (Word)

 Copy code hover
[image]

BuildingBlockEntries.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified BuildingBlockEntries object.

Syntax

expression .Parent

expression A variable that represents a BuildingBlockEntries object.

See also

Concepts

BuildingBlockEntries Collection

Other resources

BuildingBlockEntries Object Members


BuildingBlockEntries Methods (Word)

 Copy code hover
[image]

BuildingBlockEntries Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Creates a new building block entry in a template and returns a BuildingBlock object that represents the new building block entry.
Item | Returns a BuildingBlock object that represents the specified item in the collection.


BuildingBlockEntries.Add Method (Word)

 Copy code hover
[image]

BuildingBlockEntries.Add Method (Word)
See also Send feedback

Published: July 16, 2012

Creates a new building block entry in a template and returns a BuildingBlock object that represents the new building block entry.

Syntax

expression .Add(Name, Type, Category, Range, Description, InsertOptions)

expression An expression that returns a BuildingBlockEntries object.

Parameters

Name | Required/Optional | Data Type | Description
Name | Required | String | Specifies the name of the building block entry. Corresponds to the Name property of the BuildingBlock object.
Type | Required | WdBuildingBlockTypes | Specifies the type of building block to create. Corresponds to the Type property of the BuildingBlock object.
Category | Required | String | Specifies the category of the new building block entry. Corresponds to the Category property of the BuildingBlock object.
Range | Required | Range | Specifies the value of the buildling block entry. Corresponds to the Value property of the BuildingBlock object.
Description | Optional | Variant | Specifies the description of the buildling block entry. Corresponds to the Description property of the BuildingBlock object.
InsertOptions | Optional | WdDocPartInsertOptions | Specifies whether the building block entry is inserted as a page, a paragraph, or inline. If omitted, the default value is wdInsertContent. Corresponds to the InsertOptions property for the BuildingBlock object.

Return Value

BuildingBlock

Example

The following example creates a new building block entry and adds it to the template attached to the active document, and than sets the value of the building block to the selected text.

VBA Copy code Copy code
Dim objTemplate As Template
Dim objBB As BuildingBlock

Set objTemplate = ActiveDocument.AttachedTemplate
Set objBB = objTemplate.BuildingBlockEntries.Add("Author Name", _
 wdTypeCustomTextBox, "Custom", Selection.Range)

See also

Concepts

BuildingBlockEntries Collection

Other resources

BuildingBlockEntries Object Members


BuildingBlockEntries.Item Method (Word)

 Copy code hover
[image]

BuildingBlockEntries.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a BuildingBlock object that represents the specified item in the collection.

Syntax

expression .Item(Index)

expression An expression that returns a BuildingBlockEntries object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | Specifies a String or Integer that represents the name or ordinal position of the object in the collection.

Return Value

BuildingBlock

See also

Concepts

BuildingBlockEntries Collection

Other resources

BuildingBlockEntries Object Members


BuildingBlocks Object (Word)

 Copy code hover
[image]

BuildingBlocks Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a collection of BuildingBlock objects for a specific building block type and category in a template.

Version Information

Version Added: Word 2007

Remarks

Use the Add method to create a new building block and add it to a template. The following example adds the selected text to the watermarks building block gallery of the first template in the Templates collection.

VBA Copy code Copy code
Dim objTemplate As Template
Dim objBB As BuildingBlock

Set objTemplate = Templates(1)

Set objBB = objTemplate.BuildingBlockEntries _
 .Add(Name:="New Building Block Entry", _
 Type:=wdTypeWatermarks, _
 Category:="General", _
 Range:=Selection.Range)

The collection returned with the BuildingBlocks collection is a filtered collection based on the type and category. Depending on how you access the collection, the collection returned changes. For example, if you access a collection of building blocks with a type of wdTypeAutoText with a category of "General", the returned collection may be different from the collection returned if you access a collection of building blocks with a type of wdTypeAutoText with a category of "Custom". It is also different from the collection returned if you access the collection of building blocks with a type of wdTypeCustomAutoText with a category of "General".

For more information about building blocks, see Working with Building Blocks.

See also

Concepts

Word Object Model Reference

Other resources

BuildingBlocks Object Members


BuildingBlocks Members (Word)

 Copy code hover
[image]

BuildingBlocks Members (Word)
Send feedback

Published: July 16, 2012

Represents a collection of BuildingBlock objects for a specific building block type and category in a template.

Methods

Name | Description
Add | Creates a new building block and returns a BuildingBlock object.
Item | Returns a BuildingBlock object that represents the specified item in the collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns the number of items in the BuildingBlocks collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified BuildingBlocks object.


BuildingBlocks Properties (Word)

 Copy code hover
[image]

BuildingBlocks Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns the number of items in the BuildingBlocks collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified BuildingBlocks object.


BuildingBlocks.Application Property (Word)

 Copy code hover
[image]

BuildingBlocks.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a BuildingBlocks collection.

See also

Concepts

BuildingBlocks Collection

Other resources

BuildingBlocks Object Members


BuildingBlocks.Count Property (Word)

 Copy code hover
[image]

BuildingBlocks.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the number of items in the BuildingBlocks collection. Read-only Long.

Syntax

expression .Count

expression A variable that represents a BuildingBlocks object.

See also

Concepts

BuildingBlocks Collection

Other resources

BuildingBlocks Object Members


BuildingBlocks.Creator Property (Word)

 Copy code hover
[image]

BuildingBlocks.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.

Syntax

expression .Creator

expression An expression that returns an BuildingBlocks object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

BuildingBlocks Collection

Other resources

BuildingBlocks Object Members


BuildingBlocks.Parent Property (Word)

 Copy code hover
[image]

BuildingBlocks.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified BuildingBlocks object.

Syntax

expression .Parent

expression A variable that represents a BuildingBlocks object.

See also

Concepts

BuildingBlocks Collection

Other resources

BuildingBlocks Object Members


BuildingBlocks Methods (Word)

 Copy code hover
[image]

BuildingBlocks Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Creates a new building block and returns a BuildingBlock object.
Item | Returns a BuildingBlock object that represents the specified item in the collection.


BuildingBlocks.Add Method (Word)

 Copy code hover
[image]

BuildingBlocks.Add Method (Word)
See also Send feedback

Published: July 16, 2012

Creates a new building block and returns a BuildingBlock object.

Syntax

expression .Add(Name, Range, Description, InsertOptions)

expression An expression that returns a BuildingBlocks object.

Parameters

Name | Required/Optional | Data Type | Description
Name | Required | String | Specifies the name of the building block entry. Corresponds to the Name property of the BuildingBlock object.
Range | Required | Range | Specifies the value of the buildling block entry. Corresponds to the Value property of the BuildingBlock object.
Description | Optional | Variant | Specifies the description of the buildling block entry. Corresponds to the Description property of the BuildingBlock object.
InsertOptions | Optional | WdDocPartInsertOptions | Specifies whether the building block entry is inserted as a page, a paragraph, or inline. If omitted, the default value is wdInsertContent. Corresponds to the InsertOptions property for the BuildingBlock object.

Return Value

BuildingBlock

Example

The following example adds a new building block auto text entry to the first template in the collection of templates.

VBA Copy code Copy code
Dim objTemplate As Template

Set objTemplate = Templates(1)

objTemplate.BuildingBlockTypes(wdTypeAutoText) _
 .Categories("General").BuildingBlocks _
 .Add Name:="New Building Block", _
 Range:=Selection.Range

See also

Concepts

BuildingBlocks Collection

Other resources

BuildingBlocks Object Members


BuildingBlocks.Item Method (Word)

 Copy code hover
[image]

BuildingBlocks.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a BuildingBlock object that represents the specified item in the collection.

Syntax

expression .Item(Index)

expression An expression that returns a BuildingBlocks object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | Specifies a String or Integer that represents the name or ordinal position of the object in the collection.

Return Value

BuildingBlock

See also

Concepts

BuildingBlocks Collection

Other resources

BuildingBlocks Object Members


BuildingBlockType Object (Word)

 Copy code hover
[image]

BuildingBlockType Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a type of building block. Each BuildingBlockType object is a member of the BuildingBlockTypes collection.

Version Information

Version Added: Word 2007

Remarks

Microsoft Word uses types and categories to organize building blocks. Each building block type is represented by a WdBuildingBlockTypes constant. Use the Categories property to access categories for a specific building block type. The following example prints the type and category names of all the building blocks in the first template to the Immediate Window. (This example assumes that the Immediate Window is visible.)

VBA Copy code Copy code
Dim objTemplate As Template
Dim objBBT As BuildingBlockType
Dim objCat As Category
Dim intCount As Integer
Dim intCountCat As Integer

Set objTemplate = Templates(1)

For intCount = 1 To objTemplate.BuildingBlockTypes.Count
 Set objBBT = objTemplate.BuildingBlockTypes(intCount)
 If objBBT.Categories.Count > 0 Then
 Debug.Print objBBT.Name
 For intCountCat = 1 To objBBT.Categories.Count
 Set objCat = objBBT.Categories(intCountCat)
 Debug.Print vbTab & objCat.Name
 Next
 End If
Next

For more information about building blocks, see Working with Building Blocks.

See also

Concepts

Word Object Model Reference

Other resources

BuildingBlockType Object Members


BuildingBlockType Members (Word)

 Copy code hover
[image]

BuildingBlockType Members (Word)
Send feedback

Published: July 16, 2012

Represents a type of building block. Each BuildingBlockType object is a member of the BuildingBlockTypes collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Categories | Returns a Categories collection that represents the categories for a building block type. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
Index | Returns a Long that represents the position of an item in a collection. Read-only.
Name | Returns a String that represents the localized name of a building block type. Read-only.
Parent | Returns an Object that represents the parent object of the specified BuildingBlockType object.


BuildingBlockType Properties (Word)

 Copy code hover
[image]

BuildingBlockType Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Categories | Returns a Categories collection that represents the categories for a building block type. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
Index | Returns a Long that represents the position of an item in a collection. Read-only.
Name | Returns a String that represents the localized name of a building block type. Read-only.
Parent | Returns an Object that represents the parent object of the specified BuildingBlockType object.


BuildingBlockType.Application Property (Word)

 Copy code hover
[image]

BuildingBlockType.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a BuildingBlockType object.

See also

Concepts

BuildingBlockType Object

Other resources

BuildingBlockType Object Members


BuildingBlockType.Categories Property (Word)

 Copy code hover
[image]

BuildingBlockType.Categories Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Categories collection that represents the categories for a building block type. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Categories

expression An expression that returns a BuildingBlockType object.

See also

Concepts

BuildingBlockType Object

Other resources

BuildingBlockType Object Members


BuildingBlockType.Creator Property (Word)

 Copy code hover
[image]

BuildingBlockType.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.

Syntax

expression .Creator

expression An expression that returns an BuildingBlockType object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

BuildingBlockType Object

Other resources

BuildingBlockType Object Members


BuildingBlockType.Index Property (Word)

 Copy code hover
[image]

BuildingBlockType.Index Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the position of an item in a collection. Read-only.

Syntax

expression .Index

expression An expression that returns a BuildingBlockType object.

See also

Concepts

BuildingBlockType Object

Other resources

BuildingBlockType Object Members


BuildingBlockType.Name Property (Word)

 Copy code hover
[image]

BuildingBlockType.Name Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a String that represents the localized name of a building block type. Read-only.

Syntax

expression .Name

expression An expression that returns a BuildingBlockType object.

See also

Concepts

BuildingBlockType Object

Other resources

BuildingBlockType Object Members


BuildingBlockType.Parent Property (Word)

 Copy code hover
[image]

BuildingBlockType.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified BuildingBlockType object.

Syntax

expression .Parent

expression A variable that represents a BuildingBlockType object.

See also

Concepts

BuildingBlockType Object

Other resources

BuildingBlockType Object Members


BuildingBlockTypes Object (Word)

 Copy code hover
[image]

BuildingBlockTypes Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a collection of BuildingBlockType objects.

Version Information

Version Added: Word 2007

Remarks

Building block types are represented by WdBuildingBlockTypes constants. Use the Item method to access a specific type in the BuildingBlockTypes collection.

To loop through the different building block types, use a For loop with the Count property. The following example loops through the building block types and prints the name in the Immediate Window. (This example assumes that the Immediate Window is visible.)

VBA Copy code Copy code
Dim objTemplate As Template
Dim intCount As Integer
Dim objBBT As BuildingBlockType

Set objTemplate = Templates(1)

For intCount = 1 To objTemplate.BuildingBlockTypes.Count
 Set objBBT = objTemplate.BuildingBlockTypes(intCount)
 Debug.Print objBBT.Name
Next

For more information about building blocks, see Working with Building Blocks.

See also

Concepts

Word Object Model Reference

Other resources

BuildingBlockTypes Object Members


BuildingBlockTypes Members (Word)

 Copy code hover
[image]

BuildingBlockTypes Members (Word)
Send feedback

Published: July 16, 2012

Represents a collection of BuildingBlockType objects.

Methods

Name | Description
Item | Returns a BuildingBlockType object that represents the specified item in the collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns the number of items in the BuildingBlockTypes collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified BuildingBlockTypes object.


BuildingBlockTypes Properties (Word)

 Copy code hover
[image]

BuildingBlockTypes Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns the number of items in the BuildingBlockTypes collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified BuildingBlockTypes object.


BuildingBlockTypes.Application Property (Word)

 Copy code hover
[image]

BuildingBlockTypes.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a BuildingBlockTypes collection.

See also

Concepts

BuildingBlockTypes Collection

Other resources

BuildingBlockTypes Object Members


BuildingBlockTypes.Count Property (Word)

 Copy code hover
[image]

BuildingBlockTypes.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the number of items in the BuildingBlockTypes collection. Read-only Long.

Syntax

expression .Count

expression A variable that represents a BuildingBlockTypes object.

See also

Concepts

BuildingBlockTypes Collection

Other resources

BuildingBlockTypes Object Members


BuildingBlockTypes.Creator Property (Word)

 Copy code hover
[image]

BuildingBlockTypes.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.

Syntax

expression .Creator

expression An expression that returns an BuildingBlockTypes object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

BuildingBlockTypes Collection

Other resources

BuildingBlockTypes Object Members


BuildingBlockTypes.Parent Property (Word)

 Copy code hover
[image]

BuildingBlockTypes.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified BuildingBlockTypes object.

Syntax

expression .Parent

expression A variable that represents a BuildingBlockTypes object.

See also

Concepts

BuildingBlockTypes Collection

Other resources

BuildingBlockTypes Object Members


BuildingBlockTypes Methods (Word)

 Copy code hover
[image]

BuildingBlockTypes Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Item | Returns a BuildingBlockType object that represents the specified item in the collection.


BuildingBlockTypes.Item Method (Word)

 Copy code hover
[image]

BuildingBlockTypes.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a BuildingBlockType object that represents the specified item in the collection.

Syntax

expression .Item(Index)

expression An expression that returns a BuildingBlockTypes object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | WdBuildingBlockTypes | Specifies the building block type of the item in the collection.

Return Value

BuildingBlockType

See also

Concepts

BuildingBlockTypes Collection

Other resources

BuildingBlockTypes Object Members


CalloutFormat Object (Word)

 Copy code hover
[image]

CalloutFormat Object (Word)
See also Send feedback

Published: July 16, 2012

Contains properties and methods that apply to line callouts.

Remarks

Use the Callout property to return a CalloutFormat object. The following example specifies the following attributes of shape three (a line callout) on the active document: the callout will have a vertical accent bar that separates the text from the callout line; the angle between the callout line and the side of the callout text box will be 30 degrees; there will be no border around the callout text; the callout line will be attached to the top of the callout text box; and the callout line will contain two segments. For this example to work, shape three must be a callout.

VBA Copy code Copy code
With ActiveDocument.Shapes(3).Callout
 .Accent = True
 .Angle = msoCalloutAngle30
 .Border = False
 .PresetDrop msoCalloutDropTop
 .Type = msoCalloutThree
End With

See also

Concepts

Word Object Model Reference

Other resources

CalloutFormat Object Members


CalloutFormat Members (Word)

 Copy code hover
[image]

CalloutFormat Members (Word)
Send feedback

Published: July 16, 2012

Contains properties and methods that apply to line callouts.

Methods

Name | Description
CustomDrop | Sets the vertical distance (in points) from the edge of the text bounding box to the place where the callout line attaches to the text box.
CustomLength | Specifies that the first segment of the callout line (the segment attached to the text callout box) retain a fixed length whenever the callout is moved.
PresetDrop | Specifies whether the callout line attaches to the top, bottom, or center of the callout text box or whether it attaches at a point that's a specified distance from the top or bottom of the text box.

Properties

Name | Description
Accent | True if a vertical accent bar separates the callout text from the callout line. Read/write MsoTriState.
Angle | Returns or sets the angle of the callout line. Read/write MsoCalloutAngleType.
Application | Returns an Application object that represents the Microsoft Word application.
AutoLength | MsoTrue to automatically sets the length of the callout line. Read-only MsoTriState.
Border | Returns or sets whether the text in the specified callout is surrounded by a border. Read/write MsoTriState.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Drop | Returns the vertical distance (in points) from the edge of the text bounding box to the place where the callout line attaches to the text box. Read-only Single.
DropType | Returns a value that indicates where the callout line attaches to the callout text box. Read-only MsoCalloutDropType.
Gap | Returns or sets the horizontal distance (in points) between the end of the callout line and the text bounding box. Read/write Single.
Length | Returns the length (in points) of the first segment of the callout line (the segment attached to the text callout box). Read-only Single.
Parent | Returns an Object that represents the parent object of the specified CalloutFormat object.
Type | Returns or sets the callout type. Read/write MsoCalloutType.


CalloutFormat Properties (Word)

 Copy code hover
[image]

CalloutFormat Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Accent | True if a vertical accent bar separates the callout text from the callout line. Read/write MsoTriState.
Angle | Returns or sets the angle of the callout line. Read/write MsoCalloutAngleType.
Application | Returns an Application object that represents the Microsoft Word application.
AutoLength | MsoTrue to automatically sets the length of the callout line. Read-only MsoTriState.
Border | Returns or sets whether the text in the specified callout is surrounded by a border. Read/write MsoTriState.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Drop | Returns the vertical distance (in points) from the edge of the text bounding box to the place where the callout line attaches to the text box. Read-only Single.
DropType | Returns a value that indicates where the callout line attaches to the callout text box. Read-only MsoCalloutDropType.
Gap | Returns or sets the horizontal distance (in points) between the end of the callout line and the text bounding box. Read/write Single.
Length | Returns the length (in points) of the first segment of the callout line (the segment attached to the text callout box). Read-only Single.
Parent | Returns an Object that represents the parent object of the specified CalloutFormat object.
Type | Returns or sets the callout type. Read/write MsoCalloutType.


CalloutFormat.Accent Property (Word)

 Copy code hover
[image]

CalloutFormat.Accent Property (Word)
See also Send feedback

Published: July 16, 2012

True if a vertical accent bar separates the callout text from the callout line. Read/write MsoTriState.

Syntax

expression .Accent

expression A variable that represents a CalloutFormat object.

Example

This example adds an oval to the active document and a callout that points to the oval. The callout text won't have a border, but it will have a vertical accent bar that separates the text from the callout line.

VBA Copy code Copy code
Dim shapeCallout As Shape

With ActiveDocument.Shapes
 .AddShape msoShapeOval, 180, 200, 280, 130
 Set shapeCallout = .AddCallout(msoCalloutTwo, 420, 170, 170, 40)

 With shapeCallout
 .TextFrame.TextRange.Text = "My oval"
 .Callout.Accent = msoTrue
 .Callout.Border = msoFalse
 End With
End With

See also

Concepts

CalloutFormat Object

Other resources

CalloutFormat Object Members


CalloutFormat.Angle Property (Word)

 Copy code hover
[image]

CalloutFormat.Angle Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the angle of the callout line. Read/write MsoCalloutAngleType.

Syntax

expression .Angle

expression A variable that represents a CalloutFormat object.

Remarks

If the callout line contains more than one line segment, this property returns or sets the angle of the segment that is farthest from the callout text box. If you set the value of this property to anything other than msoCalloutAngleAutomatic, the callout line maintains a fixed angle as you drag the callout.

Note Note

Setting this property to msoCalloutAngleMixed will cause an error. msoCalloutAngleMixed is a return value only. It indicates a combination of the other states.

Example

This example sets the callout angle to 90 degrees for a callout named "co1" on the active document.

VBA Copy code Copy code
ActiveDocument.Shapes("co1").Callout.Angle = msoCalloutAngle90

See also

Concepts

CalloutFormat Object

Other resources

CalloutFormat Object Members


CalloutFormat.Application Property (Word)

 Copy code hover
[image]

CalloutFormat.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression A variable that represents a CalloutFormat object.

See also

Concepts

CalloutFormat Object

Other resources

CalloutFormat Object Members


CalloutFormat.AutoLength Property (Word)

 Copy code hover
[image]

CalloutFormat.AutoLength Property (Word)
See also Send feedback

Published: July 16, 2012

MsoTrue to automatically sets the length of the callout line. Read-only MsoTriState.

Syntax

expression .AutoLength

expression Required. A variable that represents a CalloutFormat object.

Remarks

Use the AutomaticLength method to set this property to msoTrue, and use the CustomLength method to set this property to msoFalse.

Example

This example creates a new document and adds a callout to the new document, and then sets the length of the callout manually.

VBA Copy code Copy code
Sub AutoCalloutLength()
 Dim docNew As Document
 Dim shpCallout As Shape
 Set docNew = Documents.Add
 Set shpCallout = docNew.Shapes.AddCallout(Type:=msoCalloutFour, _
 Left:=15, Top:=15, Width:=150, Height:=200)
 With shpCallout.Callout
 If .AutoLength = msoTrue then
 .CustomLength 50
 End If
 End With
End Sub

See also

Concepts

CalloutFormat Object

Other resources

CalloutFormat Object Members


CalloutFormat.Border Property (Word)

 Copy code hover
[image]

CalloutFormat.Border Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets whether the text in the specified callout is surrounded by a border. Read/write MsoTriState.

Syntax

expression .Border

expression Required. A variable that represents a CalloutFormat object.

Example

This example adds an oval to the active document and a callout that points to the oval. The callout text won't have a border, but it will have a vertical accent bar that separates the text from the callout line.

VBA Copy code Copy code
Dim docActive As Document

Set docActive = ActiveDocument

With docActive.Shapes
 .AddShape msoShapeOval, 180, 200, 280, 130
 With .AddCallout(msoCalloutTwo, 420, 170, 170, 40)
 .TextFrame.TextRange.Text = "My oval"
 With .Callout
 .Accent = True
 .Border = False
 End With
 End With
End With

See also

Concepts

CalloutFormat Object

Other resources

CalloutFormat Object Members


CalloutFormat.Creator Property (Word)

 Copy code hover
[image]

CalloutFormat.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents an CalloutFormat object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

CalloutFormat Object

Other resources

CalloutFormat Object Members


CalloutFormat.Drop Property (Word)

 Copy code hover
[image]

CalloutFormat.Drop Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the vertical distance (in points) from the edge of the text bounding box to the place where the callout line attaches to the text box. Read-only Single.

Syntax

expression .Drop

expression A variable that represents a CalloutFormat object.

Remarks

The Drop property applies to callouts with an explicitly set drop value. This distance is measured from the top of the text box unless the text box is to the left of the origin of the callout line (the place that the callout points to), in which case the drop distance is measured from the bottom of the text box.

Use the CustomDrop method to set the value of this property.

The value of this property accurately reflects the position of the callout line attachment to the text box only if the callout has an explicitly set drop value — that is, if the value of the DropType property is msoCalloutDropCustom. Use the statement PresetDrop msoCalloutCustomDrop to set the DropType property to msoCalloutDropCustom.

Example

This example replaces the custom drop for the first shape on the active document with one of two preset drops, depending on whether the custom drop value is greater than or less than half the height of the callout text box. For the example to work, the first shape must be a callout.

VBA Copy code Copy code
Dim docActive As Document

Set docActive = ActiveDocument

With docActive.Shapes(1).Callout
 If .DropType = msoCalloutDropCustom Then
 If .Drop < .Parent.Height / 2 Then
 .PresetDrop msoCalloutDropTop
 Else
 .PresetDrop msoCalloutDropBottom
 End If
 End If
End With

See also

Concepts

CalloutFormat Object

Other resources

CalloutFormat Object Members


CalloutFormat.DropType Property (Word)

 Copy code hover
[image]

CalloutFormat.DropType Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a value that indicates where the callout line attaches to the callout text box. Read-only MsoCalloutDropType.

Syntax

expression .DropType

expression Required. A variable that represents a CalloutFormat object.

Remarks

If the callout drop type is msoCalloutDropCustom, the values of the Drop and AutoAttach properties and the relative positions of the callout text box and callout line origin (the place that the callout points to) are used to determine where the callout line attaches to the text box.

This property is read-only. Use the PresetDrop method to set the value of this property.

Example

This example checks to determine whether the third shape on the active document is a callout with a custom drop. If it is, the code replaces the custom drop with one of two preset drops, depending on whether the custom drop value is greater than or less than half the height of the callout text box.

VBA Copy code Copy code
Dim docActive As Document

Set docActive = ActiveDocument

With docActive.Shapes(3)
 If .Type = msoCallout Then
 With .Callout
 If .DropType = msoCalloutDropCustom Then
 If .Drop < .Parent.Height / 2 Then
 .PresetDrop msoCalloutDropTop
 Else
 .PresetDrop msoCalloutDropBottom
 End If
 End If
 End With
 End If
End With

See also

Concepts

CalloutFormat Object

Other resources

CalloutFormat Object Members


CalloutFormat.Gap Property (Word)

 Copy code hover
[image]

CalloutFormat.Gap Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the horizontal distance (in points) between the end of the callout line and the text bounding box. Read/write Single.

Syntax

expression .Gap

expression A variable that represents a CalloutFormat object.

Example

This example sets the distance between the callout line and the text bounding box to 3 points for the first shape on the active document. For the example to work, the first shape must be a callout.

VBA Copy code Copy code
Dim docActive As Document

Set docActive = ActiveDocument
docActive.Shapes(1).Callout.Gap = 3

See also

Concepts

CalloutFormat Object

Other resources

CalloutFormat Object Members


CalloutFormat.Length Property (Word)

 Copy code hover
[image]

CalloutFormat.Length Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the length (in points) of the first segment of the callout line (the segment attached to the text callout box). Read-only Single.

Syntax

expression .Length

expression An expression that returns a CalloutFormat object.

Remarks

The Length property returns a value only when the AutoLength property of the specified callout is set to False and applies only to callouts whose lines consist of more than one segment (types msoCalloutThree and msoCalloutFour).

This property is read-only. Use the CustomLength method to set the value of this property for the CalloutFormat object.

Example

This example specifies that if the first line segment in the callout named "co1" has a fixed length, then the length of the first line segment in the callout named "co2" will also be fixed at that same length. For the example to work, both callouts must have multiple-segment lines.

VBA Copy code Copy code
Dim sngLength As Single

With ActiveDocument.Shapes
 With .Item("co1").Callout
 If Not .AutoLength Then sngLength = .Length
 End With
 If sngLength Then _
 .Item("co2").Callout.CustomLength sngLength
End With

See also

Concepts

CalloutFormat Object

Other resources

CalloutFormat Object Members


CalloutFormat.Parent Property (Word)

 Copy code hover
[image]

CalloutFormat.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified CalloutFormat object.

Syntax

expression .Parent

expression A variable that represents an CalloutFormat object.

See also

Concepts

CalloutFormat Object

Other resources

CalloutFormat Object Members


CalloutFormat.Type Property (Word)

 Copy code hover
[image]

CalloutFormat.Type Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the callout type. Read/write MsoCalloutType.

Syntax

expression .Type

expression Required. A variable that represents a CalloutFormat object.

See also

Concepts

CalloutFormat Object

Other resources

CalloutFormat Object Members


CalloutFormat Methods (Word)

 Copy code hover
[image]

CalloutFormat Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
CustomDrop | Sets the vertical distance (in points) from the edge of the text bounding box to the place where the callout line attaches to the text box.
CustomLength | Specifies that the first segment of the callout line (the segment attached to the text callout box) retain a fixed length whenever the callout is moved.
PresetDrop | Specifies whether the callout line attaches to the top, bottom, or center of the callout text box or whether it attaches at a point that's a specified distance from the top or bottom of the text box.


CalloutFormat.CustomDrop Method (Word)

 Copy code hover
[image]

CalloutFormat.CustomDrop Method (Word)
See also Send feedback

Published: July 16, 2012

Sets the vertical distance (in points) from the edge of the text bounding box to the place where the callout line attaches to the text box.

Syntax

expression .CustomDrop(Drop)

expression Required. A variable that represents a CalloutFormat object.

Parameters

Name | Required/Optional | Data Type | Description
Drop | Required | Single | The drop distance, in points.

Remarks

This distance is measured from the top of the text box unless the AutoAttach property is set to True and the text box is to the left of the origin of the callout line (the place that the callout points to), in which case the drop distance is measured from the bottom of the text box.

If the PresetDrop method was previously used to set the drop for the specified callout, use the following statement before using the CustomDrop method so that the custom drop setting takes effect.

VBA Copy code Copy code
PresetDrop msoCalloutDropCustom

Example

This example cancels any preset drop that's been set for the first shape in the active document, sets the custom drop distance to 14 points, and specifies that the drop distance always be measured from the top. For the example to work, the first shape must be a callout.

VBA Copy code Copy code
Dim docActive As Document

Set docActive = ActiveDocument
VBA Copy code Copy code
With docActive.Shapes(1).Callout
 .PresetDrop msoCalloutDropCustom
 .CustomDrop 14
 .AutoAttach = False
End With

See also

Concepts

CalloutFormat Object

Other resources

CalloutFormat Object Members


CalloutFormat.CustomLength Method (Word)

 Copy code hover
[image]

CalloutFormat.CustomLength Method (Word)
See also Send feedback

Published: July 16, 2012

Specifies that the first segment of the callout line (the segment attached to the text callout box) retain a fixed length whenever the callout is moved.

Syntax

expression .CustomLength(Length)

expression Required. A variable that represents a CalloutFormat object.

Parameters

Name | Required/Optional | Data Type | Description
Length | Required | Single | The length of the first segment of the callout, in points.

Remarks

Use the AutomaticLength method to specify that the first segment of the callout line be scaled automatically whenever the callout is moved. Applies only to callouts whose lines consist of more than one segment (types msoCalloutThree and msoCalloutFour).

Applying this method sets the AutoLength property to False and sets the Length property to the value specified for the Length argument.

Example

This example switches between an automatically scaling first segment and one with a fixed length for the callout line for the first shape on the active document. For the example to work, the first shape must be a callout.

VBA Copy code Copy code
Dim docActive As Document

Set docActive = ActiveDocument
VBA Copy code Copy code
With docActive.Shapes(1).Callout
 If .AutoLength Then
 .CustomLength 50
 Else
 .AutomaticLength
 End If
End With

See also

Concepts

CalloutFormat Object

Other resources

CalloutFormat Object Members


CalloutFormat.PresetDrop Method (Word)

 Copy code hover
[image]

CalloutFormat.PresetDrop Method (Word)
See also Send feedback

Published: July 16, 2012

Specifies whether the callout line attaches to the top, bottom, or center of the callout text box or whether it attaches at a point that's a specified distance from the top or bottom of the text box.

Syntax

expression .PresetDrop(DropType)

expression Required. A variable that represents a CalloutFormat object.

Parameters

Name | Required/Optional | Data Type | Description
DropType | Required | MsoCalloutDropType | The starting position of the callout line relative to the text bounding box. If you specify msoCalloutDropCustom, the values of the Drop and AutoAttach properties and the relative positions of the callout text box and callout line origin (the place that the callout points to) are used to determine where the callout line attaches to the text box.

Example

This example specifies that the callout line attach to the top of the text bounding box for the first shape on the active document. For the example to work, the first shape must be a callout.

VBA Copy code Copy code
ActiveDocument.Shapes(1).Callout.PresetDrop msoCalloutDropTop

This example switches between two preset drops for the first shape on the active document. For the example to work, the first shape must be a callout.

VBA Copy code Copy code
With ActiveDocument.Shapes(1).Callout
 If .DropType = msoCalloutDropTop Then
 .PresetDrop msoCalloutDropBottom
 ElseIf .DropType = msoCalloutDropBottom Then
 .PresetDrop msoCalloutDropTop
 End If
End With

See also

Concepts

CalloutFormat Object

Other resources

CalloutFormat Object Members


CanvasShapes Object (Word)

 Copy code hover
[image]

CanvasShapes Object (Word)
See also Send feedback

Published: July 16, 2012

Use the CanvasItems property of either a Shape or ShapeRange object to return a CanvasShapes collection.

Remarks

To add shapes to a drawing canvas, use the following methods of the CanvasShapes collection: AddCallout , AddConnectorAddCurve , AddLabel , AddLine , AddPicture , AddPolyline , AddShape , AddTextbox , AddTextEffect , or BuildFreeform. The following example adds a drawing canvas to the active document and then adds three shapes to the drawing canvas.

VBA Copy code Copy code
Sub AddCanvasShapes()
 Dim shpCanvas As Shape
 Dim shpCanvasShapes As CanvasShapes
 Dim shpCnvItem As Shape

 'Adds a new canvas to the document
 Set shpCanvas = ActiveDocument.Shapes _
 .AddCanvas(Left:=100, Top:=75, _
 Width:=50, Height:=75)
 Set shpCanvasShapes = shpCanvas.CanvasItems

 'Adds shapes to the CanvasShapes collection
 With shpCanvasShapes
 .AddShape Type:=msoShapeRectangle, _
 Left:=0, Top:=0, Width:=50, Height:=50
 .AddShape Type:=msoShapeOval, _
 Left:=5, Top:=5, Width:=40, Height:=40
 .AddShape Type:=msoShapeIsoscelesTriangle, _
 Left:=0, Top:=25, Width:=50, Height:=50
 End With
End Sub

Use CanvasItems(index), where index is the name or the index number, to return a single shape in the CanvasShapes collection. The following example sets the Line and Fill properties and vertically flips the third shape in a drawing canvas.

VBA Copy code Copy code
Sub CanvasShapeThree()
 With ActiveDocument.Shapes(1).CanvasItems(3)
 .Line.ForeColor.RGB = RGB(50, 0, 255)
 .Fill.ForeColor.RGB = RGB(50, 0, 255)
 .Flip msoFlipVertical
 End With
End Sub

Each shape is assigned a default name when it is created. For example, if you add three different shapes to a document, they might be named Rectangle 2, TextBox 3, and Oval 4. Use the Name property to reference the default name or to assign a more meaningful name to a shape.

See also

Concepts

Word Object Model Reference

Other resources

CanvasShapes Object Members


CanvasShapes Members (Word)

 Copy code hover
[image]

CanvasShapes Members (Word)
Send feedback

Published: July 16, 2012

Use the CanvasItems property of either a Shape or ShapeRange object to return a CanvasShapes collection.

Methods

Name | Description
AddCallout | Adds a borderless line callout to a drawing canvas. Returns a Shape object that represents the callout.
AddConnector | Returns a Shape object that represents a connecting line between two shapes in a drawing canvas.
AddCurve | Returns a Shape object that represents a Bézier curve in a drawing canvas.
AddLabel | Adds a text label to a drawing canvas. Returns a Shapes object that represents the text label.
AddLine | Adds a line to a drawing canvas. Returns a Shape object that represents the line and adds it to the CanvasShapes collection.
AddPicture | Adds a picture to a drawing canvas. Returns a Shape object that represents the picture and adds it to the CanvasShapes collection.
AddPolyline | Adds an open or closed polygon to a drawing canvas. Returns a Shape object that represents the polygon.
AddShape | Adds an AutoShape to a drawing canvas. Returns a Shape object that represents the AutoShape.
AddTextbox | Adds a text box to a drawing canvas. Returns a Shape object that represents the text box.
AddTextEffect | Adds a WordArt shape to a drawing canvas. Returns a Shape object that represents the WordArt.
BuildFreeform | Builds a freeform object. Returns a FreeformBuilder object that represents the freeform as it is being built. .
Item | Returns an individual Shape object in a collection.
Range | Returns a ShapeRange object.
SelectAll | Selects all the shapes in a canvas.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of canvas shapes in the specified collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified CanvasShapes object.


CanvasShapes Properties (Word)

 Copy code hover
[image]

CanvasShapes Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of canvas shapes in the specified collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified CanvasShapes object.


CanvasShapes.Application Property (Word)

 Copy code hover
[image]

CanvasShapes.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a CanvasShapes collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

CanvasShapes Collection

Other resources

CanvasShapes Object Members


CanvasShapes.Count Property (Word)

 Copy code hover
[image]

CanvasShapes.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of canvas shapes in the specified collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents a CanvasShapes collection.

Example

This example displays the number of paragraphs in the active document.

VBA Copy code Copy code
MsgBox "The active document contains " & _
 ActiveDocument.Paragraphs.Count & " paragraphs."

This example displays the number of words in the selection.

VBA Copy code Copy code
If Selection.Words.Count >= 1 And _
 Selection.Type <> wdSelectionIP Then
 MsgBox "The selection contains " & Selection.Words.Count _
 & " words."
End If

This example uses the aFields() array to store the field codes in the active document.

VBA Copy code Copy code
fcount = ActiveDocument.Fields.Count
If fcount >= 1 Then
 ReDim aFields(fcount)
 For Each aField In ActiveDocument.Fields
 aFields(aField.Index) = aField.Code.Text
 Next aField
End If

See also

Concepts

CanvasShapes Collection

Other resources

CanvasShapes Object Members


CanvasShapes.Creator Property (Word)

 Copy code hover
[image]

CanvasShapes.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a CanvasShapes collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

CanvasShapes Collection

Other resources

CanvasShapes Object Members


CanvasShapes.Parent Property (Word)

 Copy code hover
[image]

CanvasShapes.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified CanvasShapes object.

Syntax

expression .Parent

expression Required. A variable that represents a CanvasShapes collection.

See also

Concepts

CanvasShapes Collection

Other resources

CanvasShapes Object Members


CanvasShapes Methods (Word)

 Copy code hover
[image]

CanvasShapes Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
AddCallout | Adds a borderless line callout to a drawing canvas. Returns a Shape object that represents the callout.
AddConnector | Returns a Shape object that represents a connecting line between two shapes in a drawing canvas.
AddCurve | Returns a Shape object that represents a Bézier curve in a drawing canvas.
AddLabel | Adds a text label to a drawing canvas. Returns a Shapes object that represents the text label.
AddLine | Adds a line to a drawing canvas. Returns a Shape object that represents the line and adds it to the CanvasShapes collection.
AddPicture | Adds a picture to a drawing canvas. Returns a Shape object that represents the picture and adds it to the CanvasShapes collection.
AddPolyline | Adds an open or closed polygon to a drawing canvas. Returns a Shape object that represents the polygon.
AddShape | Adds an AutoShape to a drawing canvas. Returns a Shape object that represents the AutoShape.
AddTextbox | Adds a text box to a drawing canvas. Returns a Shape object that represents the text box.
AddTextEffect | Adds a WordArt shape to a drawing canvas. Returns a Shape object that represents the WordArt.
BuildFreeform | Builds a freeform object. Returns a FreeformBuilder object that represents the freeform as it is being built. .
Item | Returns an individual Shape object in a collection.
Range | Returns a ShapeRange object.
SelectAll | Selects all the shapes in a canvas.


CanvasShapes.AddCallout Method (Word)

 Copy code hover
[image]

CanvasShapes.AddCallout Method (Word)
See also Send feedback

Published: July 16, 2012

Adds a borderless line callout to a drawing canvas. Returns a Shape object that represents the callout.

Syntax

expression .AddCallout(Type, Left, Top, Width, Height)

expression Required. A variable that represents a CanvasShapes collection.

Parameters

Name | Required/Optional | Data Type | Description
Type | Required | MsoCallout | The type of callout.
Left | Required | Single | The position, in points, of the left edge of the callout's bounding box.
Top | Required | Single | The position, in points, of the top edge of the callout's bounding box.
Width | Required | Single | The width, in points, of the callout's bounding box.
Height | Required | Single | The height, in points, of the callout's bounding box.

Remarks

You can insert a greater variety of callouts, such as balloons and clouds, using the AddShape method.

Example

This example adds a callout to a newly created drawing canvas.

VBA Copy code Copy code
Sub NewCanvasCallout()
 Dim shpCanvas As Shape

 'Add drawing canvas to the active document
 Set shpCanvas = ActiveDocument.Shapes.AddCanvas _
 (Left:=150, Top:=150, Width:=200, Height:=300)

 'Add callout to the drawing canvas
 shpCanvas.CanvasItems.AddCallout _
 Type:=msoCalloutTwo, Left:=100, _
 Top:=40, Width:=150, Height:=75
End Sub

See also

Concepts

CanvasShapes Collection

Other resources

CanvasShapes Object Members


CanvasShapes.AddConnector Method (Word)

 Copy code hover
[image]

CanvasShapes.AddConnector Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a Shape object that represents a connecting line between two shapes in a drawing canvas.

Syntax

expression .AddConnector(Type, BeginX, BeginY, EndX, EndY)

expression Required. A variable that represents a CanvasShapes collection.

Parameters

Name | Required/Optional | Data Type | Description
Type | Required | MsoConnectorType | The type of connector.
BeginX | Required | Single | The horizontal position that marks the beginning of the connector.
BeginY | Required | Single | The vertical position that marks the beginning of the connector.
EndX | Required | Single | The horizontal position that marks the end of the connector.
EndY | Required | Single | The vertical position that marks the end of the connector.

Example

The following example adds a straight connector to a new canvas in a new document.

VBA Copy code Copy code
Sub AddCanvasConnector()

 Dim docNew As Document
 Dim shpCanvas As Shape

 Set docNew = Documents.Add

 'Add drawing canvas to new document
 Set shpCanvas = docNew.Shapes.AddCanvas( _
 Left:=150, Top:=150, Width:=200, Height:=300)

 'Add connector to the drawing canvas
 shpCanvas.CanvasItems.AddConnector _
 Type:=msoConnectorStraight, BeginX:=150, _
 BeginY:=150, EndX:=200, EndY:=200

End Sub

See also

Concepts

CanvasShapes Collection

Other resources

CanvasShapes Object Members


CanvasShapes.AddCurve Method (Word)

 Copy code hover
[image]

CanvasShapes.AddCurve Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a Shape object that represents a Bézier curve in a drawing canvas.

Syntax

expression .AddCurve(SafeArrayOfPoints)

expression Required. A variable that represents a CanvasShapes collection.

Parameters

Name | Required/Optional | Data Type | Description
SafeArrayOfPoints | Required | Variant | An array of coordinate pairs that specifies the vertices and control points of the curve. The first point you specify is the starting vertex, and the next two points are control points for the first Bézier segment. Then, for each additional segment of the curve, you specify a vertex and two control points. The last point you specify is the ending vertex for the curve. Note that you must always specify 3n + 1 points, where n is the number of segments in the curve.

Example

This example adds a Bézier curve to a new drawing canvas.

VBA Copy code Copy code
Sub CanvasBezier()

 Dim docNew As Document
 Dim shpCanvas As Shape
 Dim sngArray(1 To 7, 1 To 2) As Single

 Set docNew = Documents.Add

 'Create a new drawing canvas
 Set shpCanvas = docNew.Shapes.AddCanvas(Left:=100, _
 Top:=100, Width:=300, Height:=50)

 sngArray(1, 1) = 0
 sngArray(1, 2) = 0
 sngArray(2, 1) = 50
 sngArray(2, 2) = 50
 sngArray(3, 1) = 100
 sngArray(3, 2) = 0
 sngArray(4, 1) = 150
 sngArray(4, 2) = 50
 sngArray(5, 1) = 200
 sngArray(5, 2) = 0
 sngArray(6, 1) = 250
 sngArray(6, 2) = 50
 sngArray(7, 1) = 300
 sngArray(7, 2) = 0

 'Add Bezier curve to drawing canvas
 shpCanvas.CanvasItems.AddCurve _
 SafeArrayOfPoints:=sngArray

End Sub

See also

Concepts

CanvasShapes Collection

Other resources

CanvasShapes Object Members


CanvasShapes.AddLabel Method (Word)

 Copy code hover
[image]

CanvasShapes.AddLabel Method (Word)
See also Send feedback

Published: July 16, 2012

Adds a text label to a drawing canvas. Returns a Shapes object that represents the text label.

Syntax

expression .AddLabel(Orientation, Left, Top, Width, Height)

expression Required. A variable that represents a CanvasShapes collection.

Parameters

Name | Required/Optional | Data Type | Description
Orientation | Required | MsoText | The orientation of the text.
Left | Required | Single | The position, measured in points, of the left edge of the label relative to the left edge of the drawing canvas.
Top | Required | Single | The position, measured in points, of the top edge of the label relative to the top edge of the drawing canvas.
Width | Required | Single | The width of the label, in points.
Height | Required | Single | The height of the label, in points.

Example

This example adds a blue text label with the text "Hello World" to a new drawing canvas in the active document.

VBA Copy code Copy code
Sub NewCanvasTextLabel()
 Dim shpCanvas As Shape
 Dim shpLabel As Shape

 'Add a drawing canvas to the active document
 Set shpCanvas = ActiveDocument.Shapes.AddCanvas _
 (Left:=100, Top:=75, Width:=150, Height:=200)

 'Add a label to the drawing canvas
 Set
VBA Copy code Copy code
shpLabel = shpCanvas.CanvasItems.AddLabel _
 (Orientation:=msoTextOrientationHorizontal, _
 Left:=15, Top:=15, Width:=100, Height:=100)

 'Fill the label textbox with a color,
 'add text to the label and format it
 With
VBA Copy code Copy code
shpLabel
 With .Fill
 .BackColor.RGB = RGB(Red:=0, Green:=0, Blue:=192)
 'Make the fill visible
 .Visible = msoTrue
 End With
 With .TextFrame.TextRange
 .Text = "Hello World."
 .Bold = True
 .Font.Name = "Tahoma"
 End With
 End With
End Sub

See also

Concepts

CanvasShapes Collection

Other resources

CanvasShapes Object Members


CanvasShapes.AddLine Method (Word)

 Copy code hover
[image]

CanvasShapes.AddLine Method (Word)
See also Send feedback

Published: July 16, 2012

Adds a line to a drawing canvas. Returns a Shape object that represents the line and adds it to the CanvasShapes collection.

Syntax

expression .AddLine(BeginX, BeginY, EndX, EndY)

expression Required. A variable that represents a CanvasShapes collection.

Parameters

Name | Required/Optional | Data Type | Description
BeginX | Required | Single | The horizontal position, measured in points, of the line's starting point, relative to the drawing canvas.
BeginY | Required | Single | The vertical position, measured in points, of the line's starting point, relative to the drawing canvas.
EndX | Required | Single | The horizontal position, measured in points, of the line's endpoint, relative to the drawing canvas.
EndY | Required | Single | The vertical position, measured in points, of the line's endpoint, relative to the drawing canvas.

Remarks

To create an arrow, use the Line property to format a line.

Example

This example adds a purple line with an arrow to a new drawing canvas.

VBA Copy code Copy code
Sub NewCanvasLine()
 Dim shpCanvas As Shape
 Dim shpLine As Shape

 'Add new drawing canvas to the active document
 Set shpCanvas = ActiveDocument.Shapes _
 .AddCanvas(Left:=100, Top:=75, _
 Width:=150, Height:=200)

 'Add a line to the drawing canvas
 Set shpLine = shpCanvas.CanvasItems.AddLine( _
 BeginX:=25, BeginY:=25, EndX:=150, EndY:=150)

 'Add an arrow to the line and sets the color to purple
 With shpLine.Line
 .BeginArrowheadStyle = msoArrowheadDiamond
 .BeginArrowheadWidth = msoArrowheadWide
 .ForeColor.RGB = RGB(Red:=150, Green:=0, Blue:=255)
 End With
End Sub

See also

Concepts

CanvasShapes Collection

Other resources

CanvasShapes Object Members


CanvasShapes.AddPicture Method (Word)

 Copy code hover
[image]

CanvasShapes.AddPicture Method (Word)
See also Send feedback

Published: July 16, 2012

Adds a picture to a drawing canvas. Returns a Shape object that represents the picture and adds it to the CanvasShapes collection.

Syntax

expression .AddPicture(FileName, LinkToFile, SaveWithDocument, Left, Top, Width, Height)

expression Required. A variable that represents a CanvasShapes collection.

Parameters

Name | Required/Optional | Data Type | Description
FileName | Required | String | The path and file name of the picture.
LinkToFile | Optional | Variant | True to link the picture to the file from which it was created. False to make the picture an independent copy of the file. The default value is False.
SaveWithDocument | Optional | Variant | True to save the linked picture with the document. The default value is False.
Left | Optional | Variant | The position, measured in points, of the left edge of the new picture relative to the drawing canvas.
Top | Optional | Variant | The position, measured in points, of the top edge of the new picture relative to the drawing canvas.
Width | Optional | Variant | The width of the picture, in points.
Height | Optional | Variant | The height of the picture, in points.

Example

This example adds a picture to a newly created drawing canvas in the active document.

VBA Copy code Copy code
Sub NewCanvasPicture()
 Dim shpCanvas As Shape

 'Add a drawing canvas to the active document
 Set shpCanvas = ActiveDocument.Shapes _
 .AddCanvas(Left:=100, Top:=75, _
 Width:=200, Height:=300)

 'Add a graphic to the drawing canvas
 shpCanvas.CanvasItems.AddPicture _
 FileName:="C:\Program Files\Microsoft Office\" & _
 "Office\Bitmaps\Styles\stone.bmp", _
 LinkToFile:=False, SaveWithDocument:=True
End Sub

See also

Concepts

CanvasShapes Collection

Other resources

CanvasShapes Object Members


CanvasShapes.AddPolyline Method (Word)

 Copy code hover
[image]

CanvasShapes.AddPolyline Method (Word)
See also Send feedback

Published: July 16, 2012

Adds an open or closed polygon to a drawing canvas. Returns a Shape object that represents the polygon.

Syntax

expression .AddPolyline(SafeArrayOfPoints)

expression Required. A variable that represents a CanvasShapes collection.

Parameters

Name | Required/Optional | Data Type | Description
SafeArrayOfPoints | Required | Variant | An array of coordinate pairs that specifies the polyline drawing's vertices.

Remarks

To form a closed polygon, assign the same coordinates to the first and last vertices in the polyline drawing.

Example

This example creates a V-shaped open polyline in a new drawing canvas.

VBA Copy code Copy code
Sub NewCanvasPolyline()
 Dim docNew As Document
 Dim shpCanvas As Shape
 Dim sngArray(1 To 3, 1 To 2) As Single

 'Creates a new document and adds a drawing canvas
 Set docNew = Documents.Add
 Set shpCanvas = docNew.Shapes.AddCanvas( _
 Left:=100, Top:=75, Width:=200, Height:=300)

 'Sets the coordinates of the array
 sngArray(1, 1) = 100
 sngArray(1, 2) = 75
 sngArray(2, 1) = 150
 sngArray(2, 2) = 100
 sngArray(3, 1) = 100
 sngArray(3, 2) = 125

 'Adds a V-shaped open polyline to the drawing canvas
 shpCanvas.CanvasItems.AddPolyline SafeArrayOfPoints:=sngArray
End Sub

See also

Concepts

CanvasShapes Collection

Other resources

CanvasShapes Object Members


CanvasShapes.AddShape Method (Word)

 Copy code hover
[image]

CanvasShapes.AddShape Method (Word)
See also Send feedback

Published: July 16, 2012

Adds an AutoShape to a drawing canvas. Returns a Shape object that represents the AutoShape.

Syntax

expression .AddShape(Type, Left, Top, Width, Height)

expression Required. A variable that represents a CanvasShapes collection.

Parameters

Name | Required/Optional | Data Type | Description
Type | Required | Long | The type of shape to be returned. Can be any MsoAutoShape constant.
Left | Required | Single | The position, measured in points, of the left edge of the AutoShape.
Top | Required | Single | The position, measured in points, of the top edge of the AutoShape.
Width | Required | Single | The width, measured in points, of the AutoShape.
Height | Required | Single | The height, measured in points, of the AutoShape.

Remarks

To change the type of an AutoShape that you've added, set the AutoShapeType property.

Example

This example creates a new canvas in the active document and adds a circle to the canvas.

VBA Copy code Copy code
Sub NewCanvasShape()
 Dim shpCanvas As Shape
 Dim shpCanvasShape As Shape

 'Add a new drawing canvas to the active document
 Set shpCanvas = ActiveDocument.Shapes.AddCanvas( _
 Left:=100, Top:=75, Width:=150, Height:=200)

 'Add a circle to the drawing canvas
 Set shpCanvasShape = shpCanvas.CanvasItems.AddShape( _
 Type:=msoShapeOval, Left:=25, Top:=25, _
 Width:=150, Height:=150)
End Sub

See also

Concepts

CanvasShapes Collection

Other resources

CanvasShapes Object Members


CanvasShapes.AddTextbox Method (Word)

 Copy code hover
[image]

CanvasShapes.AddTextbox Method (Word)
See also Send feedback

Published: July 16, 2012

Adds a text box to a drawing canvas. Returns a Shape object that represents the text box.

Syntax

expression .AddTextbox(Orientation, Left, Top, Width, Height)

expression Required. A variable that represents a CanvasShapes collection.

Parameters

Name | Required/Optional | Data Type | Description
Orientation | Required | MsoTextOrientation | The orientation of the text. Some of the MsoTextOrientation constants may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.
Left | Required | Single | The position, measured in points, of the left edge of the text box.
Top | Required | Single | The position, measured in points, of the top edge of the text box.
Width | Required | Single | The width, measured in points, of the text box.
Height | Required | Single | The height, measured in points, of the text box.

Example

This example add a textbox to a canvas in a new document.

VBA Copy code Copy code
Sub NewCanvasTextbox()
 Dim docNew As Document
 Dim shpCanvas As Shape

 'Create a new document and add a drawing canvas
 Set docNew = Documents.Add
 Set shpCanvas = docNew.Shapes.AddCanvas _
 (Left:=100, Top:=75, Width:=150, Height:=200)

 'Add a text box to the drawing canvas
 shpCanvas.CanvasItems.AddTextbox _
 Orientation:=msoTextOrientationHorizontal, _
 Left:=1, Top:=1, Width:=100, Height:=100
End Sub

See also

Concepts

CanvasShapes Collection

Other resources

CanvasShapes Object Members


CanvasShapes.AddTextEffect Method (Word)

 Copy code hover
[image]

CanvasShapes.AddTextEffect Method (Word)
See also Send feedback

Published: July 16, 2012

Adds a WordArt shape to a drawing canvas. Returns a Shape object that represents the WordArt.

Syntax

expression .AddTextEffect(PresetTextEffect, Text, FontName, FontSize, FontBold, FontItalic, Left, Top)

expression Required. A variable that represents a CanvasShapes collection.

Parameters

Name | Required/Optional | Data Type | Description
PresetTextEffect | Required | Mso | A preset text effect. The values of the MsoPresetTextEffect constants correspond to the formats listed in the WordArt Gallery dialog box (numbered from left to right and from top to bottom).
Text | Required | String | The text in the WordArt.
FontName | Required | String | The name of the font used in the WordArt.
FontSize | Required | Single | The size (in points) of the font used in the WordArt.
FontBold | Required | MsoTriState | msoTrue to bold the WordArt font. msoFalse to set the font used in the WordArt to regular.
FontItalic | Required | MsoTriState | msoTrue to italicize the WordArt font. msoFalse to set the font used in the WordArt to regular.
Left | Required | Single | The position, measured in points, of the left edge of the WordArt shape relative to the left edge of the drawing canvas.
Top | Required | Single | The position, measured in points, of the top edge of the WordArt shape relative to the top edge of the drawing canvas.

Remarks

When you add WordArt to a document, the height and width of the WordArt are automatically set based on the size and amount of text you specify.

Example

This example adds a drawing canvas to a new document and inserts a WordArt shape inside the canvas that contains the text "Hello, World."

VBA Copy code Copy code
Sub NewCanvasTextEffect()
 Dim docNew As Document
 Dim shpCanvas As Shape

 'Create a new document and add a drawing canvas
 Set docNew = Documents.Add
 Set shpCanvas = docNew.Shapes.AddCanvas( _
 Left:=100, Top:=100, Width:=150, _
 Height:=50)

 'Add WordArt shape to the drawing canvas
 shpCanvas.CanvasItems.AddTextEffect _
 PresetTextEffect:=msoTextEffect20, _
 Text:="Hello, World", FontName:="Tahoma", _
 FontSize:=15, FontBold:=msoTrue, _
 FontItalic:=msoFalse, _
 Left:=120, Top:=120
End Sub

See also

Concepts

CanvasShapes Collection

Other resources

CanvasShapes Object Members


CanvasShapes.BuildFreeform Method (Word)

 Copy code hover
[image]

CanvasShapes.BuildFreeform Method (Word)
See also Send feedback

Published: July 16, 2012

Builds a freeform object. Returns a FreeformBuilder object that represents the freeform as it is being built. .

Syntax

expression .BuildFreeform(EditingType, X1, Y1)

expression Required. A variable that represents a CanvasShapes object.

Parameters

Name | Required/Optional | Data Type | Description
EditingType | Required | MsoEditingType | The EditingType parameter can be either msoEditingAuto or msoEditingCorner; cannot be msoEditingSmooth or msoEditingSymmetric.
X1 | Required | Single | The position (in points) of the first node in the freeform drawing relative to the left edge of the document.
Y1 | Required | Single | The position (in points) of the first node in the freeform drawing relative to the top of the document.

Remarks

Use the AddNodes method to add segments to the freeform. After you have added at least one segment to the freeform, you can use the ConvertToShape method to convert the FreeformBuilder object into a Shape object that has the geometric description you've defined in the FreeformBuilder object.

Example

This example adds a freeform with five vertices to the active document.

VBA Copy code Copy code
Dim docActive As Document

Set docActive = ActiveDocument
With docActive.Shapes.BuildFreeform(msoEditingCorner, 360, 200)
 .AddNodes msoSegmentCurve, msoEditingCorner, _
 380, 230, 400, 250, 450, 300
 .AddNodes msoSegmentCurve, msoEditingAuto, 480, 200
 .AddNodes msoSegmentLine, msoEditingAuto, 480, 400
 .AddNodes msoSegmentLine, msoEditingAuto, 360, 200
 .ConvertToShape
End With

See also

Concepts

CanvasShapes Collection

Other resources

CanvasShapes Object Members


CanvasShapes.Item Method (Word)

 Copy code hover
[image]

CanvasShapes.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual Shape object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents a CanvasShapes collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The individual object to be returned. Can be a Long indicating the ordinal position or a String representing the name of the individual object.

Return Value

Shape

See also

Concepts

CanvasShapes Collection

Other resources

CanvasShapes Object Members


CanvasShapes.Range Method (Word)

 Copy code hover
[image]

CanvasShapes.Range Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a ShapeRange object.

Syntax

expression .Range(Index)

expression Required. A variable that represents a CanvasShapes collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | Specifies which shapes are to be included in the specified range. Can be an integer that specifies the index number of a shape within the Shapes collection, a string that specifies the name of a shape, or a array that contains integers or strings.

Return Value

ShapeRange

Remarks

Character position values begin with 0 (zero) at the beginning of the document. All characters are counted, including nonprinting characters. Hidden characters are counted even if they're not displayed.

ShapeRange objects don't include InlineShape objects. An InlineShape object is equivalent to a character and is positioned as a character within a range of text. Shape objects are anchored to a range of text (the selection, by default), but they can be positioned anywhere on the page. A Shape object will always appear on the same page as the range it is anchored to.

Most operations that you can do with a Shape object you can also do with a ShapeRange object that contains a single shape. Some operations, when performed on a ShapeRange object that contains multiple shapes, produce an error.

Example

This example selects and deletes the shapes in the first shape in the active document. This example assumes that the first shape is a canvas shape.

VBA Copy code Copy code
Sub CanvasShapeRange()
 Dim rngCanvasShapes As Range
 Set rngCanvasShapes = ActiveDocument.Shapes(1).CanvasItems.Range(1)
 rngCanvasShapes.Select
 rngCanvasShapes.Delete
End Sub

See also

Concepts

CanvasShapes Collection

Other resources

CanvasShapes Object Members


CanvasShapes.SelectAll Method (Word)

 Copy code hover
[image]

CanvasShapes.SelectAll Method (Word)
See also Send feedback

Published: July 16, 2012

Selects all the shapes in a canvas.

Syntax

expression .SelectAll

expression Required. A variable that represents a CanvasShapes collection.

Remarks

This method doesn't select InlineShape objects.

Example

This example selects and deletes all the shapes inside the first canvas of the active document.

VBA Copy code Copy code
Sub SelectCanvasShapes()
 Dim s As Shape
 Set s = ActiveDocument.Shapes.Range(1)
 s.CanvasItems.SelectAll
 Selection.Delete
End Sub

See also

Concepts

CanvasShapes Collection

Other resources

CanvasShapes Object Members


CaptionLabel Object (Word)

 Copy code hover
[image]

CaptionLabel Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a single caption label. The CaptionLabel object is a member of the CaptionLabels collection. The items in the CaptionLabels collection are listed in the Label box in the Caption dialog box.

Remarks

Use CaptionLabels(index), where index is the caption label name or index number, to return a single CaptionLabel object. The following example sets the numbering style for the Figure caption label.

VBA Copy code Copy code
CaptionLabels("Figure").NumberStyle = _
 wdCaptionNumberStyleLowercaseLetter

The index number represents the position of the caption label in the CaptionLabels collection. The following example displays the first caption label.

VBA Copy code Copy code
MsgBox CaptionLabels(1).Name

Use the Add method to add a custom caption label. The following example adds a caption label named "Photo."

VBA Copy code Copy code
CaptionLabels.Add Name:="Photo"

See also

Concepts

Word Object Model Reference

Other resources

CaptionLabel Object Members


CaptionLabel Members (Word)

 Copy code hover
[image]

CaptionLabel Members (Word)
Send feedback

Published: July 16, 2012

Represents a single caption label. The CaptionLabel object is a member of the CaptionLabels collection. The items in the CaptionLabels collection are listed in the Label box in the Caption dialog box.

Methods

Name | Description
Delete | Deletes the specified caption label.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
BuiltIn | True if the specified caption label is one of the built-in caption labels in Word. Read-only Boolean.
ChapterStyleLevel | Returns or sets the heading style that marks a new chapter when chapter numbers are included with the specified caption label. Read/write Long.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
ID | Returns a WdCaptionLabelID constant that represents the type for the specified caption label if the BuiltIn property of the CaptionLabel object is True. Read-only.
IncludeChapterNumber | True if a chapter number is included with page numbers or a caption label. Read/write Boolean.
Name | Returns the name of the specified object. Read-only String.
NumberStyle | Returns or sets the number style for the CaptionLabel object. Read/write WdCaptionNumberStyle.
Parent | Returns an Object that represents the parent object of the specified CaptionLabel object.
Position | Returns or sets the position of caption label text. Read/write WdCaptionPosition.
Separator | Returns or sets the character between the chapter number and the sequence number. Read/write WdSeparatorType.


CaptionLabel Properties (Word)

 Copy code hover
[image]

CaptionLabel Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
BuiltIn | True if the specified caption label is one of the built-in caption labels in Word. Read-only Boolean.
ChapterStyleLevel | Returns or sets the heading style that marks a new chapter when chapter numbers are included with the specified caption label. Read/write Long.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
ID | Returns a WdCaptionLabelID constant that represents the type for the specified caption label if the BuiltIn property of the CaptionLabel object is True. Read-only.
IncludeChapterNumber | True if a chapter number is included with page numbers or a caption label. Read/write Boolean.
Name | Returns the name of the specified object. Read-only String.
NumberStyle | Returns or sets the number style for the CaptionLabel object. Read/write WdCaptionNumberStyle.
Parent | Returns an Object that represents the parent object of the specified CaptionLabel object.
Position | Returns or sets the position of caption label text. Read/write WdCaptionPosition.
Separator | Returns or sets the character between the chapter number and the sequence number. Read/write WdSeparatorType.


CaptionLabel.Application Property (Word)

 Copy code hover
[image]

CaptionLabel.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a CaptionLabel object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

CaptionLabel Object

Other resources

CaptionLabel Object Members


CaptionLabel.BuiltIn Property (Word)

 Copy code hover
[image]

CaptionLabel.BuiltIn Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified caption label is one of the built-in caption labels in Word. Read-only Boolean.

Syntax

expression .BuiltIn

expression A variable that represents a CaptionLabel object.

Remarks

You can specify built-in styles across all languages by using the WdBuiltinStyle constants or within a language by using the style name for the language version of Word. For example, if you specify U.S. English in your Microsoft Office language settings, the following statements are equivalent:

VBA Copy code Copy code
ActiveDocument.Styles(wdStyleHeading1)
ActiveDocument.Styles("Heading 1")

Example

This example checks all the styles in the active document. When it finds a style that isn't built in, it displays the name of the style.

VBA Copy code Copy code
Dim styleLoop As Style

For Each styleLoop in ActiveDocument.Styles
 If styleLoop.BuiltIn = False Then
 Msgbox styleLoop.NameLocal
 End If
Next styleLoop

This example checks all the caption labels that have been created in the application. When it finds a caption label that isn't built in, it displays the name of the label.

VBA Copy code Copy code
Dim clLoop As CaptionLabel

For Each clLoop in CaptionLabels
 If clLoop.BuiltIn = False Then
 Msgbox clLoop.Name
 End If
Next clLoop

See also

Concepts

CaptionLabel Object

Other resources

CaptionLabel Object Members


CaptionLabel.ChapterStyleLevel Property (Word)

 Copy code hover
[image]

CaptionLabel.ChapterStyleLevel Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the heading style that marks a new chapter when chapter numbers are included with the specified caption label. Read/write Long.

Syntax

expression .ChapterStyleLevel

expression A variable that represents a CaptionLabel object.

Remarks

The number 1 corresponds to Heading 1, 2 corresponds to Heading 2, and so on. The IncludeChapterNumber property must be set to True for chapter numbers to be included with caption labels.

Example

This example formats the table's caption label to include a chapter number. The chapter number is taken from paragraphs formatted with the Heading 2 style.

VBA Copy code Copy code
With CaptionLabels(wdCaptionTable)
 .IncludeChapterNumber = True
 .ChapterStyleLevel = 2
End With

See also

Concepts

CaptionLabel Object

Other resources

CaptionLabel Object Members


CaptionLabel.Creator Property (Word)

 Copy code hover
[image]

CaptionLabel.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a CaptionLabel object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

CaptionLabel Object

Other resources

CaptionLabel Object Members


CaptionLabel.ID Property (Word)

 Copy code hover
[image]

CaptionLabel.ID Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a WdCaptionLabelID constant that represents the type for the specified caption label if the BuiltIn property of the CaptionLabel object is True. Read-only.

Syntax

expression .ID

expression Required. A variable that represents a CaptionLabel object.

Example

This example displays the built-in caption label names and ID values.

VBA Copy code Copy code
For Each cl In CaptionLabels
 If cl.BuiltIn = True Then MsgBox cl.Name & " " & cl.ID
Next cl

See also

Concepts

CaptionLabel Object

Other resources

CaptionLabel Object Members


CaptionLabel.IncludeChapterNumber Property (Word)

 Copy code hover
[image]

CaptionLabel.IncludeChapterNumber Property (Word)
See also Send feedback

Published: July 16, 2012

True if a chapter number is included with page numbers or a caption label. Read/write Boolean.

Syntax

expression .IncludeChapterNumber

expression Required. A variable that represents a CaptionLabel object.

Example

This example adds the chapter number from the Heading 2 style to figure captions, sets the caption numbering style, and then inserts a new figure caption. The document should already contain a Heading 2 style with numbering.

VBA Copy code Copy code
With CaptionLabels(wdCaptionFigure)
 .IncludeChapterNumber = True
 .ChapterStyleLevel = 2
 .NumberStyle = wdCaptionNumberStyleUppercaseLetter
End With
Selection.InsertCaption Label:="Figure", Title:=": History"

See also

Concepts

CaptionLabel Object

Other resources

CaptionLabel Object Members


CaptionLabel.Name Property (Word)

 Copy code hover
[image]

CaptionLabel.Name Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the name of the specified object. Read-only String.

Syntax

expression .Name

expression Required. A variable that represents a CaptionLabel object.

See also

Concepts

CaptionLabel Object

Other resources

CaptionLabel Object Members


CaptionLabel.NumberStyle Property (Word)

 Copy code hover
[image]

CaptionLabel.NumberStyle Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the number style for the CaptionLabel object. Read/write WdCaptionNumberStyle.

Syntax

expression .NumberStyle

expression Required. A variable that represents a CaptionLabel object.

Remarks

Some of the constants listed above may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.

Example

This example inserts a caption at the insertion point. The caption letter is formatted as an uppercase letter.

VBA Copy code Copy code
CaptionLabels(wdCaptionFigure).NumberStyle = _
 wdCaptionNumberStyleUppercaseLetter
Selection.Collapse Direction:=wdCollapseEnd
Selection.InsertCaption Label:=wdCaptionFigure

See also

Concepts

CaptionLabel Object

Other resources

CaptionLabel Object Members


CaptionLabel.Parent Property (Word)

 Copy code hover
[image]

CaptionLabel.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified CaptionLabel object.

Syntax

expression .Parent

expression Required. A variable that represents a CaptionLabel object.

See also

Concepts

CaptionLabel Object

Other resources

CaptionLabel Object Members


CaptionLabel.Position Property (Word)

 Copy code hover
[image]

CaptionLabel.Position Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the position of caption label text. Read/write WdCaptionPosition.

Syntax

expression .Position

expression Required. A variable that represents a CaptionLabel object.

See also

Concepts

CaptionLabel Object

Other resources

CaptionLabel Object Members


CaptionLabel.Separator Property (Word)

 Copy code hover
[image]

CaptionLabel.Separator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the character between the chapter number and the sequence number. Read/write WdSeparatorType.

Syntax

expression .Separator

expression Required. A variable that represents a CaptionLabel object.

Example

This example inserts a Figure caption that has a colon (:) between the chapter number and the sequence number.

VBA Copy code Copy code
With CaptionLabels("Figure")
 .Separator = wdSeparatorColon
 .IncludeChapterNumber = True
End With
Selection.InsertCaption "Figure"

See also

Concepts

CaptionLabel Object

Other resources

CaptionLabel Object Members


CaptionLabel Methods (Word)

 Copy code hover
[image]

CaptionLabel Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the specified caption label.


CaptionLabel.Delete Method (Word)

 Copy code hover
[image]

CaptionLabel.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the specified caption label.

Syntax

expression .Delete

expression Required. A variable that represents a CaptionLabel object.

See also

Concepts

CaptionLabel Object

Other resources

CaptionLabel Object Members


CaptionLabels Object (Word)

 Copy code hover
[image]

CaptionLabels Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of CaptionLabel objects that represent the available caption labels. The items in the CaptionLabels collection are listed in the Label box in the Caption dialog box.

Remarks

Use the CaptionLabels property to return the CaptionLabels collection. By default, the CaptionLabels collection includes the three built-in caption labels: Figure, Table, and Equation.

Use the Add method to add a custom caption label. The following example adds a caption label named "Photo."

VBA Copy code Copy code
CaptionLabels.Add Name:="Photo"

Use CaptionLabels(index), where index is the caption label name or index number, to return a single CaptionLabel object. The following example sets the numbering style for the Figure caption label.

VBA Copy code Copy code
CaptionLabels("Figure").NumberStyle = _
 wdCaptionNumberStyleLowercaseLetter

The index number represents the position of the caption label in the CaptionLabels collection. The following example displays the first caption label.

VBA Copy code Copy code
MsgBox CaptionLabels(1).Name

See also

Concepts

Word Object Model Reference

Other resources

CaptionLabels Object Members


CaptionLabels Members (Word)

 Copy code hover
[image]

CaptionLabels Members (Word)
Send feedback

Published: July 16, 2012

A collection of CaptionLabel objects that represent the available caption labels. The items in the CaptionLabels collection are listed in the Label box in the Caption dialog box.

Methods

Name | Description
Add | Returns a CaptionLabel object that represents a custom caption label.
Item | Returns an individual CaptionLabel object in a collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of caption labels in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified CaptionLabels object.


CaptionLabels Properties (Word)

 Copy code hover
[image]

CaptionLabels Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of caption labels in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified CaptionLabels object.


CaptionLabels.Application Property (Word)

 Copy code hover
[image]

CaptionLabels.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a CaptionLabels collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

CaptionLabels Collection Object

Other resources

CaptionLabels Object Members


CaptionLabels.Count Property (Word)

 Copy code hover
[image]

CaptionLabels.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of caption labels in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents a CaptionLabels collection.

See also

Concepts

CaptionLabels Collection Object

Other resources

CaptionLabels Object Members


CaptionLabels.Creator Property (Word)

 Copy code hover
[image]

CaptionLabels.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a CaptionLabels collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

CaptionLabels Collection Object

Other resources

CaptionLabels Object Members


CaptionLabels.Parent Property (Word)

 Copy code hover
[image]

CaptionLabels.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified CaptionLabels object.

Syntax

expression .Parent

expression Required. A variable that represents a CaptionLabels collection.

See also

Concepts

CaptionLabels Collection Object

Other resources

CaptionLabels Object Members


CaptionLabels Methods (Word)

 Copy code hover
[image]

CaptionLabels Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Returns a CaptionLabel object that represents a custom caption label.
Item | Returns an individual CaptionLabel object in a collection.


CaptionLabels.Add Method (Word)

 Copy code hover
[image]

CaptionLabels.Add Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a CaptionLabel object that represents a custom caption label.

Syntax

expression .Add(Name)

expression Required. A variable that represents a CaptionLabels collection.

Parameters

Name | Required/Optional | Data Type | Description
Name | Required | String | The name of the custom caption label.

Return Value

CaptionLabel

Example

This example adds a custom caption label named Demo Slide. To verify that the custom label is added, view the Label combo box in the Caption dialog box, accessed from the Reference command on the Insert menu.

VBA Copy code Copy code
Sub CapLbl()
 CaptionLabels.Add Name:="Demo Slide"
End Sub

See also

Concepts

CaptionLabels Collection Object

Other resources

CaptionLabels Object Members


CaptionLabels.Item Method (Word)

 Copy code hover
[image]

CaptionLabels.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual CaptionLabel object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents a CaptionLabels collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The individual object to be returned. Can be a Long indicating the ordinal position or a String representing the name of the individual object.

Return Value

CaptionLabel

See also

Concepts

CaptionLabels Collection Object

Other resources

CaptionLabels Object Members


Categories Object (Word)

 Copy code hover
[image]

Categories Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a collection of building block categories.

Version Information

Version Added: Word 2007

Remarks

Use the Item method to access an exising category. You can then use the BuildingBlocks property to access a collection of BuildingBlock objects for the category. The following example prints the type and category names of all the building blocks in the first template to the Immediate Window. (This example assumes that the Immediate Window is visible.)

VBA Copy code Copy code
Dim objTemplate As Template
Dim objBBT As BuildingBlockType
Dim objCat As Category
Dim intCount As Integer
Dim intCountCat As Integer

Set objTemplate = Templates(1)

For intCount = 1 To objTemplate.BuildingBlockTypes.Count
 Set objBBT = objTemplate.BuildingBlockTypes(intCount)
 If objBBT.Categories.Count > 0 Then
 Debug.Print objBBT.Name
 For intCountCat = 1 To objBBT.Categories.Count
 Set objCat = objBBT.Categories(intCountCat)
 Debug.Print vbTab & objCat.Name
 Next
 End If
Next

Use the Item method to access an exising category; to create a new category, use the Add method of the BuildingBlockEntries collection. Set the value of the Category parameter.

For more information about building blocks, see Working with Building Blocks.

See also

Concepts

Word Object Model Reference

Other resources

Categories Object Members


Categories Members (Word)

 Copy code hover
[image]

Categories Members (Word)
Send feedback

Published: July 16, 2012

Represents a collection of building block categories.

Methods

Name | Description
Item | Returns a Category object that represents the specified item in the collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns the number of items in the Categories collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified Categories collection.


Categories Properties (Word)

 Copy code hover
[image]

Categories Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns the number of items in the Categories collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified Categories collection.


Categories.Application Property (Word)

 Copy code hover
[image]

Categories.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression A variable that represents a Categories collection.

See also

Concepts

Categories Object

Other resources

Categories Object Members


Categories.Count Property (Word)

 Copy code hover
[image]

Categories.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the number of items in the Categories collection. Read-only Long.

Syntax

expression .Count

expression A variable that represents a Categories collection.

See also

Concepts

Categories Object

Other resources

Categories Object Members


Categories.Creator Property (Word)

 Copy code hover
[image]

Categories.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a Categories collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

Categories Object

Other resources

Categories Object Members


Categories.Parent Property (Word)

 Copy code hover
[image]

Categories.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Categories collection.

Syntax

expression .Parent

expression A variable that represents a Categories collection.

See also

Concepts

Categories Object

Other resources

Categories Object Members


Categories Methods (Word)

 Copy code hover
[image]

Categories Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Item | Returns a Category object that represents the specified item in the collection.


Categories.Item Method (Word)

 Copy code hover
[image]

Categories.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a Category object that represents the specified item in the collection.

Syntax

expression .Item(Index)

expression An expression that returns a Categories object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | Specifies a String or Integer that represents the name or ordinal position of the object in the collection.

Return Value

Category

See also

Concepts

Categories Object

Other resources

Categories Object Members


Category Object (Word)

 Copy code hover
[image]

Category Object (Word)
See also Send feedback

Published: July 16, 2012

Represents an individual category of a building block type.

Version Information

Version Added: Word 2007

Remarks

Microsoft Word uses types and categories to organize building blocks. Each building block type is represented by a WdBuildingBlockTypes constant. Each category is a unique string that a user defines. Word comes with two categories already defined: "General" and "Custom"; you can create additional categories as you need.

Use the Type property to access the building block type associated with a specific category. Use the BuildingBlocks property to access the collection of building blocks for a category. The following example prints the type and category names of all the building blocks in the first template to the Immediate Window. (This example assumes that the Immediate Window is visible.)

VBA Copy code Copy code
Dim objTemplate As Template
Dim objBBT As BuildingBlockType
Dim objCat As Category
Dim intCount As Integer
Dim intCountCat As Integer

Set objTemplate = Templates(1)

For intCount = 1 To objTemplate.BuildingBlockTypes.Count
 Set objBBT = objTemplate.BuildingBlockTypes(intCount)
 If objBBT.Categories.Count > 0 Then
 Debug.Print objBBT.Name
 For intCountCat = 1 To objBBT.Categories.Count
 Set objCat = objBBT.Categories(intCountCat)
 Debug.Print vbTab & objCat.Name
 Next
 End If
Next

Use the Item method of the Categories collection to access an exising category; to create a new category, use the Add method of the BuildingBlockEntries collection. Set the value of the Category parameter.

For more information about building blocks, see Working with Building Blocks.

See also

Concepts

Word Object Model Reference

Other resources

Category Object Members


Category Members (Word)

 Copy code hover
[image]

Category Members (Word)
Send feedback

Published: July 16, 2012

Represents an individual category of a building block type.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
BuildingBlocks | Returns a BuildingBlocks collection that represents the building blocks for a category. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Index | Returns a Long that represents the position of an item in a collection. Read-only.
Name | Returns the name of the specified object. Read-only String.
Parent | Returns an Object that represents the parent object of the specified Category object.
Type | Returns a BuildingBlockType object that represents the type of building block for a building block category. Read-only.


Category Properties (Word)

 Copy code hover
[image]

Category Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
BuildingBlocks | Returns a BuildingBlocks collection that represents the building blocks for a category. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Index | Returns a Long that represents the position of an item in a collection. Read-only.
Name | Returns the name of the specified object. Read-only String.
Parent | Returns an Object that represents the parent object of the specified Category object.
Type | Returns a BuildingBlockType object that represents the type of building block for a building block category. Read-only.


Category.Application Property (Word)

 Copy code hover
[image]

Category.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression A variable that represents a Category object.

See also

Concepts

Category Object

Other resources

Category Object Members


Category.BuildingBlocks Property (Word)

 Copy code hover
[image]

Category.BuildingBlocks Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a BuildingBlocks collection that represents the building blocks for a category. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .BuildingBlocks

expression An expression that returns a Category object.

See also

Concepts

Category Object

Other resources

Category Object Members


Category.Creator Property (Word)

 Copy code hover
[image]

Category.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a Category object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

Category Object

Other resources

Category Object Members


Category.Index Property (Word)

 Copy code hover
[image]

Category.Index Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the position of an item in a collection. Read-only.

Syntax

expression .Index

expression Required. A variable that represents a Category object.

See also

Concepts

Category Object

Other resources

Category Object Members


Category.Name Property (Word)

 Copy code hover
[image]

Category.Name Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the name of the specified object. Read-only String.

Syntax

expression .Name

expression Required. A variable that represents a Category object.

See also

Concepts

Category Object

Other resources

Category Object Members


Category.Parent Property (Word)

 Copy code hover
[image]

Category.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Category object.

Syntax

expression .Parent

expression A variable that represents a Category object.

See also

Concepts

Category Object

Other resources

Category Object Members


Category.Type Property (Word)

 Copy code hover
[image]

Category.Type Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a BuildingBlockType object that represents the type of building block for a building block category. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Type

expression An expression that returns a Category object.

See also

Concepts

Category Object

Other resources

Category Object Members


CategoryCollection Object (Word)

 Copy code hover
[image]

CategoryCollection Object (Word)
See also Send feedback

Published: July 16, 2012

Represents the collection of visible chart categories in the document.

Version information

Version Added: Word 2013

Remarks

Categories are visible if they have not been filtered out of a chart.

See also

Other resources

CategoryCollection Members (Word)


CategoryCollection Members (Word)

 Copy code hover
[image]

CategoryCollection Members (Word)
Send feedback

Published: July 16, 2012

Represents the collection of visible chart categories in the document.

Methods

Name | Description
Item | Returns an individual chart category.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of categories in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified CategoryCollection object.


CategoryCollection Properties (Word)

 Copy code hover
[image]

CategoryCollection Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of categories in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified CategoryCollection object.


CategoryCollection.Application Property (Word)

 Copy code hover
[image]

CategoryCollection.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Version information

Version Added: Word 2013

Syntax

expression .Application

expression A variable that represents a CategoryCollection object.

Property value

OBJECT

See also

Other resources

CategoryCollection Object Members


CategoryCollection.Count Property (Word)

 Copy code hover
[image]

CategoryCollection.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of categories in the collection. Read-only.

Version information

Version Added: Word 2013

Syntax

expression .Count

expression A variable that represents a CategoryCollection object.

Property value

INT32

See also

Other resources

CategoryCollection Object Members


CategoryCollection.Creator Property (Word)

 Copy code hover
[image]

CategoryCollection.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version information

Version Added: Word 2013

Syntax

expression .Creator

expression A variable that represents a CategoryCollection object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

Property value

INT32

See also

Other resources

CategoryCollection Object Members
CategoryCollection Object


CategoryCollection.Parent Property (Word)

 Copy code hover
[image]

CategoryCollection.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified CategoryCollection object.

Version information

Version Added: Word 2013

Syntax

expression .Parent

expression A variable that represents a CategoryCollection object.

Property value

OBJECT

See also

Other resources

CategoryCollection Object
CategoryCollection Object Members


CategoryCollection Methods (Word)

 Copy code hover
[image]

CategoryCollection Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Item | Returns an individual chart category.


CategoryCollection.Item Method (Word)

 Copy code hover
[image]

CategoryCollection.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual chart category.

Version information

Version Added: Word 2013

Syntax

expression .Item(Index)

expression A variable that represents a CategoryCollection object.

Parameters

Name | Required/Optional | Data type | Description
Index | Required | VARIANT | The name or index number for the object.

Return value

CHARTCATEGORY

See also

Other resources

CategoryCollection Object
CategoryCollection Object Members


Cell Object (Word)

 Copy code hover
[image]

Cell Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a single table cell. The Cell object is a member of the Cells collection. The Cells collection represents all the cells in the specified object.

Remarks

Use Cell(row, column), where row is the row number and column is the column number, or Cells(index), where index is the index number, to return a Cell object. The following example applies shading to the second cell in the first row.

VBA Copy code Copy code
Set myCell = ActiveDocument.Tables(1).Cell(Row:=1, Column:=2)
myCell.Shading.Texture = wdTexture20Percent

The following example applies shading to the first cell in the first row.

VBA Copy code Copy code
ActiveDocument.Tables(1).Rows(1).Cells(1).Shading _
 .Texture = wdTexture20Percent

Use the Add method to add a Cell object to the Cells collection. You can also use the InsertCells method of the Selection object to insert new cells. The following example adds a cell before the first cell in myTable.

VBA Copy code Copy code
Set myTable = ActiveDocument.Tables(1)
myTable.Range.Cells.Add BeforeCell:=myTable.Cell(1, 1)

The following example sets a range (myRange) that references the first two cells in the first table. After the range is set, the cells are combined by the Merge method.

VBA Copy code Copy code
Set myTable = ActiveDocument.Tables(1)
Set myRange = ActiveDocument.Range(myTable.Cell(1, 1) _
 .Range.Start, myTable.Cell(1, 2).Range.End)
myRange.Cells.Merge

Remarks

Use the Add method with the Rows or Columns collection to add a row or column of cells.

Use the Information property with a Selection object to return the current row and column number. The following example changes the width of the first cell in the selection and then displays the cell's row number and column number.

VBA Copy code Copy code
If Selection.Information(wdWithInTable) = True Then
 With Selection
 .Cells(1).Width = 22
 MsgBox "Cell " & .Information(wdStartOfRangeRowNumber) _
 & "," & .Information(wdStartOfRangeColumnNumber)
 End With
End If

See also

Concepts

Word Object Model Reference

Other resources

Cell Object Members


Cell Members (Word)

 Copy code hover
[image]

Cell Members (Word)
Send feedback

Published: July 16, 2012

Represents a single table cell. The Cell object is a member of the Cells collection. The Cells collection represents all the cells in the specified object.

Methods

Name | Description
AutoSum | Inserts an = (Formula) field that calculates and displays the sum of the values in table cells above or to the left of the cell specified in the expression.
Delete | Deletes a table cell or cells and optionally controls how the remaining cells are shifted.
Formula | Inserts an = (Formula) field that contains the specified formula into a table cell.
Merge | Merges the specified table cell with another table cell. The result is a single table cell.
Select | Selects the specified object.
SetHeight | Sets the height of table cells.
SetWidth | Sets the width of columns or cells in a table.
Split | Splits a single table cell into multiple cells.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Borders | Returns a Borders collection that represents all the borders for the specified object.
BottomPadding | Returns or sets the amount of space (in points) to add below the contents of a single cell or all the cells in a table. Read/write Single.
Column | Returns a Column object that represents the table column containing the specified cell. Read-only.
ColumnIndex | Returns the number of the table column that contains the specified cell. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
FitText | True if Microsoft Word visually reduces the size of text typed into a cell so that it fits within the column width. Read/write Boolean.
Height | Returns or sets the height of the specified table cell. .
HeightRule | Returns or sets a WdRowHeightRule constant that represents the rule for determining the height of the specified cells or rows. Read/write.
ID | Returns or sets the identifying label for the specified object when the current document is saved as a Web page. Read/write String.
LeftPadding | Returns or sets the amount of space (in points) to add to the left of the contents of a single cell or all the cells in a table. Read/write Single.
NestingLevel | Returns the nesting level of the specified cell. Read-only Long.
Next | Returns a Cell object that represents the next table cell in the Cells collection. Read-only.
Parent | Returns an Object that represents the parent object of the specified Cell object.
PreferredWidth | Returns or sets the preferred width (in points or as a percentage of the window width) for the specified cell. Read/write Single.
PreferredWidthType | Returns or sets the preferred unit of measurement to use for the width of the specified cell. Read-only WdPreferredWidthType.
Previous | Returns a Cell object that represents the previous table cell in the Cells collection. Read-only.
Range | Returns a Range object that represents the portion of a document that's contained in the specified object.
RightPadding | Returns or sets the amount of space (in points) to add to the right of the contents of a single cell or all the cells in a table. Read/write Single.
Row | Returns a Row object that represents the row containing the specified cell.
RowIndex | Returns the number of the row that contains the specified cell. Read-only Long.
Shading | Returns a Shading object that refers to the shading formatting for the specified object.
Tables | Returns a Tables collection that represents all the nested tables inside the specified table cell. Read-only.
TopPadding | Returns or sets the amount of space (in points) to add above the contents of a single cell or all the cells in a table. Read/write Single.
VerticalAlignment | Returns or sets the vertical alignment of text in one or more cells of a table. Read/write WdCellVerticalAlignment.
Width | Returns or sets the width of a table cell, in points. Read/write Long.
WordWrap | True if Microsoft Word wraps text to multiple lines and lengthens the cell so that the cell width remains the same. Read/write Boolean.


Cell Properties (Word)

 Copy code hover
[image]

Cell Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Borders | Returns a Borders collection that represents all the borders for the specified object.
BottomPadding | Returns or sets the amount of space (in points) to add below the contents of a single cell or all the cells in a table. Read/write Single.
Column | Returns a Column object that represents the table column containing the specified cell. Read-only.
ColumnIndex | Returns the number of the table column that contains the specified cell. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
FitText | True if Microsoft Word visually reduces the size of text typed into a cell so that it fits within the column width. Read/write Boolean.
Height | Returns or sets the height of the specified table cell. .
HeightRule | Returns or sets a WdRowHeightRule constant that represents the rule for determining the height of the specified cells or rows. Read/write.
ID | Returns or sets the identifying label for the specified object when the current document is saved as a Web page. Read/write String.
LeftPadding | Returns or sets the amount of space (in points) to add to the left of the contents of a single cell or all the cells in a table. Read/write Single.
NestingLevel | Returns the nesting level of the specified cell. Read-only Long.
Next | Returns a Cell object that represents the next table cell in the Cells collection. Read-only.
Parent | Returns an Object that represents the parent object of the specified Cell object.
PreferredWidth | Returns or sets the preferred width (in points or as a percentage of the window width) for the specified cell. Read/write Single.
PreferredWidthType | Returns or sets the preferred unit of measurement to use for the width of the specified cell. Read-only WdPreferredWidthType.
Previous | Returns a Cell object that represents the previous table cell in the Cells collection. Read-only.
Range | Returns a Range object that represents the portion of a document that's contained in the specified object.
RightPadding | Returns or sets the amount of space (in points) to add to the right of the contents of a single cell or all the cells in a table. Read/write Single.
Row | Returns a Row object that represents the row containing the specified cell.
RowIndex | Returns the number of the row that contains the specified cell. Read-only Long.
Shading | Returns a Shading object that refers to the shading formatting for the specified object.
Tables | Returns a Tables collection that represents all the nested tables inside the specified table cell. Read-only.
TopPadding | Returns or sets the amount of space (in points) to add above the contents of a single cell or all the cells in a table. Read/write Single.
VerticalAlignment | Returns or sets the vertical alignment of text in one or more cells of a table. Read/write WdCellVerticalAlignment.
Width | Returns or sets the width of a table cell, in points. Read/write Long.
WordWrap | True if Microsoft Word wraps text to multiple lines and lengthens the cell so that the cell width remains the same. Read/write Boolean.


Cell.Application Property (Word)

 Copy code hover
[image]

Cell.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression A variable that represents a Cell object.

See also

Concepts

Cell Object

Other resources

Cell Object Members


Cell.Borders Property (Word)

 Copy code hover
[image]

Cell.Borders Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Borders collection that represents all the borders for the specified object.

Syntax

expression .Borders

expression A variable that represents a Cell object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

See also

Concepts

Cell Object

Other resources

Cell Object Members


Cell.BottomPadding Property (Word)

 Copy code hover
[image]

Cell.BottomPadding Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the amount of space (in points) to add below the contents of a single cell or all the cells in a table. Read/write Single.

Syntax

expression .BottomPadding

expression A variable that represents a Cell object.

Remarks

The setting of the BottomPadding property for a single cell overrides the setting of the BottomPadding property for the entire table.

Example

This example sets the bottom padding for the first table in the active document to 40 pixels.

VBA Copy code Copy code
ActiveDocument.Tables(1).BottomPadding = _
 PixelsToPoints(40, True)

See also

Concepts

Cell Object

Other resources

Cell Object Members


Cell.Column Property (Word)

 Copy code hover
[image]

Cell.Column Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Column object that represents the table column containing the specified cell. Read-only.

Syntax

expression .Column

expression Required. A variable that represents a Cell object.

Example

This example creates a 3x5 table and applies shading to the even-numbered columns.

VBA Copy code Copy code
Dim tableNew As Table
Dim cellLoop As Cell

Selection.Collapse Direction:=wdCollapseStart
Set tableNew = _
 ActiveDocument.Tables.Add(Range:=Selection.Range, _
 NumRows:=3, NumColumns:=5)

For Each cellLoop In tableNew.Rows(1).Cells
 If cellLoop.ColumnIndex Mod 2 = 0 Then
 cellLoop.Column.Shading.Texture = wdTexture10Percent
 End If
Next cellLoop

See also

Concepts

Cell Object

Other resources

Cell Object Members


Cell.ColumnIndex Property (Word)

 Copy code hover
[image]

Cell.ColumnIndex Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the number of the table column that contains the specified cell. Read-only Long.

Syntax

expression .ColumnIndex

expression A variable that represents a Cell object.

Example

This example creates a table in a new document, selects each cell in the first row, and returns the column number that contains the selected cell.

VBA Copy code Copy code
Dim docNew As Document
Dim tableNew As Table
Dim cellLoop As Cell

Set docNew = Documents.Add
Set tableNew = docNew.Tables.Add(Selection.Range, 3, 3)
For Each cellLoop In tableNew.Rows(1).Cells
 cellLoop.Select
 MsgBox "This is column " & cellLoop.ColumnIndex
Next cellLoop

This example returns the column number of the cell that contains the insertion point.

VBA Copy code Copy code
Msgbox Selection.Cells(1).ColumnIndex

See also

Concepts

Cell Object

Other resources

Cell Object Members


Cell.Creator Property (Word)

 Copy code hover
[image]

Cell.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a Cell object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

Cell Object

Other resources

Cell Object Members


Cell.FitText Property (Word)

 Copy code hover
[image]

Cell.FitText Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word visually reduces the size of text typed into a cell so that it fits within the column width. Read/write Boolean.

Syntax

expression .FitText

expression A variable that represents a Cell object.

Remarks

If the FitText property is set to True, the font size of the text is not changed, but the visual width of the characters is adjusted to fit all the typed text into the cell.

Example

This example sets the first cell in the selection to automatically fit typed text within its width.

VBA Copy code Copy code
Selection.Cells(1).FitText = True

See also

Concepts

Cell Object

Other resources

Cell Object Members


Cell.Height Property (Word)

 Copy code hover
[image]

Cell.Height Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the height of the specified table cell. .

Syntax

expression .Height

expression An expression that returns a Cell object.

Remarks

If the HeightRule property of the specified row is wdRowHeightAuto, Height returns wdUndefined; setting the Height property sets HeightRule to wdRowHeightAtLeast. Read/write Single.

See also

Concepts

Cell Object

Other resources

Cell Object Members


Cell.HeightRule Property (Word)

 Copy code hover
[image]

Cell.HeightRule Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a WdRowHeightRule constant that represents the rule for determining the height of the specified cells or rows. Read/write.

Syntax

expression .HeightRule

expression Required. A variable that represents a Cell object.

Remarks

Setting the HeightRule property of a Cell object automatically sets the height for the entire row.

See also

Concepts

Cell Object

Other resources

Cell Object Members


Cell.ID Property (Word)

 Copy code hover
[image]

Cell.ID Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the identifying label for the specified object when the current document is saved as a Web page. Read/write String.

Syntax

expression .ID

expression Required. A variable that represents a Cell object.

Remarks

You can use a label as a hyperlink reference from other Web pages or from within the current document.

See also

Concepts

Cell Object

Other resources

Cell Object Members


Cell.LeftPadding Property (Word)

 Copy code hover
[image]

Cell.LeftPadding Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the amount of space (in points) to add to the left of the contents of a single cell or all the cells in a table. Read/write Single.

Syntax

expression .LeftPadding

expression A variable that represents a Cell object.

Remarks

The setting of the LeftPadding property for a single cell overrides the setting of the LeftPadding property for the entire table.

Example

This example sets the left padding for the first cell in the first table in the active document to 40 pixels.

VBA Copy code Copy code
ActiveDocument.Tables(1).Rows(1).Cells(1).LeftPadding = _
 PixelsToPoints(40, False)

See also

Concepts

Cell Object

Other resources

Cell Object Members


Cell.NestingLevel Property (Word)

 Copy code hover
[image]

Cell.NestingLevel Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the nesting level of the specified cell. Read-only Long.

Syntax

expression .NestingLevel

expression A variable that represents a Cell object.

Remarks

The outermost table has a nesting level of 1. The nesting level of each successively nested table is one higher than the previous table.

Example

This example creates a new document, creates a nested table with three levels, and then fills the first cell of each table with its nesting level.

VBA Copy code Copy code
Documents.Add
ActiveDocument.Tables.Add Selection.Range, _
 3, 3, wdWord9TableBehavior, wdAutoFitContent
With ActiveDocument.Tables(1).Range
 .Copy
 .Cells(1).Range.Text = .Cells(1).NestingLevel
 .Cells(5).Range.PasteAsNestedTable
 With .Cells(5).Tables(1).Range
 .Cells(1).Range.Text = .Cells(1).NestingLevel
 .Cells(5).Range.PasteAsNestedTable
 With .Cells(5).Tables(1).Range
 .Cells(1).Range.Text = _
 .Cells(1).NestingLevel
 End With
 End With
End With

See also

Concepts

Cell Object

Other resources

Cell Object Members


Cell.Next Property (Word)

 Copy code hover
[image]

Cell.Next Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Cell object that represents the next table cell in the Cells collection. Read-only.

Syntax

expression .Next

expression A variable that represents a Cell object.

Example

If the selection is in a table, this example selects the contents of the next table cell.

VBA Copy code Copy code
If Selection.Information(wdWithInTable) = True Then
 Selection.Cells(1).Next.Select
End If

See also

Concepts

Cell Object

Other resources

Cell Object Members


Cell.Parent Property (Word)

 Copy code hover
[image]

Cell.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Cell object.

Syntax

expression .Parent

expression A variable that represents a Cell object.

Example

This example sets a variable to the first cell in the first table of the active document, changes the width of the cell to 36 points, and removes borders from the table.

VBA Copy code Copy code
Set objCell = ActiveDocument.Tables(1).Cell(1, 1)
With objCell
 .SetWidth ColumnWidth:=36, RulerStyle:=wdAdjustNone
 .Parent.Borders.Enable = False
End With

See also

Concepts

Cell Object

Other resources

Cell Object Members


Cell.PreferredWidth Property (Word)

 Copy code hover
[image]

Cell.PreferredWidth Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the preferred width (in points or as a percentage of the window width) for the specified cell. Read/write Single.

Syntax

expression .PreferredWidth

expression Required. A variable that represents a Cell object.

Remarks

If the PreferredWidthType property is set to wdPreferredWidthPoints, the PreferredWidth property returns or sets the width in points. If the PreferredWidthType property is set to wdPreferredWidthPercent, the PreferredWidth property returns or sets the width as a percentage of the window width.

See also

Concepts

Cell Object

Other resources

Cell Object Members


Cell.PreferredWidthType Property (Word)

 Copy code hover
[image]

Cell.PreferredWidthType Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the preferred unit of measurement to use for the width of the specified cell. Read-only WdPreferredWidthType.

Syntax

expression .PreferredWidthType

expression Required. A variable that represents a Cell object.

Example

This example sets Microsoft Word to accept widths as a percentage of window width, and then it sets the width of the first table in the document to 50% of the window width.

VBA Copy code Copy code
With ActiveDocument.Tables(1)
 .PreferredWidthType = wdPreferredWidthPercent
 .PreferredWidth = 50
End With

See also

Concepts

Cell Object

Other resources

Cell Object Members


Cell.Previous Property (Word)

 Copy code hover
[image]

Cell.Previous Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Cell object that represents the previous table cell in the Cells collection. Read-only.

Syntax

expression .Previous

expression A variable that represents a Cell object.

Example

If the selection is in a table, this example selects the contents of the previous cell.

VBA Copy code Copy code
If Selection.Information(wdWithInTable) = True Then
 Selection.Rows(1).Cells(3).Previous.Select
End If

See also

Concepts

Cell Object

Other resources

Cell Object Members


Cell.Range Property (Word)

 Copy code hover
[image]

Cell.Range Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the portion of a document that's contained in the specified object.

Syntax

expression .Range

expression A variable that represents a Cell object.

Example

This example copies thecontents of the first cell in the first row in the first table.

VBA Copy code Copy code
If ActiveDocument.Tables.Count >= 1 Then _
 ActiveDocument.Tables(1).Rows(1).Cells(1).Range.Copy

See also

Concepts

Cell Object

Other resources

Cell Object Members


Cell.RightPadding Property (Word)

 Copy code hover
[image]

Cell.RightPadding Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the amount of space (in points) to add to the right of the contents of a single cell or all the cells in a table. Read/write Single.

Syntax

expression .RightPadding

expression A variable that represents a Cell object.

Remarks

The setting of the RightPadding property for a single cell overrides the setting of the RightPadding property for the entire table.

Example

This example sets the right padding for the first cell in the first row in the first table in the active document to 40 pixels.

VBA Copy code Copy code
ActiveDocument.Tables(1).Rows(1).Cells(1).RightPadding = _
 PixelsToPoints(40, False)

See also

Concepts

Cell Object

Other resources

Cell Object Members


Cell.Row Property (Word)

 Copy code hover
[image]

Cell.Row Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Row object that represents the row containing the specified cell.

Syntax

expression .Row

expression An expression that returns a Cell object.

Example

This example applies shading to the table row that contains the insertion point.

VBA Copy code Copy code
If Selection.Information(wdWithInTable) = True Then
 Selection.Cells(1).Row.Shading.Texture = wdTexture10Percent
Else
 MsgBox "The insertion point is not in a table."
End If

See also

Concepts

Cell Object

Other resources

Cell Object Members


Cell.RowIndex Property (Word)

 Copy code hover
[image]

Cell.RowIndex Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the number of the row that contains the specified cell. Read-only Long.

Syntax

expression .RowIndex

expression An expression that returns a Cell object.

Example

This example creates a 3x3 table in a new document, selects each cell in the first column, and displays the row number that contains each selected cell.

VBA Copy code Copy code
Set newDoc = Documents.Add
Set myTable = newDoc.Tables.Add(Range:=Selection.Range, _
 NumRows:=3, NumColumns:=3)
For Each aCell In myTable.Columns(1).Cells
 aCell.Select
 MsgBox "This is row " & aCell.RowIndex
Next aCell

This example displays the row number of the first row in the selection.

VBA Copy code Copy code
If Selection.Information(wdWithInTable) = True Then
 Msgbox Selection.Cells(1).RowIndex
End If

See also

Concepts

Cell Object

Other resources

Cell Object Members


Cell.Shading Property (Word)

 Copy code hover
[image]

Cell.Shading Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Shading object that refers to the shading formatting for the specified object.

Syntax

expression .Shading

expression A variable that represents a Cell object.

Example

This example applies horizontal line texture to the first cell in the first row in first table.

VBA Copy code Copy code
If ActiveDocument.Tables.Count >= 1 Then
 With ActiveDocument.Tables(1).Rows(1).Cells(1).Shading
 .Texture = wdTextureHorizontal
 End With
End If

See also

Concepts

Cell Object

Other resources

Cell Object Members


Cell.Tables Property (Word)

 Copy code hover
[image]

Cell.Tables Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Tables collection that represents all the nested tables inside the specified table cell. Read-only.

Syntax

expression .Tables

expression A variable that represents a Cell object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

See also

Concepts

Cell Object

Other resources

Cell Object Members


Cell.TopPadding Property (Word)

 Copy code hover
[image]

Cell.TopPadding Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the amount of space (in points) to add above the contents of a single cell or all the cells in a table. Read/write Single.

Syntax

expression .TopPadding

expression A variable that represents a Cell object.

Remarks

The setting of the TopPadding property for a single cell overrides the setting of the TopPadding property for the entire table.

Example

This example sets the top padding for the first table in the active document to 40 pixels.

VBA Copy code Copy code
ActiveDocument.Tables(1).TopPadding = _
 PixelsToPoints(40, True)

See also

Concepts

Cell Object

Other resources

Cell Object Members


Cell.VerticalAlignment Property (Word)

 Copy code hover
[image]

Cell.VerticalAlignment Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the vertical alignment of text in one or more cells of a table. Read/write WdCellVerticalAlignment.

Syntax

expression .VerticalAlignment

expression Required. A variable that represents a Cell object.

Example

This example creates a 3x3 table in a new document and assigns a sequential cell number to each cell in the table. The example then sets the height of the first row to 20 points and vertically aligns the text at the top of the cells.

VBA Copy code Copy code
Set newDoc = Documents.Add
Set myTable = newDoc.Tables.Add(Selection.Range, 3, 3)
i = 1
For Each c In myTable.Range.Cells
 c.Range.InsertAfter "Cell " & i
 i = i + 1
Next
With myTable.Rows(1)
 .Height = 20
 .Cells.VerticalAlignment = wdAlignVerticalTop
End With

See also

Concepts

Cell Object

Other resources

Cell Object Members


Cell.Width Property (Word)

 Copy code hover
[image]

Cell.Width Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the width of a table cell, in points. Read/write Long.

Syntax

expression .Width

expression A variable that represents a Cell object.

Example

This example returns the width (in inches) of the cell that contains the insertion point.

VBA Copy code Copy code
If Selection.Information(wdWithInTable) = True Then
 MsgBox PointsToInches(Selection.Cells(1).Width)
End If

See also

Concepts

Cell Object

Other resources

Cell Object Members


Cell.WordWrap Property (Word)

 Copy code hover
[image]

Cell.WordWrap Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word wraps text to multiple lines and lengthens the cell so that the cell width remains the same. Read/write Boolean.

Syntax

expression .WordWrap

expression Required. A variable that represents a Cell object.

Example

This example sets Microsoft Word to wrap text to multiple lines in the third cell of the first table so that the cell's width remains the same.

VBA Copy code Copy code
ActiveDocument.Tables(1).Range.Cells(3).WordWrap = True

See also

Concepts

Cell Object

Other resources

Cell Object Members


Cell Methods (Word)

 Copy code hover
[image]

Cell Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
AutoSum | Inserts an = (Formula) field that calculates and displays the sum of the values in table cells above or to the left of the cell specified in the expression.
Delete | Deletes a table cell or cells and optionally controls how the remaining cells are shifted.
Formula | Inserts an = (Formula) field that contains the specified formula into a table cell.
Merge | Merges the specified table cell with another table cell. The result is a single table cell.
Select | Selects the specified object.
SetHeight | Sets the height of table cells.
SetWidth | Sets the width of columns or cells in a table.
Split | Splits a single table cell into multiple cells.


Cell.AutoSum Method (Word)

 Copy code hover
[image]

Cell.AutoSum Method (Word)
See also Send feedback

Published: July 16, 2012

Inserts an = (Formula) field that calculates and displays the sum of the values in table cells above or to the left of the cell specified in the expression.

Syntax

expression .AutoSum

expression Required. A variable that represents a Cell object.

Remarks

For information about how Word determines which values to add, see the Formula method.

Example

This example creates a 3x3 table in a new document and sums the numbers in the first column.

VBA Copy code Copy code
Dim docNew as Document
Dim tableNew as Table

Set docNew = Documents.Add
Set tableNew = docNew.Tables.Add(Selection.Range, 3, 3)

With tableNew
 .Cell(1, 1).Range.InsertAfter "10"
 .Cell(2, 1).Range.InsertAfter "15"
 .Cell(3, 1).AutoSum
End With

This example sums the numbers above or to the left of the cell that contains the insertion point.

VBA Copy code Copy code
Selection.Collapse Direction:=wdCollapseStart
If Selection.Information(wdWithInTable) = True Then
 Selection.Cells(1).AutoSum
Else
 MsgBox "The insertion point is not in a table."
End If

See also

Concepts

Cell Object

Other resources

Cell Object Members


Cell.Delete Method (Word)

 Copy code hover
[image]

Cell.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes a table cell or cells and optionally controls how the remaining cells are shifted.

Syntax

expression .Delete(ShiftCells)

expression Required. A variable that represents a Cell object.

Parameters

Name | Required/Optional | Data Type | Description
ShiftCells | Optional | Variant | The direction in which the remaining cells are to be shifted. Can be any WdDeleteCells constant. If omitted, cells to the right of the last deleted cell are shifted left.

Example

This example deletes the first cell in the first table of the active document.

VBA Copy code Copy code
Sub DeleteCells()
 Dim intResponse As Integer

 intResponse = MsgBox("Are you sure you want " & _
 "to delete the cells?", vbYesNo)

 If intResponse = vbYes Then
 ActiveDocument.Tables(1).Cell(1, 1).Delete
 End If
End Sub

See also

Concepts

Cell Object

Other resources

Cell Object Members


Cell.Formula Method (Word)

 Copy code hover
[image]

Cell.Formula Method (Word)
See also Send feedback

Published: July 16, 2012

Inserts an = (Formula) field that contains the specified formula into a table cell.

Syntax

expression .Formula(Formula, NumFormat)

expression Required. A variable that represents a Cell object.

Parameters

Name | Required/Optional | Data Type | Description
Formula | Optional | Variant | The mathematical formula you want the = (Formula) field to evaluate. Spreadsheet-type references to table cells are valid. For example, "=SUM(A4:C4)" specifies the first three values in the fourth row. For more information about the = (Formula) field, see Field codes:= (Formula) field.
NumFormat | Optional | Variant | A format for the result of the = (Formula) field. For information about the types of formats you can apply, see Numeric Picture (\#) field switch.

Remarks

Formula is optional as long as there is at least one cell that contains a value above or to the left of the cell that contains the insertion point. If the cells above the insertion point contain values, the inserted field is {=SUM(ABOVE)}; if the cells to the left of the insertion point contain values, the inserted field is {=SUM(LEFT)}. If both the cells above the insertion point and the cells to the left of the insertion point contain values, Microsoft Word uses the following rules to determine which SUM function to insert:

  • If the cell immediately above the insertion point contains a value, Word inserts {=SUM(ABOVE)}.

  • If the cell immediately above the insertion point doesn't contain a value and the cell immediately to the left of it does, Word inserts {=SUM(LEFT)}.

  • If neither adjoining cell contains a value, Word inserts {=SUM(ABOVE)}.

  • If you don't specify Formula and all the cells above and to the left of the insertion point are empty, the result of the field is an error.

Example

This example creates a 3x3 table at the beginning of the active document and then averages the numbers in the first column.

VBA Copy code Copy code
Set myRange = ActiveDocument.Range(0, 0)
Set myTable = ActiveDocument.Tables.Add(myRange, 3, 3)
With myTable
 .Cell(1,1).Range.InsertAfter "100"
 .Cell(2,1).Range.InsertAfter "50"
 .Cell(3,1).Formula Formula:="=Average(Above)"
End With

This example inserts a formula at the insertion point that determines the largest number in the cells above the selected cell.

VBA Copy code Copy code
Selection.Collapse Direction:=wdCollapseStart
If Selection.Information(wdWithInTable) = True Then
 Selection.Cells(1).Formula Formula:="=Max(Above)"
Else
 MsgBox "The insertion point is not in a table."
End If

See also

Concepts

Cell Object

Other resources

Cell Object Members


Cell.Merge Method (Word)

 Copy code hover
[image]

Cell.Merge Method (Word)
See also Send feedback

Published: July 16, 2012

Merges the specified table cell with another table cell. The result is a single table cell.

Syntax

expression .Merge(MergeTo)

expression Required. A variable that represents a Cell object.

Parameters

Name | Required/Optional | Data Type | Description
MergeTo | Required | Cell object | The cell to be merged with.

Example

This example merges the first two cells in table one in the active document with one another and then removes the table borders.

VBA Copy code Copy code
If ActiveDocument.Tables.Count >= 1 Then
 With ActiveDocument.Tables(1)
 .Cell(Row:=1, Column:=1).Merge _
 MergeTo:=.Cell(Row:=1, Column:=2)
 .Borders.Enable = False
 End With
End If

See also

Concepts

Cell Object

Other resources

Cell Object Members


Cell.Select Method (Word)

 Copy code hover
[image]

Cell.Select Method (Word)
See also Send feedback

Published: July 16, 2012

Selects the specified object.

Syntax

expression .Select

expression Required. A variable that represents a Cell object.

Remarks

After using this method, use the Selection object to work with the selected items. For more information, see Working with the Selection object.

See also

Concepts

Cell Object

Other resources

Cell Object Members


Cell.SetHeight Method (Word)

 Copy code hover
[image]

Cell.SetHeight Method (Word)
See also Send feedback

Published: July 16, 2012

Sets the height of table cells.

Syntax

expression .SetHeight(RowHeight, HeightRule)

expression Required. A variable that represents a Cell object.

Parameters

Name | Required/Optional | Data Type | Description
RowHeight | Required | Variant | The height of the row or rows, in points.
HeightRule | Required | WdRowHeightRule | The rule for determining the height of the specified cells.

Remarks

Setting the SetHeight property of a Cell object automatically sets the property for the entire row.

Example

This example sets the row height of the selected cells to at least 18 points.

VBA Copy code Copy code
If Selection.Information(wdWithInTable) = True Then
 Selection.Cells.SetHeight RowHeight:=18, _
 HeightRule:=wdRowHeightAtLeast
Else
 MsgBox "The insertion point is not in a table."
End If

See also

Concepts

Cell Object

Other resources

Cell Object Members


Cell.SetWidth Method (Word)

 Copy code hover
[image]

Cell.SetWidth Method (Word)
See also Send feedback

Published: July 16, 2012

Sets the width of columns or cells in a table.

Syntax

expression .SetWidth(ColumnWidth, RulerStyle)

expression Required. A variable that represents a Cell object.

Parameters

Name | Required/Optional | Data Type | Description
ColumnWidth | Required | Single | The width of the specified column or columns, in points.
RulerStyle | Required | WdRulerStyle | Controls the way Word adjusts cell widths.

Remarks

The WdRulerStyle behavior described above applies to left-aligned tables. The WdRulerStyle behavior for center- and right-aligned tables can be unexpected; in these cases, the SetWidth method should be used with care.

Example

This example creates a table in a new document and sets the width of the first cell in the second row to 1.5 inches. The example preserves the widths of the other cells in the table.

VBA Copy code Copy code
Set newDoc = Documents.Add
Set myTable = _
 newDoc.Tables.Add(Range:=Selection.Range, NumRows:=3, _
 NumColumns:=3)
myTable.Cell(2,1).SetWidth _
 ColumnWidth:=InchesToPoints(1.5), _
 RulerStyle:=wdAdjustNone

This example sets the width of the cell that contains the insertion point to 36 points. The example also narrows the first column to preserve the position of the right edge of the table.

VBA Copy code Copy code
If Selection.Information(wdWithInTable) = True Then
 Selection.Cells(1).SetWidth ColumnWidth:=36, _
 RulerStyle:=wdAdjustFirstColumn
Else
 MsgBox "The insertion point is not in a table."
End If

See also

Concepts

Cell Object

Other resources

Cell Object Members


Cell.Split Method (Word)

 Copy code hover
[image]

Cell.Split Method (Word)
See also Send feedback

Published: July 16, 2012

Splits a single table cell into multiple cells.

Syntax

expression .Split(NumRows, NumColumns)

expression Required. A variable that represents a Cell object.

Parameters

Name | Required/Optional | Data Type | Description
NumRows | Optional | Variant | The number of rows that the cell or group of cells is to be split into.
NumColumns | Optional | Variant | The number of columns that the cell or group of cells is to be split into.

Example

This example splits the first cell in the first table into two cells.

VBA Copy code Copy code
ActiveDocument.Tables(1).Cell(1, 1).Split NumColumns:=2

See also

Concepts

Cell Object

Other resources

Cell Object Members


Cells Object (Word)

 Copy code hover
[image]

Cells Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of Cell objects in a table column, table row, selection, or range.

Remarks

Use the Cells property to return the Cells collection. The following example formats the cells in the first row in table one in the active document to be 30 points wide.

VBA Copy code Copy code
ActiveDocument.Tables(1).Rows(1).Cells.Width = 30

The following example returns the number of cells in the current row.

VBA Copy code Copy code
num = Selection.Rows(1).Cells.Count

Use the Add method to add a Cell object to the Cells collection. You can also use the InsertCells method of the Selection object to insert new cells. The following example adds a cell before the first cell in myTable.

VBA Copy code Copy code
Set myTable = ActiveDocument.Tables(1)
myTable.Range.Cells.Add BeforeCell:=myTable.Cell(1, 1)

Use Cell(row, column), where row is the row number and column is the column number, or Cells(index), where index is the index number, to return a Cell object. The following example applies shading to the second cell in the first row in table one.

VBA Copy code Copy code
Set myCell = ActiveDocument.Tables(1).Cell(Row:=1, Column:=2)
myCell.Shading.Texture = wdTexture20Percent

The following example applies shading to the first cell in the first row.

VBA Copy code Copy code
ActiveDocument.Tables(1).Rows(1).Cells(1).Shading _
 .Texture = wdTexture20Percent

Remarks

Use the Add method with the Rows or Columns collection to add a row or column of cells. The following example adds a column to the first table in the active document and then inserts numbers into the first column.

VBA Copy code Copy code
Set myTable = ActiveDocument.Tables(1)
Set aColumn = myTable.Columns.Add(BeforeColumn:=myTable.Columns(1))
For Each aCell In aColumn.Cells
 aCell.Range.Delete
 aCell.Range.InsertAfter num + 1
 num = num + 1
Next aCell

See also

Concepts

Word Object Model Reference

Other resources

Cells Object Members


Cells Members (Word)

 Copy code hover
[image]

Cells Members (Word)
Send feedback

Published: July 16, 2012

A collection of Cell objects in a table column, table row, selection, or range.

Methods

Name | Description
Add | Returns a Cell object that represents a cell added to a table.
AutoFit | Changes the width of a table column to accommodate the width of the text without changing the way text wraps in the cells.
Delete | Deletes a table cell or cells and optionally controls how the remaining cells are shifted.
DistributeHeight | Adjusts the height of the specified cells so that they are equal.
DistributeWidth | Adjusts the width of the specified cells so that they are equal.
Item | Returns an individual Cell object in a collection.
Merge | Merges the specified table cells with one another. The result is a single table cell.
SetHeight | Sets the height of table cells.
SetWidth | Sets the width of columns or cells in a table.
Split | Splits a range of table cells.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Borders | Returns a Borders collection that represents all the borders for the specified object.
Count | Returns the number of items in the Cells collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Height | Returns or sets the height of the specified table cells. Read/write Single.
HeightRule | Returns or sets a WdRowHeightRule constant that represents the rule for determining the height of the specified cells. Read/write .
NestingLevel | Returns the nesting level of the specified cells. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified Cells object.
PreferredWidth | Returns or sets the preferred width (in points or as a percentage of the window width) for the specified cells. Read/write Single.
PreferredWidthType | Returns or sets the preferred unit of measurement to use for the width of the specified cells. Read-only WdPreferredWidthType.
Shading | Returns a Shading object that refers to the shading formatting for the specified object.
VerticalAlignment | Returns or sets the vertical alignment of text in one or more cells of a table. Read/write WdCellVerticalAlignment.
Width | Returns or sets the width of the table cells, in points. Read/write Long.


Cells Properties (Word)

 Copy code hover
[image]

Cells Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Borders | Returns a Borders collection that represents all the borders for the specified object.
Count | Returns the number of items in the Cells collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Height | Returns or sets the height of the specified table cells. Read/write Single.
HeightRule | Returns or sets a WdRowHeightRule constant that represents the rule for determining the height of the specified cells. Read/write .
NestingLevel | Returns the nesting level of the specified cells. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified Cells object.
PreferredWidth | Returns or sets the preferred width (in points or as a percentage of the window width) for the specified cells. Read/write Single.
PreferredWidthType | Returns or sets the preferred unit of measurement to use for the width of the specified cells. Read-only WdPreferredWidthType.
Shading | Returns a Shading object that refers to the shading formatting for the specified object.
VerticalAlignment | Returns or sets the vertical alignment of text in one or more cells of a table. Read/write WdCellVerticalAlignment.
Width | Returns or sets the width of the table cells, in points. Read/write Long.


Cells.Application Property (Word)

 Copy code hover
[image]

Cells.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression A variable that represents a Cells object.

See also

Concepts

Cells Collection Object

Other resources

Cells Object Members


Cells.Borders Property (Word)

 Copy code hover
[image]

Cells.Borders Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Borders collection that represents all the borders for the specified object.

Syntax

expression .Borders

expression A variable that represents a Cells object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example applies inside and outside borders to the cells in the first row of the first table in the active document.

VBA Copy code Copy code
Dim objTable As Table
Set objTable = ActiveDocument.Tables(1)
With objTable.Rows(1).Cells.Borders
 .InsideLineStyle = wdLineStyleSingle
 .OutsideLineStyle = wdLineStyleDouble
End With

See also

Concepts

Cells Collection Object

Other resources

Cells Object Members


Cells.Count Property (Word)

 Copy code hover
[image]

Cells.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the number of items in the Cells collection. Read-only Long.

Syntax

expression .Count

expression A variable that represents a Cells collection.

See also

Concepts

Cells Collection Object

Other resources

Cells Object Members


Cells.Creator Property (Word)

 Copy code hover
[image]

Cells.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a Cells object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

Cells Collection Object

Other resources

Cells Object Members


Cells.Height Property (Word)

 Copy code hover
[image]

Cells.Height Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the height of the specified table cells. Read/write Single.

Syntax

expression .Height

expression An expression that returns a Cells collection.

Remarks

If the HeightRule property of the specified row is wdRowHeightAuto, Height returns wdUndefined; setting the Height property sets HeightRule to wdRowHeightAtLeast.

See also

Concepts

Cells Collection Object

Other resources

Cells Object Members


Cells.HeightRule Property (Word)

 Copy code hover
[image]

Cells.HeightRule Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a WdRowHeightRule constant that represents the rule for determining the height of the specified cells. Read/write .

Syntax

expression .HeightRule

expression Required. A variable that represents a Cells collection.

Remarks

Setting the HeightRule property of a Cells collection automatically sets the height for the entire row.

See also

Concepts

Cells Collection Object

Other resources

Cells Object Members


Cells.NestingLevel Property (Word)

 Copy code hover
[image]

Cells.NestingLevel Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the nesting level of the specified cells. Read-only Long.

Syntax

expression .NestingLevel

expression A variable that represents a Cells collection.

Remarks

The outermost table has a nesting level of 1. The nesting level of each successively nested table is one higher than the previous table.

Example

This example creates a new document, creates a nested table with three levels, and then fills the first cell of each table with its nesting level.

VBA Copy code Copy code
Documents.Add
ActiveDocument.Tables.Add Selection.Range, _
 3, 3, wdWord9TableBehavior, wdAutoFitContent
With ActiveDocument.Tables(1).Range
 .Copy
 .Cells(1).Range.Text = .Cells.NestingLevel
 .Cells(5).Range.PasteAsNestedTable
 With .Cells(5).Tables(1).Range
 .Cells(1).Range.Text = .Cells.NestingLevel
 .Cells(5).Range.PasteAsNestedTable
 With .Cells(5).Tables(1).Range
 .Cells(1).Range.Text = _
 .Cells.NestingLevel
 End With
 End With
End With

See also

Concepts

Cells Collection Object

Other resources

Cells Object Members


Cells.Parent Property (Word)

 Copy code hover
[image]

Cells.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Cells object.

Syntax

expression .Parent

expression A variable that represents a Cells object.

See also

Concepts

Cells Collection Object

Other resources

Cells Object Members


Cells.PreferredWidth Property (Word)

 Copy code hover
[image]

Cells.PreferredWidth Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the preferred width (in points or as a percentage of the window width) for the specified cells. Read/write Single.

Syntax

expression .PreferredWidth

expression Required. A variable that represents a Cells collection.

Remarks

If the PreferredWidthType property is set to wdPreferredWidthPoints, the PreferredWidth property returns or sets the width in points. If the PreferredWidthType property is set to wdPreferredWidthPercent, the PreferredWidth property returns or sets the width as a percentage of the window width.

See also

Concepts

Cells Collection Object

Other resources

Cells Object Members


Cells.PreferredWidthType Property (Word)

 Copy code hover
[image]

Cells.PreferredWidthType Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the preferred unit of measurement to use for the width of the specified cells. Read-only WdPreferredWidthType.

Syntax

expression .PreferredWidthType

expression Required. A variable that represents a Cells collection.

Example

This example sets Microsoft Word to accept widths as a percentage of window width, and then it sets the width of the first table in the document to 50% of the window width.

VBA Copy code Copy code
With ActiveDocument.Tables(1)
 .PreferredWidthType = wdPreferredWidthPercent
 .PreferredWidth = 50
End With

See also

Concepts

Cells Collection Object

Other resources

Cells Object Members


Cells.Shading Property (Word)

 Copy code hover
[image]

Cells.Shading Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Shading object that refers to the shading formatting for the specified object.

Syntax

expression .Shading

expression A variable that represents a Cells object.

Example

This example applies horizontal line texture to the first row in table one.

VBA Copy code Copy code
If ActiveDocument.Tables.Count >= 1 Then
 With ActiveDocument.Tables(1).Rows(1).Cells.Shading
 .Texture = wdTextureHorizontal
 End With
End If

See also

Concepts

Cells Collection Object

Other resources

Cells Object Members


Cells.VerticalAlignment Property (Word)

 Copy code hover
[image]

Cells.VerticalAlignment Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the vertical alignment of text in one or more cells of a table. Read/write WdCellVerticalAlignment.

Syntax

expression .VerticalAlignment

expression Required. A variable that represents a Cells collection.

Example

This example creates a 3x3 table in a new document and assigns a sequential cell number to each cell in the table. The example then sets the height of the first row to 20 points and vertically aligns the text at the top of the cells.

VBA Copy code Copy code
Set newDoc = Documents.Add
Set myTable = newDoc.Tables.Add(Selection.Range, 3, 3)
i = 1
For Each c In myTable.Range.Cells
 c.Range.InsertAfter "Cell " & i
 i = i + 1
Next
With myTable.Rows(1)
 .Height = 20
 .Cells.VerticalAlignment = wdAlignVerticalTop
End With

See also

Concepts

Cells Collection Object

Other resources

Cells Object Members


Cells.Width Property (Word)

 Copy code hover
[image]

Cells.Width Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the width of the table cells, in points. Read/write Long.

Syntax

expression .Width

expression A variable that represents a Cells object.

Example

This example returns the width (in inches) of the cells within the selection.

VBA Copy code Copy code
If Selection.Information(wdWithInTable) = True Then
 MsgBox PointsToInches(Selection.Cells.Width)
End If

See also

Concepts

Cells Collection Object

Other resources

Cells Object Members


Cells Methods (Word)

 Copy code hover
[image]

Cells Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Returns a Cell object that represents a cell added to a table.
AutoFit | Changes the width of a table column to accommodate the width of the text without changing the way text wraps in the cells.
Delete | Deletes a table cell or cells and optionally controls how the remaining cells are shifted.
DistributeHeight | Adjusts the height of the specified cells so that they are equal.
DistributeWidth | Adjusts the width of the specified cells so that they are equal.
Item | Returns an individual Cell object in a collection.
Merge | Merges the specified table cells with one another. The result is a single table cell.
SetHeight | Sets the height of table cells.
SetWidth | Sets the width of columns or cells in a table.
Split | Splits a range of table cells.


Cells.Add Method (Word)

 Copy code hover
[image]

Cells.Add Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a Cell object that represents a cell added to a table.

Syntax

expression .Add(BeforeCell)

expression Required. A variable that represents a Cells collection.

Parameters

Name | Required/Optional | Data Type | Description
BeforeCell | Optional | Variant | A Cell object that represents the cell that will appear immediately to the right of the new cell or cells.

Return Value

Cell

See also

Concepts

Cells Collection Object

Other resources

Cells Object Members


Cells.AutoFit Method (Word)

 Copy code hover
[image]

Cells.AutoFit Method (Word)
See also Send feedback

Published: July 16, 2012

Changes the width of a table column to accommodate the width of the text without changing the way text wraps in the cells.

Syntax

expression .AutoFit

expression Required. A variable that represents a Cells collection.

Remarks

If the table is already as wide as the distance between the left and right margins, this method has no affect.

Example

This example creates a 3x3 table in a new document and then changes the width of the first column to accommodate the width of the text.

VBA Copy code Copy code
Dim docNew as Document
Dim tableNew as Table

Set docNew = Documents.Add
Set tableNew = docNew.Tables.Add(Range:=Selection.Range, _
 NumRows:=3, NumColumns:=3)
With tableNew
 .Cell(1,1).Range.InsertAfter "First cell"
 .Columns(1).AutoFit
End With

This example creates a 3x3 table in a new document and then changes the width of all the columns to accommodate the width of the text.

VBA Copy code Copy code
Dim docNew as Document
Dim tableNew as Table

Set docNew = Documents.Add
Set tableNew = docNew.Tables.Add(Selection.Range, 3, 3)
With tableNew
 .Cell(1,1).Range.InsertAfter "First cell"
 .Cell(1,2).Range.InsertAfter "This is cell (1,2)"
 .Cell(1,3).Range.InsertAfter "(1,3)"
 .Columns.AutoFit
End With

See also

Concepts

Cells Collection Object

Other resources

Cells Object Members


Cells.Delete Method (Word)

 Copy code hover
[image]

Cells.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes a table cell or cells and optionally controls how the remaining cells are shifted.

Syntax

expression .Delete(ShiftCells)

expression Required. A variable that represents a Cells collection.

Parameters

Name | Required/Optional | Data Type | Description
ShiftCells | Optional | Variant | The direction in which the remaining cells are to be shifted. Can be any WdDeleteCells constant. If omitted, cells to the right of the last deleted cell are shifted left.

See also

Concepts

Cells Collection Object

Other resources

Cells Object Members


Cells.DistributeHeight Method (Word)

 Copy code hover
[image]

Cells.DistributeHeight Method (Word)
See also Send feedback

Published: July 16, 2012

Adjusts the height of the specified cells so that they are equal.

Syntax

expression .DistributeHeight

expression Required. A variable that represents a Cells collection.

Example

This example adjusts the height of the rows in the first table in the active document so that they're equal.

VBA Copy code Copy code
ActiveDocument.Tables(1).Rows.DistributeHeight

This example adjusts the height of the first three rows in the first table so that they're equal.

VBA Copy code Copy code
Dim rngTemp As Range

If ActiveDocument.Tables.Count >= 1 Then
 Set rngTemp = ActiveDocument.Range(Start:=ActiveDocument _
 .Tables(1).Rows(1).Range.Start, _
 End:=ActiveDocument.Tables(1).Rows(3).Range.End)
 rngTemp.Rows.DistributeHeight
End If

See also

Concepts

Cells Collection Object

Other resources

Cells Object Members


Cells.DistributeWidth Method (Word)

 Copy code hover
[image]

Cells.DistributeWidth Method (Word)
See also Send feedback

Published: July 16, 2012

Adjusts the width of the specified cells so that they are equal.

Syntax

expression .DistributeWidth

expression Required. A variable that represents a Cells collection.

Example

This example adjusts the width of the columns in the first table in the active document so that they're equal.

VBA Copy code Copy code
ActiveDocument.Tables(1).Columns.DistributeWidth

This example adjusts the height of the selected cells.

VBA Copy code Copy code
If Selection.Cells.Count >= 2 Then
 Selection.Cells.DistributeWidth
End If

See also

Concepts

Cells Collection Object

Other resources

Cells Object Members


Cells.Item Method (Word)

 Copy code hover
[image]

Cells.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual Cell object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents a Cells collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The individual object to be returned. Can be a Long indicating the ordinal position of the individual object.

Return Value

Cell

See also

Concepts

Cells Collection Object

Other resources

Cells Object Members


Cells.Merge Method (Word)

 Copy code hover
[image]

Cells.Merge Method (Word)
See also Send feedback

Published: July 16, 2012

Merges the specified table cells with one another. The result is a single table cell.

Syntax

expression .Merge

expression Required. A variable that represents a Cells collection.

Example

This example merges the cells in row one of the selection into a single cell and then applies shading to the row.

VBA Copy code Copy code
If Selection.Information(wdWithInTable) = True Then
 Set myrow = Selection.Rows(1)
 myrow.Cells.Merge
 myrow.Shading.Texture = wdTexture10Percent
End If

See also

Concepts

Cells Collection Object

Other resources

Cells Object Members


Cells.SetHeight Method (Word)

 Copy code hover
[image]

Cells.SetHeight Method (Word)
See also Send feedback

Published: July 16, 2012

Sets the height of table cells.

Syntax

expression .SetHeight(RowHeight, HeightRule)

expression Required. A variable that represents a Cells collection.

Parameters

Name | Required/Optional | Data Type | Description
RowHeight | Required | Variant | The height of the row or rows, in points.
HeightRule | Required | WdRowHeightRule | The rule for determining the height of the specified cells.

Remarks

Setting the SetHeight property of a Cells object automatically sets the property for the entire row.

Example

This example sets the row height of the selected cells to at least 18 points.

VBA Copy code Copy code
If Selection.Information(wdWithInTable) = True Then
 Selection.Cells.SetHeight RowHeight:=18, _
 HeightRule:=wdRowHeightAtLeast
Else
 MsgBox "The insertion point is not in a table."
End If

See also

Concepts

Cells Collection Object

Other resources

Cells Object Members


Cells.SetWidth Method (Word)

 Copy code hover
[image]

Cells.SetWidth Method (Word)
See also Send feedback

Published: July 16, 2012

Sets the width of columns or cells in a table.

Syntax

expression .SetWidth(ColumnWidth, RulerStyle)

expression Required. A variable that represents a Cells collection.

Parameters

Name | Required/Optional | Data Type | Description
ColumnWidth | Required | Single | The width of the specified column or columns, in points.
RulerStyle | Required | WdRulerStyle | Controls the way Word adjusts cell widths.

Remarks

The WdRulerStyle behavior described above applies to left-aligned tables. The WdRulerStyle behavior for center- and right-aligned tables can be unexpected; in these cases, the SetWidth method should be used with care.

Example

This example creates a table in a new document and sets the width of the first cell in the second row to 1.5 inches. The example preserves the widths of the other cells in the table.

VBA Copy code Copy code
Set newDoc = Documents.Add
Set myTable = _
 newDoc.Tables.Add(Range:=Selection.Range, NumRows:=3, _
 NumColumns:=3)
myTable.Cell(2,1).SetWidth _
 ColumnWidth:=InchesToPoints(1.5), _
 RulerStyle:=wdAdjustNone

This example sets the width of the cell that contains the insertion point to 36 points. The example also narrows the first column to preserve the position of the right edge of the table.

VBA Copy code Copy code
If Selection.Information(wdWithInTable) = True Then
 Selection.Cells(1).SetWidth ColumnWidth:=36, _
 RulerStyle:=wdAdjustFirstColumn
Else
 MsgBox "The insertion point is not in a table."
End If

See also

Concepts

Cells Collection Object

Other resources

Cells Object Members


Cells.Split Method (Word)

 Copy code hover
[image]

Cells.Split Method (Word)
See also Send feedback

Published: July 16, 2012

Splits a range of table cells.

Syntax

expression .Split(NumRows, NumColumns, MergeBeforeSplit)

expression Required. A variable that represents a Cells collection.

Parameters

Name | Required/Optional | Data Type | Description
NumRows | Optional | Variant | The number of rows that the cell or group of cells is to be split into.
NumColumns | Optional | Variant | The number of columns that the cell or group of cells is to be split into.
MergeBeforeSplit | Optional | Variant | True to merge the cells with one another before splitting them.

Example

This example merges the selected cells into a single cell and then splits the cell into three cells in the same row.

VBA Copy code Copy code
If Selection.Information(wdWithInTable) = True Then
 Selection.Cells.Split NumRows:=1, NumColumns:=3, _
 MergeBeforeSplit:= True
End If

See also

Concepts

Cells Collection Object

Other resources

Cells Object Members


Characters Object (Word)

 Copy code hover
[image]

Characters Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of characters in a selection, range, or document. There is no Character object; instead, each item in the Characters collection is a Range object that represents one character.

Remarks

Use the Characters property of a Document, Range, or Selection object to return the Characters collection. The following example displays how many characters are selected.

VBA Copy code Copy code
MsgBox Selection.Characters.Count & " characters are selected"

Use Characters(Index), where Index is the index number, to return a Range object that represents one character. The index number represents the position of a character in the Characters collection. The following example formats the first letter in the selection as 24-point bold.

VBA Copy code Copy code
With Selection.Characters(1)
 .Bold = True
 .Font.Size = 24
End With

Remarks

The Count property for this collection in a document returns the number of items in the main story only. To count items in other stories use the collection with the Range object.

There is no Add method for the Characters collection. Instead, use the InsertAfter or InsertBefore method to add characters to a Range object. The following example inserts a new paragraph after the first paragraph in the active document.

VBA Copy code Copy code
With ActiveDocument
 .Paragraphs(1).Range.InsertParagraphAfter
 .Paragraphs(2).Range.InsertBefore "New Text"
End With

See also

Concepts

Word Object Model Reference

Other resources

Characters Object Members


Characters Members (Word)

 Copy code hover
[image]

Characters Members (Word)
Send feedback

Published: July 16, 2012

A collection of characters in a selection, range, or document. There is no Character object; instead, each item in the Characters collection is a Range object that represents one character.

Methods

Name | Description
Item | Returns an individual Range object in a collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns the number of characters in the Characters collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
First | Returns a Range object that represents the first character in the collection.
Last | Returns a Range object that represents the last character in the collection.
Parent | Returns an Object that represents the parent object of the specified Characters object.


Characters Properties (Word)

 Copy code hover
[image]

Characters Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns the number of characters in the Characters collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
First | Returns a Range object that represents the first character in the collection.
Last | Returns a Range object that represents the last character in the collection.
Parent | Returns an Object that represents the parent object of the specified Characters object.


Characters.Application Property (Word)

 Copy code hover
[image]

Characters.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression A variable that represents a Characters collection.

See also

Concepts

Characters Collection Object

Other resources

Characters Object Members


Characters.Count Property (Word)

 Copy code hover
[image]

Characters.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the number of characters in the Characters collection. Read-only Long.

Syntax

expression .Count

expression A variable that represents a Characters collection.

See also

Concepts

Characters Collection Object

Other resources

Characters Object Members


Characters.Creator Property (Word)

 Copy code hover
[image]

Characters.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a Characters collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

Characters Collection Object

Other resources

Characters Object Members


Characters.First Property (Word)

 Copy code hover
[image]

Characters.First Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the first character in the collection.

Syntax

expression .First

expression Required. A variable that represents a Characters collection.

See also

Concepts

Characters Collection Object

Other resources

Characters Object Members


Characters.Last Property (Word)

 Copy code hover
[image]

Characters.Last Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the last character in the collection.

Syntax

expression .Last

expression Required. A variable that represents a Characters collection.

See also

Concepts

Characters Collection Object

Other resources

Characters Object Members


Characters.Parent Property (Word)

 Copy code hover
[image]

Characters.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Characters object.

Syntax

expression .Parent

expression A variable that represents a Characters collection.

See also

Concepts

Characters Collection Object

Other resources

Characters Object Members


Characters Methods (Word)

 Copy code hover
[image]

Characters Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Item | Returns an individual Range object in a collection.


Characters.Item Method (Word)

 Copy code hover
[image]

Characters.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual Range object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents a Characters collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The individual object to be returned. Can be a Long indicating the ordinal position of the individual object.

Return Value

Range

See also

Concepts

Characters Collection Object

Other resources

Characters Object Members


Chart Object (Word)

 Copy code hover
[image]

Chart Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a chart in a document.

Version Information

Version Added: Word 2007

Remarks

The Example section describes the following properties and methods for returning a Chart object:

  • The Chart property.

  • The AddChart method.

Example

The InlineShapes collection contains an object for each inline shape, including charts, in a document. Use InlineShapes(Index), where Index is the index number of an inline shape, to return a single InlineShape object. Use the HasChart property to determine whether the InlineShape object represents a chart. If the HasChart property is set to True, use the Chart property to return a Chart object.

You can also use the Type property to determine whether the InlineShape object represents a chart. If the Type property is set to WdInlineShapeChart, the inline shape represents a chart.

The following example verifies whether the first inline shape in the active document represents a chart. If so, the example changes the fore color of the first series on the chart.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.SeriesCollection(1).Format.Fill.ForeColor.RGB = rgbRed
 End If
End With

The following example creates a new 3-D column chart and adds it to the active document.

VBA Copy code Copy code
ActiveDocument.InlineShapes.AddChart Type:=xl3DColumn

See also

Concepts

Word Object Model Reference

Other resources

Chart Object Members


Chart Members (Word)

 Copy code hover
[image]

Chart Members (Word)
Send feedback

Published: July 16, 2012

Represents a chart in a document.

Methods

Name | Description
ApplyChartTemplate | Applies a standard or custom chart type to a chart.
ApplyDataLabels | Applies data labels to all the series in a chart.
ApplyLayout | Applies the layouts shown in the ribbon.
Axes | Returns a collection of axes on the chart.
ChartWizard | Modifies the properties of the given chart. You can use this method to quickly format a chart without setting all the individual properties. This method is noninteractive, and it changes only the specified properties.
ClearToMatchColorStyle | Clears all colors on the specified chart that do not follow the color style applied to the chart.
ClearToMatchStyle | Clears the chart elements formatting to automatic.
Copy | Not supported for this object.
CopyPicture | Copies the selected object to the Clipboard as a picture.
Delete | Deletes the object.
Export | Exports the chart in a graphic format.
FullSeriesCollection | Returns the collection of all the series in the specified chart, or the specified series.
GetChartElement | Returns information about the chart element at the specified x-coordinate and y-coordinate.
Paste | Pastes chart data from the Clipboard into the chart.
Refresh | Causes the specified chart to be redrawn immediately.
SaveChartTemplate | Saves a custom chart template to the list of available chart templates.
Select | Selects the object.
SeriesCollection | Returns all the series in the chart.
SetBackgroundPicture | Sets the background graphic for a chart.
SetDefaultChart | Specifies the name of the chart template that Microsoft Word uses when it creates new charts.
SetElement | Sets chart elements on a chart. Read/write MsoChartElementType.
SetSourceData | Sets the source data range for the chart.

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
AutoScaling | True if Microsoft Word scales a 3-D chart so that it is closer in size to the equivalent 2-D chart. The RightAngleAxes property must be True. Read/write Boolean.
BackWall | Returns an object that allows the user to individually format the back wall of a 3-D chart. Read-only Walls.
BarShape | Returns or sets the shape used for every series in a 3-D bar or column chart. Read/write XlBarShape.
CategoryLabelLevel | Returns or sets an XlCategoryLabel constant that specifies the source level of the chart category labels. Read-write.
ChartArea | Returns the complete chart area for the chart. Read-only ChartArea.
ChartColor | Returns or sets an integer that represents the color scheme for the chart. Read-write.
ChartData | Returns information about the linked or embedded data associated with a chart. Read-only ChartData.
ChartGroups | Returns an object that represents either a single chart group or a collection of all the chart groups in the chart.
ChartStyle | Returns or sets the chart style for the chart. Read/write Variant.
ChartTitle | Returns the title of the specified chart. Read-only ChartTitle.
ChartType | Returns or sets the chart type. Read/write XlChartType.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
DataTable | Returns the chart data table. Read-only DataTable.
DepthPercent | Returns or sets the depth of a 3-D chart as a percentage of the chart width (between 20 and 2000 percent). Read/write Long.
DisplayBlanksAs | Returns or sets the way that blank cells are plotted on a chart. Can be one of the XlDisplayBlanksAs constants. Read/write Long.
Elevation | Returns or sets the elevation, in degrees, of the 3-D chart view. Read/write Long.
Floor | Returns the floor of the 3-D chart. Read-only Floor.
GapDepth | Returns or sets the distance, as a percentage of the marker width, between the data series in a 3-D chart. Read/write Long.
HasAxis | Returns or sets which axes exist on the chart. Read/write Variant.
HasDataTable | True if the chart has a data table. Read/write Boolean.
HasLegend | True if the chart has a legend. Read/write Boolean.
HasTitle | True if the axis or chart has a visible title. Read/write Boolean.
HeightPercent | Returns or sets the height of a 3-D chart as a percentage of the chart width (from 5 through 500 percent). Read/write Long.
Legend | Returns the legend for the chart. Read-only Legend.
Parent | Returns the parent for the specified object. Read-only Object.
Perspective | Returns or sets the perspective for the 3-D chart view. Read/write Long.
PivotLayout | Not supported for this object.
PlotArea | Returns the plot area of a chart. Read-only PlotArea.
PlotBy | Returns or sets the way columns or rows are used as data series on the chart. Read/write Long.
PlotVisibleOnly | True if only visible cells are plotted. False if both visible and hidden cells are plotted. Read/write Boolean.
RightAngleAxes | True if the chart axes are at right angles, independent of chart rotation or elevation. Read/write Boolean.
Rotation | Returns or sets the rotation, in degrees, of the 3-D chart view (the rotation of the plot area around the z-axis). Read/write Variant.
SeriesNameLevel | Returns or sets an XlSeriesNameLevel constant that specifies the source level of the series names. Read-write.
Shapes | Returns a collection that represents all the shapes on the chart sheet. Read-only Shapes.
ShowAllFieldButtons | Returns or sets whether to display all field buttons on a PivotChart. Read/write. Deprecated.
ShowAxisFieldButtons | Returns or sets whether to display axis field buttons on a PivotChart. Read/write. Depcrecated.
ShowDataLabelsOverMaximum | Returns or sets a value that indicates whether to show the data labels when the value is greater than the maximum value on the value axis. Read/write Boolean.
ShowLegendFieldButtons | Returns or sets whether to display legend field buttons on a PivotChart. Read/write. Deprecated.
ShowReportFilterFieldButtons | Returns or sets whether to display the report filter field buttons on a PivotChart. Read/write. Deprecated.
ShowValueFieldButtons | Returns or sets whether to display the value field buttons on a PivotChart. Read/write. Deprecated.
SideWall | Returns a Walls object that allows the user to individually format the side wall of a 3-D chart. Read-only.
Walls | Returns the walls of the 3-D chart. Read-only Walls.


Chart Properties (Word)

 Copy code hover
[image]

Chart Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
AutoScaling | True if Microsoft Word scales a 3-D chart so that it is closer in size to the equivalent 2-D chart. The RightAngleAxes property must be True. Read/write Boolean.
BackWall | Returns an object that allows the user to individually format the back wall of a 3-D chart. Read-only Walls.
BarShape | Returns or sets the shape used for every series in a 3-D bar or column chart. Read/write XlBarShape.
CategoryLabelLevel | Returns or sets an XlCategoryLabel constant that specifies the source level of the chart category labels. Read-write.
ChartArea | Returns the complete chart area for the chart. Read-only ChartArea.
ChartColor | Returns or sets an integer that represents the color scheme for the chart. Read-write.
ChartData | Returns information about the linked or embedded data associated with a chart. Read-only ChartData.
ChartGroups | Returns an object that represents either a single chart group or a collection of all the chart groups in the chart.
ChartStyle | Returns or sets the chart style for the chart. Read/write Variant.
ChartTitle | Returns the title of the specified chart. Read-only ChartTitle.
ChartType | Returns or sets the chart type. Read/write XlChartType.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
DataTable | Returns the chart data table. Read-only DataTable.
DepthPercent | Returns or sets the depth of a 3-D chart as a percentage of the chart width (between 20 and 2000 percent). Read/write Long.
DisplayBlanksAs | Returns or sets the way that blank cells are plotted on a chart. Can be one of the XlDisplayBlanksAs constants. Read/write Long.
Elevation | Returns or sets the elevation, in degrees, of the 3-D chart view. Read/write Long.
Floor | Returns the floor of the 3-D chart. Read-only Floor.
GapDepth | Returns or sets the distance, as a percentage of the marker width, between the data series in a 3-D chart. Read/write Long.
HasAxis | Returns or sets which axes exist on the chart. Read/write Variant.
HasDataTable | True if the chart has a data table. Read/write Boolean.
HasLegend | True if the chart has a legend. Read/write Boolean.
HasTitle | True if the axis or chart has a visible title. Read/write Boolean.
HeightPercent | Returns or sets the height of a 3-D chart as a percentage of the chart width (from 5 through 500 percent). Read/write Long.
Legend | Returns the legend for the chart. Read-only Legend.
Parent | Returns the parent for the specified object. Read-only Object.
Perspective | Returns or sets the perspective for the 3-D chart view. Read/write Long.
PivotLayout | Not supported for this object.
PlotArea | Returns the plot area of a chart. Read-only PlotArea.
PlotBy | Returns or sets the way columns or rows are used as data series on the chart. Read/write Long.
PlotVisibleOnly | True if only visible cells are plotted. False if both visible and hidden cells are plotted. Read/write Boolean.
RightAngleAxes | True if the chart axes are at right angles, independent of chart rotation or elevation. Read/write Boolean.
Rotation | Returns or sets the rotation, in degrees, of the 3-D chart view (the rotation of the plot area around the z-axis). Read/write Variant.
SeriesNameLevel | Returns or sets an XlSeriesNameLevel constant that specifies the source level of the series names. Read-write.
Shapes | Returns a collection that represents all the shapes on the chart sheet. Read-only Shapes.
ShowAllFieldButtons | Returns or sets whether to display all field buttons on a PivotChart. Read/write. Deprecated.
ShowAxisFieldButtons | Returns or sets whether to display axis field buttons on a PivotChart. Read/write. Depcrecated.
ShowDataLabelsOverMaximum | Returns or sets a value that indicates whether to show the data labels when the value is greater than the maximum value on the value axis. Read/write Boolean.
ShowLegendFieldButtons | Returns or sets whether to display legend field buttons on a PivotChart. Read/write. Deprecated.
ShowReportFilterFieldButtons | Returns or sets whether to display the report filter field buttons on a PivotChart. Read/write. Deprecated.
ShowValueFieldButtons | Returns or sets whether to display the value field buttons on a PivotChart. Read/write. Deprecated.
SideWall | Returns a Walls object that allows the user to individually format the side wall of a 3-D chart. Read-only.
Walls | Returns the walls of the 3-D chart. Read-only Walls.


Chart.Application Property (Word)

 Copy code hover
[image]

Chart.Application Property (Word)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Application

expression A variable that represents a Chart object.

Example

The following example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveDocument
If myObject.Application.Value = "Microsoft Word" Then
 MsgBox "This is a Word Application object."
Else
 MsgBox "This is not a Word Application object."
End If

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.AutoScaling Property (Word)

 Copy code hover
[image]

Chart.AutoScaling Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word scales a 3-D chart so that it is closer in size to the equivalent 2-D chart. The RightAngleAxes property must be True. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .AutoScaling

expression A variable that represents a Chart object.

Example

The following example automatically scales the first chart in the active document. The example should be run on a 3-D chart.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.RightAngleAxes = True
 .Chart.AutoScaling = True
 End If
End With

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.BackWall Property (Word)

 Copy code hover
[image]

Chart.BackWall Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an object that allows the user to individually format the back wall of a 3-D chart. Read-only Walls.

Version Information

Version Added: Word 2007

Syntax

expression .BackWall

expression A variable that represents a Chart object.

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.BarShape Property (Word)

 Copy code hover
[image]

Chart.BarShape Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the shape used for every series in a 3-D bar or column chart. Read/write XlBarShape.

Version Information

Version Added: Word 2007

Syntax

expression .BarShape

expression A variable that represents a Chart object.

Example

The following example sets the shape used with the first series of the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.BarShape = xlConeToPoint
 End If
End With

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.CategoryLabelLevel Property (Word)

 Copy code hover
[image]

Chart.CategoryLabelLevel Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets an XlCategoryLabel constant that specifies the source level of the chart category labels. Read-write.

Version information

Version Added: Word 2013

Syntax

expression .CategoryLabelLevel

expression A variable that represents a Chart object.

Property value

XLCATEGORYLABELLEVEL

See also

Concepts

Chart Object

Other resources

Chart Members


Chart.ChartArea Property (Word)

 Copy code hover
[image]

Chart.ChartArea Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the complete chart area for the chart. Read-only ChartArea.

Version Information

Version Added: Word 2007

Syntax

expression .ChartArea

expression A variable that represents a Chart object.

Example

The following example sets the chart area interior color of the first chart in the active document to red and sets the border color to blue.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1).Chart.ChartArea
 .Interior.ColorIndex = 3
 .Border.ColorIndex = 5
End With

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.ChartColor Property (Word)

 Copy code hover
[image]

Chart.ChartColor Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets an integer that represents the color scheme for the chart. Read-write.

Version information

Version Added: Word 2013

Syntax

expression .ChartColor

expression A variable that represents a Chart object.

Remarks

Chart color schemes are numbered from 1 to 17; the setting of this property corresponds to the color schemes shown on the Change Colors gallery on the Chart Tools Design ribbon tab.

Property value

VARIANT

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.ChartData Property (Word)

 Copy code hover
[image]

Chart.ChartData Property (Word)
See also Send feedback

Published: July 16, 2012

Returns information about the linked or embedded data associated with a chart. Read-only ChartData.

Version Information

Version Added: Word 2007

Syntax

expression .ChartData

expression A variable that represents a Chart object.

Example

The following example uses the Activate method to display the data associated with the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1).Chart.ChartData
 .Activate
End With

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.ChartGroups Property (Word)

 Copy code hover
[image]

Chart.ChartGroups Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an object that represents either a single chart group or a collection of all the chart groups in the chart.

Version Information

Version Added: Word 2007

Syntax

expression .ChartGroups(Index)

expression A variable that represents a Chart object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Optional | Variant | The chart group number. If specified, a single ChartGroup object is returned. If omitted, a ChartGroups object, which contains a collection of every ChartGroup object for that chart, is returned.

Example

The following example enables up and down bars for the first chart group of the first chart, and then sets their colors. You should run this example on a 2-D line chart that contains two series that intersect at one or more data points.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1).Chart.ChartGroups(1)
 .HasUpDownBars = True
 .DownBars.Interior.ColorIndex = 3
 .UpBars.Interior.ColorIndex = 5
End With

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.ChartStyle Property (Word)

 Copy code hover
[image]

Chart.ChartStyle Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the chart style for the chart. Read/write Variant.

Version Information

Version Added: Word 2007

Syntax

expression .ChartStyle

expression A variable that represents a Chart object.

Remarks

You can use a number from 1 to 48 to set the chart style.

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.ChartTitle Property (Word)

 Copy code hover
[image]

Chart.ChartTitle Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the title of the specified chart. Read-only ChartTitle.

Version Information

Version Added: Word 2007

Syntax

expression .ChartTitle

expression A variable that represents a Chart object.

Remarks

The ChartTitle object does not exist and cannot be used unless the HasTitle property for the chart is True.

Example

The following example sets the text for the title of the first chart.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1).Chart
 .HasTitle = True
 .ChartTitle.Text = "First Quarter Sales"
End With

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.ChartType Property (Word)

 Copy code hover
[image]

Chart.ChartType Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the chart type. Read/write XlChartType.

Version Information

Version Added: Word 2007

Syntax

expression .ChartType

expression A variable that represents a Chart object.

Remarks

Some chart types are not available for PivotChart reports.

Example

The following example sets the bubble size in chart group one to 200% of the default size if the chart is a 2-D bubble chart.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1).Chart
 If .ChartType = xlBubble Then
 .ChartGroups(1).BubbleScale = 200
 End If
End With

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.Creator Property (Word)

 Copy code hover
[image]

Chart.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version Information

Version Added: Word 2007

Syntax

expression .Creator

expression A variable that represents a Chart object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Word has the creator code MSWD. For more information about this property, consult the language reference Help included with Microsoft Office for Mac.

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.DataTable Property (Word)

 Copy code hover
[image]

Chart.DataTable Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the chart data table. Read-only DataTable.

Version Information

Version Added: Word 2007

Syntax

expression .DataTable

expression A variable that represents a Chart object.

Example

The following example adds a data table with an outline border to the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.HasDataTable = True
 .Chart.DataTable.HasBorderOutline = True
 End If
End With

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.DepthPercent Property (Word)

 Copy code hover
[image]

Chart.DepthPercent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the depth of a 3-D chart as a percentage of the chart width (between 20 and 2000 percent). Read/write Long.

Version Information

Version Added: Word 2007

Syntax

expression .DepthPercent

expression A variable that represents a Chart object.

Remarks

This property applies only to 3-D charts.

Example

The following example sets the depth of the first chart in the active document to be 50 percent of its width. You should run this example on a 3-D chart.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 Chart.DepthPercent = 50
 End If
End With

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.DisplayBlanksAs Property (Word)

 Copy code hover
[image]

Chart.DisplayBlanksAs Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the way that blank cells are plotted on a chart. Can be one of the XlDisplayBlanksAs constants. Read/write Long.

Version Information

Version Added: Word 2007

Syntax

expression .DisplayBlanksAs

expression A variable that represents a Chart object.

Example

The following example sets Microsoft Word to not plot blank cells for the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.DisplayBlanksAs = xlNotPlotted
 End If
End With

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.Elevation Property (Word)

 Copy code hover
[image]

Chart.Elevation Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the elevation, in degrees, of the 3-D chart view. Read/write Long.

Version Information

Version Added: Word 2007

Syntax

expression .Elevation

expression A variable that represents a Chart object.

Remarks

The chart elevation is the height, in degrees, at which you view the chart. The default is 15 for most chart types. The value of this property must be between -90 and 90, except for 3-D bar charts, where it must be between 0 and 44.

Note Note

This property applies only to 3-D charts.

Example

The following example sets the chart elevation of the first chart in the active document to 34 degrees. You should run the example on a 3-D chart.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.Elevation = 34
 End If
End With

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.Floor Property (Word)

 Copy code hover
[image]

Chart.Floor Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the floor of the 3-D chart. Read-only Floor.

Version Information

Version Added: Word 2007

Syntax

expression .Floor

expression A variable that represents a Chart object.

Example

The following example sets the floor color of the first chart in the active document to blue. You should run the example on a 3-D chart (the Floor property fails on 2-D charts).

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.Floor.Interior.ColorIndex = 5
 End If
End With

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.GapDepth Property (Word)

 Copy code hover
[image]

Chart.GapDepth Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the distance, as a percentage of the marker width, between the data series in a 3-D chart. Read/write Long.

Version Information

Version Added: Word 2007

Syntax

expression .GapDepth

expression A variable that represents a Chart object.

Remarks

The value of this property must be between 0 and 500.

Note Note

This property applies only to 3-D charts.

Example

The following example sets the distance between the data series for the first chart in the active document to 200 percent of the marker width. You should run the example on a 3-D chart (the GapDepth property fails on 2-D charts).

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.GapDepth = 200
 End If
End With

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.HasAxis Property (Word)

 Copy code hover
[image]

Chart.HasAxis Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets which axes exist on the chart. Read/write Variant.

Version Information

Version Added: Word 2007

Syntax

expression .HasAxis(Index1, Index2)

expression A variable that represents a Chart object.

Parameters

Name | Required/Optional | Data Type | Description
Index1 | Optional | Variant | The axis type. Series axes apply only to 3-D charts. Can be one of the XlAxisType constants.
Index2 | Optional | Variant | The axis group. 3-D charts have only one set of axes. Can be one of the XlAxisGroup constants.

Remarks

You must enter a value for at least one of the parameters when you set this property.

Microsoft Word may create or delete axes if you change the chart type or the AxisGroup property.

Example

The following example enables the primary value axis for the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.HasAxis(xlValue, xlPrimary) = True
 End If
End With

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.HasDataTable Property (Word)

 Copy code hover
[image]

Chart.HasDataTable Property (Word)
See also Send feedback

Published: July 16, 2012

True if the chart has a data table. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .HasDataTable

expression A variable that represents a Chart object.

Example

The following example causes the embedded chart data table to be displayed with an outline border and no cell borders.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart
 .HasDataTable = True
 With .DataTable
 .HasBorderHorizontal = False
 .HasBorderVertical = False
 .HasBorderOutline = True
 End With
 End With
 End If
End With

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.HasLegend Property (Word)

 Copy code hover
[image]

Chart.HasLegend Property (Word)
See also Send feedback

Published: July 16, 2012

True if the chart has a legend. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .HasLegend

expression A variable that represents a Chart object.

Example

The following example enables the legend for the first chart in the active document and then sets the legend font color to blue.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart
 .HasLegend = True
 .Legend.Font.ColorIndex = 5
 End With
 End If
End With

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.HasTitle Property (Word)

 Copy code hover
[image]

Chart.HasTitle Property (Word)
See also Send feedback

Published: July 16, 2012

True if the axis or chart has a visible title. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .HasTitle

expression A variable that represents a Chart object.

Remarks

A chart title is represented by a ChartTitle object.

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.HeightPercent Property (Word)

 Copy code hover
[image]

Chart.HeightPercent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the height of a 3-D chart as a percentage of the chart width (from 5 through 500 percent). Read/write Long.

Version Information

Version Added: Word 2007

Syntax

expression .HeightPercent

expression A variable that represents a Chart object.

Example

The following example sets the height of the first chart in the active document to 80 percent of its width. You should run the example on a 3-D chart.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.HeightPercent = 80
 End If
End With

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.Legend Property (Word)

 Copy code hover
[image]

Chart.Legend Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the legend for the chart. Read-only Legend.

Version Information

Version Added: Word 2007

Syntax

expression .Legend

expression A variable that represents a Chart object.

Example

The following example enables the legend for the first chart in the active document and then sets the legend font color to blue.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart
 .HasLegend = True
 .Legend.Font.ColorIndex = 5
 End With
 End If
End With

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.Parent Property (Word)

 Copy code hover
[image]

Chart.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the parent for the specified object. Read-only Object.

Version Information

Version Added: Word 2007

Syntax

expression .Parent

expression A variable that represents a Chart object.

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.Perspective Property (Word)

 Copy code hover
[image]

Chart.Perspective Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the perspective for the 3-D chart view. Read/write Long.

Version Information

Version Added: Word 2007

Syntax

expression .Perspective

expression A variable that represents a Chart object.

Remarks

The value of this property must be between 0 and 100. This property is ignored if the RightAngleAxes property is set to True.

Example

The following example sets the perspective of the first chart in the active document to 70. You should run the example on a 3-D chart.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.RightAngleAxes = False
 .Chart.Perspective = 70
 End If
End With

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.PivotLayout Property (Word)

 Copy code hover
[image]

Chart.PivotLayout Property (Word)
See also Send feedback

Published: July 16, 2012

Not supported for this object.

Version Information

Version Added: Word 2007

Syntax

expression .PivotLayout

expression A variable that represents a Chart object.

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.PlotArea Property (Word)

 Copy code hover
[image]

Chart.PlotArea Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the plot area of a chart. Read-only PlotArea.

Version Information

Version Added: Word 2007

Syntax

expression .PlotArea

expression A variable that represents a Chart object.

Example

The following example sets the color of the plot area interior for the first chart in the active document to cyan.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.PlotArea.Interior.ColorIndex = 8
 End If
End With

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.PlotBy Property (Word)

 Copy code hover
[image]

Chart.PlotBy Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the way columns or rows are used as data series on the chart. Read/write Long.

Version Information

Version Added: Word 2007

Syntax

expression .PlotBy

expression A variable that represents a Chart object.

Remarks

The value of this property can be one of the following XlRowCol constants:

  • xlColumns

  • xlRows

For PivotChart reports, this property is read-only and always returns xlColumns.

Example

The following example causes the first chart in the active document to plot data by columns.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.PlotBy = xlColumns
 End If
End With

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.PlotVisibleOnly Property (Word)

 Copy code hover
[image]

Chart.PlotVisibleOnly Property (Word)
See also Send feedback

Published: July 16, 2012

True if only visible cells are plotted. False if both visible and hidden cells are plotted. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .PlotVisibleOnly

expression A variable that represents a Chart object.

Example

The following example causes Microsoft Word to plot only visible cells for the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.PlotVisibleOnly = True
 End If
End With

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.RightAngleAxes Property (Word)

 Copy code hover
[image]

Chart.RightAngleAxes Property (Word)
See also Send feedback

Published: July 16, 2012

True if the chart axes are at right angles, independent of chart rotation or elevation. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .RightAngleAxes

expression A variable that represents a Chart object.

Remarks

This property applies only to 3-D line, column, and bar charts.

If this property is set to True, the Perspective property is ignored.

Example

The following example sets the axes for the first chart in the active document to intersect at right angles. You should run the example on a 3-D chart.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.RightAngleAxes = True
 End If
End With

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.Rotation Property (Word)

 Copy code hover
[image]

Chart.Rotation Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the rotation, in degrees, of the 3-D chart view (the rotation of the plot area around the z-axis). Read/write Variant.

Version Information

Version Added: Word 2007

Syntax

expression .Rotation

expression A variable that represents a Chart object.

Remarks

The value of this property must be from 0 through 360, except for 3-D bar charts, where the value must be from 0 through 44. The default value is 20. This property applies only to 3-D charts.

Rotations are always rounded to the nearest integer.

Example

The following example sets the rotation of the first chart in the active document to 30 degrees. You should run the example on a 3-D chart.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.Rotation = 30
 End If
End With

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.SeriesNameLevel Property (Word)

 Copy code hover
[image]

Chart.SeriesNameLevel Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets an XlSeriesNameLevel constant that specifies the source level of the series names. Read-write.

Version information

Version Added: Word 2013

Syntax

expression .SeriesNameLevel

expression A variable that represents a Chart object.

Property value

XLSERIESNAMELEVEL

See also

Concepts

Chart Object

Other resources

Chart Members


Chart.Shapes Property (Word)

 Copy code hover
[image]

Chart.Shapes Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a collection that represents all the shapes on the chart sheet. Read-only Shapes.

Version Information

Version Added: Word 2007

Syntax

expression .Shapes

expression A variable that represents a Chart object.

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.ShowAllFieldButtons Property (Word)

 Copy code hover
[image]

Chart.ShowAllFieldButtons Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets whether to display all field buttons on a PivotChart. Read/write. Deprecated.

Version Information

Version Added: Word 2010

Syntax

expression .ShowAllFieldButtons

expression A variable that represents a Chart object.

Return Value

Boolean

Remarks

This object or member is part of the shared chart object model infrastructure between Microsoft Word, Excel, and PowerPoint and is not meant to be called directly from your code. Reading or setting this property causes a run-time error. In Word 2010, you cannot create a PivotChart and copying or pasting a valid PivotChart from Microsoft Excel to a Word document will convert the PivotChart to a Chart.

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.ShowAxisFieldButtons Property (Word)

 Copy code hover
[image]

Chart.ShowAxisFieldButtons Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets whether to display axis field buttons on a PivotChart. Read/write. Depcrecated.

Version Information

Version Added: Word 2010

Syntax

expression .ShowAxisFieldButtons

expression A variable that represents a Chart object.

Remarks

This object or member is part of the shared chart object model infrastructure between Microsoft Word, Excel, and PowerPoint and is not meant to be called directly from your code. Reading or setting this property causes a run-time error. In Word 2010, you cannot create a PivotChart and copying or pasting a valid PivotChart from Microsoft Excel to a Word document will convert the PivotChart to a Chart.

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.ShowDataLabelsOverMaximum Property (Word)

 Copy code hover
[image]

Chart.ShowDataLabelsOverMaximum Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a value that indicates whether to show the data labels when the value is greater than the maximum value on the value axis. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .ShowDataLabelsOverMaximum

expression A variable that represents a Chart object.

Remarks

If you change the value axis in such a way that it becomes smaller than the size of the data points, you can use this property to set a value that indicates whether to show the data labels. This property applies to 2-D charts only.

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.ShowLegendFieldButtons Property (Word)

 Copy code hover
[image]

Chart.ShowLegendFieldButtons Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets whether to display legend field buttons on a PivotChart. Read/write. Deprecated.

Version Information

Version Added: Word 2010

Syntax

expression .ShowLegendFieldButtons

expression A variable that represents a Chart object.

Remarks

This object or member is part of the shared chart object model infrastructure between Microsoft Word, Excel, and PowerPoint and is not meant to be called directly from your code. Reading or setting this property causes a run-time error. In Word 2010, you cannot create a PivotChart and copying or pasting a valid PivotChart from Microsoft Excel to a Word document will convert the PivotChart to a Chart.

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.ShowReportFilterFieldButtons Property (Word)

 Copy code hover
[image]

Chart.ShowReportFilterFieldButtons Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets whether to display the report filter field buttons on a PivotChart. Read/write. Deprecated.

Version Information

Version Added: Word 2010

Syntax

expression .ShowReportFilterFieldButtons

expression A variable that represents a Chart object.

Remarks

This object or member is part of the shared chart object model infrastructure between Microsoft Word, Excel, and PowerPoint and is not meant to be called directly from your code. Reading or setting this property causes a run-time error. In Word 2010, you cannot create a PivotChart and copying or pasting a valid PivotChart from Microsoft Excel to a Word document will convert the PivotChart to a Chart.

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.ShowValueFieldButtons Property (Word)

 Copy code hover
[image]

Chart.ShowValueFieldButtons Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets whether to display the value field buttons on a PivotChart. Read/write. Deprecated.

Version Information

Version Added: Word 2010

Syntax

expression .ShowValueFieldButtons

expression A variable that represents a Chart object.

Remarks

This object or member is part of the shared chart object model infrastructure between Microsoft Word, Excel, and PowerPoint and is not meant to be called directly from your code. Reading or setting this property causes a run-time error. In Word 2010, you cannot create a PivotChart and copying or pasting a valid PivotChart from Microsoft Excel to a Word document will convert the PivotChart to a Chart.

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.SideWall Property (Word)

 Copy code hover
[image]

Chart.SideWall Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Walls object that allows the user to individually format the side wall of a 3-D chart. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .SideWall

expression A variable that represents a Chart object.

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.Walls Property (Word)

 Copy code hover
[image]

Chart.Walls Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the walls of the 3-D chart. Read-only Walls.

Version Information

Version Added: Word 2007

Syntax

expression .Walls

expression A variable that represents a Chart object.

Example

The following example sets the color of the wall border of the first chart in the active document to red. You should run the example on a 3-D chart.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.Walls.Border. _
 ColorIndex = 3
 End If
End With

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart Methods (Word)

 Copy code hover
[image]

Chart Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
ApplyChartTemplate | Applies a standard or custom chart type to a chart.
ApplyDataLabels | Applies data labels to all the series in a chart.
ApplyLayout | Applies the layouts shown in the ribbon.
Axes | Returns a collection of axes on the chart.
ChartWizard | Modifies the properties of the given chart. You can use this method to quickly format a chart without setting all the individual properties. This method is noninteractive, and it changes only the specified properties.
ClearToMatchColorStyle | Clears all colors on the specified chart that do not follow the color style applied to the chart.
ClearToMatchStyle | Clears the chart elements formatting to automatic.
Copy | Not supported for this object.
CopyPicture | Copies the selected object to the Clipboard as a picture.
Delete | Deletes the object.
Export | Exports the chart in a graphic format.
FullSeriesCollection | Returns the collection of all the series in the specified chart, or the specified series.
GetChartElement | Returns information about the chart element at the specified x-coordinate and y-coordinate.
Paste | Pastes chart data from the Clipboard into the chart.
Refresh | Causes the specified chart to be redrawn immediately.
SaveChartTemplate | Saves a custom chart template to the list of available chart templates.
Select | Selects the object.
SeriesCollection | Returns all the series in the chart.
SetBackgroundPicture | Sets the background graphic for a chart.
SetDefaultChart | Specifies the name of the chart template that Microsoft Word uses when it creates new charts.
SetElement | Sets chart elements on a chart. Read/write MsoChartElementType.
SetSourceData | Sets the source data range for the chart.


Chart.ApplyChartTemplate Method (Word)

 Copy code hover
[image]

Chart.ApplyChartTemplate Method (Word)
See also Send feedback

Published: July 16, 2012

Applies a standard or custom chart type to a chart.

Version Information

Version Added: Word 2007

Syntax

expression .ApplyChartTemplate(FileName)

expression A variable that represents a Chart object.

Parameters

Name | Required/Optional | Data Type | Description
FileName | Required | String | The file name for a chart template.

Remarks

This method does not support taking constants for native or combination charts.

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.ApplyDataLabels Method (Word)

 Copy code hover
[image]

Chart.ApplyDataLabels Method (Word)
See also Send feedback

Published: July 16, 2012

Applies data labels to all the series in a chart.

Version Information

Version Added: Word 2007

Syntax

expression .ApplyDataLabels(Type, LegendKey, AutoText, HasLeaderLines, ShowSeriesName, ShowCategoryName, ShowValue, ShowPercentage, ShowBubbleSize, Separator)

expression A variable that represents a Chart object.

Parameters

Name | Required/Optional | Data Type | Description
Type | Optional | XlDataLabelsType | One of the enumeration values that specifies the type of data label to apply.
LegendKey | Optional | Variant | True to show the legend key next to the point. The default is False.
AutoText | Optional | Variant | True if the object automatically generates appropriate text based on content.
HasLeaderLines | Optional | Variant | For the Chart and Series objects, True if the series has leader lines.
ShowSeriesName | Optional | Variant | True to enable the series name for the data label; otherwise, False.
ShowCategoryName | Optional | Variant | True to enable the category name for the data label; otherwise, False.
ShowValue | Optional | Variant | True to enable the value for the data label; otherwise, False.
ShowPercentage | Optional | Variant | True to enable the percentage for the data label; otherwise, False.
ShowBubbleSize | Optional | Variant | True to enable the bubble size for the data label; otherwise, False.
Separator | Optional | Variant | The separator for the data label.

Remarks

The Type parameter can be one of the following XlDataLabelsType constants:

  • xlDataLabelsShowBubbleSizes—The bubble size for the data label.

  • xlDataLabelsShowLabelAndPercent—The percentage of the total, and the category for the point. Available only for pie charts and doughnut charts.

  • xlDataLabelsShowPercent—The percentage of the total. Available only for pie charts and doughnut charts.

  • xlDataLabelsShowLabel—The category for the point.

  • xlDataLabelsShowNone—No data labels.

  • xlDataLabelsShowValue—(Default) The value for the point (assumed if this argument is not specified).

Example

The following example applies category labels to the first series of the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.SeriesCollection(1). _
 ApplyDataLabels Type:=xlDataLabelsShowLabel
 End If
End With
Note Note

If you use a string for the Separator parameter, you will get a string as the separator. If you use xlDataLabelSeparatorDefault (= 1), you will get the default data label separator, which is either a comma or a newline, depending on the data label.
When a value of 1 is returned, it indicates that the user has not changed the default separator, which is a comma (,). You can also pass a value of 1 to change the separator back to the default separator.
The chart must first be active before you can access the data labels programmatically; otherwise, a run-time error occurs.

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.ApplyLayout Method (Word)

 Copy code hover
[image]

Chart.ApplyLayout Method (Word)
See also Send feedback

Published: July 16, 2012

Applies the layouts shown in the ribbon.

Version Information

Version Added: Word 2007

Syntax

expression .ApplyLayout(Layout, ChartType)

expression A variable that represents a Chart object.

Parameters

Name | Required/Optional | Data Type | Description
Layout | Required | Long | The type of layout. The type of layout is denoted by a number from 1 to 10.
ChartType | Optional | Variant | An XlChartType constant that represents the type of chart.

Remarks

When you use a layout on the current chart type, a number from 1 to 10 is applied to the chart type. You can also apply the layout of one chart type on another chart type. For example, you can apply the layouts that are available from a line chart to a column chart. The layout adds only chart elements that are available for that particular chart type.

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.Axes Method (Word)

 Copy code hover
[image]

Chart.Axes Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a collection of axes on the chart.

Version Information

Version Added: Word 2007

Syntax

expression .Axes(Type, AxisGroup)

expression A variable that represents a Chart object.

Parameters

Name

Required/Optional

Data Type

Description

Type

Optional

Variant

The axis to return. Can be one of the following XlAxisType constants: xlValue, xlCategory, or xlSeriesAxis (xlSeriesAxis is valid only for 3-D charts).

AxisGroup

Optional

XlAxisGroup

One of the enumeration values that specifies the axis group. The default is xlPrimary.

Note Note

3-D charts have only one axis group.

Return Value

An Axes object that contains the selected axes from the chart.

Example

The following example adds an axis label to the category axis for the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
    If .HasChart Then
        With .Chart.Axes(xlCategory)
            .HasTitle = True
            .AxisTitle.Text = "July Sales"
        End With
    End If
End With

The following example turns off major gridlines in the category axis for the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
    If .HasChart Then
        .Chart.Axes(xlCategory). _
            HasMajorGridlines = False
    End If
End With

The following example turns off all gridlines for all axes in the first chart of the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
    If .HasChart Then
        For Each a In .Chart.Axes
            a.HasMajorGridlines = False
            a.HasMinorGridlines = False
        Next
    End If
End With

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.ChartWizard Method (Word)

 Copy code hover
[image]

Chart.ChartWizard Method (Word)
See also Send feedback

Published: July 16, 2012

Modifies the properties of the given chart. You can use this method to quickly format a chart without setting all the individual properties. This method is noninteractive, and it changes only the specified properties.

Version Information

Version Added: Word 2007

Syntax

expression .ChartWizard(Source, Gallery, Format, PlotBy, CategoryLabels, SeriesLabels, HasLegend, Title, CategoryTitle, ValueTitle, ExtraTitle)

expression A variable that represents a Chart object.

Parameters

Name | Required/Optional | Data Type | Description
Source | Optional | Variant | The range that contains the source data for the new chart. If this argument is omitted, Microsoft Word edits the active chart sheet or the selected chart on the active worksheet.
Gallery | Optional | Variant | One of the XlChartType constants that specifies the chart type.
Format | Optional | Variant | The option number for the built-in autoformats. Can be a number from 1 through 10, depending on the gallery type. If this argument is omitted, Word chooses a default value based on the gallery type and data source.
PlotBy | Optional | Variant | Specifies whether the data for each series is in rows or columns. Can be one of the following XlRowCol constants: xlRows or xlColumns.
CategoryLabels | Optional | Variant | An integer that specifies the number of rows or columns within the source range that contain category labels. Allowed values are from 0 (zero) through one less than the maximum number of the corresponding categories or series.
SeriesLabels | Optional | Variant | An integer that specifies the number of rows or columns within the source range that contain series labels. Allowed values are from 0 (zero) through one less than the maximum number of the corresponding categories or series.
HasLegend | Optional | Variant | True to include a legend.
Title | Optional | Variant | The chart title text.
CategoryTitle | Optional | Variant | The category axis title text.
ValueTitle | Optional | Variant | The value axis title text.
ExtraTitle | Optional | Variant | The series axis title for 3-D charts or the second value axis title for 2-D charts.

Remarks

If the Source parameter is omitted and the selection is not a chart on the active document, this method fails and an error occurs.

Example

The following example reformats the first chart as a line chart, adds a legend, and adds category and value axis titles.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1).Chart
 .ChartWizard _
 Gallery:=xlLine, _
 HasLegend:=True, _
 CategoryTitle:="Year", _
 ValueTitle:="Sales"
End With

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.ClearToMatchColorStyle Method (Word)

 Copy code hover
[image]

Chart.ClearToMatchColorStyle Method (Word)
See also Send feedback

Published: July 16, 2012

Clears all colors on the specified chart that do not follow the color style applied to the chart.

Version information

Version Added: Word 2013

Syntax

expression .ClearToMatchColorStyle

expression A variable that represents a Chart object.

Return value

VOID

Remarks

Use this method to reset all the chart color formatting to the color style applied to the chart.

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.ClearToMatchStyle Method (Word)

 Copy code hover
[image]

Chart.ClearToMatchStyle Method (Word)
See also Send feedback

Published: July 16, 2012

Clears the chart elements formatting to automatic.

Version Information

Version Added: Word 2007

Syntax

expression .ClearToMatchStyle

expression A variable that represents a Chart object.

Remarks

Use this method to reset the chart elements formatting to automatic. If you use this method on a chart, all formatting (including overrides) will be reset.

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.Copy Method (Word)

 Copy code hover
[image]

Chart.Copy Method (Word)
See also Send feedback

Published: July 16, 2012

Not supported for this object.

Version Information

Version Added: Word 2007

Syntax

expression .Copy(Before, After)

expression A variable that represents a Chart object.

Parameters

Name | Required/Optional | Data Type | Description
Before | Optional | Variant | Not supported for this object.
After | Optional | Variant | Not supported for this object.

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.CopyPicture Method (Word)

 Copy code hover
[image]

Chart.CopyPicture Method (Word)
See also Send feedback

Published: July 16, 2012

Copies the selected object to the Clipboard as a picture.

Version Information

Version Added: Word 2007

Syntax

expression .CopyPicture(Appearance, Format, Size)

expression A variable that represents a Chart object.

Parameters

Name | Required/Optional | Data Type | Description
Appearance | Optional | XlPictureAppearance | One of the enumeration values that specifies how the picture should be copied. The default is xlScreen.
Format | Optional | XlCopyPictureFormat | One of the enumeration values that specifies the format of the picture. The default is xlPicture.
Size | Optional | XlPictureAppearance | One of the enumeration values that specifies the size of the copied picture when the object is a chart on a chart sheet (not embedded on a worksheet). The default is xlPrinter.

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.Delete Method (Word)

 Copy code hover
[image]

Chart.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Version Information

Version Added: Word 2007

Syntax

expression .Delete

expression A variable that represents a Chart object.

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.Export Method (Word)

 Copy code hover
[image]

Chart.Export Method (Word)
See also Send feedback

Published: July 16, 2012

Exports the chart in a graphic format.

Version Information

Version Added: Word 2007

Syntax

expression .Export(FileName, FilterName, Interactive)

expression A variable that represents a Chart object.

Parameters

Name | Required/Optional | Data Type | Description
FileName | Required | String | The name of the exported file.
FilterName | Optional | Variant | The language-independent name of the graphic filter as it appears in the registry.
Interactive | Optional | Variant | True to display the dialog box that contains the filter-specific options. False to indicate that Word should use the default values for the filter. The default is False.

Return Value

A Boolean value that indicates whether the export was successful.

Example

The following example exports the first chart in the active document as a GIF file.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.Export _
 FileName:="current_sales.gif", FilterName:="GIF"
 End If
End With

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.FullSeriesCollection Method (Word)

 Copy code hover
[image]

Chart.FullSeriesCollection Method (Word)
See also Send feedback

Published: July 16, 2012

Returns the collection of all the series in the specified chart, or the specified series.

Version information

Version Added: Word 2013

Syntax

expression .FullSeriesCollection(Index)

expression A variable that represents a Chart object.

Parameters

Name | Required/Optional | Data type | Description
Index | Optional | VARIANT | The index number in the series collection of the series to return.
Index | Optional | VARIANT |

Return value

OBJECT

See also

Concepts

Chart Object

Other resources

Chart Members


Chart.GetChartElement Method (Word)

 Copy code hover
[image]

Chart.GetChartElement Method (Word)
See also Send feedback

Published: July 16, 2012

Returns information about the chart element at the specified x-coordinate and y-coordinate.

Version Information

Version Added: Word 2007

Syntax

expression .GetChartElement(x, y, ElementID, Arg1, Arg2)

expression A variable that represents a Chart object.

Parameters

Name | Required/Optional | Data Type | Description
x | Required | Long | The x-coordinate of the chart element.
y | Required | Long | The y-coordinate of the chart element.
ElementID | Required | Long | When the method returns, this argument contains the XlChartItem value of the chart element at the specified coordinates. For more information, see the Remarks section.
Arg1 | Required | Long | When the method returns, this argument contains information related to the chart element. For more information, see the Remarks section.
Arg2 | Required | Long | When the method returns, this argument contains information related to the chart element. For more information, see the Remarks section.

Remarks

This method is unusual in that you specify values for only the first two arguments. Microsoft Word fills in the other arguments, and your code should examine those values when the method returns.

The value of ElementID after the method returns determines whether Arg1 and Arg2 contain any information, as shown in the following table.

ElementID Constant | Constant Value | Arg1 | Arg2
xlAxis | 21 | AxisIndex | AxisType
xlAxisTitle | 17 | AxisIndex | AxisType
xlDisplayUnitLabel | 30 | AxisIndex | AxisType
xlMajorGridlines | 15 | AxisIndex | AxisType
xlMinorGridlines | 16 | AxisIndex | AxisType
xlPivotChartDropZone | 32 | DropZoneType | None
xlPivotChartFieldButton | 31 | DropZoneType | None
xlDownBars | 20 | GroupIndex | None
xlDropLines | 26 | GroupIndex | None
xlHiLoLines | 25 | GroupIndex | None
xlRadarAxisLabels | 27 | GroupIndex | None
xlSeriesLines | 22 | GroupIndex | None
xlUpBars | 18 | GroupIndex | None
xlChartArea | 2 | None | None
xlChartTitle | 4 | None | None
xlCorners | 6 | None | None
xlDataTable | 7 | None | None
xlFloor | 23 | None | None
xlLeaderLines | 29 | None | None
xlLegend | 24 | None | None
xlNothing | 28 | None | None
xlPlotArea | 19 | None | None
xlWalls | 5 | None | None
xlDataLabel | 7 | SeriesIndex | PointIndex
xlErrorBars | 9 | SeriesIndex | None
xlLegendEntry | 12 | SeriesIndex | None
xlLegendKey | 13 | SeriesIndex | None
xlSeries | 3 | SeriesIndex | PointIndex
xlShape | 14 | ShapeIndex | None
xlTrendline | 8 | SeriesIndex | TrendLineIndex
xlXErrorBars | 10 | SeriesIndex | None
xlYErrorBars | 11 | SeriesIndex | None

The following table describes the meaning of Arg1 and Arg2 after the method returns.

Argument | Description
AxisIndex | Specifies whether the axis is primary or secondary. Can be one of the following XlAxisGroup constants: xlPrimary or xlSecondary.
AxisType | Specifies the axis type. Can be one of the following XlAxisType constants: xlCategory, xlSeriesAxis, or xlValue.
DropZoneType | Specifies the drop zone type: column, data, page, or row field. Can be one of the following XlPivotFieldOrientation constants: xlColumnField, xlDataField, xlPageField, or xlRowField. The column and row field constants specify the series and category fields, respectively.
GroupIndex | Specifies the offset within the ChartGroups collection for a specific chart group.
PointIndex | Specifies the offset within the Points collection for a specific point within a series. A value of -1 indicates that all data points are selected.
SeriesIndex | Specifies the offset within the Series collection for a specific series.
ShapeIndex | Specifies the offset within the Shapes collection for a specific shape.
TrendlineIndex | Specifies the offset within the Trendlines collection for a specific trendline within a series.

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.Paste Method (Word)

 Copy code hover
[image]

Chart.Paste Method (Word)
See also Send feedback

Published: July 16, 2012

Pastes chart data from the Clipboard into the chart.

Version Information

Version Added: Word 2007

Syntax

expression .Paste(Type)

expression A variable that represents a Chart object.

Parameters

Name

Required/Optional

Data Type

Description

Type

Optional

Variant

Specifies the chart information to paste if a chart is on the Clipboard. Can be one of the following values:

-4104 | Everything will be pasted. This is the default value.
-4122 | Copied source formats are pasted.
-4123 | Formulas are pasted.

Example

The following example activates the Microsoft Excel workbook associated with the first chart in the active document. If the Excel workbook has multiple windows, the example activates the first window. The example then copies the contents of cells B1 through B5 and pastes the cell contents into the chart.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.ChartData.Activate
 .Chart.ChartData.Workbook. _
 Worksheets("Sheet1").Range("B1:B5").Copy
 .Chart.Paste
 End If
End With

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.Refresh Method (Word)

 Copy code hover
[image]

Chart.Refresh Method (Word)
See also Send feedback

Published: July 16, 2012

Causes the specified chart to be redrawn immediately.

Version Information

Version Added: Word 2007

Syntax

expression .Refresh

expression A variable that represents a Chart object.

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.SaveChartTemplate Method (Word)

 Copy code hover
[image]

Chart.SaveChartTemplate Method (Word)
See also Send feedback

Published: July 16, 2012

Saves a custom chart template to the list of available chart templates.

Version Information

Version Added: Word 2007

Syntax

expression .SaveChartTemplate(FileName)

expression A variable that represents a Chart object.

Parameters

Name | Required/Optional | Data Type | Description
FileName | Required | String | The name of the chart template.

Remarks

By default, this method saves the active chart to the user's chart template directory. If a UNC or URL is specified, the chart will be saved to the specified location instead.

Example

The following example adds a new chart template based on the first chart of the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.SaveChartTemplate _
 FileName:="Presentation Chart"
 End If
End With

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.Select Method (Word)

 Copy code hover
[image]

Chart.Select Method (Word)
See also Send feedback

Published: July 16, 2012

Selects the object.

Version Information

Version Added: Word 2007

Syntax

expression .Select(Replace)

expression A variable that represents a Chart object.

Parameters

Name | Required/Optional | Data Type | Description
Replace | Optional | Variant | True to replace the current selection with the specified object. False to extend the current selection to include any previously selected objects and the specified object. This parameter is used only with sheets.

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.SeriesCollection Method (Word)

 Copy code hover
[image]

Chart.SeriesCollection Method (Word)
See also Send feedback

Published: July 16, 2012

Returns all the series in the chart.

Version Information

Version Added: Word 2007

Syntax

expression .SeriesCollection(Index)

expression A variable that represents a Chart object.

Return Value

A SeriesCollection object that represents all the series in the chart.

Example

The following example turns on data labels for series one of the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.SeriesCollection(1).HasDataLabels = True
 End If
End With

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.SetBackgroundPicture Method (Word)

 Copy code hover
[image]

Chart.SetBackgroundPicture Method (Word)
See also Send feedback

Published: July 16, 2012

Sets the background graphic for a chart.

Version Information

Version Added: Word 2007

Syntax

expression .SetBackgroundPicture(FileName)

expression A variable that represents a Chart object.

Parameters

Name | Required/Optional | Data Type | Description
FileName | Required | String | The name of the file for the graphic.

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.SetDefaultChart Method (Word)

 Copy code hover
[image]

Chart.SetDefaultChart Method (Word)
See also Send feedback

Published: July 16, 2012

Specifies the name of the chart template that Microsoft Word uses when it creates new charts.

Version Information

Version Added: Word 2007

Syntax

expression .SetDefaultChart(Name)

expression A variable that represents a Chart object.

Parameters

Name | Required/Optional | Data Type | Description
Name | Required | Variant | Specifies the name of the default chart template that Word uses when it creates new charts. This name can be set to either the name of a user-defined chart template in the gallery or a special XlChartGallery constant, xlBuiltIn, to specify a built-in chart template.

Example

The following example sets the default chart template to a custom chart template named "Monthly Sales."

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.SetDefaultChart Name:="Monthly Sales"
 End If
End With

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.SetElement Method (Word)

 Copy code hover
[image]

Chart.SetElement Method (Word)
See also Send feedback

Published: July 16, 2012

Sets chart elements on a chart. Read/write MsoChartElementType.

Version Information

Version Added: Word 2007

Syntax

expression .SetElement(Element)

expression A variable that represents a Chart object.

Parameters

Name | Required/Optional | Data Type | Description
Element | Required | MsoChartElementType | One of the enumeration values that specifies the chart element type.

Remarks

For charts, the following commands in the Layout tab correspond to the SetElement method:

  • Everything in the Labels group.

  • Everything in the Axes group.

  • Everything in the Analysis group.

  • PlotArea, Chart Wall, and Chart Floor buttons.

MsoChartElementType is an enumeration of constants that refer to all of the above commands.

Example

The following example sets chart elements by using the various constant values to an active chart.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart
 ' Select the major gridlines on the value axis.
 .Axes(xlValue).MajorGridlines.Select
 .SetElement msoElementChartTitleCenteredOverlay
 .SetElement msoElementPrimaryCategoryGridLinesMinor
 ' Select the walls.
 .Walls.Select
 .SetElement msoElementChartFloorShow
 End With
 End If
End With

See also

Concepts

Chart Object

Other resources

Chart Object Members


Chart.SetSourceData Method (Word)

 Copy code hover
[image]

Chart.SetSourceData Method (Word)
See also Send feedback

Published: July 16, 2012

Sets the source data range for the chart.

Version Information

Version Added: Word 2007

Syntax

expression .SetSourceData(Source, PlotBy)

expression A variable that represents a Chart object.

Parameters

Name | Required/Optional | Data Type | Description
Source | Required | String | The address of the chart data range that contains the source data.
PlotBy | Optional | Variant | Specifies the way the data will be plotted. Can be either of the following XlRowCol constants: xlColumns or xlRows.

Example

The following example sets the source data range for the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.SetSourceData _
 Source:="='Sheet1'!$A$1:$D$5", _
 PlotBy:=xlColumns
 End If
End With

See also

Concepts

Chart Object

Other resources

Chart Object Members


ChartArea Object (Word)

 Copy code hover
[image]

ChartArea Object (Word)
See also Send feedback

Published: July 16, 2012

Represents the chart area of a chart.

Version Information

Version Added: Word 2007

Remarks

The chart area includes everything, including the plot area. However, the PlotArea object has its own formatting, so formatting the plot area does not format the chart area.

Use the ChartArea property to return the ChartArea object.

Example

The following example turns off the border for the chart area in the first chart of the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1).Chart
 ChartArea.Format.Line.Visible = False
End With

See also

Concepts

Word Object Model Reference

Other resources

ChartArea Object Members


ChartArea Members (Word)

 Copy code hover
[image]

ChartArea Members (Word)
Send feedback

Published: July 16, 2012

Represents the chart area of a chart.

Methods

Name | Description
Clear | Clears the entire object.
ClearContents | Clears the data from a chart but leaves the formatting.
ClearFormats | Clears the formatting of the object.
Copy | Copies the object to the Clipboard.
Select | Selects the object.

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Format | Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.
Height | Returns or sets the height, in points, of the object. Read/write Double.
Left | Returns or sets the distance, in points, from the left edge of the object to the left edge of the chart area. Read/write Double.
Name | Returns the name of the object. Read-only String.
Parent | Returns the parent for the specified object. Read-only Object.
Shadow | Returns or sets a value that determines whether the object has a shadow. Read/write Boolean.
Top | Returns or sets the distance, in points, from the top edge of the object to the top of row 1 (on a worksheet) or the top of the chart area (on a chart). Read/write Double.
Width | Returns or sets the width, in points, of the object. Read/write Double.


ChartArea Properties (Word)

 Copy code hover
[image]

ChartArea Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Format | Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.
Height | Returns or sets the height, in points, of the object. Read/write Double.
Left | Returns or sets the distance, in points, from the left edge of the object to the left edge of the chart area. Read/write Double.
Name | Returns the name of the object. Read-only String.
Parent | Returns the parent for the specified object. Read-only Object.
Shadow | Returns or sets a value that determines whether the object has a shadow. Read/write Boolean.
Top | Returns or sets the distance, in points, from the top edge of the object to the top of row 1 (on a worksheet) or the top of the chart area (on a chart). Read/write Double.
Width | Returns or sets the width, in points, of the object. Read/write Double.


ChartArea.Application Property (Word)

 Copy code hover
[image]

ChartArea.Application Property (Word)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Application

expression A variable that represents a ChartArea object.

Example

The following example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveDocument
If myObject.Application.Value = "Microsoft Word" Then
 MsgBox "This is a Word Application object."
Else
 MsgBox "This is not a Word Application object."
End If

See also

Concepts

ChartArea Object

Other resources

ChartArea Object Members


ChartArea.Creator Property (Word)

 Copy code hover
[image]

ChartArea.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version Information

Version Added: Word 2007

Syntax

expression .Creator

expression A variable that represents a ChartArea object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Word has the creator code MSWD. For more information about this property, consult the language reference Help included with Microsoft Office for Mac.

See also

Concepts

ChartArea Object

Other resources

ChartArea Object Members


ChartArea.Format Property (Word)

 Copy code hover
[image]

ChartArea.Format Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.

Version Information

Version Added: Word 2007

Syntax

expression .Format

expression A variable that represents a ChartArea object.

See also

Concepts

ChartArea Object

Other resources

ChartArea Object Members


ChartArea.Height Property (Word)

 Copy code hover
[image]

ChartArea.Height Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the height, in points, of the object. Read/write Double.

Version Information

Version Added: Word 2007

Syntax

expression .Height

expression A variable that represents a ChartArea object.

See also

Concepts

ChartArea Object

Other resources

ChartArea Object Members


ChartArea.Left Property (Word)

 Copy code hover
[image]

ChartArea.Left Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the distance, in points, from the left edge of the object to the left edge of the chart area. Read/write Double.

Version Information

Version Added: Word 2007

Syntax

expression .Left

expression A variable that represents a ChartArea object.

See also

Concepts

ChartArea Object

Other resources

ChartArea Object Members


ChartArea.Name Property (Word)

 Copy code hover
[image]

ChartArea.Name Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the name of the object. Read-only String.

Version Information

Version Added: Word 2007

Syntax

expression .Name

expression A variable that represents a ChartArea object.

See also

Concepts

ChartArea Object

Other resources

ChartArea Object Members


ChartArea.Parent Property (Word)

 Copy code hover
[image]

ChartArea.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the parent for the specified object. Read-only Object.

Version Information

Version Added: Word 2007

Syntax

expression .Parent

expression A variable that represents a ChartArea object.

See also

Concepts

ChartArea Object

Other resources

ChartArea Object Members


ChartArea.Shadow Property (Word)

 Copy code hover
[image]

ChartArea.Shadow Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a value that determines whether the object has a shadow. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .Shadow

expression A variable that represents a ChartArea object.

See also

Concepts

ChartArea Object

Other resources

ChartArea Object Members


ChartArea.Top Property (Word)

 Copy code hover
[image]

ChartArea.Top Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the distance, in points, from the top edge of the object to the top of row 1 (on a worksheet) or the top of the chart area (on a chart). Read/write Double.

Version Information

Version Added: Word 2007

Syntax

expression .Top

expression A variable that represents a ChartArea object.

See also

Concepts

ChartArea Object

Other resources

ChartArea Object Members


ChartArea.Width Property (Word)

 Copy code hover
[image]

ChartArea.Width Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the width, in points, of the object. Read/write Double.

Version Information

Version Added: Word 2007

Syntax

expression .Width

expression A variable that represents a ChartArea object.

See also

Concepts

ChartArea Object

Other resources

ChartArea Object Members


ChartArea Methods (Word)

 Copy code hover
[image]

ChartArea Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Clear | Clears the entire object.
ClearContents | Clears the data from a chart but leaves the formatting.
ClearFormats | Clears the formatting of the object.
Copy | Copies the object to the Clipboard.
Select | Selects the object.


ChartArea.Clear Method (Word)

 Copy code hover
[image]

ChartArea.Clear Method (Word)
See also Send feedback

Published: July 16, 2012

Clears the entire object.

Version Information

Version Added: Word 2007

Syntax

expression .Clear

expression A variable that represents a ChartArea object.

Example

The following example clears the chart area (the chart data and formatting) of the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineGroups(1)
 If .HasChart Then
 .Chart.ChartArea.Clear
 End If
End With

See also

Concepts

ChartArea Object

Other resources

ChartArea Object Members


ChartArea.ClearContents Method (Word)

 Copy code hover
[image]

ChartArea.ClearContents Method (Word)
See also Send feedback

Published: July 16, 2012

Clears the data from a chart but leaves the formatting.

Version Information

Version Added: Word 2007

Syntax

expression .ClearContents

expression A variable that represents a ChartArea object.

Example

The following example clears the chart data from the first chart in the active document but leaves the formatting intact.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.ChartArea.ClearContents
 End If
End With

See also

Concepts

ChartArea Object

Other resources

ChartArea Object Members


ChartArea.ClearFormats Method (Word)

 Copy code hover
[image]

ChartArea.ClearFormats Method (Word)
See also Send feedback

Published: July 16, 2012

Clears the formatting of the object.

Version Information

Version Added: Word 2007

Syntax

expression .ClearFormats

expression A variable that represents a ChartArea object.

Example

The following example clears the formatting from the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.ChartArea.ClearFormats
 End If
End With

See also

Concepts

ChartArea Object

Other resources

ChartArea Object Members


ChartArea.Copy Method (Word)

 Copy code hover
[image]

ChartArea.Copy Method (Word)
See also Send feedback

Published: July 16, 2012

Copies the object to the Clipboard.

Version Information

Version Added: Word 2007

Syntax

expression .Copy

expression A variable that represents a ChartArea object.

See also

Concepts

ChartArea Object

Other resources

ChartArea Object Members


ChartArea.Select Method (Word)

 Copy code hover
[image]

ChartArea.Select Method (Word)
See also Send feedback

Published: July 16, 2012

Selects the object.

Version Information

Version Added: Word 2007

Syntax

expression .Select

expression A variable that represents a ChartArea object.

See also

Concepts

ChartArea Object

Other resources

ChartArea Object Members


ChartBorder Object (Word)

 Copy code hover
[image]

ChartBorder Object (Word)
See also Send feedback

Published: July 16, 2012

Represents the border of an object.

Version Information

Version Added: Word 2007

Remarks

Most bordered objects have a border that is treated as a single entity, regardless of how many sides it has. The entire border must be returned as a unit. To return a Border object, use the Border property for the particular bordered object (for example, the Border property of a TrendLine object).

Example

The following example changes the type and line style of a trendline on the active chart.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1).Chart.SeriesCollection(1).Trendlines(1)
 .Type = xlLinear
 .Border.LineStyle = xlDash
End With

See also

Concepts

Word Object Model Reference

Other resources

ChartBorder Object Members


ChartBorder Members (Word)

 Copy code hover
[image]

ChartBorder Members (Word)
Send feedback

Published: July 16, 2012

Represents the border of an object.

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
Color | Returns or sets the primary color of the object. Read/write Variant.
ColorIndex | Returns or sets the color of the border. Read/write Variant.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
LineStyle | Returns or sets the line style for the border. Read/write XlLineStyle, xlGray25, xlGray50, xlGray75, or xlAutomatic.
Parent | Returns the parent for the specified object. Read-only Object.
Weight | Returns or sets the weight of the border. Read/write XlBorderWeight.


ChartBorder Properties (Word)

 Copy code hover
[image]

ChartBorder Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
Color | Returns or sets the primary color of the object. Read/write Variant.
ColorIndex | Returns or sets the color of the border. Read/write Variant.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
LineStyle | Returns or sets the line style for the border. Read/write XlLineStyle, xlGray25, xlGray50, xlGray75, or xlAutomatic.
Parent | Returns the parent for the specified object. Read-only Object.
Weight | Returns or sets the weight of the border. Read/write XlBorderWeight.


ChartBorder.Application Property (Word)

 Copy code hover
[image]

ChartBorder.Application Property (Word)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Application

expression A variable that represents a ChartBorder object.

Example

The following example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveDocument
If myObject.Application.Value = "Microsoft Word" Then
 MsgBox "This is a Word Application object."
Else
 MsgBox "This is not a Word Application object."
End If

See also

Concepts

ChartBorder Object

Other resources

ChartBorder Object Members


ChartBorder.Color Property (Word)

 Copy code hover
[image]

ChartBorder.Color Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the primary color of the object. Read/write Variant.

Version Information

Version Added: Word 2007

Syntax

expression .Color

expression A variable that represents a ChartBorder object.

See also

Concepts

ChartBorder Object

Other resources

ChartBorder Object Members


ChartBorder.ColorIndex Property (Word)

 Copy code hover
[image]

ChartBorder.ColorIndex Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the color of the border. Read/write Variant.

Version Information

Version Added: Word 2007

Syntax

expression .ColorIndex

expression A variable that represents a ChartBorder object.

Remarks

The color is specified as an index value into the current color palette, or as one of the following XlColorIndex constants:

  • xlColorIndexAutomatic

  • xlColorIndexNone

Example

The following example sets the color of the major gridlines for the value axis of the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.Axes(xlValue)
 If .HasMajorGridlines Then
 ' Set the color to blue.
 .MajorGridlines.Border.ColorIndex = 5
 End If
 End With
 End If
End With

See also

Concepts

ChartBorder Object

Other resources

ChartBorder Object Members


ChartBorder.Creator Property (Word)

 Copy code hover
[image]

ChartBorder.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version Information

Version Added: Word 2007

Syntax

expression .Creator

expression A variable that represents a ChartBorder object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Word has the creator code MSWD. For more information about this property, consult the language reference Help included with Microsoft Office for Mac.

See also

Concepts

ChartBorder Object

Other resources

ChartBorder Object Members


ChartBorder.LineStyle Property (Word)

 Copy code hover
[image]

ChartBorder.LineStyle Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the line style for the border. Read/write XlLineStyle, xlGray25, xlGray50, xlGray75, or xlAutomatic.

Version Information

Version Added: Word 2007

Syntax

expression .LineStyle

expression A variable that represents a ChartBorder object.

Remarks

The xlDouble and xlSlantDashDot constants of the XlLineStyle enumeration do not apply to charts.

Example

The following example puts a border around the chart area and the plot area of the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart
 .ChartArea.Border.LineStyle = xlDashDot
 With .PlotArea.Border
 .LineStyle = xlDashDotDot
 .Weight = xlThick
 End With
 End With
 End If
End With

See also

Concepts

ChartBorder Object

Other resources

ChartBorder Object Members


ChartBorder.Parent Property (Word)

 Copy code hover
[image]

ChartBorder.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the parent for the specified object. Read-only Object.

Version Information

Version Added: Word 2007

Syntax

expression .Parent

expression A variable that represents a ChartBorder object.

See also

Concepts

ChartBorder Object

Other resources

ChartBorder Object Members


ChartBorder.Weight Property (Word)

 Copy code hover
[image]

ChartBorder.Weight Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the weight of the border. Read/write XlBorderWeight.

Version Information

Version Added: Word 2007

Syntax

expression .Weight

expression A variable that represents a ChartBorder object.

Example

The following example sets the border weight for the value axis of the first chart in the active document to medium.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.Axes(xlValue).Border.Weight = xlMedium
 End If
End With

See also

Concepts

ChartBorder Object

Other resources

ChartBorder Object Members


ChartCategory Object (Word)

 Copy code hover
[image]

ChartCategory Object (Word)
See also Send feedback

Published: July 16, 2012

Represents all chart categories in the document, whether visible (unfiltered) or not.

Version information

Version Added: Word 2013

Remarks

You can use the IsFiltered property to determine which categories are visible and which are filtered out.

See also

Other resources

ChartCategory Members


ChartCategory Members (Word)

 Copy code hover
[image]

ChartCategory Members (Word)
Send feedback

Published: July 16, 2012

Represents all chart categories in the document, whether visible (unfiltered) or not.

Properties

Name | Description
IsFiltered | Returns or sets a Boolean that determines whether the specified chart category is filtered out from the chart. Read-write.
Name | Returns or sets a String that represents the name of a chart category. Read/write.
Parent | Returns an Object that represents the parent object of the specified ChartCategory object.


ChartCategory Properties (Word)

 Copy code hover
[image]

ChartCategory Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
IsFiltered | Returns or sets a Boolean that determines whether the specified chart category is filtered out from the chart. Read-write.
Name | Returns or sets a String that represents the name of a chart category. Read/write.
Parent | Returns an Object that represents the parent object of the specified ChartCategory object.


ChartCategory.IsFiltered Property (Word)

 Copy code hover
[image]

ChartCategory.IsFiltered Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that determines whether the specified chart category is filtered out from the chart. Read-write.

Version information

Version Added: Word 2013

Syntax

expression .IsFiltered

expression A variable that represents a ChartCategory object.

Property value

BOOL

See also

Other resources

ChartCategory Object
ChartCategory Members


ChartCategory.Name Property (Word)

 Copy code hover
[image]

ChartCategory.Name Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a String that represents the name of a chart category. Read/write.

Version information

Version Added: Word 2013

Syntax

expression .Name

expression A variable that represents a ChartCategory object.

Property value

STRING

See also

Other resources

ChartCategory Object
ChartCategory Object Members


ChartCategory.Parent Property (Word)

 Copy code hover
[image]

ChartCategory.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified ChartCategory object.

Version information

Version Added: Word 2013

Syntax

expression .Parent

expression A variable that represents a ChartCategory object.

Property value

OBJECT

See also

Other resources

ChartCategory Object
ChartCategory Object Members


ChartCharacters Object (Word)

 Copy code hover
[image]

ChartCharacters Object (Word)
See also Send feedback

Published: July 16, 2012

Represents characters in an object that contains text.

Version Information

Version Added: Word 2007

Remarks

The ChartCharacters object lets you modify any sequence of characters contained in the full text string.

Use Characters(Start, Length), where Start is the start character number and Length is the number of characters, to return a ChartCharacters object.

Example

The Characters property is necessary only when you need to change some of an object's text without affecting the rest (you cannot use the Characters property to format a portion of the text if the object does not support rich text). To change all the text at the same time, you can usually apply the appropriate method or property directly to the object. The following example formats the contents of the chart title for the first chart in the active document as italic.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1).Chart
 .ChartTitle.Characters.Font.Italic = True
End With

See also

Concepts

Word Object Model Reference

Other resources

ChartCharacters Object Members


ChartCharacters Members (Word)

 Copy code hover
[image]

ChartCharacters Members (Word)
Send feedback

Published: July 16, 2012

Represents characters in an object that contains text.

Methods

Name | Description
Delete | Deletes the object.
Insert | Inserts a string preceding the selected characters.

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
Caption | Returns the text of this range of characters. Read-only String.
Count | Returns the number of objects in the collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Font | Returns the font of the specified object. Read-only ChartFont.
Parent | Returns the parent for the specified object. Read-only Object.
PhoneticCharacters | Returns or sets the phonetic text for the object. Read/write String.
Text | Returns or sets the text for the specified object. Read/write String.


ChartCharacters Properties (Word)

 Copy code hover
[image]

ChartCharacters Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
Caption | Returns the text of this range of characters. Read-only String.
Count | Returns the number of objects in the collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Font | Returns the font of the specified object. Read-only ChartFont.
Parent | Returns the parent for the specified object. Read-only Object.
PhoneticCharacters | Returns or sets the phonetic text for the object. Read/write String.
Text | Returns or sets the text for the specified object. Read/write String.


ChartCharacters.Application Property (Word)

 Copy code hover
[image]

ChartCharacters.Application Property (Word)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Application

expression A variable that represents a ChartCharacters object.

Example

The following example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveDocument
If myObject.Application.Value = "Microsoft Word" Then
 MsgBox "This is a Word Application object."
Else
 MsgBox "This is not a Word Application object."
End If

See also

Concepts

ChartCharacters Object

Other resources

ChartCharacters Object Members


ChartCharacters.Caption Property (Word)

 Copy code hover
[image]

ChartCharacters.Caption Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the text of this range of characters. Read-only String.

Version Information

Version Added: Word 2007

Syntax

expression .Caption

expression A variable that represents a ChartCharacters object.

See also

Concepts

ChartCharacters Object

Other resources

ChartCharacters Object Members


ChartCharacters.Count Property (Word)

 Copy code hover
[image]

ChartCharacters.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the number of objects in the collection. Read-only Long.

Version Information

Version Added: Word 2007

Syntax

expression .Count

expression A variable that represents a ChartCharacters object.

Example

The following example makes the last character a superscript character in the title of the first chart in the active document.

VBA Copy code Copy code
Sub MakeSuperscript()
 Dim n As Integer

 With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 n = .Chart.Title.Characters.Count
 .Chart.Title.Characters(n, 1).Font.Superscript = True
 End If
 End With
End Sub

See also

Concepts

ChartCharacters Object

Other resources

ChartCharacters Object Members


ChartCharacters.Creator Property (Word)

 Copy code hover
[image]

ChartCharacters.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version Information

Version Added: Word 2007

Syntax

expression .Creator

expression A variable that represents a ChartCharacters object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Word has the creator code MSWD. For more information about this property, consult the language reference Help included with Microsoft Office for Mac.

See also

Concepts

ChartCharacters Object

Other resources

ChartCharacters Object Members


ChartCharacters.Font Property (Word)

 Copy code hover
[image]

ChartCharacters.Font Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the font of the specified object. Read-only ChartFont.

Version Information

Version Added: Word 2007

Syntax

expression .Font

expression A variable that represents a ChartCharacters object.

See also

Concepts

ChartCharacters Object

Other resources

ChartCharacters Object Members


ChartCharacters.Parent Property (Word)

 Copy code hover
[image]

ChartCharacters.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the parent for the specified object. Read-only Object.

Version Information

Version Added: Word 2007

Syntax

expression .Parent

expression A variable that represents a ChartCharacters object.

See also

Concepts

ChartCharacters Object

Other resources

ChartCharacters Object Members


ChartCharacters.PhoneticCharacters Property (Word)

 Copy code hover
[image]

ChartCharacters.PhoneticCharacters Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the phonetic text for the object. Read/write String.

Version Information

Version Added: Word 2007

Syntax

expression .PhoneticCharacters

expression A variable that represents a ChartCharacters object.

Example

The following example replaces the first three characters in the title of the first chart in the active document with Furigana characters.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
    If .HasChart Then
        .Chart.Title.Characters(1,3).PhoneticCharacters = "フリガナ"
    End If
End With

See also

Concepts

ChartCharacters Object

Other resources

ChartCharacters Object Members


ChartCharacters.Text Property (Word)

 Copy code hover
[image]

ChartCharacters.Text Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the text for the specified object. Read/write String.

Version Information

Version Added: Word 2007

Syntax

expression .Text

expression A variable that represents a ChartCharacters object.

See also

Concepts

ChartCharacters Object

Other resources

ChartCharacters Object Members


ChartCharacters Methods (Word)

 Copy code hover
[image]

ChartCharacters Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the object.
Insert | Inserts a string preceding the selected characters.


ChartCharacters.Delete Method (Word)

 Copy code hover
[image]

ChartCharacters.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Version Information

Version Added: Word 2007

Syntax

expression .Delete

expression A variable that represents a ChartCharacters object.

See also

Concepts

ChartCharacters Object

Other resources

ChartCharacters Object Members


ChartCharacters.Insert Method (Word)

 Copy code hover
[image]

ChartCharacters.Insert Method (Word)
See also Send feedback

Published: July 16, 2012

Inserts a string preceding the selected characters.

Version Information

Version Added: Word 2007

Syntax

expression .Insert(String)

expression A variable that represents a ChartCharacters object.

Parameters

Name | Required/Optional | Data Type | Description
String | Required | String | The string to insert.

See also

Concepts

ChartCharacters Object

Other resources

ChartCharacters Object Members


ChartColorFormat Object (Word)

 Copy code hover
[image]

ChartColorFormat Object (Word)
See also Send feedback

Published: July 16, 2012

Represents the color of a one-color object or the foreground or background color of an object with a gradient or patterned fill.

Version Information

Version Added: Word 2007

See also

Concepts

Word Object Model Reference

Other resources

ChartColorFormat Object Members


ChartColorFormat Members (Word)

 Copy code hover
[image]

ChartColorFormat Members (Word)
Send feedback

Published: July 16, 2012

Represents the color of a one-color object or the foreground or background color of an object with a gradient or patterned fill.

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns the parent for the specified object. Read-only Object.
RGB | Returns the red-green-blue value of the specified color. Read-only Long.
SchemeColor | Returns or sets the index of a color in the current color scheme. Read/write Long.
Type | Returns the color format type. Read-only Long.


ChartColorFormat Properties (Word)

 Copy code hover
[image]

ChartColorFormat Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns the parent for the specified object. Read-only Object.
RGB | Returns the red-green-blue value of the specified color. Read-only Long.
SchemeColor | Returns or sets the index of a color in the current color scheme. Read/write Long.
Type | Returns the color format type. Read-only Long.


ChartColorFormat.Application Property (Word)

 Copy code hover
[image]

ChartColorFormat.Application Property (Word)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Application

expression A variable that represents a ChartColorFormat object.

Example

The following example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveDocument
If myObject.Application.Value = "Microsoft Word" Then
 MsgBox "This is a Word Application object."
Else
 MsgBox "This is not a Word Application object."
End If

See also

Concepts

ChartColorFormat Object

Other resources

ChartColorFormat Object Members


ChartColorFormat.Creator Property (Word)

 Copy code hover
[image]

ChartColorFormat.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version Information

Version Added: Word 2007

Syntax

expression .Creator

expression A variable that represents a ChartColorFormat object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD". This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Word has the creator code MSWD. For more information about this property, consult the language reference Help included with Microsoft Office for Mac.

See also

Concepts

ChartColorFormat Object

Other resources

ChartColorFormat Object Members


ChartColorFormat.Parent Property (Word)

 Copy code hover
[image]

ChartColorFormat.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the parent for the specified object. Read-only Object.

Version Information

Version Added: Word 2007

Syntax

expression .Parent

expression A variable that represents a ChartColorFormat object.

See also

Concepts

ChartColorFormat Object

Other resources

ChartColorFormat Object Members


ChartColorFormat.RGB Property (Word)

 Copy code hover
[image]

ChartColorFormat.RGB Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the red-green-blue value of the specified color. Read-only Long.

Version Information

Version Added: Word 2007

Syntax

expression .RGB

expression A variable that represents a ChartColorFormat object.

Example

The following example enables up and down bars, then adds a criss-cross pattern to the down bars and sets the pattern color to the chart area foreground fill color, for the first chart group of the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart
 .ChartGroups(1).HasUpDownBars = True
 .ChartGroups(1).DownBars.Interior.Pattern = xlPatternCrissCross
 .ChartGroups(1).DownBars.Interior.PatternColor = _
 .ChartArea.Fill.ForeColor.RGB
 End With
 End If
End With

See also

Concepts

ChartColorFormat Object

Other resources

ChartColorFormat Object Members


ChartColorFormat.SchemeColor Property (Word)

 Copy code hover
[image]

ChartColorFormat.SchemeColor Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the index of a color in the current color scheme. Read/write Long.

Version Information

Version Added: Word 2007

Syntax

expression .SchemeColor

expression A variable that represents a ChartColorFormat object.

Example

The following example sets the visibility, foreground color, background color, and gradient for the chart area fill of the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.ChartArea.Fill
 .Visible = True
 .ForeColor.SchemeColor = 15
 .BackColor.SchemeColor = 17
 .TwoColorGradient msoGradientHorizontal, 1
 End With
 End If
End With

See also

Concepts

ChartColorFormat Object

Other resources

ChartColorFormat Object Members


ChartColorFormat.Type Property (Word)

 Copy code hover
[image]

ChartColorFormat.Type Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the color format type. Read-only Long.

Version Information

Version Added: Word 2007

Syntax

expression .Type

expression A variable that represents a ChartColorFormat object.

Remarks

This property returns one of the following MsoColorType constants:

  • msoColorTypeRGB

  • msoColorTypeScheme

See also

Concepts

ChartColorFormat Object

Other resources

ChartColorFormat Object Members


ChartData Object (Word)

 Copy code hover
[image]

ChartData Object (Word)
See also Send feedback

Published: July 16, 2012

Represents access to the linked or embedded data associated with a chart.

Version Information

Version Added: Word 2007

Remarks

Use the ChartData property to return the ChartData object.

Example

The following example uses the Activate method to display the data associated with the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1).Chart.ChartData
 .Activate
End With

See also

Concepts

Word Object Model Reference

Other resources

ChartData Object Members


ChartData Members (Word)

 Copy code hover
[image]

ChartData Members (Word)
Send feedback

Published: July 16, 2012

Represents access to the linked or embedded data associated with a chart.

Methods

Name | Description
Activate | Activates the first window of the workbook associated with the chart.
ActivateChartDataWindow | Opens a Microsoft Excel 2013 data grid window that contains the full source data for the specified chart.
BreakLink | Removes the link between the data for a chart and a Microsoft Excel workbook.

Properties

Name | Description
IsLinked | True if the data for the chart is linked to an external Microsoft Excel workbook. Read-only Boolean.
Workbook | Returns the workbook that contains the chart data associated with the chart. Read-only Object.


ChartData Properties (Word)

 Copy code hover
[image]

ChartData Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
IsLinked | True if the data for the chart is linked to an external Microsoft Excel workbook. Read-only Boolean.
Workbook | Returns the workbook that contains the chart data associated with the chart. Read-only Object.


ChartData.IsLinked Property (Word)

 Copy code hover
[image]

ChartData.IsLinked Property (Word)
See also Send feedback

Published: July 16, 2012

True if the data for the chart is linked to an external Microsoft Excel workbook. Read-only Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .IsLinked

expression A variable that represents a ChartData object.

Remarks

Using the BreakLink method to remove the link to an Excel workbook sets this property to False.

Example

The following example verifies whether the data for the first chart in the active document is linked to an external Excel workbook. If the data for the chart is linked, the example then uses the BreakLink method to remove the link. If the data for the chart is not linked, the example uses the Activate method to display the embedded data for the chart.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.ChartData
 If .IsLinked Then
 .BreakLink
 Else
 .Activate
 End If
 End With
 End If
End With

See also

Concepts

ChartData Object

Other resources

ChartData Object Members


ChartData.Workbook Property (Word)

 Copy code hover
[image]

ChartData.Workbook Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the workbook that contains the chart data associated with the chart. Read-only Object.

Version Information

Version Added: Word 2007

Syntax

expression .Workbook

expression A variable that represents a ChartData object.

Remarks

Note Note

You must call the Activate method before referencing this property; otherwise, an error occurs.

Example

The following example activates the Microsoft Excel workbook associated with the first chart in the active document. If the Excel workbook has multiple windows, the example activates the first window. The example then copies the contents of cells B1 through B5 and pastes the cell contents into the chart.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.ChartData.Activate
 .Chart.ChartData.Workbook. _
 Worksheets("Sheet1").Range("B1:B5").Copy
 .Chart.Paste
 End If
End With

See also

Concepts

ChartData Object

Other resources

ChartData Object Members


ChartData Methods (Word)

 Copy code hover
[image]

ChartData Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Activate | Activates the first window of the workbook associated with the chart.
ActivateChartDataWindow | Opens a Microsoft Excel 2013 data grid window that contains the full source data for the specified chart.
BreakLink | Removes the link between the data for a chart and a Microsoft Excel workbook.


ChartData.Activate Method (Word)

 Copy code hover
[image]

ChartData.Activate Method (Word)
See also Send feedback

Published: July 16, 2012

Activates the first window of the workbook associated with the chart.

Version Information

Version Added: Word 2007

Syntax

expression .Activate

expression A variable that represents a ChartData object.

Remarks

If the chart is linked to a Microsoft Excel workbook, this method does not run any Auto_Activate or Auto_Deactivate macros that might be attached to the workbook (use the RunAutoMacros method to run those macros).

Note Note

You must call this method before referencing the Workbook property.

Example

The following example activates the Excel workbook associated with the first chart in the active document. If the Excel workbook has multiple windows, the example activates the first window. The example then copies the contents of cells B1 through B5 and pastes the cell contents into the chart.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.ChartData.Activate
 .Chart.ChartData.Workbook. _
 Worksheets("Sheet1").Range("B1:B5").Copy
 .Chart.Paste
 End If
End With

See also

Concepts

ChartData Object

Other resources

ChartData Object Members


ChartData.ActivateChartDataWindow Method (Word)

 Copy code hover
[image]

ChartData.ActivateChartDataWindow Method (Word)
Send feedback

Published: July 16, 2012

Opens a Microsoft Excel 2013 data grid window that contains the full source data for the specified chart.

Version information

Version Added: Word 2013

Syntax

expression .ActivateChartDataWindow

expression A variable that represents a ChartData object.

Return value

VOID

Remarks

If the data grid window is already open, this method has no effect.

The ActivateChartDataWindow method differs from the ChartData.Activate method in that the former opens the chart in an Excel window within Word, with the Excel ribbon unavailable, whereas the latter opens a full version of Excel, with the ribbon available.

Example

The following example shows how to activate the chart data window for the chart that is at the first index position in the collection of shapes in the active document.

VBA Copy code Copy code
Public Sub ActivateChartDataWindow_Example()

    ThisDocument.Shapes(1).Chart.ChartData.ActivateChartDataWindow

End Sub


ChartData.BreakLink Method (Word)

 Copy code hover
[image]

ChartData.BreakLink Method (Word)
See also Send feedback

Published: July 16, 2012

Removes the link between the data for a chart and a Microsoft Excel workbook.

Version Information

Version Added: Word 2007

Syntax

expression .BreakLink

expression A variable that represents a ChartData object.

Remarks

Calling this method sets the IsLinked property of the ChartData object to False.

Example

The following example removes the link between the ChartData object for the first chart in the active document and the Excel workbook that provided the data for the chart.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.ChartData.Activate
 .Chart.ChartData.BreakLink
 End If
End With

See also

Concepts

ChartData Object

Other resources

ChartData Object Members


ChartFont Object (Word)

 Copy code hover
[image]

ChartFont Object (Word)
See also Send feedback

Published: July 16, 2012

Contains the font attributes (font name, font size, color, and so on) for an object chart.

Version Information

Version Added: Word 2007

Remarks

If you do not want to format all the text in an AxisTitle, ChartTitle, DataLabel, or DisplayUnitLabel object the same way, use the Characters property of that object to first return a subset of the text as a ChartCharacters object. Then use the Font property of the ChartCharacters object to return a ChartFont object you can use to format the subset of text, as needed.

Example

The following example formats the title of the first chart as bold. Use the Font property to return the ChartFont object.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1).Chart
 .AxisTitle.Font.Bold = True
End With

See also

Concepts

Word Object Model Reference

Other resources

ChartFont Object Members


ChartFont Members (Word)

 Copy code hover
[image]

ChartFont Members (Word)
Send feedback

Published: July 16, 2012

Contains the font attributes (font name, font size, color, and so on) for an object chart.

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
Background | Returns or sets the type of background for text used in charts. Read/write Variant that is set to one of the constants of XlBackground.
Bold | True if the font is bold. Read/write Variant.
Color | Returns or sets the primary color of the object. Read/write Variant.
ColorIndex | Returns or sets the color of the font. Read/write Variant.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
FontStyle | Returns or sets the font style. Read/write String.
Italic | True if the font style is italic. Read/write Boolean.
Name | Returns or sets the name of the object. Read/write String.
Parent | Returns the parent for the specified object. Read-only Object.
Size | Returns or sets the size of the font. Read/write Variant.
StrikeThrough | True if the font is struck through with a horizontal line. Read/write Boolean.
Subscript | True if the font is formatted as subscript. The default is False. Read/write Variant.
Superscript | True if the font is formatted as superscript. The default is False. Read/write Variant.
Underline | Returns or sets the type of underline applied to the font. Can be one of the XlUnderlineStyle constants. Read/write Variant.


ChartFont Properties (Word)

 Copy code hover
[image]

ChartFont Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
Background | Returns or sets the type of background for text used in charts. Read/write Variant that is set to one of the constants of XlBackground.
Bold | True if the font is bold. Read/write Variant.
Color | Returns or sets the primary color of the object. Read/write Variant.
ColorIndex | Returns or sets the color of the font. Read/write Variant.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
FontStyle | Returns or sets the font style. Read/write String.
Italic | True if the font style is italic. Read/write Boolean.
Name | Returns or sets the name of the object. Read/write String.
Parent | Returns the parent for the specified object. Read-only Object.
Size | Returns or sets the size of the font. Read/write Variant.
StrikeThrough | True if the font is struck through with a horizontal line. Read/write Boolean.
Subscript | True if the font is formatted as subscript. The default is False. Read/write Variant.
Superscript | True if the font is formatted as superscript. The default is False. Read/write Variant.
Underline | Returns or sets the type of underline applied to the font. Can be one of the XlUnderlineStyle constants. Read/write Variant.


ChartFont.Application Property (Word)

 Copy code hover
[image]

ChartFont.Application Property (Word)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Application

expression A variable that represents a ChartFont object.

Example

The following example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveDocument
If myObject.Application.Value = "Microsoft Word" Then
 MsgBox "This is a Word Application object."
Else
 MsgBox "This is not a Word Application object."
End If

See also

Concepts

ChartFont Object

Other resources

ChartFont Object Members


ChartFont.Background Property (Word)

 Copy code hover
[image]

ChartFont.Background Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the type of background for text used in charts. Read/write Variant that is set to one of the constants of XlBackground.

Version Information

Version Added: Word 2007

Syntax

expression .Background

expression A variable that represents a ChartFont object.

Example

The following example adds a chart title to the first chart in the active document and then sets the font size and specifies a transparent background for the title.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart
 .HasTitle = True
 .ChartTitle.Text = "Rainfall Totals by Month"
 With .ChartTitle.Font
 .Size = 10
 .Background = xlBackgroundTransparent
 End With
 End With
 End If
End With

See also

Concepts

ChartFont Object

Other resources

ChartFont Object Members


ChartFont.Bold Property (Word)

 Copy code hover
[image]

ChartFont.Bold Property (Word)
See also Send feedback

Published: July 16, 2012

True if the font is bold. Read/write Variant.

Version Information

Version Added: Word 2007

Syntax

expression .Bold

expression A variable that represents a ChartFont object.

Example

The following example sets the font to bold for all characters in the chart title of the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.ChartTitle.Characters.Font.Bold = True
 End If
End With

See also

Concepts

ChartFont Object

Other resources

ChartFont Object Members


ChartFont.Color Property (Word)

 Copy code hover
[image]

ChartFont.Color Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the primary color of the object. Read/write Variant.

Version Information

Version Added: Word 2007

Syntax

expression .Color

expression A variable that represents a ChartFont object.

Example

The following example sets the color of the tick-mark labels on the value axis for the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 Chart.Axes(xlValue).TickLabels.Font.Color = _
 RGB(0, 255, 0)
 End If
End With

See also

Concepts

ChartFont Object

Other resources

ChartFont Object Members


ChartFont.ColorIndex Property (Word)

 Copy code hover
[image]

ChartFont.ColorIndex Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the color of the font. Read/write Variant.

Version Information

Version Added: Word 2007

Syntax

expression .ColorIndex

expression A variable that represents a ChartFont object.

Remarks

The color is specified as an index value into the current color palette, or as one of the following XlColorIndex constants:

  • xlColorIndexAutomatic

  • xlColorIndexNone

Example

The following example changes the font color in the title of the first chart in the active document to red.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.Title
 ' Set the color to red.
 .Font.ColorIndex = 3
 End If
 End With
 End If
End With

See also

Concepts

ChartFont Object

Other resources

ChartFont Object Members


ChartFont.Creator Property (Word)

 Copy code hover
[image]

ChartFont.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version Information

Version Added: Word 2007

Syntax

expression .Creator

expression A variable that represents a ChartFont object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD". This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Word has the creator code MSWD. For more information about this property, consult the language reference Help included with Microsoft Office for Mac.

See also

Concepts

ChartFont Object

Other resources

ChartFont Object Members


ChartFont.FontStyle Property (Word)

 Copy code hover
[image]

ChartFont.FontStyle Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the font style. Read/write String.

Version Information

Version Added: Word 2007

Syntax

expression .FontStyle

expression A variable that represents a ChartFont object.

Remarks

Changing this property may affect other ChartFont properties (such as Bold and Italic).

Example

The following example sets the font style for the title of the first chart in the active document to bold and italic.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.Title.Font.FontStyle = "Bold Italic"
 End If
End With

See also

Concepts

ChartFont Object

Other resources

ChartFont Object Members


ChartFont.Italic Property (Word)

 Copy code hover
[image]

ChartFont.Italic Property (Word)
See also Send feedback

Published: July 16, 2012

True if the font style is italic. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .Italic

expression A variable that represents a ChartFont object.

Example

The following example sets the font to italic for all characters in the title of the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.Title.Characters.Font.Italic = True
 End If
End With

See also

Concepts

ChartFont Object

Other resources

ChartFont Object Members


ChartFont.Name Property (Word)

 Copy code hover
[image]

ChartFont.Name Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the name of the object. Read/write String.

Version Information

Version Added: Word 2007

Syntax

expression .Name

expression A variable that represents a ChartFont object.

See also

Concepts

ChartFont Object

Other resources

ChartFont Object Members


ChartFont.Parent Property (Word)

 Copy code hover
[image]

ChartFont.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the parent for the specified object. Read-only Object.

Version Information

Version Added: Word 2007

Syntax

expression .Parent

expression A variable that represents a ChartFont object.

See also

Concepts

ChartFont Object

Other resources

ChartFont Object Members


ChartFont.Size Property (Word)

 Copy code hover
[image]

ChartFont.Size Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the size of the font. Read/write Variant.

Version Information

Version Added: Word 2007

Syntax

expression .Size

expression A variable that represents a ChartFont object.

Example

The following example sets the font size for the title of the first chart in the active document to 12 points.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.Title.Characters.Font.Size = 12
 End If
End With

See also

Concepts

ChartFont Object

Other resources

ChartFont Object Members


ChartFont.StrikeThrough Property (Word)

 Copy code hover
[image]

ChartFont.StrikeThrough Property (Word)
See also Send feedback

Published: July 16, 2012

True if the font is struck through with a horizontal line. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .StrikeThrough

expression A variable that represents a ChartFont object.

See also

Concepts

ChartFont Object

Other resources

ChartFont Object Members


ChartFont.Subscript Property (Word)

 Copy code hover
[image]

ChartFont.Subscript Property (Word)
See also Send feedback

Published: July 16, 2012

True if the font is formatted as subscript. The default is False. Read/write Variant.

Version Information

Version Added: Word 2007

Syntax

expression .Subscript

expression A variable that represents a ChartFont object.

See also

Concepts

ChartFont Object

Other resources

ChartFont Object Members


ChartFont.Superscript Property (Word)

 Copy code hover
[image]

ChartFont.Superscript Property (Word)
See also Send feedback

Published: July 16, 2012

True if the font is formatted as superscript. The default is False. Read/write Variant.

Version Information

Version Added: Word 2007

Syntax

expression .Superscript

expression A variable that represents a ChartFont object.

See also

Concepts

ChartFont Object

Other resources

ChartFont Object Members


ChartFont.Underline Property (Word)

 Copy code hover
[image]

ChartFont.Underline Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the type of underline applied to the font. Can be one of the XlUnderlineStyle constants. Read/write Variant.

Version Information

Version Added: Word 2007

Syntax

expression .Underline

expression A variable that represents a ChartFont object.

Example

The following example sets the font in the title of the first chart in the active document to single underline.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.ChartTitle.Font.Underline = xlUnderlineStyleSingle
 End If
End With

See also

Concepts

ChartFont Object

Other resources

ChartFont Object Members


ChartFormat Object (Word)

 Copy code hover
[image]

ChartFormat Object (Word)
See also Send feedback

Published: July 16, 2012

Provides access to the OfficeArt formatting for chart elements.

Version Information

Version Added: Word 2007

Remarks

Using a property or method that does not apply to the type of object the ChartFormat object is attached to will result in a run-time error.

See also

Concepts

Word Object Model Reference

Other resources

ChartFormat Object Members


ChartFormat Members (Word)

 Copy code hover
[image]

ChartFormat Members (Word)
Send feedback

Published: July 16, 2012

Provides access to the OfficeArt formatting for chart elements.

Properties

Name | Description
Adjustments | Returns an Adjustments object that contains a collection of adjustment values for the specified Chart Format object.
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
AutoShapeType | Returns or sets the auto shape type of the specified object. Read-write MSOAutoShapeType.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Fill | Returns a FillFormat object for the parent chart element that contains fill formatting properties for the chart element. Read-only.
Glow | Returns the glow formatting properties for the chart element. Read-only GlowFormat.
Line | Returns the line formatting properties for the specified chart element. Read-only LineFormat.
Parent | Returns the parent for the specified object. Read-only Object.
PictureFormat | Returns a PictureFormat object for a specified chart that contains pictures. Read-only.
Shadow | Returns shadow formatting properties for the chart element. Read-only ShadowFormat.
SoftEdge | Returns the soft edge formatting for a shape. Read-only SoftEdgeFormat.
TextFrame2 | Returns the text formatting for the specified chart element. Read-only TextFrame2.
ThreeD | Returns the 3-D-effect formatting properties for the specified chart. Read-only ThreeDFormat.


ChartFormat Properties (Word)

 Copy code hover
[image]

ChartFormat Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Adjustments | Returns an Adjustments object that contains a collection of adjustment values for the specified Chart Format object.
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
AutoShapeType | Returns or sets the auto shape type of the specified object. Read-write MSOAutoShapeType.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Fill | Returns a FillFormat object for the parent chart element that contains fill formatting properties for the chart element. Read-only.
Glow | Returns the glow formatting properties for the chart element. Read-only GlowFormat.
Line | Returns the line formatting properties for the specified chart element. Read-only LineFormat.
Parent | Returns the parent for the specified object. Read-only Object.
PictureFormat | Returns a PictureFormat object for a specified chart that contains pictures. Read-only.
Shadow | Returns shadow formatting properties for the chart element. Read-only ShadowFormat.
SoftEdge | Returns the soft edge formatting for a shape. Read-only SoftEdgeFormat.
TextFrame2 | Returns the text formatting for the specified chart element. Read-only TextFrame2.
ThreeD | Returns the 3-D-effect formatting properties for the specified chart. Read-only ThreeDFormat.


ChartFormat.Adjustments Property (Word)

 Copy code hover
[image]

ChartFormat.Adjustments Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Adjustments object that contains a collection of adjustment values for the specified Chart Format object.

Version information

Version Added: Word 2013

Syntax

expression .Adjustments

expression A variable that represents a ChartFormat object.

Property value

ADJUSTMENTS

See also

Concepts

ChartFormat Object

Other resources

ChartFormat Members


ChartFormat.Application Property (Word)

 Copy code hover
[image]

ChartFormat.Application Property (Word)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Application

expression A variable that represents a ChartFormat object.

Example

The following example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveDocument
If myObject.Application.Value = "Microsoft Word" Then
 MsgBox "This is a Word Application object."
Else
 MsgBox "This is not a Word Application object."
End If

See also

Concepts

ChartFormat Object

Other resources

ChartFormat Object Members


ChartFormat.AutoShapeType Property (Word)

 Copy code hover
[image]

ChartFormat.AutoShapeType Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the auto shape type of the specified object. Read-write MSOAutoShapeType.

Version information

Version Added: Word 2013

Syntax

expression .AutoShapeType

expression A variable that represents a ChartFormat object.

Property value

MSOAUTOSHAPETYPE

See also

Concepts

ChartFormat Object

Other resources

ChartFormat Members


ChartFormat.Creator Property (Word)

 Copy code hover
[image]

ChartFormat.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version Information

Version Added: Word 2007

Syntax

expression .Creator

expression A variable that represents a ChartFormat object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD". This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Word has the creator code MSWD. For more information about this property, consult the language reference Help included with Microsoft Office for Mac.

See also

Concepts

ChartFormat Object

Other resources

ChartFormat Object Members


ChartFormat.Fill Property (Word)

 Copy code hover
[image]

ChartFormat.Fill Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a FillFormat object for the parent chart element that contains fill formatting properties for the chart element. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Fill

expression A variable that represents a ChartFormat object.

See also

Concepts

ChartFormat Object

Other resources

ChartFormat Object Members


ChartFormat.Glow Property (Word)

 Copy code hover
[image]

ChartFormat.Glow Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the glow formatting properties for the chart element. Read-only GlowFormat.

Version Information

Version Added: Word 2007

Syntax

expression .Glow

expression A variable that represents a ChartFormat object.

Remarks

The glow effect adds a vibrant colored edge to graphics.

See also

Concepts

ChartFormat Object

Other resources

ChartFormat Object Members


ChartFormat.Line Property (Word)

 Copy code hover
[image]

ChartFormat.Line Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the line formatting properties for the specified chart element. Read-only LineFormat.

Version Information

Version Added: Word 2007

Syntax

expression .Line

expression A variable that represents a ChartFormat object.

Remarks

For a line, the LineFormat object represents the line itself; for a chart with a border, the LineFormat object represents the border.

See also

Concepts

ChartFormat Object

Other resources

ChartFormat Object Members


ChartFormat.Parent Property (Word)

 Copy code hover
[image]

ChartFormat.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the parent for the specified object. Read-only Object.

Version Information

Version Added: Word 2007

Syntax

expression .Parent

expression A variable that represents a ChartFormat object.

See also

Concepts

ChartFormat Object

Other resources

ChartFormat Object Members


ChartFormat.PictureFormat Property (Word)

 Copy code hover
[image]

ChartFormat.PictureFormat Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a PictureFormat object for a specified chart that contains pictures. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .PictureFormat

expression A variable that represents a ChartFormat object.

See also

Concepts

ChartFormat Object

Other resources

ChartFormat Object Members


ChartFormat.Shadow Property (Word)

 Copy code hover
[image]

ChartFormat.Shadow Property (Word)
See also Send feedback

Published: July 16, 2012

Returns shadow formatting properties for the chart element. Read-only ShadowFormat.

Version Information

Version Added: Word 2007

Syntax

expression .Shadow

expression A variable that represents a ChartFormat object.

See also

Concepts

ChartFormat Object

Other resources

ChartFormat Object Members


ChartFormat.SoftEdge Property (Word)

 Copy code hover
[image]

ChartFormat.SoftEdge Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the soft edge formatting for a shape. Read-only SoftEdgeFormat.

Version Information

Version Added: Word 2007

Syntax

expression .SoftEdge

expression A variable that represents a ChartFormat object.

See also

Concepts

ChartFormat Object

Other resources

ChartFormat Object Members


ChartFormat.TextFrame2 Property (Word)

 Copy code hover
[image]

ChartFormat.TextFrame2 Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the text formatting for the specified chart element. Read-only TextFrame2.

Version Information

Version Added: Word 2007

Syntax

expression .TextFrame2

expression A variable that represents a ChartFormat object.

See also

Concepts

ChartFormat Object

Other resources

ChartFormat Object Members


ChartFormat.ThreeD Property (Word)

 Copy code hover
[image]

ChartFormat.ThreeD Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the 3-D-effect formatting properties for the specified chart. Read-only ThreeDFormat.

Version Information

Version Added: Word 2007

Syntax

expression .ThreeD

expression A variable that represents a ChartFormat object.

See also

Concepts

ChartFormat Object

Other resources

ChartFormat Object Members


ChartGroup Object (Word)

 Copy code hover
[image]

ChartGroup Object (Word)
See also Send feedback

Published: July 16, 2012

Represents one or more series plotted in a chart with the same format.

Version Information

Version Added: Word 2007

Remarks

A chart contains one or more chart groups, each chart group contains one or more Series objects, and each series contains one or more Points objects. For example, a single chart might contain both a line chart group, which contains all the series plotted with the line chart format, and a bar chart group, which contains all the series plotted with the bar chart format. The ChartGroup object is a member of the ChartGroups collection.

Use ChartGroups(Index), where index is the chart group index number, to return a single ChartGroup object.

Example

The following example adds drop lines to the first chart group of the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1).Chart
 .ChartGroups(1).HasDropLines = True
End With

See also

Concepts

Word Object Model Reference

Other resources

ChartGroup Object Members


ChartGroup Members (Word)

 Copy code hover
[image]

ChartGroup Members (Word)
Send feedback

Published: July 16, 2012

Represents one or more series plotted in a chart with the same format.

Methods

Name | Description
CategoryCollection | Returns all the visible categories in the chart group, or the specified visible category.
FullCategoryCollection | Returns all the categories in the chart group, or the specified category, whether visible or filtered out.
SeriesCollection | Returns all the series in the chart group.

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
AxisGroup | Returns the type of axis group. Read/write XlAxisGroup.
BubbleScale | Returns or sets the scale factor for bubbles in the specified chart group. Read/write Long.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
DoughnutHoleSize | Returns or sets the size of the hole in a doughnut chart group. Read/write Long.
DownBars | Returns the down bars on a line chart. Read-only DownBars.
DropLines | Returns the drop lines for a series on a line chart or area chart. Read-only DropLines.
FirstSliceAngle | Returns or sets the angle, in degrees (clockwise from vertical), of the first pie-chart or doughnut-chart slice. Read/write Long.
GapWidth | For bar and column charts, returns or sets the space, as a percentage of the bar or column width, between bar or column clusters. For pie-of-pie and bar-of-pie charts, returns or sets the space between the primary and secondary sections of the chart. Read/write Long.
Has3DShading | True if a chart group has three-dimensional shading. Read/write Boolean.
HasDropLines | True if the line chart or area chart has drop lines. Read/write Boolean.
HasHiLoLines | True if the line chart has high-low lines. Read/write Boolean.
HasRadarAxisLabels | True if a radar chart has axis labels. Read/write Boolean.
HasSeriesLines | True if a stacked column chart or bar chart has series lines or if a pie-of-pie chart or bar-of-pie chart has connector lines between the two sections. Read/write Boolean.
HasUpDownBars | True if a line chart has up and down bars. Read/write Boolean.
HiLoLines | Returns the high-low lines for a series on a line chart. Read-only HiLoLines.
Index | Returns the index number of the object within the collection of similar objects. Read-only Long.
Overlap | Specifies how bars and columns are positioned. Read/write Long.
Parent | Returns the parent for the specified object. Read-only Object.
RadarAxisLabels | Returns the radar axis labels for the specified chart group. Read-only TickLabels.
SecondPlotSize | Returns or sets the size, as a percentage of the primary pie, of the secondary section of either a pie-of-pie chart or a bar-of-pie chart. Read/write Long.
SeriesLines | Returns the series lines for a 2-D stacked bar, 2-D stacked column, pie-of-pie, or bar-of-pie chart. Read-only SeriesLines.
ShowNegativeBubbles | True if negative bubbles are shown for the chart group. Read/write Boolean.
SizeRepresents | Returns or sets what the bubble size represents on a bubble chart. Read/write Long.
SplitType | Returns or sets the way the two sections of either a pie-of-pie chart or a bar-of-pie chart are split. Read/write XlChartSplitType.
SplitValue | Returns or sets the threshold value separating the two sections of either a pie-of-pie chart or a bar-of-pie chart. Read/write Variant.
UpBars | Returns the up bars on a line chart. Read-only UpBars.
VaryByCategories | True if Microsoft Word assigns a different color or pattern to each data marker. Read/write Boolean.


ChartGroup Properties (Word)

 Copy code hover
[image]

ChartGroup Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
AxisGroup | Returns the type of axis group. Read/write XlAxisGroup.
BubbleScale | Returns or sets the scale factor for bubbles in the specified chart group. Read/write Long.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
DoughnutHoleSize | Returns or sets the size of the hole in a doughnut chart group. Read/write Long.
DownBars | Returns the down bars on a line chart. Read-only DownBars.
DropLines | Returns the drop lines for a series on a line chart or area chart. Read-only DropLines.
FirstSliceAngle | Returns or sets the angle, in degrees (clockwise from vertical), of the first pie-chart or doughnut-chart slice. Read/write Long.
GapWidth | For bar and column charts, returns or sets the space, as a percentage of the bar or column width, between bar or column clusters. For pie-of-pie and bar-of-pie charts, returns or sets the space between the primary and secondary sections of the chart. Read/write Long.
Has3DShading | True if a chart group has three-dimensional shading. Read/write Boolean.
HasDropLines | True if the line chart or area chart has drop lines. Read/write Boolean.
HasHiLoLines | True if the line chart has high-low lines. Read/write Boolean.
HasRadarAxisLabels | True if a radar chart has axis labels. Read/write Boolean.
HasSeriesLines | True if a stacked column chart or bar chart has series lines or if a pie-of-pie chart or bar-of-pie chart has connector lines between the two sections. Read/write Boolean.
HasUpDownBars | True if a line chart has up and down bars. Read/write Boolean.
HiLoLines | Returns the high-low lines for a series on a line chart. Read-only HiLoLines.
Index | Returns the index number of the object within the collection of similar objects. Read-only Long.
Overlap | Specifies how bars and columns are positioned. Read/write Long.
Parent | Returns the parent for the specified object. Read-only Object.
RadarAxisLabels | Returns the radar axis labels for the specified chart group. Read-only TickLabels.
SecondPlotSize | Returns or sets the size, as a percentage of the primary pie, of the secondary section of either a pie-of-pie chart or a bar-of-pie chart. Read/write Long.
SeriesLines | Returns the series lines for a 2-D stacked bar, 2-D stacked column, pie-of-pie, or bar-of-pie chart. Read-only SeriesLines.
ShowNegativeBubbles | True if negative bubbles are shown for the chart group. Read/write Boolean.
SizeRepresents | Returns or sets what the bubble size represents on a bubble chart. Read/write Long.
SplitType | Returns or sets the way the two sections of either a pie-of-pie chart or a bar-of-pie chart are split. Read/write XlChartSplitType.
SplitValue | Returns or sets the threshold value separating the two sections of either a pie-of-pie chart or a bar-of-pie chart. Read/write Variant.
UpBars | Returns the up bars on a line chart. Read-only UpBars.
VaryByCategories | True if Microsoft Word assigns a different color or pattern to each data marker. Read/write Boolean.


ChartGroup.Application Property (Word)

 Copy code hover
[image]

ChartGroup.Application Property (Word)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Application

expression A variable that represents a ChartGroup object.

Example

The following example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveDocument
If myObject.Application.Value = "Microsoft Word" Then
 MsgBox "This is a Word Application object."
Else
 MsgBox "This is not a Word Application object."
End If

See also

Concepts

ChartGroup Object

Other resources

ChartGroup Object Members


ChartGroup.AxisGroup Property (Word)

 Copy code hover
[image]

ChartGroup.AxisGroup Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the type of axis group. Read/write XlAxisGroup.

Version Information

Version Added: Word 2007

Syntax

expression .AxisGroup

expression A variable that represents a ChartGroup object.

See also

Concepts

ChartGroup Object

Other resources

ChartGroup Object Members


ChartGroup.BubbleScale Property (Word)

 Copy code hover
[image]

ChartGroup.BubbleScale Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the scale factor for bubbles in the specified chart group. Read/write Long.

Version Information

Version Added: Word 2007

Syntax

expression .BubbleScale

expression A variable that represents a ChartGroup object.

Remarks

You can set this property to an integer from 0 (zero) through 300, corresponding to a percentage of the default size.

Note Note

This property applies only to bubble charts.

Example

The following example sets the bubble size in the first chart group of the first chart in the active document to 200 percent of the default size.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.ChartGroups(1).BubbleScale = 200
 End If
End With

See also

Concepts

ChartGroup Object

Other resources

ChartGroup Object Members


ChartGroup.Creator Property (Word)

 Copy code hover
[image]

ChartGroup.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version Information

Version Added: Word 2007

Syntax

expression .Creator

expression A variable that represents a ChartGroup object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD". This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Word has the creator code MSWD. For more information about this property, consult the language reference Help included with Microsoft Office for Mac.

See also

Concepts

ChartGroup Object

Other resources

ChartGroup Object Members


ChartGroup.DoughnutHoleSize Property (Word)

 Copy code hover
[image]

ChartGroup.DoughnutHoleSize Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the size of the hole in a doughnut chart group. Read/write Long.

Version Information

Version Added: Word 2007

Syntax

expression .DoughnutHoleSize

expression A variable that represents a ChartGroup object.

Remarks

The hole size is expressed as a percentage of the chart size, from 10 through 90 percent.

Example

The following example sets the hole size for doughnut group one of the first chart in the active document. You should run the example on a 2-D doughnut chart.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.DoughnutGroups(1).DoughnutHoleSize = 10
 End If
End With

See also

Concepts

ChartGroup Object

Other resources

ChartGroup Object Members


ChartGroup.DownBars Property (Word)

 Copy code hover
[image]

ChartGroup.DownBars Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the down bars on a line chart. Read-only DownBars.

Version Information

Version Added: Word 2007

Syntax

expression .DownBars

expression A variable that represents a ChartGroup object.

Remarks

This property applies only to line charts.

Example

The following example enables up bars and down bars for chart group one of the first chart in the active document and then sets their colors. You should run the example on a 2-D line chart that has two series that cross each other at one or more data points.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With Chart.ChartGroups(1)
 .HasUpDownBars = True
 .DownBars.Interior.ColorIndex = 3
 .UpBars.Interior.ColorIndex = 5
 End With
 End If
End With

See also

Concepts

ChartGroup Object

Other resources

ChartGroup Object Members


ChartGroup.DropLines Property (Word)

 Copy code hover
[image]

ChartGroup.DropLines Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the drop lines for a series on a line chart or area chart. Read-only DropLines.

Version Information

Version Added: Word 2007

Syntax

expression .DropLines

expression A variable that represents a ChartGroup object.

Remarks

This property applies only to line charts or area charts.

Example

The following example enables drop lines for chart group one of the first chart in the active document and then sets their line style, weight, and color. You should run the example on a 2-D line chart that has one series.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With Chart.ChartGroups(1)
 .HasDropLines = True
 With .DropLines.Border
 .LineStyle = xlThin
 .Weight = xlMedium
 .ColorIndex = 3
 End With
 End With
 End If
End With

See also

Concepts

ChartGroup Object

Other resources

ChartGroup Object Members


ChartGroup.FirstSliceAngle Property (Word)

 Copy code hover
[image]

ChartGroup.FirstSliceAngle Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the angle, in degrees (clockwise from vertical), of the first pie-chart or doughnut-chart slice. Read/write Long.

Version Information

Version Added: Word 2007

Syntax

expression .FirstSliceAngle

expression A variable that represents a ChartGroup object.

Remarks

This property applies only to pie, 3-D pie, and doughnut charts. It can be a value from 0 through 360.

Example

The following example sets the angle for the first slice in chart group one for the first chart in the active document. You should run the example on a 2-D pie chart.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.ChartGroups(1).FirstSliceAngle = 15
 End If
End With

See also

Concepts

ChartGroup Object

Other resources

ChartGroup Object Members


ChartGroup.GapWidth Property (Word)

 Copy code hover
[image]

ChartGroup.GapWidth Property (Word)
See also Send feedback

Published: July 16, 2012

For bar and column charts, returns or sets the space, as a percentage of the bar or column width, between bar or column clusters. For pie-of-pie and bar-of-pie charts, returns or sets the space between the primary and secondary sections of the chart. Read/write Long.

Version Information

Version Added: Word 2007

Syntax

expression .GapWidth

expression A variable that represents a ChartGroup object.

Remarks

The value of this property must be between 0 and 500.

Example

The following example sets the space between column clusters for the first chart in the active document to be 50 percent of the column width.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.ChartGroups(1).GapWidth = 50
 End If
End With

See also

Concepts

ChartGroup Object

Other resources

ChartGroup Object Members


ChartGroup.Has3DShading Property (Word)

 Copy code hover
[image]

ChartGroup.Has3DShading Property (Word)
See also Send feedback

Published: July 16, 2012

True if a chart group has three-dimensional shading. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .Has3DShading

expression A variable that represents a ChartGroup object.

Remarks

Setting Has3DShading to False removes the 3-D shading effect from the chart (rendering it as flat). Setting Has3DShading to True sets the chart content to the default.

Example

The following example adds 3-D shading to the first chart group of the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.ChartGroups(1).Has3DShading = True
 End If
End With

See also

Concepts

ChartGroup Object

Other resources

ChartGroup Object Members


ChartGroup.HasDropLines Property (Word)

 Copy code hover
[image]

ChartGroup.HasDropLines Property (Word)
See also Send feedback

Published: July 16, 2012

True if the line chart or area chart has drop lines. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .HasDropLines

expression A variable that represents a ChartGroup object.

Remarks

This property applies only to line and area charts.

Example

The following example enables drop lines for chart group one of the first chart in the active document and then sets their line style, weight, and color. You should run the example on a 2-D line chart that has one series.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.ChartGroups(1)
 .HasDropLines = True
 With .DropLines.Border
 .LineStyle = xlThin
 .Weight = xlMedium
 .ColorIndex = 3
 End With
 End With
 End If
End With

See also

Concepts

ChartGroup Object

Other resources

ChartGroup Object Members


ChartGroup.HasHiLoLines Property (Word)

 Copy code hover
[image]

ChartGroup.HasHiLoLines Property (Word)
See also Send feedback

Published: July 16, 2012

True if the line chart has high-low lines. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .HasHiLoLines

expression A variable that represents a ChartGroup object.

Remarks

This property applies only to line charts.

Example

The following example enables high-low lines for chart group one of the first chart in the active document and then sets line style, weight, and color. You should run the example on a 2-D line chart that has three series of stock-quote-like data (high-low-close).

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.ChartGroups(1)
 .HasHiLoLines = True
 With .HiLoLines.Border
 .LineStyle = xlThin
 .Weight = xlMedium
 .ColorIndex = 3
 End With
 End With
 End If
End With

See also

Concepts

ChartGroup Object

Other resources

ChartGroup Object Members


ChartGroup.HasRadarAxisLabels Property (Word)

 Copy code hover
[image]

ChartGroup.HasRadarAxisLabels Property (Word)
See also Send feedback

Published: July 16, 2012

True if a radar chart has axis labels. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .HasRadarAxisLabels

expression A variable that represents a ChartGroup object.

Remarks

This property applies only to radar charts.

Example

The following example enables radar axis labels for chart group one of the first chart in the active document and sets their color. You should run the example on a radar chart.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.ChartGroups(1)
 .HasRadarAxisLabels = True
 .RadarAxisLabels.Font.ColorIndex = 3
 End With
 End If
End With

See also

Concepts

ChartGroup Object

Other resources

ChartGroup Object Members


ChartGroup.HasSeriesLines Property (Word)

 Copy code hover
[image]

ChartGroup.HasSeriesLines Property (Word)
See also Send feedback

Published: July 16, 2012

True if a stacked column chart or bar chart has series lines or if a pie-of-pie chart or bar-of-pie chart has connector lines between the two sections. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .HasSeriesLines

expression A variable that represents a ChartGroup object.

Remarks

This property applies only to 2-D stacked bar, 2-D stacked column, pie-of-pie, or bar-of-pie charts.

Example

The following example enables series lines for chart group one of the first chart in the active document and then sets their line style, weight, and color. You should run the example on a 2-D stacked column chart that has two or more series.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.ChartGroups(1)
 .HasSeriesLines = True
 With .SeriesLines.Border
 .LineStyle = xlThin
 .Weight = xlMedium
 .ColorIndex = 3
 End With
 End With
 End If
End With

See also

Concepts

ChartGroup Object

Other resources

ChartGroup Object Members


ChartGroup.HasUpDownBars Property (Word)

 Copy code hover
[image]

ChartGroup.HasUpDownBars Property (Word)
See also Send feedback

Published: July 16, 2012

True if a line chart has up and down bars. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .HasUpDownBars

expression A variable that represents a ChartGroup object.

Remarks

This property applies only to line charts.

Example

The following example enables up and down bars for chart group one of the first chart in the active document and then sets their colors. You should run the example on a 2-D line chart that contains two series that cross each other at one or more data points.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.ChartGroups(1)
 .HasUpDownBars = True
 .DownBars.Interior.ColorIndex = 3
 .UpBars.Interior.ColorIndex = 5
 End With
 End If
End With

See also

Concepts

ChartGroup Object

Other resources

ChartGroup Object Members


ChartGroup.HiLoLines Property (Word)

 Copy code hover
[image]

ChartGroup.HiLoLines Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the high-low lines for a series on a line chart. Read-only HiLoLines.

Version Information

Version Added: Word 2007

Syntax

expression .HiLoLines

expression A variable that represents a ChartGroup object.

Remarks

This property applies only to line charts.

Example

The following example enables high-low lines for chart group one of the first chart in the active document and then sets their line style, weight, and color. You should run the example on a 2-D line chart that has three series of stock-quote-like data (high-low-close).

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.ChartGroups(1)
 .HasHiLoLines = True
 With .HiLoLines.Border
 .LineStyle = xlThin
 .Weight = xlMedium
 .ColorIndex = 3
 End With
 End With
 End If
End With

See also

Concepts

ChartGroup Object

Other resources

ChartGroup Object Members


ChartGroup.Index Property (Word)

 Copy code hover
[image]

ChartGroup.Index Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the index number of the object within the collection of similar objects. Read-only Long.

Version Information

Version Added: Word 2007

Syntax

expression .Index

expression A variable that represents a ChartGroup object.

See also

Concepts

ChartGroup Object

Other resources

ChartGroup Object Members


ChartGroup.Overlap Property (Word)

 Copy code hover
[image]

ChartGroup.Overlap Property (Word)
See also Send feedback

Published: July 16, 2012

Specifies how bars and columns are positioned. Read/write Long.

Version Information

Version Added: Word 2007

Syntax

expression .Overlap

expression A variable that represents a ChartGroup object.

Remarks

This property applies only to 2-D bar and 2-D column charts.

You can set this property to a value from -100 through 100. If this property is set to -100, bars are positioned so that there is one bar width between them. If the overlap is 0 (zero), there is no space between bars (one bar starts immediately after the preceding bar). If the overlap is 100, bars are positioned on top of each other.

Example

The following example sets the overlap for chart group one of the first chart in the active document to -50. You should run the example on a 2-D column chart that has two or more series.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.ChartGroups(1).Overlap = -50
 End If
End With

See also

Concepts

ChartGroup Object

Other resources

ChartGroup Object Members


ChartGroup.Parent Property (Word)

 Copy code hover
[image]

ChartGroup.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the parent for the specified object. Read-only Object.

Version Information

Version Added: Word 2007

Syntax

expression .Parent

expression A variable that represents a ChartGroup object.

See also

Concepts

ChartGroup Object

Other resources

ChartGroup Object Members


ChartGroup.RadarAxisLabels Property (Word)

 Copy code hover
[image]

ChartGroup.RadarAxisLabels Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the radar axis labels for the specified chart group. Read-only TickLabels.

Version Information

Version Added: Word 2007

Syntax

expression .RadarAxisLabels

expression A variable that represents a ChartGroup object.

Example

The following example enables radar axis labels for chart group one for the first chart in the active document and then sets the color for the labels to red. You should run the example on a radar chart.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.ChartGroups(1)
 .HasRadarAxisLabels = True
 .RadarAxisLabels.Font.ColorIndex = 3
 End With
 End If
End With

See also

Concepts

ChartGroup Object

Other resources

ChartGroup Object Members


ChartGroup.SecondPlotSize Property (Word)

 Copy code hover
[image]

ChartGroup.SecondPlotSize Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the size, as a percentage of the primary pie, of the secondary section of either a pie-of-pie chart or a bar-of-pie chart. Read/write Long.

Version Information

Version Added: Word 2007

Syntax

expression .SecondPlotSize

expression A variable that represents a ChartGroup object.

Remarks

This property can have a value from 5 through 200.

Example

The following example splits the two sections of the chart by value, combining all values under 10 in the primary pie and displaying them in the secondary section. The secondary section is 50 percent of the size of the primary pie. You must run the example on either a pie-of-pie chart or a bar-of-pie chart.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.ChartGroups(1)
 .SplitType = xlSplitByValue
 .SplitValue = 10
 .VaryByCategories = True
 .SecondPlotSize = 50
 End With
 End If
End With

See also

Concepts

ChartGroup Object

Other resources

ChartGroup Object Members


ChartGroup.SeriesLines Property (Word)

 Copy code hover
[image]

ChartGroup.SeriesLines Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the series lines for a 2-D stacked bar, 2-D stacked column, pie-of-pie, or bar-of-pie chart. Read-only SeriesLines.

Version Information

Version Added: Word 2007

Syntax

expression .SeriesLines

expression A variable that represents a ChartGroup object.

Example

The following example enables series lines for chart group one of the first chart in the active document, and then sets the line style, weight, and color of the series lines. You should run the example on a 2-D stacked column chart that has two or more series.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.ChartGroups(1)
 .HasSeriesLines = True
 With .SeriesLines.Border
 .LineStyle = xlThin
 .Weight = xlMedium
 .ColorIndex = 3
 End With
 End With
 End If
End With

See also

Concepts

ChartGroup Object

Other resources

ChartGroup Object Members


ChartGroup.ShowNegativeBubbles Property (Word)

 Copy code hover
[image]

ChartGroup.ShowNegativeBubbles Property (Word)
See also Send feedback

Published: July 16, 2012

True if negative bubbles are shown for the chart group. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .ShowNegativeBubbles

expression A variable that represents a ChartGroup object.

Remarks

The property is valid only for bubble charts.

Example

The following example causes Microsoft Word to display negative bubbles for the first chart group of the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.ChartGroups(1).ShowNegativeBubbles = True
 End If
End With

See also

Concepts

ChartGroup Object

Other resources

ChartGroup Object Members


ChartGroup.SizeRepresents Property (Word)

 Copy code hover
[image]

ChartGroup.SizeRepresents Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets what the bubble size represents on a bubble chart. Read/write Long.

Version Information

Version Added: Word 2007

Syntax

expression .SizeRepresents

expression A variable that represents a ChartGroup object.

Remarks

This property can be either of the following XlSizeRepresents constants:

  • xlSizeIsArea

  • xlSizeIsWidth

Example

The following example sets what the bubble size represents for chart group one of the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.ChartGroups(1).SizeRepresents = xlSizeIsWidth
 End If
End With

See also

Concepts

ChartGroup Object

Other resources

ChartGroup Object Members


ChartGroup.SplitType Property (Word)

 Copy code hover
[image]

ChartGroup.SplitType Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the way the two sections of either a pie-of-pie chart or a bar-of-pie chart are split. Read/write XlChartSplitType.

Version Information

Version Added: Word 2007

Syntax

expression .SplitType

expression A variable that represents a ChartGroup object.

Example

The following example splits the two sections of the chart by value, combining all values under 10 in the primary pie and displaying them in the secondary section. You must run the example on either a pie-of-pie chart or a bar-of-pie chart.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.ChartGroups(1)
 .SplitType = xlSplitByValue
 .SplitValue = 10
 .VaryByCategories = True
 End With
 End If
End With

See also

Concepts

ChartGroup Object

Other resources

ChartGroup Object Members


ChartGroup.SplitValue Property (Word)

 Copy code hover
[image]

ChartGroup.SplitValue Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the threshold value separating the two sections of either a pie-of-pie chart or a bar-of-pie chart. Read/write Variant.

Version Information

Version Added: Word 2007

Syntax

expression .SplitValue

expression A variable that represents a ChartGroup object.

Example

The following example splits the two sections of the chart by value, combining all values under 10 in the primary pie and displaying them in the secondary section. You must run this example on either a pie-of-pie chart or a bar-of-pie chart.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.ChartGroups(1)
 .SplitType = xlSplitByValue
 .SplitValue = 10
 .VaryByCategories = True
 End With
 End If
End With

See also

Concepts

ChartGroup Object

Other resources

ChartGroup Object Members


ChartGroup.UpBars Property (Word)

 Copy code hover
[image]

ChartGroup.UpBars Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the up bars on a line chart. Read-only UpBars.

Version Information

Version Added: Word 2007

Syntax

expression .UpBars

expression A variable that represents a ChartGroup object.

Remarks

This property applies only to line charts.

Example

The following example enables up and down bars for chart group one of the first chart in the active document, and then sets their colors. You should run the example on a 2-D line chart that contains two series that cross each other at one or more data points.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.ChartGroups(1)
 .HasUpDownBars = True
 .DownBars.Interior.ColorIndex = 3
 .UpBars.Interior.ColorIndex = 5
 End With
 End If
End With

See also

Concepts

ChartGroup Object

Other resources

ChartGroup Object Members


ChartGroup.VaryByCategories Property (Word)

 Copy code hover
[image]

ChartGroup.VaryByCategories Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word assigns a different color or pattern to each data marker. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .VaryByCategories

expression A variable that represents a ChartGroup object.

Remarks

The chart must contain only one series.

Example

The following example assigns a different color or pattern to each data marker in chart group one. You should run the example on a 2-D line chart that has data markers on a series.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.ChartGroups(1).VaryByCategories = True
 End If
End With

See also

Concepts

ChartGroup Object

Other resources

ChartGroup Object Members


ChartGroup Methods (Word)

 Copy code hover
[image]

ChartGroup Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
CategoryCollection | Returns all the visible categories in the chart group, or the specified visible category.
FullCategoryCollection | Returns all the categories in the chart group, or the specified category, whether visible or filtered out.
SeriesCollection | Returns all the series in the chart group.


ChartGroup.CategoryCollection Method (Word)

 Copy code hover
[image]

ChartGroup.CategoryCollection Method (Word)
See also Send feedback

Published: July 16, 2012

Returns all the visible categories in the chart group, or the specified visible category.

Version information

Version Added: Word 2013

Syntax

expression .CategoryCollection(Index)

expression A variable that represents a ChartGroup object.

Parameters

Name | Required/Optional | Data type | Description
Index | Optional | VARIANT | The index number in the visible category collection of the category to return.

Return value

OBJECT

See also

Concepts

ChartGroup Object

Other resources

ChartGroup Object Members


ChartGroup.FullCategoryCollection Method (Word)

 Copy code hover
[image]

ChartGroup.FullCategoryCollection Method (Word)
See also Send feedback

Published: July 16, 2012

Returns all the categories in the chart group, or the specified category, whether visible or filtered out.

Version information

Version Added: Word 2013

Syntax

expression .FullCategoryCollection(Index)

expression A variable that represents a ChartGroup object.

Parameters

Name | Required/Optional | Data type | Description
Index | Optional | VARIANT | The index number in the full category collection of the category to return.

Return value

OBJECT

See also

Concepts

ChartGroup Object

Other resources

ChartGroup Object Members


ChartGroup.SeriesCollection Method (Word)

 Copy code hover
[image]

ChartGroup.SeriesCollection Method (Word)
See also Send feedback

Published: July 16, 2012

Returns all the series in the chart group.

Version Information

Version Added: Word 2007

Syntax

expression .SeriesCollection(Index)

expression A variable that represents a ChartGroup object.

Return Value

A SeriesCollection object that represents all the series in the chart group.

Example

The following example turns on data labels for the first series of the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.ChartGroups(1). _
 SeriesCollection(1).HasDataLabels = True
 End If
End With

See also

Concepts

ChartGroup Object

Other resources

ChartGroup Object Members


ChartGroups Object (Word)

 Copy code hover
[image]

ChartGroups Object (Word)
See also Send feedback

Published: July 16, 2012

Represents one or more series plotted in a chart with the same format.

Version Information

Version Added: Word 2007

Remarks

A ChartGroups collection is a collection of all the ChartGroup objects in the specified chart. A chart contains one or more chart groups, each chart group contains one or more series, and each series contains one or more points. For example, a single chart might contain both a line chart group, containing all the series plotted with the line chart format, and a bar chart group, containing all the series plotted with the bar chart format.

The following example displays the number of chart groups on the first chart of the active document. Use the ChartGroups property to return the ChartGroups collection.

VBA Copy code Copy code
MsgBox ActiveDocument.InlineShapes(1).Chart._
 ChartGroups.Count

The following example adds drop lines to chart group 1 on chart sheet 1. Use ChartGroups(index), where Index is the chart group index number, to return a single ChartGroup object.

VBA Copy code Copy code
ActiveDocument.InlineShapes(1).Chart._
 ChartGroups(1).HasDropLines = True

See also

Concepts

Word Object Model Reference

Other resources

ChartGroups Object Members


ChartGroups Members (Word)

 Copy code hover
[image]

ChartGroups Members (Word)
Send feedback

Published: July 16, 2012

Represents one or more series plotted in a chart with the same format.

Methods

Name | Description
Item | Returns a single object from a collection.

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
Count | Returns the number of objects in the collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns the parent for the specified object. Read-only Object.


ChartGroups Properties (Word)

 Copy code hover
[image]

ChartGroups Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
Count | Returns the number of objects in the collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns the parent for the specified object. Read-only Object.


ChartGroups.Application Property (Word)

 Copy code hover
[image]

ChartGroups.Application Property (Word)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Application

expression A variable that represents a ChartGroups object.

Example

The following example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveDocument
If myObject.Application.Value = "Microsoft Word" Then
 MsgBox "This is a Word Application object."
Else
 MsgBox "This is not a Word Application object."
End If

See also

Concepts

ChartGroups Object

Other resources

ChartGroups Object Members


ChartGroups.Count Property (Word)

 Copy code hover
[image]

ChartGroups.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the number of objects in the collection. Read-only Long.

Version Information

Version Added: Word 2007

Syntax

expression .Count

expression A variable that represents a ChartGroups object.

See also

Concepts

ChartGroups Object

Other resources

ChartGroups Object Members


ChartGroups.Creator Property (Word)

 Copy code hover
[image]

ChartGroups.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version Information

Version Added: Word 2007

Syntax

expression .Creator

expression A variable that represents a ChartGroups object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD". This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Word has the creator code MSWD. For more information about this property, consult the language reference Help included with Microsoft Office for Mac.

See also

Concepts

ChartGroups Object

Other resources

ChartGroups Object Members


ChartGroups.Parent Property (Word)

 Copy code hover
[image]

ChartGroups.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the parent for the specified object. Read-only Object.

Version Information

Version Added: Word 2007

Syntax

expression .Parent

expression A variable that represents a ChartGroups object.

See also

Concepts

ChartGroups Object

Other resources

ChartGroups Object Members


ChartGroups Methods (Word)

 Copy code hover
[image]

ChartGroups Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Item | Returns a single object from a collection.


ChartGroups.Item Method (Word)

 Copy code hover
[image]

ChartGroups.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a single object from a collection.

Version Information

Version Added: Word 2007

Syntax

expression .Item(Index)

expression A variable that represents a ChartGroups object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The index number for the object.

Return Value

A ChartGroup object contained by the collection.

Example

The following example adds drop lines to chart group one for the first chart group of the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.ChartGroups.Item(1).HasDropLines = True
 End If
End With

See also

Concepts

ChartGroups Object

Other resources

ChartGroups Object Members


ChartTitle Object (Word)

 Copy code hover
[image]

ChartTitle Object (Word)
See also Send feedback

Published: July 16, 2012

Represents the chart title.

Version Information

Version Added: Word 2007

Remarks

Use the ChartTitle property to return the ChartTitle object.

The ChartTitle object does not exist and cannot be used unless the HasTitle property for the chart is True.

Example

The following example adds a title to embedded chart one on the worksheet named "Sheet1."

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1).Chart
 .HasTitle = True
 .ChartTitle.Text = "February Sales"
End With

See also

Concepts

Word Object Model Reference

Other resources

ChartTitle Object Members


ChartTitle Members (Word)

 Copy code hover
[image]

ChartTitle Members (Word)
Send feedback

Published: July 16, 2012

Represents the chart title.

Methods

Name | Description
Delete | Deletes the object.
Select | Selects the object.

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
Caption | Returns or sets the chart title text. Read/write String.
Characters | Returns a ChartCharacters object that represents a range of characters within the object text. You can use the ChartCharacters object to format characters within a text string.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Format | Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.
Formula | Gets or sets a String value that represents the formula of the object using A1-style notation, in English. Read/write.
FormulaLocal | Returns or sets the formula for the object, using A1-style references in the language of the user. Read/write String.
FormulaR1C1 | Returns or sets the formula for the object, using R1C1-style notation in the language of the macro. Read/write String.
FormulaR1C1Local | Returns or sets the formula for the object, using R1C1-style notation in the language of the user. Read/write String.
Height | Returns the height, in points, of the object. Read-only.
HorizontalAlignment | Returns or sets the horizontal alignment for the specified object. Read/write Variant.
IncludeInLayout | True if a chart title will occupy the chart layout space when a chart layout is being determined. The default is True. Read/write Boolean.
Left | Returns or sets the distance, in points, from the left edge of the object to the left edge of the chart area. Read/write Double.
Name | Returns the name of the object. Read-only String.
Orientation | Returns or sets the text orientation. Read/write Long.
Parent | Returns the parent for the specified object. Read-only Object.
Position | Returns or sets the position of the chart title on the chart. Read/write XlChartElementPosition.
ReadingOrder | Returns or sets an XlReadingOrder constant that represents the reading order for the specified object. Read/write Long.
Shadow | Returns or sets a value that indicates whether the object has a shadow. Read/write Boolean.
Text | Returns or sets the text for the specified object. Read/write String.
Top | Returns or sets the distance, in points, from the top edge of the object to the top of the first row (on a worksheet) or the top of the chart area (on a chart). Read/write Double.
VerticalAlignment | Returns or sets the vertical alignment of the specified object. Read/write Variant.
Width | Returns the width, in points, of the object. Read-only.


ChartTitle Properties (Word)

 Copy code hover
[image]

ChartTitle Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
Caption | Returns or sets the chart title text. Read/write String.
Characters | Returns a ChartCharacters object that represents a range of characters within the object text. You can use the ChartCharacters object to format characters within a text string.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Format | Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.
Formula | Gets or sets a String value that represents the formula of the object using A1-style notation, in English. Read/write.
FormulaLocal | Returns or sets the formula for the object, using A1-style references in the language of the user. Read/write String.
FormulaR1C1 | Returns or sets the formula for the object, using R1C1-style notation in the language of the macro. Read/write String.
FormulaR1C1Local | Returns or sets the formula for the object, using R1C1-style notation in the language of the user. Read/write String.
Height | Returns the height, in points, of the object. Read-only.
HorizontalAlignment | Returns or sets the horizontal alignment for the specified object. Read/write Variant.
IncludeInLayout | True if a chart title will occupy the chart layout space when a chart layout is being determined. The default is True. Read/write Boolean.
Left | Returns or sets the distance, in points, from the left edge of the object to the left edge of the chart area. Read/write Double.
Name | Returns the name of the object. Read-only String.
Orientation | Returns or sets the text orientation. Read/write Long.
Parent | Returns the parent for the specified object. Read-only Object.
Position | Returns or sets the position of the chart title on the chart. Read/write XlChartElementPosition.
ReadingOrder | Returns or sets an XlReadingOrder constant that represents the reading order for the specified object. Read/write Long.
Shadow | Returns or sets a value that indicates whether the object has a shadow. Read/write Boolean.
Text | Returns or sets the text for the specified object. Read/write String.
Top | Returns or sets the distance, in points, from the top edge of the object to the top of the first row (on a worksheet) or the top of the chart area (on a chart). Read/write Double.
VerticalAlignment | Returns or sets the vertical alignment of the specified object. Read/write Variant.
Width | Returns the width, in points, of the object. Read-only.


ChartTitle.Application Property (Word)

 Copy code hover
[image]

ChartTitle.Application Property (Word)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Application

expression A variable that represents a ChartTitle object.

Example

The following example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveDocument
If myObject.Application.Value = "Microsoft Word" Then
 MsgBox "This is a Word Application object."
Else
 MsgBox "This is not a Word Application object."
End If

See also

Concepts

ChartTitle Object

Other resources

ChartTitle Object Members


ChartTitle.Caption Property (Word)

 Copy code hover
[image]

ChartTitle.Caption Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the chart title text. Read/write String.

Version Information

Version Added: Word 2007

Syntax

expression .Caption

expression A variable that represents a ChartTitle object.

See also

Concepts

ChartTitle Object

Other resources

ChartTitle Object Members


ChartTitle.Characters Property (Word)

 Copy code hover
[image]

ChartTitle.Characters Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a ChartCharacters object that represents a range of characters within the object text. You can use the ChartCharacters object to format characters within a text string.

Version Information

Version Added: Word 2007

Syntax

expression .Characters(Start, Length)

expression A variable that represents a ChartTitle object.

Parameters

Name | Required/Optional | Data Type | Description
Start | Optional | Variant | The first character to be returned. If this argument is either 1 or omitted, this property returns a range of characters starting with the first character.
Length | Optional | Variant | The number of characters to be returned. If this argument is omitted, this property returns the remainder of the string (everything after the Start character).

Remarks

The ChartCharacters object is not a collection.

See also

Concepts

ChartTitle Object

Other resources

ChartTitle Object Members


ChartTitle.Creator Property (Word)

 Copy code hover
[image]

ChartTitle.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version Information

Version Added: Word 2007

Syntax

expression .Creator

expression A variable that represents a ChartTitle object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD". This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Word has the creator code MSWD. For more information about this property, consult the language reference Help included with Microsoft Office for Mac.

See also

Concepts

ChartTitle Object

Other resources

ChartTitle Object Members


ChartTitle.Format Property (Word)

 Copy code hover
[image]

ChartTitle.Format Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.

Version Information

Version Added: Word 2007

Syntax

expression .Format

expression A variable that represents a ChartTitle object.

See also

Concepts

ChartTitle Object

Other resources

ChartTitle Object Members


ChartTitle.Formula Property (Word)

 Copy code hover
[image]

ChartTitle.Formula Property (Word)
See also Send feedback

Published: July 16, 2012

Gets or sets a String value that represents the formula of the object using A1-style notation, in English. Read/write.

Version Information

Version Added: Word 2010

Syntax

expression .Formula

expression A variable that represents a ChartTitle object.

Return Value

String

Remarks

For more information about A1-style notation, see How to: Refer to Cells and Ranges by Using A1 Notation.

See also

Concepts

ChartTitle Object

Other resources

ChartTitle Object Members


ChartTitle.FormulaLocal Property (Word)

 Copy code hover
[image]

ChartTitle.FormulaLocal Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the formula for the object, using A1-style references in the language of the user. Read/write String.

Version Information

Version Added: Word 2010

Syntax

expression .FormulaLocal

expression A variable that represents a ChartTitle object.

Remarks

If the cell contains a constant, this property returns that constant. If the cell is empty, the property returns an empty string. If the cell contains a formula, the property returns the formula as a string, in the same format in which it would be displayed in the formula bar (including the equal sign (=)).

If you set the value or formula of a cell to a date, Microsoft Excel verifies that the cell is already formatted with one of the date or time number formats. If not, the number format is changed to the default short date number format.

If the range is a one- or two-dimensional range, you can set the formula to a Visual Basic array of the same dimensions. Similarly, you can put the formula into a Visual Basic array.

Setting the formula of a multiple-cell range fills all cells in the range with the formula.

See also

Concepts

ChartTitle Object

Other resources

ChartTitle Object Members


ChartTitle.FormulaR1C1 Property (Word)

 Copy code hover
[image]

ChartTitle.FormulaR1C1 Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the formula for the object, using R1C1-style notation in the language of the macro. Read/write String.

Version Information

Version Added: Word 2010

Syntax

expression .FormulaR1C1

expression A variable that represents a ChartTitle object.

Remarks

If the cell contains a constant, this property returns the constant. If the cell is empty, the property returns an empty string. If the cell contains a formula, the property returns the formula as a string, in the same format in which it would be displayed in the formula bar (including the equal sign).

If you set the value or formula of a cell to a date, Microsoft Excel checks to see whether that cell is already formatted with one of the date or time number formats. If not, the number format is changed to the default short date number format.

If the range is a one- or two-dimensional range, you can set the formula to a Visual Basic array of the same dimensions. Similarly, you can put the formula into a Visual Basic array.

Setting the formula of a multiple-cell range fills all cells in the range with the formula.

See also

Concepts

ChartTitle Object

Other resources

ChartTitle Object Members


ChartTitle.FormulaR1C1Local Property (Word)

 Copy code hover
[image]

ChartTitle.FormulaR1C1Local Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the formula for the object, using R1C1-style notation in the language of the user. Read/write String.

Version Information

Version Added: Word 2010

Syntax

expression .FormulaR1C1Local

expression A variable that represents a ChartTitle object.

See also

Concepts

ChartTitle Object

Other resources

ChartTitle Object Members


ChartTitle.Height Property (Word)

 Copy code hover
[image]

ChartTitle.Height Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the height, in points, of the object. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .Height

expression A variable that represents a ChartTitle object.

Return Value

Double

See also

Concepts

ChartTitle Object

Other resources

ChartTitle Object Members


ChartTitle.HorizontalAlignment Property (Word)

 Copy code hover
[image]

ChartTitle.HorizontalAlignment Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the horizontal alignment for the specified object. Read/write Variant.

Version Information

Version Added: Word 2007

Syntax

expression .HorizontalAlignment

expression A variable that represents a ChartTitle object.

Remarks

You can set the value of this property to one of the following XlConstants constants:

  • xlCenter

  • xlDistributed

  • xlJustify

  • xlLeft

  • xlRight

Some of these constants may not be available to you, depending on the language support (for example, U.S. English) that you have selected or installed.

See also

Concepts

ChartTitle Object

Other resources

ChartTitle Object Members


ChartTitle.IncludeInLayout Property (Word)

 Copy code hover
[image]

ChartTitle.IncludeInLayout Property (Word)
See also Send feedback

Published: July 16, 2012

True if a chart title will occupy the chart layout space when a chart layout is being determined. The default is True. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .IncludeInLayout

expression An expression that returns a ChartTitle object.

Remarks

This property does not affect whether a chart is in autolayout mode or not. If the user adds a title by using the Above Chart command, the chart will resize smaller, as in previous versions of Microsoft Office. If the user then removes the title or selects one of the overlay title options, the chart will resize larger, as if the title were not on the chart.

See also

Concepts

ChartTitle Object

Other resources

ChartTitle Object Members


ChartTitle.Left Property (Word)

 Copy code hover
[image]

ChartTitle.Left Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the distance, in points, from the left edge of the object to the left edge of the chart area. Read/write Double.

Version Information

Version Added: Word 2007

Syntax

expression .Left

expression A variable that represents a ChartTitle object.

See also

Concepts

ChartTitle Object

Other resources

ChartTitle Object Members


ChartTitle.Name Property (Word)

 Copy code hover
[image]

ChartTitle.Name Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the name of the object. Read-only String.

Version Information

Version Added: Word 2007

Syntax

expression .Name

expression A variable that represents a ChartTitle object.

See also

Concepts

ChartTitle Object

Other resources

ChartTitle Object Members


ChartTitle.Orientation Property (Word)

 Copy code hover
[image]

ChartTitle.Orientation Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the text orientation. Read/write Long.

Version Information

Version Added: Word 2007

Syntax

expression .Orientation

expression A variable that represents a ChartTitle object.

Remarks

The value of this property can be an integer from -90 through 90 degrees or one of the XlOrientation constants.

See also

Concepts

ChartTitle Object

Other resources

ChartTitle Object Members


ChartTitle.Parent Property (Word)

 Copy code hover
[image]

ChartTitle.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the parent for the specified object. Read-only Object.

Version Information

Version Added: Word 2007

Syntax

expression .Parent

expression A variable that represents a ChartTitle object.

See also

Concepts

ChartTitle Object

Other resources

ChartTitle Object Members


ChartTitle.Position Property (Word)

 Copy code hover
[image]

ChartTitle.Position Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the position of the chart title on the chart. Read/write XlChartElementPosition.

Version Information

Version Added: Word 2007

Syntax

expression .Position

expression A variable that represents a ChartTitle object.

See also

Concepts

ChartTitle Object

Other resources

ChartTitle Object Members


ChartTitle.ReadingOrder Property (Word)

 Copy code hover
[image]

ChartTitle.ReadingOrder Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets an XlReadingOrder constant that represents the reading order for the specified object. Read/write Long.

Version Information

Version Added: Word 2007

Syntax

expression .ReadingOrder

expression A variable that represents a ChartTitle object.

See also

Concepts

ChartTitle Object

Other resources

ChartTitle Object Members


ChartTitle.Shadow Property (Word)

 Copy code hover
[image]

ChartTitle.Shadow Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a value that indicates whether the object has a shadow. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .Shadow

expression A variable that represents a ChartTitle object.

See also

Concepts

ChartTitle Object

Other resources

ChartTitle Object Members


ChartTitle.Text Property (Word)

 Copy code hover
[image]

ChartTitle.Text Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the text for the specified object. Read/write String.

Version Information

Version Added: Word 2007

Syntax

expression .Text

expression A variable that represents a ChartTitle object.

Example

The following example sets the text for the chart title of the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.HasTitle = True
 .Chart.ChartTitle.Text = "First Quarter Sales"
 End If
End With

See also

Concepts

ChartTitle Object

Other resources

ChartTitle Object Members


ChartTitle.Top Property (Word)

 Copy code hover
[image]

ChartTitle.Top Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the distance, in points, from the top edge of the object to the top of the first row (on a worksheet) or the top of the chart area (on a chart). Read/write Double.

Version Information

Version Added: Word 2007

Syntax

expression .Top

expression A variable that represents a ChartTitle object.

See also

Concepts

ChartTitle Object

Other resources

ChartTitle Object Members


ChartTitle.VerticalAlignment Property (Word)

 Copy code hover
[image]

ChartTitle.VerticalAlignment Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the vertical alignment of the specified object. Read/write Variant.

Version Information

Version Added: Word 2007

Syntax

expression .VerticalAlignment

expression A variable that represents a ChartTitle object.

Remarks

You can set the value of this property to one of the following XlConstants constants:

  • xlBottom

  • xlCenter

  • xlDistributed

  • xlJustify

  • xlTop

See also

Concepts

ChartTitle Object

Other resources

ChartTitle Object Members


ChartTitle.Width Property (Word)

 Copy code hover
[image]

ChartTitle.Width Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the width, in points, of the object. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .Width

expression A variable that represents a ChartTitle object.

See also

Concepts

ChartTitle Object

Other resources

ChartTitle Object Members


ChartTitle Methods (Word)

 Copy code hover
[image]

ChartTitle Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the object.
Select | Selects the object.


ChartTitle.Delete Method (Word)

 Copy code hover
[image]

ChartTitle.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Version Information

Version Added: Word 2007

Syntax

expression .Delete

expression A variable that represents a ChartTitle object.

See also

Concepts

ChartTitle Object

Other resources

ChartTitle Object Members


ChartTitle.Select Method (Word)

 Copy code hover
[image]

ChartTitle.Select Method (Word)
See also Send feedback

Published: July 16, 2012

Selects the object.

Version Information

Version Added: Word 2007

Syntax

expression .Select

expression A variable that represents a ChartTitle object.

See also

Concepts

ChartTitle Object

Other resources

ChartTitle Object Members


CheckBox Object (Word)

 Copy code hover
[image]

CheckBox Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a single check box form field.

Remarks

Use FormFields(Index), where Index is index number or the bookmark name associated with the check box, to return a single FormField object. Use the CheckBox property with the FormField object to return a CheckBox object. The following example selects the check box form field named "Check1" in the active document.

VBA Copy code Copy code
ActiveDocument.FormFields("Check1").CheckBox.Value = True

The index number represents the position of the form field in the FormFields collection. The following example checks the type of the first form field; if it is a check box, the check box is selected.

VBA Copy code Copy code
If ActiveDocument.FormFields(1).Type = wdFieldFormCheckBox Then
 ActiveDocument.FormFields(1).CheckBox.Value = True
End If

The following example determines whether the ffield object is valid before changing the check box size to 14 points.

VBA Copy code Copy code
Set ffield = ActiveDocument.FormFields(1).CheckBox
If ffield.Valid = True Then
 ffield.AutoSize = False
 ffield.Size = 14
Else
 MsgBox "First field is not a check box"
End If

Use the Add method with the FormFields object to add a check box form field. The following example adds a check box at the beginning of the active document, sets the name to "Color", and then selects the check box.

VBA Copy code Copy code
With ActiveDocument.FormFields.Add(Range:=ActiveDocument.Range _
 (Start:=0,End:=0), Type:=wdFieldFormCheckBox)
 .Name = "Color"
 .CheckBox.Value = True
End With

See also

Concepts

Word Object Model Reference

Other resources

CheckBox Object Members


CheckBox Members (Word)

 Copy code hover
[image]

CheckBox Members (Word)
Send feedback

Published: July 16, 2012

Represents a single check box form field.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
AutoSize | True sizes the check box or text frame according to the font size of the surrounding text. False sizes the check box or text frame according to the Size property. Read/write Boolean.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Default | Returns or sets the default check box value. True if the default value is checked. Read/write Boolean.
Parent | Returns an Object that represents the parent object of the specified CheckBox object.
Size | Returns or sets the size of a check box, in points. Read/write Single.
Valid | True if the specified form field object is a valid check box form field. Read-only Boolean.
Value | True if the check box is selected. Read/write Boolean.


CheckBox Properties (Word)

 Copy code hover
[image]

CheckBox Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
AutoSize | True sizes the check box or text frame according to the font size of the surrounding text. False sizes the check box or text frame according to the Size property. Read/write Boolean.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Default | Returns or sets the default check box value. True if the default value is checked. Read/write Boolean.
Parent | Returns an Object that represents the parent object of the specified CheckBox object.
Size | Returns or sets the size of a check box, in points. Read/write Single.
Valid | True if the specified form field object is a valid check box form field. Read-only Boolean.
Value | True if the check box is selected. Read/write Boolean.


CheckBox.Application Property (Word)

 Copy code hover
[image]

CheckBox.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression A variable that represents a CheckBox object.

See also

Concepts

CheckBox Object

Other resources

CheckBox Object Members


CheckBox.AutoSize Property (Word)

 Copy code hover
[image]

CheckBox.AutoSize Property (Word)
See also Send feedback

Published: July 16, 2012

True sizes the check box or text frame according to the font size of the surrounding text. False sizes the check box or text frame according to the Size property. Read/write Boolean.

Syntax

expression .AutoSize

expression Required. A variable that represents a CheckBox object.

See also

Concepts

CheckBox Object

Other resources

CheckBox Object Members


CheckBox.Creator Property (Word)

 Copy code hover
[image]

CheckBox.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a CheckBox object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

CheckBox Object

Other resources

CheckBox Object Members


CheckBox.Default Property (Word)

 Copy code hover
[image]

CheckBox.Default Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the default check box value. True if the default value is checked. Read/write Boolean.

Syntax

expression .Default

expression Required. A variable that represents a CheckBox object.

Example

If the first form field in the active document is a check box, this example retrieves the default value.

VBA Copy code Copy code
Dim blnDefault As Boolean

If ActiveDocument.FormFields(1).Type = wdFieldFormCheckBox Then
 blnDefault = ActiveDocument.FormFields(1).CheckBox.DefaultEnd If

See also

Concepts

CheckBox Object

Other resources

CheckBox Object Members


CheckBox.Parent Property (Word)

 Copy code hover
[image]

CheckBox.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified CheckBox object.

Syntax

expression .Parent

expression A variable that represents a CheckBox object.

See also

Concepts

CheckBox Object

Other resources

CheckBox Object Members


CheckBox.Size Property (Word)

 Copy code hover
[image]

CheckBox.Size Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the size of a check box, in points. Read/write Single.

Syntax

expression .Size

expression A variable that represents a CheckBox object.

Example

This example sets the size of the check box named "Check1" in the active document to 14 points and then sets the check box as selected.

VBA Copy code Copy code
With ActiveDocument.FormFields("Check1").CheckBox
 .AutoSize = False
 .Size = 14
 .Value = True
End With

See also

Concepts

CheckBox Object

Other resources

CheckBox Object Members


CheckBox.Valid Property (Word)

 Copy code hover
[image]

CheckBox.Valid Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified form field object is a valid check box form field. Read-only Boolean.

Syntax

expression .Valid

expression A variable that represents a CheckBox object.

Example

This example adds a text form field at the insertion point. Because myFormField is a text input field and not a check box, the message box displays "False."

VBA Copy code Copy code
Selection.Collapse Direction:=wdCollapseStart
Set myFormField = ActiveDocument.FormFields.Add(Range:= _
 Selection.Range, Type:=wdFieldFormTextInput)
MsgBox myFormField.CheckBox.Valid

See also

Concepts

CheckBox Object

Other resources

CheckBox Object Members


CheckBox.Value Property (Word)

 Copy code hover
[image]

CheckBox.Value Property (Word)
See also Send feedback

Published: July 16, 2012

True if the check box is selected. Read/write Boolean.

Syntax

expression .Value

expression Required. A variable that represents a CheckBox object.

See also

Concepts

CheckBox Object

Other resources

CheckBox Object Members


CoAuthLock Object (Word)

 Copy code hover
[image]

CoAuthLock Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a lock within the document. The CoAuthLock object is a member of the CoAuthLocks collection.

Version Information

Version Added: Word 2010

Remarks

Use Locks(index), where index is the index number, to return a CoAuthLock object. When adding a CoAuthLock object, use the WdLockType enumeration to specify the type of lock.

Example

The following code example returns the first lock in the active document.

VBA Copy code Copy code
Dim myLock as CoAuthLock

Set myLock = ActiveDocument.CoAuthoring.Locks(1)

The following code example adds a reservation lock on the third paragraph in the active document. Reservation locks are explicitly created by a document author and are persisted across explicit save actions (locks of type wdLockEphemeral do not persist across explicit saves). You can add locks with a with a lock type of wdLockReservation using the Word 2010 ribbon. For example, you can create a reservation lock on a selected paragraph range using Block Authors on the Review tab.

VBA Copy code Copy code
ActiveDocument.CoAuthoring.Locks.Add(ActiveDocument.Paragraphs(3), wdLockReservation)

See also

Concepts

Word Object Model Reference

Other resources

CoAuthLock Object Members


CoAuthLock Members (Word)

 Copy code hover
[image]

CoAuthLock Members (Word)
Send feedback

Published: July 16, 2012

Represents a lock within the document. The CoAuthLock object is a member of the CoAuthLocks collection.

Methods

Name | Description
Unlock | Unlocks the specified lock.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
HeaderFooter | This object or member has been deprecated. You should not use it in new applications.
Owner | Returns the CoAuthor that owns the specified lock. Read-only.
Parent | Returns an Object that represents the parent object of the specified CoAuthLock object.
Range | Returns a Range object that represents the portion of a document that is contained in the specified object. Read-only.
Type | Returns a WdLockType constant that specifies the lock type. Read-only.


CoAuthLock Properties (Word)

 Copy code hover
[image]

CoAuthLock Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
HeaderFooter | This object or member has been deprecated. You should not use it in new applications.
Owner | Returns the CoAuthor that owns the specified lock. Read-only.
Parent | Returns an Object that represents the parent object of the specified CoAuthLock object.
Range | Returns a Range object that represents the portion of a document that is contained in the specified object. Read-only.
Type | Returns a WdLockType constant that specifies the lock type. Read-only.


CoAuthLock.Application Property (Word)

 Copy code hover
[image]

CoAuthLock.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .Application

expression An expression that returns a CoAuthLock object.

See also

Concepts

CoAuthLock Object

Other resources

CoAuthLock Object Members


CoAuthLock.Creator Property (Word)

 Copy code hover
[image]

CoAuthLock.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version Information

Version Added: Word 2010

Syntax

expression .Creator

expression An expression that returns a CoAuthLock object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Apple Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For more information about this property, see the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

CoAuthLock Object

Other resources

CoAuthLock Object Members


CoAuthLock.HeaderFooter Property (Word)

 Copy code hover
[image]

CoAuthLock.HeaderFooter Property (Word)
See also Send feedback

Published: July 16, 2012

This object or member has been deprecated. You should not use it in new applications.

Version Information

Version Added: Word 2010

This property will always return false.

See also

Concepts

CoAuthLock Object

Other resources

CoAuthLock Object Members


CoAuthLock.Owner Property (Word)

 Copy code hover
[image]

CoAuthLock.Owner Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the CoAuthor that owns the specified lock. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .Owner

expression An expression that returns a CoAuthLock object.

Example

The following code example displays the name of the owner of each lock in the active document.

VBA Copy code Copy code
Dim myLock As CoAuthLock

For Each myLock In ActiveDocument.CoAuthoring.Locks
    MsgBox "The owner of this lock is " & _
    myLock.Owner.Name & "."
Next myLock

See also

Concepts

CoAuthLock Object

Other resources

CoAuthLock Object Members


CoAuthLock.Parent Property (Word)

 Copy code hover
[image]

CoAuthLock.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified CoAuthLock object.

Version Information

Version Added: Word 2010

Syntax

expression .Parent

expression An expression that returns a CoAuthLock object.

See also

Concepts

CoAuthLock Object

Other resources

CoAuthLock Object Members


CoAuthLock.Range Property (Word)

 Copy code hover
[image]

CoAuthLock.Range Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the portion of a document that is contained in the specified object. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .Range

expression An expression that returns a CoAuthLock object.

Example

The following code example gets the document range for the first lock in the active document and displays the range text to the user.

VBA Copy code Copy code
MsgBox ActiveDocument.Coauthoring.Locks(1).Range

See also

Concepts

CoAuthLock Object

Other resources

CoAuthLock Object Members


CoAuthLock.Type Property (Word)

 Copy code hover
[image]

CoAuthLock.Type Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a WdLockType constant that specifies the lock type. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .Type

expression An expression that returns a CoAuthLock object.

Example

The following code example removes all the reservation locks in the active document.

VBA Copy code Copy code
Dim myLock As CoAuthLock

For Each myLock In ActiveDocument.CoAuthoring.Locks
    If myLock.Type = wdLockReservation Then
        myLock.Unlock
    End If
Next myLock

See also

Concepts

CoAuthLock Object

Other resources

CoAuthLock Object Members


CoAuthLock Methods (Word)

 Copy code hover
[image]

CoAuthLock Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Unlock | Unlocks the specified lock.


CoAuthLock.Unlock Method (Word)

 Copy code hover
[image]

CoAuthLock.Unlock Method (Word)
See also Send feedback

Published: July 16, 2012

Unlocks the specified lock.

Version Information

Version Added: Word 2010

Syntax

expression .Unlock

expression An expression that returns a CoAuthLock object.

Return Value

Nothing

Remarks

The Unlock method unlocks the specified lock even if it belongs to another user other than the current user.

Example

The following code example unlocks all locks in the active document.

VBA Copy code Copy code
Dim myLock as CoAuthLock

For Each myLock In ActiveDocument.CoAuthoring.Locks
   myLock.Unlock
Next myLock

See also

Concepts

CoAuthLock Object

Other resources

CoAuthLock Object Members


CoAuthLocks Object (Word)

 Copy code hover
[image]

CoAuthLocks Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of CoAuthLock objects.

Version Information

Version Added: Word 2010

Remarks

Use the Locks property to return the CoAuthLocks collection.

Example

The following code example displays the number of locks in the active document.

VBA Copy code Copy code
MsgBox ActiveDocument.CoAuthoring.Locks.Count

See also

Concepts

CoAuthoring.Locks Property
Word Object Model Reference

Other resources

CoAuthLocks Object Members


CoAuthLocks Members (Word)

 Copy code hover
[image]

CoAuthLocks Members (Word)
Send feedback

Published: July 16, 2012

A collection of CoAuthLock objects.

Methods

Name | Description
Add | Returns a CoAuthLock object that represents a lock added to a specified range.
Item | Returns an individual CoAuthLock object in a collection.
RemoveEphemeralLocks | Removes ephemeral locks from the document.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application. Read-only.
Count | Returns a Long that represents the number of locks in the CoAuthLocks collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified CoAuthLocks object.


CoAuthLocks Properties (Word)

 Copy code hover
[image]

CoAuthLocks Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application. Read-only.
Count | Returns a Long that represents the number of locks in the CoAuthLocks collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified CoAuthLocks object.


CoAuthLocks.Application Property (Word)

 Copy code hover
[image]

CoAuthLocks.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .Application

expression An expression that returns a CoAuthLocks object.

See also

Concepts

CoAuthLocks Object

Other resources

CoAuthLocks Object Members


CoAuthLocks.Count Property (Word)

 Copy code hover
[image]

CoAuthLocks.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of locks in the CoAuthLocks collection. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .Count

expression An expression that returns a CoAuthLocks object.

Example

The following code example displays the number of locks in the active document.

VBA Copy code Copy code
MsgBox "The active document contains " & _
    ActiveDocument.CoAuthoring.Locks.Count & " locks."

See also

Concepts

CoAuthLocks Object

Other resources

CoAuthLocks Object Members


CoAuthLocks.Creator Property (Word)

 Copy code hover
[image]

CoAuthLocks.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version Information

Version Added: Word 2010

Syntax

expression .Creator

expression An expression that returns a CoAuthLocks object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Apple Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For more information about this property, see the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

CoAuthLocks Object

Other resources

CoAuthLocks Object Members


CoAuthLocks.Parent Property (Word)

 Copy code hover
[image]

CoAuthLocks.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified CoAuthLocks object.

Version Information

Version Added: Word 2010

Syntax

expression .Parent

expression An expression that returns a CoAuthLocks object.

See also

Concepts

CoAuthLocks Object

Other resources

CoAuthLocks Object Members


CoAuthLocks Methods (Word)

 Copy code hover
[image]

CoAuthLocks Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Returns a CoAuthLock object that represents a lock added to a specified range.
Item | Returns an individual CoAuthLock object in a collection.
RemoveEphemeralLocks | Removes ephemeral locks from the document.


CoAuthLocks.Add Method (Word)

 Copy code hover
[image]

CoAuthLocks.Add Method (Word)
Send feedback

Published: July 16, 2012

Returns a CoAuthLock object that represents a lock added to a specified range.

Version Information

Version Added: Word 2010

Syntax

expression .Add(Range, Type)

expression An expression that returns a CoAuthLocks object.

Parameters

Name | Required/Optional | Data Type | Description
Range | Optional | Variant | Specifies the document range locked by the CoAuthLock object. This parameter may be a Paragraph, Column, Cell, Row, Table, Range, or Selection object.
Type | Optional | WdLockType | Specifies the type of lock. The WdLockType specified can only be wdLockEphemeral or WdLockReservation

Return Value

CoAuthLock

Remarks

The following code example adds a reservation lock to the first paragraph in the active document.

Note Note

By default, if no arguments are given in the call to the CoAuthLocks.Add method, a reservation lock is placed on the paragraph that contains the insertion point.

Example

VBA Copy code Copy code
ActiveDocument. CoAuthoring.Locks.Add(ActiveDocument.Paragraphs(1).Range, wdLockReservation)


CoAuthLocks.Item Method (Word)

 Copy code hover
[image]

CoAuthLocks.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual CoAuthLock object in a collection.

Version Information

Version Added: Word 2010

Syntax

expression .Item(Index)

expression An expression that returns a CoAuthLocks object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The individual object to be returned.

Return Value

CoAuthLock

See also

Concepts

CoAuthLocks Object

Other resources

CoAuthLocks Object Members


CoAuthLocks.RemoveEphemeralLocks Method (Word)

 Copy code hover
[image]

CoAuthLocks.RemoveEphemeralLocks Method (Word)
See also Send feedback

Published: July 16, 2012

Removes ephemeral locks from the document.

Version Information

Version Added: Word 2010

Syntax

expression .RemoveEphemeralLocks

expression An expression that returns a CoAuthLocks object.

Return Value

Nothing

Remarks

Ephemeral locks are automatically applied to a range when a co-author begins to edit a document that has co-authoring enabled.

Example

The following code example removes all ephemeral locks from the active document.

VBA Copy code Copy code
ActiveDocument.CoAuthoring.Locks.RemoveEphemeralLocks

See also

Concepts

CoAuthLocks Object

Other resources

CoAuthLocks Object Members


CoAuthor Object (Word)

 Copy code hover
[image]

CoAuthor Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a single co-author in the document. The CoAuthor object is a member of the CoAuthors collection. The CoAuthors collection contains all the co-authors in the document (authors that are actively editing the document).

Important note Important

Documents can only be co-authored on a server that supports the File Synchronization via SOAP over HTTP protocol, such as Microsoft SharePoint Server 2010.

Version Information

Version Added: Word 2010

Remarks

Use CoAuthors(Index), where Index is the index number to return a single CoAuthor object.

Note Note

When a new co-author begins to edit the document, it can take up to one minute or longer for the co-author to appear in the document.

Example

The following code example returns the name of the first co-author in the active document.

VBA Copy code Copy code
Dim author As CoAuthor

Set author = ActiveDocument.CoAuthoring.Authors(1)
MsgBox "The name of the first co-author in this document is " & author.Name

See also

Concepts

Word Object Model Reference

Other resources

CoAuthor Object Members


CoAuthor Members (Word)

 Copy code hover
[image]

CoAuthor Members (Word)
Send feedback

Published: July 16, 2012

Represents a single co-author in the document. The CoAuthor object is a member of the CoAuthors collection. The CoAuthors collection contains all the co-authors in the document (authors that are actively editing the document).

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
EmailAddress | Returns a string that specifies the e-mail address of the specified co-author. Read-only.
ID | Returns a String that specifies a unique identifier for the specified author. Read-only.
IsMe | Returns true if this author represents the current user. Read-only.
Locks | Returns a CoAuthLocks collection that represents the locks in the document that are associated with the specified co-author. Read-only.
Name | Returns a String that contains the display name of the specified co-author. Read-only.
Parent | Returns an Object that represents the parent object of the specified CoAuthor object.


CoAuthor Properties (Word)

 Copy code hover
[image]

CoAuthor Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
EmailAddress | Returns a string that specifies the e-mail address of the specified co-author. Read-only.
ID | Returns a String that specifies a unique identifier for the specified author. Read-only.
IsMe | Returns true if this author represents the current user. Read-only.
Locks | Returns a CoAuthLocks collection that represents the locks in the document that are associated with the specified co-author. Read-only.
Name | Returns a String that contains the display name of the specified co-author. Read-only.
Parent | Returns an Object that represents the parent object of the specified CoAuthor object.


CoAuthor.Application Property (Word)

 Copy code hover
[image]

CoAuthor.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .Application

expression An expression that returns a CoAuthor object.

See also

Concepts

CoAuthor Object

Other resources

CoAuthor Object Members


CoAuthor.Creator Property (Word)

 Copy code hover
[image]

CoAuthor.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version Information

Version Added: Word 2010

Syntax

expression .Creator

expression An expression that returns a CoAuthor object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Apple Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For more information about this property, see the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

CoAuthor Object

Other resources

CoAuthor Object Members


CoAuthor.EmailAddress Property (Word)

 Copy code hover
[image]

CoAuthor.EmailAddress Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a string that specifies the e-mail address of the specified co-author. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .EmailAddress

expression An expression that returns a CoAuthor object.

Example

The following code example displays the e-mail address of the first co-author in the active document.

VBA Copy code Copy code
If ActiveDocument.CoAuthoring.Authors.Count <> 0 Then
 MsgBox ActiveDocument.CoAuthoring.Authors(1).EmailAddress
Else
 MsgBox "There are no co-authors in this document."
End If

See also

Concepts

CoAuthor Object

Other resources

CoAuthor Object Members


CoAuthor.ID Property (Word)

 Copy code hover
[image]

CoAuthor.ID Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a String that specifies a unique identifier for the specified author. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .ID

expression An expression that returns a CoAuthor object.

Remarks

The unique identifier returned by the ID property should not be assumed to have a particular length or format.

Example

The following code example displays the unique identifier for each co-author in the active document.

VBA Copy code Copy code
Dim allAuthors As CoAuthors
Dim coAuth As CoAuthor

Set allAuthors = ActiveDocument.CoAuthoring.Authors

For Each coAuth In allAuthors
 MsgBox "The ID for " & _
 coAuth.Name & " is " & coAuth.ID & "."
Next coAuth

See also

Concepts

CoAuthor Object

Other resources

CoAuthor Object Members


CoAuthor.IsMe Property (Word)

 Copy code hover
[image]

CoAuthor.IsMe Property (Word)
See also Send feedback

Published: July 16, 2012

Returns true if this author represents the current user. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .IsMe

expression An expression that returns a CoAuthor object.

Example

The following code example checks the active document to see if the first co-author in the CoAuthors collection is the current user.

VBA Copy code Copy code
If ActiveDocument.CoAuthoring.Authors(1).IsMe Then
MsgBox "The current user is the first coauthor."
End If

See also

Concepts

CoAuthor Object

Other resources

CoAuthor Object Members


CoAuthor.Locks Property (Word)

 Copy code hover
[image]

CoAuthor.Locks Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a CoAuthLocks collection that represents the locks in the document that are associated with the specified co-author. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .Locks

expression An expression that returns a CoAuthor object.

Example

The following code example displays the number of locks that are associated with the first co-author in the active document.

VBA Copy code Copy code
Dim lockCount As Integer
Dim coAuth As CoAuthor

Set coAuth = ActiveDocument.CoAuthoring.Authors(1)
lockCount = coAuth.Locks.Count

MsgBox "There are " & lockCount & _
 " locks in the active document for " & _
 coAuth.Name & "."

See also

Concepts

CoAuthor Object

Other resources

CoAuthor Object Members


CoAuthor.Name Property (Word)

 Copy code hover
[image]

CoAuthor.Name Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a String that contains the display name of the specified co-author. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .Name

expression An expression that returns a CoAuthor object.

Example

The following code example displays the name of the first co-author in the active document.

VBA Copy code Copy code
Set coAuth = ActiveDocument.CoAuthoring.Authors(1)
MsgBox "The name of the user is " & _
coAuth.Name & "."

See also

Concepts

CoAuthor Object

Other resources

CoAuthor Object Members


CoAuthor.Parent Property (Word)

 Copy code hover
[image]

CoAuthor.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified CoAuthor object.

Version Information

Version Added: Word 2010

Syntax

expression .Parent

expression An expression that returns a CoAuthor object.

See also

Concepts

CoAuthor Object

Other resources

CoAuthor Object Members


CoAuthoring Object (Word)

 Copy code hover
[image]

CoAuthoring Object (Word)
See also Send feedback

Published: July 16, 2012

Provides the primary entry point to the co-authoring object model.

Version Information

Version Added: Word 2010

Remarks

The CoAuthoring object provides information about co-authoring at the document level. For example, the CoAuthoring object can provide information about whether there are any locks in the document, which users have current locks in the document, or whether or not updates to the document content is available from the server. Use the CoAuthoring property to return the CoAuthoring object.

Example

The following code example gets the number of locks in the active document.

VBA Copy code Copy code
Sub CountLocks()
Dim i As Integer

i = ActiveDocument.CoAuthoring.Locks.Count

MsgBox i

End Sub

See also

Concepts

Word Object Model Reference

Other resources

CoAuthoring Object Members


CoAuthoring Members (Word)

 Copy code hover
[image]

CoAuthoring Members (Word)
Send feedback

Published: July 16, 2012

Provides the primary entry point to the co-authoring object model.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application. Read-only.
Authors | Returns a CoAuthors collection that represents all the co-authors currently editing the document. Read-only.
CanMerge | Returns a Boolean that specifies whether the document can be auto-merged. Read-only.
CanShare | Returns a Boolean that specifies whether this document can be co-authored. Read-only.
Conflicts | Returns a Conflicts collection that represents all the conflicts in a document. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Locks | Returns a CoAuthLocks collection that represents the locks in the document. Read-only.
Me | Returns a CoAuthor object that represents the current user. Read-only.
Parent | Returns an Object that represents the parent object of the specified CoAuthoring object.
PendingUpdates | Returns true if the document has pending updates that have not been accepted. Read-only.
Updates | Returns a CoAuthUpdates collection that represents the most recent updates that were merged into the document. Read-only.


CoAuthoring Properties (Word)

 Copy code hover
[image]

CoAuthoring Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application. Read-only.
Authors | Returns a CoAuthors collection that represents all the co-authors currently editing the document. Read-only.
CanMerge | Returns a Boolean that specifies whether the document can be auto-merged. Read-only.
CanShare | Returns a Boolean that specifies whether this document can be co-authored. Read-only.
Conflicts | Returns a Conflicts collection that represents all the conflicts in a document. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Locks | Returns a CoAuthLocks collection that represents the locks in the document. Read-only.
Me | Returns a CoAuthor object that represents the current user. Read-only.
Parent | Returns an Object that represents the parent object of the specified CoAuthoring object.
PendingUpdates | Returns true if the document has pending updates that have not been accepted. Read-only.
Updates | Returns a CoAuthUpdates collection that represents the most recent updates that were merged into the document. Read-only.


CoAuthoring.Application Property (Word)

 Copy code hover
[image]

CoAuthoring.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .Application

expression An expression that returns a CoAuthoring object.

See also

Concepts

CoAuthoring Object

Other resources

CoAuthoring Object Members


CoAuthoring.Authors Property (Word)

 Copy code hover
[image]

CoAuthoring.Authors Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a CoAuthors collection that represents all the co-authors currently editing the document. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .Authors

expression An expression that returns a CoAuthoring object.

Remarks

The collection returned by this property is static. If this collection is stored and then new users begin editing the document, or current users are no longer editing the document, the stored collection will not change.

Example

The following code example gets all the co-authors currently editing the document.

VBA Copy code Copy code
Dim allAuthors As CoAuthors
Set allAuthors = ActiveDocument.CoAuthoring.Authors

See also

Concepts

CoAuthoring Object

Other resources

CoAuthoring Object Members


CoAuthoring.CanMerge Property (Word)

 Copy code hover
[image]

CoAuthoring.CanMerge Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Boolean that specifies whether the document can be auto-merged. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .CanMerge

expression An expression that returns a CoAuthoring object.

Remarks

Only documents stored on a server that supports the File Synchronization via SOAP over HTTP protocol can be co-authored, for example, SharePoint Server 2010. Additionally, a document that has the following features cannot be auto-merged:

  • Digital Rights Management

  • Digital Signatures

  • Final mode

  • Encryption

  • Master Document role

  • Disable Auto-merge Client Policy

  • Framesets

  • Object Linking and Embedding (OLE) objects that do not have Revision Save IDs (RSIDs)

  • ActiveX controls

  • OfficeArt Engine 2.0 Charts and ink objects, and SmartArt that do not have corresponding IDs in the document

  • Documents with file name extensions other than .docx, .doc, and .odt

  • Word Blog documents

Example

The following code example displays whether the active document can be auto-merged.

VBA Copy code Copy code
If ActiveDocument.CoAuthoring.CanMerge Then
    MsgBox "This document can be auto-merged."
Else: MsgBox "This document cannot be auto-merged."
End If

See also

Concepts

CoAuthoring Object

Other resources

CoAuthoring Object Members


CoAuthoring.CanShare Property (Word)

 Copy code hover
[image]

CoAuthoring.CanShare Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Boolean that specifies whether this document can be co-authored. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .CanShare

expression An expression that returns a CoAuthoring object.

Remarks

The value of this property is affected by whether CanMerge is True, the file extension is .docx, and the document is stored on a server that supports the File Synchronization via SOAP over HTTP protocol.

Example

The following code example displays whether the active document can be co-authored.

VBA Copy code Copy code
If ActiveDocument.CoAuthoring.CanShare Then
    MsgBox "This document can be co-authored."
Else: MsgBox "This document cannot be co-authored."
End If

See also

Concepts

CoAuthoring Object

Other resources

CoAuthoring Object Members


CoAuthoring.Conflicts Property (Word)

 Copy code hover
[image]

CoAuthoring.Conflicts Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Conflicts collection that represents all the conflicts in a document. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .Conflicts

expression An expression that returns a CoAuthoring object.

Example

The following code example gets the type of each conflict in the active document. The Type property uses the WdRevisionType enumeration to specify the conflict type.

VBA Copy code Copy code
Dim conf As Conflict

For Each conf In ActiveDocument.CoAuthoring.Conflicts
    MsgBox conf.Type
Next conf

See also

Concepts

CoAuthoring Object

Other resources

CoAuthoring Object Members


CoAuthoring.Creator Property (Word)

 Copy code hover
[image]

CoAuthoring.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version Information

Version Added: Word 2010

Syntax

expression .Creator

expression An expression that returns a CoAuthoring object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Apple Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For more information about this property, see the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

CoAuthoring Object

Other resources

CoAuthoring Object Members


CoAuthoring.Locks Property (Word)

 Copy code hover
[image]

CoAuthoring.Locks Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a CoAuthLocks collection that represents the locks in the document. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .Locks

expression An expression that returns a CoAuthoring object.

Example

The following code example displays the number of locks in the active document.

VBA Copy code Copy code
MsgBox "There are " & _
    ActiveDocument.CoAuthoring.Locks.Count & _
    " locks in the active document."

See also

Concepts

CoAuthoring Object

Other resources

CoAuthoring Object Members


CoAuthoring.Me Property (Word)

 Copy code hover
[image]

CoAuthoring.Me Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a CoAuthor object that represents the current user. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .Me

expression An expression that returns a CoAuthoring object.

Example

The following code example gets the number of locks in the active document that are associated with the current user.

VBA Copy code Copy code
Dim coAuth As CoAuthor

Set coAuth = ActiveDocument.CoAuthoring.Me
MsgBox "The current user has " & coAuth.Locks.Count & _
" locks in the active document."

See also

Concepts

CoAuthoring Object

Other resources

CoAuthoring Object Members


CoAuthoring.Parent Property (Word)

 Copy code hover
[image]

CoAuthoring.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified CoAuthoring object.

Version Information

Version Added: Word 2010

Syntax

expression .Parent

expression An expression that returns a CoAuthoring object.

See also

Concepts

CoAuthoring Object

Other resources

CoAuthoring Object Members


CoAuthoring.PendingUpdates Property (Word)

 Copy code hover
[image]

CoAuthoring.PendingUpdates Property (Word)
See also Send feedback

Published: July 16, 2012

Returns true if the document has pending updates that have not been accepted. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .PendingUpdates

expression An expression that returns a CoAuthoring object.

Example

The following code example displays a message that indicates whether content updates are pending for the active document.

VBA Copy code Copy code
If ActiveDocument.CoAuthoring.PendingUpdates Then
MsgBox "There are content updates pending."
Else: MsgBox "There are no pending updates."
End If

See also

Concepts

CoAuthoring Object

Other resources

CoAuthoring Object Members


CoAuthoring.Updates Property (Word)

 Copy code hover
[image]

CoAuthoring.Updates Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a CoAuthUpdates collection that represents the most recent updates that were merged into the document. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .Updates

expression An expression that returns a CoAuthoring object.

Example

The following code example gets the most recent updates that have been merged into the active document.

VBA Copy code Copy code
Dim allUpdates As CoAuthUpdates

Set allUpdates = ActiveDocument.CoAuthoring.Updates

See also

Concepts

CoAuthoring Object

Other resources

CoAuthoring Object Members


CoAuthors Object (Word)

 Copy code hover
[image]

CoAuthors Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of all the CoAuthor objects in the document.

Version Information

Version Added: Word 2010

Remarks

The CoAuthors collection contains all the co-authors in the document (authors that are actively editing the document).

Example

The following code example gets the number of co-authors in the active document.

VBA Copy code Copy code
Dim i As Integer

i = ActiveDocument.CoAuthoring.Authors.Count

MsgBox "The number of co-authors is " & i

See also

Concepts

Word Object Model Reference

Other resources

CoAuthors Object Members


CoAuthors Members (Word)

 Copy code hover
[image]

CoAuthors Members (Word)
Send feedback

Published: July 16, 2012

A collection of all the CoAuthor objects in the document.

Methods

Name | Description
Item | Returns an individual CoAuthor object in a collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application. Read-only.
Count | Returns the number of items in the CoAuthors collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified CoAuthors object.


CoAuthors Properties (Word)

 Copy code hover
[image]

CoAuthors Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application. Read-only.
Count | Returns the number of items in the CoAuthors collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified CoAuthors object.


CoAuthors.Application Property (Word)

 Copy code hover
[image]

CoAuthors.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .Application

expression An expression that returns a CoAuthors object.

See also

Concepts

CoAuthors Object

Other resources

CoAuthors Object Members


CoAuthors.Count Property (Word)

 Copy code hover
[image]

CoAuthors.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the number of items in the CoAuthors collection. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .Count

expression An expression that returns a CoAuthors object.

Example

The following code example displays the number of co-authors in the active document.

VBA Copy code Copy code
MsgBox "The active document contains " & _
 ActiveDocument.CoAuthoring.Authors.Count & " authors."

See also

Concepts

CoAuthors Object

Other resources

CoAuthors Object Members


CoAuthors.Creator Property (Word)

 Copy code hover
[image]

CoAuthors.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version Information

Version Added: Word 2010

Syntax

expression .Creator

expression An expression that returns a CoAuthors object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD". This property was primarily designed to be used on the Apple Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For more information about this property, see the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

CoAuthors Object

Other resources

CoAuthors Object Members


CoAuthors.Parent Property (Word)

 Copy code hover
[image]

CoAuthors.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified CoAuthors object.

Version Information

Version Added: Word 2010

Syntax

expression .Parent

expression An expression that returns a CoAuthors object.

See also

Concepts

CoAuthors Object

Other resources

CoAuthors Object Members


CoAuthors Methods (Word)

 Copy code hover
[image]

CoAuthors Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Item | Returns an individual CoAuthor object in a collection.


CoAuthors.Item Method (Word)

 Copy code hover
[image]

CoAuthors.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual CoAuthor object in a collection.

Version Information

Version Added: Word 2010

Syntax

expression .Item(Index)

expression An expression that returns a CoAuthors object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The individual object to be returned.

Return Value

CoAuthor

See also

Concepts

CoAuthors Object

Other resources

CoAuthors Object Members


CoAuthUpdate Object (Word)

 Copy code hover
[image]

CoAuthUpdate Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a range of text that has been updated by a co-author.

Version Information

Version Added: Word 2010

Remarks

When a document that has co-authoring enabled is edited by more than one author, changes to the document by one author are pushed to other authors' versions of the document by using updates. When a co-author performs an explicit document save (by pressing CTRL + S, for example), changes made by other co-authors are merged into the document as updates. The CoAuthUpdates collection contains all changes that were merged into the document, where each change is a single update represented by a CoAuthUpdate object.

The contents of the CoAuthUpdates collection remains the same until a co-author performs another explicit document save. When the co-author saves the document again, if there are no new changes from other co-authors that are merged into the document, the CoAuthUpdates collection retains the same updates that were merged at the previous explicit save. If there are new changes that are merged into the document, the CoAuthUpdates collection contains the new updates for the document. Use a CoAuthUpdate object to retrieve an individual update from the CoAuthUpdates collection.

Example

The following code example gets the associated text in the range of each CoAuthUpdate object in the active document.

VBA Copy code Copy code
Dim caUpdate As CoAuthUpdate
Dim strText As String

For Each caUpdate In ActiveDocument.CoAuthoring.Updates
    strText = caUpdate.Range.Text
    MsgBox strText
Next caUpdate

See also

Concepts

Word Object Model Reference

Other resources

CoAuthUpdate Object Members


CoAuthUpdate Members (Word)

 Copy code hover
[image]

CoAuthUpdate Members (Word)
Send feedback

Published: July 16, 2012

Represents a range of text that has been updated by a co-author.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified CoAuthUpdate object.
Range | Returns a Range object that represents the portion of a document that is contained in the specified object. Read-only.


CoAuthUpdate Properties (Word)

 Copy code hover
[image]

CoAuthUpdate Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified CoAuthUpdate object.
Range | Returns a Range object that represents the portion of a document that is contained in the specified object. Read-only.


CoAuthUpdate.Application Property (Word)

 Copy code hover
[image]

CoAuthUpdate.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .Application

expression An expression that returns a CoAuthUpdate object.

See also

Concepts

CoAuthUpdate Object

Other resources

CoAuthUpdate Object Members


CoAuthUpdate.Creator Property (Word)

 Copy code hover
[image]

CoAuthUpdate.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version Information

Version Added: Word 2010

Syntax

expression .Creator

expression An expression that returns a CoAuthUpdate object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD". This property was primarily designed to be used on the Apple Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For more information about this property, see the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

CoAuthUpdate Object

Other resources

CoAuthUpdate Object Members


CoAuthUpdate.Parent Property (Word)

 Copy code hover
[image]

CoAuthUpdate.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified CoAuthUpdate object.

Version Information

Version Added: Word 2010

Syntax

expression .Parent

expression An expression that returns a CoAuthUpdate object.

See also

Concepts

CoAuthUpdate Object

Other resources

CoAuthUpdate Object Members


CoAuthUpdate.Range Property (Word)

 Copy code hover
[image]

CoAuthUpdate.Range Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the portion of a document that is contained in the specified object. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .Range

expression An expression that returns a CoAuthUpdate object.

Example

The following code example gets the document range for the first update in the active document.

VBA Copy code Copy code
Dim rng As Range

Set rng = ActiveDocument.CoAuthoring.Updates(1).Range

See also

Concepts

CoAuthUpdate Object

Other resources

CoAuthUpdate Object Members


CoAuthUpdates Object(Word)

 Copy code hover
[image]

CoAuthUpdates Object(Word)
See also Send feedback

Published: July 16, 2012

A collection of CoAuthUpdate objects that represent the updates that were merged into the document at the last explicit save.

Version Information

Version Added: Word 2010

Remarks

When a document with co-authoring enabled is edited by more than one author, changes to the document by one author are pushed to other authors' versions of the document using updates. When a co-author performs an explicit document save (by pressing CTRL + S, for example), changes made by other co-authors are merged into the document as updates. The CoAuthUpdates collection contains all the changes that were merged into the document, where each change is a single update.

The contents of the CoAuthUpdates collection remains the same until a co-author performs another explicit document save. When the co-author saves the document again, if there are no new changes from other co-authors that are merged into the document, the CoAuthUpdates collection retains the same updates that were merged at the previous explicit save. If there are new changes that are merged into the document, the CoAuthUpdates collection contains the new updates for the document.

Example

The following code example gets the number of the latest updates that were merged into the document at the last explicit save.

VBA Copy code Copy code
Dim countOfUpdates As Integer

countOfUpdates = ActiveDocument.CoAuthoring.Updates.Count

MsgBox "The number of updates is " & countOfUpdates

See also

Concepts

Word Object Model Reference

Other resources

CoAuthUpdates Object Members


CoAuthUpdates Members (Word)

 Copy code hover
[image]

CoAuthUpdates Members (Word)
Send feedback

Published: July 16, 2012

A collection of CoAuthUpdate objects that represent the updates that were merged into the document at the last explicit save.

Methods

Name | Description
Item | Returns an individual CoAuthUpdates object in a collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application. Read-only.
Count | Returns the number of items in the CoAuthUpdates collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified CoAuthUpdates object.


CoAuthUpdates Properties (Word)

 Copy code hover
[image]

CoAuthUpdates Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application. Read-only.
Count | Returns the number of items in the CoAuthUpdates collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified CoAuthUpdates object.


CoAuthUpdates.Application Property (Word)

 Copy code hover
[image]

CoAuthUpdates.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .Application

expression An expression that returns a CoAuthUpdates object.

See also

Concepts

CoAuthUpdates Object

Other resources

CoAuthUpdates Object Members


CoAuthUpdates.Count Property (Word)

 Copy code hover
[image]

CoAuthUpdates.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the number of items in the CoAuthUpdates collection. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .Count

expression An expression that returns a CoAuthUpdates object.

Example

The following code example displays the number of content updates that were merged into the active document at the last explicit save.

VBA Copy code Copy code
MsgBox "The active document contains " & _
    ActiveDocument.CoAuthoring.Updates.Count & " update(s)."

See also

Concepts

CoAuthUpdates Object

Other resources

CoAuthUpdates Object Members


CoAuthUpdates.Creator Property (Word)

 Copy code hover
[image]

CoAuthUpdates.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version Information

Version Added: Word 2010

Syntax

expression .Creator

expression An expression that returns a CoAuthUpdates object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD". This property was primarily designed to be used on the Apple Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For more information about this property, see the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

CoAuthUpdates Object

Other resources

CoAuthUpdates Object Members


CoAuthUpdates.Parent Property (Word)

 Copy code hover
[image]

CoAuthUpdates.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified CoAuthUpdates object.

Version Information

Version Added: Word 2010

Syntax

expression .Parent

expression An expression that returns a CoAuthUpdates object.

See also

Concepts

CoAuthUpdates Object

Other resources

CoAuthUpdates Object Members


CoAuthUpdates Methods (Word)

 Copy code hover
[image]

CoAuthUpdates Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Item | Returns an individual CoAuthUpdates object in a collection.


CoAuthUpdates.Item Method (Word)

 Copy code hover
[image]

CoAuthUpdates.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual CoAuthUpdates object in a collection.

Version Information

Version Added: Word 2010

Syntax

expression .Item(Index)

expression An expression that returns a CoAuthUpdates object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The individual object to be returned.

Return Value

CoAuthUpdate

See also

Concepts

CoAuthUpdates Object

Other resources

CoAuthUpdates Object Members


ColorFormat Object (Word)

 Copy code hover
[image]

ColorFormat Object (Word)
See also Send feedback

Published: July 16, 2012

Represents the color of a one-color object or the foreground or background color of an object with a gradient or patterned fill. You can set colors to an explicit red-green-blue value by using the RGB property.

Remarks

Use one of the properties listed in the following table to return a ColorFormat object.

Use this property | With this object | To return a ColorFormat object that represents this
BackColor | FillFormat | Background fill color (used in a shaded or patterned fill)
ForeColor | FillFormat | Foreground fill color (or the fill color for a solid fill)
BackColor | LineFormat | Background line color (used in a patterned line)
ForeColor | LineFormat | Foreground line color (or the line color for a solid line)
ForeColor | ShadowFormat | Shadow color
ExtrusionColor | ThreeDFormat | Color of the sides of an extruded object

Use the RGB property to set a color to an explicit red-green-blue value. The following example adds a rectangle to the active document and then sets the foreground color, background color, and gradient for the rectangle's fill.

VBA Copy code Copy code
With ActiveDocument.Shapes _
 .AddShape(msoShapeRectangle, 90, 90, 90, 50).Fill
 .ForeColor.RGB = RGB(128, 0, 0)
 .BackColor.RGB = RGB(170, 170, 170)
 .TwoColorGradient msoGradientHorizontal, 1
End With

See also

Concepts

Word Object Model Reference

Other resources

ColorFormat Object Members


ColorFormat Members (Word)

 Copy code hover
[image]

ColorFormat Members (Word)
Send feedback

Published: July 16, 2012

Represents the color of a one-color object or the foreground or background color of an object with a gradient or patterned fill. You can set colors to an explicit red-green-blue value by using the RGB property.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Brightness | Returns a Single that represents the brightness of a specified shape color. Read/write.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
ObjectThemeColor | Returns or sets a WdThemeColorIndex constant that represents the theme color for a color format. Read/write.
Parent | Returns an Object that represents the parent object of the specified ColorFormat object.
RGB | Returns or sets the red-green-blue (RGB) value of the specified color. Read/write Long.
TintAndShade | Returns a Single that represents the lightening or darkening of a specified shape's color. Read/write.
Type | Returns or sets the shape color type. Read-only MsoColorType.


ColorFormat Properties (Word)

 Copy code hover
[image]

ColorFormat Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Brightness | Returns a Single that represents the brightness of a specified shape color. Read/write.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
ObjectThemeColor | Returns or sets a WdThemeColorIndex constant that represents the theme color for a color format. Read/write.
Parent | Returns an Object that represents the parent object of the specified ColorFormat object.
RGB | Returns or sets the red-green-blue (RGB) value of the specified color. Read/write Long.
TintAndShade | Returns a Single that represents the lightening or darkening of a specified shape's color. Read/write.
Type | Returns or sets the shape color type. Read-only MsoColorType.


ColorFormat.Application Property (Word)

 Copy code hover
[image]

ColorFormat.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression A variable that represents a ColorFormat object.

See also

Concepts

ColorFormat Object

Other resources

ColorFormat Object Members


ColorFormat.Brightness Property (Word)

 Copy code hover
[image]

ColorFormat.Brightness Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Single that represents the brightness of a specified shape color. Read/write.

Version Information

Version Added: Word 2010

Syntax

expression .Brightness

expression A variable that represents a ColorFormat object.

Remarks

You can enter a number from -1 (darkest) to 1 (lightest) for the Brightness property, 0 (zero) being neutral.

Example

The following code example creates a new shape in the active document, sets the fill color, and brightens the color.

VBA Copy code Copy code
Sub NewTintedShape()
 Dim shpHeart As Shape

 Set shpHeart = ActiveDocument.Shapes _
 .AddShape(Type:=msoShapeHeart, Left:=150, _
 Top:=150, Width:=250, Height:=250)
 With shpHeart.Fill.ForeColor
 .RGB = RGB(Red:=255, Green:=28, Blue:=0)
 .Brightness = 0.4
 End With
End Sub

See also

Concepts

ColorFormat Object

Other resources

ColorFormat Object Members


ColorFormat.Creator Property (Word)

 Copy code hover
[image]

ColorFormat.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a ColorFormat object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

ColorFormat Object

Other resources

ColorFormat Object Members


ColorFormat.ObjectThemeColor Property (Word)

 Copy code hover
[image]

ColorFormat.ObjectThemeColor Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a WdThemeColorIndex constant that represents the theme color for a color format. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .ObjectThemeColor

expression An expression that returns a ColorFormat object.

See also

Concepts

ColorFormat Object

Other resources

ColorFormat Object Members


ColorFormat.Parent Property (Word)

 Copy code hover
[image]

ColorFormat.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified ColorFormat object.

Syntax

expression .Parent

expression Required. A variable that represents a ColorFormat object.

See also

Concepts

ColorFormat Object

Other resources

ColorFormat Object Members


ColorFormat.RGB Property (Word)

 Copy code hover
[image]

ColorFormat.RGB Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the red-green-blue (RGB) value of the specified color. Read/write Long.

Syntax

expression .RGB

expression A variable that represents a ColorFormat object.

Example

This example sets the color of the second shape in the active document to gray.

VBA Copy code Copy code
ActiveDocument.Shapes(2).Fill.ForeColor.RGB = RGB(128, 128, 128)

This example sets the color of the shadow for Rectangle 1 in the active document to blue.

VBA Copy code Copy code
ActiveDocument.Shapes("Rectangle 1").Shadow.ForeColor.RGB = _
 RGB(0, 0, 255)

This example returns the value of the foreground color of the first shape in the active document.

VBA Copy code Copy code
MsgBox ActiveDocument.Shapes(1).Fill.ForeColor.RGB

See also

Concepts

ColorFormat Object

Other resources

ColorFormat Object Members


ColorFormat.TintAndShade Property (Word)

 Copy code hover
[image]

ColorFormat.TintAndShade Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Single that represents the lightening or darkening of a specified shape's color. Read/write.

Syntax

expression .TintAndShade

expression An expression that returns a ColorFormat object.

Remarks

You can enter a number from -1 (darkest) to 1 (lightest) for the TintAndShade property, 0 (zero) being neutral.

Example

This example creates a new shape in the active document, sets the fill color, and lightens the color shade.

VBA Copy code Copy code
Sub NewTintedShape()
 Dim shpHeart As Shape
 Set shpHeart = ActiveDocument.Shapes _
 .AddShape(Type:=msoShapeHeart, Left:=150, _
 Top:=150, Width:=250, Height:=250)
 With shpHeart.Fill.ForeColor
 .RGB = RGB(Red:=255, Green:=28, Blue:=0)
 .TintAndShade = 0.3
 End With
End Sub

See also

Concepts

ColorFormat Object

Other resources

ColorFormat Object Members


ColorFormat.Type Property (Word)

 Copy code hover
[image]

ColorFormat.Type Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the shape color type. Read-only MsoColorType.

Syntax

expression .Type

expression Required. A variable that represents a ColorFormat object.

See also

Concepts

ColorFormat Object

Other resources

ColorFormat Object Members


Column Object (Word)

 Copy code hover
[image]

Column Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a single table column. The Column object is a member of the Columns collection. The Columns collection includes all the columns in a table, selection, or range.

Remarks

Use Columns(Index), where Index is the index number, to return a single Column object. The index number represents the position of the column in the Columns collection (counting from left to right).

The following example selects column one in table one in the active document.

VBA Copy code Copy code
ActiveDocument.Tables(1).Columns(1).Select

Use the Column property with a Cell object to return a Column object. The following example deletes the text in cell one, inserts new text, and then sorts the entire column.

VBA Copy code Copy code
With ActiveDocument.Tables(1).Cell(1, 1)
 .Range.Delete
 .Range.InsertBefore "Sales"
 .Column.Sort
End With

Use the Add method to add a column to a table. The following example adds a column to the first table in the active document, and then it makes the column widths equal.

VBA Copy code Copy code
If ActiveDocument.Tables.Count >= 1 Then
 Set myTable = ActiveDocument.Tables(1)
 myTable.Columns.Add BeforeColumn:=myTable.Columns(1)
 myTable.Columns.DistributeWidth
End If

Remarks

Use the Information property with a Selection object to return the current column number. The following example selects the current column and then displays the column number in a message box.

VBA Copy code Copy code
If Selection.Information(wdWithInTable) = True Then
 Selection.Columns(1).Select
 MsgBox "Column " _
 & Selection.Information(wdStartOfRangeColumnNumber)
End If

See also

Concepts

Word Object Model Reference

Other resources

Column Object Members


Column Members (Word)

 Copy code hover
[image]

Column Members (Word)
Send feedback

Published: July 16, 2012

Represents a single table column. The Column object is a member of the Columns collection. The Columns collection includes all the columns in a table, selection, or range.

Methods

Name | Description
AutoFit | Changes the width of a table column to accommodate the width of the text without changing the way text wraps in the cells.
Delete | Deletes the specified column.
Select | Selects the specified table column.
SetWidth | Sets the width of a column in a table.
Sort | Sorts the specified table column.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Borders | Returns a Borders collection that represents all the borders for the specified object.
Cells | Returns a Cells collection that represents the table cells in a table column. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Index | Returns a Long that represents the position of an item in a collection. Read-only.
IsFirst | True if the specified column or row is the first one in the table. Read-only Boolean.
IsLast | True if the specified column or row is the last one in the table. Read-only Boolean.
NestingLevel | Returns the nesting level of the specified column. Read-only Long.
Next | Returns the next column in a collection of table columns. Read-only.
Parent | Returns an Object that represents the parent object of the specified Column object.
PreferredWidth | Returns or sets the preferred width (in points or as a percentage of the window width) for the specified column. Read/write Single.
PreferredWidthType | Returns or sets the preferred unit of measurement to use for the width of the specified table column. Read/write WdPreferredWidthType.
Previous | Returns the previous column in a collection of table columns. Read-only.
Shading | Returns a Shading object that refers to the shading formatting for the specified column.
Width | Returns or sets the width of the specified column, in points. Read/write Long.


Column Properties (Word)

 Copy code hover
[image]

Column Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Borders | Returns a Borders collection that represents all the borders for the specified object.
Cells | Returns a Cells collection that represents the table cells in a table column. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Index | Returns a Long that represents the position of an item in a collection. Read-only.
IsFirst | True if the specified column or row is the first one in the table. Read-only Boolean.
IsLast | True if the specified column or row is the last one in the table. Read-only Boolean.
NestingLevel | Returns the nesting level of the specified column. Read-only Long.
Next | Returns the next column in a collection of table columns. Read-only.
Parent | Returns an Object that represents the parent object of the specified Column object.
PreferredWidth | Returns or sets the preferred width (in points or as a percentage of the window width) for the specified column. Read/write Single.
PreferredWidthType | Returns or sets the preferred unit of measurement to use for the width of the specified table column. Read/write WdPreferredWidthType.
Previous | Returns the previous column in a collection of table columns. Read-only.
Shading | Returns a Shading object that refers to the shading formatting for the specified column.
Width | Returns or sets the width of the specified column, in points. Read/write Long.


Column.Application Property (Word)

 Copy code hover
[image]

Column.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a Column object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

Column Object

Other resources

Column Object Members


Column.Borders Property (Word)

 Copy code hover
[image]

Column.Borders Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Borders collection that represents all the borders for the specified object.

Syntax

expression .Borders

expression Required. A variable that represents a Column object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

See also

Concepts

Column Object

Other resources

Column Object Members


Column.Cells Property (Word)

 Copy code hover
[image]

Column.Cells Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Cells collection that represents the table cells in a table column. Read-only.

Syntax

expression .Cells

expression A variable that represents a Column object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

See also

Concepts

Column Object

Other resources

Column Object Members


Column.Creator Property (Word)

 Copy code hover
[image]

Column.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a Column object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Column Object

Other resources

Column Object Members


Column.Index Property (Word)

 Copy code hover
[image]

Column.Index Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the position of an item in a collection. Read-only.

Syntax

expression .Index

expression Required. A variable that represents a Column object.

See also

Concepts

Column Object

Other resources

Column Object Members


Column.IsFirst Property (Word)

 Copy code hover
[image]

Column.IsFirst Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified column or row is the first one in the table. Read-only Boolean.

Syntax

expression .IsFirst

expression Required. A variable that represents a Column object.

Example

This example indicates whether the first column in the selection is the first column in the table.

VBA Copy code Copy code
MsgBox Selection.Columns(1).IsFirst

See also

Concepts

Column Object

Other resources

Column Object Members


Column.IsLast Property (Word)

 Copy code hover
[image]

Column.IsLast Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified column or row is the last one in the table. Read-only Boolean.

Syntax

expression .IsLast

expression Required. A variable that represents a Column object.

Example

This example determines whether the first column in the selection is the last column in the table.

VBA Copy code Copy code
If Selection.Information(wdWithInTable) = True Then
 MsgBox Selection.Columns(1).IsLast
End If

See also

Concepts

Column Object

Other resources

Column Object Members


Column.NestingLevel Property (Word)

 Copy code hover
[image]

Column.NestingLevel Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the nesting level of the specified column. Read-only Long.

Syntax

expression .NestingLevel

expression Required. A variable that represents a Column object.

Remarks

The outermost table has a nesting level of 1. The nesting level of each successively nested table is one higher than the previous table.

Example

This example creates a new document, creates a nested table with three levels, and then fills the first cell of each table with its nesting level.

VBA Copy code Copy code
Documents.Add
ActiveDocument.Tables.Add Selection.Range, _
 3, 3, wdWord9TableBehavior, wdAutoFitContent
With ActiveDocument.Tables(1).Range
 .Copy
 .Cells(1).Range.Text = .Cells(1).NestingLevel
 .Cells(5).Range.PasteAsNestedTable
 With .Cells(5).Tables(1).Range
 .Cells(1).Range.Text = .Cells(1).NestingLevel
 .Cells(5).Range.PasteAsNestedTable
 With .Cells(5).Tables(1).Range
 .Cells(1).Range.Text = _
 .Cells(1).NestingLevel
 End With
 End With
End With

See also

Concepts

Column Object

Other resources

Column Object Members


Column.Next Property (Word)

 Copy code hover
[image]

Column.Next Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the next column in a collection of table columns. Read-only.

Syntax

expression .Next

expression A variable that represents a Column object.

Example

If the selection is in a table, this example selects the contents of the next table column.

VBA Copy code Copy code
If Selection.Information(wdWithInTable) = True Then
 Selection.Columns(1).Next.Select
End If

See also

Concepts

Column Object

Other resources

Column Object Members


Column.Parent Property (Word)

 Copy code hover
[image]

Column.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Column object.

Syntax

expression .Parent

expression Required. A variable that represents a Column object.

See also

Concepts

Column Object

Other resources

Column Object Members


Column.PreferredWidth Property (Word)

 Copy code hover
[image]

Column.PreferredWidth Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the preferred width (in points or as a percentage of the window width) for the specified column. Read/write Single.

Syntax

expression PreferredWidth

expression Required. An expression that returns a Column object.

Remarks

If the PreferredWidthType property is set to wdPreferredWidthPoints, the PreferredWidth property returns or sets the width in points. If the PreferredWidthType property is set to wdPreferredWidthPercent, the PreferredWidth property returns or sets the width as a percentage of the window width.

See also

Concepts

Column Object

Other resources

Column Object Members


Column.PreferredWidthType Property (Word)

 Copy code hover
[image]

Column.PreferredWidthType Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the preferred unit of measurement to use for the width of the specified table column. Read/write WdPreferredWidthType.

Syntax

expression .PreferredWidthType

expression Required. A variable that represents a Column object.

See also

Concepts

Column Object

Other resources

Column Object Members


Column.Previous Property (Word)

 Copy code hover
[image]

Column.Previous Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the previous column in a collection of table columns. Read-only.

Syntax

expression .Previous

expression A variable that represents a Column object.

Example

If the selection is in a table, this example selects the contents of the previous table column.

VBA Copy code Copy code
If Selection.Information(wdWithInTable) = True Then
 Selection.Columns(1).Previous.Select
End If

See also

Concepts

Column Object

Other resources

Column Object Members


Column.Shading Property (Word)

 Copy code hover
[image]

Column.Shading Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Shading object that refers to the shading formatting for the specified column.

Syntax

expression .Shading

expression Required. A variable that represents a Column object.

Example

This example applies horizontal line texture to the first column in the first table in the active document.

VBA Copy code Copy code
If ActiveDocument.Tables.Count >= 1 Then
 With ActiveDocument.Tables(1).Columns(1).Shading
 .Texture = wdTextureHorizontal
 End With
End If

See also

Concepts

Column Object

Other resources

Column Object Members


Column.Width Property (Word)

 Copy code hover
[image]

Column.Width Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the width of the specified column, in points. Read/write Long.

Syntax

expression .Width

expression A variable that represents a Column object.

See also

Concepts

Column Object

Other resources

Column Object Members


Column Methods (Word)

 Copy code hover
[image]

Column Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
AutoFit | Changes the width of a table column to accommodate the width of the text without changing the way text wraps in the cells.
Delete | Deletes the specified column.
Select | Selects the specified table column.
SetWidth | Sets the width of a column in a table.
Sort | Sorts the specified table column.


Column.AutoFit Method (Word)

 Copy code hover
[image]

Column.AutoFit Method (Word)
See also Send feedback

Published: July 16, 2012

Changes the width of a table column to accommodate the width of the text without changing the way text wraps in the cells.

Syntax

expression .AutoFit

expression Required. A variable that represents a Column object.

Remarks

If the table is already as wide as the distance between the left and right margins, this method has no affect.

Example

This example creates a 3x3 table in a new document and then changes the width of the first column to accommodate the width of the text.

VBA Copy code Copy code
Dim docNew as Document
Dim tableNew as Table

Set docNew = Documents.Add
Set tableNew = docNew.Tables.Add(Range:=Selection.Range, _
 NumRows:=3, NumColumns:=3)
With tableNew
 .Cell(1,1).Range.InsertAfter "First cell"
 .Columns(1).AutoFit
End With

This example creates a 3x3 table in a new document and then changes the width of all the columns to accommodate the width of the text.

VBA Copy code Copy code
Dim docNew as Document
Dim tableNew as Table

Set docNew = Documents.Add
Set tableNew = docNew.Tables.Add(Selection.Range, 3, 3)
With tableNew
 .Cell(1,1).Range.InsertAfter "First cell"
 .Cell(1,2).Range.InsertAfter "This is cell (1,2)"
 .Cell(1,3).Range.InsertAfter "(1,3)"
 .Columns.AutoFit
End With

See also

Concepts

Column Object

Other resources

Column Object Members


Column.Delete Method (Word)

 Copy code hover
[image]

Column.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the specified column.

Syntax

expression .Delete

expression Required. A variable that represents a Column object.

See also

Concepts

Column Object

Other resources

Column Object Members


Column.Select Method (Word)

 Copy code hover
[image]

Column.Select Method (Word)
See also Send feedback

Published: July 16, 2012

Selects the specified table column.

Syntax

expression .Select

expression Required. A variable that represents a Column object.

Remarks

After using this method, use the Selection property to work with the selected items. For more information, see Working with the Selection Object.

See also

Concepts

Column Object

Other resources

Column Object Members


Column.SetWidth Method (Word)

 Copy code hover
[image]

Column.SetWidth Method (Word)
See also Send feedback

Published: July 16, 2012

Sets the width of a column in a table.

Syntax

expression .SetWidth(ColumnWidth, RulerStyle)

expression Required. A variable that represents a Column object.

Parameters

Name | Required/Optional | Data Type | Description
ColumnWidth | Required | Single | The width of the specified column or columns, in points.
RulerStyle | Required | WdRulerStyle | Controls the way Word adjusts cell widths.

Remarks

The WdRulerStyle behavior described above applies to left-aligned tables. The WdRulerStyle behavior for center- and right-aligned tables can be unexpected; in these cases, the SetWidth method should be used with care.

See also

Concepts

Column Object

Other resources

Column Object Members


Column.Sort Method (Word)

 Copy code hover
[image]

Column.Sort Method (Word)
See also Send feedback

Published: July 16, 2012

Sorts the specified table column.

Syntax

expression .Sort(ExcludeHeader, SortFieldType, SortOrder, CaseSensitive, BidiSort, IgnoreThe, IgnoreKashida, IgnoreDiacritics, IgnoreHe, LanguageID)

expression Required. A variable that represents a Column object.

Parameters

Name | Required/Optional | Data Type | Description
ExcludeHeader | Optional | Variant | True to exclude the first row or paragraph header from the sort operation. The default value is False.
SortFieldType | Optional | Variant | The sort type for the column. Can be one of the WdSortFieldType constants.
SortOrder | Optional | Variant | The sorting order to use for the column. Can be one WdSortOrder constant.
CaseSensitive | Optional | Variant | True to sort with case sensitivity. The default value is False.
BidiSort | Optional | Variant | True to sort based on right-to-left language rules. This argument may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.
IgnoreThe | Optional | Variant | True to ignore the Arabic character alef lam when sorting right-to-left language text. This argument may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.
IgnoreKashida | Optional | Variant | True to ignore kashidas when sorting right-to-left language text. This argument may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.
IgnoreDiacritics | Optional | Variant | True to ignore bidirectional control characters when sorting right-to-left language text. This argument may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.
IgnoreHe | Optional | Variant | True to ignore the Hebrew character he when sorting right-to-left language text. This argument may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.
LanguageID | Optional | Variant | Specifies the sorting language. Can be one of the WdLanguageID constants.

Remarks

If you want to sort paragraphs within a table cell, include only the paragraphs and not the end-of-cell mark; if you include the end-of-cell mark in a selection or range and then attempt to sort the paragraphs, Word displays a message stating that it found no valid records to sort.

See also

Concepts

Column Object

Other resources

Column Object Members


Columns Object (Word)

 Copy code hover
[image]

Columns Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of Column objects that represent the columns in a table.

Remarks

Use the Columns property of a Range, Selection, or Table object to return a Columns collection. The following example displays the number of Column objects in the Columns collection for the first table in the active document.

VBA Copy code Copy code
MsgBox ActiveDocument.Tables(1).Columns.Count

The following example creates a table with six columns and three rows and then formats each column with a progressively larger (darker) shading percentage.

VBA Copy code Copy code
Set myTable = ActiveDocument.Tables.Add(Range:=Selection.Range, _
 NumRows:=3, NumColumns:=6)
For Each col In myTable.Columns
 col.Shading.Texture = 2 + i
 i = i + 1
Next col

Use the Add method to add a column to a table. The following example adds a column to the first table in the active document, and then it makes the column widths equal.

VBA Copy code Copy code
If ActiveDocument.Tables.Count >= 1 Then
 Set myTable = ActiveDocument.Tables(1)
 myTable.Columns.Add BeforeColumn:=myTable.Columns(1)
 myTable.Columns.DistributeWidth
End If

Use Columns(Index), where Index is the index number, to return a single Column object. The index number represents the position of the column in the Columns collection (counting from left to right). The following example selects the first column in the first table.

VBA Copy code Copy code
ActiveDocument.Tables(1).Columns(1).Select

See also

Concepts

Word Object Model Reference

Other resources

Columns Object Members


Columns Members (Word)

 Copy code hover
[image]

Columns Members (Word)
Send feedback

Published: July 16, 2012

A collection of Column objects that represent the columns in a table.

Methods

Name | Description
Add | Returns a Column object that represents a column added to a table.
AutoFit | Changes the width of a table column to accommodate the width of the text without changing the way text wraps in the cells.
Delete | Deletes the specified columns.
DistributeWidth | Adjusts the width of the specified columns so that they are equal.
Item | Returns an individual Column object in a collection.
Select | Selects the specified table columns.
SetWidth | Sets the width of columns in a table.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Borders | Returns a Borders collection that represents all the borders for the specified columns.
Count | Returns a Long that represents the number of columns in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
First | Returns a Column object that represents the first item in the Columns collection.
Last | Returns a Column object that represents the last column in a table.
NestingLevel | Returns the nesting level of the specified columns. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified Columns object.
PreferredWidth | Returns or sets the preferred width (in points or as a percentage of the window width) for the specified columns. Read/write Single.
PreferredWidthType | Returns or sets the preferred unit of measurement to use for the width of the specified cells, columns, or table. Read/write WdPreferredWidthType.
Shading | Returns a Shading object that refers to the shading formatting for the specified table columns.
Width | Returns or sets the width of the specified columns, in points. Read/write Long.


Columns Properties (Word)

 Copy code hover
[image]

Columns Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Borders | Returns a Borders collection that represents all the borders for the specified columns.
Count | Returns a Long that represents the number of columns in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
First | Returns a Column object that represents the first item in the Columns collection.
Last | Returns a Column object that represents the last column in a table.
NestingLevel | Returns the nesting level of the specified columns. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified Columns object.
PreferredWidth | Returns or sets the preferred width (in points or as a percentage of the window width) for the specified columns. Read/write Single.
PreferredWidthType | Returns or sets the preferred unit of measurement to use for the width of the specified cells, columns, or table. Read/write WdPreferredWidthType.
Shading | Returns a Shading object that refers to the shading formatting for the specified table columns.
Width | Returns or sets the width of the specified columns, in points. Read/write Long.


Columns.Application Property (Word)

 Copy code hover
[image]

Columns.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a Columns collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

Columns Collection Object

Other resources

Columns Object Members


Columns.Borders Property (Word)

 Copy code hover
[image]

Columns.Borders Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Borders collection that represents all the borders for the specified columns.

Syntax

expression .Borders

expression Required. A variable that represents a Columns collection.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

See also

Concepts

Columns Collection Object

Other resources

Columns Object Members


Columns.Count Property (Word)

 Copy code hover
[image]

Columns.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of columns in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents a Columns collection.

See also

Concepts

Columns Collection Object

Other resources

Columns Object Members


Columns.Creator Property (Word)

 Copy code hover
[image]

Columns.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a Columns collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Columns Collection Object

Other resources

Columns Object Members


Columns.First Property (Word)

 Copy code hover
[image]

Columns.First Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Column object that represents the first item in the Columns collection.

Syntax

expression .First

expression Required. A variable that represents a Columns collection.

See also

Concepts

Columns Collection Object

Other resources

Columns Object Members


Columns.Last Property (Word)

 Copy code hover
[image]

Columns.Last Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Column object that represents the last column in a table.

Syntax

expression .Last

expression Required. A variable that represents a Columns collection.

See also

Concepts

Columns Collection Object

Other resources

Columns Object Members


Columns.NestingLevel Property (Word)

 Copy code hover
[image]

Columns.NestingLevel Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the nesting level of the specified columns. Read-only Long.

Syntax

expression .NestingLevel

expression Required. A variable that represents a Columns collection.

Remarks

The outermost table has a nesting level of 1. The nesting level of each successively nested table is one higher than the previous table.

See also

Concepts

Columns Collection Object

Other resources

Columns Object Members


Columns.Parent Property (Word)

 Copy code hover
[image]

Columns.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Columns object.

Syntax

expression .Parent

expression Required. A variable that represents a Columns collection.

See also

Concepts

Columns Collection Object

Other resources

Columns Object Members


Columns.PreferredWidth Property (Word)

 Copy code hover
[image]

Columns.PreferredWidth Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the preferred width (in points or as a percentage of the window width) for the specified columns. Read/write Single.

Syntax

expression .PreferredWidth

expression Required. An expression that returns a Columns collection.

Remarks

If the PreferredWidthType property is set to wdPreferredWidthPoints, the PreferredWidth property returns or sets the width in points. If the PreferredWidthType property is set to wdPreferredWidthPercent, the PreferredWidth property returns or sets the width as a percentage of the window width.

See also

Concepts

Columns Collection Object

Other resources

Columns Object Members


Columns.PreferredWidthType Property (Word)

 Copy code hover
[image]

Columns.PreferredWidthType Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the preferred unit of measurement to use for the width of the specified cells, columns, or table. Read/write WdPreferredWidthType.

Syntax

expression .PreferredWidthType

expression Required. A variable that represents a Columns collection.

Example

This example sets Microsoft Word to accept widths as a percentage of window width, and then it sets the width of all columns in the first table in the active document to 50% of the window width.

VBA Copy code Copy code
With ActiveDocument.Tables(1).Columns
 .PreferredWidthType = wdPreferredWidthPercent
 .PreferredWidth = 50
End With

See also

Concepts

Columns Collection Object

Other resources

Columns Object Members


Columns.Shading Property (Word)

 Copy code hover
[image]

Columns.Shading Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Shading object that refers to the shading formatting for the specified table columns.

Syntax

expression .Shading

expression Required. A variable that represents a Columns collection.

Example

This example applies horizontal line texture to all columns in the first table in the active document.

VBA Copy code Copy code
If ActiveDocument.Tables.Count >= 1 Then
 With ActiveDocument.Tables(1).Columns.Shading
 .Texture = wdTextureDiagonalDown
 End With
End If

See also

Concepts

Columns Collection Object

Other resources

Columns Object Members


Columns.Width Property (Word)

 Copy code hover
[image]

Columns.Width Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the width of the specified columns, in points. Read/write Long.

Syntax

expression .Width

expression A variable that represents a Columns collection.

Example

This example creates a 5x5 table in a new document and then sets the width of all the columns in the table to 1.5 inches.

VBA Copy code Copy code
Dim objDoc As Document
Dim objTable As Table

Set objDoc = ActiveDocument
Set objTable = objDoc.Tables.Add(Range:=Selection.Range, _
 NumRows:=5, NumColumns:=5)
objTable.Columns.Width = InchesToPoints(1.5)

See also

Concepts

Columns Collection Object

Other resources

Columns Object Members


Columns Methods (Word)

 Copy code hover
[image]

Columns Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Returns a Column object that represents a column added to a table.
AutoFit | Changes the width of a table column to accommodate the width of the text without changing the way text wraps in the cells.
Delete | Deletes the specified columns.
DistributeWidth | Adjusts the width of the specified columns so that they are equal.
Item | Returns an individual Column object in a collection.
Select | Selects the specified table columns.
SetWidth | Sets the width of columns in a table.


Columns.Add Method (Word)

 Copy code hover
[image]

Columns.Add Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a Column object that represents a column added to a table.

Syntax

expression .Add(BeforeColumn)

expression Required. A variable that represents a Columns collection.

Parameters

Name | Required/Optional | Data Type | Description
BeforeColumn | Optional | Variant | A Column object that represents the column that will appear immediately to the right of the new column.

Return Value

Column

Example

This example creates a table with two columns and two rows in the active document and then adds another column before the first column. The width of the new column is set at 1.5 inches.

VBA Copy code Copy code
Sub AddATable()
 Dim myTable As Table
 Dim newCol As Column

 Set myTable = ActiveDocument.Tables.Add(Selection.Range, 2, 2)
 Set newCol = myTable.Columns.Add(BeforeColumn:=myTable.Columns(1))
 newCol.SetWidth ColumnWidth:=InchesToPoints(1.5), _
 RulerStyle:=wdAdjustNone
End Sub

See also

Concepts

Columns Collection Object

Other resources

Columns Object Members


Columns.AutoFit Method (Word)

 Copy code hover
[image]

Columns.AutoFit Method (Word)
See also Send feedback

Published: July 16, 2012

Changes the width of a table column to accommodate the width of the text without changing the way text wraps in the cells.

Syntax

expression .AutoFit

expression Required. A variable that represents a Columns collection.

Remarks

If the table is already as wide as the distance between the left and right margins, this method has no affect.

Example

This example creates a 3x3 table in a new document and then changes the width of the first column to accommodate the width of the text.

VBA Copy code Copy code
Dim docNew as Document
Dim tableNew as Table

Set docNew = Documents.Add
Set tableNew = docNew.Tables.Add(Range:=Selection.Range, _
 NumRows:=3, NumColumns:=3)
With tableNew
 .Cell(1,1).Range.InsertAfter "First cell"
 .Columns(1).AutoFit
End With

This example creates a 3x3 table in a new document and then changes the width of all the columns to accommodate the width of the text.

VBA Copy code Copy code
Dim docNew as Document
Dim tableNew as Table

Set docNew = Documents.Add
Set tableNew = docNew.Tables.Add(Selection.Range, 3, 3)
With tableNew
 .Cell(1,1).Range.InsertAfter "First cell"
 .Cell(1,2).Range.InsertAfter "This is cell (1,2)"
 .Cell(1,3).Range.InsertAfter "(1,3)"
 .Columns.AutoFit
End With

See also

Concepts

Columns Collection Object

Other resources

Columns Object Members


Columns.Delete Method (Word)

 Copy code hover
[image]

Columns.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the specified columns.

Syntax

expression .Delete

expression Required. A variable that represents a Columns collection.

See also

Concepts

Columns Collection Object

Other resources

Columns Object Members


Columns.DistributeWidth Method (Word)

 Copy code hover
[image]

Columns.DistributeWidth Method (Word)
See also Send feedback

Published: July 16, 2012

Adjusts the width of the specified columns so that they are equal.

Syntax

expression .DistributeWidth

expression Required. A variable that represents a Columns collection.

Example

This example adjusts the width of the columns in the first table in the active document so that they're equal.

VBA Copy code Copy code
ActiveDocument.Tables(1).Columns.DistributeWidth

This example adjusts the height of the selected cells.

VBA Copy code Copy code
If Selection.Cells.Count >= 2 Then
 Selection.Cells.DistributeWidth
End If

See also

Concepts

Columns Collection Object

Other resources

Columns Object Members


Columns.Item Method (Word)

 Copy code hover
[image]

Columns.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual Column object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents a Columns collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The individual object to be returned. Can be a Long indicating the ordinal position of the individual object.

Return Value

Column

See also

Concepts

Columns Collection Object

Other resources

Columns Object Members


Columns.Select Method (Word)

 Copy code hover
[image]

Columns.Select Method (Word)
See also Send feedback

Published: July 16, 2012

Selects the specified table columns.

Syntax

expression .Select

expression Required. A variable that represents a Columns collection.

Remarks

After using this method, use the Selection object to work with the selected items. For more information, see Working with the Selection Object.

See also

Concepts

Columns Collection Object

Other resources

Columns Object Members


Columns.SetWidth Method (Word)

 Copy code hover
[image]

Columns.SetWidth Method (Word)
See also Send feedback

Published: July 16, 2012

Sets the width of columns in a table.

Syntax

expression .SetWidth(ColumnWidth, RulerStyle)

expression Required. A variable that represents a Columns collection.

Parameters

Name | Required/Optional | Data Type | Description
ColumnWidth | Required | Single | The width of the specified column or columns, in points.
RulerStyle | Required | WdRulerStyle | Controls the way Word adjusts cell widths.

Remarks

The WdRulerStyle behavior described above applies to left-aligned tables. The WdRulerStyle behavior for center- and right-aligned tables can be unexpected; in these cases, the SetWidth method should be used with care.

See also

Concepts

Columns Collection Object

Other resources

Columns Object Members


Comment Object (Word)

 Copy code hover
[image]

Comment Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a single comment. The Comment object is a member of the Comments collection. The Comments collection includes comments in a selection, range or document.

Remarks

Use Comments(Index), where Index is the index number, to return a single Comment object. The index number represents the position of the comment in the specified selection, range, or document. The following example displays the author of the first comment in the active document.

VBA Copy code Copy code
MsgBox ActiveDocument.Comments(1).Author

Use the Add method to add a comment at the specified range. The following example adds a comment immediately after the selection.

VBA Copy code Copy code
Selection.Collapse Direction:=wdCollapseEnd
ActiveDocument.Comments.Add Range:=Selection.Range, _
 Text:="review this"

Use the Reference property to return the reference mark associated with the specified comment. Use the Range property to return the text associated with the specified comment. The following example displays the text associated with the first comment in the active document.

VBA Copy code Copy code
MsgBox ActiveDocument.Comments(1).Range.Text

See also

Concepts

Word Object Model Reference

Other resources

Comment Object Members


Comment Members (Word)

 Copy code hover
[image]

Comment Members (Word)
Send feedback

Published: July 16, 2012

Represents a single comment. The Comment object is a member of the Comments collection. The Comments collection includes comments in a selection, range or document.

Methods

Name | Description
DeleteRecursively | Deletes the specified comment and all replies associated with it.
Edit | Opens the specified OLE object for editing in the application it was created in.

Properties

Name | Description
Ancestor | For comments that are replies to existing comments, returns the parent Comment object; for new (top-level) comments, returns null. Read-only.
Application | Returns an Application object that represents the Microsoft Word application.
Contact | Returns a CoAuthor object that represents the author of the specified comment. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Date | Returns a Date that represents the date and time that a comment was inserted. Read-only.
Done | Returns or sets a Boolean whose value is true if the specified comment has been marked closed. Read-write.
Index | Returns a Long that represents the position of an item in a collection. Read-only.
IsInk | Returns a Boolean that represents whether a comment is a handwritten comment.
Parent | Returns an Object that represents the parent object of the specified Comment object.
Range | Returns a Range object that represents the contents of a comment.
Reference | Returns a Range object that represents a reference mark for a comment.
Replies | Returns a Comments collection of Comment objects that are children of the specified comment. Read-only.
Scope | Returns a Range object that represents the range of text marked by the specified comment.


Comment Properties (Word)

 Copy code hover
[image]

Comment Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Ancestor | For comments that are replies to existing comments, returns the parent Comment object; for new (top-level) comments, returns null. Read-only.
Application | Returns an Application object that represents the Microsoft Word application.
Contact | Returns a CoAuthor object that represents the author of the specified comment. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Date | Returns a Date that represents the date and time that a comment was inserted. Read-only.
Done | Returns or sets a Boolean whose value is true if the specified comment has been marked closed. Read-write.
Index | Returns a Long that represents the position of an item in a collection. Read-only.
IsInk | Returns a Boolean that represents whether a comment is a handwritten comment.
Parent | Returns an Object that represents the parent object of the specified Comment object.
Range | Returns a Range object that represents the contents of a comment.
Reference | Returns a Range object that represents a reference mark for a comment.
Replies | Returns a Comments collection of Comment objects that are children of the specified comment. Read-only.
Scope | Returns a Range object that represents the range of text marked by the specified comment.


Comment.Ancestor Property (Word)

 Copy code hover
[image]

Comment.Ancestor Property (Word)
See also Send feedback

Published: July 16, 2012

For comments that are replies to existing comments, returns the parent Comment object; for new (top-level) comments, returns null. Read-only.

Version information

Version Added: Word 2013

Syntax

expression .Ancestor

expression A variable that represents a Comment object.

Property value

COMMENT

See also

Concepts

Comment Object

Other resources

Comment Members


Comment.Application Property (Word)

 Copy code hover
[image]

Comment.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a Comment object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

Comment Object

Other resources

Comment Object Members


Comment.Contact Property (Word)

 Copy code hover
[image]

Comment.Contact Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a CoAuthor object that represents the author of the specified comment. Read-only.

Version information

Version Added: Word 2013

Syntax

expression .Contact

expression A variable that represents a Comment object.

Property value

COAUTHOR

See also

Concepts

Comment Object

Other resources

Comment Members


Comment.Creator Property (Word)

 Copy code hover
[image]

Comment.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a Comment object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Comment Object

Other resources

Comment Object Members


Comment.Date Property (Word)

 Copy code hover
[image]

Comment.Date Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Date that represents the date and time that a comment was inserted. Read-only.

Syntax

expression .Date

expression A variable that represents a Comment object.

See also

Concepts

Comment Object

Other resources

Comment Object Members


Comment.Done Property (Word)

 Copy code hover
[image]

Comment.Done Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean whose value is true if the specified comment has been marked closed. Read-write.

Version information

Version Added: Word 2013

Syntax

expression .Done

expression A variable that represents a Comment object.

Property value

BOOL

See also

Concepts

Comment Object

Other resources

Comment Members


Comment.Index Property (Word)

 Copy code hover
[image]

Comment.Index Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the position of an item in a collection. Read-only.

Syntax

expression .Index

expression Required. A variable that represents a Comment object.

See also

Concepts

Comment Object

Other resources

Comment Object Members


Comment.IsInk Property (Word)

 Copy code hover
[image]

Comment.IsInk Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Boolean that represents whether a comment is a handwritten comment.

Syntax

expression .IsInk

expression An expression that returns a Comment object.

Example

The following example removes all handwritten comments from the active document.

VBA Copy code Copy code
Dim objComment As Comment

For Each objComment In ActiveDocument.Comments
 If objComment.IsInk = True Then
 objComment.Delete
 End If
Next

See also

Concepts

Comment Object

Other resources

Comment Object Members


Comment.Parent Property (Word)

 Copy code hover
[image]

Comment.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Comment object.

Syntax

expression .Parent

expression Required. A variable that represents a Comment object.

See also

Concepts

Comment Object

Other resources

Comment Object Members


Comment.Range Property (Word)

 Copy code hover
[image]

Comment.Range Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the contents of a comment.

Syntax

expression .Range

expression Required. A variable that represents a Comment object.

Example

This example changes the text of the first comment in the document.

VBA Copy code Copy code
With ActiveDocument.Comments(1).Range
 .Delete
 .InsertBefore "new comment text"
End With

See also

Concepts

Comment Object

Other resources

Comment Object Members


Comment.Reference Property (Word)

 Copy code hover
[image]

Comment.Reference Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents a reference mark for a comment.

Syntax

expression .Reference

expression Required. A variable that represents a Comment object.

See also

Concepts

Comment Object

Other resources

Comment Object Members


Comment.Replies Property (Word)

 Copy code hover
[image]

Comment.Replies Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Comments collection of Comment objects that are children of the specified comment. Read-only.

Version information

Version Added: Word 2013

Syntax

expression .Replies

expression A variable that represents a Comment object.

Remarks

Calling the Add method on the returned collection of replies adds a new reply, unless the collection was accessed from a reply to a reply.

The Comments.ShowBy property fails when called on the Comments collection returned by the Replies property.

Property value

COMMENTS

See also

Concepts

Comment Object

Other resources

Comment Members


Comment.Scope Property (Word)

 Copy code hover
[image]

Comment.Scope Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the range of text marked by the specified comment.

Syntax

expression .Scope

expression An expression that returns a Comment object.

Example

This example displays the text associated with the first comment in the selection.

VBA Copy code Copy code
If Selection.Comments.Count >= 1 Then
 Set myRange = Selection.Comments(1).Scope
 MsgBox myRange.Text
End If

This example copies the text associated with the last comment in the active document.

VBA Copy code Copy code
total = ActiveDocument.Comments.Count
If total >= 1 Then ActiveDocument.Comments(total).Scope.Copy

See also

Concepts

Comment Object

Other resources

Comment Object Members


Comment Methods (Word)

 Copy code hover
[image]

Comment Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
DeleteRecursively | Deletes the specified comment and all replies associated with it.
Edit | Opens the specified OLE object for editing in the application it was created in.


Comment.DeleteRecursively Method (Word)

 Copy code hover
[image]

Comment.DeleteRecursively Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the specified comment and all replies associated with it.

Version information

Version Added: Word 2013

Syntax

expression .DeleteRecursively

expression A variable that represents a Comment object.

Return value

VOID

See also

Concepts

Comment Object

Other resources

Comment Members


Comment.Edit Method (Word)

 Copy code hover
[image]

Comment.Edit Method (Word)
See also Send feedback

Published: July 16, 2012

Opens the specified OLE object for editing in the application it was created in.

Syntax

expression .Edit

expression Required. A variable that represents a Comment object.

Example

This example opens (for editing) the first embedded OLE object (defined as a shape) on the active document.

VBA Copy code Copy code
Dim shapesAll As Shapes

Set shapesAll = ActiveDocument.Shapes
If shapesAll.Count >= 1 Then
 If shapesAll(1).Type = msoEmbeddedOLEObject Then
 shapesAll(1).OLEFormat.Edit
 End If
End If

This example opens (for editing) the first linked OLE object (defined as an inline shape) in the active document.

VBA Copy code Copy code
Dim colIS As InlineShapes

Set colIS = ActiveDocument.InlineShapes
If colIS.Count >= 1 Then
 If colIS(1).Type = wdInlineShapeLinkedOLEObject Then
 colIS(1).OLEFormat.Edit
 End If
End If

See also

Concepts

Comment Object

Other resources

Comment Object Members


Comments Object (Word)

 Copy code hover
[image]

Comments Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of Comment objects that represent the comments in a selection, range, or document.

Remarks

Use the Comments property to return the Comments collection. The following example displays comments made by Don Funk in the active document.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.View.SplitSpecial = wdPaneComments
ActiveDocument.Comments.ShowBy = "Don Funk"

Use the Add method to add a comment at the specified range. The following example adds a comment immediately after the selection.

VBA Copy code Copy code
Selection.Collapse Direction:=wdCollapseEnd
ActiveDocument.Comments.Add Range:=Selection.Range, _
 Text:="review this"

Use Comments(Index), where Index is the index number, to return a single Comment object. The index number represents the position of the comment in the specified selection, range, or document. The following example displays the author of the first comment in the active document.

VBA Copy code Copy code
MsgBox ActiveDocument.Comments(1).Author

The following example displays the initials of the author of the first comment in the selection.

VBA Copy code Copy code
If Selection.Comments.Count >= 1 Then MsgBox _
 Selection.Comments(1).Initial

See also

Concepts

Word Object Model Reference

Other resources

Comments Object Members


Comments Members (Word)

 Copy code hover
[image]

Comments Members (Word)
Send feedback

Published: July 16, 2012

A collection of Comment objects that represent the comments in a selection, range, or document.

Methods

Name | Description
Add | Returns a Comment object that represents a comment added to a range.
Item | Returns an individual Comment object in a collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of items in the Comments collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified Comments object.
ShowBy | Returns or sets the name of the reviewer whose comments are shown in the comments pane. Read/write String.


Comments Properties (Word)

 Copy code hover
[image]

Comments Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of items in the Comments collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified Comments object.
ShowBy | Returns or sets the name of the reviewer whose comments are shown in the comments pane. Read/write String.


Comments.Application Property (Word)

 Copy code hover
[image]

Comments.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a Comments collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

Comments Collection Object

Other resources

Comments Object Members


Comments.Count Property (Word)

 Copy code hover
[image]

Comments.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of items in the Comments collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents a Comments collection.

See also

Concepts

Comments Collection Object

Other resources

Comments Object Members


Comments.Creator Property (Word)

 Copy code hover
[image]

Comments.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a Comments collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Comments Collection Object

Other resources

Comments Object Members


Comments.Parent Property (Word)

 Copy code hover
[image]

Comments.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Comments object.

Syntax

expression .Parent

expression Required. A variable that represents a Comments collection.

See also

Concepts

Comments Collection Object

Other resources

Comments Object Members


Comments.ShowBy Property (Word)

 Copy code hover
[image]

Comments.ShowBy Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the name of the reviewer whose comments are shown in the comments pane. Read/write String.

Syntax

expression .ShowBy

expression An expression that returns a Comments collection object.

Remarks

You can choose to show comments either by a single reviewer or by all reviewers. To view the comments by all reviewers, set this property to "All Reviewers."

Example

The following example displays comments made by Don Funk.

VBA Copy code Copy code
If ActiveDocument.Comments.Count >= 1 Then
 ActiveDocument.ActiveWindow.View.SplitSpecial = wdPaneComments
 ActiveDocument.Comments.ShowBy = "Don Funk"
End If

See also

Concepts

Comments Collection Object

Other resources

Comments Object Members


Comments Methods (Word)

 Copy code hover
[image]

Comments Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Returns a Comment object that represents a comment added to a range.
Item | Returns an individual Comment object in a collection.


Comments.Add Method (Word)

 Copy code hover
[image]

Comments.Add Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a Comment object that represents a comment added to a range.

Syntax

expression .Add(Range, Text)

expression Required. A variable that represents a Comments collection.

Parameters

Name | Required/Optional | Data Type | Description
Range | Required | Range object | The range to have a comment added to it.
Text | Optional | Variant | The text of the comment.

Return Value

Comment

Example

This example adds a comment at the insertion point.

VBA Copy code Copy code
Sub AddComment()
 Selection.Collapse Direction:=wdCollapseEnd
 ActiveDocument.Comments.Add _
 Range:=Selection.Range, Text:="review this"
End Sub

This example adds a comment to the third paragraph in the active document.

VBA Copy code Copy code
Sub Comment3rd()
 Dim myRange As Range

 Set myRange = ActiveDocument.Paragraphs(3).Range
 ActiveDocument.Comments.Add Range:=myRange, _
 Text:="original third paragraph"
End Sub

See also

Concepts

Comments Collection Object

Other resources

Comments Object Members


Comments.Item Method (Word)

 Copy code hover
[image]

Comments.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual Comment object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents a Comments collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The individual object to be returned. Can be a Long indicating the ordinal position of the individual object.

Return Value

Comment

See also

Concepts

Comments Collection Object

Other resources

Comments Object Members


ConditionalStyle Object (Word)

 Copy code hover
[image]

ConditionalStyle Object (Word)
See also Send feedback

Published: July 16, 2012

Represents special formatting applied to specified areas of a table when the selected table is formatted with a specified table style.

Remarks

Use the Condition method of the TableStyle object to return a ConditionalStyle object. The Shading property can be used to apply shading to specified areas of a table. This example selects the first table in the active document and applies shading to alternate rows and columns. This example assumes that there is a table in the active document and that it is formatted using the Table Grid style.

VBA Copy code Copy code
Sub ApplyConditionalStyle()
 With ActiveDocument
 .Tables(1).Select
 With .Styles("Table Grid").Table
 .Condition(wdOddColumnBanding).Shading _
 .BackgroundPatternColor = wdColorGray10
 .Condition(wdOddRowBanding).Shading _
 .BackgroundPatternColor = wdColorGray10
 End With
 End With
End Sub

Use the Borders property to apply borders to specified areas of a table. This example selects the first table in the active document and applies borders to the first and last row and first column. This example assumes that there is a table in the active document and that it is formatted using the Table Grid style.

VBA Copy code Copy code
Sub ApplyTableBorders()
 With ActiveDocument
 .Tables(1).Select
 With .Styles("Table Grid").Table
 .Condition(wdFirstRow).Borders(wdBorderBottom) _
 .LineStyle = wdLineStyleDouble
 .Condition(wdFirstColumn).Borders(wdBorderRight) _
 .LineStyle = wdLineStyleDouble
 .Condition(wdLastRow).Borders(wdBorderTop) _
 .LineStyle = wdLineStyleDouble
 End With
 End With
End Sub

See also

Concepts

Word Object Model Reference

Other resources

ConditionalStyle Object Members


ConditionalStyle Members (Word)

 Copy code hover
[image]

ConditionalStyle Members (Word)
Send feedback

Published: July 16, 2012

Represents special formatting applied to specified areas of a table when the selected table is formatted with a specified table style.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Borders | Returns a Borders collection that represents all the borders for the specified ConditionalStyle object.
BottomPadding | Returns or sets a Single that represents the amount of space (in points) to add below the contents of a single cell or all the cells in a table. Read/write.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Font | Returns or sets a Font object that represents the character formatting of the specified object. Read/write.
LeftPadding | Returns or sets the amount of space (in points) to add to the left of the contents of a single cell or all the cells in a table. Read/write Single.
ParagraphFormat | Returns or sets a ParagraphFormat object that represents the paragraph settings for the specified conditional style. Read/write.
Parent | Returns an Object that represents the parent object of the specified ConditionalStyle object.
RightPadding | Returns or sets the amount of space (in points) to add to the right of the contents of a single cell or all the cells in a table. Read/write Single.
Shading | Returns a Shading object that represents the shading formatting for the style formatting of a table.
TopPadding | Returns or sets the amount of space (in points) to add above the contents of a single cell or all the cells in a table. Read/write Single.


ConditionalStyle Properties (Word)

 Copy code hover
[image]

ConditionalStyle Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Borders | Returns a Borders collection that represents all the borders for the specified ConditionalStyle object.
BottomPadding | Returns or sets a Single that represents the amount of space (in points) to add below the contents of a single cell or all the cells in a table. Read/write.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Font | Returns or sets a Font object that represents the character formatting of the specified object. Read/write.
LeftPadding | Returns or sets the amount of space (in points) to add to the left of the contents of a single cell or all the cells in a table. Read/write Single.
ParagraphFormat | Returns or sets a ParagraphFormat object that represents the paragraph settings for the specified conditional style. Read/write.
Parent | Returns an Object that represents the parent object of the specified ConditionalStyle object.
RightPadding | Returns or sets the amount of space (in points) to add to the right of the contents of a single cell or all the cells in a table. Read/write Single.
Shading | Returns a Shading object that represents the shading formatting for the style formatting of a table.
TopPadding | Returns or sets the amount of space (in points) to add above the contents of a single cell or all the cells in a table. Read/write Single.


ConditionalStyle.Application Property (Word)

 Copy code hover
[image]

ConditionalStyle.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a ConditionalStyle object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

ConditionalStyle Object

Other resources

ConditionalStyle Object Members


ConditionalStyle.Borders Property (Word)

 Copy code hover
[image]

ConditionalStyle.Borders Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Borders collection that represents all the borders for the specified ConditionalStyle object.

Syntax

expression .Borders

expression Required. A variable that represents a ConditionalStyle object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

See also

Concepts

ConditionalStyle Object

Other resources

ConditionalStyle Object Members


ConditionalStyle.BottomPadding Property (Word)

 Copy code hover
[image]

ConditionalStyle.BottomPadding Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Single that represents the amount of space (in points) to add below the contents of a single cell or all the cells in a table. Read/write.

Syntax

expression .BottomPadding

expression Required. A variable that represents a ConditionalStyle object.

Remarks

The setting of the BottomPadding property for a single cell overrides the setting of the BottomPadding property for the entire table.

See also

Concepts

ConditionalStyle Object

Other resources

ConditionalStyle Object Members


ConditionalStyle.Creator Property (Word)

 Copy code hover
[image]

ConditionalStyle.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a ConditionalStyle object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

ConditionalStyle Object

Other resources

ConditionalStyle Object Members


ConditionalStyle.Font Property (Word)

 Copy code hover
[image]

ConditionalStyle.Font Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Font object that represents the character formatting of the specified object. Read/write.

Syntax

expression .Font

expression A variable that represents a ConditionalStyle object.

Remarks

To set the Font property, specify an expression that returns a Font object.

See also

Concepts

ConditionalStyle Object

Other resources

ConditionalStyle Object Members


ConditionalStyle.LeftPadding Property (Word)

 Copy code hover
[image]

ConditionalStyle.LeftPadding Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the amount of space (in points) to add to the left of the contents of a single cell or all the cells in a table. Read/write Single.

Syntax

expression .LeftPadding

expression Required. A variable that represents a ConditionalStyle object.

Remarks

The setting of the LeftPadding property for a single cell overrides the setting of the LeftPadding property for the entire table.

Example

This example sets the left padding for the first table in the active document to 40 pixels.

VBA Copy code Copy code
ActiveDocument.Tables(1).LeftPadding = _
 PixelsToPoints(40, False)

See also

Concepts

ConditionalStyle Object

Other resources

ConditionalStyle Object Members


ConditionalStyle.ParagraphFormat Property (Word)

 Copy code hover
[image]

ConditionalStyle.ParagraphFormat Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a ParagraphFormat object that represents the paragraph settings for the specified conditional style. Read/write.

Syntax

expression .ParagraphFormat

expression A variable that represents a ConditionalStyle object.

Example

This example modifies the Heading 2 style for the active document. Paragraphs formatted with this style are indented to the first tab stop and double-spaced.

VBA Copy code Copy code
With ActiveDocument.Styles(wdStyleHeading2).ParagraphFormat
 .TabIndent(1)
 .Space2
End With

See also

Concepts

ConditionalStyle Object

Other resources

ConditionalStyle Object Members


ConditionalStyle.Parent Property (Word)

 Copy code hover
[image]

ConditionalStyle.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified ConditionalStyle object.

Syntax

expression .Parent

expression Required. A variable that represents a ConditionalStyle object.

See also

Concepts

ConditionalStyle Object

Other resources

ConditionalStyle Object Members


ConditionalStyle.RightPadding Property (Word)

 Copy code hover
[image]

ConditionalStyle.RightPadding Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the amount of space (in points) to add to the right of the contents of a single cell or all the cells in a table. Read/write Single.

Syntax

expression .RightPadding

expression Required. A variable that represents a ConditionalStyle object.

Remarks

The setting of the RightPadding property for a single cell overrides the setting of the RightPadding property for the entire table.

Example

This example sets the right padding for the first table in the active document to 40 pixels.

VBA Copy code Copy code
ActiveDocument.Tables(1).RightPadding = _
 PixelsToPoints(40, False)

See also

Concepts

ConditionalStyle Object

Other resources

ConditionalStyle Object Members


ConditionalStyle.Shading Property (Word)

 Copy code hover
[image]

ConditionalStyle.Shading Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Shading object that represents the shading formatting for the style formatting of a table.

Syntax

expression .Shading

expression Required. A variable that represents a ConditionalStyle object.

See also

Concepts

ConditionalStyle Object

Other resources

ConditionalStyle Object Members


ConditionalStyle.TopPadding Property (Word)

 Copy code hover
[image]

ConditionalStyle.TopPadding Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the amount of space (in points) to add above the contents of a single cell or all the cells in a table. Read/write Single.

Syntax

expression .TopPadding

expression Required. A variable that represents a ConditionalStyle object.

Remarks

The setting of the TopPadding property for a single cell overrides the setting of the TopPadding property for the entire table.

See also

Concepts

ConditionalStyle Object

Other resources

ConditionalStyle Object Members


Conflict Object (Word)

 Copy code hover
[image]

Conflict Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a conflicting edit in a co-authored document. The type of a Conflict object is specified by the WdRevisionType enumeration.

Version Information

Version Added: Word 2010

Remarks

Although co-authoring in Word 2010 is designed to minimize conflicts, conflicts can sometimes occur when editing a document that has co-authoring enabled. A conflict occurs when Word requires user input to resolve a merge.

Note Note

Documents can only be co-authored on a server that supports the File Synchronization via SOAP over HTTP protocol, such as Microsoft SharePoint Server 2010.

For example, conflicts could potentially occur when a user opens a co-authored document from the server, works offline, and once online again, saves the document back to the server. As another example, conflicts can sometimes occur when more than one person works on the same document range at exactly the same time.

Note Note

A user is only made aware of conflicts in the document when they perform an explicit document save. When the user performs an explicit document save, Word will enter Conflict Resolution mode if there are conflicts in the document. Conflict Resolution mode enables the user to resolve document conflicts.

Example

The following code example gets the type of each conflict in the active document.

VBA Copy code Copy code
Dim con as Conflict

For Each con in ActiveDocument.CoAuthoring.Conflicts
MsgBox con.Type
Next con

See also

Concepts

Word Object Model Reference

Other resources

Conflict Object Members


Conflict Members (Word)

 Copy code hover
[image]

Conflict Members (Word)
Send feedback

Published: July 16, 2012

Represents a conflicting edit in a co-authored document. The type of a Conflict object is specified by the WdRevisionType enumeration.

Methods

Name | Description
Accept | Accepts the user specified conflict change, and removes the conflict.
Reject | Rejects the user change, removes the conflict, and accepts the server copy of the change for the conflict.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Index | Returns a Long that represents the position of an item in a collection. Read-only.
Parent | Returns an Object that represents the parent object of the specified Conflict object.
Range | Returns a Range object that represents the portion of a document that is contained in the specified object. Read-only.
Type | Returns the WdRevisionType for the Conflict object. Read-only.


Conflict Properties (Word)

 Copy code hover
[image]

Conflict Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Index | Returns a Long that represents the position of an item in a collection. Read-only.
Parent | Returns an Object that represents the parent object of the specified Conflict object.
Range | Returns a Range object that represents the portion of a document that is contained in the specified object. Read-only.
Type | Returns the WdRevisionType for the Conflict object. Read-only.


Conflict.Application Property (Word)

 Copy code hover
[image]

Conflict.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .Application

expression An expression that returns a Conflict object.

See also

Concepts

Conflict Object

Other resources

Conflict Object Members


Conflict.Creator Property (Word)

 Copy code hover
[image]

Conflict.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version Information

Version Added: Word 2010

Syntax

expression .Creator

expression An expression that returns a Conflict object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD". This property was primarily designed to be used on the Apple Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For more information about this property, see the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

Conflict Object

Other resources

Conflict Object Members


Conflict.Index Property (Word)

 Copy code hover
[image]

Conflict.Index Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the position of an item in a collection. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .Index

expression An expression that returns a Conflict object.

See also

Concepts

Conflict Object

Other resources

Conflict Object Members


Conflict.Parent Property (Word)

 Copy code hover
[image]

Conflict.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Conflict object.

Version Information

Version Added: Word 2010

Syntax

expression .Parent

expression An expression that returns a Conflict object.

See also

Concepts

Conflict Object

Other resources

Conflict Object Members


Conflict.Range Property (Word)

 Copy code hover
[image]

Conflict.Range Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the portion of a document that is contained in the specified object. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .Range

expression An expression that returns a Conflict object.

Example

The following code example returns the range associated with the second conflict in the active document.

VBA Copy code Copy code
Dim rng As Range

Set rng = ActiveDocument.CoAuthoring.Conflicts(2).Range

See also

Concepts

Conflict Object

Other resources

Conflict Object Members


Conflict.Type Property (Word)

 Copy code hover
[image]

Conflict.Type Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the WdRevisionType for the Conflict object. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .Type

expression An expression that returns a Conflict object.

Example

The following code example gets the type of each conflict in the active document.

VBA Copy code Copy code
Dim con as Conflict

For Each con in ActiveDocument.CoAuthoring.Conflicts
 MsgBox con.Type
Next con

See also

Concepts

Conflict Object

Other resources

Conflict Object Members


Conflict Methods (Word)

 Copy code hover
[image]

Conflict Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Accept | Accepts the user specified conflict change, and removes the conflict.
Reject | Rejects the user change, removes the conflict, and accepts the server copy of the change for the conflict.


Conflict.Accept Method (Word)

 Copy code hover
[image]

Conflict.Accept Method (Word)
See also Send feedback

Published: July 16, 2012

Accepts the user specified conflict change, and removes the conflict.

Version Information

Version Added: Word 2010

Syntax

expression .Accept

expression An expression that returns a Conflict object.

Return Value

Nothing

Remarks

In a conflict, a user can choose either to keep or to reject the changes they have made to the content where the conflict exists. The Accept method keeps the changes that the user has made.

Example

The following example accepts all of the conflicts in the active document.

VBA Copy code Copy code
Dim conf As Conflict

For Each conf In ActiveDocument.CoAuthoring.Conflicts
    conf.Accept
Next conf

Alternatively, you can use the AcceptAll method of the Conflicts collection object to accept all the conflicts in a document, as shown in the following code example.

VBA Copy code Copy code
ActiveDocument.CoAuthoring.Conflicts.AcceptAll

See also

Concepts

Conflict Object

Other resources

Conflict Object Members


Conflict.Reject Method (Word)

 Copy code hover
[image]

Conflict.Reject Method (Word)
See also Send feedback

Published: July 16, 2012

Rejects the user change, removes the conflict, and accepts the server copy of the change for the conflict.

Version Information

Version Added: Word 2010

Syntax

expression .Reject

expression An expression that returns a Conflict object.

Return Value

Nothing

Remarks

The Reject method rejects the user version of a conflict and accepts the version that is currently on the server.

Example

The following code example rejects all the conflicts in the active document.

VBA Copy code Copy code
Dim conf As Conflict

For Each conf In ActiveDocument.CoAuthoring.Conflicts
 conf.Reject
Next conf

Alternatively, you can use the RejectAll method of the Conflicts collection object to reject all the conflicts in a document, as shown in the following code example.

VBA Copy code Copy code
ActiveDocument.CoAuthoring.Conflicts.RejectAll

See also

Concepts

Conflict Object

Other resources

Conflict Object Members


Conflicts Object (Word)

 Copy code hover
[image]

Conflicts Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of Conflict objects that represents the conflicts in a document. The type of a Conflict object is specified by the WdRevisionType enumeration.

Version Information

Version Added: Word 2010

Remarks

Use the Conflicts property to return the Conflicts collection for a document. Use Conflicts(Index), where Index is the conflict index number, to return a single Conflict object.

Example

The following code example accepts the first conflict in the active document.

VBA Copy code Copy code
ActiveDocument.CoAuthoring.Conflicts(1).Accept

See also

Concepts

Word Object Model Reference

Other resources

Conflicts Object Members


Conflicts Members (Word)

 Copy code hover
[image]

Conflicts Members (Word)
Send feedback

Published: July 16, 2012

A collection of Conflict objects that represents the conflicts in a document. The type of a Conflict object is specified by the WdRevisionType enumeration.

Methods

Name | Description
AcceptAll | Accepts all of the user's changes, removes the conflicts, and merges the changes into the server copy of the document.
Item | Returns an individual Conflicts object in a collection.
RejectAll | Rejects all of the user's changes and retains the server copy of the document.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application. Read-only.
Count | Returns the number of items in the Conflicts collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified Conflicts object.


Conflicts Properties (Word)

 Copy code hover
[image]

Conflicts Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application. Read-only.
Count | Returns the number of items in the Conflicts collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified Conflicts object.


Conflicts.Application Property (Word)

 Copy code hover
[image]

Conflicts.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .Application

expression An expression that returns a Conflicts object.

See also

Concepts

Conflicts Object

Other resources

Conflicts Object Members


Conflicts.Count Property (Word)

 Copy code hover
[image]

Conflicts.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the number of items in the Conflicts collection. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .Count

expression An expression that returns a Conflicts object.

Example

The following code example gets the number of Conflict objects in the active document.

VBA Copy code Copy code
Dim confCount as Long

confCount = ActiveDocument.CoAuthoring.Conflicts.Count

See also

Concepts

Conflicts Object

Other resources

Conflicts Object Members


Conflicts.Creator Property (Word)

 Copy code hover
[image]

Conflicts.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version Information

Version Added: Word 2010

Syntax

expression .Creator

expression An expression that returns a Conflicts object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD". This property was primarily designed to be used on the Apple Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For more information about this property, see the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

Conflicts Object

Other resources

Conflicts Object Members


Conflicts.Parent Property (Word)

 Copy code hover
[image]

Conflicts.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Conflicts object.

Version Information

Version Added: Word 2010

Syntax

expression .Parent

expression An expression that returns a Conflicts object.

See also

Concepts

Conflicts Object

Other resources

Conflicts Object Members


Conflicts Methods (Word)

 Copy code hover
[image]

Conflicts Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
AcceptAll | Accepts all of the user's changes, removes the conflicts, and merges the changes into the server copy of the document.
Item | Returns an individual Conflicts object in a collection.
RejectAll | Rejects all of the user's changes and retains the server copy of the document.


Conflicts.AcceptAll Method (Word)

 Copy code hover
[image]

Conflicts.AcceptAll Method (Word)
See also Send feedback

Published: July 16, 2012

Accepts all of the user's changes, removes the conflicts, and merges the changes into the server copy of the document.

Version Information

Version Added: Word 2010

Syntax

expression .AcceptAll

expression An expression that returns a Conflicts object.

Return Value

Nothing

Example

The following code example accepts all the user changes for the conflicts in the active document.

VBA Copy code Copy code
ActiveDocument.CoAuthoring.Conflicts.AcceptAll

See also

Concepts

Conflicts Object

Other resources

Conflicts Object Members


Conflicts.Item Method (Word)

 Copy code hover
[image]

Conflicts.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual Conflicts object in a collection.

Version Information

Version Added: Word 2010

Syntax

expression .Item(Index)

expression An expression that returns a Conflicts object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The individual object to be returned.

Return Value

Conflict

See also

Concepts

Conflicts Object

Other resources

Conflicts Object Members


Conflicts.RejectAll Method (Word)

 Copy code hover
[image]

Conflicts.RejectAll Method (Word)
See also Send feedback

Published: July 16, 2012

Rejects all of the user's changes and retains the server copy of the document.

Version Information

Version Added: Word 2010

Syntax

expression .RejectAll

expression An expression that returns a Conflicts object.

Return Value

Nothing

Example

The following code example rejects all the user's changes and retains the server copy of the active document.

VBA Copy code Copy code
ActiveDocument.CoAuthoring.Conflicts.RejectAll

See also

Concepts

Conflicts Object

Other resources

Conflicts Object Members


ContentControl Object (Word)

 Copy code hover
[image]

ContentControl Object (Word)
See also Send feedback

Published: July 16, 2012

An individual content control. Content controls are bounded and potentially labeled regions in a document that serve as containers for specific types of content. Individual content controls may contain contents such as dates, lists, or paragraphs of formatted text. The ContentControl object is a member of the ContentControls collection.

Version Information

Version Added: Word 2007

Remarks

Use the Add method of the ContentControls collection to create a content control. Use the Type parameter of the Add method to specify the type of content control to create. The following example create a new drop-down list content control and adds several items to the list.

VBA Copy code Copy code
Dim objCC As ContentControl

Set objCC = ActiveDocument.ContentControls.Add(Type:=wdContentControlDropdownList)

'List entries
objCC.DropdownListEntries.Add "Cat"
objCC.DropdownListEntries.Add "Dog"
objCC.DropdownListEntries.Add "Horse"
objCC.DropdownListEntries.Add "Monkey"
objCC.DropdownListEntries.Add "Snake"
objCC.DropdownListEntries.Add "Other"

Use the Type property to change the content control to a different type of content control. For example, perhaps you want to change from a date control to a text control. However, you may not be able to change all content controls to another type; some may not allow changing their type. In addition, depending on the contents of a content control, you may not be able to change the type. For example, if the content control that you want to change to does not allow the type of content that is in the existing content control, attempting to change the type is not allowed and generates a run-time error.

The following example inserts a date content control and sets the value of the control, and then changes the control to a text content control.

VBA Copy code Copy code
Dim objCC As ContentControl

Set objCC = ActiveDocument.ContentControls.Add(wdContentControlDate)

objCC.Range.Text = "January 1, 2007"
objCC.Type = wdContentControlText

Use the SetPlaceholderText method to change the placeholder text from the default string to something more appropriate for the control. Use the Title property to specify the title text for the control. This displays above the control when the cursor is positioned inside the control or the mouse pointer is positioned over the control.

Depending on the type of content control that you have, you may not be able to use all the properties and methods of the ContentControl object.

Not all content control properties apply to all the different types of content controls. The following table lists which properties apply to which types of content controls.

Property/Method | Applies To
BuildingBlockCategory property | BuildingBlock Gallery content controls (wdContentControlBuildingBlockGallery)
BuildingBlockType property | BuildingBlock Gallery content controls (wdContentControlBuildingBlockGallery)
DateDisplayFormat property | Date content controls (wdContentControlDate)
DateDisplayLocale property | Date content controls (wdContentControlDate)
DateStorageFormat property | Date content controls (wdContentControlDate)
DropdownListEntries property | Combo box and drop-down list content controls (wdContentControlComboBox and wdContentControlDropdownList)
MultiLine property | Plain text content controls (wdContentControlText)
Ungroup method | Group content controls (wdContentControlGroup)

See also

Concepts

Word Object Model Reference

Other resources

ContentControl Object Members


ContentControl Members (Word)

 Copy code hover
[image]

ContentControl Members (Word)
Send feedback

Published: July 16, 2012

An individual content control. Content controls are bounded and potentially labeled regions in a document that serve as containers for specific types of content. Individual content controls may contain contents such as dates, lists, or paragraphs of formatted text. The ContentControl object is a member of the ContentControls collection.

Methods

Name | Description
Copy | Copies the content control from the active document to the Clipboard.
Cut | Removes the content control from the active document and moves the content control to the Clipboard.
Delete | Deletes the specified content control and the contents of the content control.
SetCheckedSymbol | Sets the symbol used to represent the checked state of a check box content control.
SetPlaceholderText | Sets the placeholder text that displays in the content control until a user enters their own text.
SetUncheckedSymbol | Sets the symbol used to represent the unchecked state of a check box content control.
Ungroup | Removes a group content control from a document so that its child content controls are no longer nested and can be freely edited.

Properties

Name | Description
AllowInsertDeleteSection | Gets or sets whether users can add or remove sections from the specified repeating section content control by using the user interface.
Appearance | Returns or sets the appearance of the content control. Read/write WdContentControlAppearance.
Application | Returns an Application object that represents the Microsoft Word application.
BuildingBlockCategory | Returns or sets a String that represents the category for a building block content control. Read/write.
BuildingBlockType | Returns or sets a WdBuildingBlockTypes constant that represents they type of building block for a building block content control. Read/write.
Checked | Returns or sets a Boolean that represents the current state (checked/unchecked) for a check box. Read/Write.
Color | Returns or sets the color of the content control. Read/write WdColor.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
DateCalendarType | Returns or sets a WdCalendarType constant that represents the calendar type for a calendar content control. Read/write.
DateDisplayFormat | Returns or sets a String that represents the format in which dates are displayed. Read/write.
DateDisplayLocale | Returns a WdLanguageID that represents the language format for the date displayed in a date content control. Read/write.
DateStorageFormat | Returns or sets a WdContentControlDateStorageFormat that represents the format for storage and retrieval of dates when a date content control is bound to the XML data store of the active document. Read/write.
DefaultTextStyle | Returns or sets a Variant that represents the name of the character style to use to format text in a text content control. Read/write.
DropdownListEntries | Returns a ContentControlListEntries collection that represents the items in a drop-down list content control or in a combo box content control. Read-only.
ID | Returns a String that represents the identification for a content control. Read-only.
Level | Returns the level of the content control—whether the content control surrounds text, paragraphs, table cells, or table rows; or if it is inline. Read-only WdContentControlLevel.
LockContentControl | Returns or sets a Boolean that represents whether the user can delete a content control from the active document. Read/write.
LockContents | Returns or sets a Boolean that represents whether the user can edit the contents of a content control. Read/write.
MultiLine | Returns a Boolean that represents whether a text content control allows multiple lines of text. Read/write.
Parent | Returns an Object that represents the parent object of the specified ContentControl object.
ParentContentControl | Returns a ContentControl that represents the parent content control for a content control that is nested inside a rich-text control or group control. Read-only.
PlaceholderText | Returns a BuildingBlock object that represents the placeholder text for a content control. Read-only.
Range | Returns a Range that represents the contents of the content control in the active document. Read-only.
RepeatingSectionItems | Returns the collection of repeating section items in the specified repeating section content control. Read-only.
RepeatingSectionItemTitle | Returns or sets the name of the repeating section items used in the context menu associated with the specified repeating section content control. Read/write.
ShowingPlaceholderText | Returns a Boolean that indicates whether the placeholder text for the content control is displayed. Read-only.
Tag | Returns or sets a String that represents a value to identify a content control. Read/write.
Temporary | Returns or sets a Boolean that represents whether to remove a content control from the active document when the user edits the contents of the control. Read/write.
Title | Returns or sets a String that represents the title for a content control. Read/write.
Type | Returns or sets a WdContentControlType that represents the type for a content control. Read/write.
XMLMapping | Returns an XMLMapping object that represents the mapping of a content control to XML data in the data store of a document. Read-only.


ContentControl Properties (Word)

 Copy code hover
[image]

ContentControl Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
AllowInsertDeleteSection | Gets or sets whether users can add or remove sections from the specified repeating section content control by using the user interface.
Appearance | Returns or sets the appearance of the content control. Read/write WdContentControlAppearance.
Application | Returns an Application object that represents the Microsoft Word application.
BuildingBlockCategory | Returns or sets a String that represents the category for a building block content control. Read/write.
BuildingBlockType | Returns or sets a WdBuildingBlockTypes constant that represents they type of building block for a building block content control. Read/write.
Checked | Returns or sets a Boolean that represents the current state (checked/unchecked) for a check box. Read/Write.
Color | Returns or sets the color of the content control. Read/write WdColor.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
DateCalendarType | Returns or sets a WdCalendarType constant that represents the calendar type for a calendar content control. Read/write.
DateDisplayFormat | Returns or sets a String that represents the format in which dates are displayed. Read/write.
DateDisplayLocale | Returns a WdLanguageID that represents the language format for the date displayed in a date content control. Read/write.
DateStorageFormat | Returns or sets a WdContentControlDateStorageFormat that represents the format for storage and retrieval of dates when a date content control is bound to the XML data store of the active document. Read/write.
DefaultTextStyle | Returns or sets a Variant that represents the name of the character style to use to format text in a text content control. Read/write.
DropdownListEntries | Returns a ContentControlListEntries collection that represents the items in a drop-down list content control or in a combo box content control. Read-only.
ID | Returns a String that represents the identification for a content control. Read-only.
Level | Returns the level of the content control—whether the content control surrounds text, paragraphs, table cells, or table rows; or if it is inline. Read-only WdContentControlLevel.
LockContentControl | Returns or sets a Boolean that represents whether the user can delete a content control from the active document. Read/write.
LockContents | Returns or sets a Boolean that represents whether the user can edit the contents of a content control. Read/write.
MultiLine | Returns a Boolean that represents whether a text content control allows multiple lines of text. Read/write.
Parent | Returns an Object that represents the parent object of the specified ContentControl object.
ParentContentControl | Returns a ContentControl that represents the parent content control for a content control that is nested inside a rich-text control or group control. Read-only.
PlaceholderText | Returns a BuildingBlock object that represents the placeholder text for a content control. Read-only.
Range | Returns a Range that represents the contents of the content control in the active document. Read-only.
RepeatingSectionItems | Returns the collection of repeating section items in the specified repeating section content control. Read-only.
RepeatingSectionItemTitle | Returns or sets the name of the repeating section items used in the context menu associated with the specified repeating section content control. Read/write.
ShowingPlaceholderText | Returns a Boolean that indicates whether the placeholder text for the content control is displayed. Read-only.
Tag | Returns or sets a String that represents a value to identify a content control. Read/write.
Temporary | Returns or sets a Boolean that represents whether to remove a content control from the active document when the user edits the contents of the control. Read/write.
Title | Returns or sets a String that represents the title for a content control. Read/write.
Type | Returns or sets a WdContentControlType that represents the type for a content control. Read/write.
XMLMapping | Returns an XMLMapping object that represents the mapping of a content control to XML data in the data store of a document. Read-only.


ContentControl.AllowInsertDeleteSection Property (Word)

 Copy code hover
[image]

ContentControl.AllowInsertDeleteSection Property (Word)
See also Send feedback

Published: July 16, 2012

Gets or sets whether users can add or remove sections from the specified repeating section content control by using the user interface.

Version information

Version Added: Word 2013

Syntax

expression .AllowInsertDeleteSection

expression A variable that represents a ContentControl object.

Remarks

You can use this property only with repeating section content controls. Using it with other content controls will result in an error message effect.

Property value

BOOL

See also

Concepts

ContentControl Object

Other resources

ContentControl Object Members


ContentControl.Appearance Property (Word)

 Copy code hover
[image]

ContentControl.Appearance Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the appearance of the content control. Read/write WdContentControlAppearance.

Version information

Version Added: Word 2013

Syntax

expression .Appearance

expression A variable that represents a ContentControl object.

Property value

WDCONTENTCONTROLAPPEARANCE

See also

Concepts

ContentControl Object

Other resources

ContentControl Object Members


ContentControl.Application Property (Word)

 Copy code hover
[image]

ContentControl.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a ContentControl object.

See also

Concepts

ContentControl Object

Other resources

ContentControl Object Members


ContentControl.BuildingBlockCategory Property (Word)

 Copy code hover
[image]

ContentControl.BuildingBlockCategory Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a String that represents the category for a building block content control. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .BuildingBlockCategory

expression An expression that returns a ContentControl object.

Remarks

This property applies only to building block content controls and corresponds with the Category option in the Content Control Properties dialog box. You can set this property to any string; however, if you set it to a string for which there is no corresponding category, the value of the Category option is set to "(All Categories)".

Example

The following example creates a new building block content control and specifies the type of building block and the gallery.

VBA Copy code Copy code
Dim objBB As ContentControl

Set objBB = Selection.ContentControls.Add(wdContentControlBuildingBlockGallery)

objBB.BuildingBlockType = wdTypeEquations
objBB.BuildingBlockCategory = "General"

See also

Concepts

ContentControl Object

Other resources

ContentControl Object Members


ContentControl.BuildingBlockType Property (Word)

 Copy code hover
[image]

ContentControl.BuildingBlockType Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a WdBuildingBlockTypes constant that represents they type of building block for a building block content control. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .BuildingBlockType

expression An expression that returns a ContentControl object.

Remarks

This property applies only to building block content controls and corresponds with the Gallery option in the Content Control Properties dialog box. You can set this property only for the following building block types:

  • Custom 1 through Custom 5

  • Autotext

  • Quick Parts

  • Custom Autotext

  • Custom Quick Parts

  • Equations

Example

The following example creates a new building block content control and specifies the type of building block and the gallery.

VBA Copy code Copy code
Dim objBB As ContentControl

Set objBB = Selection.ContentControls.Add(wdContentControlBuildingBlockGallery)

objBB.BuildingBlockType = wdTypeEquations
objBB.BuildingBlockCategory = "General"

See also

Concepts

ContentControl Object

Other resources

ContentControl Object Members


ContentControl.Checked Property (Word)

 Copy code hover
[image]

ContentControl.Checked Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents the current state (checked/unchecked) for a check box. Read/Write.

Version Information

Version Added: Word 2010

Syntax

expression .Checked

expression An expression that returns a ContentControl object.

Remarks

Use the Checked property to get/set the current state for a check box content control. If the control is not a check box, attempts to access the property will fail with the run-time error "This property is only available for check box content controls."

Example

The following code example sets the specified check box content control Checked property.

VBA Copy code Copy code
Dim objCC As ContentControl

Set objCC = ActiveDocument.ContentControls.Add (wdContentControlCheckbox)
objCC.Title = "Send Reminder"
objCC.Checked = true

See also

Concepts

ContentControl Object

Other resources

ContentControl Object Members


ContentControl.Color Property (Word)

 Copy code hover
[image]

ContentControl.Color Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the color of the content control. Read/write WdColor.

Version information

Version Added: Word 2013

Syntax

expression .Color

expression A variable that represents a ContentControl object.

Property value

WDCOLOR

See also

Concepts

ContentControl Object

Other resources

ContentControl Object Members


ContentControl.Creator Property (Word)

 Copy code hover
[image]

ContentControl.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.

Syntax

expression .Creator

expression An expression that returns an ContentControl object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

ContentControl Object

Other resources

ContentControl Object Members


ContentControl.DateCalendarType Property (Word)

 Copy code hover
[image]

ContentControl.DateCalendarType Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a WdCalendarType constant that represents the calendar type for a calendar content control. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .DateCalendarType

expression An expression that returns a ContentControl object.

See also

Concepts

ContentControl Object

Other resources

ContentControl Object Members


ContentControl.DateDisplayFormat Property (Word)

 Copy code hover
[image]

ContentControl.DateDisplayFormat Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a String that represents the format in which dates are displayed. Read/write.

Syntax

expression .DateDisplayFormat

expression An expression that returns a ContentControl object.

Remarks

The default format is the format setting specified in Microsoft Word on the users' system, which usually depends on the location setting in Microsoft Windows. For example, the default format of dates for English (U.S.) is "mm/dd/yyyy". Use the DateDisplayFormat property to specify a different date format.

Example

VBA Copy code Copy code
Dim objCC As ContentControl

Set objCC = ActiveDocument.ContentControls.Add(wdContentControlDate)

objCC.Title = "Review Period End Date"
objCC.DateDisplayFormat = "MMMM d, yyyy"
objCC.DateStorageFormat = wdContentControlDateStorageDate
objCC.Range.Text = "January 1, 2007"

See also

Concepts

ContentControl Object

Other resources

ContentControl Object Members


ContentControl.DateDisplayLocale Property (Word)

 Copy code hover
[image]

ContentControl.DateDisplayLocale Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a WdLanguageID that represents the language format for the date displayed in a date content control. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .DateDisplayLocale

expression An expression that returns a ContentControl object.

Remarks

By default, the DateDisplayLocale property is initially set to the editing language specified in Microsoft Word, if this is different from the location specified in Microsoft Windows.

See also

Concepts

ContentControl Object

Other resources

ContentControl Object Members


ContentControl.DateStorageFormat Property (Word)

 Copy code hover
[image]

ContentControl.DateStorageFormat Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a WdContentControlDateStorageFormat that represents the format for storage and retrieval of dates when a date content control is bound to the XML data store of the active document. Read/write.

Syntax

expression .DateStorageFormat

expression An expression that returns a ContentControl object.

Remarks

The DateStorageFormat property allows you to store dates in date format, date/time format, or text format.

Example

The following example adds a date content control to the active document and specifies the date, the date display format, and the date storage format.

VBA Copy code Copy code
Dim objCC As ContentControl

Set objCC = ActiveDocument.ContentControls.Add(wdContentControlDate)

objCC.Title = "Review Period End Date"
objCC.DateDisplayFormat = "MMMM d, yyyy"
objCC.DateStorageFormat = wdContentControlDateStorageDate
objCC.Range.Text = "January 1, 2007"

See also

Concepts

ContentControl Object

Other resources

ContentControl Object Members


ContentControl.DefaultTextStyle Property (Word)

 Copy code hover
[image]

ContentControl.DefaultTextStyle Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Variant that represents the name of the character style to use to format text in a text content control. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .DefaultTextStyle

expression An expression that returns a ContentControl object.

See also

Concepts

ContentControl Object

Other resources

ContentControl Object Members


ContentControl.DropdownListEntries Property (Word)

 Copy code hover
[image]

ContentControl.DropdownListEntries Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a ContentControlListEntries collection that represents the items in a drop-down list content control or in a combo box content control. Read-only.

Syntax

expression .DropdownListEntries

expression An expression that returns a ContentControl object.

Example

The following example inserts a new drop-down list content control into the active document, sets the title and placeholder text, and then adds several new items to the list.

VBA Copy code Copy code
Dim objCC As ContentControl
Dim objMap As XMLMapping

Set objCC = ActiveDocument.ContentControls.Add(wdContentControlDropdownList)
objCC.Title = "My Favorite Animal"
objCC.SetPlaceholderText , , "Select your favorite animal "

'List entries
objCC.DropdownListEntries.Add "Cat"
objCC.DropdownListEntries.Add "Dog"
objCC.DropdownListEntries.Add "Horse"
objCC.DropdownListEntries.Add "Monkey"
objCC.DropdownListEntries.Add "Snake"
objCC.DropdownListEntries.Add("Other")

See also

Concepts

ContentControl Object

Other resources

ContentControl Object Members


ContentControl.ID Property (Word)

 Copy code hover
[image]

ContentControl.ID Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a String that represents the identification for a content control. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .ID

expression An expression that returns a ContentControl object.

Remarks

The ID property is an internal number that you cannot change but that you can use to identify a content control in code. This number is unique for each content control and does not change.

When you get the ID property value at runtime, it is returned as an unsigned value. However, when saved into the Office Open XML file format, it is saved as a signed value. If your solution attempts to map programmatically returned values to values saved in the file format, you must check for both the unsigned and signed version of the value obtained from this property.

See also

Concepts

ContentControl Object

Other resources

ContentControl Object Members


ContentControl.Level Property (Word)

 Copy code hover
[image]

ContentControl.Level Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the level of the content control—whether the content control surrounds text, paragraphs, table cells, or table rows; or if it is inline. Read-only WdContentControlLevel.

Version information

Version Added: Word 2013

Syntax

expression .Level

expression A variable that represents a ContentControl object.

Property value

WDCONTENTCONTROLLEVEL

See also

Concepts

ContentControl Object

Other resources

ContentControl Object Members


ContentControl.LockContentControl Property (Word)

 Copy code hover
[image]

ContentControl.LockContentControl Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents whether the user can delete a content control from the active document. Read/write.

Syntax

expression .LockContentControl

expression An expression that returns a ContentControl object.

Remarks

The default value of this property is False. This property corresponds to the Content control cannot be deleted check box in the Content Control Properties dialog box.

Note Note

You cannot set this property if the Temporary property is set to True.

Example

The following example inserts a date content control into the active document, and then sets the contents of the content control and specifies that the user cannot edit the contents or delete the control from the document.

VBA Copy code Copy code
Dim objCC As ContentControl

Set objCC = ActiveDocument.ContentControls _
 .Add(wdContentControlDate)

objCC.Range.Text = "January 1, 2007"
objCC.LockContents = True
objCC.LockContentControl = True

See also

Concepts

ContentControl Object

Other resources

ContentControl Object Members


ContentControl.LockContents Property (Word)

 Copy code hover
[image]

ContentControl.LockContents Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents whether the user can edit the contents of a content control. Read/write.

Syntax

expression .LockContents

expression An expression that returns a ContentControl object.

Remarks

The default value of this property is False. This property corresponds to the Contents cannot be edited check box in the Content Control Properties dialog box.

Example

The following example inserts a date content control into the active document, and then sets the contents of the content control and specifies that the user cannot edit the contents or delete the control from the document.

VBA Copy code Copy code
Dim objCC As ContentControl

Set objCC = ActiveDocument.ContentControls _
 .Add(wdContentControlDate)

objCC.Range.Text = "January 1, 2007"
objCC.LockContents = True
objCC.LockContentControl = True

See also

Concepts

ContentControl Object

Other resources

ContentControl Object Members


ContentControl.MultiLine Property (Word)

 Copy code hover
[image]

ContentControl.MultiLine Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Boolean that represents whether a text content control allows multiple lines of text. Read/write.

Syntax

expression .MultiLine

expression An expression that returns a ContentControl object.

Remarks

This property applies only to text content controls and rich text content controls.

See also

Concepts

ContentControl Object

Other resources

ContentControl Object Members


ContentControl.Parent Property (Word)

 Copy code hover
[image]

ContentControl.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified ContentControl object.

Syntax

expression .Parent

expression A variable that represents a ContentControl object.

See also

Concepts

ContentControl Object

Other resources

ContentControl Object Members


ContentControl.ParentContentControl Property (Word)

 Copy code hover
[image]

ContentControl.ParentContentControl Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a ContentControl that represents the parent content control for a content control that is nested inside a rich-text control or group control. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .ParentContentControl

expression An expression that returns a ContentControl object.

Remarks

If a content control is not nested, this proprerty returns an error.

See also

Concepts

ContentControl Object

Other resources

ContentControl Object Members


ContentControl.PlaceholderText Property (Word)

 Copy code hover
[image]

ContentControl.PlaceholderText Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a BuildingBlock object that represents the placeholder text for a content control. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .PlaceholderText

expression An expression that returns a ContentControl object.

Remarks

Use the SetPlaceholderText method to set the placeholder text for a content control.

See also

Concepts

ContentControl Object

Other resources

ContentControl Object Members


ContentControl.Range Property (Word)

 Copy code hover
[image]

ContentControl.Range Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Range that represents the contents of the content control in the active document. Read-only.

Syntax

expression .Range

expression An expression that returns a ContentControl object.

Remarks

Use the Range property to access the text, the formatting for the text, and other text properties. For more information, see Working with Range Objects.

Example

The following example inserts a date content control into the active document, and then sets the contents of the content control and specifies that the user cannot edit the contents or delete the control from the document.

VBA Copy code Copy code
Dim objCC As ContentControl

Set objCC = ActiveDocument.ContentControls _
 .Add(wdContentControlDate)

objCC.Range.Text = "January 1, 2007"
objCC.LockContents = True
objCC.LockContentControl = True

See also

Concepts

ContentControl Object

Other resources

ContentControl Object Members


ContentControl.RepeatingSectionItems Property (Word)

 Copy code hover
[image]

ContentControl.RepeatingSectionItems Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the collection of repeating section items in the specified repeating section content control. Read-only.

Version information

Version Added: Word 2013

Syntax

expression .RepeatingSectionItems

expression A variable that represents a ContentControl object.

Remarks

You can use this property with repeating section content controls only. Using it with other content controls will result in an error.

Property value

REPEATINGSECTIONITEMCOLL

See also

Concepts

ContentControl Object

Other resources

ContentControl Object Members


ContentControl.RepeatingSectionItemTitle Property (Word)

 Copy code hover
[image]

ContentControl.RepeatingSectionItemTitle Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the name of the repeating section items used in the context menu associated with the specified repeating section content control. Read/write.

Version information

Version Added: Word 2013

Syntax

expression .RepeatingSectionItemTitle

expression A variable that represents a ContentControl object.

Remarks

You can use this property with repeating section content controls only. Using it with other content controls will result in an error.

Property value

STRING

See also

Concepts

ContentControl Object

Other resources

ContentControl Object Members


ContentControl.ShowingPlaceholderText Property (Word)

 Copy code hover
[image]

ContentControl.ShowingPlaceholderText Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Boolean that indicates whether the placeholder text for the content control is displayed. Read-only.

Syntax

expression .ShowingPlaceholderText

expression An expression that returns a ContentControl object.

Example

The following example inserts a new drop-down list content control into the active document, sets the title and the placeholder text if the placeholder text is showing, and then adds several new items to the list.

VBA Copy code Copy code
Dim objCC As ContentControl
Dim objMap As XMLMapping

Set objCC = ActiveDocument.ContentControls.Add(wdContentControlDropdownList)
objCC.Title = "My Favorite Animal"
If objCC.ShowingPlaceholderText Then _
 objCC.SetPlaceholderText , , "Select your favorite animal "

'List entries
objCC.DropdownListEntries.Add "Cat"
objCC.DropdownListEntries.Add "Dog"
objCC.DropdownListEntries.Add "Horse"
objCC.DropdownListEntries.Add "Monkey"
objCC.DropdownListEntries.Add "Snake"
objCC.DropdownListEntries.Add("Other")

See also

Concepts

ContentControl Object

Other resources

ContentControl Object Members


ContentControl.Tag Property (Word)

 Copy code hover
[image]

ContentControl.Tag Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a String that represents a value to identify a content control. Read/write.

Syntax

expression .Tag

expression An expression that returns a ContentControl object.

Remarks

The Tag property is different from the Title property in that a tag is never displayed while a user edits a document. Instead, developers can use it to store a value for programmatic manipulation while the document is opened.

See also

Concepts

ContentControl Object

Other resources

ContentControl Object Members


ContentControl.Temporary Property (Word)

 Copy code hover
[image]

ContentControl.Temporary Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents whether to remove a content control from the active document when the user edits the contents of the control. Read/write.

Syntax

expression .Temporary

expression An expression that returns a ContentControl object.

Remarks

The default value is False. This property corresponds to the Remove content control when contents are edited check box in the Content Control Properties dialog box.

Note Note

You cannot set this property if the LockContentControl property is set to True.

See also

Concepts

ContentControl Object

Other resources

ContentControl Object Members


ContentControl.Title Property (Word)

 Copy code hover
[image]

ContentControl.Title Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a String that represents the title for a content control. Read/write.

Syntax

expression .Title

expression An expression that returns a ContentControl object.

Example

The following example inserts a new drop-down list content control into the active document, sets the title and placeholder text, and then adds several new items to the list.

VBA Copy code Copy code
Dim objCC As ContentControl
Dim objMap As XMLMapping

Set objCC = ActiveDocument.ContentControls.Add(wdContentControlDropdownList)
objCC.Title = "My Favorite Animal"
objCC.SetPlaceholderText , , "Select your favorite animal "

'List entries
objCC.DropdownListEntries.Add "Cat"
objCC.DropdownListEntries.Add "Dog"
objCC.DropdownListEntries.Add "Horse"
objCC.DropdownListEntries.Add "Monkey"
objCC.DropdownListEntries.Add "Snake"
objCC.DropdownListEntries.Add("Other")

See also

Concepts

ContentControl Object

Other resources

ContentControl Object Members


ContentControl.Type Property (Word)

 Copy code hover
[image]

ContentControl.Type Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a WdContentControlType that represents the type for a content control. Read/write.

Syntax

expression .Type

expression An expression that returns a ContentControl object.

Remarks

You can use the Type property to change the type of a content control from one type to another. However, the ability to change the type of control depends on the original type and on the content inside the content control at the time of the change. All content controls can be changed to rich text or building block gallery type content controls because these types allow arbitrary content. For other types, if the content is valid for the type that you want to change to, then changing the type is allowed. Otherwise, the change is rejected, resulting in a run-time error.

Example

The following example checks to see if the specified content control is a drop-down list box or a combo box, and if it is one of these two types, moves the last item in the list up, so that it becomes the first item in the list.

VBA Copy code Copy code
Dim objCC As ContentControl
Dim objCL As ContentControlListEntry
Dim intCount As Integer

Set objCC = ActiveDocument.ContentControls.Item(3)

If objCC.Type = wdContentControlComboBox Or _
 objCC.Type = wdContentControlDropdownList Then

 Set objCL = objCC.DropdownListEntries.Item(objCC.DropdownListEntries.Count)

 For intCount = 1 To objCC.DropdownListEntries.Count
 objCL.MoveUp
 Next

End If

See also

Concepts

ContentControl Object

Other resources

ContentControl Object Members


ContentControl.XMLMapping Property (Word)

 Copy code hover
[image]

ContentControl.XMLMapping Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an XMLMapping object that represents the mapping of a content control to XML data in the data store of a document. Read-only.

Syntax

expression .XMLMapping

expression An expression that returns a ContentControl object.

Example

The following example sets the built-in Author document property and adds a new content control to the active document, and then sets the mapping for the control to the value of the built-in document property.

VBA Copy code Copy code
Dim objCC As ContentControl
Dim objMap As XMLMapping
Dim blnMap As Boolean

ActiveDocument.BuiltInDocumentProperties("Author").Value = "David Jaffe"

Set objCC = ActiveDocument.ContentControls.Add _
 (wdContentControlText, ActiveDocument.Paragraphs(1).Range)

Set objMap = objCC.XMLMapping
blnMap = objMap.SetMapping(XPath:="/ns1:coreProperties[1]/ns0:creator[1]")

If blnMap = False Then
 MsgBox "Unable to map the content control."
End If

See also

Concepts

ContentControl Object

Other resources

ContentControl Object Members


ContentControl Methods (Word)

 Copy code hover
[image]

ContentControl Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Copy | Copies the content control from the active document to the Clipboard.
Cut | Removes the content control from the active document and moves the content control to the Clipboard.
Delete | Deletes the specified content control and the contents of the content control.
SetCheckedSymbol | Sets the symbol used to represent the checked state of a check box content control.
SetPlaceholderText | Sets the placeholder text that displays in the content control until a user enters their own text.
SetUncheckedSymbol | Sets the symbol used to represent the unchecked state of a check box content control.
Ungroup | Removes a group content control from a document so that its child content controls are no longer nested and can be freely edited.


ContentControl.Copy Method (Word)

 Copy code hover
[image]

ContentControl.Copy Method (Word)
See also Send feedback

Published: July 16, 2012

Copies the content control from the active document to the Clipboard.

Syntax

expression .Copy

expression An expression that returns a ContentControl object.

Remarks

When you use the Copy method, the original content control remains in the active document, but a copy of the control, including all text and property settings, is moved to the Clipboard. You can then paste the content control into other sections of the active document. Use the Paste method of the Selection object or the Paste method of the Range object to insert the copied content control, or use the Paste function from within Microsoft Word.

See also

Concepts

ContentControl Object

Other resources

ContentControl Object Members


ContentControl.Cut Method (Word)

 Copy code hover
[image]

ContentControl.Cut Method (Word)
See also Send feedback

Published: July 16, 2012

Removes the content control from the active document and moves the content control to the Clipboard.

Syntax

expression .Cut

expression An expression that returns a ContentControl object.

Remarks

Use the Paste method of the Selection object or the Paste method of the Range object to insert the cut content control, or use the Paste function from within Microsoft Word.

See also

Concepts

ContentControl Object

Other resources

ContentControl Object Members


ContentControl.Delete Method (Word)

 Copy code hover
[image]

ContentControl.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the specified content control and the contents of the content control.

Syntax

expression .Delete(DeleteContents)

expression An expression that returns a ContentControl object.

Parameters

Name | Required/Optional | Data Type | Description
DeleteContents | Optional | Boolean | Specifies whether to delete the contents of the content control. True removes both the content control and its contents. False removes the control but leaves the contents of the content control in the active document. The default value is False.

Example

The following example removes all content controls and their contents from the active document.

VBA Copy code Copy code
Dim objCC As ContentControl

Do While ActiveDocument.ContentControls.Count > 0
 For Each objCC In ActiveDocument.ContentControls
 objCC.Delete True
 Next
Loop

See also

Concepts

ContentControl Object

Other resources

ContentControl Object Members


ContentControl.SetCheckedSymbol Method (Word)

 Copy code hover
[image]

ContentControl.SetCheckedSymbol Method (Word)
See also Send feedback

Published: July 16, 2012

Sets the symbol used to represent the checked state of a check box content control.

Version Information

Version Added: Word 2010

Syntax

expression .SetCheckedSymbol(CharacterNumber, Font)

expression An expression that returns a ContentControl object.

Parameters

Name | Required/Optional | Data Type | Description
CharacterNumber | Required | Long | The Unicode character number for the specified symbol. This value will always be the sum of 31 (the number of control symbols at the beginning of the font) and the number that corresponds to the position of the symbol in the table of symbols (counting from left to right). For example, to specify a delta character at position 37 in the table of symbols in the Symbol font, set CharacterNumber to 68.
Font | Optional | String | The name of the font that contains the symbol.

Example

The following code example sets the checked symbol of the specified content control to the "MS Gothic" font "Ballot Box with X" symbol.

VBA Copy code Copy code
Dim objCC As ContentControl

Set objCC = ActiveDocument.ContentControls.Add (wdContentControlCheckbox)
objCC.SetCheckedSymbol CharacterNumber:=&H2612, Font:="MS Gothic"

See also

Concepts

ContentControl Object

Other resources

ContentControl Object Members


ContentControl.SetPlaceholderText Method (Word)

 Copy code hover
[image]

ContentControl.SetPlaceholderText Method (Word)
See also Send feedback

Published: July 16, 2012

Sets the placeholder text that displays in the content control until a user enters their own text.

Syntax

expression .SetPlaceholderText(BuildingBlock, Range, Text)

expression An expression that returns a ContentControl object.

Parameters

Name | Required/Optional | Data Type | Description
BuildingBlock | Optional | BuildingBlock | Specifies a BuildingBlock object that contains the contents of the placeholder text.
Range | Optional | Range | Specifies a Range object that contains the contents of the placeholder text.
Text | Optional | String | Specifies the contents of the placeholder text.

Remarks

Only one of the parameters is used when specifying placeholder text. If more than one parameter is used, Microsoft Word uses the text specified in the first parameter. If all parameters are omitted, the placeholder text is blank.

Example

The following example inserts a new drop-down list content control into the active document, sets the title and placeholder text, and then inserts several new items into the list.

VBA Copy code Copy code
Dim objCC As ContentControl
Dim objMap As XMLMapping

Set objCC = ActiveDocument.ContentControls.Add(wdContentControlDropdownList)
objCC.Title = "My Favorite Animal"
objCC.SetPlaceholderText , , "Select your favorite animal "

'List entries
objCC.DropdownListEntries.Add "Cat"
objCC.DropdownListEntries.Add "Dog"
objCC.DropdownListEntries.Add "Horse"
objCC.DropdownListEntries.Add "Monkey"
objCC.DropdownListEntries.Add "Snake"
objCC.DropdownListEntries.Add "Other"

See also

Concepts

ContentControl Object

Other resources

ContentControl Object Members


ContentControl.SetUncheckedSymbol Method (Word)

 Copy code hover
[image]

ContentControl.SetUncheckedSymbol Method (Word)
See also Send feedback

Published: July 16, 2012

Sets the symbol used to represent the unchecked state of a check box content control.

Version Information

Version Added: Word 2010

Syntax

expression .SetCheckedSymbol(CharacterNumber, Font)

expression An expression that returns a ContentControl object.

Parameters

Name | Required/Optional | Data Type | Description
CharacterNumber | Required | Long | The Unicode character number for the specified symbol. This value will always be the sum of 31 (the number of control symbols at the beginning of the font) and the number that corresponds to the position of the symbol in the table of symbols (counting from left to right). For example, to specify a delta character at position 37 in the table of symbols in the Symbol font, set CharacterNumber to 68.
Font | Optional | String | The name of the font that contains the symbol.

Example

The following code example sets the unchecked symbol of the specified content control to the "MS Gothic" font "Ballot Box" symbol.

VBA Copy code Copy code
Dim objCC As ContentControl

Set objCC = ActiveDocument.ContentControls.Add (wdContentControlCheckbox)
objCC.SetUncheckedSymbol CharacterNumber:=&H2610, Font:="MS Gothic"

See also

Concepts

ContentControl Object

Other resources

ContentControl Object Members


ContentControl.Ungroup Method (Word)

 Copy code hover
[image]

ContentControl.Ungroup Method (Word)
See also Send feedback

Published: July 16, 2012

Removes a group content control from a document so that its child content controls are no longer nested and can be freely edited.

Version Information

Version Added: Word 2007

Syntax

expression .Ungroup

expression An expression that returns a ContentControl object.

Remarks

This method fails if you run it on a control that is not of type wdContentControlGroup.

See also

Concepts

ContentControl Object

Other resources

ContentControl Object Members


ContentControlListEntries Object (Word)

 Copy code hover
[image]

ContentControlListEntries Object (Word)
See also Send feedback

Published: July 16, 2012

The ContentControlListEntries collection contains ContentControlListEntry objects that represent the items in a drop-down list or combo box content control.

Remarks

Use the Add method to add an item to a drop-down list or combo box. The following code example uses the Add method to add several list items to a new drop-down list content control.

VBA Copy code Copy code
Dim objCC As ContentControl Dim objLE As ContentControlListEntry Dim objMap As XMLMapping  Set objCC = ActiveDocument.ContentControls.Add(wdContentControlDropdownList)  'List items objCC.DropdownListEntries.Add "Cat" objCC.DropdownListEntries.Add "Dog" objCC.DropdownListEntries.Add "Equine" objCC.DropdownListEntries.Add "Monkey" objCC.DropdownListEntries.Add "Snake" objCC.DropdownListEntries.Add "Other"

Use the Item method or the DropdownListEntries property of a ContentControl object to access an individual list item within a collection. The following code example uses the Item method to access the third item in a list and change the display text.

Note Note

The following code example assumes that the first ContentControl object in the active document is a drop-down list or combo box.

VBA Copy code Copy code
Dim objCC As ContentControl Dim objLE As ContentControlListEntry Dim objMap As XMLMapping  Set objCC = ActiveDocument.ContentControls(1) Set objLE = objCC.DropdownListEntries.Item(3) objLE.Text = "Horse"

Use the Clear method to remove all items from a drop-down list or combo box. The following code example clears all items from the first content control in the active document.

Note Note

The following code example assumes that the first content control in the active document is a drop-down list or combo box.

VBA Copy code Copy code
Dim objCC As ContentControl  Set objCC = ActiveDocument.ContentControls(1)  objCC.DropdownListEntries.Clear

See also

Concepts

Word Object Model Reference

Other resources

ContentControlListEntries Object Members


ContentControlListEntries Members (Word)

 Copy code hover
[image]

ContentControlListEntries Members (Word)
Send feedback

Published: July 16, 2012

The ContentControlListEntries collection contains ContentControlListEntry objects that represent the items in a drop-down list or combo box content control.

Methods

Name | Description
Add | Adds a new list item to a drop-down list or combo box content control and returns a ContentControlListEntry object.
Clear | Clears all items from a drop-down list or combo box content control.
Item | Returns a ContentControlListEntry object that represents the specified item in the collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns the number of items in the ContentControlListEntries collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified ContentControlListEntries object.


ContentControlListEntries Properties (Word)

 Copy code hover
[image]

ContentControlListEntries Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns the number of items in the ContentControlListEntries collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified ContentControlListEntries object.


ContentControlListEntries.Application Property (Word)

 Copy code hover
[image]

ContentControlListEntries.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a ContentControlListEntries collection.

See also

Concepts

ContentControlListEntries Collection

Other resources

ContentControlListEntries Object Members


ContentControlListEntries.Count Property (Word)

 Copy code hover
[image]

ContentControlListEntries.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the number of items in the ContentControlListEntries collection. Read-only Long.

Syntax

expression .Count

expression A variable that represents a ContentControlListEntries object.

See also

Concepts

ContentControlListEntries Collection

Other resources

ContentControlListEntries Object Members


ContentControlListEntries.Creator Property (Word)

 Copy code hover
[image]

ContentControlListEntries.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.

Syntax

expression .Creator

expression An expression that returns an ContentControlListEntries object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD". This property was primarily designed to be used on the Apple Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For more information about this property, see the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

ContentControlListEntries Collection

Other resources

ContentControlListEntries Object Members


ContentControlListEntries.Parent Property (Word)

 Copy code hover
[image]

ContentControlListEntries.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified ContentControlListEntries object.

Syntax

expression .Parent

expression A variable that represents a ContentControlListEntries object.

See also

Concepts

ContentControlListEntries Collection

Other resources

ContentControlListEntries Object Members


ContentControlListEntries Methods (Word)

 Copy code hover
[image]

ContentControlListEntries Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Adds a new list item to a drop-down list or combo box content control and returns a ContentControlListEntry object.
Clear | Clears all items from a drop-down list or combo box content control.
Item | Returns a ContentControlListEntry object that represents the specified item in the collection.


ContentControlListEntries.Add Method (Word)

 Copy code hover
[image]

ContentControlListEntries.Add Method (Word)
See also Send feedback

Published: July 16, 2012

Adds a new list item to a drop-down list or combo box content control and returns a ContentControlListEntry object.

Syntax

expression .Add(Text, Value, Index)

expression An expression that returns a ContentControlListEntries object.

Parameters

Name | Required/Optional | Data Type | Description
Text | Required | String | Specifies the display text for the list item. Corresponds to the Text property for a ContentControlListEntry object.
Value | Optional | String | Specifies the value of the list item. Corresponds to the Value property for a ContentControlListEntry object. If omitted, the Value property is equal to the Text property.
Index | Optional | Long | Specifies the ordinal position of the new item in the list. If an item exists at the position specified, the existing item is pushed down in the list. If omitted, the new item is added to the end of the list.

Return Value

ContentControlListEntry

Remarks

List entries must have unique display names. Attempting to add a list item that already exists raises a run-time error.

Example

The following code example creates a new drop-down list content control and then adds several items to it.

VBA Copy code Copy code
Dim objCC As ContentControl
Dim objLE As ContentControlListEntry
Dim objMap As XMLMapping

Set objCC = ActiveDocument.ContentControls.Add(wdContentControlDropdownList)

'List items
objCC.DropdownListEntries.Add "Cat"
objCC.DropdownListEntries.Add "Dog"
objCC.DropdownListEntries.Add "Equine"
objCC.DropdownListEntries.Add "Monkey"
objCC.DropdownListEntries.Add "Snake"
objCC.DropdownListEntries.Add "Other"

See also

Concepts

ContentControlListEntries Collection

Other resources

ContentControlListEntries Object Members


ContentControlListEntries.Clear Method (Word)

 Copy code hover
[image]

ContentControlListEntries.Clear Method (Word)
See also Send feedback

Published: July 16, 2012

Clears all items from a drop-down list or combo box content control.

Syntax

expression .Clear

expression An expression that returns a ContentControlListEntries object.

Example

The following code example clears all items from the first content control in the active document.

Note Note

The following code example assumes that the first content control in the active document is a drop-down list or combo box.

VBA Copy code Copy code
Dim objCC As ContentControl

Set objCC = ActiveDocument.ContentControls(1)

objCC.DropdownListEntries.Clear

See also

Concepts

ContentControlListEntries Collection

Other resources

ContentControlListEntries Object Members


ContentControlListEntries.Item Method (Word)

 Copy code hover
[image]

ContentControlListEntries.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a ContentControlListEntry object that represents the specified item in the collection.

Syntax

expression .Item(Index)

expression An expression that returns a ContentControlListEntries object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | Specifies the ordinal position of the object within the collection.

Return Value

ContentControlListEntry

See also

Concepts

ContentControlListEntries Collection

Other resources

ContentControlListEntries Object Members


ContentControlListEntry Object (Word)

 Copy code hover
[image]

ContentControlListEntry Object (Word)
See also Send feedback

Published: July 16, 2012

A ContentControlListEntry object represents a list item in a drop-down list or combo box content control. A ContentControlListEntry object is a member of the ContentControlListEntries collection for a ContentControl object.

Remarks

Use the Add method of the ContentControlListEntries collection to create a new ContentControlListEntry object. Use the Item method, or DropdownListEntries(Index), where Index is the ordinal position of the content control list item, to access an individual list item within the ContentControlListEntries collection.

Note Note

List entries must have unique display names. Attempting to add a list item that already exists raises a run-time error.

The following code example uses the Add method to add several list items to a new drop-down list content control, and then uses the Item method to access the third item in the list and change the display text.

VBA Copy code Copy code
Dim objCC As ContentControl
Dim objLE As ContentControlListEntry
Dim objMap As XMLMapping

Set objCC = ActiveDocument.ContentControls.Add(wdContentControlDropdownList)

'List items
objCC.DropdownListEntries.Add "Cat"
objCC.DropdownListEntries.Add "Dog"
objCC.DropdownListEntries.Add "Equine"
objCC.DropdownListEntries.Add "Monkey"
objCC.DropdownListEntries.Add "Snake"
objCC.DropdownListEntries.Add "Other"

Set objLE = objCC.DropdownListEntries.Item(3) objLE.Text = "Horse"

Use the MoveUp and MoveDown methods to reposition items in a drop-down list. The following code example moves the first item down, so that it becomes the last item in the list, and moves the last item up, so that it becomes the first item in the list.

VBA Copy code Copy code
Dim objcc As ContentControl
Dim objLE1 As ContentControlListEntry
Dim objLE2 As ContentControlListEntry
Dim intCount As Integer

Set objcc = ActiveDocument.ContentControls.Item(3)

If objcc.Type = wdContentControlComboBox Or _
 objcc.Type = wdContentControlDropdownList Then

 'First item in the list.
 Set objLE1 = objcc.DropdownListEntries.Item(1)

 'Last item in the list.
 Set objLE2 = objcc.DropdownListEntries.Item(objcc.DropdownListEntries.Count)

 For intCount = 1 To objcc.DropdownListEntries.Count
 'Move the first item down one.
 objLE1.MoveDown

 'Move the last item up one.
 objLE2.MoveUp
 Next

End If

Use the Select method to programmatically select a content control list item. The following code example inserts a drop-down list content control into the active document, sets the title and placeholder text and adds several items to the list, and then selects the last item entered.

VBA Copy code Copy code
Dim objCC As ContentControl
Dim objCE As ContentControlListEntry
Dim objMap As XMLMapping

Set objCC = ActiveDocument.ContentControls.Add(wdContentControlDropdownList)
objCC.Title = "My Favorite Animal"
If objCC.ShowingPlaceholderText Then _
 objCC.SetPlaceholderText , , "Select your favorite animal "

'List entries
objCC.DropdownListEntries.Add "Cat"
objCC.DropdownListEntries.Add "Dog"
objCC.DropdownListEntries.Add "Horse"
objCC.DropdownListEntries.Add "Monkey"
objCC.DropdownListEntries.Add "Snake"

Set objCE = objCC.DropdownListEntries.Add("Other")
objCE.Select

Use the Text property to set the display text for a content control list item, and use the Value property to set a programmatic value that you may use later for processing a form. For example, you may use a content control drop-down list for a list of products. The Text property may contain the name of the product, a display name that a user can easily recognize and understand. The Value property may contain the product number for the product that corresponds to a product number in a database. You can then use the product number from the Value property to look up product information in a database. Also, the value of the Value property is what is sent to the custom XML data if the content control is mapped to XML data in the data store.

The following code example sets the value for the item based on the contents of the display text.

VBA Copy code Copy code
Dim objCc As ContentControl
Dim objLe As ContentControlListEntry
Dim strText As String
Dim strChar As String

Set objCc = ActiveDocument.ContentControls(3)

For Each objLE In objCC.DropdownListEntries
 If objLE.Text <> "Other" Then
 strText = objLE.Text
 objLE.Value = "My favorite animal is the " & strText & "."
 End If
Next

Use the Delete method to remove an item from a content control drop-down list or combo box. The following code example deletes a drop-down list item if the display text of the item is "Other".

VBA Copy code Copy code
Dim objCC As ContentControl
Dim objCL As ContentControlListEntry

For Each objCC In ActiveDocument.ContentControls
 If objCC.Type = wdContentControlComboBox Or _
 objCC.Type = wdContentControlDropdownList Then
 For Each objCL In objCC.DropdownListEntries
 If objCL.Text = "Other" Then objCL.Delete
 Next
 End If
Next

See also

Concepts

Word Object Model Reference

Other resources

ContentControlListEntry Object Members


ContentControlListEntry Members (Word)

 Copy code hover
[image]

ContentControlListEntry Members (Word)
Send feedback

Published: July 16, 2012

A ContentControlListEntry object represents a list item in a drop-down list or combo box content control. A ContentControlListEntry object is a member of the ContentControlListEntries collection for a ContentControl object.

Methods

Name | Description
Delete | Deletes the specified item in a combo box or drop-down list content control.
MoveDown | Moves an item in a drop-down list or combo box content control down one item, so that it is after the item that originally followed it.
MoveUp | Moves an item in a drop-down list or combo box content control up one item, so that it is before the item that originally preceded it.
Select | Selects the list entry in a drop-down list or combo box content control and sets the text of the content control to the value of the item.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
Index | Returns or sets a Long that represents the ordinal position of a content control list item in the collection of list items. Read/write.
Parent | Returns an Object that represents the parent object of the specified ContentControlListEntry object.
Text | Returns or sets a String that represents the display text of a list item for a drop-down list or combo box content control. Read/write.
Value | Returns or sets a String that represents the programmatic value of an item in a drop-down list or combo box content control. Read/write.


ContentControlListEntry Properties (Word)

 Copy code hover
[image]

ContentControlListEntry Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
Index | Returns or sets a Long that represents the ordinal position of a content control list item in the collection of list items. Read/write.
Parent | Returns an Object that represents the parent object of the specified ContentControlListEntry object.
Text | Returns or sets a String that represents the display text of a list item for a drop-down list or combo box content control. Read/write.
Value | Returns or sets a String that represents the programmatic value of an item in a drop-down list or combo box content control. Read/write.


ContentControlListEntry.Application Property (Word)

 Copy code hover
[image]

ContentControlListEntry.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a ContentControlListEntry object.

See also

Concepts

ContentControlListEntry Object

Other resources

ContentControlListEntry Object Members


ContentControlListEntry.Creator Property (Word)

 Copy code hover
[image]

ContentControlListEntry.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.

Syntax

expression .Creator

expression An expression that returns an ContentControlListEntry object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

ContentControlListEntry Object

Other resources

ContentControlListEntry Object Members


ContentControlListEntry.Index Property (Word)

 Copy code hover
[image]

ContentControlListEntry.Index Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Long that represents the ordinal position of a content control list item in the collection of list items. Read/write.

Syntax

expression .Index

expression An expression that returns a ContentControlListEntry object.

Remarks

You can set the Index property to any numeric value to change the ordinal position of an item in a list. For example, if you change the Index property for the fifth item in a list to "2", the fifth item becomes the second item. The original second item, and all items that follow, move down one position.

See also

Concepts

ContentControlListEntry Object

Other resources

ContentControlListEntry Object Members


ContentControlListEntry.Parent Property (Word)

 Copy code hover
[image]

ContentControlListEntry.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified ContentControlListEntry object.

Syntax

expression .Parent

expression A variable that represents a ContentControlListEntry object.

See also

Concepts

ContentControlListEntry Object

Other resources

ContentControlListEntry Object Members


ContentControlListEntry.Text Property (Word)

 Copy code hover
[image]

ContentControlListEntry.Text Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a String that represents the display text of a list item for a drop-down list or combo box content control. Read/write.

Syntax

expression .Text

expression An expression that returns a ContentControlListEntry object.

Remarks

List entries must have unique display names. Attempting to change the Text property to a string that already exists in the list of entries raises a run-time error.

Example

The following example capitalizes the first character, if it is lowercase, in the display text of each list item.

VBA Copy code Copy code
Dim objCC As ContentControl
Dim objLE As ContentControlListEntry
Dim strFirst As String

For Each objCC In ActiveDocument.ContentControls
 If objCC.Type = wdContentControlComboBox Or objCC.Type = wdContentControlDropdownList Then
 For Each objLE In objCC.DropdownListEntries
 strFirst = Left(objLE.Text, 1)

 If strFirst = LCase(strFirst) Then
 objLE.Text = UCase(strFirst) & Right(objLe.Text, Len(objLe.Text) - 1)
 End If
 Next
 End If
Next

The following example sets the value for the list item based on the contents of the display text.

VBA Copy code Copy code
Dim objCc As ContentControl
Dim objLe As ContentControlListEntry
Dim strText As String
Dim strChar As String

Set objCc = ActiveDocument.ContentControls(3)

For Each objLE In objCC.DropdownListEntries
 If objLE.Text <> "Other" Then
 strText = objLE.Text
 objLE.Value = "My favorite animal is the " & strText & "."
 End If
Next

See also

Concepts

ContentControlListEntry Object

Other resources

ContentControlListEntry Object Members


ContentControlListEntry.Value Property (Word)

 Copy code hover
[image]

ContentControlListEntry.Value Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a String that represents the programmatic value of an item in a drop-down list or combo box content control. Read/write.

Syntax

expression .Value

expression An expression that returns a ContentControlListEntry object.

Remarks

Use the Value property to store data that you need to use at processing time. For example, the Text property may contain a string that you want to display and the Value property may contain a number, such as an item number, that you can use to look up information in a database. Also, the value of the Value property is what is sent to the custom XML data, if the content control is mapped to XML data in the data store.

Note Note

You cannot set the Value property for list entries that were automatically populated from an XML schema attached to the custom XML that is mapped to this control.

Example

The following example sets the value for the item based on the contents of the display text.

VBA Copy code Copy code
Dim objCc As ContentControl
Dim objLe As ContentControlListEntry
Dim strText As String
Dim strChar As String

Set objCc = ActiveDocument.ContentControls(3)

For Each objLE In objCC.DropdownListEntries
 If objLE.Text <> "Other" Then
 strText = objLE.Text
 objLE.Value = "My favorite animal is the " & strText & "."
 End If
Next

See also

Concepts

ContentControlListEntry Object

Other resources

ContentControlListEntry Object Members


ContentControlListEntry Methods (Word)

 Copy code hover
[image]

ContentControlListEntry Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the specified item in a combo box or drop-down list content control.
MoveDown | Moves an item in a drop-down list or combo box content control down one item, so that it is after the item that originally followed it.
MoveUp | Moves an item in a drop-down list or combo box content control up one item, so that it is before the item that originally preceded it.
Select | Selects the list entry in a drop-down list or combo box content control and sets the text of the content control to the value of the item.


ContentControlListEntry.Delete Method (Word)

 Copy code hover
[image]

ContentControlListEntry.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the specified item in a combo box or drop-down list content control.

Syntax

expression .Delete

expression An expression that returns a ContentControlListEntry object.

Example

The following example deletes a drop-down list item if the display text of the item is "Other".

VBA Copy code Copy code
Dim objCC As ContentControl
Dim objCL As ContentControlListEntry

For Each objCC In ActiveDocument.ContentControls
 If objCC.Type = wdContentControlComboBox Or _
 objCC.Type = wdContentControlDropdownList Then
 For Each objCL In objCC.DropdownListEntries
 If objCL.Text = "Other" Then objCL.Delete
 Next
 End If
Next

See also

Concepts

ContentControlListEntry Object

Other resources

ContentControlListEntry Object Members


ContentControlListEntry.MoveDown Method (Word)

 Copy code hover
[image]

ContentControlListEntry.MoveDown Method (Word)
See also Send feedback

Published: July 16, 2012

Moves an item in a drop-down list or combo box content control down one item, so that it is after the item that originally followed it.

Syntax

expression .MoveDown

expression An expression that returns a ContentControlListEntry object.

Example

The following example moves the first item down, so that it becomes the last item in the list of items in a drop-down list or combo box content control.

VBA Copy code Copy code
Dim objCC As ContentControl
Dim objCL As ContentControlListEntry
Dim intCount As Integer

Set objCC = ActiveDocument.ContentControls.Item(3)

If objCC.Type = wdContentControlComboBox Or _
 objCC.Type = wdContentControlDropdownList Then

 Set objCL = objCC.DropdownListEntries.Item(1)

 For intCount = 1 To objCC.DropdownListEntries.Count
 objCL.MoveDown
 Next

End If

See also

Concepts

ContentControlListEntry Object

Other resources

ContentControlListEntry Object Members


ContentControlListEntry.MoveUp Method (Word)

 Copy code hover
[image]

ContentControlListEntry.MoveUp Method (Word)
See also Send feedback

Published: July 16, 2012

Moves an item in a drop-down list or combo box content control up one item, so that it is before the item that originally preceded it.

Syntax

expression .MoveUp

expression An expression that returns a ContentControlListEntry object.

Example

The following example moves the last item in the drop-down list or combo box content control up, so that it becomes the first item.

VBA Copy code Copy code
Dim objCC As ContentControl
Dim objCL As ContentControlListEntry
Dim intCount As Integer

Set objCC = ActiveDocument.ContentControls.Item(3)

If objCC.Type = wdContentControlComboBox Or _
 objCC.Type = wdContentControlDropdownList Then

 Set objCL = objCC.DropdownListEntries.Item(objCC.DropdownListEntries.Count)

 For intCount = 1 To objCC.DropdownListEntries.Count
 objCL.MoveUp
 Next

End If

See also

Concepts

ContentControlListEntry Object

Other resources

ContentControlListEntry Object Members


ContentControlListEntry.Select Method (Word)

 Copy code hover
[image]

ContentControlListEntry.Select Method (Word)
See also Send feedback

Published: July 16, 2012

Selects the list entry in a drop-down list or combo box content control and sets the text of the content control to the value of the item.

Syntax

expression .Select

expression An expression that returns a ContentControlListEntry object.

Example

The following example inserts a drop-down list content control into the active document, sets the title and placeholder text and adds several items to the list, and then selects the last item entered.

VBA Copy code Copy code
Dim objCC As ContentControl
Dim objCE As ContentControlListEntry
Dim objMap As XMLMapping

Set objCC = ActiveDocument.ContentControls.Add(wdContentControlDropdownList)
objCC.Title = "My Favorite Animal"
If objCC.ShowingPlaceholderText Then _
 objCC.SetPlaceholderText , , "Select your favorite animal "

'List entries
objCC.DropdownListEntries.Add "Cat"
objCC.DropdownListEntries.Add "Dog"
objCC.DropdownListEntries.Add "Horse"
objCC.DropdownListEntries.Add "Monkey"
objCC.DropdownListEntries.Add "Snake"

Set objCE = objCC.DropdownListEntries.Add("Other")
objCE.Select

See also

Concepts

ContentControlListEntry Object

Other resources

ContentControlListEntry Object Members


ContentControls Object (Word)

 Copy code hover
[image]

ContentControls Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of ContentControl objects. Content controls are bounded and potentially labeled regions in a document that serve as containers for specific types of content. Individual content controls may contain content such as dates, lists, or paragraphs of formatted text.

Remarks

Use the Add method to create a new content control and insert it into a document. The following example creates a new drop-down list content control and adds several items to the list.

VBA Copy code Copy code
Dim objcc As ContentControl
Dim objMap As XMLMapping

Set objcc = ActiveDocument.ContentControls.Add(wdContentControlDropdownList)
objcc.Title = "My Favorite Animal"
If objcc.ShowingPlaceholderText Then _
 objcc.SetPlaceholderText , , "Select your favorite animal "

'List entries
objcc.DropdownListEntries.Add "Cat"
objcc.DropdownListEntries.Add "Dog"
objcc.DropdownListEntries.Add "Horse"
objcc.DropdownListEntries.Add "Monkey"
objcc.DropdownListEntries.Add "Snake"
objcc.DropdownListEntries.Add "Other"

Use the Item method to access a specific content control in the collection. The following example accesses the third content control in the active document and, if the control is a drop-down list or a combo box, moves the first item to the bottom of the list and the last item to the top of the list.

VBA Copy code Copy code
Dim objcc As ContentControl
Dim objLE1 As ContentControlListEntry
Dim objLE2 As ContentControlListEntry
Dim intCount As Integer

Set objcc = ActiveDocument.ContentControls.Item(3)

If objcc.Type = wdContentControlComboBox Or _
 objcc.Type = wdContentControlDropdownList Then

 'First item in the list.
 Set objLE1 = objcc.DropdownListEntries.Item(1)

 'Last item in the list.
 Set objLE2 = objcc.DropdownListEntries.Item(objcc.DropdownListEntries.Count)

 For intCount = 1 To objcc.DropdownListEntries.Count
 'Move the first item down one.
 objLE1.MoveDown

 'Move the last item up one.
 objLE2.MoveUp
 Next

End If

Use the ContentControl object to work with individual content controls. For more information, see Working with Content Controls.

See also

Concepts

Word Object Model Reference

Other resources

ContentControls Object Members


ContentControls Members (Word)

 Copy code hover
[image]

ContentControls Members (Word)
Send feedback

Published: July 16, 2012

A collection of ContentControl objects. Content controls are bounded and potentially labeled regions in a document that serve as containers for specific types of content. Individual content controls may contain content such as dates, lists, or paragraphs of formatted text.

Methods

Name | Description
Add | Adds a new content control, of the type specified, into the active document and returns a ContentControl object that represents the new content control.
Item | Returns a ContentControl object that represents the specified content control within the collection of content controls in a document.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns the number of items in the ContentControls collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified ContentControls object.


ContentControls Properties (Word)

 Copy code hover
[image]

ContentControls Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns the number of items in the ContentControls collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified ContentControls object.


ContentControls.Application Property (Word)

 Copy code hover
[image]

ContentControls.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a ContentControls collection.

See also

Concepts

ContentControls Collection

Other resources

ContentControls Object Members


ContentControls.Count Property (Word)

 Copy code hover
[image]

ContentControls.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the number of items in the ContentControls collection. Read-only Long.

Syntax

expression .Count

expression A variable that represents a ContentControls object.

See also

Concepts

ContentControls Collection

Other resources

ContentControls Object Members


ContentControls.Creator Property (Word)

 Copy code hover
[image]

ContentControls.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.

Syntax

expression .Creator

expression An expression that returns an ContentControls object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

ContentControls Collection

Other resources

ContentControls Object Members


ContentControls.Parent Property (Word)

 Copy code hover
[image]

ContentControls.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified ContentControls object.

Syntax

expression .Parent

expression A variable that represents a ContentControls object.

See also

Concepts

ContentControls Collection

Other resources

ContentControls Object Members


ContentControls Methods (Word)

 Copy code hover
[image]

ContentControls Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Adds a new content control, of the type specified, into the active document and returns a ContentControl object that represents the new content control.
Item | Returns a ContentControl object that represents the specified content control within the collection of content controls in a document.


ContentControls.Add Method (Word)

 Copy code hover
[image]

ContentControls.Add Method (Word)
See also Send feedback

Published: July 16, 2012

Adds a new content control, of the type specified, into the active document and returns a ContentControl object that represents the new content control.

Syntax

expression .Add(Type, Range)

expression An expression that returns a ContentControls object.

Parameters

Name | Required/Optional | Data Type | Description
Type | Optional | WdContentControlType | Specifies the type of content control to insert into the active document. If omitted, Microsoft Word inserts a rich-text content control.
Range | Optional | Variant | Specifies where in the active document to place the content control. If omitted, Word places the content control at the position of the insertion point or replaces the current selection.

Return Value

ContentControl

Remarks

You can nest content controls only within rich-text content controls, building block gallery content controls, and group content controls. If the insertion point or current selection is inside a content control of a different type, this method raises an error. In this case, you can either move the insertion point or use the Range parameter to specify a location within the document.

Example

The following example creates a new drop-down list content control and adds several items to the list.

VBA Copy code Copy code
Dim objCC As ContentControl

Set objCC = ActiveDocument.ContentControls.Add(wdContentControlDropdownList)
objCC.Title = "My Favorite Animal"
If objCC.ShowingPlaceholderText Then _
 objCC.SetPlaceholderText , , "Select your favorite animal "

'List entries
objCC.DropdownListEntries.Add "Cat"
objCC.DropdownListEntries.Add "Dog"
objCC.DropdownListEntries.Add "Horse"
objCC.DropdownListEntries.Add "Monkey"
objCC.DropdownListEntries.Add "Snake"
objCC.DropdownListEntries.Add "Other"

See also

Concepts

ContentControls Collection

Other resources

ContentControls Object Members


ContentControls.Item Method (Word)

 Copy code hover
[image]

ContentControls.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a ContentControl object that represents the specified content control within the collection of content controls in a document.

Syntax

expression .Item(Index)

expression An expression that returns a ContentControls object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | Specifies the ordinal position of the content control to return.

Return Value

ContentControl

See also

Concepts

ContentControls Collection

Other resources

ContentControls Object Members


CustomLabel Object (Word)

 Copy code hover
[image]

CustomLabel Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a custom mailing label. The CustomLabel object is a member of the CustomLabels collection. The CustomLabels collection contains all the custom mailing labels listed in the Label Options dialog box.

Remarks

Use CustomLabels(Index), where Index is the custom label name or index number, to return a single CustomLabel object. The following example creates a new document with an existing custom label layout named "My Labels."

VBA Copy code Copy code
Set ML = Application.MailingLabel
If ML.CustomLabels("My Labels").Valid = True Then
 ML.CreateNewDocument Name:="My Labels"
Else
 MsgBox "The My Labels custom label is not available"
End If

The index number represents the position of the custom mailing label in the CustomLabels collection. The following example displays the name of the first custom mailing label.

VBA Copy code Copy code
If Application.MailingLabel.CustomLabels.Count >= 1 Then
 MsgBox Application.MailingLabel.CustomLabels(1).Name
End If
Note Note

CustomLabel objects are sorted alphabetically in the CustomLabels collection and their index numbers are dynamically reassigned as the contents of the collection change. For that reason, it is safer to refer to a specific CustomLabel object by name rather than by index number.

Use the Add method to create a custom label. The following example adds a custom mailing label named "My Label" and sets the page size.

VBA Copy code Copy code
Set ML = _
 Application.MailingLabel.CustomLabels.Add(Name:="My Labels", _
 DotMatrix:=False)
ML.PageSize = wdCustomLabelA4

See also

Concepts

Word Object Model Reference

Other resources

CustomLabel Object Members


CustomLabel Members (Word)

 Copy code hover
[image]

CustomLabel Members (Word)
Send feedback

Published: July 16, 2012

Represents a custom mailing label. The CustomLabel object is a member of the CustomLabels collection. The CustomLabels collection contains all the custom mailing labels listed in the Label Options dialog box.

Methods

Name | Description
Delete | Deletes the specified custom label.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
DotMatrix | True if the printer type for the specified custom label is dot matrix. False if the printer type is either laser or ink jet. Read-only Boolean.
Height | Returns or sets the height of a specified custom mailing label, in points. Read/write Single.
HorizontalPitch | Returns or sets the horizontal distance (in points) between the left edge of one custom mailing label and the left edge of the next mailing label. Read/write Single.
Index | Returns a Long that represents the position of an item in a collection. Read-only.
Name | Returns or sets the name of the specified object. Read/write CustomLabel.
NumberAcross | Returns or sets the number of custom mailing labels across a page. Read/write Long.
NumberDown | Returns or sets the number of custom mailing labels down the length of a page. Read/write Long.
PageSize | Returns or sets the page size for the specified custom mailing label. Read/write WdCustomLabelPageSize.
Parent | Returns an Object that represents the parent object of the specified CustomLabel object.
SideMargin | Returns or sets the side margin widths (in points) for the specified custom mailing label. Read/write Single.
TopMargin | Returns or sets the distance (in points) between the top edge of the page and the top boundary of the body text. Read/write Single.
Valid | True if the various properties (for example, Height, Width, and NumberDown) for the specified custom label work together to produce a valid mailing label. Read-only Boolean.
VerticalPitch | Returns or sets the vertical distance between the top of one mailing label and the top of the next mailing label. Read/write Single.
Width | Returns or sets the width of a custom mailing label, in points. Read/write Long.


CustomLabel Properties (Word)

 Copy code hover
[image]

CustomLabel Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
DotMatrix | True if the printer type for the specified custom label is dot matrix. False if the printer type is either laser or ink jet. Read-only Boolean.
Height | Returns or sets the height of a specified custom mailing label, in points. Read/write Single.
HorizontalPitch | Returns or sets the horizontal distance (in points) between the left edge of one custom mailing label and the left edge of the next mailing label. Read/write Single.
Index | Returns a Long that represents the position of an item in a collection. Read-only.
Name | Returns or sets the name of the specified object. Read/write CustomLabel.
NumberAcross | Returns or sets the number of custom mailing labels across a page. Read/write Long.
NumberDown | Returns or sets the number of custom mailing labels down the length of a page. Read/write Long.
PageSize | Returns or sets the page size for the specified custom mailing label. Read/write WdCustomLabelPageSize.
Parent | Returns an Object that represents the parent object of the specified CustomLabel object.
SideMargin | Returns or sets the side margin widths (in points) for the specified custom mailing label. Read/write Single.
TopMargin | Returns or sets the distance (in points) between the top edge of the page and the top boundary of the body text. Read/write Single.
Valid | True if the various properties (for example, Height, Width, and NumberDown) for the specified custom label work together to produce a valid mailing label. Read-only Boolean.
VerticalPitch | Returns or sets the vertical distance between the top of one mailing label and the top of the next mailing label. Read/write Single.
Width | Returns or sets the width of a custom mailing label, in points. Read/write Long.


CustomLabel.Application Property (Word)

 Copy code hover
[image]

CustomLabel.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a CustomLabel object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

CustomLabel Object

Other resources

CustomLabel Object Members


CustomLabel.Creator Property (Word)

 Copy code hover
[image]

CustomLabel.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a CustomLabel object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

CustomLabel Object

Other resources

CustomLabel Object Members


CustomLabel.DotMatrix Property (Word)

 Copy code hover
[image]

CustomLabel.DotMatrix Property (Word)
See also Send feedback

Published: July 16, 2012

True if the printer type for the specified custom label is dot matrix. False if the printer type is either laser or ink jet. Read-only Boolean.

Syntax

expression .DotMatrix

expression A variable that represents a CustomLabel object.

Example

This example displays the name and printer type of the first custom mailing label.

VBA Copy code Copy code
Dim mlTemp As MailingLabel

Set mlTemp = Application.MailingLabel
If mlTemp.CustomLabels.Count >= 1 Then
 If mlTemp.CustomLabels(1).DotMatrix = True Then
 MsgBox mlTemp.CustomLabels(1).Name & " is dot matrix"
 Else
 MsgBox mlTemp.CustomLabels(1).Name _
 & " is laser or ink jet"
 End If
End If

See also

Concepts

CustomLabel Object

Other resources

CustomLabel Object Members


CustomLabel.Height Property (Word)

 Copy code hover
[image]

CustomLabel.Height Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the height of a specified custom mailing label, in points. Read/write Single.

Syntax

expression .Height

expression An expression that returns a CustomLabel object.

See also

Concepts

CustomLabel Object

Other resources

CustomLabel Object Members


CustomLabel.HorizontalPitch Property (Word)

 Copy code hover
[image]

CustomLabel.HorizontalPitch Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the horizontal distance (in points) between the left edge of one custom mailing label and the left edge of the next mailing label. Read/write Single.

Syntax

expression .HorizontalPitch

expression A variable that represents a CustomLabel object.

Remarks

If this property is changed to a value that isn't valid for the specified mailing label layout, an error occurs.

Example

This example defines the layout of an existing custom label named "Laser labels." The horizontal distance between the left edge of one label and the left edge of the next label is set to 4.19 inches.

VBA Copy code Copy code
With Application.MailingLabel.CustomLabels("Laser labels")
 .Height = InchesToPoints(2)
 .HorizontalPitch = InchesToPoints(4.19)
 .NumberAcross = 2
 .NumberDown = 5
 .PageSize = wdCustomLabelLetter
 .SideMargin = InchesToPoints(0.16)
 .TopMargin = InchesToPoints(0.5)
 .VerticalPitch = InchesToPoints(2)
 .Width = InchesToPoints(4)
End With

See also

Concepts

CustomLabel Object

Other resources

CustomLabel Object Members


CustomLabel.Index Property (Word)

 Copy code hover
[image]

CustomLabel.Index Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the position of an item in a collection. Read-only.

Syntax

expression .Index

expression Required. A variable that represents a CustomLabel object.

See also

Concepts

CustomLabel Object

Other resources

CustomLabel Object Members


CustomLabel.Name Property (Word)

 Copy code hover
[image]

CustomLabel.Name Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the name of the specified object. Read/write CustomLabel.

Syntax

expression .Name

expression Required. A variable that represents a CustomLabel object.

See also

Concepts

CustomLabel Object

Other resources

CustomLabel Object Members


CustomLabel.NumberAcross Property (Word)

 Copy code hover
[image]

CustomLabel.NumberAcross Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the number of custom mailing labels across a page. Read/write Long.

Syntax

expression .NumberAcross

expression An expression that returns a CustomLabel object.

Remarks

If this property is changed to a value that isn't valid for the specified mailing label layout, an error occurs.

Example

This example creates a new custom label named "Dept. Labels" and defines the layout, including the number of labels across the page.

VBA Copy code Copy code
Set myLabel = Application.MailingLabel.CustomLabels _
 .Add(Name:="Dept. Labels", DotMatrix:=False)
With myLabel
 .Height = InchesToPoints(0.5)
 .HorizontalPitch = InchesToPoints(2.06)
 .NumberAcross = 4
 .NumberDown = 4
 .PageSize = wdCustomLabelLetter
 .SideMargin = InchesToPoints(0.28)
 .TopMargin = InchesToPoints(0.5)
 .VerticalPitch = InchesToPoints(2)
 .Width = InchesToPoints(1.75)
End With

See also

Concepts

CustomLabel Object

Other resources

CustomLabel Object Members


CustomLabel.NumberDown Property (Word)

 Copy code hover
[image]

CustomLabel.NumberDown Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the number of custom mailing labels down the length of a page. Read/write Long.

Syntax

expression .NumberDown

expression An expression that returns a CustomLabel object.

Remarks

If this property is changed to a value that isn't valid for the specified mailing label layout, an error occurs.

Example

This example displays the number of labels across and down the page for the first custom label in the CustomLabels collection.

VBA Copy code Copy code
numAcr = Application.MailingLabel.CustomLabels(1).NumberAcross
numDwn = Application.MailingLabel.CustomLabels(1).NumberDown
MsgBox Prompt:= "Number of labels across " & numAcr & vbCr _
 & "Number of labels down " & numDwn & vbCr , _
 Title:="Label Page Configuration"

See also

Concepts

CustomLabel Object

Other resources

CustomLabel Object Members


CustomLabel.PageSize Property (Word)

 Copy code hover
[image]

CustomLabel.PageSize Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the page size for the specified custom mailing label. Read/write WdCustomLabelPageSize.

Syntax

expression .PageSize

expression Required. A variable that represents a CustomLabel object.

Remarks

Some of the WdCustomLabelPageSize constants may not be available to you, depending on the language support (U.S. English, for example) that you have selected or installed.

Example

This example creates a new custom label named "Home Address" and then sets various properties for the label, including the page size.

VBA Copy code Copy code
Set myLabel = Application.MailingLabel _
 .CustomLabels.Add(Name:="Home Address", DotMatrix:=False)
With myLabel
 .Height = InchesToPoints(0.5)
 .HorizontalPitch = InchesToPoints(2.06)
 .NumberAcross = 4
 .NumberDown = 20
 .PageSize = wdCustomLabelLetter
 .SideMargin = InchesToPoints(0.28)
 .TopMargin = InchesToPoints(0.5)
 .VerticalPitch = InchesToPoints(0.5)
 .Width = InchesToPoints(1.75)
End With

See also

Concepts

CustomLabel Object

Other resources

CustomLabel Object Members


CustomLabel.Parent Property (Word)

 Copy code hover
[image]

CustomLabel.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified CustomLabel object.

Syntax

expression .Parent

expression Required. A variable that represents a CustomLabel object.

See also

Concepts

CustomLabel Object

Other resources

CustomLabel Object Members


CustomLabel.SideMargin Property (Word)

 Copy code hover
[image]

CustomLabel.SideMargin Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the side margin widths (in points) for the specified custom mailing label. Read/write Single.

Syntax

expression .SideMargin

expression An expression that returns a CustomLabel object.

Remarks

If this property is changed to a value that isn't valid for the specified mailing label layout, an error occurs.

Example

This example creates a custom label named "VisitorPass" and defines its layout. The left and right margins for each label are 0.75 inch.

VBA Copy code Copy code
Set myLabel = Application.MailingLabel.CustomLabels _
 .Add(Name:="VisitorPass", DotMatrix:=False)
With myLabel
 .Height = InchesToPoints(2.17)
 .HorizontalPitch = InchesToPoints(3.5)
 .NumberAcross = 2
 .NumberDown = 4
 .PageSize = wdCustomLabelLetter
 .SideMargin = InchesToPoints(0.75)
 .TopMargin = InchesToPoints(0.17)
 .VerticalPitch = InchesToPoints(2.17)
 .Width = InchesToPoints(3.5)
End With

See also

Concepts

CustomLabel Object

Other resources

CustomLabel Object Members


CustomLabel.TopMargin Property (Word)

 Copy code hover
[image]

CustomLabel.TopMargin Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the distance (in points) between the top edge of the page and the top boundary of the body text. Read/write Single.

Syntax

expression .TopMargin

expression Required. A variable that represents a CustomLabel object.

Example

This example creates a new custom label and sets several properties, including the top margin, and then it creates a new document using the custom labels.

VBA Copy code Copy code
Set newlbl = Application.MailingLabel. _
 CustomLabels.Add(Name:="My Label")
With newlbl
 .Height = InchesToPoints(1.25)
 .NumberAcross = 2
 .NumberDown = 7
 .PageSize = wdCustomLabelLetter
 .SideMargin = InchesToPoints(0)
 .TopMargin = InchesToPoints(1)
 .Width = InchesToPoints(4.25)
End With
Application.MailingLabel.CreateNewDocument Name:="My Label"

See also

Concepts

CustomLabel Object

Other resources

CustomLabel Object Members


CustomLabel.Valid Property (Word)

 Copy code hover
[image]

CustomLabel.Valid Property (Word)
See also Send feedback

Published: July 16, 2012

True if the various properties (for example, Height, Width, and NumberDown) for the specified custom label work together to produce a valid mailing label. Read-only Boolean.

Syntax

expression .Valid

expression A variable that represents a CustomLabel object.

Example

If the settings for the custom label named "My Labels" are valid, this example creates a new document of labels using the My Labels settings.

VBA Copy code Copy code
addr = "James Allard" & vbCr & "123 Main St." & vbCr _
 & "Seattle, WA 98040"
If Application.MailingLabel.CustomLabels("My Labels") _
 .Valid = True Then Application.MailingLabel.CreateNewDocument _
 Name:="My Labels", Address:=addr
End If

See also

Concepts

CustomLabel Object

Other resources

CustomLabel Object Members


CustomLabel.VerticalPitch Property (Word)

 Copy code hover
[image]

CustomLabel.VerticalPitch Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the vertical distance between the top of one mailing label and the top of the next mailing label. Read/write Single.

Syntax

expression .VerticalPitch

expression An expression that returns a CustomLabel object.

Remarks

If this property is changed to a value that isn't valid for the specified mailing label layout, an error occurs.

Example

This example creates a custom label named "VisitorPass" and defines its layout. The distance between the top edge of one label to the top edge of the next label is 2.17 inches.

VBA Copy code Copy code
Set myLabel = Application.MailingLabel.CustomLabels _
 .Add(Name:="VisitorPass", DotMatrix:=False)
With myLabel
 .Height = InchesToPoints(2.17)
 .HorizontalPitch = InchesToPoints(3.5)
 .NumberAcross = 2
 .NumberDown = 4
 .PageSize = wdCustomLabelLetter
 .SideMargin = InchesToPoints(0.75)
 .TopMargin = InchesToPoints(0.17)
 .VerticalPitch = InchesToPoints(2.17)
 .Width = InchesToPoints(3.5)
End With

See also

Concepts

CustomLabel Object

Other resources

CustomLabel Object Members


CustomLabel.Width Property (Word)

 Copy code hover
[image]

CustomLabel.Width Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the width of a custom mailing label, in points. Read/write Long.

Syntax

expression .Width

expression A variable that represents a CustomLabel object.

See also

Concepts

CustomLabel Object

Other resources

CustomLabel Object Members


CustomLabel Methods (Word)

 Copy code hover
[image]

CustomLabel Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the specified custom label.


CustomLabel.Delete Method (Word)

 Copy code hover
[image]

CustomLabel.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the specified custom label.

Syntax

expression .Delete

expression Required. A variable that represents a CustomLabel object.

See also

Concepts

CustomLabel Object

Other resources

CustomLabel Object Members


CustomLabels Object (Word)

 Copy code hover
[image]

CustomLabels Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of CustomLabel objects available in the Label Options dialog box. This collection includes custom labels of all printer types (dot-matrix, laser, and ink-jet printers).

Remarks

Use the CustomLabels property to return the CustomLabels collection. The following example displays the number of available custom labels.

VBA Copy code Copy code
MsgBox Application.MailingLabel.CustomLabels.Count

Use the Add method to create a custom label. The following example adds a custom mailing label named "My Label" and sets the page size.

VBA Copy code Copy code
Set ML = _
 Application.MailingLabel.CustomLabels.Add(Name:="My Labels", _
 DotMatrix:=False)
ML.PageSize = wdCustomLabelA4

Use CustomLabels(Index), where Index is the custom label name or index number, to return a single CustomLabel object. The following example creates a new document with an existing custom label layout named "My Labels."

VBA Copy code Copy code
Set ML = Application.MailingLabel
If ML.CustomLabels("My Labels").Valid = True Then
 ML.CreateNewDocument Name:="My Labels"
Else
 MsgBox "The My Labels custom label is not available"
End If

The index number represents the position of the custom mailing label in the CustomLabels collection. The following example displays the name of the first custom mailing label.

VBA Copy code Copy code
If Application.MailingLabel.CustomLabels.Count >= 1 Then
 MsgBox Application.MailingLabel.CustomLabels(1).Name
End If

See also

Concepts

Word Object Model Reference

Other resources

CustomLabels Object Members


CustomLabels Members (Word)

 Copy code hover
[image]

CustomLabels Members (Word)
Send feedback

Published: July 16, 2012

A collection of CustomLabel objects available in the Label Options dialog box. This collection includes custom labels of all printer types (dot-matrix, laser, and ink-jet printers).

Methods

Name | Description
Add | Adds a custom mailing label to the CustomLabels collection. Returns a CustomLabel object that represents the custom mailing label.
Item | Returns a CustomLabel object in a collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of items in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified CustomLabels object.


CustomLabels Properties (Word)

 Copy code hover
[image]

CustomLabels Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of items in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified CustomLabels object.


CustomLabels.Application Property (Word)

 Copy code hover
[image]

CustomLabels.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a CustomLabels collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

CustomLabels Collection Object

Other resources

CustomLabels Object Members


CustomLabels.Count Property (Word)

 Copy code hover
[image]

CustomLabels.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of items in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents a CustomLabels collection.

See also

Concepts

CustomLabels Collection Object

Other resources

CustomLabels Object Members


CustomLabels.Creator Property (Word)

 Copy code hover
[image]

CustomLabels.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a CustomLabels collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

CustomLabels Collection Object

Other resources

CustomLabels Object Members


CustomLabels.Parent Property (Word)

 Copy code hover
[image]

CustomLabels.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified CustomLabels object.

Syntax

expression .Parent

expression Required. A variable that represents a CustomLabels collection.

See also

Concepts

CustomLabels Collection Object

Other resources

CustomLabels Object Members


CustomLabels Methods (Word)

 Copy code hover
[image]

CustomLabels Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Adds a custom mailing label to the CustomLabels collection. Returns a CustomLabel object that represents the custom mailing label.
Item | Returns a CustomLabel object in a collection.


CustomLabels.Add Method (Word)

 Copy code hover
[image]

CustomLabels.Add Method (Word)
See also Send feedback

Published: July 16, 2012

Adds a custom mailing label to the CustomLabels collection. Returns a CustomLabel object that represents the custom mailing label.

Syntax

expression .Add(Name, DotMatrix)

expression Required. A variable that represents a CustomLabels collection.

Parameters

Name | Required/Optional | Data Type | Description
Name | Required | String | The name for the custom mailing labels.
DotMatrix | Optional | Variant | True to have the mailing labels printed on a dot-matrix printer.

Return Value

CustomLabel

Example

This example adds a custom mailing label named Return Address, sets the page size, and then creates a page of these labels.

VBA Copy code Copy code
Sub ReturnAddrLabel()
 Dim ml As CustomLabel
 Dim addr As String

 Set ml = Application.MailingLabel.CustomLabels _
 .Add(Name:="Return Address", DotMatrix:=False)
 ml.PageSize = wdCustomLabelLetter
 addr = "Dave Edson" & vbCr & "123 Skye St." & vbCr _
 & "Our Town, WA 98004"
 Application.MailingLabel.CreateNewDocument _
 Name:="Return Address", Address:=addr, ExtractAddress:=False
End Sub

See also

Concepts

CustomLabels Collection Object

Other resources

CustomLabels Object Members


CustomLabels.Item Method (Word)

 Copy code hover
[image]

CustomLabels.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a CustomLabel object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents a CustomLabels collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The individual object to be returned. Can be a Long indicating the ordinal position or a String representing the name of the individual object.

Return Value

CustomLabel

See also

Concepts

CustomLabels Collection Object

Other resources

CustomLabels Object Members


CustomProperties Object (Word)

 Copy code hover
[image]

CustomProperties Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of CustomProperty objects that represents the properties related to a smart tag. The CustomProperties collection includes all the smart tag custom properties in a document.

Remarks

Use the Properties property to return a single CustomProperties object. Use the Add method of the CustomProperties object with to create a custom property from within a Microsoft Word Visual Basic for Applications project. This example creates a new property for the first smart tag in the active document and displays the XML code used for the tag.

VBA Copy code Copy code
Sub AddProps()
 With ActiveDocument.SmartTags(1)
 .Properties.Add Name:="President", Value:=True
 MsgBox "The XML code is " & .XML
 End With
End Sub

Use Properties(Index) to return a single property for a smart tag, where Index is the number of the property. This example displays the name and value of the first property of the first smart tag in the current document.

VBA Copy code Copy code
Sub ReturnProps()
 With ActiveDocument.SmartTags(1).Properties(1)
 MsgBox "The Smart Tag name is: " & .Name & vbLf & .Value
 End With
End Sub

Use the Count property to return the number of custom properties for a smart tag. This example loops through all the smart tags in the current document and then lists in a new document the name and value of the custom properties for all smart tags that have custom properties.

VBA Copy code Copy code
Sub SmartTagsProps()
 Dim docNew As Document
 Dim stgTag As SmartTag
 Dim stgProp As CustomProperty
 Dim intTag As Integer
 Dim intProp As Integer

 Set docNew = Documents.Add

 'Create heading info in new document
 With docNew.Content
 .InsertAfter "Name" & vbTab & "Value"
 .InsertParagraphAfter
 End With

 'Loop through smart tags in current document
 For intTag = 1 To ActiveDocument.SmartTags.Count

 With ActiveDocument.SmartTags(intTag)

 'Verify that the custom properties
 'for smart tags is greater than zero
 If .Properties.Count > 0 Then

 'Loop through the custom properties
 For intProp = 1 To .Properties.Count

 'Add custom property name to new document
 docNew.Content.InsertAfter .Properties(intProp) _
 .Name & vbTab & .Properties(intProp).Value
 docNew.Content.InsertParagraphAfter
 Next
 Else

 'Display message if there are no custom properties
 MsgBox "There are no custom properties for the " & _
 "smart tags in your document."
 End If
 End With
 Next

 'Convert the content in the new document into a table
 docNew.Content.Select
 Selection.ConvertToTable Separator:=wdSeparateByTabs, NumColumns:=2

End Sub

See also

Concepts

Word Object Model Reference

Other resources

CustomProperties Object Members


CustomProperties Members (Word)

 Copy code hover
[image]

CustomProperties Members (Word)
Send feedback

Published: July 16, 2012

A collection of CustomProperty objects that represents the properties related to a smart tag. The CustomProperties collection includes all the smart tag custom properties in a document.

Methods

Name | Description
Add | Returns a CustomProperty object that represents s custom property added to a smart tag.
Item | Returns a CustomProperty object in a collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of items in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified CustomProperties object.


CustomProperties Properties (Word)

 Copy code hover
[image]

CustomProperties Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of items in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified CustomProperties object.


CustomProperties.Application Property (Word)

 Copy code hover
[image]

CustomProperties.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a CustomProperties collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

CustomProperties Collection

Other resources

CustomProperties Object Members


CustomProperties.Count Property (Word)

 Copy code hover
[image]

CustomProperties.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of items in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents a CustomProperties collection.

See also

Concepts

CustomProperties Collection

Other resources

CustomProperties Object Members


CustomProperties.Creator Property (Word)

 Copy code hover
[image]

CustomProperties.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a CustomProperties collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

CustomProperties Collection

Other resources

CustomProperties Object Members


CustomProperties.Parent Property (Word)

 Copy code hover
[image]

CustomProperties.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified CustomProperties object.

Syntax

expression .Parent

expression Required. A variable that represents a CustomProperties collection.

See also

Concepts

CustomProperties Collection

Other resources

CustomProperties Object Members


CustomProperties Methods (Word)

 Copy code hover
[image]

CustomProperties Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Returns a CustomProperty object that represents s custom property added to a smart tag.
Item | Returns a CustomProperty object in a collection.


CustomProperties.Add Method (Word)

 Copy code hover
[image]

CustomProperties.Add Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a CustomProperty object that represents s custom property added to a smart tag.

Syntax

expression .Add(Name, Value)

expression Required. A variable that represents a CustomProperties collection.

Parameters

Name | Required/Optional | Data Type | Description
Name | Required | String | The name of the custom smart tag property.
Value | Required | String | The value of the custom smart tag property

Return Value

CustomProperty

See also

Concepts

CustomProperties Collection

Other resources

CustomProperties Object Members


CustomProperties.Item Method (Word)

 Copy code hover
[image]

CustomProperties.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a CustomProperty object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents a CustomProperties collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The individual object to be returned. Can be a Long indicating the ordinal position or a String representing the name of the individual object.

Return Value

CustomProperty

See also

Concepts

CustomProperties Collection

Other resources

CustomProperties Object Members


CustomProperty Object (Word)

 Copy code hover
[image]

CustomProperty Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a single instance of a custom property for a smart tag. The CustomProperty object is a member of the CustomProperties collection.

Remarks

Use the Item method—or Properties(Index), where Index is the number of the property—of the CustomProperties collection to return a CustomProperty object.

Use the Name and Value properties to return the information related to a custom property for a smart tag. This example displays a message containing the name and value of the first custom property of the first smart tag in the current document. This example assumes that the current document contains at least one smart tag and that the first smart tag has at least one custom property.

VBA Copy code Copy code
Sub SmartTagsProps()
 With ActiveDocument.SmartTags(Index:=1).Properties.Item(Index:=1)
 MsgBox "Smart Tag Name: " & .Name & vbLf & _
 "Smart Tag Value: " & .Value
 End With
End Sub

See also

Concepts

Word Object Model Reference

Other resources

CustomProperty Object Members


CustomProperty Members (Word)

 Copy code hover
[image]

CustomProperty Members (Word)
Send feedback

Published: July 16, 2012

Represents a single instance of a custom property for a smart tag. The CustomProperty object is a member of the CustomProperties collection.

Methods

Name | Description
Delete | Deletes the specified custom property.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Name | Returns the name of the specified object. Read-only String.
Parent | Returns an Object that represents the parent object of the specified CustomProperty object.
Value | Returns or sets the value of a custom property. Read/write String.


CustomProperty Properties (Word)

 Copy code hover
[image]

CustomProperty Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Name | Returns the name of the specified object. Read-only String.
Parent | Returns an Object that represents the parent object of the specified CustomProperty object.
Value | Returns or sets the value of a custom property. Read/write String.


CustomProperty.Application Property (Word)

 Copy code hover
[image]

CustomProperty.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a CustomProperty object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

CustomProperty Object

Other resources

CustomProperty Object Members


CustomProperty.Creator Property (Word)

 Copy code hover
[image]

CustomProperty.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a CustomProperty object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

CustomProperty Object

Other resources

CustomProperty Object Members


CustomProperty.Name Property (Word)

 Copy code hover
[image]

CustomProperty.Name Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the name of the specified object. Read-only String.

Syntax

expression .Name

expression Required. A variable that represents a CustomProperty object.

See also

Concepts

CustomProperty Object

Other resources

CustomProperty Object Members


CustomProperty.Parent Property (Word)

 Copy code hover
[image]

CustomProperty.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified CustomProperty object.

Syntax

expression .Parent

expression Required. A variable that represents a CustomProperty object.

See also

Concepts

CustomProperty Object

Other resources

CustomProperty Object Members


CustomProperty.Value Property (Word)

 Copy code hover
[image]

CustomProperty.Value Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the value of a custom property. Read/write String.

Syntax

expression .Value

expression Required. A variable that represents a CustomProperty object.

See also

Concepts

CustomProperty Object

Other resources

CustomProperty Object Members


CustomProperty Methods (Word)

 Copy code hover
[image]

CustomProperty Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the specified custom property.


CustomProperty.Delete Method (Word)

 Copy code hover
[image]

CustomProperty.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the specified custom property.

Syntax

expression .Delete

expression Required. A variable that represents a CustomProperty object.

See also

Concepts

CustomProperty Object

Other resources

CustomProperty Object Members


DataLabel Object (Word)

 Copy code hover
[image]

DataLabel Object (Word)
See also Send feedback

Published: July 16, 2012

Represents the data label on a chart point or trendline.

Version Information

Version Added: Word 2007

Remarks

On a series, the DataLabel object is a member of the DataLabels collection. The DataLabels collection contains a DataLabel object for each point. For a series without definable points (such as an area series), the DataLabels collection contains a single DataLabel object.

Example

Use DataLabels(Index), where Index is the data label index number, to return a single DataLabel object. The following example sets the number format for the fifth data label in the first series of the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.SeriesCollection(1).DataLabels(5).NumberFormat = "0.000"
 End If
End With

Use the Point.DataLabel property to return the DataLabel object for a single point. The following example turns on the data label for the second point in the first series of the first chart in the active document and sets the data label text to "Saturday."

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.SeriesCollection(1).Points(2)
 .HasDataLabel = True
 .DataLabel.Text = "Saturday"
 End With
 End If
End With

On a trendline, the Trendline.DataLabel property returns the text shown with the trendline. This can be the equation, the R-squared value, or both (if both are showing). The following example sets the trendline text for the first trendline in the first series of the first chart in the active document to show only the equation.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.SeriesCollection(1).Trendlines(1)
 .DisplayRSquared = False
 .DisplayEquation = True
 End With
 End If
End With

See also

Concepts

Word Object Model Reference

Other resources

DataLabel Object Members


DataLabel Members (Word)

 Copy code hover
[image]

DataLabel Members (Word)
Send feedback

Published: July 16, 2012

Represents the data label on a chart point or trendline.

Methods

Name | Description
Delete | Deletes the object.
Select | Selects the object.

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
AutoText | True if the object automatically generates appropriate text based on context. Read/write Boolean.
Caption | Returns or sets the data label text. Read/write String.
Characters | Returns a ChartCharacters object that represents a range of characters within the object text. You can use the ChartCharacters object to format characters within a text string.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Format | Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.
Formula | Gets or sets a String value that represents the formula of the object using A1-style notation, in English. Read/write.
FormulaLocal | Returns or sets the formula for the object, using A1-style references in the language of the user. Read/write String.
FormulaR1C1 | Returns or sets the formula for the object, using R1C1-style notation in the language of the macro. Read/write.
FormulaR1C1Local | Returns or sets the formula for the object, using R1C1-style notation in the language of the user. Read/write String.
Height | Gets or sets the height, in points, of the object. Read/write Double.
HorizontalAlignment | Returns or sets the horizontal alignment for the specified object. Read/write Variant.
Left | Returns or sets the distance, in points, from the left edge of the object to the left edge of the chart area. Read/write Double.
Name | Returns the name of the object. Read-only String.
NumberFormat | Returns or sets the format code for the object. Read/write String.
NumberFormatLinked | True if the number format is linked to the cells (so that the number format changes in the labels when it changes in the cells). Read/write Boolean.
NumberFormatLocal | Returns or sets the format code for the object as a string in the language of the user. Read/write Variant.
Orientation | Returns or sets the text orientation. Read/write Long.
Parent | Returns the parent for the specified object. Read-only Object.
Position | Returns or sets the position of the data label. Read/write XlDataLabelPosition.
ReadingOrder | Returns or sets an XlReadingOrder constant that represents the reading order for the specified object. Read/write Long.
Separator | Returns or sets the separator used for the data labels on a chart. Read/write Variant.
Shadow | Returns or sets a value that indicates whether the object has a shadow. Read/write Boolean.
ShowBubbleSize | True to show the bubble size for the data labels on a chart. False to hide the bubble size. Read/write Boolean.
ShowCategoryName | True to display the category name for the data labels on a chart. False to hide the category name. Read/write Boolean.
ShowLegendKey | True if the data label legend key is visible. Read/write Boolean.
ShowPercentage | True to display the percentage value for the data labels on a chart. False to hide the value. Read/write Boolean.
ShowRange | Set to True to display the Value From Cells range field for the specified chart data label. Set to False to hide that field. Read/write Boolean.
ShowSeriesName | True to show the series name for the data labels on a chart. False to hide the series name. Read/write Boolean.
ShowValue | True to display a specified chart's data label values. False to hide the values. Read/write Boolean.
Text | Returns or sets the text for the specified object. Read/write String.
Top | Returns or sets the distance, in points, from the top edge of the object to the top of the first row (on a worksheet) or the top of the chart area (on a chart). Read/write Double.
VerticalAlignment | Returns or sets the vertical alignment of the specified object. Read/write Variant.
Width | Gets or sets the width, in points, of the object. Read/write Double.


DataLabel Properties (Word)

 Copy code hover
[image]

DataLabel Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
AutoText | True if the object automatically generates appropriate text based on context. Read/write Boolean.
Caption | Returns or sets the data label text. Read/write String.
Characters | Returns a ChartCharacters object that represents a range of characters within the object text. You can use the ChartCharacters object to format characters within a text string.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Format | Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.
Formula | Gets or sets a String value that represents the formula of the object using A1-style notation, in English. Read/write.
FormulaLocal | Returns or sets the formula for the object, using A1-style references in the language of the user. Read/write String.
FormulaR1C1 | Returns or sets the formula for the object, using R1C1-style notation in the language of the macro. Read/write.
FormulaR1C1Local | Returns or sets the formula for the object, using R1C1-style notation in the language of the user. Read/write String.
Height | Gets or sets the height, in points, of the object. Read/write Double.
HorizontalAlignment | Returns or sets the horizontal alignment for the specified object. Read/write Variant.
Left | Returns or sets the distance, in points, from the left edge of the object to the left edge of the chart area. Read/write Double.
Name | Returns the name of the object. Read-only String.
NumberFormat | Returns or sets the format code for the object. Read/write String.
NumberFormatLinked | True if the number format is linked to the cells (so that the number format changes in the labels when it changes in the cells). Read/write Boolean.
NumberFormatLocal | Returns or sets the format code for the object as a string in the language of the user. Read/write Variant.
Orientation | Returns or sets the text orientation. Read/write Long.
Parent | Returns the parent for the specified object. Read-only Object.
Position | Returns or sets the position of the data label. Read/write XlDataLabelPosition.
ReadingOrder | Returns or sets an XlReadingOrder constant that represents the reading order for the specified object. Read/write Long.
Separator | Returns or sets the separator used for the data labels on a chart. Read/write Variant.
Shadow | Returns or sets a value that indicates whether the object has a shadow. Read/write Boolean.
ShowBubbleSize | True to show the bubble size for the data labels on a chart. False to hide the bubble size. Read/write Boolean.
ShowCategoryName | True to display the category name for the data labels on a chart. False to hide the category name. Read/write Boolean.
ShowLegendKey | True if the data label legend key is visible. Read/write Boolean.
ShowPercentage | True to display the percentage value for the data labels on a chart. False to hide the value. Read/write Boolean.
ShowRange | Set to True to display the Value From Cells range field for the specified chart data label. Set to False to hide that field. Read/write Boolean.
ShowSeriesName | True to show the series name for the data labels on a chart. False to hide the series name. Read/write Boolean.
ShowValue | True to display a specified chart's data label values. False to hide the values. Read/write Boolean.
Text | Returns or sets the text for the specified object. Read/write String.
Top | Returns or sets the distance, in points, from the top edge of the object to the top of the first row (on a worksheet) or the top of the chart area (on a chart). Read/write Double.
VerticalAlignment | Returns or sets the vertical alignment of the specified object. Read/write Variant.
Width | Gets or sets the width, in points, of the object. Read/write Double.


DataLabel.Application Property (Word)

 Copy code hover
[image]

DataLabel.Application Property (Word)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Application

expression A variable that represents a DataLabel object.

Example

The following example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveDocument
If myObject.Application.Value = "Microsoft Word" Then
 MsgBox "This is a Word Application object."
Else
 MsgBox "This is not a Word Application object."
End If

See also

Concepts

DataLabel Object

Other resources

DataLabel Object Members


DataLabel.AutoText Property (Word)

 Copy code hover
[image]

DataLabel.AutoText Property (Word)
See also Send feedback

Published: July 16, 2012

True if the object automatically generates appropriate text based on context. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .AutoText

expression A variable that represents a DataLabel object.

Example

The following example sets the data labels for series one of the first chart in the active document to automatically generate appropriate text.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.SeriesCollection(1). _
 DataLabels.AutoText = True
 End If
End With

See also

Concepts

DataLabel Object

Other resources

DataLabel Object Members


DataLabel.Caption Property (Word)

 Copy code hover
[image]

DataLabel.Caption Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the data label text. Read/write String.

Version Information

Version Added: Word 2007

Syntax

expression .Caption

expression A variable that represents a DataLabel object.

See also

Concepts

DataLabel Object

Other resources

DataLabel Object Members


DataLabel.Characters Property (Word)

 Copy code hover
[image]

DataLabel.Characters Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a ChartCharacters object that represents a range of characters within the object text. You can use the ChartCharacters object to format characters within a text string.

Version Information

Version Added: Word 2007

Syntax

expression .Characters(Start, Length)

expression A variable that represents a DataLabel object.

Parameters

Name | Required/Optional | Data Type | Description
Start | Optional | Variant | The first character to be returned. If this argument is either 1 or omitted, this property returns a range of characters starting with the first character.
Length | Optional | Variant | The number of characters to be returned. If this argument is omitted, this property returns the remainder of the string (everything after the Start character).

Remarks

The ChartCharacters object is not a collection.

See also

Concepts

DataLabel Object

Other resources

DataLabel Object Members


DataLabel.Creator Property (Word)

 Copy code hover
[image]

DataLabel.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version Information

Version Added: Word 2007

Syntax

expression .Creator

expression A variable that represents a DataLabel object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD". This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Word has the creator code MSWD. For more information about this property, consult the language reference Help included with Microsoft Office for Mac.

See also

Concepts

DataLabel Object

Other resources

DataLabel Object Members


DataLabel.Format Property (Word)

 Copy code hover
[image]

DataLabel.Format Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.

Version Information

Version Added: Word 2007

Syntax

expression .Format

expression A variable that represents a DataLabel object.

See also

Concepts

DataLabel Object

Other resources

DataLabel Object Members


DataLabel.Formula Property (Word)

 Copy code hover
[image]

DataLabel.Formula Property (Word)
See also Send feedback

Published: July 16, 2012

Gets or sets a String value that represents the formula of the object using A1-style notation, in English. Read/write.

Version Information

Version Added: Word 2010

Syntax

expression .Formula

expression A variable that represents a DataLabel object.

Return Value

String

Remarks

For more information about A1-style notation, seeHow to: Refer to Cells and Ranges by Using A1 Notation.

See also

Concepts

DataLabel Object

Other resources

DataLabel Object Members


DataLabel.FormulaLocal Property (Word)

 Copy code hover
[image]

DataLabel.FormulaLocal Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the formula for the object, using A1-style references in the language of the user. Read/write String.

Version Information

Version Added: Word 2010

Syntax

expression .FormulaLocal

expression A variable that represents a DataLabel object.

Remarks

If the cell contains a constant, this property returns that constant. If the cell is empty, the property returns an empty string. If the cell contains a formula, the property returns the formula as a string, in the same format in which it would be displayed in the formula bar (including the equal sign (=)).

If you set the value or formula of a cell to a date, Microsoft Excel verifies that the cell is already formatted with one of the date or time number formats. If not, the number format is changed to the default short date number format.

If the range is a one- or two-dimensional range, you can set the formula to a Visual Basic array of the same dimensions. Similarly, you can put the formula into a Visual Basic array.

Setting the formula of a multiple-cell range fills all cells in the range with the formula.

See also

Concepts

DataLabel Object

Other resources

DataLabel Object Members


DataLabel.FormulaR1C1 Property (Word)

 Copy code hover
[image]

DataLabel.FormulaR1C1 Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the formula for the object, using R1C1-style notation in the language of the macro. Read/write.

Version Information

Version Added: Word 2010

Syntax

expression .FormulaR1C1

expression A variable that represents a DataLabel object.

Return Value

String

See also

Concepts

DataLabel Object

Other resources

DataLabel Object Members


DataLabel.FormulaR1C1Local Property (Word)

 Copy code hover
[image]

DataLabel.FormulaR1C1Local Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the formula for the object, using R1C1-style notation in the language of the user. Read/write String.

Version Information

Version Added: Word 2010

Syntax

expression .FormulaR1C1Local

expression A variable that represents a DataLabel object.

See also

Concepts

DataLabel Object

Other resources

DataLabel Object Members


DataLabel.Height Property (Word)

 Copy code hover
[image]

DataLabel.Height Property (Word)
See also Send feedback

Published: July 16, 2012

Gets or sets the height, in points, of the object. Read/write Double.

Version Information

Version Added: Word 2010

Syntax

expression .Height

expression A variable that represents a DataLabel object.

Return Value

Double

See also

Concepts

DataLabel Object

Other resources

DataLabel Object Members


DataLabel.HorizontalAlignment Property (Word)

 Copy code hover
[image]

DataLabel.HorizontalAlignment Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the horizontal alignment for the specified object. Read/write Variant.

Version Information

Version Added: Word 2007

Syntax

expression .HorizontalAlignment

expression A variable that represents a DataLabel object.

Remarks

You can set the value of this property to one of the following XlConstants constants:

  • xlCenter

  • xlDistributed

  • xlJustify

  • xlLeft

  • xlRight

Some of these constants may not be available to you, depending on the language support (for example, U.S. English) that you have selected ohttp:r installed.

See also

Concepts

DataLabel Object

Other resources

DataLabel Object Members


DataLabel.Left Property (Word)

 Copy code hover
[image]

DataLabel.Left Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the distance, in points, from the left edge of the object to the left edge of the chart area. Read/write Double.

Version Information

Version Added: Word 2007

Syntax

expression .Left

expression A variable that represents a DataLabel object.

See also

Concepts

DataLabel Object

Other resources

DataLabel Object Members


DataLabel.Name Property (Word)

 Copy code hover
[image]

DataLabel.Name Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the name of the object. Read-only String.

Version Information

Version Added: Word 2007

Syntax

expression .Name

expression A variable that represents a DataLabel object.

See also

Concepts

DataLabel Object

Other resources

DataLabel Object Members


DataLabel.NumberFormat Property (Word)

 Copy code hover
[image]

DataLabel.NumberFormat Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the format code for the object. Read/write String.

Version Information

Version Added: Word 2007

Syntax

expression .NumberFormat

expression A variable that represents a DataLabel object.

Remarks

The format code is the same string as the Format Codes option in the Format Cells dialog box. The Format function uses different format code strings than do the NumberFormat and NumberFormatLocal properties.

See also

Concepts

DataLabel Object

Other resources

DataLabel Object Members


DataLabel.NumberFormatLinked Property (Word)

 Copy code hover
[image]

DataLabel.NumberFormatLinked Property (Word)
See also Send feedback

Published: July 16, 2012

True if the number format is linked to the cells (so that the number format changes in the labels when it changes in the cells). Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .NumberFormatLinked

expression A variable that represents a DataLabel object.

See also

Concepts

DataLabel Object

Other resources

DataLabel Object Members


DataLabel.NumberFormatLocal Property (Word)

 Copy code hover
[image]

DataLabel.NumberFormatLocal Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the format code for the object as a string in the language of the user. Read/write Variant.

Version Information

Version Added: Word 2007

Syntax

expression .NumberFormatLocal

expression A variable that represents a DataLabel object.

Remarks

The Format function uses different format code strings than do the NumberFormat and NumberFormatLocal properties.

See also

Concepts

DataLabel Object

Other resources

DataLabel Object Members


DataLabel.Orientation Property (Word)

 Copy code hover
[image]

DataLabel.Orientation Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the text orientation. Read/write Long.

Version Information

Version Added: Word 2007

Syntax

expression .Orientation

expression A variable that represents a DataLabel object.

Remarks

The value of this property can be an integer from -90 through 90 degrees or one of the XlOrientation constants.

See also

Concepts

DataLabel Object

Other resources

DataLabel Object Members


DataLabel.Parent Property (Word)

 Copy code hover
[image]

DataLabel.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the parent for the specified object. Read-only Object.

Version Information

Version Added: Word 2007

Syntax

expression .Parent

expression A variable that represents a DataLabel object.

See also

Concepts

DataLabel Object

Other resources

DataLabel Object Members


DataLabel.Position Property (Word)

 Copy code hover
[image]

DataLabel.Position Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the position of the data label. Read/write XlDataLabelPosition.

Version Information

Version Added: Word 2007

Syntax

expression .Position

expression A variable that represents a DataLabel object.

See also

Concepts

DataLabel Object

Other resources

DataLabel Object Members


DataLabel.ReadingOrder Property (Word)

 Copy code hover
[image]

DataLabel.ReadingOrder Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets an XlReadingOrder constant that represents the reading order for the specified object. Read/write Long.

Version Information

Version Added: Word 2007

Syntax

expression .ReadingOrder

expression A variable that represents a DataLabel object.

See also

Concepts

DataLabel Object

Other resources

DataLabel Object Members


DataLabel.Separator Property (Word)

 Copy code hover
[image]

DataLabel.Separator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the separator used for the data labels on a chart. Read/write Variant.

Version Information

Version Added: Word 2007

Syntax

expression .Separator

expression A variable that represents a DataLabel object.

Remarks

If you use a string, you will get a string as the separator. If you use xlDataLabelSeparatorDefault (= 1), you will get the default data label separator, which is either a comma or a newline character, depending on the data label.

Example

The following example sets the data label separator for the first series on the first chart in the active document to a semicolon.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.SeriesCollection(1). _
 DataLabels.Separator = ";"
 End If
End With

See also

Concepts

DataLabel Object

Other resources

DataLabel Object Members


DataLabel.Shadow Property (Word)

 Copy code hover
[image]

DataLabel.Shadow Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a value that indicates whether the object has a shadow. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .Shadow

expression A variable that represents a DataLabel object.

See also

Concepts

DataLabel Object

Other resources

DataLabel Object Members


DataLabel.ShowBubbleSize Property (Word)

 Copy code hover
[image]

DataLabel.ShowBubbleSize Property (Word)
See also Send feedback

Published: July 16, 2012

True to show the bubble size for the data labels on a chart. False to hide the bubble size. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .ShowBubbleSize

expression A variable that represents a DataLabel object.

Example

The following example shows the bubble size for the data labels of the first series on the first chart.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.SeriesCollection(1).DataLabels. _
 ShowBubbleSize = True
 End If
End With

See also

Concepts

DataLabel Object

Other resources

DataLabel Object Members


DataLabel.ShowCategoryName Property (Word)

 Copy code hover
[image]

DataLabel.ShowCategoryName Property (Word)
See also Send feedback

Published: July 16, 2012

True to display the category name for the data labels on a chart. False to hide the category name. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .ShowCategoryName

expression A variable that represents a DataLabel object.

Example

The following example shows the category name for the data labels of the first series on the first chart.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
    If .HasChart Then
        .Chart.SeriesCollection(1).DataLabels. _
            ShowCategoryName = True
    End If
End With

See also

Concepts

DataLabel Object

Other resources

DataLabel Object Members


DataLabel.ShowLegendKey Property (Word)

 Copy code hover
[image]

DataLabel.ShowLegendKey Property (Word)
See also Send feedback

Published: July 16, 2012

True if the data label legend key is visible. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .ShowLegendKey

expression A variable that represents a DataLabel object.

Example

The following example sets the data labels for series one of the first chart in the active document to show values and the legend key.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.SeriesCollection(1).DataLabels. _
 ShowLegendKey = True
 .Chart.SeriesCollection(1).DataLabels.Type = xlShowValue
 End If
End With

See also

Concepts

DataLabel Object

Other resources

DataLabel Object Members


DataLabel.ShowPercentage Property (Word)

 Copy code hover
[image]

DataLabel.ShowPercentage Property (Word)
See also Send feedback

Published: July 16, 2012

True to display the percentage value for the data labels on a chart. False to hide the value. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .ShowPercentage

expression A variable that represents a DataLabel object.

Example

The following example enables the percentage value to be shown for the data labels of the first series on the first chart.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.SeriesCollection(1).DataLabels. _
 ShowPercentage = True
 End If
End With

See also

Concepts

DataLabel Object

Other resources

DataLabel Object Members


DataLabel.ShowRange Property (Word)

 Copy code hover
[image]

DataLabel.ShowRange Property (Word)
See also Send feedback

Published: July 16, 2012

Set to True to display the Value From Cells range field for the specified chart data label. Set to False to hide that field. Read/write Boolean.

Version information

Version Added: Word 2013

Syntax

expression .ShowRange

expression A variable that represents a DataLabel object.

Example

The following example displays the Value From Cells range field for the first data label of the first series on the first chart.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.SeriesCollection(1).DataLabels(1).ShowRange = True
 End If
End With

Property value

BOOL

See also

Concepts

DataLabel Object

Other resources

DataLabel Object Members


DataLabel.ShowSeriesName Property (Word)

 Copy code hover
[image]

DataLabel.ShowSeriesName Property (Word)
See also Send feedback

Published: July 16, 2012

True to show the series name for the data labels on a chart. False to hide the series name. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .ShowSeriesName

expression A variable that represents a DataLabel object.

Example

The following example enables the series name to be shown for the data labels of the first series on the first chart.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.SeriesCollection(1).DataLabels. _
 ShowSeriesName = True
 End If
End With

See also

Concepts

DataLabel Object

Other resources

DataLabel Object Members


DataLabel.ShowValue Property (Word)

 Copy code hover
[image]

DataLabel.ShowValue Property (Word)
See also Send feedback

Published: July 16, 2012

True to display a specified chart's data label values. False to hide the values. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .ShowValue

expression A variable that represents a DataLabel object.

Example

The following example enables the value to be shown for the data labels of the first series in the first chart.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.SeriesCollection(1).DataLabels. _
 ShowValue = True
 End If
End With

See also

Concepts

DataLabel Object

Other resources

DataLabel Object Members


DataLabel.Text Property (Word)

 Copy code hover
[image]

DataLabel.Text Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the text for the specified object. Read/write String.

Version Information

Version Added: Word 2007

Syntax

expression .Text

expression A variable that represents a DataLabel object.

See also

Concepts

DataLabel Object

Other resources

DataLabel Object Members


DataLabel.Top Property (Word)

 Copy code hover
[image]

DataLabel.Top Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the distance, in points, from the top edge of the object to the top of the first row (on a worksheet) or the top of the chart area (on a chart). Read/write Double.

Version Information

Version Added: Word 2007

Syntax

expression .Top

expression A variable that represents a DataLabel object.

See also

Concepts

DataLabel Object

Other resources

DataLabel Object Members


DataLabel.VerticalAlignment Property (Word)

 Copy code hover
[image]

DataLabel.VerticalAlignment Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the vertical alignment of the specified object. Read/write Variant.

Version Information

Version Added: Word 2007

Syntax

expression .VerticalAlignment

expression A variable that represents a DataLabel object.

Remarks

You can set the value of this property to one of the following XlConstants constants:

  • xlBottom

  • xlCenter

  • xlDistributed

  • xlJustify

  • xlTop

See also

Concepts

DataLabel Object

Other resources

DataLabel Object Members


DataLabel.Width Property (Word)

 Copy code hover
[image]

DataLabel.Width Property (Word)
See also Send feedback

Published: July 16, 2012

Gets or sets the width, in points, of the object. Read/write Double.

Version Information

Version Added: Word 2010

Syntax

expression .Width

expression A variable that represents a DataLabel object.

See also

Concepts

DataLabel Object

Other resources

DataLabel Object Members


DataLabel Methods (Word)

 Copy code hover
[image]

DataLabel Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the object.
Select | Selects the object.


DataLabel.Delete Method (Word)

 Copy code hover
[image]

DataLabel.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Version Information

Version Added: Word 2007

Syntax

expression .Delete

expression A variable that represents a DataLabel object.

See also

Concepts

DataLabel Object

Other resources

DataLabel Object Members


DataLabel.Select Method (Word)

 Copy code hover
[image]

DataLabel.Select Method (Word)
See also Send feedback

Published: July 16, 2012

Selects the object.

Version Information

Version Added: Word 2007

Syntax

expression .Select

expression A variable that represents a DataLabel object.

See also

Concepts

DataLabel Object

Other resources

DataLabel Object Members


DataLabels Object (Word)

 Copy code hover
[image]

DataLabels Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of all the DataLabel objects for the specified series.

Version Information

Version Added: Word 2007

Remarks

Each DataLabel object represents a data label for a point or trendline. For a series without definable points (such as an area series), the DataLabels collection contains a single data label.

Example

Use the DataLabels method to return the DataLabels collection. The following example sets the number format for data labels on the first series of the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With Chart.SeriesCollection(1)
 .HasDataLabels = True
 .DataLabels.NumberFormat = "##.##"
 End With
 End If
End With

Use DataLabels(Index), where Index is the data label index number, to return a single DataLabel object. The following example sets the number format for the fifth data label in the first series of the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With Chart.SeriesCollection(1).DataLabels(5)
 .NumberFormat = "0.000"
 End With
 End If
End With

See also

Concepts

Word Object Model Reference

Other resources

DataLabels Object Members


DataLabels Members (Word)

 Copy code hover
[image]

DataLabels Members (Word)
Send feedback

Published: July 16, 2012

A collection of all the DataLabel objects for the specified series.

Methods

Name | Description
Delete | Deletes the object.
Item | Returns a single object from a collection.
Propagate | Propagates the contents and formatting of the specified data label to all the other data labels in the series.
Select | Selects the object.

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
AutoText | True if all objects in the collection automatically generate appropriate text based on context. Read/write Boolean.
Count | Returns the number of objects in the collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Format | Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.
HorizontalAlignment | Returns or sets the horizontal alignment for the specified object. Read/write Variant.
Name | Returns the name of the object. Read-only String.
NumberFormat | Returns or sets the format code for the object. Read/write String.
NumberFormatLinked | True if the number format is linked to the cells (so that the number format changes in the labels when it changes in the cells). Read/write Boolean.
NumberFormatLocal | Returns or sets the format code for the object as a string in the language of the user. Read/write Variant.
Orientation | Returns or sets the text orientation. Read/write Long.
Parent | Returns the parent for the specified object. Read-only Object.
Position | Returns or sets the position of the data labels. Read/write XlDataLabelPosition.
ReadingOrder | Returns or sets an XlReadingOrder constant that represents the reading order for the specified object. Read/write Long.
Separator | Sets or returns the separator for the data labels on a chart. Read/write Variant.
Shadow | Returns or sets a value that indicates whether the object has a shadow. Read/write Boolean.
ShowBubbleSize | True to show the bubble size for the data labels on a chart. False to hide the bubble size. Read/write Boolean.
ShowCategoryName | True to display the category name for the data labels on a chart. False to hide the name. Read/write Boolean.
ShowLegendKey | True if the data label legend key is visible. Read/write Boolean.
ShowPercentage | True to display the percentage value for the data labels on a chart. False to hide the value. Read/write Boolean.
ShowRange | Set to True to display the Value From Cells range field in all the chart data labels for a specified chart. Set to False to hide that field. Read/write Boolean.
ShowSeriesName | True to show the series name for the data labels on a chart. False to hide the name. Read/write Boolean.
ShowValue | True to display the data label values for a specified chart. False to hide the values. Read/write Boolean.
VerticalAlignment | Returns or sets the vertical alignment of the specified object. Read/write Variant.


DataLabels Properties (Word)

 Copy code hover
[image]

DataLabels Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
AutoText | True if all objects in the collection automatically generate appropriate text based on context. Read/write Boolean.
Count | Returns the number of objects in the collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Format | Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.
HorizontalAlignment | Returns or sets the horizontal alignment for the specified object. Read/write Variant.
Name | Returns the name of the object. Read-only String.
NumberFormat | Returns or sets the format code for the object. Read/write String.
NumberFormatLinked | True if the number format is linked to the cells (so that the number format changes in the labels when it changes in the cells). Read/write Boolean.
NumberFormatLocal | Returns or sets the format code for the object as a string in the language of the user. Read/write Variant.
Orientation | Returns or sets the text orientation. Read/write Long.
Parent | Returns the parent for the specified object. Read-only Object.
Position | Returns or sets the position of the data labels. Read/write XlDataLabelPosition.
ReadingOrder | Returns or sets an XlReadingOrder constant that represents the reading order for the specified object. Read/write Long.
Separator | Sets or returns the separator for the data labels on a chart. Read/write Variant.
Shadow | Returns or sets a value that indicates whether the object has a shadow. Read/write Boolean.
ShowBubbleSize | True to show the bubble size for the data labels on a chart. False to hide the bubble size. Read/write Boolean.
ShowCategoryName | True to display the category name for the data labels on a chart. False to hide the name. Read/write Boolean.
ShowLegendKey | True if the data label legend key is visible. Read/write Boolean.
ShowPercentage | True to display the percentage value for the data labels on a chart. False to hide the value. Read/write Boolean.
ShowRange | Set to True to display the Value From Cells range field in all the chart data labels for a specified chart. Set to False to hide that field. Read/write Boolean.
ShowSeriesName | True to show the series name for the data labels on a chart. False to hide the name. Read/write Boolean.
ShowValue | True to display the data label values for a specified chart. False to hide the values. Read/write Boolean.
VerticalAlignment | Returns or sets the vertical alignment of the specified object. Read/write Variant.


DataLabels.Application Property (Word)

 Copy code hover
[image]

DataLabels.Application Property (Word)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Application

expression A variable that represents a DataLabels object.

Example

The following example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveDocument
If myObject.Application.Value = "Microsoft Word" Then
 MsgBox "This is a Word Application object."
Else
 MsgBox "This is not a Word Application object."
End If

See also

Concepts

DataLabels Object

Other resources

DataLabels Object Members


DataLabels.AutoText Property (Word)

 Copy code hover
[image]

DataLabels.AutoText Property (Word)
See also Send feedback

Published: July 16, 2012

True if all objects in the collection automatically generate appropriate text based on context. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .AutoText

expression A variable that represents a DataLabels object.

Remarks

Setting the value of this property sets the AutoText property of all DataLabel objects contained by the collection. This property returns True only when the AutoText property for all DataLabel objects contained in the collection is set to True; otherwise, this property returns False.

Example

The following example sets the data labels for series one of the first chart in the active document to automatically generate appropriate text.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.SeriesCollection(1). _
 DataLabels.AutoText = True
 End If
End With

See also

Concepts

DataLabels Object

Other resources

DataLabels Object Members


DataLabels.Count Property (Word)

 Copy code hover
[image]

DataLabels.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the number of objects in the collection. Read-only Long.

Version Information

Version Added: Word 2007

Syntax

expression .Count

expression A variable that represents a DataLabels object.

See also

Concepts

DataLabels Object

Other resources

DataLabels Object Members


DataLabels.Creator Property (Word)

 Copy code hover
[image]

DataLabels.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version Information

Version Added: Word 2007

Syntax

expression .Creator

expression A variable that represents a DataLabels object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD". This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Word has the creator code MSWD. For more information about this property, consult the language reference Help included with Microsoft Office for Mac.

See also

Concepts

DataLabels Object

Other resources

DataLabels Object Members


DataLabels.Format Property (Word)

 Copy code hover
[image]

DataLabels.Format Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.

Version Information

Version Added: Word 2007

Syntax

expression .Format

expression A variable that represents a DataLabels object.

See also

Concepts

DataLabels Object

Other resources

DataLabels Object Members


DataLabels.HorizontalAlignment Property (Word)

 Copy code hover
[image]

DataLabels.HorizontalAlignment Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the horizontal alignment for the specified object. Read/write Variant.

Version Information

Version Added: Word 2007

Syntax

expression .HorizontalAlignment

expression A variable that represents a DataLabels object.

Remarks

You can set the value of this property to one of the following XlConstants constants:

  • xlCenter

  • xlDistributed

  • xlJustify

  • xlLeft

  • xlRight

Some of these constants may not be available to you, depending on the language support (for example, U.S. English) that you have selected or installed.

See also

Concepts

DataLabels Object

Other resources

DataLabels Object Members


DataLabels.Name Property (Word)

 Copy code hover
[image]

DataLabels.Name Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the name of the object. Read-only String.

Version Information

Version Added: Word 2007

Syntax

expression .Name

expression A variable that represents a DataLabels object.

See also

Concepts

DataLabels Object

Other resources

DataLabels Object Members


DataLabels.NumberFormat Property (Word)

 Copy code hover
[image]

DataLabels.NumberFormat Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the format code for the object. Read/write String.

Version Information

Version Added: Word 2007

Syntax

expression .NumberFormat

expression A variable that represents a DataLabels object.

Remarks

The format code is the same string as the Format Codes option in the Format Cells dialog box. The Format function uses different format code strings than do the NumberFormat and NumberFormatLocal properties.

See also

Concepts

DataLabels Object

Other resources

DataLabels Object Members


DataLabels.NumberFormatLinked Property (Word)

 Copy code hover
[image]

DataLabels.NumberFormatLinked Property (Word)
See also Send feedback

Published: July 16, 2012

True if the number format is linked to the cells (so that the number format changes in the labels when it changes in the cells). Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .NumberFormatLinked

expression A variable that represents a DataLabels object.

See also

Concepts

DataLabels Object

Other resources

DataLabels Object Members


DataLabels.NumberFormatLocal Property (Word)

 Copy code hover
[image]

DataLabels.NumberFormatLocal Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the format code for the object as a string in the language of the user. Read/write Variant.

Version Information

Version Added: Word 2007

Syntax

expression .NumberFormatLocal

expression A variable that represents a DataLabels object.

Remarks

The Format function uses different format code strings than do the NumberFormat and NumberFormatLocal properties.

See also

Concepts

DataLabels Object

Other resources

DataLabels Object Members


DataLabels.Orientation Property (Word)

 Copy code hover
[image]

DataLabels.Orientation Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the text orientation. Read/write Long.

Version Information

Version Added: Word 2007

Syntax

expression .Orientation

expression A variable that represents a DataLabels object.

Remarks

The value of this property can be an integer from -90 through 90 degrees or one of the XlOrientation constants.

See also

Concepts

DataLabels Object

Other resources

DataLabels Object Members


DataLabels.Parent Property (Word)

 Copy code hover
[image]

DataLabels.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the parent for the specified object. Read-only Object.

Version Information

Version Added: Word 2007

Syntax

expression .Parent

expression A variable that represents a DataLabels object.

See also

Concepts

DataLabels Object

Other resources

DataLabels Object Members


DataLabels.Position Property (Word)

 Copy code hover
[image]

DataLabels.Position Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the position of the data labels. Read/write XlDataLabelPosition.

Version Information

Version Added: Word 2007

Syntax

expression .Position

expression A variable that represents a DataLabels object.

See also

Concepts

DataLabels Object

Other resources

DataLabels Object Members


DataLabels.ReadingOrder Property (Word)

 Copy code hover
[image]

DataLabels.ReadingOrder Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets an XlReadingOrder constant that represents the reading order for the specified object. Read/write Long.

Version Information

Version Added: Word 2007

Syntax

expression .ReadingOrder

expression A variable that represents a DataLabels object.

See also

Concepts

DataLabels Object

Other resources

DataLabels Object Members


DataLabels.Separator Property (Word)

 Copy code hover
[image]

DataLabels.Separator Property (Word)
See also Send feedback

Published: July 16, 2012

Sets or returns the separator for the data labels on a chart. Read/write Variant.

Version Information

Version Added: Word 2007

Syntax

expression .Separator

expression A variable that represents a DataLabels object.

Remarks

If you use a string, you will get a string as the separator. If you use xlDataLabelSeparatorDefault (= 1), you will get the default data label separator, which is either a comma or a newline character, depending on the data label.

Example

The following example sets the data label separator for the first series on the first chart in the active document to a semicolon.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.SeriesCollection(1). _
 DataLabels.Separator = ";"
 End If
End With

See also

Concepts

DataLabels Object

Other resources

DataLabels Object Members


DataLabels.Shadow Property (Word)

 Copy code hover
[image]

DataLabels.Shadow Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a value that indicates whether the object has a shadow. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .Shadow

expression A variable that represents a DataLabels object.

See also

Concepts

DataLabels Object

Other resources

DataLabels Object Members


DataLabels.ShowBubbleSize Property (Word)

 Copy code hover
[image]

DataLabels.ShowBubbleSize Property (Word)
See also Send feedback

Published: July 16, 2012

True to show the bubble size for the data labels on a chart. False to hide the bubble size. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .ShowBubbleSize

expression A variable that represents a DataLabels object.

Example

The following example shows the bubble size for the data labels of the first series on the first chart.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.SeriesCollection(1).DataLabels. _
 ShowBubbleSize = True
 End If
End With

See also

Concepts

DataLabels Object

Other resources

DataLabels Object Members


DataLabels.ShowCategoryName Property (Word)

 Copy code hover
[image]

DataLabels.ShowCategoryName Property (Word)
See also Send feedback

Published: July 16, 2012

True to display the category name for the data labels on a chart. False to hide the name. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .ShowCategoryName

expression A variable that represents a DataLabels object.

Example

The following example shows the category name for the data labels of the first series on the first chart.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.SeriesCollection(1).DataLabels. _
 ShowCategoryName = True
 End If
End With

See also

Concepts

DataLabels Object

Other resources

DataLabels Object Members


DataLabels.ShowLegendKey Property (Word)

 Copy code hover
[image]

DataLabels.ShowLegendKey Property (Word)
See also Send feedback

Published: July 16, 2012

True if the data label legend key is visible. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .ShowLegendKey

expression A variable that represents a DataLabels object.

Example

The following example sets the data labels for series one of the first chart in the active document to show values and the legend key.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.SeriesCollection(1).DataLabels. _
 ShowLegendKey = True
 .Chart.SeriesCollection(1).DataLabels.Type = xlShowValue
 End If
End With

See also

Concepts

DataLabels Object

Other resources

DataLabels Object Members


DataLabels.ShowPercentage Property (Word)

 Copy code hover
[image]

DataLabels.ShowPercentage Property (Word)
See also Send feedback

Published: July 16, 2012

True to display the percentage value for the data labels on a chart. False to hide the value. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .ShowPercentage

expression A variable that represents a DataLabels object.

Example

The following example enables the percentage value to be shown for the data labels of the first series on the first chart.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.SeriesCollection(1).DataLabels. _
 ShowPercentage = True
 End If
End With

See also

Concepts

DataLabels Object

Other resources

DataLabels Object Members


DataLabels.ShowRange Property (Word)

 Copy code hover
[image]

DataLabels.ShowRange Property (Word)
See also Send feedback

Published: July 16, 2012

Set to True to display the Value From Cells range field in all the chart data labels for a specified chart. Set to False to hide that field. Read/write Boolean.

Version information

Version Added: Word 2013

Syntax

expression .ShowRange

expression A variable that represents a DataLabels object.

Example

The following example displays the Value From Cells range field for all the data labels of the first series in the first chart.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.SeriesCollection(1).DataLabels.ShowRange = True
 End If
End With

Property value

BOOL

See also

Concepts

DataLabels Object

Other resources

DataLabels Object Members


DataLabels.ShowSeriesName Property (Word)

 Copy code hover
[image]

DataLabels.ShowSeriesName Property (Word)
See also Send feedback

Published: July 16, 2012

True to show the series name for the data labels on a chart. False to hide the name. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .ShowSeriesName

expression A variable that represents a DataLabels object.

Example

The following example enables the series name to be shown for the data labels of the first series on the first chart.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.SeriesCollection(1).DataLabels. _
 ShowSeriesName = True
 End If
End With

See also

Concepts

DataLabels Object

Other resources

DataLabels Object Members


DataLabels.ShowValue Property (Word)

 Copy code hover
[image]

DataLabels.ShowValue Property (Word)
See also Send feedback

Published: July 16, 2012

True to display the data label values for a specified chart. False to hide the values. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .ShowValue

expression A variable that represents a DataLabels object.

Example

The following example enables the value to be shown for the data labels of the first series in the first chart.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.SeriesCollection(1).DataLabels. _
 ShowValue = True
 End If
End With

See also

Concepts

DataLabels Object

Other resources

DataLabels Object Members


DataLabels.VerticalAlignment Property (Word)

 Copy code hover
[image]

DataLabels.VerticalAlignment Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the vertical alignment of the specified object. Read/write Variant.

Version Information

Version Added: Word 2007

Syntax

expression .VerticalAlignment

expression A variable that represents a DataLabels object.

Remarks

You can set the value of this property to one of the following XlConstants constants:

  • xlBottom

  • xlCenter

  • xlDistributed

  • xlJustify

  • xlTop

See also

Concepts

DataLabels Object

Other resources

DataLabels Object Members


DataLabels Methods (Word)

 Copy code hover
[image]

DataLabels Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the object.
Item | Returns a single object from a collection.
Propagate | Propagates the contents and formatting of the specified data label to all the other data labels in the series.
Select | Selects the object.


DataLabels.Delete Method (Word)

 Copy code hover
[image]

DataLabels.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Version Information

Version Added: Word 2007

Syntax

expression .Delete

expression A variable that represents a DataLabels object.

See also

Concepts

DataLabels Object

Other resources

DataLabels Object Members


DataLabels.Item Method (Word)

 Copy code hover
[image]

DataLabels.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a single object from a collection.

Version Information

Version Added: Word 2007

Syntax

expression .Item(Index)

expression A variable that represents a DataLabels object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The index number for the object.

Return Value

A DataLabel object contained by the collection.

Example

The following example sets the number format for the fifth data label in the first series for the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.SeriesCollection(1).DataLabels.Item(5). _
 NumberFormat = "0.000"
 End If
End With

See also

Concepts

DataLabels Object

Other resources

DataLabels Object Members


DataLabels.Propagate Method (Word)

 Copy code hover
[image]

DataLabels.Propagate Method (Word)
See also Send feedback

Published: July 16, 2012

Propagates the contents and formatting of the specified data label to all the other data labels in the series.

Version information

Version Added: Word 2013

Syntax

expression .Propagate(Index)

expression A variable that represents a DataLabels object.

Parameters

Name | Required/Optional | Data type | Description
Index | Required | VARIANT | The index number in the DataLabels collection of the data label to propagate.

Return value

VOID

Remarks

If the source data label supports fields that are incompatible with the destination data label, those fields are inserted in the form [Field Name].

See also

Concepts

DataLabels Collection

Other resources

DataLabels Members


DataLabels.Select Method (Word)

 Copy code hover
[image]

DataLabels.Select Method (Word)
See also Send feedback

Published: July 16, 2012

Selects the object.

Version Information

Version Added: Word 2007

Syntax

expression .Select

expression A variable that represents a DataLabels object.

See also

Concepts

DataLabels Object

Other resources

DataLabels Object Members


DataTable Object (Word)

 Copy code hover
[image]

DataTable Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a chart data table.

Version Information

Version Added: Word 2007

Example

Use the DataTable property to return a DataTable object. The following example adds a data table with an outline border to embedded chart one.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.HasDataTable = True
 .Chart.DataTable.HasBorderOutline = True
 End If
End With

See also

Concepts

Word Object Model Reference

Other resources

DataTable Object Members


DataTable Members (Word)

 Copy code hover
[image]

DataTable Members (Word)
Send feedback

Published: July 16, 2012

Represents a chart data table.

Methods

Name | Description
Delete | Deletes the object.
Select | Selects the object.

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
Border | Returns the border of the object. Read-only ChartBorder.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Font | Returns the font of the specified object. Read-only ChartFont.
Format | Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.
HasBorderHorizontal | True if the chart data table has horizontal cell borders. Read/write Boolean.
HasBorderOutline | True if the chart data table has outline borders. Read/write Boolean.
HasBorderVertical | True if the chart data table has vertical cell borders. Read/write Boolean.
Parent | Returns the parent for the specified object. Read-only Object.
ShowLegendKey | True if the data label legend key is visible. Read/write Boolean.


DataTable Properties (Word)

 Copy code hover
[image]

DataTable Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:


DataTable.Application Property (Word)

 Copy code hover
[image]

DataTable.Application Property (Word)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Application

expression A variable that represents a DataTable object.

Example

The following example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveDocument
If myObject.Application.Value = "Microsoft Word" Then
 MsgBox "This is a Word Application object."
Else
 MsgBox "This is not a Word Application object."
End If

See also

Concepts

DataTable Object

Other resources

DataTable Object Members


DataTable.Border Property (Word)

 Copy code hover
[image]

DataTable.Border Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the border of the object. Read-only ChartBorder.

Version Information

Version Added: Word 2007

Syntax

expression .Border

expression A variable that represents a DataTable object.

See also

Concepts

DataTable Object

Other resources

DataTable Object Members


DataTable.Creator Property (Word)

 Copy code hover
[image]

DataTable.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version Information

Version Added: Word 2007

Syntax

expression .Creator

expression A variable that represents a DataTable object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD". This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Word has the creator code MSWD. For more information about this property, consult the language reference Help included with Microsoft Office for Mac.

See also

Concepts

DataTable Object

Other resources

DataTable Object Members


DataTable.Font Property (Word)

 Copy code hover
[image]

DataTable.Font Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the font of the specified object. Read-only ChartFont.

Version Information

Version Added: Word 2007

Syntax

expression .Font

expression A variable that represents a DataTable object.

See also

Concepts

DataTable Object

Other resources

DataTable Object Members


DataTable.Format Property (Word)

 Copy code hover
[image]

DataTable.Format Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.

Version Information

Version Added: Word 2007

Syntax

expression .Format

expression A variable that represents a DataTable object.

See also

Concepts

DataTable Object

Other resources

DataTable Object Members


DataTable.HasBorderHorizontal Property (Word)

 Copy code hover
[image]

DataTable.HasBorderHorizontal Property (Word)
See also Send feedback

Published: July 16, 2012

True if the chart data table has horizontal cell borders. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .HasBorderHorizontal

expression A variable that represents a DataTable object.

Example

The following example causes the data table for the first chart in the active document to be displayed with an outline border and no cell borders.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart
 .HasDataTable = True
 With .DataTable
 .HasBorderHorizontal = False
 .HasBorderVertical = False
 .HasBorderOutline = True
 End With
 End With
 End If
End With

See also

Concepts

DataTable Object

Other resources

DataTable Object Members


DataTable.HasBorderOutline Property (Word)

 Copy code hover
[image]

DataTable.HasBorderOutline Property (Word)
See also Send feedback

Published: July 16, 2012

True if the chart data table has outline borders. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .HasBorderOutline

expression A variable that represents a DataTable object.

Example

The following example causes the data table for the first chart in the active document to be displayed with an outline border and no cell borders.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart
 .HasDataTable = True
 With .DataTable
 .HasBorderHorizontal = False
 .HasBorderVertical = False
 .HasBorderOutline = True
 End With
 End With
 End If
End With

See also

Concepts

DataTable Object

Other resources

DataTable Object Members


DataTable.HasBorderVertical Property (Word)

 Copy code hover
[image]

DataTable.HasBorderVertical Property (Word)
See also Send feedback

Published: July 16, 2012

True if the chart data table has vertical cell borders. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .HasBorderVertical

expression A variable that represents a DataTable object.

Example

The following example causes the data table for the first chart in the active document to be displayed with an outline border and no cell borders.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart
 .HasDataTable = True
 With .DataTable
 .HasBorderHorizontal = False
 .HasBorderVertical = False
 .HasBorderOutline = True
 End With
 End With
 End If
End With

See also

Concepts

DataTable Object

Other resources

DataTable Object Members


DataTable.Parent Property (Word)

 Copy code hover
[image]

DataTable.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the parent for the specified object. Read-only Object.

Version Information

Version Added: Word 2007

Syntax

expression .Parent

expression A variable that represents a DataTable object.

See also

Concepts

DataTable Object

Other resources

DataTable Object Members


DataTable.ShowLegendKey Property (Word)

 Copy code hover
[image]

DataTable.ShowLegendKey Property (Word)
See also Send feedback

Published: July 16, 2012

True if the data label legend key is visible. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .ShowLegendKey

expression A variable that represents a DataTable object.

See also

Concepts

DataTable Object

Other resources

DataTable Object Members


DataTable Methods (Word)

 Copy code hover
[image]

DataTable Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the object.
Select | Selects the object.


DataTable.Delete Method (Word)

 Copy code hover
[image]

DataTable.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Version Information

Version Added: Word 2007

Syntax

expression .Delete

expression A variable that represents a DataTable object.

See also

Concepts

DataTable Object

Other resources

DataTable Object Members


DataTable.Select Method (Word)

 Copy code hover
[image]

DataTable.Select Method (Word)
See also Send feedback

Published: July 16, 2012

Selects the object.

Version Information

Version Added: Word 2007

Syntax

expression .Select

expression A variable that represents a DataTable object.

See also

Concepts

DataTable Object

Other resources

DataTable Object Members


DefaultWebOptions Object (Word)

 Copy code hover
[image]

DefaultWebOptions Object (Word)
See also Send feedback

Published: July 16, 2012

Contains global application-level attributes used by Microsoft Word when you open a Web page or save a document as a Web page.

Remarks

You can return or set attributes either at the application (global) level or at the document level. (Note that attribute values can be different from one document to another, depending on the attribute value at the time the document was saved.) Document-level attribute settings override application-level attribute settings. Document-level attributes are contained in the WebOptions object.

Use the DefaultWebOptions method to return the DefaultWebOptions object. The following example checks to see whether PNG (Portable Network Graphics) is allowed as an image format and sets the strImageFileType variable accordingly.

VBA Copy code Copy code
Set objAppWebOptions = Application.DefaultWebOptions
With objAppWebOptions
 If .AllowPNG = True Then
 strImageFileType = "PNG"
 Else
 strImageFileType = "JPG"
 End If
End With

See also

Concepts

Word Object Model Reference

Other resources

DefaultWebOptions Object Members


DefaultWebOptions Members (Word)

 Copy code hover
[image]

DefaultWebOptions Members (Word)
Send feedback

Published: July 16, 2012

Contains global application-level attributes used by Microsoft Word when you open a Web page or save a document as a Web page.

Properties

Name | Description
AllowPNG | False if PNG (Portable Network Graphics) is not allowed as an output format. Read/write Boolean.
AlwaysSaveInDefaultEncoding | True if the default encoding is used when you save a Web page or plain text document, independent of the file's original encoding when opened. Read/write Boolean.
Application | Returns an Application object that represents the Microsoft Word application.
BrowserLevel | Returns or sets a WdBrowserLevel constant that represents the level of the Web browser for which you want to target new Web pages created in Microsoft Word. Read/write.
CheckIfOfficeIsHTMLEditor | True if Microsoft Word checks to see whether an Office application is the default HTML editor when you start Word. Read/write Boolean.
CheckIfWordIsDefaultHTMLEditor | True if Microsoft Word checks to see whether it is the default HTML editor when you start Word. Read/write Boolean.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Encoding | Returns or sets the document encoding (code page or character set) to be used by the Web browser when you view the saved document. Read/write MsoEncoding.
FolderSuffix | Returns a String that represents the folder suffix that Microsoft Word uses when you save a document as a Web page, use long file names, or save supporting files in a separate folder. Read-only.
Fonts | Returns the WebPageFonts collection representing the set of fonts that Microsoft Word uses when you open a Web page in Word.
OptimizeForBrowser | True if Microsoft Word optimizes new Web pages created in Word for the Web browser specified by the BrowserLevel property. Read/write Boolean.
OrganizeInFolder | True if all supporting files, such as background textures and graphics, are organized in a separate folder when you save the specified document as a Web page. False if supporting files are saved in the same folder as the Web page. The default value is True. Read/write Boolean.
Parent | Returns an Object that represents the parent object of the specified DefaultWebOptions object.
PixelsPerInch | Returns or sets the density (pixels per inch) of graphics images and table cells on a Web page. Read/write Long.
RelyOnCSS | True if cascading style sheets (CSS) are used for font formatting when you view a saved document in a Web browser. Read/write Boolean.
RelyOnVML | True if image files are not generated from drawing objects when you save a document as a Web page. False if images are generated. The default value is False. Read/write Boolean.
SaveNewWebPagesAsWebArchives | True for Microsoft Word to save new Web pages in the Single File Web Page (formerly known as Web Archive) format. Read/write Boolean.
ScreenSize | Returns or sets the ideal minimum screen size (width by height, in pixels) that you should use when viewing the saved document in a Web browser. Read/write MsoScreenSize.
TargetBrowser | Sets or returns an MsoTargetBrowser constant representing the target browser for documents viewed in a Web browser. Read/write.
UpdateLinksOnSave | True if hyperlinks and paths to all supporting files are automatically updated before you save the document as a Web page. Read/write Boolean.
UseLongFileNames | True if long file names are used when you save the document as a Web page. False if long file names are not used and the DOS file name format (8.3) is used. The default value is True. Read/write Boolean.


DefaultWebOptions Properties (Word)

 Copy code hover
[image]

DefaultWebOptions Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
AllowPNG | False if PNG (Portable Network Graphics) is not allowed as an output format. Read/write Boolean.
AlwaysSaveInDefaultEncoding | True if the default encoding is used when you save a Web page or plain text document, independent of the file's original encoding when opened. Read/write Boolean.
Application | Returns an Application object that represents the Microsoft Word application.
BrowserLevel | Returns or sets a WdBrowserLevel constant that represents the level of the Web browser for which you want to target new Web pages created in Microsoft Word. Read/write.
CheckIfOfficeIsHTMLEditor | True if Microsoft Word checks to see whether an Office application is the default HTML editor when you start Word. Read/write Boolean.
CheckIfWordIsDefaultHTMLEditor | True if Microsoft Word checks to see whether it is the default HTML editor when you start Word. Read/write Boolean.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Encoding | Returns or sets the document encoding (code page or character set) to be used by the Web browser when you view the saved document. Read/write MsoEncoding.
FolderSuffix | Returns a String that represents the folder suffix that Microsoft Word uses when you save a document as a Web page, use long file names, or save supporting files in a separate folder. Read-only.
Fonts | Returns the WebPageFonts collection representing the set of fonts that Microsoft Word uses when you open a Web page in Word.
OptimizeForBrowser | True if Microsoft Word optimizes new Web pages created in Word for the Web browser specified by the BrowserLevel property. Read/write Boolean.
OrganizeInFolder | True if all supporting files, such as background textures and graphics, are organized in a separate folder when you save the specified document as a Web page. False if supporting files are saved in the same folder as the Web page. The default value is True. Read/write Boolean.
Parent | Returns an Object that represents the parent object of the specified DefaultWebOptions object.
PixelsPerInch | Returns or sets the density (pixels per inch) of graphics images and table cells on a Web page. Read/write Long.
RelyOnCSS | True if cascading style sheets (CSS) are used for font formatting when you view a saved document in a Web browser. Read/write Boolean.
RelyOnVML | True if image files are not generated from drawing objects when you save a document as a Web page. False if images are generated. The default value is False. Read/write Boolean.
SaveNewWebPagesAsWebArchives | True for Microsoft Word to save new Web pages in the Single File Web Page (formerly known as Web Archive) format. Read/write Boolean.
ScreenSize | Returns or sets the ideal minimum screen size (width by height, in pixels) that you should use when viewing the saved document in a Web browser. Read/write MsoScreenSize.
TargetBrowser | Sets or returns an MsoTargetBrowser constant representing the target browser for documents viewed in a Web browser. Read/write.
UpdateLinksOnSave | True if hyperlinks and paths to all supporting files are automatically updated before you save the document as a Web page. Read/write Boolean.
UseLongFileNames | True if long file names are used when you save the document as a Web page. False if long file names are not used and the DOS file name format (8.3) is used. The default value is True. Read/write Boolean.


DefaultWebOptions.AllowPNG Property (Word)

 Copy code hover
[image]

DefaultWebOptions.AllowPNG Property (Word)
See also Send feedback

Published: July 16, 2012

False if PNG (Portable Network Graphics) is not allowed as an output format. Read/write Boolean.

Syntax

expression .AllowPNG

expression A variable that represents a DefaultWebOptions collection.

Remarks

True if PNG is allowed as an image format when you save a document as a Web page. The default value is False.

If you save images in the PNG format and if the Web browsers you are targeting support the PNG format, you might improve the image quality or reduce the size of those image files, and therefore decrease the download time.

Example

This example enables PNG as an output format for the active document.

VBA Copy code Copy code
ActiveDocument.WebOptions.AllowPNG = True

Alternatively, PNG can be enabled as the global default for the application for newly created documents.

VBA Copy code Copy code
Application.DefaultWebOptions.AllowPNG = True

See also

Concepts

DefaultWebOptions Object

Other resources

DefaultWebOptions Object Members


DefaultWebOptions.AlwaysSaveInDefaultEncoding Property (Word)

 Copy code hover
[image]

DefaultWebOptions.AlwaysSaveInDefaultEncoding Property (Word)
See also Send feedback

Published: July 16, 2012

True if the default encoding is used when you save a Web page or plain text document, independent of the file's original encoding when opened. Read/write Boolean.

Syntax

expression .AlwaysSaveInDefaultEncoding

expression A variable that represents a DefaultWebOptions object.

Remarks

False if the original encoding of the file is used. The default value is False.

The Encoding property can be used to set the default encoding.

Example

This example sets the encoding to the default encoding. The encoding is used when you save the document as a Web page.

VBA Copy code Copy code
Application.DefaultWebOptions _
 .AlwaysSaveInDefaultEncoding = True

See also

Concepts

DefaultWebOptions Object

Other resources

DefaultWebOptions Object Members


DefaultWebOptions.Application Property (Word)

 Copy code hover
[image]

DefaultWebOptions.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a DefaultWebOptions collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

DefaultWebOptions Object

Other resources

DefaultWebOptions Object Members


DefaultWebOptions.BrowserLevel Property (Word)

 Copy code hover
[image]

DefaultWebOptions.BrowserLevel Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a WdBrowserLevel constant that represents the level of the Web browser for which you want to target new Web pages created in Microsoft Word. Read/write.

Syntax

expression .BrowserLevel

expression Required. A variable that represents a DefaultWebOptions collection.

Remarks

After you set the BrowserLevel property on the DefaultWebOptions object, the BrowserLevel property of any new Web pages you create in Word will be the same as the global setting.

Example

This example sets Word to optimize new Web pages for Microsoft Internet Explorer 5 and creates a Web page based on this setting.

VBA Copy code Copy code
With Application.DefaultWebOptions
 .BrowserLevel = wdBrowserLevelMicrosoftInternetExplorer5
 .OptimizeForBrowser = True
End With
Documents.Add DocumentType:=wdNewWebPage

See also

Concepts

DefaultWebOptions Object

Other resources

DefaultWebOptions Object Members


DefaultWebOptions.CheckIfOfficeIsHTMLEditor Property (Word)

 Copy code hover
[image]

DefaultWebOptions.CheckIfOfficeIsHTMLEditor Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word checks to see whether an Office application is the default HTML editor when you start Word. Read/write Boolean.

Syntax

expression .CheckIfOfficeIsHTMLEditor

expression A variable that represents a DefaultWebOptions object.

Remarks

The CheckIfOfficeIsHTMLEditor property returns False if Word does not perform this check. The default value is True.

This property is used only if the Web browser you are using supports HTML editing and HTML editors. To use a different HTML editor, you must set this property to False and then register the editor as the default system HTML editor.

Example

This example causes Microsoft Word not to check to see whether an Office application is the default HTML editor.

VBA Copy code Copy code
Application.DefaultWebOptions _
 .CheckIfOfficeIsHTMLEditor = False

See also

Concepts

DefaultWebOptions Object

Other resources

DefaultWebOptions Object Members


DefaultWebOptions.CheckIfWordIsDefaultHTMLEditor Property (Word)

 Copy code hover
[image]

DefaultWebOptions.CheckIfWordIsDefaultHTMLEditor Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word checks to see whether it is the default HTML editor when you start Word. Read/write Boolean.

Syntax

expression .CheckIfWordIsDefaultHTMLEditor

expression A variable that represents a DefaultWebOptions object.

Remarks

The CheckIfWordIsDefaultHTMLEditor property returnsFalse if Word does not perform this check. The default value is True.

This property is used only if the Web browser you are using supports HTML editing and HTML editors. To use a different HTML editor, you must set this property to False and then register the editor as the default system HTML editor.

Example

This example sets Microsoft Word to check to see whether it is the default HTML editor.

VBA Copy code Copy code
Application.DefaultWebOptions _
 .CheckIfWordIsDefaultHTMLEditor = True

See also

Concepts

DefaultWebOptions Object

Other resources

DefaultWebOptions Object Members


DefaultWebOptions.Creator Property (Word)

 Copy code hover
[image]

DefaultWebOptions.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a DefaultWebOptions collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

DefaultWebOptions Object

Other resources

DefaultWebOptions Object Members


DefaultWebOptions.Encoding Property (Word)

 Copy code hover
[image]

DefaultWebOptions.Encoding Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the document encoding (code page or character set) to be used by the Web browser when you view the saved document. Read/write MsoEncoding.

Syntax

expression .Encoding

expression Required. A variable that represents a DefaultWebOptions collection.

Example

This example checks to see whether the default document encoding is Western, and then it sets the string strDocEncoding accordingly.

VBA Copy code Copy code
Dim strDocEncoding As String

If Application.DefaultWebOptions.Encoding _
 = msoEncodingWestern Then
 strDocEncoding = "Western"
Else
 strDocEncoding = "Other"
End If

See also

Concepts

DefaultWebOptions Object

Other resources

DefaultWebOptions Object Members


DefaultWebOptions.FolderSuffix Property (Word)

 Copy code hover
[image]

DefaultWebOptions.FolderSuffix Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a String that represents the folder suffix that Microsoft Word uses when you save a document as a Web page, use long file names, or save supporting files in a separate folder. Read-only.

Syntax

expression .FolderSuffix

expression Required. A variable that represents a DefaultWebOptions collection.

Remarks

To save supporting files in a separate folder, set the UseLongFileNames and OrganizeInFolder properties to True.

Newly created documents use the suffix returned by the FolderSuffix property of the DefaultWebOptions object. The value of the FolderSuffix property of the WebOptions object may differ from that of the DefaultWebOptions object if the document was previously edited in a different language version of Microsoft Word. You can use the UseDefaultFolderSuffix method to change the suffix to the language you are currently using in Microsoft Office.

By default, the name of the supporting folder is the name of the Web page plus an underscore (_), a period (.), or a hyphen (-) and the word "files" (appearing in the language of the version of Word in which the file was saved as a Web page). For example, suppose that you use the Dutch language version of Word to save a file called "Page1" as a Web page. The default name of the supporting folder is Page1_bestanden.

The following table lists each language version of Office and gives its corresponding LanguageID property value and folder suffix. For the languages that are not listed in the table, the suffix ".files" is used.

Language | LanguageID | Folder suffix
Arabic | 1025 | .files
Basque | 1069 | _fitxategiak
Portuguese (Brazil) | 1046 | _arquivos
Bulgarian | 1026 | .files
Catalan | 1027 | _fitxers
Chinese - Simplified | 2052 | .files
Chinese - Traditional | 1028 | .files
Croatian | 1050 | _datoteke
Czech | 1029 | _soubory
Danish | 1030 | -filer
Dutch | 1043 | _bestanden
English | 1033 | _files
Estonian | 1061 | _failid
Finnish | 1035 | _tiedostot
French | 1036 | _fichiers
German | 1031 | -Dateien
Greek | 1032 | .files
Hebrew | 1037 | .files
Hungarian | 1038 | _elemei
Italian | 1040 | _file
Japanese | 1041 | .files
Korean | 1042 | .files
Latvian | 1062 | _fails
Lithuanian | 1063 | _bylos
Norwegian | 1044 | -filer
Polish | 1045 | _pliki
Portuguese | 2070 | _ficheiros
Romanian | 1048 | .files
Russian | 1049 | .files
Serbian (Cyrillic) | 3098 | .files
Serbian (Latin) | 2074 | _fajlovi
Slovakian | 1051 | .files
Slovenian | 1060 | _datoteke
Spanish | 3082 | _archivos
Swedish | 1053 | -filer
Thai | 1054 | .files
Turkish | 1055 | _dosyalar
Ukranian | 1058 | .files
Vietnamese | 1066 | .files

Example

This example places the folder suffix used by the active document in a String variable.

VBA Copy code Copy code
strFolderSuffix = ActiveDocument.WebOptions.FolderSuffix

See also

Concepts

DefaultWebOptions Object

Other resources

DefaultWebOptions Object Members


DefaultWebOptions.Fonts Property (Word)

 Copy code hover
[image]

DefaultWebOptions.Fonts Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the WebPageFonts collection representing the set of fonts that Microsoft Word uses when you open a Web page in Word.

Syntax

expression .Fonts

expression An expression that returns a DefaultWebOptions object.

Remarks

Word uses the fonts in the WebPageFonts collection to display Web pages in Word when either there is no font information specified in the Web page or Word is unable to display the character set.

Example

The following example sets the default fixed-width font for the English/Western European/Other Latin Script character set to Courier New, 14 point.

VBA Copy code Copy code
With Application.DefaultWebOptions _
 .Fonts(msoCharacterSetEnglishWesternEuropeanOtherLatinScript)
 .FixedWidthFont = "Courier New"
 .FixedWidthFontSize = 14
End With

See also

Concepts

DefaultWebOptions Object

Other resources

DefaultWebOptions Object Members


DefaultWebOptions.OptimizeForBrowser Property (Word)

 Copy code hover
[image]

DefaultWebOptions.OptimizeForBrowser Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word optimizes new Web pages created in Word for the Web browser specified by the BrowserLevel property. Read/write Boolean.

Syntax

expression .OptimizeForBrowser

expression Required. A variable that represents a DefaultWebOptions collection.

Example

This example sets Word to optimize new Web pages for Microsoft Internet Explorer 5 and creates a Web page based on this setting.

VBA Copy code Copy code
With Application.DefaultWebOptions
 .BrowserLevel _
 = wdBrowserLevelMicrosoftInternetExplorer5
 .OptimizeForBrowser = True
End With
Documents.Add DocumentType:=wdNewWebPage

See also

Concepts

DefaultWebOptions Object

Other resources

DefaultWebOptions Object Members


DefaultWebOptions.OrganizeInFolder Property (Word)

 Copy code hover
[image]

DefaultWebOptions.OrganizeInFolder Property (Word)
See also Send feedback

Published: July 16, 2012

True if all supporting files, such as background textures and graphics, are organized in a separate folder when you save the specified document as a Web page. False if supporting files are saved in the same folder as the Web page. The default value is True. Read/write Boolean.

Syntax

expression .OrganizeInFolder

expression Required. A variable that represents a DefaultWebOptions collection.

Remarks

The new folder is created in the folder where you have saved the Web page and is named after the document. If long file names are used, a suffix is added to the folder name. The FolderSuffix property returns wither the folder suffix for the language support you have selected or installed or the default folder suffix.

If you save a document that was previously saved with the OrganizeInFolder property set to a different value, Microsoft Word automatically moves the supporting files into or out of the folder, as appropriate.

If you don't use long file names (that is, if the UseLongFileNames property is set to False), Microsoft Word automatically saves any supporting files in a separate folder. The files cannot be saved in the same folder as the Web page.

Example

This example specifies that all supporting files are saved in the same folder when the document is saved as a Web page.

VBA Copy code Copy code
Application.DefaultWebOptions.OrganizeInFolder = False

See also

Concepts

DefaultWebOptions Object

Other resources

DefaultWebOptions Object Members


DefaultWebOptions.Parent Property (Word)

 Copy code hover
[image]

DefaultWebOptions.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified DefaultWebOptions object.

Syntax

expression .Parent

expression Required. A variable that represents a DefaultWebOptions collection.

See also

Concepts

DefaultWebOptions Object

Other resources

DefaultWebOptions Object Members


DefaultWebOptions.PixelsPerInch Property (Word)

 Copy code hover
[image]

DefaultWebOptions.PixelsPerInch Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the density (pixels per inch) of graphics images and table cells on a Web page. Read/write Long.

Syntax

expression .PixelsPerInch

expression Required. A variable that represents a DefaultWebOptions collection.

Remarks

The range of settings is usually from 19 to 480, and common settings for popular screen sizes are 72, 96, and 120. The default setting is 96.

This property determines the size of the images and cells on the specified Web page relative to the size of text whenever you view the saved document in a Web browser. The physical dimensions of the resulting image or cell are the result of the original dimensions (in inches) multiplied by the number of pixels per inch.

Use the ScreenSize property to set the optimum screen size for the targeted Web browsers.

Example

This example sets the pixel density depending on the target screen size of the Web browser.

VBA Copy code Copy code
With Application.DefaultWebOptions
 Select Case .ScreenSize
 Case msoScreenSize800x600
 .PixelsPerInch = 72
 Case msoScreenSize1024x768
 .PixelsPerInch = 96
 Case Else
 .PixelsPerInch = 120
 End Select
End With

See also

Concepts

DefaultWebOptions Object

Other resources

DefaultWebOptions Object Members


DefaultWebOptions.RelyOnCSS Property (Word)

 Copy code hover
[image]

DefaultWebOptions.RelyOnCSS Property (Word)
See also Send feedback

Published: July 16, 2012

True if cascading style sheets (CSS) are used for font formatting when you view a saved document in a Web browser. Read/write Boolean.

Syntax

expression .RelyOnCSS

expression Required. A variable that represents a DefaultWebOptions collection.

Remarks

Microsoft Word creates a cascading style sheet file and saves it either to the specified folder or to the same folder as your Web page, depending on the value of the OrganizeInFolder property. False if HTML <FONT> tags and cascading style sheets are used. The default value is True.

You should set this property to True if your Web browser supports cascading style sheets because this will give you more precise layout and formatting control on your Web page and make it look more like your document (as it appears in Microsoft Word).

Example

This example enables the use of cascading style sheets as the global default for the application.

VBA Copy code Copy code
Application.DefaultWebOptions.RelyOnCSS = True

See also

Concepts

DefaultWebOptions Object

Other resources

DefaultWebOptions Object Members


DefaultWebOptions.RelyOnVML Property (Word)

 Copy code hover
[image]

DefaultWebOptions.RelyOnVML Property (Word)
See also Send feedback

Published: July 16, 2012

True if image files are not generated from drawing objects when you save a document as a Web page. False if images are generated. The default value is False. Read/write Boolean.

Syntax

expression .RelyOnVML

expression Required. A variable that represents a DefaultWebOptions collection.

Remarks

You can reduce file sizes by not generating images for drawing objects, if your Web browser supports Vector Markup Language (VML). For example, Microsoft Internet Explorer 5 supports this feature, and you should set the RelyOnVML property to True if you are targeting this browser. For browsers that do not support VML, the image will not appear when you view a Web page saved with this property enabled.

Don't generate images if your Web page uses image files that you have generated earlier and if the location where you save the document is different from the final location of the page on the Web server.

Example

This example specifies that images are generated when saving the document as a Web page.

VBA Copy code Copy code
Application.DefaultWebOptions.RelyOnVML = False

See also

Concepts

DefaultWebOptions Object

Other resources

DefaultWebOptions Object Members


DefaultWebOptions.SaveNewWebPagesAsWebArchives Property (Word)

 Copy code hover
[image]

DefaultWebOptions.SaveNewWebPagesAsWebArchives Property (Word)
See also Send feedback

Published: July 16, 2012

True for Microsoft Word to save new Web pages in the Single File Web Page (formerly known as Web Archive) format. Read/write Boolean.

Syntax

expression .SaveNewWebPagesAsWebArchives

expression An expression that returns a DefaultWebOptions object.

Remarks

Setting the SaveNewWebPagesAsWebArchives property won't change the format of any saved Web pages. To change their format, you must individually open them and then use the SaveAs2 method to set the Web page format.

Example

This example enables the SaveNewWebPagesAsWebArchives property so that when Web pages are saved, they are saved in the Single File Web Page format.

VBA Copy code Copy code
Sub SetWebOption()
 Application.DefaultWebOptions _
 .SaveNewWebPagesAsWebArchives = True
End Sub

See also

Concepts

DefaultWebOptions Object

Other resources

DefaultWebOptions Object Members


DefaultWebOptions.ScreenSize Property (Word)

 Copy code hover
[image]

DefaultWebOptions.ScreenSize Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the ideal minimum screen size (width by height, in pixels) that you should use when viewing the saved document in a Web browser. Read/write MsoScreenSize.

Syntax

expression .ScreenSize

expression Required. A variable that represents a DefaultWebOptions collection.

Example

This example sets the target screen size at 800x600 pixels.

VBA Copy code Copy code
Application.DefaultWebOptions.ScreenSize = _
 msoScreenSize800x600

See also

Concepts

DefaultWebOptions Object

Other resources

DefaultWebOptions Object Members


DefaultWebOptions.TargetBrowser Property (Word)

 Copy code hover
[image]

DefaultWebOptions.TargetBrowser Property (Word)
See also Send feedback

Published: July 16, 2012

Sets or returns an MsoTargetBrowser constant representing the target browser for documents viewed in a Web browser. Read/write.

Syntax

expression .TargetBrowser

expression Required. A variable that represents a DefaultWebOptions collection.

Example

This example sets the target browser for all documents to Internet Explorer 6.

VBA Copy code Copy code
Sub GlobalTargetBrowser()
 Application.DefaultWebOptions _
 .TargetBrowser = msoTargetBrowserIE6
End Sub

See also

Concepts

DefaultWebOptions Object

Other resources

DefaultWebOptions Object Members


DefaultWebOptions.UpdateLinksOnSave Property (Word)

 Copy code hover
[image]

DefaultWebOptions.UpdateLinksOnSave Property (Word)
See also Send feedback

Published: July 16, 2012

True if hyperlinks and paths to all supporting files are automatically updated before you save the document as a Web page. Read/write Boolean.

Syntax

expression .UpdateLinksOnSave

expression An expression that returns a DefaultWebOptions object.

Remarks

The UpdateLinksOnSave property ensures that the links are up-to-date at the time the document is saved. The default value for the UpdateLinksOnSave property is True.

A value of False indicates that the links are not updated. You should set this property to False if the location where the document is saved is different from the final location on the Web server and the supporting files are not available at the first location.

Example

This example specifies that links are not updated before the document is saved.

VBA Copy code Copy code
Application.DefaultWebOptions.UpdateLinksOnSave = False

See also

Concepts

DefaultWebOptions Object

Other resources

DefaultWebOptions Object Members


DefaultWebOptions.UseLongFileNames Property (Word)

 Copy code hover
[image]

DefaultWebOptions.UseLongFileNames Property (Word)
See also Send feedback

Published: July 16, 2012

True if long file names are used when you save the document as a Web page. False if long file names are not used and the DOS file name format (8.3) is used. The default value is True. Read/write Boolean.

Syntax

expression .UseLongFileNames

expression Required. A variable that represents a DefaultWebOptions collection.

Remarks

If you don't use long file names and your document has supporting files, Microsoft Word automatically organizes those files in a separate folder. Otherwise, use the OrganizeInFolder property to determine whether supporting files are organized in a separate folder.

Example

This example disallows the use of long file names as the global default for the application.

VBA Copy code Copy code
Application.DefaultWebOptions.UseLongFileNames = False

See also

Concepts

DefaultWebOptions Object

Other resources

DefaultWebOptions Object Members


Dialog Object (Word)

 Copy code hover
[image]

Dialog Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a built-in dialog box. The Dialog object is a member of the Dialogs collection. The Dialogs collection contains all the built-in dialog boxes in Word. You cannot create a new built-in dialog box or add one to the Dialogs collection.

Remarks

Use Dialogs(Index), where Index is a WdWordDialog constant that identifies the dialog box, to return a single Dialog object. The following example displays and carries out the actions taken in the built-in Open dialog box.

VBA Copy code Copy code
dlgAnswer = Dialogs(wdDialogFileOpen).Show

The WdWordDialog constants are formed from the prefix "wdDialog" followed by the name of the menu and the dialog box. For example, the constant for the Page Setup dialog box is wdDialogFilePageSetup, and the constant for the New dialog box is wdDialogFileNew.

For more information about working with built-in Word dialog boxes, see Displaying built-in Word dialog boxes.

See also

Concepts

Word Object Model Reference

Other resources

Dialog Object Members


Dialog Members (Word)

 Copy code hover
[image]

Dialog Members (Word)
Send feedback

Published: July 16, 2012

Represents a built-in dialog box. The Dialog object is a member of the Dialogs collection. The Dialogs collection contains all the built-in dialog boxes in Word. You cannot create a new built-in dialog box or add one to the Dialogs collection.

Methods

Name | Description
Display | Displays the specified built-in Word dialog box until either the user closes it or the specified amount of time has passed. Returns a Long that indicates which button was clicked to close the dialog box.
Execute | Applies the current settings of a Microsoft Word dialog box.
Show | Displays and carries out actions initiated in the specified built-in Word dialog box. Returns a Long that indicates which button was clicked to close the dialog box.
Update | Updates the values shown in a built-in Microsoft Word dialog box.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
CommandBarId | Returns a Long that represents the toolbar control id for a built-in Microsoft Word dialog box. Read-only.
CommandName | Returns the name of the procedure that displays the specified built-in dialog box. Read-only String.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
DefaultTab | Returns or sets the active tab when the specified dialog box is displayed. Read/write WdWordDialogTab.
Parent | Returns an Object that represents the parent object of the specified Dialog object.
Type | Returns the type of built-in Microsoft Word dialog box. Read-only WdWordDialog.


Dialog Properties (Word)

 Copy code hover
[image]

Dialog Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
CommandBarId | Returns a Long that represents the toolbar control id for a built-in Microsoft Word dialog box. Read-only.
CommandName | Returns the name of the procedure that displays the specified built-in dialog box. Read-only String.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
DefaultTab | Returns or sets the active tab when the specified dialog box is displayed. Read/write WdWordDialogTab.
Parent | Returns an Object that represents the parent object of the specified Dialog object.
Type | Returns the type of built-in Microsoft Word dialog box. Read-only WdWordDialog.


Dialog.Application Property (Word)

 Copy code hover
[image]

Dialog.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a Dialog object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

Dialog Object

Other resources

Dialog Object Members


Dialog.CommandBarId Property (Word)

 Copy code hover
[image]

Dialog.CommandBarId Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the toolbar control id for a built-in Microsoft Word dialog box. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .CommandBarId

expression An expression that returns a Dialog object.

See also

Concepts

Dialog Object

Other resources

Dialog Object Members


Dialog.CommandName Property (Word)

 Copy code hover
[image]

Dialog.CommandName Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the name of the procedure that displays the specified built-in dialog box. Read-only String.

Syntax

expression .CommandName

expression A variable that represents a Dialog object.

Remarks

For more information about working with built-in Word dialog boxes, see Displaying Built-in Word Dialog Boxes.

Example

This example displays the name of the procedure that displays the Save As dialog box (File menu): FileSaveAs.

VBA Copy code Copy code
MsgBox Dialogs(wdDialogFileSaveAs).CommandName

See also

Concepts

Dialog Object

Other resources

Dialog Object Members


Dialog.Creator Property (Word)

 Copy code hover
[image]

Dialog.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a Dialog object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Dialog Object

Other resources

Dialog Object Members


Dialog.DefaultTab Property (Word)

 Copy code hover
[image]

Dialog.DefaultTab Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the active tab when the specified dialog box is displayed. Read/write WdWordDialogTab.

Syntax

expression .DefaultTab

expression Required. A variable that represents a Dialog object.

Example

This example displays the Page Setup dialog box with the Paper Source tab selected.

VBA Copy code Copy code
With Dialogs(wdDialogFilePageSetup)
 .DefaultTab = wdDialogFilePageSetupTabPaperSource
 .Show
End With

See also

Concepts

Dialog Object

Other resources

Dialog Object Members


Dialog.Parent Property (Word)

 Copy code hover
[image]

Dialog.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Dialog object.

Syntax

expression .Parent

expression Required. A variable that represents a Dialog object.

See also

Concepts

Dialog Object

Other resources

Dialog Object Members


Dialog.Type Property (Word)

 Copy code hover
[image]

Dialog.Type Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the type of built-in Microsoft Word dialog box. Read-only WdWordDialog.

Syntax

expression .Type

expression Required. A variable that represents a Dialog object.

See also

Concepts

Dialog Object

Other resources

Dialog Object Members


Dialog Methods (Word)

 Copy code hover
[image]

Dialog Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Display | Displays the specified built-in Word dialog box until either the user closes it or the specified amount of time has passed. Returns a Long that indicates which button was clicked to close the dialog box.
Execute | Applies the current settings of a Microsoft Word dialog box.
Show | Displays and carries out actions initiated in the specified built-in Word dialog box. Returns a Long that indicates which button was clicked to close the dialog box.
Update | Updates the values shown in a built-in Microsoft Word dialog box.


Dialog.Display Method (Word)

 Copy code hover
[image]

Dialog.Display Method (Word)
See also Send feedback

Published: July 16, 2012

Displays the specified built-in Word dialog box until either the user closes it or the specified amount of time has passed. Returns a Long that indicates which button was clicked to close the dialog box.

Syntax

expression .Display(TimeOut)

expression Required. A variable that represents a Dialog object.

Parameters

Name | Required/Optional | Data Type | Description
TimeOut | Optional | Variant | The amount of time that Word will wait before closing the dialog box automatically. One unit is approximately 0.001 second. Concurrent system activity may increase the effective time value. If this argument is omitted, the dialog box is closed when the user closes it.

Return Value

Long

Remarks

The Display method returns the following possible values.

Return value | Description
-2 | The Close button.
-1 | The OK button.
0 (zero) | The Cancel button.
> 0 (zero) | A command button: 1 is the first button, 2 is the second button, and so on.

Example

This example displays the About dialog box for approximately ten seconds.

VBA Copy code Copy code
Dim dlgAbout As Dialog

Set dlgAbout = Dialogs(wdDialogHelpAbout)
dlgAbout.Display TimeOut:=10000

This example displays the Customize dialog box.

VBA Copy code Copy code
Dialogs(wdDialogToolsCustomize).Display

See also

Concepts

Dialog Object

Other resources

Dialog Object Members


Dialog.Execute Method (Word)

 Copy code hover
[image]

Dialog.Execute Method (Word)
See also Send feedback

Published: July 16, 2012

Applies the current settings of a Microsoft Word dialog box.

Syntax

expression .Execute

expression Required. A variable that represents a Dialog object.

Example

The following example enables the Keep with next check box on the Line and Page Breaks tab in the Paragraph dialog box.

VBA Copy code Copy code
With Dialogs(wdDialogFormatParagraph)
 .KeepWithNext = 1
 .Execute
End With

See also

Concepts

Dialog Object

Other resources

Dialog Object Members


Dialog.Show Method (Word)

 Copy code hover
[image]

Dialog.Show Method (Word)
See also Send feedback

Published: July 16, 2012

Displays and carries out actions initiated in the specified built-in Word dialog box. Returns a Long that indicates which button was clicked to close the dialog box.

Syntax

expression .Show(TimeOut)

expression Required. A variable that represents a Dialog object.

Parameters

Name | Required/Optional | Data Type | Description
TimeOut | Optional | Variant | The amount of time that Word will wait before closing the dialog box automatically. One unit is approximately 0.001 second. Concurrent system activity may increase the effective time value. If this argument is omitted, the dialog box is closed when the user dismisses it.

Return Value

Long

Remarks

The following table shows the meaning of the values that the Show method returns.

Return value | Description
-2 | The Close button.
-1 | The OK button.
0 (zero) | The Cancel button.
> 0 (zero) | A command button: 1 is the first button, 2 is the second button, and so on.

Example

This example displays the Find and Replace dialog box with the word "Blue" preset in the Find what text box.

VBA Copy code Copy code
With Dialogs(wdDialogEditFind)
 .Find = "Blue"
 .Show
End With

This example displays and carries out any action initiated in the Open dialog box. The file name is set to *.* so that all file names are displayed.

VBA Copy code Copy code
With Dialogs(wdDialogFileOpen)
 .Name = "*.*"
 .Show
End With

This example displays and carries out any action initiated in the Zoom dialog box. If there are no actions initiated for approximately 9 seconds, the dialog box is closed.

VBA Copy code Copy code
Dialogs(wdDialogViewZoom).Show TimeOut:=9000

See also

Concepts

Dialog Object

Other resources

Dialog Object Members


Dialog.Update Method (Word)

 Copy code hover
[image]

Dialog.Update Method (Word)
See also Send feedback

Published: July 16, 2012

Updates the values shown in a built-in Microsoft Word dialog box.

Syntax

expression .Update

expression Required. A variable that represents a Dialog object.

Example

This example returns a Dialog object that refers to the Font dialog box. The font applied to the Selection object is changed to Arial, the dialog values are updated, and the Font dialog box is displayed.

VBA Copy code Copy code
Set myDialog = Dialogs(wdDialogFormatFont)
Selection.Font.Name = "Arial"
myDialog.Update
myDialog.Show

See also

Concepts

Dialog Object

Other resources

Dialog Object Members


Dialogs Object (Word)

 Copy code hover
[image]

Dialogs Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of Dialog objects in Word. Each Dialog object represents a built-in Word dialog box.

Remarks

Use the Dialogs property to return the Dialogs collection. The following example displays the number of available built-in dialog boxes.

VBA Copy code Copy code
MsgBox Dialogs.Count

You cannot create a new built-in dialog box or add one to the Dialogs collection. Use Dialogs(Index), where Index is the WdWordDialog constant that identifies the dialog box, to return a single Dialog object. The following example displays the built-in Open dialog box.

VBA Copy code Copy code
dlgAnswer = Dialogs(wdDialogFileOpen).Show

For more information, see Displaying built-in Word dialog boxes .

See also

Concepts

Word Object Model Reference

Other resources

Dialogs Object Members


Dialogs Members (Word)

 Copy code hover
[image]

Dialogs Members (Word)
Send feedback

Published: July 16, 2012

A collection of Dialog objects in Word. Each Dialog object represents a built-in Word dialog box.

Methods

Name | Description
Item | Returns a dialog in Microsoft Word.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of dialog boxes in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified Dialogs object.


Dialogs Properties (Word)

 Copy code hover
[image]

Dialogs Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of dialog boxes in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified Dialogs object.


Dialogs.Application Property (Word)

 Copy code hover
[image]

Dialogs.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a Dialogs collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

Dialogs Collection Object

Other resources

Dialogs Object Members


Dialogs.Count Property (Word)

 Copy code hover
[image]

Dialogs.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of dialog boxes in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents a Dialogs collection.

See also

Concepts

Dialogs Collection Object

Other resources

Dialogs Object Members


Dialogs.Creator Property (Word)

 Copy code hover
[image]

Dialogs.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a Dialogs collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Dialogs Collection Object

Other resources

Dialogs Object Members


Dialogs.Parent Property (Word)

 Copy code hover
[image]

Dialogs.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Dialogs object.

Syntax

expression .Parent

expression Required. A variable that represents a Dialogs collection.

See also

Concepts

Dialogs Collection Object

Other resources

Dialogs Object Members


Dialogs Methods (Word)

 Copy code hover
[image]

Dialogs Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Item | Returns a dialog in Microsoft Word.


Dialogs.Item Method (Word)

 Copy code hover
[image]

Dialogs.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a dialog in Microsoft Word.

Syntax

expression .Item(Index)

expression Required. A variable that represents a Dialogs collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | WdWordDialog | A constant that specifies the dialog.

Return Value

Dialog

Example

This example displays the Page Setup dialog.

VBA Copy code Copy code
Sub DialogItem()
 Application.Dialogs.Item(wdDialogFileDocumentLayout).Display
End Sub

See also

Concepts

Dialogs Collection Object

Other resources

Dialogs Object Members


Dictionaries Object (Word)

 Copy code hover
[image]

Dictionaries Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of Dictionary objects that includes the active custom spelling dictionaries.

Remarks

Use the CustomDictionaries property to return the collection of currently active custom dictionaries. The following example displays the names of all the active custom dictionaries.

VBA Copy code Copy code
For Each d In CustomDictionaries
 Msgbox d.Name
Next d

Use the Add method to add a new custom dictionary to the collection of active custom dictionaries. If there isn't a file with the name specified by FileName, Word creates it. The following example adds "MyCustom.dic" to the collection of custom dictionaries.

VBA Copy code Copy code
CustomDictionaries.Add FileName:="MyCustom.dic"

Use the ClearAll method to unload all custom dictionaries. Note, however, that this method doesn't delete the dictionary files. After you use this method, the number of custom dictionaries in the collection is 0 (zero). The following example clears the custom dictionaries and creates a new custom dictionary file. The new dictionary is set as the active custom dictionary, to which Word will automatically add any new words it encounters.

VBA Copy code Copy code
With CustomDictionaries
 .ClearAll
 .Add FileName:= "MyCustom.dic"
 .ActiveCustomDictionary = CustomDictionaries(1)
End With

Remarks

You set the custom dictionary to which new words are added by using the ActiveCustomDictionary property. If you try to set this property to a dictionary that isn't a custom dictionary, an error occurs.

The Maximum property returns the maximum number of simultaneous custom spelling dictionaries that the application can support. For Word, this maximum is 10.

See also

Concepts

Word Object Model Reference

Other resources

Dictionaries Object Members


Dictionaries Members (Word)

 Copy code hover
[image]

Dictionaries Members (Word)
Send feedback

Published: July 16, 2012

A collection of Dictionary objects that includes the active custom spelling dictionaries.

Methods

Name | Description
Add | Returns a Dictionary object that represents a new custom spelling or conversion dictionary added to the collection of active custom spelling or conversion dictionaries.
ClearAll | Unloads all of the custom or conversion dictionaries.
Item | Returns an individual Dictionary object in a collection.

Properties

Name | Description
ActiveCustomDictionary | Returns or sets a Dictionary object that represents the custom dictionary to which words will be added. Read/write.
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of dictionaries in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Maximum | Returns the maximum number of custom or conversion dictionaries allowed. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified Dictionaries object.


Dictionaries Properties (Word)

 Copy code hover
[image]

Dictionaries Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
ActiveCustomDictionary | Returns or sets a Dictionary object that represents the custom dictionary to which words will be added. Read/write.
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of dictionaries in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Maximum | Returns the maximum number of custom or conversion dictionaries allowed. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified Dictionaries object.


Dictionaries.ActiveCustomDictionary Property (Word)

 Copy code hover
[image]

Dictionaries.ActiveCustomDictionary Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Dictionary object that represents the custom dictionary to which words will be added. Read/write.

Syntax

expression .ActiveCustomDictionary

expression A variable that represents a Dictionaries collection.

Example

This example displays the full path and file name of the active custom dictionary.

VBA Copy code Copy code
Set dicCustom = Application.CustomDictionaries.ActiveCustomDictionary
MsgBox dicCustom.Path & Application.PathSeparator & dicCustom.Name

This example clears all existing custom dictionaries, adds a custom dictionary named "Home.dic," and then loads the new dictionary.

VBA Copy code Copy code
Dim dicCustom As Dictionary

Application.CustomDictionaries.ClearAll

Set dicCustom = Application.CustomDictionaries _
 .Add(FileName:="C:\Program Files" _
 & "\Microsoft Office\Office\Home.dic")
Application.CustomDictionaries.ActiveCustomDictionary = dicCustom

See also

Concepts

Dictionaries Collection Object

Other resources

Dictionaries Object Members


Dictionaries.Application Property (Word)

 Copy code hover
[image]

Dictionaries.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a Dictionaries collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

Dictionaries Collection Object

Other resources

Dictionaries Object Members


Dictionaries.Count Property (Word)

 Copy code hover
[image]

Dictionaries.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of dictionaries in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents a Dictionaries collection.

See also

Concepts

Dictionaries Collection Object

Other resources

Dictionaries Object Members


Dictionaries.Creator Property (Word)

 Copy code hover
[image]

Dictionaries.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a Dictionaries collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Dictionaries Collection Object

Other resources

Dictionaries Object Members


Dictionaries.Maximum Property (Word)

 Copy code hover
[image]

Dictionaries.Maximum Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the maximum number of custom or conversion dictionaries allowed. Read-only Long.

Syntax

expression .Maximum

expression Required. A variable that represents a Dictionaries collection.

Example

This example displays a message if the number of custom dictionaries is equal to the maximum number allowed. If the maximum number has not been reached, a custom dictionary named "MyDictionary.dic" is added.

VBA Copy code Copy code
If CustomDictionaries.Count = CustomDictionaries.Maximum Then
 MsgBox "Cannot add another dictionary file"
Else
 CustomDictionaries.Add "MyDictionary.dic"
End If

See also

Concepts

Dictionaries Collection Object

Other resources

Dictionaries Object Members


Dictionaries.Parent Property (Word)

 Copy code hover
[image]

Dictionaries.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Dictionaries object.

Syntax

expression .Parent

expression Required. A variable that represents a Dictionaries collection.

See also

Concepts

Dictionaries Collection Object

Other resources

Dictionaries Object Members


Dictionaries Methods (Word)

 Copy code hover
[image]

Dictionaries Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Returns a Dictionary object that represents a new custom spelling or conversion dictionary added to the collection of active custom spelling or conversion dictionaries.
ClearAll | Unloads all of the custom or conversion dictionaries.
Item | Returns an individual Dictionary object in a collection.


Dictionaries.Add Method (Word)

 Copy code hover
[image]

Dictionaries.Add Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a Dictionary object that represents a new custom spelling or conversion dictionary added to the collection of active custom spelling or conversion dictionaries.

Syntax

expression .Add(FileName)

expression Required. A variable that represents a Dictionaries collection.

Parameters

Name | Required/Optional | Data Type | Description
FileName | Required | String | The string name of the dictionary file. If no path is specified in the string, the proofing tools path is used.

Return Value

Dictionary

Remarks

If a file with the name specified by the FileName parameter doesn't exist, Microsoft Word creates one.

The Dictionaries collection includes only the active custom spelling dictionaries. Dictionary objects that are derived from the Languages collection don't have an Add method. These include the Dictionary objects returned by the ActiveSpellingDictionary, ActiveGrammarDictionary, ActiveThesaurusDictionary, and ActiveHyphenationDictionary properties.

Use the HangulHanjaDictionaries property to return the collection of custom conversion dictionaries. The HangulHanjaConversionDictionaries collection includes only the active custom conversion dictionaries.

Example

This example removes all dictionaries from the list of custom spelling dictionaries and creates a new custom dictionary file. The new dictionary is assigned to be the active custom dictionary, to which new words are automatically added.

VBA Copy code Copy code
With CustomDictionaries
 .ClearAll
 .Add FileName:="c:\My Documents\MyCustom.dic"
 .ActiveCustomDictionary = CustomDictionaries(1)
End With

This example creates a new custom dictionary and assigns it to a variable. The new custom dictionary is then set to be used for text that's marked as French Canadian. Note that to run a spelling check for another language, you must have installed the proofing tools for that language.

VBA Copy code Copy code
Sub FrCanDic()
 Dim dicFrenchCan As Dictionary

 Set dicFrenchCan = CustomDictionaries.Add(FileName:="FrenchCanadian.dic")
 With dicFrenchCan
 .LanguageSpecific = True
 .LanguageID = wdFrenchCanadian
 End With
End Sub

This example removes all dictionaries from the list of custom conversion dictionaries and creates a new custom dictionary file. The new dictionary is assigned to be the active custom dictionary, to which new words are automatically added.

VBA Copy code Copy code
With HangulHanjaDictionaries
 .ClearAll
 .Add FileName:="C:\My Documents\MyCustom.hhd"
 .ActiveCustomDictionary = CustomDictionaries(1)
End With

See also

Concepts

Dictionaries Collection Object

Other resources

Dictionaries Object Members


Dictionaries.ClearAll Method (Word)

 Copy code hover
[image]

Dictionaries.ClearAll Method (Word)
See also Send feedback

Published: July 16, 2012

Unloads all of the custom or conversion dictionaries.

Syntax

expression .ClearAll

expression A variable that represents a Dictionaries object.

Example

This example unloads all of the custom dictionaries.

VBA Copy code Copy code
CustomDictionaries.ClearAll

See also

Concepts

Dictionaries Collection Object

Other resources

Dictionaries Object Members


Dictionaries.Item Method (Word)

 Copy code hover
[image]

Dictionaries.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual Dictionary object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents a Dictionaries collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The individual object to be returned. Can be a Long indicating the ordinal position or a String representing the name of the individual object.

Return Value

Dictionary

See also

Concepts

Dictionaries Collection Object

Other resources

Dictionaries Object Members


Dictionary Object (Word)

 Copy code hover
[image]

Dictionary Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a dictionary. Dictionary objects that represent custom dictionaries are members of the Dictionaries collection. Other dictionary objects are returned by properties of the Languages collection; these include the ActiveSpellingDictionary, ActiveGrammarDictionary, ActiveThesaurusDictionary, and ActiveHyphenationDictionary properties.

Remarks

Use CustomDictionaries(Index), where Index is an index number or the string name for the dictionary, to return a single Dictionary object that represents a custom dictionary. The following example returns the first dictionary in the collection.

VBA Copy code Copy code
CustomDictionaries(1)

The following example returns the dictionary named "MyDictionary."

VBA Copy code Copy code
CustomDictionaries("MyDictionary")

Use the ActiveCustomDictionary property to set the custom spelling dictionary in the collection to which new words are added. If you try to set this property to a dictionary that's not a custom dictionary, an error occurs.

Use the Add method to add a new dictionary to the collection of active custom dictionaries. If there is no file with the name specified by FileName, Word creates it. The following example adds "MyCustom.dic" to the collection of custom dictionaries.

VBA Copy code Copy code
CustomDictionaries.Add FileName:="MyCustom.dic"

Remarks

Use the Name and Path properties to locate any of the dictionaries. The following example displays a message box that contains the full path for each dictionary.

VBA Copy code Copy code
For Each d in CustomDictionaries
 Msgbox d.Path & Application.PathSeparator & d.Name
Next d

Use the LanguageSpecific property to determine whether the specified custom dictionary can have a specific language assigned to it with the LanguageID property. If the dictionary is language specific, it will verify only text that's formatted for the specified language.

For each language for which proofing tools are installed, you can use the ActiveGrammarDictionary, ActiveHyphenationDictionary, ActiveSpellingDictionary, and ActiveThesaurusDictionary properties to return the corresponding Dictionary objects. The following example returns the full path for the active spelling dictionary used in the U.S. English version of Word.

VBA Copy code Copy code
Set myspell = Languages(wdEnglishUS).ActiveSpellingDictionary
MsgBox mySpell.Path & Application.PathSeparator & mySpell.Name

The ReadOnly property returns True for .lex files (built-in proofing dictionaries) and False for .dic files (custom spelling dictionaries).

See also

Concepts

Word Object Model Reference

Other resources

Dictionary Object Members


Dictionary Members (Word)

 Copy code hover
[image]

Dictionary Members (Word)
Send feedback

Published: July 16, 2012

Represents a dictionary. Dictionary objects that represent custom dictionaries are members of the Dictionaries collection. Other dictionary objects are returned by properties of the Languages collection; these include the ActiveSpellingDictionary, ActiveGrammarDictionary, ActiveThesaurusDictionary, and ActiveHyphenationDictionary properties.

Methods

Name | Description
Delete | Deletes the specified dictionary.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
LanguageID | Returns or sets a WdLanguageID constant that represents the language for the specified object. Read/write.
LanguageSpecific | True if the custom dictionary is to be used only with text formatted for a specific language. Read/write Boolean.
Name | Returns the name of the specified object. Read-only String.
Parent | Returns an Object that represents the parent object of the specified Dictionary object.
Path | Returns the path to the specified dictionary. Read-only String.
ReadOnly | True if the specified dictionary cannot be changed. Read-only Boolean.
Type | Returns the dictionary type. Read-only WdDictionaryType.


Dictionary Properties (Word)

 Copy code hover
[image]

Dictionary Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
LanguageID | Returns or sets a WdLanguageID constant that represents the language for the specified object. Read/write.
LanguageSpecific | True if the custom dictionary is to be used only with text formatted for a specific language. Read/write Boolean.
Name | Returns the name of the specified object. Read-only String.
Parent | Returns an Object that represents the parent object of the specified Dictionary object.
Path | Returns the path to the specified dictionary. Read-only String.
ReadOnly | True if the specified dictionary cannot be changed. Read-only Boolean.
Type | Returns the dictionary type. Read-only WdDictionaryType.


Dictionary.Application Property (Word)

 Copy code hover
[image]

Dictionary.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a Dictionary object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

Dictionary Object

Other resources

Dictionary Object Members


Dictionary.Creator Property (Word)

 Copy code hover
[image]

Dictionary.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a Dictionary object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Dictionary Object

Other resources

Dictionary Object Members


Dictionary.LanguageID Property (Word)

 Copy code hover
[image]

Dictionary.LanguageID Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a WdLanguageID constant that represents the language for the specified object. Read/write.

Syntax

expression LanguageID

expression Required. An expression that returns a Dictionary object.

Remarks

For a custom dictionary, you must first set the LanguageSpecific property to True before specifying the LanguageID property. Custom dictionaries that are language-specific check only text that is formatted for that language.

Some WdLanguageID constants may not be available to you, depending on the language support (U.S. English, for example) that you have selected or installed.

See also

Concepts

Dictionary Object

Other resources

Dictionary Object Members


Dictionary.LanguageSpecific Property (Word)

 Copy code hover
[image]

Dictionary.LanguageSpecific Property (Word)
See also Send feedback

Published: July 16, 2012

True if the custom dictionary is to be used only with text formatted for a specific language. Read/write Boolean.

Syntax

expression .LanguageSpecific

expression A variable that represents a Dictionary object.

Example

This example checks to see whether any custom dictionaries are language specific. If any of them are, the example removes them from the list of active custom dictionaries.

VBA Copy code Copy code
Dim dicLoop As Dictionary

For each dicLoop in CustomDictionaries
 If dicLoop.LanguageSpecific = True Then dicLoop.Delete
Next dicLoop

This example adds a custom dictionary that will check only text that's formatted as German.

VBA Copy code Copy code
Dim dicNew As Dictionary

Set dicNew = CustomDictionaries.Add("German1.dic")
dicNew.LanguageSpecific = True
dicNew.LanguageID = wdGerman

See also

Concepts

Dictionary Object

Other resources

Dictionary Object Members


Dictionary.Name Property (Word)

 Copy code hover
[image]

Dictionary.Name Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the name of the specified object. Read-only String.

Syntax

expression .Name

expression Required. A variable that represents a Dictionary object.

See also

Concepts

Dictionary Object

Other resources

Dictionary Object Members


Dictionary.Parent Property (Word)

 Copy code hover
[image]

Dictionary.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Dictionary object.

Syntax

expression .Parent

expression Required. A variable that represents a Dictionary object.

See also

Concepts

Dictionary Object

Other resources

Dictionary Object Members


Dictionary.Path Property (Word)

 Copy code hover
[image]

Dictionary.Path Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the path to the specified dictionary. Read-only String.

Syntax

expression .Path

expression Required. A variable that represents a Dictionary object.

Remarks

The path doesn't include a trailing character — for example, "C:\MSOffice" or "http://MyServer". Use the PathSeparator property to add the character that separates folders and drive letters. Use the Name property to return the file name without the path and use the FullName property to return the file name and the path together.

Note Note

You can use the PathSeparator property to build Web addresses even though they contain forward slashes (/) and the PathSeparator property defaults to a backslash (\).

See also

Concepts

Dictionary Object

Other resources

Dictionary Object Members


Dictionary.ReadOnly Property (Word)

 Copy code hover
[image]

Dictionary.ReadOnly Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified dictionary cannot be changed. Read-only Boolean.

Syntax

expression .ReadOnly

expression Required. A variable that represents a Dictionary object.

Remarks

The active grammar, hyphenation, spelling, and thesaurus dictionaries are read-only. Custom dictionaries are read/write.

See also

Concepts

Dictionary Object

Other resources

Dictionary Object Members


Dictionary.Type Property (Word)

 Copy code hover
[image]

Dictionary.Type Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the dictionary type. Read-only WdDictionaryType.

Syntax

expression .Type

expression Required. A variable that represents a Dictionary object.

See also

Concepts

Dictionary Object

Other resources

Dictionary Object Members


Dictionary Methods (Word)

 Copy code hover
[image]

Dictionary Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the specified dictionary.


Dictionary.Delete Method (Word)

 Copy code hover
[image]

Dictionary.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the specified dictionary.

Syntax

expression .Delete

expression Required. A variable that represents a Dictionary object.

See also

Concepts

Dictionary Object

Other resources

Dictionary Object Members


DisplayUnitLabel Object (Word)

 Copy code hover
[image]

DisplayUnitLabel Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a unit label on an axis in the specified chart.

Version Information

Version Added: Word 2007

Remarks

Unit labels are useful for charting large values (for example, in the millions or billions). You can make the chart more readable by using a single unit label instead of large numbers at each tick mark.

Example

Use the DisplayUnitLabel property to return the DisplayUnitLabel object. The following example sets the display label caption to "Millions" on the value axis of the first chart in the active document, and then the example turns off automatic font scaling.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.Axes(xlValue)
 .DisplayUnit = xlMillions
 .HasDisplayUnitLabel = True
 With .DisplayUnitLabel
 .Caption = "Millions"
 .AutoScaleFont = False
 End With
 End With
 End If
End With

See also

Concepts

Word Object Model Reference

Other resources

DisplayUnitLabel Object Members


DisplayUnitLabel Members (Word)

 Copy code hover
[image]

DisplayUnitLabel Members (Word)
Send feedback

Published: July 16, 2012

Represents a unit label on an axis in the specified chart.

Methods

Name | Description
Delete | Deletes the object.
Select | Selects the object.

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
Caption | Returns or sets the display unit label text. Read/write String.
Characters | Returns a ChartCharacters object that represents a range of characters within the object text. You can use the ChartCharacters object to format characters within a text string.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Format | Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.
Formula | Gets or sets a String value that represents the formula of the object using A1-style notation, in English. Read/write.
FormulaLocal | Returns or sets the formula for the object, using A1-style references in the language of the user. Read/write String.
FormulaR1C1 | Returns or sets the formula for the object, using R1C1-style notation in the language of the macro. Read/write String.
FormulaR1C1Local | Returns or sets the formula for the object, using R1C1-style notation in the language of the user. Read/write String.
Height | Returns the height, in points, of the object. Read-only.
HorizontalAlignment | Returns or sets the horizontal alignment for the specified object. Read/write Variant.
IncludeInLayout | True if a display unit label will occupy the chart layout space when a chart layout is being determined. The default is True. Read/write Boolean.
Left | Returns or sets the distance, in points, from the left edge of the object to the left edge of the chart area. Read/write Double.
Name | Returns the name of the object. Read-only String.
Orientation | Returns or sets the text orientation. Read/write Long.
Parent | Returns the parent for the specified object. Read-only Object.
Position | Returns or sets the position of the unit label on an axis in the chart. Read/write XlChartElementPosition.
ReadingOrder | Returns or sets an XlReadingOrder constant that represents the reading order for the specified object. Read/write Long.
Shadow | Returns or sets a value that indicates whether the object has a shadow. Read/write Boolean.
Text | Returns or sets the text for the specified object. Read/write String.
Top | Returns or sets the distance, in points, from the top edge of the object to the top of the first row (on a worksheet) or the top of the chart area (on a chart). Read/write Double.
VerticalAlignment | Returns or sets the vertical alignment of the specified object. Read/write Variant.
Width | Returns the width, in points, of the object. Read-only.


DisplayUnitLabel Properties (Word)

 Copy code hover
[image]

DisplayUnitLabel Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
Caption | Returns or sets the display unit label text. Read/write String.
Characters | Returns a ChartCharacters object that represents a range of characters within the object text. You can use the ChartCharacters object to format characters within a text string.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Format | Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.
Formula | Gets or sets a String value that represents the formula of the object using A1-style notation, in English. Read/write.
FormulaLocal | Returns or sets the formula for the object, using A1-style references in the language of the user. Read/write String.
FormulaR1C1 | Returns or sets the formula for the object, using R1C1-style notation in the language of the macro. Read/write String.
FormulaR1C1Local | Returns or sets the formula for the object, using R1C1-style notation in the language of the user. Read/write String.
Height | Returns the height, in points, of the object. Read-only.
HorizontalAlignment | Returns or sets the horizontal alignment for the specified object. Read/write Variant.
IncludeInLayout | True if a display unit label will occupy the chart layout space when a chart layout is being determined. The default is True. Read/write Boolean.
Left | Returns or sets the distance, in points, from the left edge of the object to the left edge of the chart area. Read/write Double.
Name | Returns the name of the object. Read-only String.
Orientation | Returns or sets the text orientation. Read/write Long.
Parent | Returns the parent for the specified object. Read-only Object.
Position | Returns or sets the position of the unit label on an axis in the chart. Read/write XlChartElementPosition.
ReadingOrder | Returns or sets an XlReadingOrder constant that represents the reading order for the specified object. Read/write Long.
Shadow | Returns or sets a value that indicates whether the object has a shadow. Read/write Boolean.
Text | Returns or sets the text for the specified object. Read/write String.
Top | Returns or sets the distance, in points, from the top edge of the object to the top of the first row (on a worksheet) or the top of the chart area (on a chart). Read/write Double.
VerticalAlignment | Returns or sets the vertical alignment of the specified object. Read/write Variant.
Width | Returns the width, in points, of the object. Read-only.


DisplayUnitLabel.Application Property (Word)

 Copy code hover
[image]

DisplayUnitLabel.Application Property (Word)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Application

expression A variable that represents a DisplayUnitLabel object.

Example

The following example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveDocument
If myObject.Application.Value = "Microsoft Word" Then
 MsgBox "This is a Word Application object."
Else
 MsgBox "This is not a Word Application object."
End If

See also

Concepts

DisplayUnitLabel Object

Other resources

DisplayUnitLabel Object Members


DisplayUnitLabel.Caption Property (Word)

 Copy code hover
[image]

DisplayUnitLabel.Caption Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the display unit label text. Read/write String.

Version Information

Version Added: Word 2007

Syntax

expression .Caption

expression A variable that represents a DisplayUnitLabel object.

See also

Concepts

DisplayUnitLabel Object

Other resources

DisplayUnitLabel Object Members


DisplayUnitLabel.Characters Property (Word)

 Copy code hover
[image]

DisplayUnitLabel.Characters Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a ChartCharacters object that represents a range of characters within the object text. You can use the ChartCharacters object to format characters within a text string.

Version Information

Version Added: Word 2007

Syntax

expression .Characters(Start, Length)

expression A variable that represents a DisplayUnitLabel object.

Parameters

Name | Required/Optional | Data Type | Description
Start | Optional | Variant | The first character to be returned. If this argument is either 1 or omitted, this property returns a range of characters starting with the first character.
Length | Optional | Variant | The number of characters to be returned. If this argument is omitted, this property returns the remainder of the string (everything after the Start character).

Remarks

The ChartCharacters object is not a collection.

See also

Concepts

DisplayUnitLabel Object

Other resources

DisplayUnitLabel Object Members


DisplayUnitLabel.Creator Property (Word)

 Copy code hover
[image]

DisplayUnitLabel.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version Information

Version Added: Word 2007

Syntax

expression .Creator

expression A variable that represents a DisplayUnitLabel object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD". This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Word has the creator code MSWD. For more information about this property, consult the language reference Help included with Microsoft Office for Mac.

See also

Concepts

DisplayUnitLabel Object

Other resources

DisplayUnitLabel Object Members


DisplayUnitLabel.Format Property (Word)

 Copy code hover
[image]

DisplayUnitLabel.Format Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.

Version Information

Version Added: Word 2007

Syntax

expression .Format

expression A variable that represents a DisplayUnitLabel object.

See also

Concepts

DisplayUnitLabel Object

Other resources

DisplayUnitLabel Object Members


DisplayUnitLabel.Formula Property (Word)

 Copy code hover
[image]

DisplayUnitLabel.Formula Property (Word)
See also Send feedback

Published: July 16, 2012

Gets or sets a String value that represents the formula of the object using A1-style notation, in English. Read/write.

Version Information

Version Added: Word 2010

Syntax

expression .Formula

expression A variable that represents a DisplayUnitLabel object.

Return Value

String

Remarks

For more information about A1-style notation, seeHow to: Refer to Cells and Ranges by Using A1 Notation.

See also

Concepts

DisplayUnitLabel Object

Other resources

DisplayUnitLabel Object Members


DisplayUnitLabel.FormulaLocal Property (Word)

 Copy code hover
[image]

DisplayUnitLabel.FormulaLocal Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the formula for the object, using A1-style references in the language of the user. Read/write String.

Version Information

Version Added: Word 2010

Syntax

expression .FormulaLocal

expression A variable that represents a DisplayUnitLabel object.

Remarks

If the cell contains a constant, this property returns that constant. If the cell is empty, the property returns an empty string. If the cell contains a formula, the property returns the formula as a string, in the same format in which it would be displayed in the formula bar (including the equal sign (=)).

If you set the value or formula of a cell to a date, Microsoft Excel verifies that the cell is already formatted with one of the date or time number formats. If not, the number format is changed to the default short date number format.

If the range is a one- or two-dimensional range, you can set the formula to a Visual Basic array of the same dimensions. Similarly, you can put the formula into a Visual Basic array.

Setting the formula of a multiple-cell range fills all cells in the range with the formula.

See also

Concepts

DisplayUnitLabel Object

Other resources

DisplayUnitLabel Object Members


DisplayUnitLabel.FormulaR1C1 Property (Word)

 Copy code hover
[image]

DisplayUnitLabel.FormulaR1C1 Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the formula for the object, using R1C1-style notation in the language of the macro. Read/write String.

Version Information

Version Added: Word 2010

Syntax

expression .FormulaR1C1

expression A variable that represents a DisplayUnitLabel object.

See also

Concepts

DisplayUnitLabel Object

Other resources

DisplayUnitLabel Object Members


DisplayUnitLabel.FormulaR1C1Local Property (Word)

 Copy code hover
[image]

DisplayUnitLabel.FormulaR1C1Local Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the formula for the object, using R1C1-style notation in the language of the user. Read/write String.

Version Information

Version Added: Word 2010

Syntax

expression .FormulaR1C1Local

expression A variable that represents a DisplayUnitLabel object.

See also

Concepts

DisplayUnitLabel Object

Other resources

DisplayUnitLabel Object Members


DisplayUnitLabel.Height Property (Word)

 Copy code hover
[image]

DisplayUnitLabel.Height Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the height, in points, of the object. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .Height

expression A variable that represents a DisplayUnitLabel object.

Return Value

Double

See also

Concepts

DisplayUnitLabel Object

Other resources

DisplayUnitLabel Object Members


DisplayUnitLabel.HorizontalAlignment Property (Word)

 Copy code hover
[image]

DisplayUnitLabel.HorizontalAlignment Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the horizontal alignment for the specified object. Read/write Variant.

Version Information

Version Added: Word 2007

Syntax

expression .HorizontalAlignment

expression A variable that represents a DisplayUnitLabel object.

Remarks

You can set the value of this property to one of the following XlConstants constants:

  • xlCenter

  • xlDistributed

  • xlJustify

  • xlLeft

  • xlRight

Some of these constants may not be available to you, depending on the language support (for example, U.S. English) that you have selected or installed.

See also

Concepts

DisplayUnitLabel Object

Other resources

DisplayUnitLabel Object Members


DisplayUnitLabel.IncludeInLayout Property (Word)

 Copy code hover
[image]

DisplayUnitLabel.IncludeInLayout Property (Word)
See also Send feedback

Published: July 16, 2012

True if a display unit label will occupy the chart layout space when a chart layout is being determined. The default is True. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .IncludeInLayout

expression An expression that returns a DisplayUnitLabel object.

Remarks

This property does not affect whether a chart is in autolayout mode or not. If the user adds a title by using the Above Chart command, the chart will resize smaller, as in previous versions of Microsoft Office. If the user then removes the title or selects one of the overlay title options, the chart will resize larger, as if the title were not on the chart.

See also

Concepts

DisplayUnitLabel Object

Other resources

DisplayUnitLabel Object Members


DisplayUnitLabel.Left Property (Word)

 Copy code hover
[image]

DisplayUnitLabel.Left Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the distance, in points, from the left edge of the object to the left edge of the chart area. Read/write Double.

Version Information

Version Added: Word 2007

Syntax

expression .Left

expression A variable that represents a DisplayUnitLabel object.

See also

Concepts

DisplayUnitLabel Object

Other resources

DisplayUnitLabel Object Members


DisplayUnitLabel.Name Property (Word)

 Copy code hover
[image]

DisplayUnitLabel.Name Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the name of the object. Read-only String.

Version Information

Version Added: Word 2007

Syntax

expression .Name

expression A variable that represents a DisplayUnitLabel object.

See also

Concepts

DisplayUnitLabel Object

Other resources

DisplayUnitLabel Object Members


DisplayUnitLabel.Orientation Property (Word)

 Copy code hover
[image]

DisplayUnitLabel.Orientation Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the text orientation. Read/write Long.

Version Information

Version Added: Word 2007

Syntax

expression .Orientation

expression A variable that represents a DisplayUnitLabel object.

Remarks

The value of this property can be an integer value from -90 through 90 degrees or one of the XlOrientation constants.

See also

Concepts

DisplayUnitLabel Object

Other resources

DisplayUnitLabel Object Members


DisplayUnitLabel.Parent Property (Word)

 Copy code hover
[image]

DisplayUnitLabel.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the parent for the specified object. Read-only Object.

Version Information

Version Added: Word 2007

Syntax

expression .Parent

expression A variable that represents a DisplayUnitLabel object.

See also

Concepts

DisplayUnitLabel Object

Other resources

DisplayUnitLabel Object Members


DisplayUnitLabel.Position Property (Word)

 Copy code hover
[image]

DisplayUnitLabel.Position Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the position of the unit label on an axis in the chart. Read/write XlChartElementPosition.

Version Information

Version Added: Word 2007

Syntax

expression .Position

expression A variable that represents a DisplayUnitLabel object.

See also

Concepts

DisplayUnitLabel Object

Other resources

DisplayUnitLabel Object Members


DisplayUnitLabel.ReadingOrder Property (Word)

 Copy code hover
[image]

DisplayUnitLabel.ReadingOrder Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets an XlReadingOrder constant that represents the reading order for the specified object. Read/write Long.

Version Information

Version Added: Word 2007

Syntax

expression .ReadingOrder

expression A variable that represents a DisplayUnitLabel object.

See also

Concepts

DisplayUnitLabel Object

Other resources

DisplayUnitLabel Object Members


DisplayUnitLabel.Shadow Property (Word)

 Copy code hover
[image]

DisplayUnitLabel.Shadow Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a value that indicates whether the object has a shadow. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .Shadow

expression A variable that represents a DisplayUnitLabel object.

See also

Concepts

DisplayUnitLabel Object

Other resources

DisplayUnitLabel Object Members


DisplayUnitLabel.Text Property (Word)

 Copy code hover
[image]

DisplayUnitLabel.Text Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the text for the specified object. Read/write String.

Version Information

Version Added: Word 2007

Syntax

expression .Text

expression A variable that represents a DisplayUnitLabel object.

See also

Concepts

DisplayUnitLabel Object

Other resources

DisplayUnitLabel Object Members


DisplayUnitLabel.Top Property (Word)

 Copy code hover
[image]

DisplayUnitLabel.Top Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the distance, in points, from the top edge of the object to the top of the first row (on a worksheet) or the top of the chart area (on a chart). Read/write Double.

Version Information

Version Added: Word 2007

Syntax

expression .Top

expression A variable that represents a DisplayUnitLabel object.

See also

Concepts

DisplayUnitLabel Object

Other resources

DisplayUnitLabel Object Members


DisplayUnitLabel.VerticalAlignment Property (Word)

 Copy code hover
[image]

DisplayUnitLabel.VerticalAlignment Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the vertical alignment of the specified object. Read/write Variant.

Version Information

Version Added: Word 2007

Syntax

expression .VerticalAlignment

expression A variable that represents a DisplayUnitLabel object.

Remarks

You can set the value of this property to one of the following XlConstants constants:

  • xlBottom

  • xlCenter

  • xlDistributed

  • xlJustify

  • xlTop

See also

Concepts

DisplayUnitLabel Object

Other resources

DisplayUnitLabel Object Members


DisplayUnitLabel.Width Property (Word)

 Copy code hover
[image]

DisplayUnitLabel.Width Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the width, in points, of the object. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .Width

expression A variable that represents a DisplayUnitLabel object.

See also

Concepts

DisplayUnitLabel Object

Other resources

DisplayUnitLabel Object Members


DisplayUnitLabel Methods (Word)

 Copy code hover
[image]

DisplayUnitLabel Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the object.
Select | Selects the object.


DisplayUnitLabel.Delete Method (Word)

 Copy code hover
[image]

DisplayUnitLabel.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Version Information

Version Added: Word 2007

Syntax

expression .Delete

expression A variable that represents a DisplayUnitLabel object.

See also

Concepts

DisplayUnitLabel Object

Other resources

DisplayUnitLabel Object Members


DisplayUnitLabel.Select Method (Word)

 Copy code hover
[image]

DisplayUnitLabel.Select Method (Word)
See also Send feedback

Published: July 16, 2012

Selects the object.

Version Information

Version Added: Word 2007

Syntax

expression .Select

expression A variable that represents a DisplayUnitLabel object.

See also

Concepts

DisplayUnitLabel Object

Other resources

DisplayUnitLabel Object Members


Document Object (Word)

 Copy code hover
[image]

Document Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a document. The Document object is a member of the Documents collection. The Documents collection contains all the Document objects that are currently open in Word.

Remarks

Use Documents(Index), where Index is the document name or index number to return a single Document object. The following example closes the document named "Report.doc" without saving changes.

VBA Copy code Copy code
Documents("Report.doc").Close SaveChanges:=wdDoNotSaveChanges

The index number represents the position of the document in the Documents collection. The following example activates the first document in the Documents collection.

VBA Copy code Copy code
Documents(1).Activate

Using ActiveDocument

You can use the ActiveDocument property to refer to the document with the focus. The following example uses the Activate method to activate the document named "Document 1." The example also sets the page orientation to landscape mode and then prints the document.

VBA Copy code Copy code
Documents("Document1").Activate
ActiveDocument.PageSetup.Orientation = wdOrientLandscape
ActiveDocument.PrintOut

See also

Concepts

Word Object Model Reference

Other resources

Document Object Members


Document Members (Word)

 Copy code hover
[image]

Document Members (Word)
Send feedback

Published: July 16, 2012

Represents a document. The Document object is a member of the Documents collection. The Documents collection contains all the Document objects that are currently open in Word.

Events

Name | Description
BuildingBlockInsert | Occurs when you insert a building block into a document. .
Close | Occurs when a document is closed.
ContentControlAfterAdd | Occurs after adding a content control to a document.
ContentControlBeforeContentUpdate | Occurs before updating the content in a content control, but only when the content comes from the Office XML data store.
ContentControlBeforeDelete | Occurs before removing a content control from a document.
ContentControlBeforeStoreUpdate | Occurs before updating the document's XML data store with the value of a content control.
ContentControlOnEnter | Occurs when a user enters a content control.
ContentControlOnExit | Occurs when a user leaves a content control.
New | Occurs when a new document based on the template is created. A procedure for the New event will run only if it is stored in a template.
Open | Occurs when a document is opened.
Sync | This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.
XMLAfterInsert | Occurs when a user adds a new XML element to a document. If more than one element is added to the document at the same time (for example, when cutting and pasting XML), the event fires for each element that is inserted.
XMLBeforeDelete | Occurs when a user deletes an XML element from a document. If more than one element is deleted from the document at the same time (for example, when cutting and pasting XML), the event fires for each element that is deleted.

Methods

Name | Description
AcceptAllRevisions | Accepts all tracked changes in the specified document.
AcceptAllRevisionsShown | Accepts all revisions in the specified document that are displayed on the screen.
Activate | Activates the specified document so that it becomes the active document.
AddToFavorites | Creates a shortcut to the document or hyperlink and adds it to the Favorites folder.
ApplyDocumentTheme |
ApplyQuickStyleSet2 | Applies the specified Quick Style set to the document.
ApplyTheme | Applies a theme to an open document.
AutoFormat | Automatically formats a document.
CanCheckin | True if Microsoft Word can check in a specified document to a server. Read/write Boolean.
CheckConsistency | Searches all text in a Japanese language document and displays instances where character usage is inconsistent for the same words.
CheckGrammar | Begins a spelling and grammar check for the specified document or range.
CheckIn | Returns a document from a local computer to a server, and sets the local document to read-only so that it cannot be edited locally.
CheckInWithVersion | Saves a document to a server from a local computer, and sets the local document to read-only so that it cannot be edited locally.
CheckSpelling | Begins a spelling check for the specified document or range. .
Close | Closes the specified document.
ClosePrintPreview | Switches the specified document from print preview to the previous view.
Compare | Displays revision marks that indicate where the specified document differs from another document.
ComputeStatistics | Returns a statistic based on the contents of the specified document. Long.
Convert | Converts file to the newest file format and enables all new features.
ConvertAutoHyphens | Converts hyphens created by automatic hyphenation to manual hyphens.
ConvertNumbersToText | Changes the list numbers and LISTNUM fields in the specified Document to text. .
ConvertVietDoc | Reconverts a Vietnamese document to Unicode using a code page other than the default.
CopyStylesFromTemplate | Copies styles from the specified template to a document.
CountNumberedItems | Returns the number of bulleted or numbered items and LISTNUM fields in the specified Document object.
CreateLetterContent | Creates and returns a LetterContent object based on the specified letter elements. LetterContent object.
DataForm | Displays the Data Form dialog box, in which you can add, delete, or modify records.
DeleteAllComments | Deletes all comments from the Comments collection in a document.
DeleteAllCommentsShown | Deletes all revisions in a specified document that are displayed on the screen.
DeleteAllEditableRanges | Deletes permissions in all ranges for which the specified user or group of users has permission to modify.
DeleteAllInkAnnotations | Deletes all handwritten ink annotations in a document.
DetectLanguage | Analyzes the specified text to determine the language that it is written in.
DowngradeDocument | Downgrades a document to the Word 97-2003 document format so that it can be edited in a previous version of Microsoft Word. .
EndReview | Terminates a review of a file that has been sent for review using the SendForReview method or that has been automatically placed in a review cycle by sending a document to another user in an e-mail message.
ExportAsFixedFormat | Saves a document as PDF or XPS format.
FitToPages | Decreases the font size of text just enough so that the document will fit on one fewer pages.
FollowHyperlink | Displays a cached document, if it has already been downloaded. Otherwise, this method resolves the hyperlink, downloads the target document, and displays the document in the appropriate application.
FreezeLayout | In Web view, fixes the layout of the document as it currently appears so that line breaks remain fixed and ink annotations do not move when you resize the window.
GetCrossReferenceItems | Returns an array of items that can be cross-referenced based on the specified cross-reference type.
GetLetterContent | Retrieves letter elements from the specified document and returns a LetterContent object.
GetWorkflowTasks | Returns a WorkflowTasks collection that represents the workflow tasks assigned to a document.
GetWorkflowTemplates | Returns a WorkflowTemplates collection that represents the workflow templates attached to a document.
GoTo | Returns a Range object that represents the start position of the specified item, such as a page, bookmark, or field.
LockServerFile | Locks the file on the server preventing anyone else from editing it.
MakeCompatibilityDefault | Sets the compatibility options.
ManualHyphenation | Initiates manual hyphenation of a document, one line at a time.
Merge | Merges the changes marked with revision marks from one document to another.
Post | Posts the specified document to a public folder in Microsoft Exchange. .
PresentIt | Opens PowerPoint with the specified Word document loaded.
PrintOut | Prints all or part of the specified document.
PrintPreview | Switches the view to print preview.
Protect | Protects the specified document from unauthorized changes.
Range | Returns a Range object by using the specified starting and ending character positions.
Redo | Redoes the last action that was undone (reverses the Undo method). Returns True if the actions were redone successfully.
RejectAllRevisions | Rejects all tracked changes in the specified document.
RejectAllRevisionsShown | Rejects all revisions in a document that are displayed on the screen.
Reload | Reloads a cached document by resolving the hyperlink to the document and downloading it.
ReloadAs | Reloads a document based on an HTML document, using the specified document encoding.
RemoveDocumentInformation | Removes sensitive information, properties, comments, and other metadata from a document.
RemoveLockedStyles | Purges a document of locked styles when formatting restrictions have been applied in a document.
RemoveNumbers | Removes numbers or bullets from the specified document.
RemoveTheme | Removes the active theme from the current document.
Repaginate | Repaginates the entire document.
ReplyWithChanges | Sends an e-mail message to the author of a document that has been sent out for review, notifying them that a reviewer has completed review of the document.
ResetFormFields | Clears all form fields in a document, preparing the form to be filled in again.
ReturnToLastReadPosition | Returns the active document to the last saved reading position, and returns an integer that represents that position.
RunAutoMacro | Runs an auto macro that's stored in the specified document. If the specified auto macro doesn't exist, nothing happens.
RunLetterWizard | Runs the Letter Wizard on the specified document.
Save | Saves all the documents in the Documents collection.
SaveAs2 | Saves the specified document with a new name or format. Some of the arguments for this method correspond to the options in the Save As dialog box (File tab).
SaveAsQuickStyleSet | Saves the group of quick styles currently in use.
Select | Selects the contents of the specified document.
SelectAllEditableRanges | Selects all ranges for which the specified user or group of users has permission to modify.
SelectContentControlsByTag | Returns a ContentControls collection that represents all the content controls in a document with the tag value specified in the Tag parameter. Read-only.
SelectContentControlsByTitle | Returns a ContentControls collection that represents all the content controls in a document with the title specified in the Title parameter. Read-only.
SelectLinkedControls | Returns a ContentControls collection that represents all content controls in a document that are linked to the specific custom XML node in the document's XML data store as specified by the Node parameter. Read-only.
SelectNodes | Returns an XMLNodes collection that represents all the nodes that match the XPath parameter in the order in which they appear in the document or range.
SelectSingleNode | Returns an XMLNode object that represents the first node that matches the XPath parameter in the specified document.
SelectUnlinkedControls | Returns a ContentControls collection that represents all content controls in a document that are not linked to an XML node in the document's XML data store. Read-only.
SendFax | Sends the specified document as a fax, without any user interaction.
SendFaxOverInternet | Sends a document to a fax service provider, who faxes the document to one or more specfied recipients.
SendForReview | Sends a document in an e-mail message for review by the specified recipients.
SendMail | Opens a message window for sending the specified document through Microsoft Exchange.
SetCompatibilityMode | Sets the compatibility mode for the document.
SetDefaultTableStyle | Specifies the table style to use for newly created tables in a document.
SetLetterContent | Inserts the contents of the specified LetterContent object into a document.
SetPasswordEncryptionOptions | Sets the options Microsoft Word uses for encrypting documents with passwords.
ToggleFormsDesign | Switches form design mode on or off.
TransformDocument | Applies the specified Extensible Stylesheet Language Transformation (XSLT) file to the specified document and replaces the document with the results.
Undo | Undoes the last action or a sequence of actions, which are displayed in the Undo list. Returns True if the actions were successfully undone.
UndoClear | Clears the list of actions that can be undone for the specified document.
Unprotect | Removes protection from the specified document. .
UpdateStyles | Copies all styles from the attached template into the document, overwriting any existing styles in the document that have the same name.
ViewCode | Displays the code window for the selected Microsoft ActiveX control in the specified document.
ViewPropertyBrowser | Displays the property window for the selected Microsoft ActiveX control in the specified document.
WebPagePreview | Displays a preview of the current document as it would look if saved as a Web page.

Properties

Name | Description
ActiveTheme | Returns the name of the active theme plus the theme formatting options for the specified document. Read-only String.
ActiveThemeDisplayName | Returns the display name of the active theme for the specified document. Read-only String.
ActiveWindow | Returns a Window object that represents the active window (the window with the focus). Read-only.
ActiveWritingStyle | Returns or sets the writing style for a specified language in the specified document. Read/write String.
Application | Returns an Application object that represents the Microsoft Word application.
AttachedTemplate | Returns a Template object that represents the template attached to the specified document. Read/write Variant.
AutoFormatOverride | Returns or sets a Boolean that represents whether automatic formatting options override formatting restrictions in a document where formatting restrictions are in effect.
AutoHyphenation | True if automatic hyphenation is turned on for the specified document. Read/write Boolean.
Background | Returns a Shape object that represents the background image for the specified document. Read-only.
Bibliography | Returns a Bibliography object that represents the bibliography references contained within a document. Read-only.
Bookmarks | Returns a Bookmarks collection that represents all the bookmarks in a document. Read-only.
Broadcast | Returns a Broadcast object that represents a broadcast session, in which presenters can present Microsoft Word 2013 documents to remote participants over the web without the participants needing to have rich clients installed.
BuiltInDocumentProperties | Returns a DocumentProperties collection that represents all the built-in document properties for the specified document.
Characters | Returns a Characters collection that represents the characters in a document. Read-only.
ChartDataPointTrack | Returns or sets a Boolean that specifies whether charts in the active document use cell-reference data-point tracking. Read-write.
ClickAndTypeParagraphStyle | Returns or sets the default paragraph style applied to text by the Click and Type feature in the specified document. Read/write Variant.
CoAuthoring | Returns a CoAuthoring object that provides the entry point into the co-authoring object model. Read-only.
CodeName | Returns the code name for the specified document. Read-only String.
CommandBars | Returns a CommandBars collection that represents the menu bar and all the toolbars in Microsoft Word.
Comments | Returns a Comments collection that represents all the comments in the specified document. Read-only.
Compatibility | True if the compatibility option specified by the Type argument is enabled. Compatibility options affect how a document is displayed in Microsoft Word. Read/write Boolean.
CompatibilityMode | Returns a Long that specifies the compatibility mode that Word 2010 uses when opening the document. Read-only.
ConsecutiveHyphensLimit | Returns or sets the maximum number of consecutive lines that can end with hyphens. Read/write. Long.
Container | Returns the object that represents the container application for the specified document. Read-only Object.
Content | Returns a Range object that represents the main document story. Read-only.
ContentControls | Returns a ContentControls collection that represents all the content controls in a document. Read-only.
ContentTypeProperties | Returns a MetaProperties collection that represents the metadata stored in a document, such as author name, subject, and company. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
CurrentRsid | Returns a Long that represents a random number that Word assigns to changes in a document. Read-only.
CustomDocumentProperties | Returns a DocumentProperties collection that represents all the custom document properties for the specified document.
CustomXMLParts | Returns a CustomXMLParts collection that represents the custom XML in the XML data store. Read-only.
DefaultTableStyle | Returns a Variant that represents the table style that is applied to all newly created tables in a document. Read-only.
DefaultTabStop | Returns or sets the interval (in points) between the default tab stops in the specified document. Read/write Single.
DefaultTargetFrame | Returns or sets a String indicating the browser frame in which to display a Web page reached through a hyperlink. Read/write.
DisableFeatures | True disables all features introduced after the version specified in the DisableFeaturesIntroducedAfter property. The default value is False. Read/write Boolean.
DisableFeaturesIntroducedAfter | Disables all features introduced after a specified version of Microsoft Word in the document only. Read/write WdDisableFeaturesIntroducedAfter.
DocumentInspectors | Returns a DocumentInspectors collection that enables you to locate hidden personal information, such as author name, company name, and revision date. Read-only.
DocumentLibraryVersions | Returns a DocumentLibraryVersions collection that represents the collection of versions of a shared document that has versioning enabled and that is stored in a document library on a server.
DocumentTheme | Returns an OfficeTheme object that represents the Microsoft Office theme applied to a document. Read-only.
DoNotEmbedSystemFonts | True for Microsoft Word to not embed common system fonts. Read/write Boolean.
Email | Returns an Email object that contains all the e-mail-related properties of the current document. Read-only.
EmbedLinguisticData | True for Microsoft Word to embed speech and handwriting so that data can be converted back to speech or handwriting. Read/write Boolean.
EmbedTrueTypeFonts | True if Microsoft Word embeds TrueType fonts in a document when it is saved. Read/write Boolean.
EncryptionProvider | Returns a String specifying the name of the algorithm encryption provider that Microsoft Word uses when encrypting documents. Read/write.
Endnotes | Returns an Endnotes collection that represents all the endnotes in a document. Read-only.
EnforceStyle | Returns or sets a Boolean that represents whether formatting restrictions are enforced in a protected document.
Envelope | Returns an Envelope object that represents an envelope and envelope features in a document. Read-only.
FarEastLineBreakLanguage | Returns or sets a WdFarEastLineBreakLanguageID that represents the East Asian language to use when breaking lines of text in the specified document or template. Read/write.
FarEastLineBreakLevel | Returns or sets a WdFarEastLineBreakLevel that represents the line break control level for the specified document. Read/write.
Fields | Returns a Fields collection that represents all the fields in the document. Read-only.
Final | Returns or sets a Boolean that indicates whether a document is final. Read/write.
Footnotes | Returns a Footnotes collection that represents all the footnotes in a document. Read-only.
FormattingShowClear | True for Microsoft Word to show clear formatting in the Styles and Formatting task pane. Read/write Boolean.
FormattingShowFilter | Sets or returns a WdShowFilter constant that represents the styles and formatting displayed in the Styles and Formatting task pane. Read/write Boolean.
FormattingShowFont | True for Microsoft Word to display font formatting in the Styles and Formatting task pane. Read/write Boolean.
FormattingShowNextLevel | Returns or sets a Boolean that represents whether Microsoft Word shows the next heading level when the previous heading level is used. Read/write.
FormattingShowNumbering | True for Microsoft Word to display number formatting in the Styles and Formatting task pane. Read/write Boolean.
FormattingShowParagraph | True for Microsoft Word to display paragraph formatting in the Styles and Formatting task pane. Read/write Boolean.
FormattingShowUserStyleName | Returns or sets a Boolean that represents whether to show user-defined styles. Read/write.
FormFields | Returns a FormFields collection that represents all the form fields in the document. Read-only.
FormsDesign | True if the specified document is in form design mode. Read-only Boolean.
Frames | Returns a Frames collection that represents all the frames in a document. Read-only.
Frameset | Returns a Frameset object that represents an entire frames page or a single frame on a frames page. Read-only.
FullName | Returns a String that represents the name of a document, including the path. Read-only.
GrammarChecked | True if a grammar check has been run on the specified range or document. Read/write Boolean.
GrammaticalErrors | Returns a ProofreadingErrors collection that represents the sentences that failed the grammar check in the specified document. Read-only.
GridDistanceHorizontal | Returns or sets a Single that represents the amount of horizontal space between the invisible gridlines that Microsoft Word uses when you draw, move, and resize AutoShapes or East Asian characters in the specified document. Read/write.
GridDistanceVertical | Returns or sets a Single that represents the amount of vertical space between the invisible gridlines that Microsoft Word uses when you draw, move, and resize AutoShapes or East Asian characters in the specified document. Read/write.
GridOriginFromMargin | True if Microsoft Word starts the character grid from the upper-left corner of the page. Read/write Boolean.
GridOriginHorizontal | Returns or sets a Single that represents the point, relative to the left edge of the page, where you want the invisible grid for drawing, moving, and resizing AutoShapes or East Asian characters to begin in the specified document. Read/write.
GridOriginVertical | Returns or sets a Single that represents the point, relative to the top of the page, where you want the invisible grid for drawing, moving, and resizing AutoShapes or East Asian characters to begin in the specified document. Read/write.
GridSpaceBetweenHorizontalLines | Returns or sets the interval at which Microsoft Word displays horizontal character gridlines in print layout view. Read/write Long.
GridSpaceBetweenVerticalLines | Returns or sets the interval at which Microsoft Word displays vertical character gridlines in print layout view. Read/write Long.
HasPassword | True if a password is required to open the specified document. Read-only Boolean.
HasVBProject | Returns a Boolean that represents whether a document has an attached Microsoft Visual Basic for Applications project. Read-only.
HTMLDivisions | Returns an HTMLDivisions collection that represents the HTML DIV elements in a Web document.
Hyperlinks | Returns a Hyperlinks collection that represents all the hyperlinks in the specified document. Read-only.
HyphenateCaps | True if words in all capital letters can be hyphenated. Read/write Boolean.
HyphenationZone | Returns or sets the width of the hyphenation zone, in points. Read/write Long.
Indexes | Returns an Indexes collection that represents all the indexes in the specified document. Read-only.
InlineShapes | Returns an InlineShapes collection that represents all the InlineShape objects in a document. Read-only.
IsInAutosave | Returns False if the most recent firing of the Application.DocumentBeforeSave Event (Word) event was the result of a manual save by the user, and not an automatic save. Read-only.
IsMasterDocument | True if the specified document is a master document. Read-only Boolean.
IsSubdocument | True if the specified document is a subdocument of a master document. Read-only Boolean.
JustificationMode | Returns or sets the character spacing adjustment for the specified document. Read/write WdJustificationMode.
KerningByAlgorithm | True if Microsoft Word kerns half-width Latin characters and punctuation marks in the specified document. Read/write Boolean.
Kind | Returns or sets the format type that Microsoft Word uses when automatically formatting the specified document. Read/write WdDocumentKind.
LanguageDetected | Returns or sets a value that specifies whether Microsoft Word has detected the language of the specified text. Read/write Boolean.
ListParagraphs | Returns a ListParagraphsobject that represents all the numbered paragraphs in a document. Read-only.
Lists | Returns a Lists collection that contains all the formatted lists in the specified document. Read-only.
ListTemplates | Returns a ListTemplates collection that represents all the list formats for the specified document. Read-only.
LockQuickStyleSet | Returns or sets a Boolean that represents whether users can change which set of Quick Styles is being used. Read/write.
LockTheme | Returns or sets a Boolean that represents whether a user can change a document theme. Read/write.
MailEnvelope | Returns an MsoEnvelope object that represents an e-mail header for a document.
MailMerge | Returns a MailMerge object that represents the mail merge functionality for the specified document. Read-only.
Name | Returns the name of the specified object. Read-only String.
NoLineBreakAfter | Returns or sets the kinsoku characters after which Microsoft Word will not break a line. Read/write String.
NoLineBreakBefore | Returns or sets the kinsoku characters before which Microsoft Word will not break a line. Read/write String.
OMathBreakBin | Returns or sets a WdOMathBreakBin constant that represents where Microsoft Word places binary operators when equations span two or more lines. Read/write.
OMathBreakSub | Returns or sets a WdOMathBreakSub constant that represents how Microsoft Word handles a subtraction operator that falls before a line break. Read/write.
OMathFontName | Returns or sets a String that represents the name of the font used in a document to display equations. Read/write.
OMathIntSubSupLim | Returns or sets a Boolean that represents the default location of limits for integrals. Read/write.
OMathJc | Returns or sets a WdOMathJc constant that represents the default justification—left, right, centered, or centered as a group—of a group of equations. Read/write.
OMathLeftMargin | Returns or sets a Single that represents the left margin for equations. Read/write.
OMathNarySupSubLim | Returns or sets a Boolean that represents the default location of limits for n-ary objects other than integrals. Read/write.
OMathRightMargin | Returns or sets a Single that represents the right margin for equations. Read/write.
OMaths | Returns an OMaths collection that represents the OMath objects within the specified range. Read-only.
OMathSmallFrac | Returns or sets a Boolean that represents whether to use small fractions in equations contained within the document. Read/write.
OMathWrap | Returns or sets a Single that represents the placement of the second line of an equation that wraps to a new line. Read/write.
OpenEncoding | Returns the encoding used to open the specified document. Read-only MsoEncoding.
OptimizeForWord97 | True if Microsoft Word optimizes the current document for viewing in Microsoft Word 97 by disabling any incompatible formatting. Read/write Boolean.
OriginalDocumentTitle | Returns a String that represents the document title for the original document after running a legal-blackline document compare function. Read-only.
PageSetup | Returns a PageSetup object that is associated with the specified document.
Paragraphs | Returns a Paragraphs collection that represents all the paragraphs in the specified document. Read-only.
Parent | Returns an Object that represents the parent object of the specified Document object.
Password | Sets a password that must be supplied to open the specified document. Write-only String.
PasswordEncryptionAlgorithm | Returns a String indicating the algorithm Microsoft Word uses for encrypting documents with passwords. Read-only.
PasswordEncryptionFileProperties | True if Microsoft Word encrypts file properties for password-protected documents. Read-only Boolean.
PasswordEncryptionKeyLength | Returns a Long indicating the key length of the algorithm Microsoft Word uses when encrypting documents with passwords. Read-only.
PasswordEncryptionProvider | Returns a String specifying the name of the algorithm encryption provider that Microsoft Word uses when encrypting documents with passwords. Read-only.
Path | Returns the disk or Web path to the document. Read-only String.
Permission | Returns a Permission object that represents the permission settings in the specified document.
PrintFormsData | True if Microsoft Word prints onto a preprinted form only the data entered in the corresponding online form. Read/write Boolean.
PrintPostScriptOverText | True if PRINT field instructions (such as PostScript commands) in a document are to be printed on top of text and graphics when a PostScript printer is used. Read/write Boolean.
PrintRevisions | True if revision marks are printed with the document. False if revision marks aren't printed (that is, tracked changes are printed as if they'd been accepted). Read/write Boolean.
ProtectionType | Returns the protection type for the specified document. Can be one of the following WdProtectionType constants: wdAllowOnlyComments, wdAllowOnlyFormFields, wdAllowOnlyReading, wdAllowOnlyRevisions, or wdNoProtection.
ReadabilityStatistics | Returns a ReadabilityStatistics collection that represents the readability statistics for the specified document or range. Read-only.
ReadingLayoutSizeX | Sets or returns a Long that represents the width of pages in a document when it is displayed in reading layout view and is frozen for entering handwritten markup.
ReadingLayoutSizeY | Sets or returns a Long that represents the height of pages in a document when it is displayed in reading layout view and is frozen for entering handwritten markup.
ReadingModeLayoutFrozen | Sets or returns a Boolean that represents whether pages displayed in reading layout view are frozen to a specified size for inserting handwritten markup into a document.
ReadOnly | True if changes to the document cannot be saved to the original document. Read-only Boolean.
ReadOnlyRecommended | True if Microsoft Word displays a message box whenever a user opens the document, suggesting that it be opened as read-only. Read/write Boolean.
RemoveDateAndTime | Sets or returns a Boolean indicating whether a document stores the date and time metadata for tracked changes. .
RemovePersonalInformation | True if Microsoft Word removes all user information from comments, revisions, and the Properties dialog box upon saving a document. Read/write Boolean.
Research | Returns a Research object that represents the research service for a document. Read-only.
RevisedDocumentTitle | Returns a String that represents the document title for a revised document after running a legal-blackline document compare function. Read-only.
Revisions | Returns a Revisions collection that represents the tracked changes in the document or range. Read-only.
Saved | True if the specified document or template has not changed since it was last saved. False if Microsoft Word displays a prompt to save changes when the document is closed. Read/write Boolean.
SaveEncoding | Returns or sets the encoding to use when saving a document. Read/write MsoEncoding.
SaveFormat | Returns the file format of the specified document or file converter. Read-only Long.
SaveFormsData | True if Microsoft Word saves the data entered in a form as a tab-delimited record for use in a database. Read/write Boolean.
SaveSubsetFonts | True if Microsoft Word saves a subset of the embedded TrueType fonts with the document. Read/write Boolean.
Scripts | Returns a Scripts collection that represents the collection of HTML scripts in the specified object.
Sections | Returns a Section collection that represents the sections in the specified document. Read-only.
Sentences | Returns a Sentences collection that represents all the sentences in the document. Read-only.
ServerPolicy | Returns a ServerPolicy object that represents a policy specified for a document stored on a server running Microsoft Office SharePoint Server 2007. Read-only.
Shapes | Returns a Shapes collection that represents all the Shape objects in the specified document. Read-only.
ShowGrammaticalErrors | True if grammatical errors are marked by a wavy green line in the specified document. Read/write Boolean.
ShowSpellingErrors | True if Microsoft Word underlines spelling errors in the document. Read/write Boolean.
Signatures | Returns a SignatureSet collection that represents the digital signatures for a document.
SmartDocument | Returns a SmartDocument object that represents the settings for a smart document solution.
SnapToGrid | True if AutoShapes or East Asian characters are automatically aligned with an invisible grid when they are drawn, moved, or resized in the specified document. Read/write Boolean.
SnapToShapes | True if Microsoft Word automatically aligns AutoShapes or East Asian characters with invisible gridlines that go through the vertical and horizontal edges of other AutoShapes or East Asian characters in the specified document. Read/write Boolean.
SpellingChecked | True if spelling has been checked throughout the specified range or document. False if all or some of the range or document has not been checked for spelling. Read/write Boolean.
SpellingErrors | Returns a ProofreadingErrors collection that represents the words identified as spelling errors in the specified document or range. Read-only.
StoryRanges | Returns a StoryRanges collection that represents all the stories in the specified document. Read-only.
Styles | Returns a Styles collection for the specified document. Read-only.
StyleSheets | Returns a StyleSheets collection that represents the Web style sheets attached to a document.
StyleSortMethod | Returns or sets aWdStyleSort constant that represents the sort method to use when sorting styles in the Styles task pane. Read/write.
Subdocuments | Returns a Subdocuments collection that represents all the subdocuments in the specified document. Read-only.
Sync | This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.
Tables | Returns a Table collection that represents all the tables in the specified document. Read-only.
TablesOfAuthorities | Returns a TableOfAuthorities collection that represents the tables of authorities in the specified document. Read-only.
TablesOfAuthoritiesCategories | Returns a TablesOfAuthoritiesCategories collection that represents the available table of authorities categories for the specified document. Read-only.
TablesOfContents | Returns a TablesOfContents collection that represents the tables of contents in the specified document. Read-only.
TablesOfFigures | Returns a TablesOfFigures collection that represents the tables of figures in the specified document. Read-only.
TextEncoding | Returns or sets the code page, or character set, that Microsoft Word uses for a document saved as an encoded text file. Read/write MsoEncoding.
TextLineEnding | Returns or sets a WdLineEndingType constant indicating how Microsoft Word marks the line and paragraph breaks in documents saved as text files. Read/write.
TrackFormatting | Returns or sets a Boolean that represents whether to track formatting changes when change tracking is turned on. Read/write.
TrackMoves | Returns or sets a Boolean that represents whether to mark moved text when Track Changes is turned on. Read/write.
TrackRevisions | True if changes are tracked in the specified document. Read/write Boolean.
Type | Returns the document type (template or document). Read-only WdDocumentType.
UpdateStylesOnOpen | True if the styles in the specified document are updated to match the styles in the attached template each time the document is opened. Read/write Boolean.
UseMathDefaults | Returns or sets a Boolean that represents whether to use the default math settings when creating new equations. Read/write.
UserControl | True if the document was created or opened by the user. Read/write Boolean.
Variables | Returns a Variables collection that represents the variables stored in the specified document. Read-only.
VBASigned | True if the Microsoft Visual Basic for Applications (VBA) project for the specified document has been digitally signed. Read-only Boolean.
VBProject | Returns the VBProject object for the specified template or document.
WebOptions | Returns the WebOptions object, which contains document-level attributes used by Microsoft Word when you save a document as a Web page or open a Web page. Read-only.
Windows | Returns a Windows collection that represents all windows for the specified document. Read-only.
WordOpenXML | Returns a String that represents the flat XML format for the Word Open XML contents of the document. Read-only.
Words | Returns a Words collection that represents all the words in a document. Read-only.
WritePassword | Sets a password for saving changes to the specified document. Write-only String.
WriteReserved | True if the specified document is protected with a write password. Read-only Boolean.
XMLSaveThroughXSLT | Sets or returns a String that specifies the path and file name for the Extensible Stylesheet Language Transformation (XSLT) to apply when a user saves a document.
XMLSchemaReferences | Returns an XMLSchemaReferences collection that represents the schemas attached to a document.
XMLShowAdvancedErrors | Returns or sets a Boolean that represents whether error message text is generated from the built-in Microsoft Word error messages or from the Microsoft XML Core Services (MSXML) 5.0 component included with Office.
XMLUseXSLTWhenSaving | Returns a Boolean that represents whether to save a document through an Extensible Stylesheet Language Transformation (XSLT). True saves a document through an XSLT.


Document Properties (Word)

 Copy code hover
[image]

Document Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
ActiveTheme | Returns the name of the active theme plus the theme formatting options for the specified document. Read-only String.
ActiveThemeDisplayName | Returns the display name of the active theme for the specified document. Read-only String.
ActiveWindow | Returns a Window object that represents the active window (the window with the focus). Read-only.
ActiveWritingStyle | Returns or sets the writing style for a specified language in the specified document. Read/write String.
Application | Returns an Application object that represents the Microsoft Word application.
AttachedTemplate | Returns a Template object that represents the template attached to the specified document. Read/write Variant.
AutoFormatOverride | Returns or sets a Boolean that represents whether automatic formatting options override formatting restrictions in a document where formatting restrictions are in effect.
AutoHyphenation | True if automatic hyphenation is turned on for the specified document. Read/write Boolean.
Background | Returns a Shape object that represents the background image for the specified document. Read-only.
Bibliography | Returns a Bibliography object that represents the bibliography references contained within a document. Read-only.
Bookmarks | Returns a Bookmarks collection that represents all the bookmarks in a document. Read-only.
Broadcast | Returns a Broadcast object that represents a broadcast session, in which presenters can present Microsoft Word 2013 documents to remote participants over the web without the participants needing to have rich clients installed.
BuiltInDocumentProperties | Returns a DocumentProperties collection that represents all the built-in document properties for the specified document.
Characters | Returns a Characters collection that represents the characters in a document. Read-only.
ChartDataPointTrack | Returns or sets a Boolean that specifies whether charts in the active document use cell-reference data-point tracking. Read-write.
ClickAndTypeParagraphStyle | Returns or sets the default paragraph style applied to text by the Click and Type feature in the specified document. Read/write Variant.
CoAuthoring | Returns a CoAuthoring object that provides the entry point into the co-authoring object model. Read-only.
CodeName | Returns the code name for the specified document. Read-only String.
CommandBars | Returns a CommandBars collection that represents the menu bar and all the toolbars in Microsoft Word.
Comments | Returns a Comments collection that represents all the comments in the specified document. Read-only.
Compatibility | True if the compatibility option specified by the Type argument is enabled. Compatibility options affect how a document is displayed in Microsoft Word. Read/write Boolean.
CompatibilityMode | Returns a Long that specifies the compatibility mode that Word 2010 uses when opening the document. Read-only.
ConsecutiveHyphensLimit | Returns or sets the maximum number of consecutive lines that can end with hyphens. Read/write. Long.
Container | Returns the object that represents the container application for the specified document. Read-only Object.
Content | Returns a Range object that represents the main document story. Read-only.
ContentControls | Returns a ContentControls collection that represents all the content controls in a document. Read-only.
ContentTypeProperties | Returns a MetaProperties collection that represents the metadata stored in a document, such as author name, subject, and company. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
CurrentRsid | Returns a Long that represents a random number that Word assigns to changes in a document. Read-only.
CustomDocumentProperties | Returns a DocumentProperties collection that represents all the custom document properties for the specified document.
CustomXMLParts | Returns a CustomXMLParts collection that represents the custom XML in the XML data store. Read-only.
DefaultTableStyle | Returns a Variant that represents the table style that is applied to all newly created tables in a document. Read-only.
DefaultTabStop | Returns or sets the interval (in points) between the default tab stops in the specified document. Read/write Single.
DefaultTargetFrame | Returns or sets a String indicating the browser frame in which to display a Web page reached through a hyperlink. Read/write.
DisableFeatures | True disables all features introduced after the version specified in the DisableFeaturesIntroducedAfter property. The default value is False. Read/write Boolean.
DisableFeaturesIntroducedAfter | Disables all features introduced after a specified version of Microsoft Word in the document only. Read/write WdDisableFeaturesIntroducedAfter.
DocumentInspectors | Returns a DocumentInspectors collection that enables you to locate hidden personal information, such as author name, company name, and revision date. Read-only.
DocumentLibraryVersions | Returns a DocumentLibraryVersions collection that represents the collection of versions of a shared document that has versioning enabled and that is stored in a document library on a server.
DocumentTheme | Returns an OfficeTheme object that represents the Microsoft Office theme applied to a document. Read-only.
DoNotEmbedSystemFonts | True for Microsoft Word to not embed common system fonts. Read/write Boolean.
Email | Returns an Email object that contains all the e-mail-related properties of the current document. Read-only.
EmbedLinguisticData | True for Microsoft Word to embed speech and handwriting so that data can be converted back to speech or handwriting. Read/write Boolean.
EmbedTrueTypeFonts | True if Microsoft Word embeds TrueType fonts in a document when it is saved. Read/write Boolean.
EncryptionProvider | Returns a String specifying the name of the algorithm encryption provider that Microsoft Word uses when encrypting documents. Read/write.
Endnotes | Returns an Endnotes collection that represents all the endnotes in a document. Read-only.
EnforceStyle | Returns or sets a Boolean that represents whether formatting restrictions are enforced in a protected document.
Envelope | Returns an Envelope object that represents an envelope and envelope features in a document. Read-only.
FarEastLineBreakLanguage | Returns or sets a WdFarEastLineBreakLanguageID that represents the East Asian language to use when breaking lines of text in the specified document or template. Read/write.
FarEastLineBreakLevel | Returns or sets a WdFarEastLineBreakLevel that represents the line break control level for the specified document. Read/write.
Fields | Returns a Fields collection that represents all the fields in the document. Read-only.
Final | Returns or sets a Boolean that indicates whether a document is final. Read/write.
Footnotes | Returns a Footnotes collection that represents all the footnotes in a document. Read-only.
FormattingShowClear | True for Microsoft Word to show clear formatting in the Styles and Formatting task pane. Read/write Boolean.
FormattingShowFilter | Sets or returns a WdShowFilter constant that represents the styles and formatting displayed in the Styles and Formatting task pane. Read/write Boolean.
FormattingShowFont | True for Microsoft Word to display font formatting in the Styles and Formatting task pane. Read/write Boolean.
FormattingShowNextLevel | Returns or sets a Boolean that represents whether Microsoft Word shows the next heading level when the previous heading level is used. Read/write.
FormattingShowNumbering | True for Microsoft Word to display number formatting in the Styles and Formatting task pane. Read/write Boolean.
FormattingShowParagraph | True for Microsoft Word to display paragraph formatting in the Styles and Formatting task pane. Read/write Boolean.
FormattingShowUserStyleName | Returns or sets a Boolean that represents whether to show user-defined styles. Read/write.
FormFields | Returns a FormFields collection that represents all the form fields in the document. Read-only.
FormsDesign | True if the specified document is in form design mode. Read-only Boolean.
Frames | Returns a Frames collection that represents all the frames in a document. Read-only.
Frameset | Returns a Frameset object that represents an entire frames page or a single frame on a frames page. Read-only.
FullName | Returns a String that represents the name of a document, including the path. Read-only.
GrammarChecked | True if a grammar check has been run on the specified range or document. Read/write Boolean.
GrammaticalErrors | Returns a ProofreadingErrors collection that represents the sentences that failed the grammar check in the specified document. Read-only.
GridDistanceHorizontal | Returns or sets a Single that represents the amount of horizontal space between the invisible gridlines that Microsoft Word uses when you draw, move, and resize AutoShapes or East Asian characters in the specified document. Read/write.
GridDistanceVertical | Returns or sets a Single that represents the amount of vertical space between the invisible gridlines that Microsoft Word uses when you draw, move, and resize AutoShapes or East Asian characters in the specified document. Read/write.
GridOriginFromMargin | True if Microsoft Word starts the character grid from the upper-left corner of the page. Read/write Boolean.
GridOriginHorizontal | Returns or sets a Single that represents the point, relative to the left edge of the page, where you want the invisible grid for drawing, moving, and resizing AutoShapes or East Asian characters to begin in the specified document. Read/write.
GridOriginVertical | Returns or sets a Single that represents the point, relative to the top of the page, where you want the invisible grid for drawing, moving, and resizing AutoShapes or East Asian characters to begin in the specified document. Read/write.
GridSpaceBetweenHorizontalLines | Returns or sets the interval at which Microsoft Word displays horizontal character gridlines in print layout view. Read/write Long.
GridSpaceBetweenVerticalLines | Returns or sets the interval at which Microsoft Word displays vertical character gridlines in print layout view. Read/write Long.
HasPassword | True if a password is required to open the specified document. Read-only Boolean.
HasVBProject | Returns a Boolean that represents whether a document has an attached Microsoft Visual Basic for Applications project. Read-only.
HTMLDivisions | Returns an HTMLDivisions collection that represents the HTML DIV elements in a Web document.
Hyperlinks | Returns a Hyperlinks collection that represents all the hyperlinks in the specified document. Read-only.
HyphenateCaps | True if words in all capital letters can be hyphenated. Read/write Boolean.
HyphenationZone | Returns or sets the width of the hyphenation zone, in points. Read/write Long.
Indexes | Returns an Indexes collection that represents all the indexes in the specified document. Read-only.
InlineShapes | Returns an InlineShapes collection that represents all the InlineShape objects in a document. Read-only.
IsInAutosave | Returns False if the most recent firing of the Application.DocumentBeforeSave Event (Word) event was the result of a manual save by the user, and not an automatic save. Read-only.
IsMasterDocument | True if the specified document is a master document. Read-only Boolean.
IsSubdocument | True if the specified document is a subdocument of a master document. Read-only Boolean.
JustificationMode | Returns or sets the character spacing adjustment for the specified document. Read/write WdJustificationMode.
KerningByAlgorithm | True if Microsoft Word kerns half-width Latin characters and punctuation marks in the specified document. Read/write Boolean.
Kind | Returns or sets the format type that Microsoft Word uses when automatically formatting the specified document. Read/write WdDocumentKind.
LanguageDetected | Returns or sets a value that specifies whether Microsoft Word has detected the language of the specified text. Read/write Boolean.
ListParagraphs | Returns a ListParagraphsobject that represents all the numbered paragraphs in a document. Read-only.
Lists | Returns a Lists collection that contains all the formatted lists in the specified document. Read-only.
ListTemplates | Returns a ListTemplates collection that represents all the list formats for the specified document. Read-only.
LockQuickStyleSet | Returns or sets a Boolean that represents whether users can change which set of Quick Styles is being used. Read/write.
LockTheme | Returns or sets a Boolean that represents whether a user can change a document theme. Read/write.
MailEnvelope | Returns an MsoEnvelope object that represents an e-mail header for a document.
MailMerge | Returns a MailMerge object that represents the mail merge functionality for the specified document. Read-only.
Name | Returns the name of the specified object. Read-only String.
NoLineBreakAfter | Returns or sets the kinsoku characters after which Microsoft Word will not break a line. Read/write String.
NoLineBreakBefore | Returns or sets the kinsoku characters before which Microsoft Word will not break a line. Read/write String.
OMathBreakBin | Returns or sets a WdOMathBreakBin constant that represents where Microsoft Word places binary operators when equations span two or more lines. Read/write.
OMathBreakSub | Returns or sets a WdOMathBreakSub constant that represents how Microsoft Word handles a subtraction operator that falls before a line break. Read/write.
OMathFontName | Returns or sets a String that represents the name of the font used in a document to display equations. Read/write.
OMathIntSubSupLim | Returns or sets a Boolean that represents the default location of limits for integrals. Read/write.
OMathJc | Returns or sets a WdOMathJc constant that represents the default justification—left, right, centered, or centered as a group—of a group of equations. Read/write.
OMathLeftMargin | Returns or sets a Single that represents the left margin for equations. Read/write.
OMathNarySupSubLim | Returns or sets a Boolean that represents the default location of limits for n-ary objects other than integrals. Read/write.
OMathRightMargin | Returns or sets a Single that represents the right margin for equations. Read/write.
OMaths | Returns an OMaths collection that represents the OMath objects within the specified range. Read-only.
OMathSmallFrac | Returns or sets a Boolean that represents whether to use small fractions in equations contained within the document. Read/write.
OMathWrap | Returns or sets a Single that represents the placement of the second line of an equation that wraps to a new line. Read/write.
OpenEncoding | Returns the encoding used to open the specified document. Read-only MsoEncoding.
OptimizeForWord97 | True if Microsoft Word optimizes the current document for viewing in Microsoft Word 97 by disabling any incompatible formatting. Read/write Boolean.
OriginalDocumentTitle | Returns a String that represents the document title for the original document after running a legal-blackline document compare function. Read-only.
PageSetup | Returns a PageSetup object that is associated with the specified document.
Paragraphs | Returns a Paragraphs collection that represents all the paragraphs in the specified document. Read-only.
Parent | Returns an Object that represents the parent object of the specified Document object.
Password | Sets a password that must be supplied to open the specified document. Write-only String.
PasswordEncryptionAlgorithm | Returns a String indicating the algorithm Microsoft Word uses for encrypting documents with passwords. Read-only.
PasswordEncryptionFileProperties | True if Microsoft Word encrypts file properties for password-protected documents. Read-only Boolean.
PasswordEncryptionKeyLength | Returns a Long indicating the key length of the algorithm Microsoft Word uses when encrypting documents with passwords. Read-only.
PasswordEncryptionProvider | Returns a String specifying the name of the algorithm encryption provider that Microsoft Word uses when encrypting documents with passwords. Read-only.
Path | Returns the disk or Web path to the document. Read-only String.
Permission | Returns a Permission object that represents the permission settings in the specified document.
PrintFormsData | True if Microsoft Word prints onto a preprinted form only the data entered in the corresponding online form. Read/write Boolean.
PrintPostScriptOverText | True if PRINT field instructions (such as PostScript commands) in a document are to be printed on top of text and graphics when a PostScript printer is used. Read/write Boolean.
PrintRevisions | True if revision marks are printed with the document. False if revision marks aren't printed (that is, tracked changes are printed as if they'd been accepted). Read/write Boolean.
ProtectionType | Returns the protection type for the specified document. Can be one of the following WdProtectionType constants: wdAllowOnlyComments, wdAllowOnlyFormFields, wdAllowOnlyReading, wdAllowOnlyRevisions, or wdNoProtection.
ReadabilityStatistics | Returns a ReadabilityStatistics collection that represents the readability statistics for the specified document or range. Read-only.
ReadingLayoutSizeX | Sets or returns a Long that represents the width of pages in a document when it is displayed in reading layout view and is frozen for entering handwritten markup.
ReadingLayoutSizeY | Sets or returns a Long that represents the height of pages in a document when it is displayed in reading layout view and is frozen for entering handwritten markup.
ReadingModeLayoutFrozen | Sets or returns a Boolean that represents whether pages displayed in reading layout view are frozen to a specified size for inserting handwritten markup into a document.
ReadOnly | True if changes to the document cannot be saved to the original document. Read-only Boolean.
ReadOnlyRecommended | True if Microsoft Word displays a message box whenever a user opens the document, suggesting that it be opened as read-only. Read/write Boolean.
RemoveDateAndTime | Sets or returns a Boolean indicating whether a document stores the date and time metadata for tracked changes. .
RemovePersonalInformation | True if Microsoft Word removes all user information from comments, revisions, and the Properties dialog box upon saving a document. Read/write Boolean.
Research | Returns a Research object that represents the research service for a document. Read-only.
RevisedDocumentTitle | Returns a String that represents the document title for a revised document after running a legal-blackline document compare function. Read-only.
Revisions | Returns a Revisions collection that represents the tracked changes in the document or range. Read-only.
Saved | True if the specified document or template has not changed since it was last saved. False if Microsoft Word displays a prompt to save changes when the document is closed. Read/write Boolean.
SaveEncoding | Returns or sets the encoding to use when saving a document. Read/write MsoEncoding.
SaveFormat | Returns the file format of the specified document or file converter. Read-only Long.
SaveFormsData | True if Microsoft Word saves the data entered in a form as a tab-delimited record for use in a database. Read/write Boolean.
SaveSubsetFonts | True if Microsoft Word saves a subset of the embedded TrueType fonts with the document. Read/write Boolean.
Scripts | Returns a Scripts collection that represents the collection of HTML scripts in the specified object.
Sections | Returns a Section collection that represents the sections in the specified document. Read-only.
Sentences | Returns a Sentences collection that represents all the sentences in the document. Read-only.
ServerPolicy | Returns a ServerPolicy object that represents a policy specified for a document stored on a server running Microsoft Office SharePoint Server 2007. Read-only.
Shapes | Returns a Shapes collection that represents all the Shape objects in the specified document. Read-only.
ShowGrammaticalErrors | True if grammatical errors are marked by a wavy green line in the specified document. Read/write Boolean.
ShowSpellingErrors | True if Microsoft Word underlines spelling errors in the document. Read/write Boolean.
Signatures | Returns a SignatureSet collection that represents the digital signatures for a document.
SmartDocument | Returns a SmartDocument object that represents the settings for a smart document solution.
SnapToGrid | True if AutoShapes or East Asian characters are automatically aligned with an invisible grid when they are drawn, moved, or resized in the specified document. Read/write Boolean.
SnapToShapes | True if Microsoft Word automatically aligns AutoShapes or East Asian characters with invisible gridlines that go through the vertical and horizontal edges of other AutoShapes or East Asian characters in the specified document. Read/write Boolean.
SpellingChecked | True if spelling has been checked throughout the specified range or document. False if all or some of the range or document has not been checked for spelling. Read/write Boolean.
SpellingErrors | Returns a ProofreadingErrors collection that represents the words identified as spelling errors in the specified document or range. Read-only.
StoryRanges | Returns a StoryRanges collection that represents all the stories in the specified document. Read-only.
Styles | Returns a Styles collection for the specified document. Read-only.
StyleSheets | Returns a StyleSheets collection that represents the Web style sheets attached to a document.
StyleSortMethod | Returns or sets aWdStyleSort constant that represents the sort method to use when sorting styles in the Styles task pane. Read/write.
Subdocuments | Returns a Subdocuments collection that represents all the subdocuments in the specified document. Read-only.
Sync | This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.
Tables | Returns a Table collection that represents all the tables in the specified document. Read-only.
TablesOfAuthorities | Returns a TableOfAuthorities collection that represents the tables of authorities in the specified document. Read-only.
TablesOfAuthoritiesCategories | Returns a TablesOfAuthoritiesCategories collection that represents the available table of authorities categories for the specified document. Read-only.
TablesOfContents | Returns a TablesOfContents collection that represents the tables of contents in the specified document. Read-only.
TablesOfFigures | Returns a TablesOfFigures collection that represents the tables of figures in the specified document. Read-only.
TextEncoding | Returns or sets the code page, or character set, that Microsoft Word uses for a document saved as an encoded text file. Read/write MsoEncoding.
TextLineEnding | Returns or sets a WdLineEndingType constant indicating how Microsoft Word marks the line and paragraph breaks in documents saved as text files. Read/write.
TrackFormatting | Returns or sets a Boolean that represents whether to track formatting changes when change tracking is turned on. Read/write.
TrackMoves | Returns or sets a Boolean that represents whether to mark moved text when Track Changes is turned on. Read/write.
TrackRevisions | True if changes are tracked in the specified document. Read/write Boolean.
Type | Returns the document type (template or document). Read-only WdDocumentType.
UpdateStylesOnOpen | True if the styles in the specified document are updated to match the styles in the attached template each time the document is opened. Read/write Boolean.
UseMathDefaults | Returns or sets a Boolean that represents whether to use the default math settings when creating new equations. Read/write.
UserControl | True if the document was created or opened by the user. Read/write Boolean.
Variables | Returns a Variables collection that represents the variables stored in the specified document. Read-only.
VBASigned | True if the Microsoft Visual Basic for Applications (VBA) project for the specified document has been digitally signed. Read-only Boolean.
VBProject | Returns the VBProject object for the specified template or document.
WebOptions | Returns the WebOptions object, which contains document-level attributes used by Microsoft Word when you save a document as a Web page or open a Web page. Read-only.
Windows | Returns a Windows collection that represents all windows for the specified document. Read-only.
WordOpenXML | Returns a String that represents the flat XML format for the Word Open XML contents of the document. Read-only.
Words | Returns a Words collection that represents all the words in a document. Read-only.
WritePassword | Sets a password for saving changes to the specified document. Write-only String.
WriteReserved | True if the specified document is protected with a write password. Read-only Boolean.
XMLSaveThroughXSLT | Sets or returns a String that specifies the path and file name for the Extensible Stylesheet Language Transformation (XSLT) to apply when a user saves a document.
XMLSchemaReferences | Returns an XMLSchemaReferences collection that represents the schemas attached to a document.
XMLShowAdvancedErrors | Returns or sets a Boolean that represents whether error message text is generated from the built-in Microsoft Word error messages or from the Microsoft XML Core Services (MSXML) 5.0 component included with Office.
XMLUseXSLTWhenSaving | Returns a Boolean that represents whether to save a document through an Extensible Stylesheet Language Transformation (XSLT). True saves a document through an XSLT.


Document.ActiveTheme Property (Word)

 Copy code hover
[image]

Document.ActiveTheme Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the name of the active theme plus the theme formatting options for the specified document. Read-only String.

Syntax

expression .ActiveTheme

expression A variable that represents a Document object.

Remarks

The ActiveTheme property returns "none" if the document doesn't have an active theme. For an explanation of the value returned by this property, see the Name argument of the ApplyTheme method. The value returned by this property may not correspond to the theme's display name. To return a theme's display name, use the ActiveThemeDisplayName property.

Example

This example applies a theme and then displays the name of the active theme plus the theme formatting options for the current document.

VBA Copy code Copy code
Sub CheckTheme()
 ActiveDocument.ApplyTheme "artsy 100"
 MsgBox ActiveDocument.ActiveTheme
End Sub

See also

Concepts

Document Object

Other resources

Document Object Members


Document.ActiveThemeDisplayName Property (Word)

 Copy code hover
[image]

Document.ActiveThemeDisplayName Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the display name of the active theme for the specified document. Read-only String.

Syntax

expression .ActiveThemeDisplayName

expression A variable that represents a Document object.

Remarks

The ActiveThemeDisplayName property returns "none" if the document doesn't have an active theme. A theme's display name is the name that appears in the Theme dialog box. This name may not correspond to the string you would use to set a default theme or to apply a theme to a document.

Example

This example returns the display name of the active theme for the current document.

VBA Copy code Copy code
Sub DisplayThemeName()
 ActiveDocument.ApplyTheme "artsy 100"
 MsgBox ActiveDocument.ActiveThemeDisplayName
End Sub

See also

Concepts

Document Object

Other resources

Document Object Members


Document.ActiveWindow Property (Word)

 Copy code hover
[image]

Document.ActiveWindow Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Window object that represents the active window (the window with the focus). Read-only.

Syntax

expression .ActiveWindow

expression A variable that represents a Document object.

Remarks

If there are no windows open, using the ActiveWindow property generates an error occurs.

Example

This example displays the caption text for the active window.

VBA Copy code Copy code
Sub WindowCaption()
 MsgBox ActiveDocument.ActiveWindow.Caption
End Sub

This example opens a new window for the active window of the active document and then tiles all the windows.

VBA Copy code Copy code
Sub WindowTiled()
 Dim wndTileWindow As Window

 Set wndTileWindow = ActiveDocument.ActiveWindow.NewWindow
 Windows.Arrange ArrangeStyle:=wdTiled
End Sub

This example splits the first document window.

VBA Copy code Copy code
Sub WindowSplit()
 Documents(1).ActiveWindow.Split = True
End Sub

See also

Concepts

Document Object

Other resources

Document Object Members


Document.ActiveWritingStyle Property (Word)

 Copy code hover
[image]

Document.ActiveWritingStyle Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the writing style for a specified language in the specified document. Read/write String.

Syntax

expression .ActiveWritingStyle(LanguageID)

expression Required. A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
LanguageID | Required | Variant | The language to set the writing style for in the specified document. Can be either a string or one of the following WdLanguageID constants. Some of the WdLanguageID constants may not be available to you, depending on the language support (U.S. English, for example) that you have selected or installed.

Remarks

The WritingStyleList property returns an array of the names of the available writing styles.

Example

This example sets the writing style used for French, German, and U.S. English for the active document. You must have the grammar files installed for French, German, and U.S. English to run this example.

VBA Copy code Copy code
With ActiveDocument
 .ActiveWritingStyle(wdFrench) = "Commercial"
 .ActiveWritingStyle(wdGerman) = "Technisch/Wiss"
 .ActiveWritingStyle(wdEnglishUS) = "Technical"
End With

This example returns the writing style for the language of the selection.

VBA Copy code Copy code
Sub WhichLanguage()
 Dim varLang As Variant

 varLang = Selection.LanguageID
 MsgBox ActiveDocument.ActiveWritingStyle(varLang)
End Sub

See also

Concepts

Document Object

Other resources

Document Object Members


Document.Application Property (Word)

 Copy code hover
[image]

Document.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a Document object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

Document Object

Other resources

Document Object Members


Document.AttachedTemplate Property (Word)

 Copy code hover
[image]

Document.AttachedTemplate Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Template object that represents the template attached to the specified document. Read/write Variant.

Syntax

expression .AttachedTemplate

expression A variable that represents a Document object.

Remarks

To set this property, specify either the name of the template or an expression that returns a Template object.

Example

This example displays the name and path of the template attached to the active document.

VBA Copy code Copy code
Set myTemplate = ActiveDocument.AttachedTemplate
MsgBox myTemplate.Path & Application.PathSeparator _
 & myTemplate.Name

This example inserts the contents of the Spike (a built-in AutoText entry) at the beginning of document one.

VBA Copy code Copy code
Set myRange = Documents(1).Range(0, 0)
Documents(1).AttachedTemplate.AutoTextEntries("Spike") _
 .Insert myRange

This example attaches the template "Letter.dot" to the active document.

VBA Copy code Copy code
ActiveDocument.AttachedTemplate = "C:\Templates\Letter.dot"

See also

Concepts

Document Object

Other resources

Document Object Members


Document.AutoFormatOverride Property (Word)

 Copy code hover
[image]

Document.AutoFormatOverride Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents whether automatic formatting options override formatting restrictions in a document where formatting restrictions are in effect.

Syntax

expression .AutoFormatOverride

expression A variable that represents a Document object.

Example

The following specifies that automatic formatting will override formatting restrictions in a protected document.

VBA Copy code Copy code
ActiveDocument.AutoFormatOverride = True

See also

Concepts

Document Object

Other resources

Document Object Members


Document.AutoHyphenation Property (Word)

 Copy code hover
[image]

Document.AutoHyphenation Property (Word)
See also Send feedback

Published: July 16, 2012

True if automatic hyphenation is turned on for the specified document. Read/write Boolean.

Syntax

expression .AutoHyphenation

expression A variable that represents a Document object.

Example

This example turns on automatic hyphenation, with a hyphenation zone of 0.25 inch. Words in all capital letters aren't hyphenated.

VBA Copy code Copy code
With ActiveDocument
 .HyphenationZone = InchesToPoints(0.25)
 .HyphenateCaps = False
 .AutoHyphenation = True
End With

See also

Concepts

Document Object

Other resources

Document Object Members


Document.Background Property (Word)

 Copy code hover
[image]

Document.Background Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Shape object that represents the background image for the specified document. Read-only.

Syntax

expression .Background

expression A variable that represents a Document object.

Remarks

Backgrounds are visible only in Web layout view.

Example

This example sets the background color for Web layout view to light gray for the active window.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.View.Type = wdWebView
With ActiveDocument.Background.Fill
 .Visible = True
 .ForeColor.RGB = RGB(192, 192, 192)
End With

This example sets the background bitmap image of Web layout view to Bubbles.bmp.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.View.Type = wdWebView
ActiveDocument.Background.Fill.UserPicture _
 PictureFile:="C:\Windows\Bubbles.bmp"

See also

Concepts

Document Object

Other resources

Document Object Members


Document.Bibliography Property (Word)

 Copy code hover
[image]

Document.Bibliography Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Bibliography object that represents the bibliography references contained within a document. Read-only.

Syntax

expression .Bibliography

expression An expression that returns a Document object.

See also

Concepts

Document Object

Other resources

Document Object Members


Document.Bookmarks Property (Word)

 Copy code hover
[image]

Document.Bookmarks Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Bookmarks collection that represents all the bookmarks in a document. Read-only.

Syntax

expression .Bookmarks

expression A variable that represents a Document object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example retrieves the starting and ending character positions for the first bookmark in the active document.

VBA Copy code Copy code
With ActiveDocument.Bookmarks(1)
 BookStart = .Start
 BookEnd = .End
End With

This example uses the aMarks() array to store the name of each bookmark contained in the active document.

VBA Copy code Copy code
If ActiveDocument.Bookmarks.Count >= 1 Then
 ReDim aMarks(ActiveDocument.Bookmarks.Count - 1)
 i = 0
 For Each aBookmark In ActiveDocument.Bookmarks
 aMarks(i) = aBookmark.Name
 i = i + 1
 Next aBookmark
End If

See also

Concepts

Document Object

Other resources

Document Object Members


Document.Broadcast Property (Word)

 Copy code hover
[image]

Document.Broadcast Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Broadcast object that represents a broadcast session, in which presenters can present Microsoft Word 2013 documents to remote participants over the web without the participants needing to have rich clients installed.

Version information

Version Added: Word 2013

Syntax

expression .Broadcast

expression A variable that represents a Document object.

Property value

BROADCAST

See also

Concepts

Document Object

Other resources

Document Members


Document.BuiltInDocumentProperties Property (Word)

 Copy code hover
[image]

Document.BuiltInDocumentProperties Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a DocumentProperties collection that represents all the built-in document properties for the specified document.

Syntax

expression .BuiltInDocumentProperties

expression Required. A variable that represents a Document object.

Remarks

To return a single DocumentProperty object that represents a specific built-in document property, use the BuiltinDocumentProperties property. If Microsoft Word doesn't define a value for one of the built-in document properties, reading the Value property for that document property generates an error.

For information about returning a single member of a collection, see Returning an Object from a Collection.

Use the CustomDocumentProperties property to return the collection of custom document properties.

Example

This example inserts a list of built-in properties at the end of the active document.

VBA Copy code Copy code
Sub ListProperties()
 Dim rngDoc As Range
 Dim proDoc As DocumentProperty

 Set rngDoc = ActiveDocument.Content

 rngDoc.Collapse Direction:=wdCollapseEnd

 For Each proDoc In ActiveDocument.BuiltInDocumentProperties
 With rngDoc
 .InsertParagraphAfter
 .InsertAfter proDoc.Name & "= "
 On Error Resume Next
 .InsertAfter proDoc.Value
 End With
 Next
End Sub

This example displays the number of words in the active document.

VBA Copy code Copy code
Sub DisplayTotalWords()
 Dim intWords As Integer
 intWords = ActiveDocument.BuiltInDocumentProperties(wdPropertyWords)
 MsgBox "This document contains " & intWords & " words."
End Sub

See also

Concepts

Document Object

Other resources

Document Object Members


Document.Characters Property (Word)

 Copy code hover
[image]

Document.Characters Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Characters collection that represents the characters in a document. Read-only.

Syntax

expression .Characters

expression A variable that represents a Document object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example returns the number of characters in the first sentence in the active document (spaces are included in the count).

VBA Copy code Copy code
numchars = ActiveDocument.Characters.Count

See also

Concepts

Document Object

Other resources

Document Object Members


Document.ChartDataPointTrack Property (Word)

 Copy code hover
[image]

Document.ChartDataPointTrack Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that specifies whether charts in the active document use cell-reference data-point tracking. Read-write.

Version information

Version Added: Word 2013

Syntax

expression .ChartDataPointTrack

expression A variable that represents a Document object.

Remarks

In cell-reference data-point tracking, data labels track the cell reference that contains the value of the data point, rather than the index number of the data point. Doing so helps to preserve custom formatting applied by the user, even when a chart is sorted or filtered. Setting ChartDataPointTrack to True specifies that charts in the active document use cell-reference data-point tracking.

Property value

BOOL

See also

Concepts

Document Object

Other resources

Document Object Members


Document.ClickAndTypeParagraphStyle Property (Word)

 Copy code hover
[image]

Document.ClickAndTypeParagraphStyle Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the default paragraph style applied to text by the Click and Type feature in the specified document. Read/write Variant.

Syntax

expression .ClickAndTypeParagraphStyle

expression An expression that returns a Document object.

Remarks

To set the ClickAndTypeParagraphStyle property, specify either the local name of the style, an integer, or a WdBuiltinStyle constant, or an object that represents the style. For a list of the WdBuiltinStyle constants, consult the Microsoft Visual Basic Object Browser.

If the InUse property for the specified style is set to False, an error occurs.

Example

This example sets the default paragraph style applied by Click and Type to Plain Text.

VBA Copy code Copy code
With ActiveDocument
 x = "Plain Text"
 If .Styles(x).InUse Then
 .ClickAndTypeParagraphStyle = x
 Else
 MsgBox "Sorry, this style is not in use yet."
 End If
End With

See also

Concepts

Document Object

Other resources

Document Object Members


Document.CoAuthoring Property (Word)

 Copy code hover
[image]

Document.CoAuthoring Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a CoAuthoring object that provides the entry point into the co-authoring object model. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .CoAuthoring

expression An expression that returns a Document object.

Remarks

The CoAuthoring object provides information about co-authoring at the document level. For example, the CoAuthoring object can provide information about whether there are any locks in the document, which users have current locks on the document, or whether or not updates to the document content is available from the server. Use the CoAuthoring property to return the CoAuthoring object.

Example

The following code example gets a reference to the CoAuthoring object through the CoAuthoring property of the active document.

VBA Copy code Copy code
Dim coAuth As CoAuthoring
Set coAuth = ActiveDocument.CoAuthoring

See also

Concepts

Document Object

Other resources

Document Object Members


Document.CodeName Property (Word)

 Copy code hover
[image]

Document.CodeName Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the code name for the specified document. Read-only String.

Syntax

expression .CodeName

expression A variable that represents a Document object.

Remarks

The code name is the name for the module that houses event macros for a document. The default name for the module is "ThisDocument"; you can view it in the Project window. For information about using events with the Document object, see Using Events with the Document Object.

Example

This example returns the name of the code window for the active document.

VBA Copy code Copy code
Msgbox ActiveDocument.CodeName

See also

Concepts

Document Object

Other resources

Document Object Members


Document.CommandBars Property (Word)

 Copy code hover
[image]

Document.CommandBars Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a CommandBars collection that represents the menu bar and all the toolbars in Microsoft Word.

Syntax

expression .CommandBars

expression Required. A variable that represents a Document object.

Remarks

Use the CustomizationContext property to set the template or document context prior to accessing the CommandBars collection.

For information about returning a single member of a collection, see Returning an Object from a Collection .

Example

This example enlarges all command bar buttons and enables ToolTips.

VBA Copy code Copy code
With CommandBars
 .LargeButtons = True
 .DisplayTooltips = True
End With

This example displays the Drawing toolbar at the bottom of the application window.

VBA Copy code Copy code
With CommandBars("Drawing")
 .Visible = True
 .Position = msoBarBottom
End With

This example adds the Versions command button to the Standard toolbar.

VBA Copy code Copy code
CustomizationContext = NormalTemplate
CommandBars("Standard").Controls.Add Type:=msoControlButton, _
 ID:=2522, Before:=4

See also

Concepts

Document Object

Other resources

Document Object Members


Document.Comments Property (Word)

 Copy code hover
[image]

Document.Comments Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Comments collection that represents all the comments in the specified document. Read-only.

Syntax

expression .Comments

expression A variable that represents a Document object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example compares the author name of each comment in the active document with the user name on the User Information tab in the Options dialog box (Tools menu). If the names aren't the same, the comment reference mark is formatted to appear in red.

VBA Copy code Copy code
For Each comm In ActiveDocument.Comments
 If comm.Author <> Application.UserName Then _
 comm.Reference.Font.ColorIndex = wdRed
Next comm

See also

Concepts

Document Object

Other resources

Document Object Members


Document.Compatibility Property (Word)

 Copy code hover
[image]

Document.Compatibility Property (Word)
See also Send feedback

Published: July 16, 2012

True if the compatibility option specified by the Type argument is enabled. Compatibility options affect how a document is displayed in Microsoft Word. Read/write Boolean.

Syntax

expression .Compatibility(Type)

expression Required. A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
Type | Required | WdCompatibility | The compatibility option.

Remarks

Some of the constants listed above may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.

Example

This example enables the Suppress Space Before after a hard page or column break option on the Compatibility tab in the Options dialog box (Tools menu) for the active document.

VBA Copy code Copy code
ActiveDocument.Compatibility(wdSuppressSpBfAfterPgBrk) = True

This example switches the Don't add automatic tab stop for hanging indent option on or off.

VBA Copy code Copy code
ActiveDocument.Compatibility(wdNoTabHangIndent) = Not _
 ActiveDocument.Compatibility(wdNoTabHangIndent)

See also

Concepts

Document Object

Other resources

Document Object Members


Document.CompatibilityMode Property (Word)

 Copy code hover
[image]

Document.CompatibilityMode Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that specifies the compatibility mode that Word 2010 uses when opening the document. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .CompatibilityMode

expression An expression that returns a Document object.

Remarks

When you open a document in Word 2010 that was created in a previous version of Word, Compatibility Mode is turned on. Compatibility Mode ensures that no new or enhanced features in Word 2010 are available while working with a document, so that people who edit the document using previous versions of Word will have full editing capabilities.

Example

The following example shows how to check if a document is in full fidelity mode before using a new feature. In this case, if the document compatibility mode supports using content controls, then a check box content control is added to the document.

VBA Copy code Copy code
Sub InsertCheckbox()

    If (Application.Version = ActiveDocument.CompatibilityMode) Then
          Selection.Range.ContentControls.Add (wdContentControlCheckBox)
    End If
End Sub

See also

Concepts

Document Object

Other resources

Document Object Members


Document.ConsecutiveHyphensLimit Property (Word)

 Copy code hover
[image]

Document.ConsecutiveHyphensLimit Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the maximum number of consecutive lines that can end with hyphens. Read/write. Long.

Syntax

expression .ConsecutiveHyphensLimit

expression A variable that represents a Document object.

Remarks

If the ConsecutiveHyphensLimit property is set to 0 (zero), any number of consecutive lines can end with hyphens.

Example

This example enables automatic hyphenation for MyReport.doc and limits the number of consecutive lines that can end with hyphens to two.

VBA Copy code Copy code
With Documents("MyReport.doc")
 .AutoHyphenation = True
 .ConsecutiveHyphensLimit = 2
End With

This example sets no limit on the number of consecutive lines that can end with hyphens.

VBA Copy code Copy code
ActiveDocument.ConsecutiveHyphensLimit = 0

See also

Concepts

Document Object

Other resources

Document Object Members


Document.Container Property (Word)

 Copy code hover
[image]

Document.Container Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the object that represents the container application for the specified document. Read-only Object.

Syntax

expression .Container

expression A variable that represents a Document object.

Remarks

The Container property provides access to the specified document's container application if the document is embedded in another application as an OLE object. This property also provides a pathway into the object model of the container application if a Word document is opened as an ActiveX document — for example, when a Word document is opened in Microsoft Office Binder or Internet Explorer.

Example

This example displays the name of the container application for the first shape in the active document. For the example to work, this shape must be an OLE object.

VBA Copy code Copy code
Msgbox ActiveDocument.Shapes(1).OLEFormat.Object.Container.Name

See also

Concepts

Document Object

Other resources

Document Object Members


Document.Content Property (Word)

 Copy code hover
[image]

Document.Content Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the main document story. Read-only.

Syntax

expression .Content

expression A variable that represents a Document object.

Remarks

The following two statements are equivalent:

VBA Copy code Copy code
Set mainStory = ActiveDocument.Content
Set mainStory = ActiveDocument.StoryRanges(wdMainTextStory)

Example

This example changes the font and font size of the text in the active document to Arial 10 point.

VBA Copy code Copy code
Set myRange = ActiveDocument.Content
With myRange.Font
 .Name = "Arial"
 .Size = 10
End With

This example inserts text at the end of the document named "Changes.doc." The For Each...Next statement is used to determine whether the document is open.

VBA Copy code Copy code
For Each aDocument In Documents
 If InStr(LCase$(aDocument.Name), "changes.doc") Then
 Set myRange = Documents("Changes.doc").Content
 myRange.InsertAfter "the end."
 End If
Next aDocument

See also

Concepts

Document Object

Other resources

Document Object Members


Document.ContentControls Property (Word)

 Copy code hover
[image]

Document.ContentControls Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a ContentControls collection that represents all the content controls in a document. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .ContentControls

expression An expression that returns a Document object.

Example

The following example inserts a drop-down list content control into the active document.

VBA Copy code Copy code
Dim objCC As ContentControl

Set objCC = ActiveDocument.ContentControls.Add(wdContentControlDropdownList)

'List entries
objCC.DropdownListEntries.Add "Cat"
objCC.DropdownListEntries.Add "Dog"
objCC.DropdownListEntries.Add "Horse"
objCC.DropdownListEntries.Add "Monkey"
objCC.DropdownListEntries.Add "Snake"
objCC.DropdownListEntries.Add "Other"

See also

Concepts

Document Object

Other resources

Document Object Members


Document.ContentTypeProperties Property (Word)

 Copy code hover
[image]

Document.ContentTypeProperties Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a MetaProperties collection that represents the metadata stored in a document, such as author name, subject, and company. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .ContentTypeProperties

expression An expression that returns a Document object.

See also

Concepts

Document Object

Other resources

Document Object Members


Document.Creator Property (Word)

 Copy code hover
[image]

Document.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a Document object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Document Object

Other resources

Document Object Members


Document.CurrentRsid Property (Word)

 Copy code hover
[image]

Document.CurrentRsid Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents a random number that Word assigns to changes in a document. Read-only.

Syntax

expression .CurrentRsid

expression An expression that returns a Document object.

Remarks

If the StoreRSIDOnSave property is True, each time a document is saved, Word generates a random number that the application uses to facilitate comparing and merging documents. Word stores the random numbers in a table and updates the table after each save. The CurrentRsid property returns the last number that Word has assigned to a document.

See also

Concepts

Document Object

Other resources

Document Object Members


Document.CustomDocumentProperties Property (Word)

 Copy code hover
[image]

Document.CustomDocumentProperties Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a DocumentProperties collection that represents all the custom document properties for the specified document.

Syntax

expression .CustomDocumentProperties

expression Required. A variable that represents a Document object.

Remarks

Use the BuiltInDocumentProperties property to return the collection of built-in document properties.

Properties of type msoPropertyTypeString cannot exceed 255 characters in length.

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example inserts a list of custom built-in properties at the end of the active document.

VBA Copy code Copy code
Set myRange = ActiveDocument.Content
myRange.Collapse Direction:=wdCollapseEnd
For Each prop In ActiveDocument.CustomDocumentProperties
 With myRange
 .InsertParagraphAfter
 .InsertAfter prop.Name & "= "
 .InsertAfter prop.Value
 End With
Next

This example adds a custom built-in property to Sales.doc.

VBA Copy code Copy code
thename = InputBox("Please type your name", "Name")
Documents("Sales.doc").CustomDocumentProperties.Add _
 Name:="YourName", LinkToContent:=False, Value:=thename, _
 Type:=msoPropertyTypeString

See also

Concepts

Document Object

Other resources

Document Object Members


Document.CustomXMLParts Property (Word)

 Copy code hover
[image]

Document.CustomXMLParts Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a CustomXMLParts collection that represents the custom XML in the XML data store. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .CustomXMLParts

expression An expression that returns a Document object.

See also

Concepts

Document Object

Other resources

Document Object Members


Document.DefaultTableStyle Property (Word)

 Copy code hover
[image]

Document.DefaultTableStyle Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Variant that represents the table style that is applied to all newly created tables in a document. Read-only.

Syntax

expression .DefaultTableStyle

expression An expression that returns a Document object.

Example

This example checks to see if the default table style used in the active document is named "Table Normal" and, if it is, changes the default table style to "TableStyle1." This example assumes that you have a table style named "TableStyle1."

VBA Copy code Copy code
Sub TableDefaultStyle()
 With ActiveDocument
 If .DefaultTableStyle = "Table Normal" Then
 .SetDefaultTableStyle _
 Style:="TableStyle1", SetInTemplate:=True
 End If
 End With
End Sub

See also

Concepts

Document Object

Other resources

Document Object Members


Document.DefaultTabStop Property (Word)

 Copy code hover
[image]

Document.DefaultTabStop Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the interval (in points) between the default tab stops in the specified document. Read/write Single.

Syntax

expression .DefaultTabStop

expression A variable that represents a Document object.

Example

This example sets the default tab stops in the active document to 1 inch. The InchesToPoints method is used to convert inches to points.

VBA Copy code Copy code
ActiveDocument.DefaultTabStop = InchesToPoints(1)

See also

Concepts

Document Object

Other resources

Document Object Members


Document.DefaultTargetFrame Property (Word)

 Copy code hover
[image]

Document.DefaultTargetFrame Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a String indicating the browser frame in which to display a Web page reached through a hyperlink. Read/write.

Syntax

expression .DefaultTargetFrame

expression An expression that returns a Document object.

Remarks

While the DefaultTargetFrame property can use any user-defined string, it has the following predefined strings: "_top", "_blank", "_parent", and "_self".

Example

This example sets Microsoft Word to open a new blank browser window when a user clicks a hyperlink in the active document.

VBA Copy code Copy code
Sub DefaultFrame()
 ActiveDocument.DefaultTargetFrame = "_blank"
End Sub

See also

Concepts

Document Object

Other resources

Document Object Members


Document.DisableFeatures Property (Word)

 Copy code hover
[image]

Document.DisableFeatures Property (Word)
See also Send feedback

Published: July 16, 2012

True disables all features introduced after the version specified in the DisableFeaturesIntroducedAfter property. The default value is False. Read/write Boolean.

Syntax

expression .DisableFeatures

expression A variable that represents a Document object.

Remarks

The DisableFeatures property only affects the document for which you set the property. Use this property if you plan on sharing a document between users with earlier versions of Microsoft Word so that you don't end up introducing into a document features that are not available in their versions.

Example

This example disables all features added after Word for Windows 95, versions 7.0 and 7.0a, for the current document. The global default setting remains unchanged.

VBA Copy code Copy code
Sub FeaturesDisable()
 With ActiveDocument

 'Checks whether features are disabled
 If .DisableFeatures = True Then

 'If they are, disables all features after Word for Windows 95
 .DisableFeaturesIntroducedAfter = wd70
 Else

 'If not, turns on the disable features option and disables
 'all features introduced after Word for Windows 95
 .DisableFeatures = True
 .DisableFeaturesIntroducedAfter = wd70
 End If
 End With
End Sub

See also

Concepts

Document Object

Other resources

Document Object Members


Document.DisableFeaturesIntroducedAfter Property (Word)

 Copy code hover
[image]

Document.DisableFeaturesIntroducedAfter Property (Word)
See also Send feedback

Published: July 16, 2012

Disables all features introduced after a specified version of Microsoft Word in the document only. Read/write WdDisableFeaturesIntroducedAfter.

Syntax

expression .DisableFeaturesIntroducedAfter

expression Required. A variable that represents a Document object.

Remarks

The DisableFeatures property must be set to True prior to setting the DisableFeaturesIntroducedAfter property. Otherwise, the setting will not take effect and will remain at its default setting of Word 97 for Windows.

The DisableFeaturesIntroducedAfter property only affects the document for which the property is set. If you want to set a global option for the application to disable features for all documents, use the DisableFeaturesIntroducedAfterByDefault property.

Example

This example disables all features added after Word for Windows 95, versions 7.0 and 7.0a, for the current document only. The global default setting remains unchanged.

VBA Copy code Copy code
Sub FeaturesDisable()
 With ActiveDocument

 'Checks whether features are disabled
 If .DisableFeatures = True Then

 'If they are, disables all features after Word for Windows 95
 .DisableFeaturesIntroducedAfter = wd70
 Else

 'If not, turns on the disable features option and disables
 'all features introduced after Word for Windows 95
 .DisableFeatures = True
 .DisableFeaturesIntroducedAfter = wd70
 End If
 End With
End Sub

See also

Concepts

Document Object

Other resources

Document Object Members


Document.DocumentInspectors Property (Word)

 Copy code hover
[image]

Document.DocumentInspectors Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a DocumentInspectors collection that enables you to locate hidden personal information, such as author name, company name, and revision date. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .DocumentInspectors

expression An expression that returns a Document object.

See also

Concepts

Document Object

Other resources

Document Object Members


Document.DocumentLibraryVersions Property (Word)

 Copy code hover
[image]

Document.DocumentLibraryVersions Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a DocumentLibraryVersions collection that represents the collection of versions of a shared document that has versioning enabled and that is stored in a document library on a server.

Syntax

expression .DocumentLibraryVersions

expression An expression that returns a Document object.

Example

The following example returns the collection of versions for the active document. This example assumes that the active document has versioning enabled and is stored in a shared document library on a server.

VBA Copy code Copy code
Dim objVersions As DocumentLibraryVersions

Set objVersions = ActiveDocument.DocumentLibraryVersions

See also

Concepts

Document Object

Other resources

Document Object Members


Document.DocumentTheme Property (Word)

 Copy code hover
[image]

Document.DocumentTheme Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an OfficeTheme object that represents the Microsoft Office theme applied to a document. Read-only.

Syntax

expression .OfficeTheme

expression An expression that returns a Document object.

Remarks

Use the ApplyDocumentTheme method to apply an Office theme.

See also

Concepts

Document Object

Other resources

Document Object Members


Document.DoNotEmbedSystemFonts Property (Word)

 Copy code hover
[image]

Document.DoNotEmbedSystemFonts Property (Word)
See also Send feedback

Published: July 16, 2012

True for Microsoft Word to not embed common system fonts. Read/write Boolean.

Syntax

expression .DoNotEmbedSystemFonts

expression An expression that returns a Document object.

Remarks

Setting the Document property to False is useful if the user is on an East Asian system and wants to create a document that is readable by others who do not have fonts for that language on their system. For example, a user on a Japanese system could choose to embed the fonts in a document so that the Japanese document would be readable on all systems.

Example

This example embeds all fonts in the current document.

VBA Copy code Copy code
Sub EmbedFonts()
 With ActiveDocument
 If .EmbedTrueTypeFonts = False Then
 .EmbedTrueTypeFonts = True
 .DoNotEmbedSystemFonts = False
 Else
 .DoNotEmbedSystemFonts = False
 End If
 End With
End Sub

See also

Concepts

Document Object

Other resources

Document Object Members


Document.Email Property (Word)

 Copy code hover
[image]

Document.Email Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Email object that contains all the e-mail-related properties of the current document. Read-only.

Syntax

expression .Email

expression A variable that represents a Document object.

Example

This example returns the name of the style associated with the current e-mail author.

VBA Copy code Copy code
MsgBox ActiveDocument.Email _
 .CurrentEmailAuthor.Style.NameLocal

See also

Concepts

Document Object

Other resources

Document Object Members


Document.EmbedLinguisticData Property (Word)

 Copy code hover
[image]

Document.EmbedLinguisticData Property (Word)
See also Send feedback

Published: July 16, 2012

True for Microsoft Word to embed speech and handwriting so that data can be converted back to speech or handwriting. Read/write Boolean.

Syntax

expression .EmbedLinguisticData

expression An expression that returns a Document object.

Remarks

The EmbedLinguisticData property also allows you to store East Asian IME keystrokes to improve correction and controls text service data received from devices connected to Microsoft Office using the Windows Text Service Framework Application Programming Interface

Example

This example embeds into the active document any speech or handwriting that may exist in the document.

VBA Copy code Copy code
Sub EmbedSpeechHandwriting()
 ActiveDocument.EmbedLinguisticData = True
End Sub

See also

Concepts

Document Object

Other resources

Document Object Members


Document.EmbedTrueTypeFonts Property (Word)

 Copy code hover
[image]

Document.EmbedTrueTypeFonts Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word embeds TrueType fonts in a document when it is saved. Read/write Boolean.

Syntax

expression .EmbedTrueTypeFonts

expression A variable that represents a Document object.

Remarks

Embedding TrueType fonts allows others to view a document with the same fonts that were used to create it.

Example

This example sets Word to automatically embed TrueType fonts when saving a document, and then it saves the active document.

VBA Copy code Copy code
ActiveDocument.EmbedTrueTypeFonts = True
ActiveDocument.Save

This example returns the current status of the Embed TrueType fonts check box in the Save options area on the Save tab in the Options dialog box.

VBA Copy code Copy code
temp = ActiveDocument.EmbedTrueTypeFonts

See also

Concepts

Document Object

Other resources

Document Object Members


Document.EncryptionProvider Property (Word)

 Copy code hover
[image]

Document.EncryptionProvider Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a String specifying the name of the algorithm encryption provider that Microsoft Word uses when encrypting documents. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .EncryptionProvider

expression An expression that returns a Document object.

See also

Concepts

Document Object

Other resources

Document Object Members


Document.Endnotes Property (Word)

 Copy code hover
[image]

Document.Endnotes Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Endnotes collection that represents all the endnotes in a document. Read-only.

Syntax

expression .Endnotes

expression A variable that represents a Document object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example positions the endnotes in the active document at the end of the document and formats the endnote reference marks as lowercase roman numerals.

VBA Copy code Copy code
With ActiveDocument.Endnotes
 .Location = wdEndOfDocument
 .NumberStyle = wdNoteNumberStyleLowercaseRoman
End With

See also

Concepts

Document Object

Other resources

Document Object Members


Document.EnforceStyle Property (Word)

 Copy code hover
[image]

Document.EnforceStyle Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents whether formatting restrictions are enforced in a protected document.

Syntax

expression .EnforceStyle

expression An expression that returns a Document object.

Example

The following example turns on formatting restrictions in the active document.

VBA Copy code Copy code
ActiveDocument.EnforceStyle = True

See also

Concepts

Document Object

Other resources

Document Object Members


Document.Envelope Property (Word)

 Copy code hover
[image]

Document.Envelope Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Envelope object that represents an envelope and envelope features in a document. Read-only.

Syntax

expression .Envelope

expression A variable that represents a Document object.

Example

This example sets the default envelope size to C4 (229 x 324 mm).

VBA Copy code Copy code
ActiveDocument.Envelope.DefaultSize = "C4"

This example displays the delivery address if an envelope has been added to the document; otherwise, a message box is displayed.

VBA Copy code Copy code
On Error GoTo errhandler
addr = ActiveDocument.Envelope.Address.Text
MsgBox Prompt:=addr, Title:="Delivery Address"
errhandler:
If Err = 5852 Then MsgBox "Add an envelope to the document"

This example creates a new document and adds an envelope with a predefined delivery address and return address.

VBA Copy code Copy code
addr = "Don Funk" & vbCr & "123 Skye St." _
 & vbCr & "Our Town, WA 98040"
retaddr = "Karin Gallagher" & vbCr & "123 Main" _
 & vbCr & "Other Town, WA 98004"
Documents.Add.Envelope.Insert Address:=addr, ReturnAddress:=retaddr
ActiveDocument.ActiveWindow.View.Type = wdPrintView

See also

Concepts

Document Object

Other resources

Document Object Members


Document.FarEastLineBreakLanguage Property (Word)

 Copy code hover
[image]

Document.FarEastLineBreakLanguage Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a WdFarEastLineBreakLanguageID that represents the East Asian language to use when breaking lines of text in the specified document or template. Read/write.

Syntax

expression .reFarEastLineBakLanguage

expression Required. A variable that represents a Document object.

Example

This example sets Word to break lines in the current document based on Korean language rules.

VBA Copy code Copy code
ActiveDocument.FarEastLineBreakLanguage = wdLineBreakKorean

See also

Concepts

Document Object

Other resources

Document Object Members


Document.FarEastLineBreakLevel Property (Word)

 Copy code hover
[image]

Document.FarEastLineBreakLevel Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a WdFarEastLineBreakLevel that represents the line break control level for the specified document. Read/write.

Syntax

expression .FarEastLineBreakLevel

expression Required. A variable that represents a Document object.

Remarks

This property is ignored if the FarEastLineBreakControl property is set to False.

For more information on using Microsoft Word with East Asian languages, see Word features for East Asian languages .

Example

This example sets Microsoft Word to perform line breaking on first-level kinsoku characters in the active document.

VBA Copy code Copy code
ActiveDocument.FarEastLineBreakLevel = wdJustificationModeCompressKana

See also

Concepts

Document Object

Other resources

Document Object Members


Document.Fields Property (Word)

 Copy code hover
[image]

Document.Fields Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Fields collection that represents all the fields in the document. Read-only.

Syntax

expression .Fields

expression Required. A variable that represents a Document object.

Example

This example updates all the fields in the active document.

VBA Copy code Copy code
ActiveDocument.Fields.Update

This example removes all the fields from the main text story and the footer in the active document.

VBA Copy code Copy code
For Each aField in ActiveDocument.Fields
 aField.Delete
Next aField
Set myRange = ActiveDocument.Sections(1).Footers _
 (wdHeaderFooterPrimary).Range
For Each aField In myRange.Fields
 aField.Delete
Next aField

See also

Concepts

Document Object

Other resources

Document Object Members


Document.Final Property (Word)

 Copy code hover
[image]

Document.Final Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that indicates whether a document is final. Read/write.

Syntax

expression .Final

expression An expression that returns a Document object.

Remarks

True marks the document as final, notifies recipients (if any) that the document is final, and sets the document to read-only.

See also

Concepts

Document Object

Other resources

Document Object Members


Document.Footnotes Property (Word)

 Copy code hover
[image]

Document.Footnotes Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Footnotes collection that represents all the footnotes in a document. Read-only.

Syntax

expression .Footnotes

expression A variable that represents a Document object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example changes the footnote reference marks for the footnotes in the active document to lowercase letters, starting with the letter "c".

VBA Copy code Copy code
With ActiveDocument.Footnotes
 .StartingNumber = 3
 .NumberStyle = wdNoteNumberStyleLowercaseLetter
End With

This example inserts an automatically numbered footnote at the insertion point.

VBA Copy code Copy code
Selection.Collapse Direction:=wdCollapseStart
ActiveDocument.Footnotes.Add Range:=Selection.Range, _
 Text:="(Lone Creek Press, 1995)"

See also

Concepts

Document Object

Other resources

Document Object Members


Document.FormattingShowClear Property (Word)

 Copy code hover
[image]

Document.FormattingShowClear Property (Word)
See also Send feedback

Published: July 16, 2012

True for Microsoft Word to show clear formatting in the Styles and Formatting task pane. Read/write Boolean.

Syntax

expression .FormattingShowClear

expression A variable that represents a Document object.

Example

This example disables display of the Clear Formatting button in the list of styles.

VBA Copy code Copy code
Sub ShowClearFormatting()
 With ActiveDocument
 .FormattingShowClear = False
 .FormattingShowFilter = wdShowFilterFormattingInUse
 .FormattingShowFont = True
 .FormattingShowNumbering = True
 .FormattingShowParagraph = True
 End With
End Sub

See also

Concepts

Document Object

Other resources

Document Object Members


Document.FormattingShowFilter Property (Word)

 Copy code hover
[image]

Document.FormattingShowFilter Property (Word)
See also Send feedback

Published: July 16, 2012

Sets or returns a WdShowFilter constant that represents the styles and formatting displayed in the Styles and Formatting task pane. Read/write Boolean.

Syntax

expression .FormattingShowFilter

expression Required. A variable that represents a Document object.

Example

This example filters formatting to show in the Styles and Formatting task pane only the formatting in use in the active document.

VBA Copy code Copy code
Sub ShowClearFormatting()
 With ActiveDocument
 .FormattingShowClear = False
 .FormattingShowFilter = wdShowFilterFormattingInUse
 .FormattingShowFont = True
 .FormattingShowNumbering = True
 .FormattingShowParagraph = True
 End With
End Sub

See also

Concepts

Document Object

Other resources

Document Object Members


Document.FormattingShowFont Property (Word)

 Copy code hover
[image]

Document.FormattingShowFont Property (Word)
See also Send feedback

Published: July 16, 2012

True for Microsoft Word to display font formatting in the Styles and Formatting task pane. Read/write Boolean.

Syntax

expression .FormattingShowFont

expression A variable that represents a Document object.

Example

This example enables display of font formatting in the Styles and Formatting task pane.

VBA Copy code Copy code
Sub ShowClearFormatting()
 With ActiveDocument
 .FormattingShowClear = False
 .FormattingShowFilter = wdShowFilterFormattingInUse
 .FormattingShowFont = True
 .FormattingShowNumbering = True
 .FormattingShowParagraph = True
 End With
End Sub

See also

Concepts

Document Object

Other resources

Document Object Members


Document.FormattingShowNextLevel Property (Word)

 Copy code hover
[image]

Document.FormattingShowNextLevel Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents whether Microsoft Word shows the next heading level when the previous heading level is used. Read/write.

Syntax

expression .FormattingShowNextLevel

expression An expression that returns a Document object.

Remarks

This property corresponds to the Show next heading when previous level is used check box in the Styles Gallery Options dialog box.

See also

Concepts

Document Object

Other resources

Document Object Members


Document.FormattingShowNumbering Property (Word)

 Copy code hover
[image]

Document.FormattingShowNumbering Property (Word)
See also Send feedback

Published: July 16, 2012

True for Microsoft Word to display number formatting in the Styles and Formatting task pane. Read/write Boolean.

Syntax

expression .FormattingShowNumbering

expression A variable that represents a Document object.

Example

This example enables displaying number formatting in the Styles and Formatting task pane.

VBA Copy code Copy code
Sub ShowClearFormatting()
 With ActiveDocument
 .FormattingShowClear = False
 .FormattingShowFilter = wdShowFilterFormattingInUse
 .FormattingShowFont = True
 .FormattingShowNumbering = True
 .FormattingShowParagraph = True
 End With
End Sub

See also

Concepts

Document Object

Other resources

Document Object Members


Document.FormattingShowParagraph Property (Word)

 Copy code hover
[image]

Document.FormattingShowParagraph Property (Word)
See also Send feedback

Published: July 16, 2012

True for Microsoft Word to display paragraph formatting in the Styles and Formatting task pane. Read/write Boolean.

Syntax

expression .FormattingShowParagraph

expression A variable that represents a Document object.

Example

This example enables displaying paragraph formatting in the Styles and Formatting task pane.

VBA Copy code Copy code
Sub ShowClearFormatting()
 With ActiveDocument
 .FormattingShowClear = False
 .FormattingShowFilter = wdShowFilterFormattingInUse
 .FormattingShowFont = True
 .FormattingShowNumbering = True
 .FormattingShowParagraph = True
 End With
End Sub

See also

Concepts

Document Object

Other resources

Document Object Members


Document.FormattingShowUserStyleName Property (Word)

 Copy code hover
[image]

Document.FormattingShowUserStyleName Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents whether to show user-defined styles. Read/write.

Syntax

expression .FormattingShowUserStyleName

expression An expression that returns a Document object.

Remarks

This property corresponds to the Hide built-in name when alternate names exists check box in the Styles Gallery Options dialog box. Setting the FormattingShowUserStyleName property to True hides built-in styles when alternate user-defined styles exist. For example, if a user creates a heading style, such as Heading 1 or Heading 2, to take advantage of other built-in features of Microsoft Word, such as tables of contents, the user-defined style takes precedence, and the similarly named built-in style is not shown in the list of style names.

See also

Concepts

Document Object

Other resources

Document Object Members


Document.FormFields Property (Word)

 Copy code hover
[image]

Document.FormFields Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a FormFields collection that represents all the form fields in the document. Read-only.

Syntax

expression .FormFields

expression A variable that represents a Document object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example sets the content of the form field named "Text1" to "Name."

VBA Copy code Copy code
ActiveDocument.FormFields("Text1").Result = "Name"

See also

Concepts

Document Object

Other resources

Document Object Members


Document.FormsDesign Property (Word)

 Copy code hover
[image]

Document.FormsDesign Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified document is in form design mode. Read-only Boolean.

Syntax

expression .FormsDesign

expression A variable that represents a Document object.

Remarks

The FormsDesign property always returns False if it's used in code that is run from Microsoft Word, but it returns the correct value if it is run through Automation. For example, if you run the example from Microsoft Excel, it will return True if you're in design mode.

When Word is in form design mode, the Control Toolbox toolbar is displayed. You can use this toolbar to insert ActiveX controls such as command buttons, scroll bars, and option buttons. In form design mode, event procedures don't run, and when you click an embedded control, the control's sizing handles appear.

Example

This example displays a message box that indicates whether the active document is in form design mode. This example will always return False.

VBA Copy code Copy code
Msgbox ActiveDocument.FormsDesign

See also

Concepts

Document Object

Other resources

Document Object Members


Document.Frames Property (Word)

 Copy code hover
[image]

Document.Frames Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Frames collection that represents all the frames in a document. Read-only.

Syntax

expression .Frames

expression A variable that represents a Document object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example adds a frame around the selection and returns a frame object to the myFrame variable.

VBA Copy code Copy code
Set myFrame = ActiveDocument.Frames.Add(Range:=Selection.Range)

See also

Concepts

Document Object

Other resources

Document Object Members


Document.Frameset Property (Word)

 Copy code hover
[image]

Document.Frameset Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Frameset object that represents an entire frames page or a single frame on a frames page. Read-only.

Syntax

expression .Frameset

expression A variable that represents a Document object.

Remarks

For more information on creating frames pages, see Creating frames pages.

Example

This example sets the color of frame borders in the specified frames page to tan.

VBA Copy code Copy code
With ActiveWindow.Document.Frameset
 .FramesetBorderColor = wdColorTan
 .FramesetBorderWidth = 6
End With

See also

Concepts

Document Object

Other resources

Document Object Members


Document.FullName Property (Word)

 Copy code hover
[image]

Document.FullName Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a String that represents the name of a document, including the path. Read-only.

Syntax

expression .FullName

expression Required. A variable that represents a Document object.

Remarks

Using this property is equivalent to using the Path, PathSeparator, and Name properties in sequence.

Example

This example displays the path and file name of the active document.

VBA Copy code Copy code
Sub DocName()
 MsgBox ActiveDocument.FullName
End Sub

See also

Concepts

Document Object

Other resources

Document Object Members


Document.GrammarChecked Property (Word)

 Copy code hover
[image]

Document.GrammarChecked Property (Word)
See also Send feedback

Published: July 16, 2012

True if a grammar check has been run on the specified range or document. Read/write Boolean.

Syntax

expression .GrammarChecked

expression A variable that represents a Document object.

Remarks

Returns False if all or some of the specified document has not been checked for grammar. To recheck the grammar in a document, set the GrammarChecked property to False.

Example

This example determines whether grammar has been checked in the active document. If it has, the word count is displayed. If grammar has not been checked, a spelling and grammar check is started.

VBA Copy code Copy code
Set myStat = ActiveDocument.ReadabilityStatistics
passGram = ActiveDocument.GrammarChecked
If passGram = True Then
 Msgbox myStat(1).Name & " - " & myStat(1).Value
Else
 ActiveDocument.CheckGrammar
End If

This example sets the GrammarChecked property to False for the active document, and then it runs a grammar check again.

VBA Copy code Copy code
ActiveDocument.GrammarChecked
VBA Copy code Copy code
= False
VBA Copy code Copy code
ActiveDocument.CheckGrammar

See also

Concepts

Document Object

Other resources

Document Object Members


Document.GrammaticalErrors Property (Word)

 Copy code hover
[image]

Document.GrammaticalErrors Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a ProofreadingErrors collection that represents the sentences that failed the grammar check in the specified document. Read-only.

Syntax

expression .GrammaticalErrors

expression A variable that represents a Document object.

Remarks

There can be more than one error per sentence. If there are no grammatical errors, the Count property for the ProofreadingErrors collection returned by the GrammaticalErrors property returns 0 (zero).

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example checks the active document for grammatical errors. If any errors are found, a new spelling and grammar check is started.

VBA Copy code Copy code
If ActiveDocument.GrammaticalErrors.Count = 0 Then
 Msgbox "There are no grammatical errors."
Else
 ActiveDocument.CheckGrammar
End If

See also

Concepts

Document Object

Other resources

Document Object Members


Document.GridDistanceHorizontal Property (Word)

 Copy code hover
[image]

Document.GridDistanceHorizontal Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Single that represents the amount of horizontal space between the invisible gridlines that Microsoft Word uses when you draw, move, and resize AutoShapes or East Asian characters in the specified document. Read/write.

Syntax

expression .GridDistanceHorizontal

expression A variable that represents a Document object.

Example

This example sets the horizontal and vertical distance between gridlines and then enables the Snap objects to grid feature for the current document.

VBA Copy code Copy code
With ActiveDocument
 .GridDistanceHorizontal = 9
 .GridDistanceVertical = 9
 .SnapToGrid = True
End With

See also

Concepts

Document Object

Other resources

Document Object Members


Document.GridDistanceVertical Property (Word)

 Copy code hover
[image]

Document.GridDistanceVertical Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Single that represents the amount of vertical space between the invisible gridlines that Microsoft Word uses when you draw, move, and resize AutoShapes or East Asian characters in the specified document. Read/write.

Syntax

expression .GridDistanceVertical

expression A variable that represents a Document object.

Example

This example sets the horizontal and vertical distance between gridlines and then enables the Snap objects to grid feature for the current document.

VBA Copy code Copy code
With ActiveDocument
 .GridDistanceHorizontal = 9
 .GridDistanceVertical = 9
 .SnapToGrid = True
End With

See also

Concepts

Document Object

Other resources

Document Object Members


Document.GridOriginFromMargin Property (Word)

 Copy code hover
[image]

Document.GridOriginFromMargin Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word starts the character grid from the upper-left corner of the page. Read/write Boolean.

Syntax

expression .GridOriginFromMargin

expression A variable that represents a Document object.

Example

This example sets Microsoft Word to start the character grid for the active document from the upper-left corner of the page.

VBA Copy code Copy code
ActiveDocument.GridOriginFromMargin = True

See also

Concepts

Document Object

Other resources

Document Object Members


Document.GridOriginHorizontal Property (Word)

 Copy code hover
[image]

Document.GridOriginHorizontal Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Single that represents the point, relative to the left edge of the page, where you want the invisible grid for drawing, moving, and resizing AutoShapes or East Asian characters to begin in the specified document. Read/write.

Syntax

expression .GridOriginHorizontal

expression A variable that represents a Document object.

Example

This example sets the horizontal and vertical point of origin for the grid, sets the horizontal and vertical distance between gridlines, and then enables the Snap to grid feature for the current document.

VBA Copy code Copy code
With ActiveDocument
 .GridOriginHorizontal = 80
 .GridOriginVertical = 90
 .GridDistanceHorizontal = 9
 .GridDistanceVertical = 9
 .SnapToGrid = True
End With

See also

Concepts

Document Object

Other resources

Document Object Members


Document.GridOriginVertical Property (Word)

 Copy code hover
[image]

Document.GridOriginVertical Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Single that represents the point, relative to the top of the page, where you want the invisible grid for drawing, moving, and resizing AutoShapes or East Asian characters to begin in the specified document. Read/write.

Syntax

expression .GridOriginVertical

expression A variable that represents a Document object.

Example

This example sets the horizontal and vertical point of origin for the grid, sets the horizontal and vertical distance between gridlines, and then enables the Snap objects to grid feature for the current document.

VBA Copy code Copy code
With ActiveDocument
 .GridOriginHorizontal = 80
 .GridOriginVertical = 90
 .GridDistanceHorizontal = 9
 .GridDistanceVertical = 9
 .SnapToGrid = True
End With

See also

Concepts

Document Object

Other resources

Document Object Members


Document.GridSpaceBetweenHorizontalLines Property (Word)

 Copy code hover
[image]

Document.GridSpaceBetweenHorizontalLines Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the interval at which Microsoft Word displays horizontal character gridlines in print layout view. Read/write Long.

Syntax

expression .GridSpaceBetweenHorizontalLines

expression A variable that represents a Document object.

Example

This example sets Microsoft Word to display every fifth horizontal character gridline.

VBA Copy code Copy code
ActiveDocument.GridSpaceBetweenHorizontalLines = 5

See also

Concepts

Document Object

Other resources

Document Object Members


Document.GridSpaceBetweenVerticalLines Property (Word)

 Copy code hover
[image]

Document.GridSpaceBetweenVerticalLines Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the interval at which Microsoft Word displays vertical character gridlines in print layout view. Read/write Long.

Syntax

expression .GridSpaceBetweenVerticalLines

expression A variable that represents a Document object.

Example

This example sets Microsoft Word to display every other vertical character gridline.

VBA Copy code Copy code
ActiveDocument.GridSpaceBetweenVerticalLines = 2

See also

Concepts

Document Object

Other resources

Document Object Members


Document.HasPassword Property (Word)

 Copy code hover
[image]

Document.HasPassword Property (Word)
See also Send feedback

Published: July 16, 2012

True if a password is required to open the specified document. Read-only Boolean.

Syntax

expression .HasPassword

expression A variable that represents a Document object.

Example

This example sets the password "kittycat" for the active document and then displays a confirmation message.

VBA Copy code Copy code
ActiveDocument.Password = "kittycat"
If ActiveDocument.HasPassword = True Then _
 MsgBox "The password is set."

See also

Concepts

Document Object

Other resources

Document Object Members


Document.HasVBProject Property (Word)

 Copy code hover
[image]

Document.HasVBProject Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Boolean that represents whether a document has an attached Microsoft Visual Basic for Applications project. Read-only.

Syntax

expression .HasVBProject

expression An expression that returns a Document object.

Remarks

This property is most useful in programatically determining whether a document needs to be saved into a macro-enabled file format. If saved in another format, macros and code projects contained within the document may be lost.

See also

Concepts

Document Object

Other resources

Document Object Members


Document.HTMLDivisions Property (Word)

 Copy code hover
[image]

Document.HTMLDivisions Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an HTMLDivisions collection that represents the HTML DIV elements in a Web document.

Syntax

expression .HTMLDivisions

expression Required. A variable that represents a Document object.

Example

This example formats three nested divisions in the active document. This example assumes that the active document is an HTML document with at least three divisions.

VBA Copy code Copy code
Sub FormatHTMLDivisions()
 With ActiveDocument.HTMLDivisions(1)
 With .Borders(wdBorderLeft)
 .Color = wdColorRed
 .LineStyle = wdLineStyleSingle
 End With
 With .Borders(wdBorderRight)
 .Color = wdColorRed
 .LineStyle = wdLineStyleSingle
 End With
 With .HTMLDivisions(1)
 .LeftIndent = InchesToPoints(1)
 .RightIndent = InchesToPoints(1)
 With .Borders(wdBorderTop)
 .Color = wdColorBlue
 .LineStyle = wdLineStyleDouble
 End With
 With .Borders(wdBorderBottom)
 .Color = wdColorBlue
 .LineStyle = wdLineStyleDouble
 End With
 With .HTMLDivisions(1)
 .LeftIndent = InchesToPoints(1)
 .RightIndent = InchesToPoints(1)
 With .Borders(wdBorderLeft)
 .LineStyle = wdLineStyleDot
 End With
 With .Borders(wdBorderRight)
 .LineStyle = wdLineStyleDot
 End With
 With .Borders(wdBorderTop)
 .LineStyle = wdLineStyleDot
 End With
 With .Borders(wdBorderBottom)
 .LineStyle = wdLineStyleDot
 End With
 End With
 End With
 End With

End Sub

See also

Concepts

Document Object

Other resources

Document Object Members


Document.Hyperlinks Property (Word)

 Copy code hover
[image]

Document.Hyperlinks Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Hyperlinks collection that represents all the hyperlinks in the specified document. Read-only.

Syntax

expression .Hyperlinks

expression A variable that represents a Document object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example displays the target address of the second hyperlink in Home.doc.

VBA Copy code Copy code
If Documents("Home.doc").Hyperlinks.Count >= 2 Then
 MsgBox Documents("Home.doc").Hyperlinks(2).Name
End If

This example displays the name of every hyperlink in the active document that includes the word "Microsoft" in its address.

VBA Copy code Copy code
For Each aHyperlink In ActiveDocument.Hyperlinks
 If InStr(LCase(aHyperlink.Address), "microsoft") <> 0 Then
 MsgBox aHyperlink.Name
 End If
Next aHyperlink

See also

Concepts

Document Object

Other resources

Document Object Members


Document.HyphenateCaps Property (Word)

 Copy code hover
[image]

Document.HyphenateCaps Property (Word)
See also Send feedback

Published: July 16, 2012

True if words in all capital letters can be hyphenated. Read/write Boolean.

Syntax

expression .HyphenateCaps

expression A variable that represents a Document object.

Example

This example enables automatic hyphenation for the active document and allows capitalized words to be hyphenated.

VBA Copy code Copy code
With ActiveDocument
 .AutoHyphenation = True
 .HyphenateCaps = True
End With

See also

Concepts

Document Object

Other resources

Document Object Members


Document.HyphenationZone Property (Word)

 Copy code hover
[image]

Document.HyphenationZone Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the width of the hyphenation zone, in points. Read/write Long.

Syntax

expression .HyphenationZone

expression A variable that represents a Document object.

Remarks

The hyphenation zone is the maximum amount of space that Microsoft Word leaves between the end of the last word in a line and the right margin.

Example

Note Note

Unless Word 2013 is in compatibility mode, HyphenationZone always returns 99999999.

This example enables automatic hyphenation for MyReport.doc. The hyphenation zone is set to 36 points (0.5 inch).

VBA Copy code Copy code
With Documents("MyReport.doc")
 .AutoHyphenation = True
 .HyphenationZone = 36
End With

This example sets the hyphenation zone to 0.25 inch (18 points) and then starts manual hyphenation of the active document.

VBA Copy code Copy code
With ActiveDocument
 .HyphenationZone = InchesToPoints(0.25)
 .ManualHyphenation
End With

See also

Concepts

Document Object

Other resources

Document Object Members


Document.Indexes Property (Word)

 Copy code hover
[image]

Document.Indexes Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Indexes collection that represents all the indexes in the specified document. Read-only.

Syntax

expression .Indexes

expression A variable that represents a Document object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example adds an index at the end of the active document.

VBA Copy code Copy code
Set MyRange = _
 ActiveDocument.Range(Start:=ActiveDocument.Content.End - 1, _
 End:=ActiveDocument.Content.End - 1)
ActiveDocument.Indexes.Add Range:=MyRange, NumberOfColumns:=1, _
 HeadingSeparator:=False

This example inserts an index entry for the selected text.

VBA Copy code Copy code
If Selection.Type = wdSelectionNormal Then
 ActiveDocument.Indexes.MarkEntry Range:=Selection.Range, _
 Entry:=Selection.Range.Text
End If

See also

Concepts

Document Object

Other resources

Document Object Members


Document.InlineShapes Property (Word)

 Copy code hover
[image]

Document.InlineShapes Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an InlineShapes collection that represents all the InlineShape objects in a document. Read-only.

Syntax

expression .InlineShapes

expression A variable that represents a Document object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example displays the number of shapes and inline shapes in the active document.

VBA Copy code Copy code
Set doc = ActiveDocument
Msgbox "InlineShape = " & doc.InlineShapes.Count & _
 vbCr & "Shapes = " & doc.Shapes.Count

See also

Concepts

Document Object

Other resources

Document Object Members


Document.IsInAutosave Property (Word)

 Copy code hover
[image]

Document.IsInAutosave Property (Word)
See also Send feedback

Published: July 16, 2012

Returns False if the most recent firing of the Application.DocumentBeforeSave Event (Word) event was the result of a manual save by the user, and not an automatic save. Read-only.

Version information

Version Added: Word 2013

Syntax

expression .IsInAutosave

expression A variable that represents a Document object.

Property value

BOOLEAN

Remarks

The IsInAutosave property is designed to be used in an event handler for the Application.DocumentBeforeSave event. Using it for other purposes is not recommended.

Note Note

In Visual Basic for Applications (VBA), the True keyword has a value of negative one (-1). The IsInAutosave property, however, returns positive one (1) for True, rather than -1. As a result, IsInAutosave never returns the VBA True keyword. To determine if the property is true, use code similar to that shown in the following code sample. If you determine that IsInAutosave is true, you can safely avoid doing any of the additional processing you might normally do for a manual save operation.

Example

Use the following code to determine if IsInAutosave is true:

Copy code Copy code
If Word.ActiveDocument.IsInAutosave = False Then
   Debug.Print "Manual save."
Else
   Debug.Print "Automatic save."
End If

See also

Concepts

Document Object

Other resources

Document Members


Document.IsMasterDocument Property (Word)

 Copy code hover
[image]

Document.IsMasterDocument Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified document is a master document. Read-only Boolean.

Syntax

expression .IsMasterDocument

expression A variable that represents a Document object.

Remarks

A master document includes one or more subdocuments.

Example

If the active document is a master document, this example switches to master document view and opens the first subdocument.

VBA Copy code Copy code
If ActiveDocument.IsMasterDocument = True Then
 ActiveDocument.ActiveWindow.View.Type = wdMasterView
 ActiveDocument.Subdocuments(1).Open
Else
 MsgBox "This document is not a master document."
End If

See also

Concepts

Document Object

Other resources

Document Object Members


Document.IsSubdocument Property (Word)

 Copy code hover
[image]

Document.IsSubdocument Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified document is a subdocument of a master document. Read-only Boolean.

Syntax

expression .IsSubdocument

expression A variable that represents a Document object.

Example

This example determines whether Sales.doc is a subdocument and then displays a message indicating the status of Sales.doc.

VBA Copy code Copy code
If Documents("Sales.doc").IsSubdocument = True Then
 MsgBox "Sales.doc is a subdocument."
Else
 MsgBox "Sales.doc is not a subdocument."
End If

See also

Concepts

Document Object

Other resources

Document Object Members


Document.JustificationMode Property (Word)

 Copy code hover
[image]

Document.JustificationMode Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the character spacing adjustment for the specified document. Read/write WdJustificationMode.

Syntax

expression .JustificationMode

expression Required. A variable that represents a Document object.

Example

This example sets Microsoft Word to compress only punctuation marks when adjusting character spacing.

VBA Copy code Copy code
ActiveDocument.JustificationMode = wdJustificationModeCompressKana

See also

Concepts

Document Object

Other resources

Document Object Members


Document.KerningByAlgorithm Property (Word)

 Copy code hover
[image]

Document.KerningByAlgorithm Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word kerns half-width Latin characters and punctuation marks in the specified document. Read/write Boolean.

Syntax

expression .KerningByAlgorithm

expression A variable that represents a Document object.

Example

This example sets Microsoft Word to kern half-width Latin characters and punctuation marks in the active document.

VBA Copy code Copy code
ActiveDocument.KerningByAlgorithm = True

See also

Concepts

Document Object

Other resources

Document Object Members


Document.Kind Property (Word)

 Copy code hover
[image]

Document.Kind Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the format type that Microsoft Word uses when automatically formatting the specified document. Read/write WdDocumentKind.

Syntax

expression .Kind

expression Required. A variable that represents a Document object.

Example

This example asks the user whether the active document is an e-mail message. If the response is Yes, the document is formatted as an e-mail message.

VBA Copy code Copy code
response = MsgBox("Is this document an e-mail message?", vbYesNo)
If response = vbYes Then
 ActiveDocument.Kind = wdDocumentEmail
 ActiveDocument.Content.AutoFormat
End If

See also

Concepts

Document Object

Other resources

Document Object Members


Document.LanguageDetected Property (Word)

 Copy code hover
[image]

Document.LanguageDetected Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a value that specifies whether Microsoft Word has detected the language of the specified text. Read/write Boolean.

Syntax

expression .LanguageDetected

expression Required. A variable that represents a Document object.

Remarks

Check the LanguageID property for the results of any previous language detection.

The LanguageDetected property is set to True when the DetectLanguage method is called. To reevaluate the language of the specified text, you must first set the LanguageDetected property to False.

Example

This example checks the active document to determine the language it's written in and then displays the result.

VBA Copy code Copy code
With ActiveDocument
 If .LanguageDetected = True Then
 x = MsgBox("This document has already " _
 & "been checked. Do you want to check " _
 & "it again?", vbYesNo)
 If x = vbYes Then
 .LanguageDetected = False
 .DetectLanguage
 End If
 Else
 .DetectLanguage
 End If
 If .Range.LanguageID = wdEnglishUS Then
 MsgBox "This is a U.S. English document."
 Else
 MsgBox "This is not a U.S. English document."
 End If
End With

See also

Concepts

Document Object

Other resources

Document Object Members


Document.ListParagraphs Property (Word)

 Copy code hover
[image]

Document.ListParagraphs Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a ListParagraphsobject that represents all the numbered paragraphs in a document. Read-only.

Syntax

expression .ListParagraphs

expression An expression that returns a Document object.

Remarks

For information about returning a single member of a collection, see Returning a Single Object from a Collection.

Example

This example adds a yellow background to each numbered or bulleted paragraph in the first document.

VBA Copy code Copy code
For Each numpar In Documents(1).ListParagraphs
 numpar.Shading.BackgroundPatternColorIndex = wdYellow
Next numpar

See also

Concepts

Document Object

Other resources

Document Object Members


Document.Lists Property (Word)

 Copy code hover
[image]

Document.Lists Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Lists collection that contains all the formatted lists in the specified document. Read-only.

Syntax

expression .Lists

expression A variable that represents a Document object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example formats the selection as a numbered list. The example then displays a message box that reports the number of lists in the active document.

VBA Copy code Copy code
Selection.Range.ListFormat.ApplyListTemplate _
 ListTemplate:=ListGalleries(wdNumberGallery).ListTemplates(2)
MsgBox "This document has " & ActiveDocument.Lists.Count _
 & " lists."

This example formats the third list in the active document with the default bulleted list format. If the list is already formatted with a bulleted list format, the example removes the formatting.

VBA Copy code Copy code
If ActiveDocument.Lists.Count >= 3 Then
 ActiveDocument.Lists(3).Range.ListFormat.ApplyBulletDefault
End If

This example displays a message box that reports the number of items in each list in MyLetter.doc.

VBA Copy code Copy code
Set myDoc = Documents("MyLetter.doc")
i = myDoc.Lists.Count
For each li in myDoc.Lists
 Msgbox "List " & i & " has " & li.CountNumberedItems _
 & " items."
 i = i - 1
Next li

See also

Concepts

Document Object

Other resources

Document Object Members


Document.ListTemplates Property (Word)

 Copy code hover
[image]

Document.ListTemplates Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a ListTemplates collection that represents all the list formats for the specified document. Read-only.

Syntax

expression .ListTemplates

expression A variable that represents a Document object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example displays the number of list templates used in the active document.

VBA Copy code Copy code
Msgbox ActiveDocument.ListTemplates.Count

See also

Concepts

Document Object

Other resources

Document Object Members


Document.LockQuickStyleSet Property (Word)

 Copy code hover
[image]

Document.LockQuickStyleSet Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents whether users can change which set of Quick Styles is being used. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .LockQuickStyleSet

expression An expression that returns a Document object.

See also

Concepts

Document Object

Other resources

Document Object Members


Document.LockTheme Property (Word)

 Copy code hover
[image]

Document.LockTheme Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents whether a user can change a document theme. Read/write.

Syntax

expression .LockTheme

expression An expression that returns a Document object.

Remarks

Use the ApplyDocumentTheme method to apply a Microsoft Office theme. Use the DocumentTheme property to return the Office theme that is applied to a document.

See also

Concepts

Document Object

Other resources

Document Object Members


Document.MailEnvelope Property (Word)

 Copy code hover
[image]

Document.MailEnvelope Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an MsoEnvelope object that represents an e-mail header for a document.

Syntax

expression .MailEnvelope

expression An expression that returns a Document object.

Example

This example sets the comments for the e-mail header of the active document.

VBA Copy code Copy code
Sub HeaderComments()

 ActiveDocument.MailEnvelope.Introduction = _
 "Please review this document and let me know " & _
 "what you think. I need your input by Friday." & _
 " Thanks."

End Sub

See also

Concepts

Document Object

Other resources

Document Object Members


Document.MailMerge Property (Word)

 Copy code hover
[image]

Document.MailMerge Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a MailMerge object that represents the mail merge functionality for the specified document. Read-only.

Syntax

expression .MailMerge

expression A variable that represents a Document object.

Remarks

The MailMerge object is available regardless of whether the specified document is a mail merge main document. Use the State property to determine the current state of the mail merge operation.

Example

This example executes a mail merge if the active document is a main document with an attached data source.

VBA Copy code Copy code
Set myMerge = ActiveDocument.MailMerge
If myMerge.State = wdMainAndDataSource Then myMerge.Execute

This example merges the main document with records 1 through 4 and sends the merge documents to the printer.

VBA Copy code Copy code
With ActiveDocument.MailMerge
 .DataSource.FirstRecord = 1
 .DataSource.LastRecord = 4
 .Destination = wdSendToPrinter
 .SuppressBlankLines = True
 .Execute
End With

See also

Concepts

Document Object

Other resources

Document Object Members


Document.Name Property (Word)

 Copy code hover
[image]

Document.Name Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the name of the specified object. Read-only String.

Syntax

expression .Name

expression Required. A variable that represents a Document object.

Example

This example returns the name of the first bookmark in Hello.doc.

VBA Copy code Copy code
abook = Documents("Hello.doc").Bookmarks(1).Name

See also

Concepts

Document Object

Other resources

Document Object Members


Document.NoLineBreakAfter Property (Word)

 Copy code hover
[image]

Document.NoLineBreakAfter Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the kinsoku characters after which Microsoft Word will not break a line. Read/write String.

Syntax

expression .NoLineBreakAfter

expression A variable that represents a Document object.

Example

This example sets "$", "(", "[", "\", and "{" as the kinsoku characters after which Microsoft Word will not break a line in the active document.

VBA Copy code Copy code
ActiveDocument.NoLineBreakAfter = "$([\{"

See also

Concepts

Document Object

Other resources

Document Object Members


Document.NoLineBreakBefore Property (Word)

 Copy code hover
[image]

Document.NoLineBreakBefore Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the kinsoku characters before which Microsoft Word will not break a line. Read/write String.

Syntax

expression .NoLineBreakBefore

expression A variable that represents a Document object.

Example

This example sets "!", ")", and "]" as the kinsoku characters before which Microsoft Word will not break a line in the active document.

VBA Copy code Copy code
ActiveDocument.NoLineBreakBefore = "!)]"

See also

Concepts

Document Object

Other resources

Document Object Members


Document.OMathBreakBin Property (Word)

 Copy code hover
[image]

Document.OMathBreakBin Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a WdOMathBreakBin constant that represents where Microsoft Word places binary operators when equations span two or more lines. Read/write.

Syntax

expression .OMathBreakBin

expression An expression that returns a Document object.

Remarks

When the equation breaks on a binary operator—for example, an addition, subtraction, or multiplication operator—there are three different placements of the operator: before the break, after the break, and repeated both before and after the break.

When this property is set to wdOMathBreakBinRepeat, use the OMathBreakSub property to specify how Word treats subtraction operators that appear before a line break.

See also

Concepts

Document Object

Other resources

Document Object Members


Document.OMathBreakSub Property (Word)

 Copy code hover
[image]

Document.OMathBreakSub Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a WdOMathBreakSub constant that represents how Microsoft Word handles a subtraction operator that falls before a line break. Read/write.

Syntax

expression .OMathBreakSub

expression An expression that returns a Document object.

Remarks

This property is used only when the OMathBreakBin property is set to wdOMathBreakBinRepeat. Subtraction sometimes receives special treatment when a line break falls on a subtraction operator and the document setting is to repeat the subtraction operator on the following line, because two negatives make a positive. Some writers choose to convert one of the minus signs into a plus sign, and some choose to keep the two negatives.

See also

Concepts

Document Object

Other resources

Document Object Members


Document.OMathFontName Property (Word)

 Copy code hover
[image]

Document.OMathFontName Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a String that represents the name of the font used in a document to display equations. Read/write.

Syntax

expression .OMathFontName

expression An expression that returns a Document object.

See also

Concepts

Document Object

Other resources

Document Object Members


Document.OMathIntSubSupLim Property (Word)

 Copy code hover
[image]

Document.OMathIntSubSupLim Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents the default location of limits for integrals. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .OMathIntSubSupLim

expression An expression that returns a Document object.

See also

Concepts

Document Object

Other resources

Document Object Members


Document.OMathJc Property (Word)

 Copy code hover
[image]

Document.OMathJc Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a WdOMathJc constant that represents the default justification—left, right, centered, or centered as a group—of a group of equations. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .OMathJc

expression An expression that returns a Document object.

See also

Concepts

Document Object

Other resources

Document Object Members


Document.OMathLeftMargin Property (Word)

 Copy code hover
[image]

Document.OMathLeftMargin Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Single that represents the left margin for equations. Read/write.

Syntax

expression .OMathLeftMargin

expression An expression that returns a Document object.

See also

Concepts

Document Object

Other resources

Document Object Members


Document.OMathNarySupSubLim Property (Word)

 Copy code hover
[image]

Document.OMathNarySupSubLim Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents the default location of limits for n-ary objects other than integrals. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .OMathNarySupSubLim

expression An expression that returns a Document object.

See also

Concepts

Document Object

Other resources

Document Object Members


Document.OMathRightMargin Property (Word)

 Copy code hover
[image]

Document.OMathRightMargin Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Single that represents the right margin for equations. Read/write.

Syntax

expression .OMathRightMargin

expression An expression that returns a Document object.

See also

Concepts

Document Object

Other resources

Document Object Members


Document.OMaths Property (Word)

 Copy code hover
[image]

Document.OMaths Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMaths collection that represents the OMath objects within the specified range. Read-only.

Syntax

expression .OMaths

expression An expression that returns a Document object.

See also

Concepts

Document Object

Other resources

Document Object Members


Document.OMathSmallFrac Property (Word)

 Copy code hover
[image]

Document.OMathSmallFrac Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents whether to use small fractions in equations contained within the document. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .OMathSmallFrac

expression An expression that returns a Document object.

See also

Concepts

Document Object

Other resources

Document Object Members


Document.OMathWrap Property (Word)

 Copy code hover
[image]

Document.OMathWrap Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Single that represents the placement of the second line of an equation that wraps to a new line. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .OMathWrap

expression An expression that returns a Document object.

Remarks

A value of -1 specifies that the continuation of the equation is right-aligned. All positive values indicate the indent from the left margin.

See also

Concepts

Document Object

Other resources

Document Object Members


Document.OpenEncoding Property (Word)

 Copy code hover
[image]

Document.OpenEncoding Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the encoding used to open the specified document. Read-only MsoEncoding.

Syntax

expression .OpenEncoding

expression Required. A variable that represents a Document object.

Example

This example tests whether the current document was opened with UTF7 encoding.

VBA Copy code Copy code
If ActiveDocument.OpenEncoding = msoEncodingUTF7 Then
 MsgBox "This is a UTF7-encoded text file!"
Else
 MsgBox "This is not a UTF7-encoded text file!"
End If

See also

Concepts

Document Object

Other resources

Document Object Members


Document.OptimizeForWord97 Property (Word)

 Copy code hover
[image]

Document.OptimizeForWord97 Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word optimizes the current document for viewing in Microsoft Word 97 by disabling any incompatible formatting. Read/write Boolean.

Syntax

expression .OptimizeForWord97

expression A variable that represents a Document object.

Remarks

To optimize all new documents for Word 97 by default, use the OptimizeForWord97byDefault property.

Example

This example checks the current document to see if it is optimized for Word 97; if it is not, the example asks the user whether it should be.

VBA Copy code Copy code
If ActiveDocument.OptimizeForWord97 = False Then
 x = MsgBox("Is this document targeted at " _
 & "Word 97 users?", vbYesNo)
 If x = vbYes Then _
 ActiveDocument.OptimizeForWord97 = True
End If

See also

Concepts

Document Object

Other resources

Document Object Members


Document.OriginalDocumentTitle Property (Word)

 Copy code hover
[image]

Document.OriginalDocumentTitle Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a String that represents the document title for the original document after running a legal-blackline document compare function. Read-only.

Syntax

expression .OriginalDocumentTitle

expression An expression that returns a Document object.

Remarks

To perform a legal-blackline document compare, use the CompareDocuments method.

See also

Concepts

Document Object

Other resources

Document Object Members


Document.PageSetup Property (Word)

 Copy code hover
[image]

Document.PageSetup Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a PageSetup object that is associated with the specified document.

Syntax

expression .PageSetup

expression A variable that represents a Document object.

Example

This example sets the right margin of the active document to 72 points (1 inch).

VBA Copy code Copy code
ActiveDocument.PageSetup.RightMargin = InchesToPoints(1)

This example displays the left margin setting, in inches.

VBA Copy code Copy code
MsgBox PointsToInches(ActiveDocument.PageSetup.LeftMargin) _
 & " inches"

See also

Concepts

Document Object

Other resources

Document Object Members


Document.Paragraphs Property (Word)

 Copy code hover
[image]

Document.Paragraphs Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Paragraphs collection that represents all the paragraphs in the specified document. Read-only.

Syntax

expression .Paragraphs

expression A variable that represents a Document object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example sets the line spacing to single for the collection of all paragraphs in section one in the active document.

VBA Copy code Copy code
ActiveDocument.Sections(1).Range.Paragraphs.LineSpacingRule = _
 wdLineSpaceSingle

This example sets the line spacing to double for the first paragraph in the selection.

VBA Copy code Copy code
Selection.Paragraphs(1).LineSpacingRule = wdLineSpaceDouble

See also

Concepts

Document Object

Other resources

Document Object Members


Document.Parent Property (Word)

 Copy code hover
[image]

Document.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Document object.

Syntax

expression .Parent

expression Required. A variable that represents a Document object.

See also

Concepts

Document Object

Other resources

Document Object Members


Document.Password Property (Word)

 Copy code hover
[image]

Document.Password Property (Word)
See also Send feedback

Published: July 16, 2012

Sets a password that must be supplied to open the specified document. Write-only String.

Syntax

expression .Password

expression A variable that represents a Document object.

Remarks

Important note Important

Avoid using hard-coded passwords in your applications. If a password is required in a procedure, request the password from the user, store it in a variable, and then use the variable in your code. For recommended best practices on how to do this, see Security Notes for Microsoft Office Solution Developers.

Example

This example opens Earnings.doc, sets a password for it, and then closes the document.

VBA Copy code Copy code
Set myDoc = Documents _
 .Open(FileName:="C:\My Documents\Earnings.doc")
myDoc.Password = strPassword
myDoc.Close

See also

Concepts

Document Object

Other resources

Document Object Members


Document.PasswordEncryptionAlgorithm Property (Word)

 Copy code hover
[image]

Document.PasswordEncryptionAlgorithm Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a String indicating the algorithm Microsoft Word uses for encrypting documents with passwords. Read-only.

Syntax

expression .PasswordEncryptionAlgorithm

expression A variable that represents a Document object.

Remarks

Use the SetPasswordEncryptionOptions method to specify the algorithm Word uses for encrypting documents with passwords.

Example

This example sets the password encryption options if the password encryption algorithm in use is "OfficeXor," which is the password algorithm used in versions of Word prior to Word 97 for Windows.

VBA Copy code Copy code
Sub PasswordSettings()
 With ActiveDocument
 If .PasswordEncryptionAlgorithm = "OfficeXor" Then
 .SetPasswordEncryptionOptions _
 PasswordEncryptionProvider:="Microsoft RSA SChannel Cryptographic Provider", _
 PasswordEncryptionAlgorithm:="RC4", _
 PasswordEncryptionKeyLength:=56, _
 PasswordEncryptionFileProperties:=True
 End If
 End With
End Sub

See also

Concepts

Document Object

Other resources

Document Object Members


Document.PasswordEncryptionFileProperties Property (Word)

 Copy code hover
[image]

Document.PasswordEncryptionFileProperties Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word encrypts file properties for password-protected documents. Read-only Boolean.

Syntax

expression .PasswordEncryptionFileProperties

expression A variable that represents a Document object.

Remarks

Use the SetPasswordEncryptionOptions method to specify whether Word encrypts file properties for password-protected documents.

Example

This example sets the password encryption options if the file properties are not encrypted for password-protected documents.

VBA Copy code Copy code
Sub PasswordSettings()
 With ActiveDocument
 If .PasswordEncryptionFileProperties = False Then
 .SetPasswordEncryptionOptions _
 PasswordEncryptionProvider:="Microsoft RSA SChannel Cryptographic Provider", _
 PasswordEncryptionAlgorithm:="RC4", _
 PasswordEncryptionKeyLength:=56, _
 PasswordEncryptionFileProperties:=True
 End If
 End With
End Sub

See also

Concepts

Document Object

Other resources

Document Object Members


Document.PasswordEncryptionKeyLength Property (Word)

 Copy code hover
[image]

Document.PasswordEncryptionKeyLength Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long indicating the key length of the algorithm Microsoft Word uses when encrypting documents with passwords. Read-only.

Syntax

expression .PasswordEncryptionKeyLength

expression A variable that represents a Document object.

Remarks

Use the SetPasswordEncryptionOptions method to specify the key length Word uses when encrypting documents with passwords.

Example

This example sets the password encryption options if the password encryption key length is less than 40.

VBA Copy code Copy code
Sub PasswordSettings()
 With ActiveDocument
 If .PasswordEncryptionKeyLength < 40 Then
 .SetPasswordEncryptionOptions _
 PasswordEncryptionProvider:="Microsoft RSA SChannel Cryptographic Provider", _
 PasswordEncryptionAlgorithm:="RC4", _
 PasswordEncryptionKeyLength:=56, _
 PasswordEncryptionFileProperties:=True
 End If
 End With
End Sub

See also

Concepts

Document Object

Other resources

Document Object Members


Document.PasswordEncryptionProvider Property (Word)

 Copy code hover
[image]

Document.PasswordEncryptionProvider Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a String specifying the name of the algorithm encryption provider that Microsoft Word uses when encrypting documents with passwords. Read-only.

Syntax

expression .PasswordEncryptionProvider

expression A variable that represents a Document object.

Remarks

Use the SetPasswordEncryptionOptions method to specify the name of the algorithm encryption provider Word uses when encrypting documents with passwords.

Example

This example sets the password encryption options if the password encryption algorithm in use is not "Microsoft RSA SChannel Cryptographic Provider."

VBA Copy code Copy code
Sub PasswordSettings()
 With ActiveDocument
 If .PasswordEncryptionProvider <> "Microsoft RSA SChannel Cryptographic Provider" Then
 .SetPasswordEncryptionOptions _
 PasswordEncryptionProvider:="Microsoft RSA SChannel Cryptographic Provider", _
 PasswordEncryptionAlgorithm:="RC4", _
 PasswordEncryptionKeyLength:=56, _
 PasswordEncryptionFileProperties:=True
 End If
 End With
End Sub

See also

Concepts

Document Object

Other resources

Document Object Members


Document.Path Property (Word)

 Copy code hover
[image]

Document.Path Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the disk or Web path to the document. Read-only String.

Syntax

expression .Path

expression Required. A variable that represents a Document object.

Remarks

The path doesn't include a trailing character — for example, "C:\MSOffice" or "http://MyServer". Use the PathSeparator property to add the character that separates folders and drive letters. Use the Name property to return the file name without the path and use the FullName property to return the file name and the path together.

Note Note

You can use the PathSeparator property to build Web addresses even though they contain forward slashes (/) and the PathSeparator property defaults to a backslash (\).

Example

This example displays the path and file name of the active document.

VBA Copy code Copy code
MsgBox ActiveDocument.Path & Application.PathSeparator & _
 ActiveDocument.Name

This example changes the current folder to the path of the template attached to the active document.

VBA Copy code Copy code
ChDir ActiveDocument.AttachedTemplate.Path

See also

Concepts

Document Object

Other resources

Document Object Members


Document.Permission Property (Word)

 Copy code hover
[image]

Document.Permission Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Permission object that represents the permission settings in the specified document.

Syntax

expression .Permission

expression An expression that returns a Document object.

Example

The following example returns the permission settings for the active document.

VBA Copy code Copy code
Dim objPermission As Permission

Set objPermission = ActiveDocument.Permission

See also

Concepts

Document Object

Other resources

Document Object Members


Document.PrintFormsData Property (Word)

 Copy code hover
[image]

Document.PrintFormsData Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word prints onto a preprinted form only the data entered in the corresponding online form. Read/write Boolean.

Syntax

expression .PrintFormsData

expression A variable that represents a Document object.

Example

This example sets Word to print only the data from an online form, and then it prints the active document.

VBA Copy code Copy code
ActiveDocument.PrintFormsData = True
ActiveDocument.PrintOut

This example returns the current status of the Print data only for forms check box in the Options for current document only area on the Print tab in the Options dialog box.

VBA Copy code Copy code
temp = ActiveDocument.PrintFormsData

See also

Concepts

Document Object

Other resources

Document Object Members


Document.PrintPostScriptOverText Property (Word)

 Copy code hover
[image]

Document.PrintPostScriptOverText Property (Word)
See also Send feedback

Published: July 16, 2012

True if PRINT field instructions (such as PostScript commands) in a document are to be printed on top of text and graphics when a PostScript printer is used. Read/write Boolean.

Syntax

expression .PrintPostScriptOverText

expression A variable that represents a Document object.

Remarks

The PrintPostScriptOverText property controls whether postscript code is printed in a converted Microsoft Word for Macintosh document. If the document contains no PRINT fields, this property has no effect.

Example

This example sets Word to print PRINT field instructions on top of text and graphics, and then it prints the active document.

VBA Copy code Copy code
ActiveDocument.PrintPostScriptOverText = True
ActiveDocument.PrintOut

This example returns the current status of the Print PostScript over text check box in the Printing options area on the Print tab in the Options dialog box.

VBA Copy code Copy code
currSet = ActiveDocument.PrintPostScriptOverText

See also

Concepts

Document Object

Other resources

Document Object Members


Document.PrintRevisions Property (Word)

 Copy code hover
[image]

Document.PrintRevisions Property (Word)
See also Send feedback

Published: July 16, 2012

True if revision marks are printed with the document. False if revision marks aren't printed (that is, tracked changes are printed as if they'd been accepted). Read/write Boolean.

Syntax

expression .PrintRevisions

expression A variable that represents a Document object.

Example

This example prints the active document without revision marks.

VBA Copy code Copy code
With ActiveDocument
 .PrintRevisions = False
 .PrintOut
End With

See also

Concepts

Document Object

Other resources

Document Object Members


Document.ProtectionType Property (Word)

 Copy code hover
[image]

Document.ProtectionType Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the protection type for the specified document. Can be one of the following WdProtectionType constants: wdAllowOnlyComments, wdAllowOnlyFormFields, wdAllowOnlyReading, wdAllowOnlyRevisions, or wdNoProtection.

Syntax

expression .ProtectionType

expression A variable that represents a Document object.

Example

If the active document isn't already protected, this example protects the document for comments.

VBA Copy code Copy code
If ActiveDocument.ProtectionType = wdNoProtection Then
 ActiveDocument.Protect Type:=wdAllowOnlyComments
End If

This example unprotects the active document if it is protected.

VBA Copy code Copy code
Set Doc = ActiveDocument
If Doc.ProtectionType <> wdNoProtection Then Doc.Unprotect

See also

Concepts

Document Object

Other resources

Document Object Members


Document.ReadabilityStatistics Property (Word)

 Copy code hover
[image]

Document.ReadabilityStatistics Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a ReadabilityStatistics collection that represents the readability statistics for the specified document or range. Read-only.

Syntax

expression .ReadabilityStatistics

expression A variable that represents a Document object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example displays each readability statistic, along with its value, for document one.

VBA Copy code Copy code
For Each rs In Documents(1).ReadabilityStatistics
 Msgbox rs.Name & " - " & rs.Value
Next rs

See also

Concepts

Document Object

Other resources

Document Object Members


Document.ReadingLayoutSizeX Property (Word)

 Copy code hover
[image]

Document.ReadingLayoutSizeX Property (Word)
See also Send feedback

Published: July 16, 2012

Sets or returns a Long that represents the width of pages in a document when it is displayed in reading layout view and is frozen for entering handwritten markup.

Syntax

expression .ReadingLayoutSizeX

expression An expression that returns a Document object.

Remarks

After setting the ReadingLayoutSizeX and ReadingLayoutSizeY properties, use the ReadingModeLayoutFrozen property to display the page using the specified height and width. Use the ReadingLayout property to display a document in reading layout view.

Example

The following example displays the active document in reading layout view and then sets the size of the displayed pages.

VBA Copy code Copy code
ActiveWindow.View.ReadingLayout = True
ActiveDocument.ReadingLayoutSizeX = 300
ActiveDocument.ReadingLayoutSizeY = 300
ActiveDocument.ReadingModeLayoutFrozen = True

See also

Concepts

Document Object

Other resources

Document Object Members


Document.ReadingLayoutSizeY Property (Word)

 Copy code hover
[image]

Document.ReadingLayoutSizeY Property (Word)
See also Send feedback

Published: July 16, 2012

Sets or returns a Long that represents the height of pages in a document when it is displayed in reading layout view and is frozen for entering handwritten markup.

Syntax

expression .ReadingLayoutSizeY

expression An expression that returns a Document object.

Remarks

After setting the ReadingLayoutSizeX and ReadingLayoutSizeY properties, use the ReadingModeLayoutFrozen property to display the page using the specified height and width. Use the ReadingLayout property to display a document in reading layout view.

Example

The following example displays the active document in reading layout view, and then sets the size of the displayed pages.

VBA Copy code Copy code
ActiveWindow.View.ReadingLayout = True
ActiveDocument.ReadingLayoutSizeX = 300
ActiveDocument.ReadingLayoutSizeY = 300
ActiveDocument.ReadingModeLayoutFrozen = True

See also

Concepts

Document Object

Other resources

Document Object Members


Document.ReadingModeLayoutFrozen Property (Word)

 Copy code hover
[image]

Document.ReadingModeLayoutFrozen Property (Word)
See also Send feedback

Published: July 16, 2012

Sets or returns a Boolean that represents whether pages displayed in reading layout view are frozen to a specified size for inserting handwritten markup into a document.

Syntax

expression .ReadingModeLayoutFrozen

expression An expression that returns a Document object.

Remarks

Use the ReadingLayoutSizeX and ReadingLayoutSizeY properties to specify the size of the pages displayed when the reading layout size is frozen for inserting handwritten markup into a document.

Example

The following example displays the active document in reading layout view and then sets the size of the displayed pages.

VBA Copy code Copy code
ActiveWindow.View.ReadingLayout = True
ActiveDocument.ReadingLayoutSize 300, 300
ActiveDocument.ReadingModeLayoutFrozen = True

See also

Concepts

Document Object

Other resources

Document Object Members


Document.ReadOnly Property (Word)

 Copy code hover
[image]

Document.ReadOnly Property (Word)
See also Send feedback

Published: July 16, 2012

True if changes to the document cannot be saved to the original document. Read-only Boolean.

Syntax

expression .ReadOnly

expression Required. A variable that represents a Document object.

Example

This example saves the active document if it isn't read-only.

VBA Copy code Copy code
If ActiveDocument.ReadOnly = False Then ActiveDocument.Save

See also

Concepts

Document Object

Other resources

Document Object Members


Document.ReadOnlyRecommended Property (Word)

 Copy code hover
[image]

Document.ReadOnlyRecommended Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word displays a message box whenever a user opens the document, suggesting that it be opened as read-only. Read/write Boolean.

Syntax

expression .ReadOnlyRecommended

expression A variable that represents a Document object.

Example

This example sets Word to suggest, when it is opening the document, that the document be opened as read-only.

VBA Copy code Copy code
ActiveDocument.ReadOnlyRecommended = True

See also

Concepts

Document Object

Other resources

Document Object Members


Document.RemoveDateAndTime Property (Word)

 Copy code hover
[image]

Document.RemoveDateAndTime Property (Word)
See also Send feedback

Published: July 16, 2012

Sets or returns a Boolean indicating whether a document stores the date and time metadata for tracked changes. .

Syntax

expression .RemoveDateAndTime

expression A variable that represents a Document object.

Remarks

True removes date and time stamp information from tracked changes. False does not remove date and time stamp information from tracked changes. Use the RemoveDateAndTime property in conjunction with the RemovePersonalInformation property to help remove personal information from the document properties.

Example

The following example removes personal information from the active document, and it removes date and time information from any tracked changes in the document.

VBA Copy code Copy code
ActiveDocument.RemovePersonalInformation = True
ActiveDocument.RemoveDateAndTime = True

See also

Concepts

Document Object

Other resources

Document Object Members


Document.RemovePersonalInformation Property (Word)

 Copy code hover
[image]

Document.RemovePersonalInformation Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word removes all user information from comments, revisions, and the Properties dialog box upon saving a document. Read/write Boolean.

Syntax

expression .RemovePersonalInformation

expression A variable that represents a Document object.

Example

This example sets the current document to remove personal information from the document the next time the user saves it.

VBA Copy code Copy code
Sub RemovePersonalInfo()
 ActiveDocument.RemovePersonalInformation = True
End Sub

See also

Concepts

Document Object

Other resources

Document Object Members


Document.Research Property (Word)

 Copy code hover
[image]

Document.Research Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Research object that represents the research service for a document. Read-only.

Syntax

expression .Research

expression An expression that returns a Document object.

See also

Concepts

Document Object

Other resources

Document Object Members


Document.RevisedDocumentTitle Property (Word)

 Copy code hover
[image]

Document.RevisedDocumentTitle Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a String that represents the document title for a revised document after running a legal-blackline document compare function. Read-only.

Syntax

expression .RevisedDocumentTitle

expression An expression that returns a Document object.

Remarks

To perform a legal-blackline document compare, use the CompareDocuments method.

See also

Concepts

Document Object

Other resources

Document Object Members


Document.Revisions Property (Word)

 Copy code hover
[image]

Document.Revisions Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Revisions collection that represents the tracked changes in the document or range. Read-only.

Syntax

expression .Revisions

expression A variable that represents a Document object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example displays the number of tracked changes in the first section in the active document.

VBA Copy code Copy code
MsgBox ActiveDocument.Sections(1).Range.Revisions.Count

This example accepts all tracked changes in the first paragraph in the selection.

VBA Copy code Copy code
Set myRange = Selection.Paragraphs(1).Range
myRange.Revisions.AcceptAll

See also

Concepts

Document Object

Other resources

Document Object Members


Document.Saved Property (Word)

 Copy code hover
[image]

Document.Saved Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified document or template has not changed since it was last saved. False if Microsoft Word displays a prompt to save changes when the document is closed. Read/write Boolean.

Syntax

expression .Saved

expression A variable that represents a Document object.

Example

This example saves the active document if it contains previously unsaved changes.

VBA Copy code Copy code
If ActiveDocument.Saved = False Then ActiveDocument.Save

See also

Concepts

Document Object

Other resources

Document Object Members


Document.SaveEncoding Property (Word)

 Copy code hover
[image]

Document.SaveEncoding Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the encoding to use when saving a document. Read/write MsoEncoding.

Syntax

expression .SaveEncoding

expression Required. A variable that represents a Document object.

Example

This example specifies Western encoding for saving the current document.

VBA Copy code Copy code
ActiveDocument.SaveEncoding = msoEncodingWestern

See also

Concepts

Document Object

Other resources

Document Object Members


Document.SaveFormat Property (Word)

 Copy code hover
[image]

Document.SaveFormat Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the file format of the specified document or file converter. Read-only Long.

Syntax

expression .SaveFormat

expression Required. A variable that represents a Document object.

Remarks

The SaveFormat property will be a unique number that specifies an external file converter or a WdSaveFormat constant.

Use the value of the SaveFormat property for the FileFormat argument of the SaveAs2 method to save a document in a file format for which there isn't a corresponding WdSaveFormat constant.

Example

If the active document is a Rich Text Format (RTF) document, this example saves it as a Microsoft Word document.

VBA Copy code Copy code
If ActiveDocument.SaveFormat = wdFormatRTF Then
 ActiveDocument.SaveAs FileFormat:=wdFormatDocument
End If

See also

Concepts

Document Object

Other resources

Document Object Members


Document.SaveFormsData Property (Word)

 Copy code hover
[image]

Document.SaveFormsData Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word saves the data entered in a form as a tab-delimited record for use in a database. Read/write Boolean.

Syntax

expression .SaveFormsData

expression A variable that represents a Document object.

Example

This example sets Word to save only the data entered in a form

VBA Copy code Copy code
ActiveDocument.SaveFormsData = True

This example returns the current status of the Save data only for forms check box in the Save options area on the Save tab in the Options dialog box.

VBA Copy code Copy code
temp = ActiveDocument.SaveFormsData

See also

Concepts

Document Object

Other resources

Document Object Members


Document.SaveSubsetFonts Property (Word)

 Copy code hover
[image]

Document.SaveSubsetFonts Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word saves a subset of the embedded TrueType fonts with the document. Read/write Boolean.

Syntax

expression .SaveSubsetFonts

expression A variable that represents a Document object.

Remarks

If fewer than 32 characters of a TrueType font are used in a document, Word embeds the subset (only the characters used) in the document. If more than 32 characters are used, Word embeds the entire font.

Example

This example sets a document named "MyDoc" to save only a subset of its embedded TrueType fonts (when just a few characters are used), and then it saves "MyDoc."

VBA Copy code Copy code
With Documents("MyDoc")
 .EmbedTrueTypeFonts = True
 .SaveSubsetFonts = True
 .Save
End With

See also

Concepts

Document Object

Other resources

Document Object Members


Document.Scripts Property (Word)

 Copy code hover
[image]

Document.Scripts Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Scripts collection that represents the collection of HTML scripts in the specified object.

Syntax

expression .Scripts

expression Required. A variable that represents a Document object.

Example

This example displays the text in the first Script object of the active document.

VBA Copy code Copy code
Debug.Print ActiveDocument.Scripts(1).ScriptText

See also

Concepts

Document Object

Other resources

Document Object Members


Document.Sections Property (Word)

 Copy code hover
[image]

Document.Sections Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Section collection that represents the sections in the specified document. Read-only.

Syntax

expression .Sections

expression A variable that represents a Document object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example sets the page orientation for all the sections in the active document.

VBA Copy code Copy code
For Each sec In ActiveDocument.Sections
 sec.PageSetup.Orientation = wdOrientLandscape
Next sec

This example creates a new document then adds some text to the document. It then creates a new section in the document and inserts text into the new section.

VBA Copy code Copy code
Set myDoc = Documents.Add
Selection.InsertAfter "This is section 1."
Set mysec = myDoc.Sections.Add
mysec.Range.InsertAfter "This is section 2"

See also

Concepts

Document Object

Other resources

Document Object Members


Document.Sentences Property (Word)

 Copy code hover
[image]

Document.Sentences Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Sentences collection that represents all the sentences in the document. Read-only.

Syntax

expression .Sentences

expression A variable that represents a Document object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example copies the first sentences in the active document.

VBA Copy code Copy code
ActiveDocument.Sentences(1).Copy

This example deletes the last sentence in the active document.

VBA Copy code Copy code
ActiveDocument.Sentences.Last.Delete

See also

Concepts

Document Object

Other resources

Document Object Members


Document.ServerPolicy Property (Word)

 Copy code hover
[image]

Document.ServerPolicy Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a ServerPolicy object that represents a policy specified for a document stored on a server running Microsoft Office SharePoint Server 2007. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .ServerPolicy

expression An expression that returns a Document object.

See also

Concepts

Document Object

Other resources

Document Object Members


Document.Shapes Property (Word)

 Copy code hover
[image]

Document.Shapes Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Shapes collection that represents all the Shape objects in the specified document. Read-only.

Syntax

expression .Shapes

expression A variable that represents a Document object.

Remarks

This collection can contain drawings, shapes, pictures, OLE objects, ActiveX controls, text objects, and callouts. For information about returning a single member of a collection, see Returning an Object from a Collection.

The Shapes property, when applied to a document, returns all the Shape objects in the main story of the document, excluding the headers and footers.

Example

This example creates a new document, adds a rectangle to it that's 100 points wide and 50 points high, and sets the upper-left corner of the rectangle to be 5 points from the left edge and 25 points from the upper-left corner of the page.

VBA Copy code Copy code
Set myDoc = Documents.Add
myDoc.Shapes.AddShape msoShapeRectangle, 5, 25, 100, 50

This example sets the fill texture for all the shapes in the active document.

VBA Copy code Copy code
For each s in ActiveDocument.Shapes
 s.Fill.PresetTextured msoTextureOak
Next s

This example adds a shadow to the first shape in the active document.

VBA Copy code Copy code
Set myShape = ActiveDocument.Shapes(1)
myShape.Shadow.Type = msoShadow6

See also

Concepts

Document Object

Other resources

Document Object Members


Document.ShowGrammaticalErrors Property (Word)

 Copy code hover
[image]

Document.ShowGrammaticalErrors Property (Word)
See also Send feedback

Published: July 16, 2012

True if grammatical errors are marked by a wavy green line in the specified document. Read/write Boolean.

Syntax

expression .ShowGrammaticalErrors

expression A variable that represents a Document object.

Remarks

To view grammatical errors in your document, you must set the CheckGrammarAsYouType property to True.

Example

This example sets Word to check for grammatical errors as you type and to display any errors found in the active document.

VBA Copy code Copy code
Options.CheckGrammarAsYouType = True
ActiveDocument.ShowGrammaticalErrors = True

See also

Concepts

Document Object

Other resources

Document Object Members


Document.ShowSpellingErrors Property (Word)

 Copy code hover
[image]

Document.ShowSpellingErrors Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word underlines spelling errors in the document. Read/write Boolean.

Syntax

expression .ShowSpellingErrors

expression A variable that represents a Document object.

Remarks

To view spelling errors in a document, you must set the CheckSpellingAsYouType property to True.

Example

This example sets Word to hide the wavy red line that denotes possible spelling errors in the active document.

VBA Copy code Copy code
ActiveDocument.ShowSpellingErrors = False

This example sets Word to show spelling errors in the active document.

VBA Copy code Copy code
Options.CheckSpellingAsYouType = True
ActiveDocument.ShowSpellingErrors = True

This example returns the current status of the Hide spelling errors in this document checkbox in the Spelling area on the Spelling & Grammar tab in the Options dialog box.

VBA Copy code Copy code
temp = ActiveDocument.ShowSpellingErrors

See also

Concepts

Document Object

Other resources

Document Object Members


Document.Signatures Property (Word)

 Copy code hover
[image]

Document.Signatures Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a SignatureSet collection that represents the digital signatures for a document.

Syntax

expression .Signatures

expression An expression that returns a Document object.

Remarks

To digitally sign Microsoft Word documents and verify other signatures in them, you will need the Microsoft CryptoAPI and a unique digital signature certificate. The CryptoAPI is installed with Microsoft Internet Explorer 4.01 and higher. You can obtain a digital signature certificate from a certification authority.

Example

This example displays the Signatures dialog box with which you can add a digital signature to a document.

VBA Copy code Copy code
Sub AddSignature
 ActiveDocument.Signatures.Add
End Sub

See also

Concepts

Document Object

Other resources

Document Object Members


Document.SmartDocument Property (Word)

 Copy code hover
[image]

Document.SmartDocument Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a SmartDocument object that represents the settings for a smart document solution.

Syntax

expression .SmartDocument

expression An expression that returns a Document object.

Remarks

For more information on smart documents, please see the Smart Document Software Development Kit on the Microsoft Developer Network (MSDN) Web site.

Example

The following example displays a dialog box that contains a list of valid XML expansion packs for the active document.

VBA Copy code Copy code
ActiveDocument.SmartDocument.PickSolution

See also

Concepts

Document Object

Other resources

Document Object Members


Document.SnapToGrid Property (Word)

 Copy code hover
[image]

Document.SnapToGrid Property (Word)
See also Send feedback

Published: July 16, 2012

True if AutoShapes or East Asian characters are automatically aligned with an invisible grid when they are drawn, moved, or resized in the specified document. Read/write Boolean.

Syntax

expression .SnapToGrid

expression A variable that represents a Document object.

Remarks

You can temporarily override this setting by pressing ALT while drawing, moving, or resizing an AutoShape.

Example

This example sets Microsoft Word to automatically align East Asian characters with the invisible grid in the current document.

VBA Copy code Copy code
ActiveDocument.SnapToGrid = True

See also

Concepts

Document Object

Other resources

Document Object Members


Document.SnapToShapes Property (Word)

 Copy code hover
[image]

Document.SnapToShapes Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word automatically aligns AutoShapes or East Asian characters with invisible gridlines that go through the vertical and horizontal edges of other AutoShapes or East Asian characters in the specified document. Read/write Boolean.

Syntax

expression .SnapToShapes

expression A variable that represents a Document object.

Remarks

This property creates additional invisible gridlines for each AutoShape. SnapToShapes works independently of the SnapToGrid property.

Example

This example sets Microsoft Word to automatically align East Asian characters with invisible gridlines that go through the vertical and horizontal edges of other East Asian characters in the current document.

VBA Copy code Copy code
ActiveDocument.SnapToShapes = True

See also

Concepts

Document Object

Other resources

Document Object Members


Document.SpellingChecked Property (Word)

 Copy code hover
[image]

Document.SpellingChecked Property (Word)
See also Send feedback

Published: July 16, 2012

True if spelling has been checked throughout the specified range or document. False if all or some of the range or document has not been checked for spelling. Read/write Boolean.

Syntax

expression .SpellingChecked

expression A variable that represents a Document object.

Remarks

To recheck the spelling in a range or document, set the SpellingChecked property to False.

To see whether the range or document contains spelling errors, use the SpellingErrors property.

Example

This example sets the SpellingChecked property to False for MyDocument.doc, and then it runs another spelling check on the document.

VBA Copy code Copy code
Documents("MyDocument.doc").SpellingChecked = False
Documents("MyDocument.doc").CheckSpelling IgnoreUppercase:=False

See also

Concepts

Document Object

Other resources

Document Object Members


Document.SpellingErrors Property (Word)

 Copy code hover
[image]

Document.SpellingErrors Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a ProofreadingErrors collection that represents the words identified as spelling errors in the specified document or range. Read-only.

Syntax

expression .SpellingErrors

expression A variable that represents a Document object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example checks the active document for spelling errors and displays the number of errors found.

VBA Copy code Copy code
myErr = ActiveDocument.SpellingErrors.Count
If myErr = 0 Then
 Msgbox "No spelling errors found."
Else
 Msgbox myErr & " spelling errors found."
End If

See also

Concepts

Document Object

Other resources

Document Object Members


Document.StoryRanges Property (Word)

 Copy code hover
[image]

Document.StoryRanges Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a StoryRanges collection that represents all the stories in the specified document. Read-only.

Syntax

expression .StoryRanges

expression A variable that represents a Document object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example steps through the StoryRanges collection to determine whether wdPrimaryFooterStory is part of the StoryRanges collection.

VBA Copy code Copy code
For Each aStory In ActiveDocument.StoryRanges
 If aStory.StoryType = wdEvenPagesFooterStory Then
 MsgBox "Document includes an even page footer"
 End If
Next aStory

This example adds text to the primary header story and then displays the text.

VBA Copy code Copy code
ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary).Range _
 .Text = "Header text"
MsgBox ActiveDocument.StoryRanges(wdPrimaryHeaderStory).Text

See also

Concepts

Document Object

Other resources

Document Object Members


Document.Styles Property (Word)

 Copy code hover
[image]

Document.Styles Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Styles collection for the specified document. Read-only.

Syntax

expression .Styles

expression A variable that represents a Document object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example applies the Heading 1 style to each paragraph in the active document that begins with the word "Chapter."

VBA Copy code Copy code
For Each para In ActiveDocument.Paragraphs
 If para.Range.Words(1).Text = "Chapter " Then
 para.Style = ActiveDocument.Styles(wdStyleHeading1)
 End If
Next para

This example opens the template attached to the active document and modifies the Heading 1 style. The template is saved, and all styles in the active document are updated.

VBA Copy code Copy code
Set tempDoc = ActiveDocument.AttachedTemplate.OpenAsDocument
With tempDoc.Styles(wdStyleHeading1).Font
 .Name = "Arial"
 .Size = 16
End With
tempDoc.Close SaveChanges:=wdSaveChanges
ActiveDocument.UpdateStyles

See also

Concepts

Document Object

Other resources

Document Object Members


Document.StyleSheets Property (Word)

 Copy code hover
[image]

Document.StyleSheets Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a StyleSheets collection that represents the Web style sheets attached to a document.

Syntax

expression .StyleSheets

expression An variable that represents a Document object.

Example

This example adds a style sheet to the active document and places it highest in the list of style sheets attached to the document. This example assumes that you have a style sheet document named "Website.css" located on your drive C.

VBA Copy code Copy code
Sub Styshts()
 ActiveDocument.StyleSheets.Add _
 FileName:="c:\Website.css", _
 Precedence:=wdStyleSheetPrecedenceHighest
End Sub

See also

Concepts

Document Object

Other resources

Document Object Members


Document.StyleSortMethod Property (Word)

 Copy code hover
[image]

Document.StyleSortMethod Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets aWdStyleSort constant that represents the sort method to use when sorting styles in the Styles task pane. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .StyleSortMethod

expression An expression that returns a Document object.

See also

Concepts

Document Object

Other resources

Document Object Members


Document.Subdocuments Property (Word)

 Copy code hover
[image]

Document.Subdocuments Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Subdocuments collection that represents all the subdocuments in the specified document. Read-only.

Syntax

expression .Subdocuments

expression A variable that represents a Document object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example displays the number of subdocuments embedded in the active document.

VBA Copy code Copy code
MsgBox ActiveDocument.Subdocuments.Count

This example displays the path and file name of each subdocument in the active document.

VBA Copy code Copy code
For Each subdoc In ActiveDocument.Subdocuments
 If subdoc.HasFile = True Then
 MsgBox subdoc.Path & Application.PathSeparator _
 & subdoc.Name
 Else
 MsgBox "This subdocument has not been saved."
 End If
Next subdoc

See also

Concepts

Document Object

Other resources

Document Object Members


Document.Sync Property (Word)

 Copy code hover
[image]

Document.Sync Property (Word)
See also Send feedback

Published: July 16, 2012

This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.

Syntax

expression .Sync

expression Required. A variable that represents a Document object.

Example

The following example displays the name of the last person to modify the active document if the active document is a shared document in a Document Workspace.

VBA Copy code Copy code
Dim eStatus As MsoSyncStatusType
Dim strLastUser As String

eStatus = ActiveDocument.Sync.Status

If eStatus = msoSyncStatusLatest Then
 strLastUser = ActiveDocument.Sync.WorkspaceLastChangedBy
 MsgBox "You have the most up-to-date copy." & _
 "This file was last modified by " & strLastUser
End If

See also

Concepts

Document Object

Other resources

Document Object Members


Document.Tables Property (Word)

 Copy code hover
[image]

Document.Tables Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Table collection that represents all the tables in the specified document. Read-only.

Syntax

expression .Tables

expression A variable that represents a Document object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example creates a 5x5 table in the active document and then applies a predefined format to it.

VBA Copy code Copy code
Selection.Collapse Direction:=wdCollapseStart
Set myTable = ActiveDocument.Tables.Add(Range:=Selection.Range, _
NumRows:=5, NumColumns:=5)
myTable.AutoFormat Format:=wdTableFormatClassic2

This example inserts numbers and text into the first column of the first table in the active document.

VBA Copy code Copy code
num = 90
For Each acell In ActiveDocument.Tables(1).Columns(1).Cells
 acell.Range.Text = num & " Sales"
 num = num + 1
Next acell

See also

Concepts

Document Object

Other resources

Document Object Members


Document.TablesOfAuthorities Property (Word)

 Copy code hover
[image]

Document.TablesOfAuthorities Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a TableOfAuthorities collection that represents the tables of authorities in the specified document. Read-only.

Syntax

expression .TablesOfAuthorities

expression A variable that represents a Document object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example adds a table of authorities at the beginning of Sales.doc. The table of authorities compiles references from all categories.

VBA Copy code Copy code
Set myRange = Documents("Sales.doc").Range(Start:=0, End:=0)
Documents("Sales.doc").TablesOfAuthorities.Add Range:=myRange, _
 Category:=0, Passim:=True, IncludeCategoryHeader:=True

This example updates each table of authorities in the active document.

VBA Copy code Copy code
For Each myTOA In ActiveDocument.TablesOfAuthorities
 myTOA.Update
Next myTOA

See also

Concepts

Document Object

Other resources

Document Object Members


Document.TablesOfAuthoritiesCategories Property (Word)

 Copy code hover
[image]

Document.TablesOfAuthoritiesCategories Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a TablesOfAuthoritiesCategories collection that represents the available table of authorities categories for the specified document. Read-only.

Syntax

expression .TablesOfAuthoritiesCategories

expression A variable that represents a Document object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example changes the name of the eighth item in the table of authorities category list for the active document.

VBA Copy code Copy code
ActiveDocument.TablesOfAuthoritiesCategories(8).Name = "Other case"

This example displays the name of the last table of authorities category if the category name has been changed.

VBA Copy code Copy code
last = ActiveDocument.TablesOfAuthoritiesCategories.Count
If ActiveDocument.TablesOfAuthoritiesCategories(last) _
 .Name <> "16" Then
 MsgBox ActiveDocument.TablesOfAuthoritiesCategories(last).Name
End If

See also

Concepts

Document Object

Other resources

Document Object Members


Document.TablesOfContents Property (Word)

 Copy code hover
[image]

Document.TablesOfContents Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a TablesOfContents collection that represents the tables of contents in the specified document. Read-only.

Syntax

expression .TablesOfContents

expression A variable that represents a Document object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example adds a table of contents at the beginning of Sales.doc. The table of contents collects entry text from TC fields.

VBA Copy code Copy code
Set myRange = Documents("Sales.doc").Range(Start:=0, End:=0)
Documents("Sales.doc").TablesOfContents.Add Range:=myRange, _
 UseFields:=True, UseHeadingStyles:=False

This example updates the page numbers for items in the table of contents in the active document.

VBA Copy code Copy code
For Each myTOC In ActiveDocument.TablesOfContents
 myTOC.UpdatePageNumbers
Next myTOC

See also

Concepts

Document Object

Other resources

Document Object Members


Document.TablesOfFigures Property (Word)

 Copy code hover
[image]

Document.TablesOfFigures Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a TablesOfFigures collection that represents the tables of figures in the specified document. Read-only.

Syntax

expression .TablesOfFigures

expression A variable that represents a Document object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example adds a table of figures at the insertion point in the active document.

VBA Copy code Copy code
Selection.Collapse Direction:=wdCollapseStart
ActiveDocument.TablesOfFigures.Add Range:=Selection.Range, _
 Caption:=wdCaptionFigure

This example updates the contents of the first table of figures in Report.doc.

VBA Copy code Copy code
Documents("Report.doc").TablesOfFigures(1).Update

See also

Concepts

Document Object

Other resources

Document Object Members


Document.TextEncoding Property (Word)

 Copy code hover
[image]

Document.TextEncoding Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the code page, or character set, that Microsoft Word uses for a document saved as an encoded text file. Read/write MsoEncoding.

Syntax

expression .TextEncoding

expression Required. A variable that represents a Document object.

Remarks

The TextEncoding property sets text encoding separately from HTML encoding, which you can set using the Encoding property. To set text encoding for all documents saved as text files, use the DefaultTextEncoding property.

Example

This example sets the text encoding for the active document to Japanese if it is saved as a text file.

VBA Copy code Copy code
Sub EncodeText()
 ActiveDocument.TextEncoding = msoEncodingJapaneseShiftJIS
End Sub

See also

Concepts

Document Object

Other resources

Document Object Members


Document.TextLineEnding Property (Word)

 Copy code hover
[image]

Document.TextLineEnding Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a WdLineEndingType constant indicating how Microsoft Word marks the line and paragraph breaks in documents saved as text files. Read/write.

Syntax

expression .TextLineEnding

expression Required. A variable that represents a Document object.

Example

This example sets the active document to enter a carriage return for line and paragraph breaks when it is saved as a text file.

VBA Copy code Copy code
Sub LineEndings()
 ActiveDocument.TextLineEnding = wdCROnly
End Sub

See also

Concepts

Document Object

Other resources

Document Object Members


Document.TrackFormatting Property (Word)

 Copy code hover
[image]

Document.TrackFormatting Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents whether to track formatting changes when change tracking is turned on. Read/write.

Syntax

expression .TrackFormatting

expression An expression that returns a Document object.

See also

Concepts

Document Object

Other resources

Document Object Members


Document.TrackMoves Property (Word)

 Copy code hover
[image]

Document.TrackMoves Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents whether to mark moved text when Track Changes is turned on. Read/write.

Syntax

expression .TrackMoves

expression An expression that returns a Document object.

Remarks

By default, when Track Changes is turned on, moved text is marked as deleted and inserted. When TrackMoves is True, moved text is marked as moved, with the from text being marked with strikethrough formatting. This property corresponds to the Track Moves check box in the Track Change Options dialog box.

See also

Concepts

Document Object

Other resources

Document Object Members


Document.TrackRevisions Property (Word)

 Copy code hover
[image]

Document.TrackRevisions Property (Word)
See also Send feedback

Published: July 16, 2012

True if changes are tracked in the specified document. Read/write Boolean.

Syntax

expression .TrackRevisions

expression A variable that represents a Document object.

Example

This example sets the active document so that it tracks changes and makes them visible on the screen.

VBA Copy code Copy code
With ActiveDocument
 .TrackRevisions = True
 .ShowRevisions = True
End With

This example inserts text if change tracking isn't enabled.

VBA Copy code Copy code
If ActiveDocument.TrackRevisions = False Then
 Selection.InsertBefore "new text"
End If

See also

Concepts

Document Object

Other resources

Document Object Members


Document.Type Property (Word)

 Copy code hover
[image]

Document.Type Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the document type (template or document). Read-only WdDocumentType.

Syntax

expression .Type

expression Required. A variable that represents a Document object.

Example

If the active window contains a document, this example redefines the Heading 1 style as centered.

VBA Copy code Copy code
If ActiveDocument.ActiveWindow.Type = wdWindowDocument Then
 ActiveDocument.Styles("Heading 1") _
 .ParagraphFormat.Alignment = wdAlignParagraphCenter
End If

See also

Concepts

Document Object

Other resources

Document Object Members


Document.UpdateStylesOnOpen Property (Word)

 Copy code hover
[image]

Document.UpdateStylesOnOpen Property (Word)
See also Send feedback

Published: July 16, 2012

True if the styles in the specified document are updated to match the styles in the attached template each time the document is opened. Read/write Boolean.

Syntax

expression .UpdateStylesOnOpen

expression A variable that represents a Document object.

Example

This example enables the option to update document styles for all open documents and then closes the documents. When any of these documents is reopened, changes to the styles in the attached template will automatically appear in the document.

VBA Copy code Copy code
For Each doc In Documents
 doc.UpdateStylesOnOpen = True
 doc.Close SaveChanges:=wdSaveChanges
Next doc

This example disables the option to update document styles so that changes made to the styles in the attached template aren't reflected in Report.doc.

VBA Copy code Copy code
Documents("Report.doc").UpdateStylesOnOpen = False

See also

Concepts

Document Object

Other resources

Document Object Members


Document.UseMathDefaults Property (Word)

 Copy code hover
[image]

Document.UseMathDefaults Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents whether to use the default math settings when creating new equations. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .UseMathDefaults

expression An expression that returns a Document object.

See also

Concepts

Document Object

Other resources

Document Object Members


Document.UserControl Property (Word)

 Copy code hover
[image]

Document.UserControl Property (Word)
See also Send feedback

Published: July 16, 2012

True if the document was created or opened by the user. Read/write Boolean.

Syntax

expression .UserControl

expression A variable that represents a Document object.

Remarks

This property returns False if the document was created or opened programmatically from another Microsoft Office application with the Open method or the Visual Basic CreateObject or GetObject command.

Note Note

If Word is visible to the user or if you call the UserControl property from within a Word code module, this property will always return True.

Example

This example displays the status of the UserControl property for the active document. This example will only work correctly when run from another Office application with the Word object library loaded.

VBA Copy code Copy code
Set wd = New Word.Application
Set wdDoc = _
 wd.Documents.Open("C:\My Documents\doc1.doc")
If wdDoc.UserControl = True Then
 MsgBox "This document was created or opened by the user."
Else
 MsgBox "This document was created programmatically."
End If

See also

Concepts

Document Object

Other resources

Document Object Members


Document.Variables Property (Word)

 Copy code hover
[image]

Document.Variables Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Variables collection that represents the variables stored in the specified document. Read-only.

Syntax

expression .Variables

expression A variable that represents a Document object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example adds a document variable named "Value1" to the active document. The example then retrieves the value from the Value1 variable, adds 3 to the value, and displays the results.

VBA Copy code Copy code
ActiveDocument.Variables.Add Name:="Value1", Value:="1"
MsgBox ActiveDocument.Variables("Value1") + 3

This example displays the name and value of each document variable in the active document.

VBA Copy code Copy code
For Each myVar In ActiveDocument.Variables
 MsgBox "Name =" & myVar.Name & vbCr & "Value = " & myVar.Value
Next myVar

See also

Concepts

Document Object

Other resources

Document Object Members


Document.VBASigned Property (Word)

 Copy code hover
[image]

Document.VBASigned Property (Word)
See also Send feedback

Published: July 16, 2012

True if the Microsoft Visual Basic for Applications (VBA) project for the specified document has been digitally signed. Read-only Boolean.

Syntax

expression .VBASigned

expression A variable that represents a Document object.

Example

This example loads a document called "Temp.doc" and tests to see whether or not it has a digital signature. If there is no digital signature, the example displays a warning message.

VBA Copy code Copy code
Documents.Open FileName:="C:\My Documents\Temp.doc"
If ActiveDocument.VBASigned = False Then
 MsgBox "Warning! This document " _
 & "has not been digitally signed.", _
 vbCritical, "Digital Signature Warning"
End If

See also

Concepts

Document Object

Other resources

Document Object Members


Document.VBProject Property (Word)

 Copy code hover
[image]

Document.VBProject Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the VBProject object for the specified template or document.

Syntax

expression .VBProject

expression Required. A variable that represents a Document object.

Remarks

Use this property to gain access to code modules and user forms.

To view the VBProject object in the object browser, you must select the Microsoft Visual Basic for Applications Extensibility check box in the References dialog box (Tools menu) in the Visual Basic Editor.

Example

This example displays the name of the Visual Basic project for the active document.

VBA Copy code Copy code
Set currProj = ActiveDocument.VBProject
MsgBox currProj.Name

This example adds a standard code module to the active document and renames it "MyModule."

VBA Copy code Copy code
Set newModule = ActiveDocument.VBProject.VBComponents _
 .Add(vbext_ct_StdModule)
NewModule.Name = "MyModule"

See also

Concepts

Document Object

Other resources

Document Object Members


Document.WebOptions Property (Word)

 Copy code hover
[image]

Document.WebOptions Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the WebOptions object, which contains document-level attributes used by Microsoft Word when you save a document as a Web page or open a Web page. Read-only.

Syntax

expression .WebOptions

expression A variable that represents a Document object.

Example

This example specifies that cascading style sheets and Western document encoding be used when items in the active document are saved to a Web page.

VBA Copy code Copy code
Set objWO = ActiveDocument.WebOptions
objWO.RelyOnCSS = True
objWO.Encoding = msoEncodingWestern

See also

Concepts

Document Object

Other resources

Document Object Members


Document.Windows Property (Word)

 Copy code hover
[image]

Document.Windows Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Windows collection that represents all windows for the specified document. Read-only.

Syntax

expression .Windows

expression A variable that represents a Document object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example displays the number of windows for the active document, both before and after the NewWindow method is run.

VBA Copy code Copy code
MsgBox Prompt:= ActiveDocument.Windows.Count & " window(s)", _
 Title:= ActiveDocument.Name
ActiveDocument.ActiveWindow.NewWindow
MsgBox Prompt:= ActiveDocument.Windows.Count & " windows", _
 Title:= ActiveDocument.Name

See also

Concepts

Document Object

Other resources

Document Object Members


Document.WordOpenXML Property (Word)

 Copy code hover
[image]

Document.WordOpenXML Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a String that represents the flat XML format for the Word Open XML contents of the document. Read-only.

Syntax

expression .WordOpenXML

expression An expression that returns a Document object.

See also

Concepts

Document Object

Other resources

Document Object Members


Document.Words Property (Word)

 Copy code hover
[image]

Document.Words Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Words collection that represents all the words in a document. Read-only.

Syntax

expression .Words

expression A variable that represents a Document object.

Remarks

Punctuation and paragraph marks in a document are included in the Words collection.

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example displays the number of words in the selection. Paragraphs marks, partial words, and punctuation are included in the count.

VBA Copy code Copy code
MsgBox "There are " & Selection.Words.Count & " words."

This example steps through the words in myRange (which spans from the beginning of the active document to the end of the selection) and deletes the word "Franklin" (including the trailing space) wherever it occurs in the range.

VBA Copy code Copy code
Set myRange = ActiveDocument.Range(Start:=0, End:=Selection.End)
For Each aWord In myRange.Words
 If aWord.Text = "Franklin " Then aWord.Delete
Next aWord

See also

Concepts

Document Object

Other resources

Document Object Members


Document.WritePassword Property (Word)

 Copy code hover
[image]

Document.WritePassword Property (Word)
See also Send feedback

Published: July 16, 2012

Sets a password for saving changes to the specified document. Write-only String.

Syntax

expression .WritePassword

expression A variable that represents a Document object.

Remarks

Important note Important

Avoid using hard-coded passwords in your applications. If a password is required in a procedure, request the password from the user, store it in a variable, and then use the variable in your code. For recommended best practices on how to do this, see Security Notes for Microsoft Office Solution Developers.

Example

If the active document isn't already protected against saving changes, this example sets "secret" as the write password for the document.

VBA Copy code Copy code
Set myDoc = ActiveDocument
If myDoc.WriteReserved = False Then myDoc.WritePassword = "secret"

See also

Concepts

Document Object

Other resources

Document Object Members


Document.WriteReserved Property (Word)

 Copy code hover
[image]

Document.WriteReserved Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified document is protected with a write password. Read-only Boolean.

Syntax

expression .WriteReserved

expression A variable that represents a Document object.

Example

This example displays a message if the active document has a write password.

VBA Copy code Copy code
If ActiveDocument.WriteReserved = True Then
 MsgBox "Changes cannot be made to this document."
End If

See also

Concepts

Document Object

Other resources

Document Object Members


Document.XMLSaveThroughXSLT Property (Word)

 Copy code hover
[image]

Document.XMLSaveThroughXSLT Property (Word)
See also Send feedback

Published: July 16, 2012

Sets or returns a String that specifies the path and file name for the Extensible Stylesheet Language Transformation (XSLT) to apply when a user saves a document.

Syntax

expression .XMLSaveThroughXSLT

expression An expression that returns a Document object.

Remarks

The XMLSaveThroughXSLT property is only applicable when the XMLUseXSLTWhenSaving property is set to True. If the XMLUseXSLTWhenSaving property is set to False, Microsoft Word will ignore the XMLSaveThroughXSLT property.

Example

The following example specifies that Word will use an XSLT when saving the active document, and then it specifies which XSLT to use.

VBA Copy code Copy code
ActiveDocument.XMLUseXSLTWhenSaving = True
ActiveDocument.XMLSaveThroughXSLT = "c:\schemas\book.xsl"

See also

Concepts

Document Object

Other resources

Document Object Members


Document.XMLSchemaReferences Property (Word)

 Copy code hover
[image]

Document.XMLSchemaReferences Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an XMLSchemaReferences collection that represents the schemas attached to a document.

Syntax

expression .XMLSchemaReferences

expression An expression that returns a Document object.

Example

The following example reloads the first schema attached to the active document.

VBA Copy code Copy code
Dim objSchema As XMLSchemaReference

Set objSchema = ActiveDocument.XMLSchemaReferences.Item(1)

objSchema.Reload

See also

Concepts

Document Object

Other resources

Document Object Members


Document.XMLShowAdvancedErrors Property (Word)

 Copy code hover
[image]

Document.XMLShowAdvancedErrors Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents whether error message text is generated from the built-in Microsoft Word error messages or from the Microsoft XML Core Services (MSXML) 5.0 component included with Office.

Syntax

expression .XMLShowAdvancedErrors

expression An expression that returns a Document object.

Remarks

Using advanced error messages from the MSXML 5.0 component provides more specific error messages. There are approximately 500 error messages provided through the XML Core Services that are accessible when the XMLShowAdvancedErrors property is True.

Word has approximately 50 built-in generic schema errors. When the XMLShowAdvancedErrors property is False, Word uses the built-in error messages for errors generated in XML documents.

Example

The following example enables advanced error messages in the active document.

VBA Copy code Copy code
ActiveDocument.XMLShowAdvancedErrors = True

See also

Concepts

Document Object

Other resources

Document Object Members


Document.XMLUseXSLTWhenSaving Property (Word)

 Copy code hover
[image]

Document.XMLUseXSLTWhenSaving Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Boolean that represents whether to save a document through an Extensible Stylesheet Language Transformation (XSLT). True saves a document through an XSLT.

Syntax

expression .XMLUseXSLTWhenSaving

expression An expression that returns a Document object.

Remarks

When setting the XMLUseXSLTWhenSaving property to True, use the XMLSaveThroughXSLT property to specify the path and file name of the XSLT to use.

Example

The following example specifies that Microsoft Word will use an XSLT when saving the active document, and then specifies which XSLT to use.

VBA Copy code Copy code
ActiveDocument.XMLUseXSLTWhenSaving = True
ActiveDocument.XMLSaveThroughXSLT = "c:\schemas\book.xslt"

See also

Concepts

Document Object

Other resources

Document Object Members


Document Methods (Word)

 Copy code hover
[image]

Document Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
AcceptAllRevisions | Accepts all tracked changes in the specified document.
AcceptAllRevisionsShown | Accepts all revisions in the specified document that are displayed on the screen.
Activate | Activates the specified document so that it becomes the active document.
AddToFavorites | Creates a shortcut to the document or hyperlink and adds it to the Favorites folder.
ApplyDocumentTheme |
ApplyQuickStyleSet2 | Applies the specified Quick Style set to the document.
ApplyTheme | Applies a theme to an open document.
AutoFormat | Automatically formats a document.
CanCheckin | True if Microsoft Word can check in a specified document to a server. Read/write Boolean.
CheckConsistency | Searches all text in a Japanese language document and displays instances where character usage is inconsistent for the same words.
CheckGrammar | Begins a spelling and grammar check for the specified document or range.
CheckIn | Returns a document from a local computer to a server, and sets the local document to read-only so that it cannot be edited locally.
CheckInWithVersion | Saves a document to a server from a local computer, and sets the local document to read-only so that it cannot be edited locally.
CheckSpelling | Begins a spelling check for the specified document or range. .
Close | Closes the specified document.
ClosePrintPreview | Switches the specified document from print preview to the previous view.
Compare | Displays revision marks that indicate where the specified document differs from another document.
ComputeStatistics | Returns a statistic based on the contents of the specified document. Long.
Convert | Converts file to the newest file format and enables all new features.
ConvertAutoHyphens | Converts hyphens created by automatic hyphenation to manual hyphens.
ConvertNumbersToText | Changes the list numbers and LISTNUM fields in the specified Document to text. .
ConvertVietDoc | Reconverts a Vietnamese document to Unicode using a code page other than the default.
CopyStylesFromTemplate | Copies styles from the specified template to a document.
CountNumberedItems | Returns the number of bulleted or numbered items and LISTNUM fields in the specified Document object.
CreateLetterContent | Creates and returns a LetterContent object based on the specified letter elements. LetterContent object.
DataForm | Displays the Data Form dialog box, in which you can add, delete, or modify records.
DeleteAllComments | Deletes all comments from the Comments collection in a document.
DeleteAllCommentsShown | Deletes all revisions in a specified document that are displayed on the screen.
DeleteAllEditableRanges | Deletes permissions in all ranges for which the specified user or group of users has permission to modify.
DeleteAllInkAnnotations | Deletes all handwritten ink annotations in a document.
DetectLanguage | Analyzes the specified text to determine the language that it is written in.
DowngradeDocument | Downgrades a document to the Word 97-2003 document format so that it can be edited in a previous version of Microsoft Word. .
EndReview | Terminates a review of a file that has been sent for review using the SendForReview method or that has been automatically placed in a review cycle by sending a document to another user in an e-mail message.
ExportAsFixedFormat | Saves a document as PDF or XPS format.
FitToPages | Decreases the font size of text just enough so that the document will fit on one fewer pages.
FollowHyperlink | Displays a cached document, if it has already been downloaded. Otherwise, this method resolves the hyperlink, downloads the target document, and displays the document in the appropriate application.
FreezeLayout | In Web view, fixes the layout of the document as it currently appears so that line breaks remain fixed and ink annotations do not move when you resize the window.
GetCrossReferenceItems | Returns an array of items that can be cross-referenced based on the specified cross-reference type.
GetLetterContent | Retrieves letter elements from the specified document and returns a LetterContent object.
GetWorkflowTasks | Returns a WorkflowTasks collection that represents the workflow tasks assigned to a document.
GetWorkflowTemplates | Returns a WorkflowTemplates collection that represents the workflow templates attached to a document.
GoTo | Returns a Range object that represents the start position of the specified item, such as a page, bookmark, or field.
LockServerFile | Locks the file on the server preventing anyone else from editing it.
MakeCompatibilityDefault | Sets the compatibility options.
ManualHyphenation | Initiates manual hyphenation of a document, one line at a time.
Merge | Merges the changes marked with revision marks from one document to another.
Post | Posts the specified document to a public folder in Microsoft Exchange. .
PresentIt | Opens PowerPoint with the specified Word document loaded.
PrintOut | Prints all or part of the specified document.
PrintPreview | Switches the view to print preview.
Protect | Protects the specified document from unauthorized changes.
Range | Returns a Range object by using the specified starting and ending character positions.
Redo | Redoes the last action that was undone (reverses the Undo method). Returns True if the actions were redone successfully.
RejectAllRevisions | Rejects all tracked changes in the specified document.
RejectAllRevisionsShown | Rejects all revisions in a document that are displayed on the screen.
Reload | Reloads a cached document by resolving the hyperlink to the document and downloading it.
ReloadAs | Reloads a document based on an HTML document, using the specified document encoding.
RemoveDocumentInformation | Removes sensitive information, properties, comments, and other metadata from a document.
RemoveLockedStyles | Purges a document of locked styles when formatting restrictions have been applied in a document.
RemoveNumbers | Removes numbers or bullets from the specified document.
RemoveTheme | Removes the active theme from the current document.
Repaginate | Repaginates the entire document.
ReplyWithChanges | Sends an e-mail message to the author of a document that has been sent out for review, notifying them that a reviewer has completed review of the document.
ResetFormFields | Clears all form fields in a document, preparing the form to be filled in again.
ReturnToLastReadPosition | Returns the active document to the last saved reading position, and returns an integer that represents that position.
RunAutoMacro | Runs an auto macro that's stored in the specified document. If the specified auto macro doesn't exist, nothing happens.
RunLetterWizard | Runs the Letter Wizard on the specified document.
Save | Saves all the documents in the Documents collection.
SaveAs2 | Saves the specified document with a new name or format. Some of the arguments for this method correspond to the options in the Save As dialog box (File tab).
SaveAsQuickStyleSet | Saves the group of quick styles currently in use.
Select | Selects the contents of the specified document.
SelectAllEditableRanges | Selects all ranges for which the specified user or group of users has permission to modify.
SelectContentControlsByTag | Returns a ContentControls collection that represents all the content controls in a document with the tag value specified in the Tag parameter. Read-only.
SelectContentControlsByTitle | Returns a ContentControls collection that represents all the content controls in a document with the title specified in the Title parameter. Read-only.
SelectLinkedControls | Returns a ContentControls collection that represents all content controls in a document that are linked to the specific custom XML node in the document's XML data store as specified by the Node parameter. Read-only.
SelectNodes | Returns an XMLNodes collection that represents all the nodes that match the XPath parameter in the order in which they appear in the document or range.
SelectSingleNode | Returns an XMLNode object that represents the first node that matches the XPath parameter in the specified document.
SelectUnlinkedControls | Returns a ContentControls collection that represents all content controls in a document that are not linked to an XML node in the document's XML data store. Read-only.
SendFax | Sends the specified document as a fax, without any user interaction.
SendFaxOverInternet | Sends a document to a fax service provider, who faxes the document to one or more specfied recipients.
SendForReview | Sends a document in an e-mail message for review by the specified recipients.
SendMail | Opens a message window for sending the specified document through Microsoft Exchange.
SetCompatibilityMode | Sets the compatibility mode for the document.
SetDefaultTableStyle | Specifies the table style to use for newly created tables in a document.
SetLetterContent | Inserts the contents of the specified LetterContent object into a document.
SetPasswordEncryptionOptions | Sets the options Microsoft Word uses for encrypting documents with passwords.
ToggleFormsDesign | Switches form design mode on or off.
TransformDocument | Applies the specified Extensible Stylesheet Language Transformation (XSLT) file to the specified document and replaces the document with the results.
Undo | Undoes the last action or a sequence of actions, which are displayed in the Undo list. Returns True if the actions were successfully undone.
UndoClear | Clears the list of actions that can be undone for the specified document.
Unprotect | Removes protection from the specified document. .
UpdateStyles | Copies all styles from the attached template into the document, overwriting any existing styles in the document that have the same name.
ViewCode | Displays the code window for the selected Microsoft ActiveX control in the specified document.
ViewPropertyBrowser | Displays the property window for the selected Microsoft ActiveX control in the specified document.
WebPagePreview | Displays a preview of the current document as it would look if saved as a Web page.


Document.AcceptAllRevisions Method (Word)

 Copy code hover
[image]

Document.AcceptAllRevisions Method (Word)
See also Send feedback

Published: July 16, 2012

Accepts all tracked changes in the specified document.

Syntax

expression .AcceptAllRevisions

expression Required. A variable that represents a Document object.

Example

This example checks the main story in the active document for tracked changes, and if there are any, the example incorporates all revisions in all stories in the document.

VBA Copy code Copy code
If ActiveDocument.Revisions.Count >= 1 Then _
 ActiveDocument.AcceptAllRevisions

See also

Concepts

Document Object

Other resources

Document Object Members


Document.AcceptAllRevisionsShown Method (Word)

 Copy code hover
[image]

Document.AcceptAllRevisionsShown Method (Word)
See also Send feedback

Published: July 16, 2012

Accepts all revisions in the specified document that are displayed on the screen.

Syntax

expression .AcceptAllRevisionsShown

expression Required. A variable that represents a Document object.

Remarks

Use the RejectAllRevisionsShown method to reject all revisions in a specified document that are displayed on the screen.

Example

This example accepts all revisions displayed after hiding revisions made by "Jeff Smith." This example assumes that the active document was reviewed by more than one person and that the name of one of the reviewers is "Jeff Smith."

VBA Copy code Copy code
Sub AcceptAllChanges()
 Dim rev As Reviewer
 With ActiveWindow.View
 'Display all comments and revisions
 .ShowRevisionsAndComments = True
 .ShowFormatChanges = True
 .ShowInsertionsAndDeletions = True

 For Each rev In .Reviewers
 rev.Visible = True
 Next

 'Hide only the revisions/comments made by the
 'reviewer named "Jeff Smith"
 .Reviewers(Index:="Jeff Smith").Visible = False
 End With

 'Accept all revisions displayed in the active view
 ActiveDocument.AcceptAllRevisionsShown

End Sub

See also

Concepts

Document Object

Other resources

Document Object Members


Document.Activate Method (Word)

 Copy code hover
[image]

Document.Activate Method (Word)
See also Send feedback

Published: July 16, 2012

Activates the specified document so that it becomes the active document.

Syntax

expression .Activate

expression Required. A variable that represents a Document object.

Example

This example activates the document named "Sales.doc."

VBA Copy code Copy code
Sub OpenSales()
 'Sales.doc must exist and be open but not active.
 Documents("Sales.doc").Activate
End Sub

See also

Concepts

Document Object

Other resources

Document Object Members


Document.AddToFavorites Method (Word)

 Copy code hover
[image]

Document.AddToFavorites Method (Word)
See also Send feedback

Published: July 16, 2012

Creates a shortcut to the document or hyperlink and adds it to the Favorites folder.

Syntax

expression .AddToFavorites

expression Required. A variable that represents a Document object.

Example

This example creates a shortcut for each hyperlink in the active document and adds it to the Favorites folder.

VBA Copy code Copy code
For Each myHyperlink In ActiveDocument.Hyperlinks
 myHyperlink.AddToFavorites
Next myHyperlink

This example creates a shortcut to Sales.doc and adds it to the Favorites folder. If Sales.doc isn't currently open, this example opens it from the C:\Documents folder.

VBA Copy code Copy code
For Each doc in Documents
 If LCase(doc.Name) = "sales.doc" Then isOpen = True
Next doc
If isOpen <> True Then Documents.Open _
 FileName:="C:\Documents\Sales.doc"
Documents("Sales.doc").AddToFavorites

See also

Concepts

Document Object

Other resources

Document Object Members


Document.ApplyDocumentTheme Method

 Copy code hover
[image]

Document.ApplyDocumentTheme Method
Send feedback

Published: July 16, 2012

Applies a document theme to a document.

Version Information

Version Added: Word 2007

Syntax

expression .ApplyDocumentTheme(FileName)

expression An expression that returns a Document object.

Parameters

Name | Required/Optional | Data Type | Description
FileName | Required | String | The path and file name of the theme to apply.

Example

The following example applies the Verve document theme to the active document.

VBA Copy code Copy code
ActiveDocument.ApplyDocumentTheme _
 "C:\Program Files\Microsoft Office\" & _
 "Document Themes 12\Verve.thmx"


Document.ApplyQuickStyleSet2 Method (Word)

 Copy code hover
[image]

Document.ApplyQuickStyleSet2 Method (Word)
See also Send feedback

Published: July 16, 2012

Applies the specified Quick Style set to the document.

Version Information

Version Added: Word 2010

Syntax

expression .ApplyQuickStyleSet2(Style)

expression An expression that returns a Document object.

Parameters

Name | Required/Optional | Data Type | Description
Style | Required | Variant | Can be either a String that specifies the name of the set to use (corresponds to the name listed in the Style Set list) or a constant from the WdApplyQuickStyleSets enumeration.

See also

Concepts

Document Object

Other resources

Document Object Members


Document.ApplyTheme Method (Word)

 Copy code hover
[image]

Document.ApplyTheme Method (Word)
See also Send feedback

Published: July 16, 2012

Applies a theme to an open document.

Syntax

expression .ApplyTheme(Name)

expression Required. A variable that represents a Document object.

Parameters

Name

Required/Optional

Data Type

Description

Name

Required

String

The name of the theme plus any theme formatting options you want to apply. The format of this string is "themennn" where theme and nnn are defined as follows:

String | Description
theme | The name of the folder that contains the data for the requested theme. (The default location for theme data folders is C:\Program Files\Common Files\Microsoft Shared\Themes.) You must use the folder name for the theme rather than the display name that appears in the Theme dialog box.
nnn | A three-digit string that indicates which theme formatting options to activate (1 to activate, 0 to deactivate). The digits correspond to the Vivid Colors, Active Graphics, and Background Image check boxes in the Theme dialog box. If this string is omitted, the default value for nnn is "011" (Active Graphics and Background Image are activated).

Example

This example applies the Artsy theme to the active document and activates the Vivid Colors option.

VBA Copy code Copy code
ActiveDocument.ApplyTheme "artsy 100"

See also

Concepts

Document Object

Other resources

Document Object Members


Document.AutoFormat Method (Word)

 Copy code hover
[image]

Document.AutoFormat Method (Word)
See also Send feedback

Published: July 16, 2012

Automatically formats a document.

Syntax

expression .AutoFormat

expression Required. A variable that represents a Document object.

Remarks

Use the Kind property to specify a document type.

See also

Concepts

Document Object

Other resources

Document Object Members


Document.CanCheckin Method (Word)

 Copy code hover
[image]

Document.CanCheckin Method (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word can check in a specified document to a server. Read/write Boolean.

Syntax

expression .CanCheckin

expression Required. A variable that represents a Document object.

Return Value

Boolean

Remarks

To take advantage of the collaboration features built into Word, documents must be stored on a Microsoft SharePoint Portal Server.

Example

This example checks the server to see if the specified document can be checked in and, if it can be, closes the document and checks it back into the server.

VBA Copy code Copy code
Sub CheckInOut(docCheckIn As String)
 If Documents(docCheckIn).CanCheckin = True Then
 Documents(docCheckIn).CheckIn
 MsgBox docCheckIn & " has been checked in."
 Else
 MsgBox "This file cannot be checked in " & _
 "at this time. Please try again later."
 End If
End Sub

To call the CheckInOut subroutine above, use the following subroutine and replace the "http://servername/workspace/report.doc" file name with an actual file located on a server mentioned in the Remarks section above.

VBA Copy code Copy code
Sub CheckDocInOut()
 Call CheckInOut (docCheckIn:="http://servername/workspace/report.doc")
End Sub

See also

Concepts

Document Object

Other resources

Document Object Members


Document.CheckConsistency Method (Word)

 Copy code hover
[image]

Document.CheckConsistency Method (Word)
See also Send feedback

Published: July 16, 2012

Searches all text in a Japanese language document and displays instances where character usage is inconsistent for the same words.

Syntax

expression .CheckConsistency

expression Required. A variable that represents a Document object.

Example

This example checks the consistency of Japanese characters in the active document.

VBA Copy code Copy code
ActiveDocument.CheckConsistency

See also

Concepts

Document Object

Other resources

Document Object Members


Document.CheckGrammar Method (Word)

 Copy code hover
[image]

Document.CheckGrammar Method (Word)
See also Send feedback

Published: July 16, 2012

Begins a spelling and grammar check for the specified document or range.

Syntax

expression .CheckGrammar

expression Required. A variable that represents a Document object.

Remarks

If the document or range contains errors, this method displays the Spelling and Grammar dialog box, with the Check grammar check box selected. When applied to a document, this method checks all available stories (such as headers, footers, and text boxes).

Example

This example begins a spelling and grammar check for all stories in the active document.

VBA Copy code Copy code
ActiveDocument.CheckGrammar

See also

Concepts

Document Object

Other resources

Document Object Members


Document.CheckIn Method (Word)

 Copy code hover
[image]

Document.CheckIn Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a document from a local computer to a server, and sets the local document to read-only so that it cannot be edited locally.

Syntax

expression .CheckIn(SaveChanges, Comments, MakePublic)

expression Required. A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
SaveChanges | Optional | Boolean | True saves the document to the server location. The default is True.
Comments | Optional | Variant | Comments for the revision of the document being checked in (only applies if SaveChanges equals True).
MakePublic | Optional | Boolean | True allows the user to perform a publish on the document after being checked in. This submits the document for the approval process, which can eventually result in a version of the document being published to users with read-only rights to the document (only applies if SaveChanges equals True). The default is False.

Remarks

To take advantage of the collaboration features built into Microsoft Word, documents must be stored on a Microsoft SharePoint Portal Server.

Example

This example checks the server to see if the specified document can be checked in. If it can be, it saves and closes the document and checks it back into the server.

VBA Copy code Copy code
Sub CheckInOut(docCheckIn As String)
 If Documents(docCheckIn).CanCheckin = True Then
 Documents(docCheckIn).CheckIn
 MsgBox docCheckIn & " has been checked in."
 Else
 MsgBox "This file cannot be checked in " &
 "at this time. Please try again later."
 End If
End Sub

To call the CheckInOut subroutine, use the following subroutine and replace "http://servername/workspace/report.doc" with the file name of an actual file located on the server mentioned in the Remarks section above.

VBA Copy code Copy code
Sub CheckDocInOut()
 Call CheckInOut (docCheckIn:="http://servername/workspace/report.doc")
End Sub

See also

Concepts

Document Object

Other resources

Document Object Members


Document.CheckInWithVersion Method (Word)

 Copy code hover
[image]

Document.CheckInWithVersion Method (Word)
See also Send feedback

Published: July 16, 2012

Saves a document to a server from a local computer, and sets the local document to read-only so that it cannot be edited locally.

Version Information

Version Added: Word 2007

Syntax

expression .CheckInWithVersion(SaveChanges, Comments, MakePublic, VersionType)

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
SaveChanges | Optional | Boolean | True to save the document to the server location. The default is True.
Comments | Optional | Variant | Comments for the revision of the document being checked in (applies only if SaveChanges is set to True).
MakePublic | Optional | Boolean | True to allow the user to publish the document after it is checked in.
VersionType | Optional | Variant | Specifies versioning information for the document.

Remarks

Setting the MakePublic parameter to True submits the document for the approval process, which can eventually result in a version of the document being published to users with read-only rights to the document (applies only if SaveChanges is set to True).

To take advantage of the collaboration features built into Microsoft Word, documents must be stored on a Microsoft SharePoint Server.

Example

The following example uses the CanCheckin method to determine whether the document has been stored on a Microsoft SharePoint Server. If the document has been stored on a server, the example calls the CheckInWithVersion method to check in the document along with the specified comments and version number, save changes to the server location, and submit the document for the approval process.

This example is for a document-level customization.

VBA Copy code Copy code
Private Sub DocumentCheckIn()
 If ActiveDocument.CanCheckin Then
 ActiveDocument.CheckInWithVersion _
 True, _
 "My updates.", _
 True, _
 WdCheckInVersionType.wdCheckInMinorVersion
 Else
 MessageBox.Show ("This document cannot be checked in")
 End If
End Sub

See also

Concepts

Document Object

Other resources

Document Object Members


Document.CheckSpelling Method (Word)

 Copy code hover
[image]

Document.CheckSpelling Method (Word)
See also Send feedback

Published: July 16, 2012

Begins a spelling check for the specified document or range. .

Syntax

expression .CheckSpelling(CustomDictionary, IgnoreUppercase, AlwaysSuggest, CustomDictionary2, CustomDictionary3, CustomDictionary4, CustomDictionary5, CustomDictionary6, CustomDictionary7, CustomDictionary8, CustomDictionary9, CustomDictionary10)

expression Required. A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
IgnoreUppercase | Optional | Variant | True if capitalization is ignored. If this argument is omitted, the current value of the IgnoreUppercase property is used.
AlwaysSuggest | Optional | Variant | True for Microsoft Word to always suggest alternative spellings. If this argument is omitted, the current value of the SuggestSpellingCorrections property is used.

Remarks

If the document or range contains errors, this method displays the Spelling and Grammar dialog box (Tools menu), with the Check grammar check box cleared. For a document, this method checks all available stories (such as headers, footers, and text boxes).

Example

The following example checks the spelling in the active document.

VBA Copy code Copy code
ActiveDocument.CheckSpelling

See also

Concepts

Document Object

Other resources

Document Object Members


Document.Close Method (Word)

 Copy code hover
[image]

Document.Close Method (Word)
See also Send feedback

Published: July 16, 2012

Closes the specified document.

Syntax

expression .Close(SaveChanges, OriginalFormat, RouteDocument)

expression Required. A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
SaveChanges | Optional | Variant | Specifies the save action for the document. Can be one of the following WdSaveOptions constants: wdDoNotSaveChanges, wdPromptToSaveChanges, or wdSaveChanges.
OriginalFormat | Optional | Variant | Specifies the save format for the document. Can be one of the following WdOriginalFormat constants: wdOriginalDocumentFormat, wdPromptUser, or wdWordDocument.
RouteDocument | Optional | Variant | True to route the document to the next recipient. If the document does not have a routing slip attached, this argument is ignored.

Example

This example prompts the user to save the active document before closing it. If the user clicks Cancel, error 4198 (command failed) is trapped and a message is displayed.

VBA Copy code Copy code
On Error GoTo errorHandler
ActiveDocument.Close _
 SaveChanges:=wdPromptToSaveChanges, _
 OriginalFormat:=wdPromptUser
errorHandler:
If Err = 4198 Then MsgBox "Document was not closed"

See also

Concepts

Document Object

Other resources

Document Object Members


Document.ClosePrintPreview Method (Word)

 Copy code hover
[image]

Document.ClosePrintPreview Method (Word)
See also Send feedback

Published: July 16, 2012

Switches the specified document from print preview to the previous view.

Syntax

expression .ClosePrintPreview

expression Required. A variable that represents a Document object.

Remarks

If the specified document isn't in print preview, an error occurs.

Example

This example switches the active window from print preview to normal view.

VBA Copy code Copy code
If ActiveDocument.PrintPreview = True Then _
 ActiveDocument.ClosePrintPreview
ActiveDocument.ActiveWindow.View.Type = wdNormalView

See also

Concepts

Document Object

Other resources

Document Object Members


Document.Compare Method (Word)

 Copy code hover
[image]

Document.Compare Method (Word)
See also Send feedback

Published: July 16, 2012

Displays revision marks that indicate where the specified document differs from another document.

Syntax

expression .Compare(Name, AuthorName, CompareTarget, DetectFormatChanges, IgnoreAllComparisonWarnings, AddToRecentFiles, RemovePersonalInformation, RemoveDateAndTime)

expression Required. A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
Name | Required | String | The name of the document with which the specified document is compared.
AuthorName | Optional | Variant | The reviewer name associated with the differences generated by the comparison. If unspecified, the value defaults to the author name of the revised document or the string "Comparison" if no author information is present.
CompareTarget | Optional | Variant | The target document for the comparison. Can be any WdCompareTarget constant.
DetectFormatChanges | Optional | Boolean | True (default) for the comparison to include detection of format changes.
IgnoreAllComparisonWarnings | Optional | Variant | True compares the documents without notifying a user of problems. The default value is False.
AddToRecentFiles | Optional | Variant | True adds the document to the list of recently used files on the File menu.
RemovePersonalInformation | Optional | Boolean | True removes all user information from comments, revisions, and the properties dialog box in the returned Document object . The default value is False.
RemoveDateAndTime | Optional | Boolean | True removes date and time stamp information from tracked changes in the returned Document object. The default value is False.

Example

This example compares the active document with the document named "FirstRev.doc" in the Draft folder and places the comparison differences in a new document.

VBA Copy code Copy code
Sub CompareDocument()
 ActiveDocument.Compare Name:="C:\Draft\FirstRev.doc", _
 CompareTarget:=wdCompareTargetNew
End Sub

See also

Concepts

Document Object

Other resources

Document Object Members


Document.ComputeStatistics Method (Word)

 Copy code hover
[image]

Document.ComputeStatistics Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a statistic based on the contents of the specified document. Long.

Syntax

expression .ComputeStatistics(Statistic, IncludeFootnotesAndEndnotes)

expression Required. A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
Statistic | Required | WdStatistic | The statistic to compute.
IncludeFootnotesAndEndnotes | Optional | Variant | True to include footnotes and endnotes when computing statistics. If this argument is omitted, the default value is False.

Remarks

Some of the constants listed above may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.

Example

This example displays the number of words in the active document, including footnotes.

VBA Copy code Copy code
MsgBox ActiveDocument.ComputeStatistics(Statistic:=wdStatisticWords, _
 IncludeFootnotesAndEndnotes:=True) & " words"

See also

Concepts

Document Object

Other resources

Document Object Members


Document.Convert Method (Word)

 Copy code hover
[image]

Document.Convert Method (Word)
See also Send feedback

Published: July 16, 2012

Converts file to the newest file format and enables all new features.

Version Information

Version Added: Word 2007

Syntax

expression .Convert

expression An expression that returns a Document object.

See also

Concepts

Document Object

Other resources

Document Object Members


Document.ConvertAutoHyphens Method (Word)

 Copy code hover
[image]

Document.ConvertAutoHyphens Method (Word)
See also Send feedback

Published: July 16, 2012

Converts hyphens created by automatic hyphenation to manual hyphens.

Version Information

Version Added: Word 2010

Syntax

expression .ConvertAutoHyphens

expression An expression that returns a Document object.

See also

Concepts

Document Object

Other resources

Document Object Members


Document.ConvertNumbersToText Method (Word)

 Copy code hover
[image]

Document.ConvertNumbersToText Method (Word)
See also Send feedback

Published: July 16, 2012

Changes the list numbers and LISTNUM fields in the specified Document to text. .

Syntax

expression .ConvertNumbersToText

expression A variable that represents a Document object.

Example

This example converts the list numbers and LISTNUM fields in the active document to text.

VBA Copy code Copy code
ActiveDocument.ConvertNumbersToText

See also

Concepts

Document Object

Other resources

Document Object Members


Document.ConvertVietDoc Method (Word)

 Copy code hover
[image]

Document.ConvertVietDoc Method (Word)
See also Send feedback

Published: July 16, 2012

Reconverts a Vietnamese document to Unicode using a code page other than the default.

Syntax

expression .ConvertVietDoc(CodePageOrigin)

expression Required. A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
CodePageOrigin | Required | Long | The original code page used to encode the document.

Remarks

Use the ConvertVietDoc method if you want a document to be viewable on another computer or platform.

Example

This example converts the active document from the Vietnamese ABC code page to Unicode. This example assumes that the active document is encoded using the Vietnamese ABC code page.

VBA Copy code Copy code
Sub ConvertToVietCodePage()
 ActiveDocument.ConvertVietDoc CodePageOrigin:=5
End Sub

See also

Concepts

Document Object

Other resources

Document Object Members


Document.CopyStylesFromTemplate Method (Word)

 Copy code hover
[image]

Document.CopyStylesFromTemplate Method (Word)
See also Send feedback

Published: July 16, 2012

Copies styles from the specified template to a document.

Syntax

expression .CopyStylesFromTemplate(Template)

expression Required. A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
Template | Required | String | The template file name.

Remarks

When styles are copied from a template to a document, like-named styles in the document are redefined to match the style descriptions in the template. Unique styles from the template are copied to the document. Unique styles in the document remain intact.

Example

This example copies the styles from the active document's template to the document.

VBA Copy code Copy code
ActiveDocument.CopyStylesFromTemplate _
 Template:=ActiveDocument.AttachedTemplate.FullName

This example copies the styles from the Sales96.dot template to Sales.doc.

VBA Copy code Copy code
Documents("Sales.doc").CopyStylesFromTemplate _
 Template:="C:\MSOffice\Templates\Sales96.dot"

See also

Concepts

Document Object

Other resources

Document Object Members


Document.CountNumberedItems Method (Word)

 Copy code hover
[image]

Document.CountNumberedItems Method (Word)
See also Send feedback

Published: July 16, 2012

Returns the number of bulleted or numbered items and LISTNUM fields in the specified Document object.

Syntax

expression .CountNumberedItems(NumberType, Level)

expression An expression that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
NumberType | Optional | Variant | The type of numbers to be counted. Can be one of the WdNumberType constants. The default value is wdNumberAllNumbers.
Level | Optional | Variant | A number that corresponds to the numbering level you want to count. If this argument is omitted, all levels are counted.

Remarks

Bulleted items are counted when either wdNumberParagraph or wdNumberAllNumbers (the default) is specified for NumberType.

There are two types of numbers: preset numbers (wdNumberParagraph), which you can add to paragraphs by selecting a template in the Bullets and Numbering dialog box; and LISTNUM fields (wdNumberListNum), which allow you to add more than one number per paragraph.

See also

Concepts

Document Object

Other resources

Document Object Members


Document.CreateLetterContent Method (Word)

 Copy code hover
[image]

Document.CreateLetterContent Method (Word)
See also Send feedback

Published: July 16, 2012

Creates and returns a LetterContent object based on the specified letter elements. LetterContent object.

Syntax

expression .CreateLetterContent(DateFormat, IncludeHeaderFooter, PageDesign, LetterStyle, Letterhead, LetterheadLocation, LetterheadSize, RecipientName, RecipientAddress, Salutation, SalutationType, RecipientReference, MailingInstructions, AttentionLine, Subject, CCList, ReturnAddress, SenderName, Closing, SenderCompany, SenderJobTitle, SenderInitials, EnclosureNumber, InfoBlock, RecipientCode, RecipientGender, ReturnAddressShortForm, SenderCity, SenderCode, SenderGender, SenderReference)

expression Required. A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
DateFormat | Required | String | The date for the letter.
IncludeHeaderFooter | Required | Boolean | True to include the header and footer from the page design template.
PageDesign | Required | String | The name of the template attached to the document.
LetterStyle | Required | WdLetterStyle | The document layout.
Letterhead | Required | Boolean | True to reserve space for a preprinted letterhead.
LetterheadLocation | Required | WdLetterheadLocation | The location of the preprinted letterhead.
LetterheadSize | Required | Single | The amount of space (in points) to be reserved for a preprinted letterhead.
RecipientName | Required | String | The name of the person who'll be receiving the letter.
RecipientAddress | Required | String | The mailing address of the person who'll be receiving the letter.
Salutation | Required | String | The salutation text for the letter.
SalutationType | Required | WdSalutationType | The salutation type for the letter.
RecipientReference | Required | String | The reference line text for the letter (for example, "In reply to:").
MailingInstructions | Required | String | The mailing instruction text for the letter (for example, "Certified Mail").
AttentionLine | Required | String | The attention line text for the letter (for example, "Attention:").
Subject | Required | String | The subject text for the specified letter.
CCList | Required | String | The names of the carbon copy (CC) recipients for the letter.
ReturnAddress | Required | String | The text of the return mailing address for the letter.
SenderName | Required | String | The name of the person sending the letter.
Closing | Required | String | The closing text for the letter.
SenderCompany | Required | String | The company name of the person creating the letter.
SenderJobTitle | Required | String | The job title of the person creating the letter.
SenderInitials | Required | String | The initials of the person creating the letter.
EnclosureNumber | Required | Long | The number of enclosures for the letter.
InfoBlock | Optional | Variant | This argument may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.
RecipientCode | Optional | Variant | This argument may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.
RecipientGender | Optional | Variant | This argument may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.
ReturnAddressShortForm | Optional | Variant | This argument may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.
SenderCity | Optional | Variant | This argument may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.
SenderCode | Optional | Variant | This argument may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.
SenderGender | Optional | Variant | This argument may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.
SenderReference | Optional | Variant | This argument may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.

Return Value

LetterContent

Example

The following example uses the CreateLetterContent method to create a new LetterContent object in the active document and then uses this object with the RunLetterWizard method.

VBA Copy code Copy code
Set myLetter = ActiveDocument _
 .CreateLetterContent(DateFormat:="July 31, 1996", _
 IncludeHeaderFooter:=False, PageDesign:="", _
 LetterStyle:=wdFullBlock, Letterhead:=True, _
 LetterheadLocation:=wdLetterTop, _
 LetterheadSize:=InchesToPoints(1.5), _
 RecipientName:="Dave Edson", _
 RecipientAddress:="436 SE Main St." & vbCr _
 & "Bellevue, WA 98004", _
 Salutation:="Dear Dave,", _
 SalutationType:=wdSalutationInformal, _
 RecipientReference:="", MailingInstructions:="", _
 AttentionLine:="", Subject:="End of year report", _
 CCList:="", ReturnAddress:="", _
 SenderName:="", Closing:="Sincerely yours,", _
 SenderCompany:="", SenderJobTitle:="", _
 SenderInitials:="", EnclosureNumber:=0)
ActiveDocument.RunLetterWizard LetterContent:=myLetter

See also

Concepts

Document Object

Other resources

Document Object Members


Document.DataForm Method (Word)

 Copy code hover
[image]

Document.DataForm Method (Word)
See also Send feedback

Published: July 16, 2012

Displays the Data Form dialog box, in which you can add, delete, or modify records.

Syntax

expression .DataForm

expression Required. A variable that represents a Document object.

Remarks

You can use this method with a mail merge main document, a mail merge data source, or any document that contains data delimited by table cells or separator characters.

Example

This example displays the Data Form dialog box if the active document is a mail merge document.

VBA Copy code Copy code
If ActiveDocument.MailMerge.State <> wdNormalDocument Then
 ActiveDocument.DataForm
End If

This example creates a table in a new document and then displays the Data Form dialog box.

VBA Copy code Copy code
Set aDoc = Documents.Add
With aDoc
 .Tables.Add Range:=aDoc.Content, NumRows:=2, NumColumns:=2
 .Tables(1).Cell(1, 1).Range.Text = "Name"
 .Tables(1).Cell(1, 2).Range.Text = "Age"
 .DataForm
End With

See also

Concepts

Document Object

Other resources

Document Object Members


Document.DeleteAllComments Method (Word)

 Copy code hover
[image]

Document.DeleteAllComments Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes all comments from the Comments collection in a document.

Syntax

expression .DeleteAllComments

expression Required. A variable that represents a Document object.

Remarks

Use the Add method for the Comments object to add a comment to a document.

Example

This example deletes all comments in the active document. This example assumes you have comments in active document.

VBA Copy code Copy code
Sub DelAllComments()
 ActiveDocument.DeleteAllComments
End Sub

See also

Concepts

Document Object

Other resources

Document Object Members


Document.DeleteAllCommentsShown Method (Word)

 Copy code hover
[image]

Document.DeleteAllCommentsShown Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes all revisions in a specified document that are displayed on the screen.

Syntax

expression .DeleteAllCommentsShown

expression Required. A variable that represents a Document object.

Example

This example hides all comments made by "Jeff Smith" and deletes all other displayed comments.

VBA Copy code Copy code
Sub HideDeleteComments()
 Dim rev As Reviewer
 With ActiveWindow.View
 'Display all comments and revisions
 .ShowRevisionsAndComments = True
 .ShowFormatChanges = True
 .ShowInsertionsAndDeletions = True

 For Each rev In .Reviewers
 rev.Visible = True
 Next

 'Hide only the revisions/comments made by the
 'reviewer named "Jeff Smith"
 .Reviewers(Index:="Jeff Smith").Visible = False
 End With

 'Delete all comments displayed in the active view
 ActiveDocument.DeleteAllCommentsShown
End Sub

See also

Concepts

Document Object

Other resources

Document Object Members


Document.DeleteAllEditableRanges Method (Word)

 Copy code hover
[image]

Document.DeleteAllEditableRanges Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes permissions in all ranges for which the specified user or group of users has permission to modify.

Syntax

expression .DeleteAllEditableRanges(EditorID)

expression Required. A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
EditorID | Optional | Variant | Can be either a String that represents the user's e-mail alias (if in the same domain), an e-mail address, or a WdEditorType constant that represents a group of users. If omitted, no permissions are deleted from a document.

Remarks

You can also use the DeleteAll method to delete permissions in all ranges for which a specified user or group of users has permission to modify.

Example

The following example deletes all permissions in all ranges for the current user.

VBA Copy code Copy code
ActiveDocument.DeleteAllEditableRanges wdEditorCurrent

See also

Concepts

Document Object

Other resources

Document Object Members


Document.DeleteAllInkAnnotations Method (Word)

 Copy code hover
[image]

Document.DeleteAllInkAnnotations Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes all handwritten ink annotations in a document.

Syntax

expression .DeleteAllInkAnnotations

expression Required. A variable that represents a Document object.

Remarks

To work with ink annotations, you must be running Microsoft Word on a tablet computer.

Example

The following example deletes all handwritten ink annotations in the active document.

VBA Copy code Copy code
ActiveDocument.DeleteAllInkAnnotations

See also

Concepts

Document Object

Other resources

Document Object Members


Document.DetectLanguage Method (Word)

 Copy code hover
[image]

Document.DetectLanguage Method (Word)
See also Send feedback

Published: July 16, 2012

Analyzes the specified text to determine the language that it is written in.

Syntax

expression .DetectLanguage

expression Required. A variable that represents a Document object.

Remarks

When applied to a Document object, the DetectLanguage method checks all available text in the document (headers, footers, text boxes, and so forth). If the specified text contains a partial sentence, the selection or range is extended to the end of the sentence.

If the DetectLanguage method has already been applied to the specified text, the LanguageDetected property is set to True. To re-evaulate the language of the specified text, you must first set the LanguageDetected property to False.

Example

This example checks the active document to determine the language it's written in and then displays the result.

VBA Copy code Copy code
With ActiveDocument
 If .LanguageDetected = True Then
 x = MsgBox("This document has already " _
 & "been checked. Do you want to check " _
 & "it again?", vbYesNo)
 If x = vbYes Then
 .LanguageDetected = False
 .DetectLanguage
 End If
 Else
 .DetectLanguage
 End If
 If .Range.LanguageID = wdEnglishUS Then
 MsgBox "This is a U.S. English document."
 Else
 MsgBox "This is not a U.S. English document."
 End If
End With

See also

Concepts

Document Object

Other resources

Document Object Members


Document.DowngradeDocument Method (Word)

 Copy code hover
[image]

Document.DowngradeDocument Method (Word)
See also Send feedback

Published: July 16, 2012

Downgrades a document to the Word 97-2003 document format so that it can be edited in a previous version of Microsoft Word. .

Version Information

Version Added: Word 2007

Syntax

expression .DowngradeDocument

expression An expression that returns a Document object.

See also

Concepts

Document Object

Other resources

Document Object Members


Document.EndReview Method (Word)

 Copy code hover
[image]

Document.EndReview Method (Word)
See also Send feedback

Published: July 16, 2012

Terminates a review of a file that has been sent for review using the SendForReview method or that has been automatically placed in a review cycle by sending a document to another user in an e-mail message.

Syntax

expression .EndReview

expression Required. A variable that represents a Document object.

Remarks

When executed, the EndReview method displays a message asking the user whether to end the review.

Example

This example terminates the review of the active document. This example assumes the active document part of a review cycle.

VBA Copy code Copy code
Sub EndDocRev()
 ActiveDocument.EndReview
End Sub

See also

Concepts

Document Object

Other resources

Document Object Members


Document.ExportAsFixedFormat Method (Word)

 Copy code hover
[image]

Document.ExportAsFixedFormat Method (Word)
See also Send feedback

Published: July 16, 2012

Saves a document as PDF or XPS format.

Version Information

Version Added: Word 2007

Syntax

expression .ExportAsFixedFormat(OutputFileName, ExportFormat, OpenAfterExport, OptimizeFor, Range, From, To, Item, IncludeDocProps, KeepIRM, CreateBookmarks, DocStructureTags, BitmapMissingFonts, UseISO19005_1, FixedFormatExtClassPtr)

expression An expression that returns a Document object.

Parameters

Name | Required/Optional | Data Type | Description
OutputFileName | Required | String | The path and file name name of the new PDF or XPS file.
ExportFormat | Required | WdExportFormat | Specifies either PDF or XPS format.
OpenAfterExport | Optional | Boolean | Opens the new file after exporting the contents.
OptimizeFor | Optional | WdExportOptimizeFor | Specifies whether to optimize for screen or print.
Range | Optional | WdExportRange | Specifies whether the export range is the entire document, the current page, a range of text, or the current selection. the default is to export the entire document.
From | Optional | Long | Specifies the starting page number, if the Range parameter is set to wdExportFromTo.
To | Optional | Long | Specifies the ending page number, if the Range parameter is set to wdExportFromTo.
Item | Optional | WdExportItem | Specifies whether the export process includes text only or includes text with markup.
IncludeDocProps | Optional | Boolean | Specifies whether to include document properties in the newly exported file.
KeepIRM | Optional | Boolean | Specifies whether to copy IRM permissions to an XPS document if the source document has IRM protections. Default value is True.
CreateBookmarks | Optional | WdExportCreateBookmarks | Specifies whether to export bookmarks and the type of bookmarks to export.
DocStructureTags | Optional | Boolean | Specifies whether to include extra data to help screen readers, for example information about the flow and logical organization of the content. Default value is True.
BitmapMissingFonts | Optional | Boolean | Specifies whether to include a bitmap of the text. Set this parameter to True when font licenses do not permit a font to be embedded in the PDF file. If False, the font is referenced, and the viewer's computer substitutes an appropriate font if the authored one is not available. Default value is True.
UseISO19005_1 | Optional | Boolean | Specifies whether to limit PDF usage to the PDF subset standardized as ISO 19005-1. If True, the resulting files are more reliably self-contained but may be larger or show more visual artifacts due to the restrictions of the format. Default value is False.
FixedFormatExtClassPtr | Optional | Variant | Specifies a pointer to an add-in that allows calls to an alternate implementation of code. The alternate implementation of code interprets the EMF and EMF+ page descriptions that are generated by the applications to make their own PDF or XPS. For more information, see "Extending the Office (2007) Fixed-Format Export Feature" on MSDN.

See also

Concepts

Document Object

Other resources

Document Object Members


Document.FitToPages Method (Word)

 Copy code hover
[image]

Document.FitToPages Method (Word)
See also Send feedback

Published: July 16, 2012

Decreases the font size of text just enough so that the document will fit on one fewer pages.

Syntax

expression .FitToPages

expression Required. A variable that represents a Document object.

Remarks

An error occurs if Word is unable to reduce the page count by one.

Example

This example attempts to reduce the page count of the active document by one page.

VBA Copy code Copy code
On Error GoTo errhandler
ActiveDocument.FitToPages
errhandler:
If Err = 5538 Then MsgBox "Fit to pages failed"

This example attempts to reduce the page count of each open document by one page.

VBA Copy code Copy code
For Each doc In Documents
 doc.FitToPages
Next doc

See also

Concepts

Document Object

Other resources

Document Object Members


Document.FollowHyperlink Method (Word)

 Copy code hover
[image]

Document.FollowHyperlink Method (Word)
See also Send feedback

Published: July 16, 2012

Displays a cached document, if it has already been downloaded. Otherwise, this method resolves the hyperlink, downloads the target document, and displays the document in the appropriate application.

Syntax

expression .FollowHyperlink(Address, SubAddress, NewWindow, AddHistory, ExtraInfo, Method, HeaderInfo)

expression Required. A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
Address | Required | String | The address of the target document.
SubAddress | Optional | Variant | The location within the target document. The default value is an empty string.
NewWindow | Optional | Variant | True to display the target location in a new window. The default value is False.
AddHistory | Optional | Variant | True to add the link to the current day's history folder.
ExtraInfo | Optional | Variant | A string or a byte array that specifies additional information for HTTP to use to resolve the hyperlink. For example, you can use ExtraInfo to specify the coordinates of an image map, the contents of a form, or a FAT file name. The string is either posted or appended, depending on the value of Method. Use the ExtraInfoRequired property to determine whether extra information is required.
Method | Optional | Variant | Specifies the way additional information for HTTP is handled. Can be any MsoExtraInfoMethod constant.
HeaderInfo | Optional | Variant | A string that specifies header information for the HTTP request. The default value is an empty string.You can combine several header lines into a single string by using the following syntax: "string1" & vbCr & "string2". The specified string is automatically converted into ANSI characters. Note that the HeaderInfo argument may overwrite default HTTP header fields.

Example

This example follows the specified URL address and displays the Microsoft home page in a new window.

VBA Copy code Copy code
ActiveDocument.FollowHyperlink _
 Address:="http://www.Microsoft.com", _
 NewWindow:=True, AddHistory:=True

This example displays the HTML document named "Default.htm."

VBA Copy code Copy code
ActiveDocument.FollowHyperlink Address:="file:C:\Pages\Default.htm"

See also

Concepts

Document Object

Other resources

Document Object Members


Document.FreezeLayout Method (Word)

 Copy code hover
[image]

Document.FreezeLayout Method (Word)
See also Send feedback

Published: July 16, 2012

In Web view, fixes the layout of the document as it currently appears so that line breaks remain fixed and ink annotations do not move when you resize the window.

Version Information

Version Added: Word 2007

Syntax

expression .FreezeLayout

expression An expression that returns a Document object.

See also

Concepts

Document Object

Other resources

Document Object Members


Document.GetCrossReferenceItems Method (Word)

 Copy code hover
[image]

Document.GetCrossReferenceItems Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an array of items that can be cross-referenced based on the specified cross-reference type.

Syntax

expression .GetCrossReferenceItems(ReferenceType)

expression An expression that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
ReferenceType | Required | Variant | The type of item you want to insert a cross-reference to. Can be any WdReferenceType constant.

Remarks

The array that this method returns corresponds to the items listed in the For which box in the Cross-reference dialog box. The value returned by this method can be used as the value of the ReferenceWhich argument for the InsertCrossReference method of the Range or Selection object.

Example

This example displays the name of the first bookmark in the active document that can be cross-referenced.

VBA Copy code Copy code
If ActiveDocument.Bookmarks.Count >= 1 Then
 myBookmarks = ActiveDocument.GetCrossReferenceItems( _
 wdRefTypeBookmark)
 MsgBox myBookmarks(1)
End If

This example uses the GetCrossReferenceItems method to retrieve a list of headings that can be cross-referenced and then inserts a cross-reference to the page that includes the heading "Introduction."

VBA Copy code Copy code
myHeadings = _
 ActiveDocument.GetCrossReferenceItems(wdRefTypeHeading)
For i = 1 To Ubound(myHeadings)
 If Instr(LCase$(myHeadings(i)), "introduction") Then
 Selection.InsertCrossReference _
 ReferenceType:=wdRefTypeHeading, _
 ReferenceKind:=wdPageNumber, ReferenceItem:=i
 Selection.InsertParagraphAfter
 End If
Next i

See also

Concepts

Document Object

Other resources

Document Object Members


Document.GetLetterContent Method (Word)

 Copy code hover
[image]

Document.GetLetterContent Method (Word)
See also Send feedback

Published: July 16, 2012

Retrieves letter elements from the specified document and returns a LetterContent object.

Syntax

expression .GetLetterContent

expression Required. A variable that represents a Document object.

Return Value

LetterContent

Example

This example displays the salutation and recipient name from the letter in the active document.

VBA Copy code Copy code
MsgBox ActiveDocument.GetLetterContent.Salutation _
 & ActiveDocument.GetLetterContent.RecipientName

This example retrieves letter elements from the active document, changes the list of carbon copy (CC) recipients by setting the CClist property, and then uses the SetLetterContent method to update the active document to reflect the changes.

VBA Copy code Copy code
Set myLetterContent = ActiveDocument.GetLetterContent
With myLetterContent
 .CCList = "J. Burns, L. Scarpaczyk, K. Wong"
 .RecipientName = "Amy Anderson"
 .RecipientAddress = "123 Main" & vbCr & "Bellevue, WA 98004"
 .LetterStyle = wdFullBlock
End With
ActiveDocument.SetLetterContent LetterContent:=myLetterContent

See also

Concepts

Document Object

Other resources

Document Object Members


Document.GetWorkflowTasks Method (Word)

 Copy code hover
[image]

Document.GetWorkflowTasks Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a WorkflowTasks collection that represents the workflow tasks assigned to a document.

Version Information

Version Added: Word 2007

Syntax

expression .GetWorkflowTasks

expression An expression that returns a Document object.

Return Value

WorkflowTasks

See also

Concepts

Document Object

Other resources

Document Object Members


Document.GetWorkflowTemplates Method (Word)

 Copy code hover
[image]

Document.GetWorkflowTemplates Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a WorkflowTemplates collection that represents the workflow templates attached to a document.

Version Information

Version Added: Word 2007

Syntax

expression .GetWorkflowTemplates

expression An expression that returns a Document object.

Return Value

WorkflowTemplates

See also

Concepts

Document Object

Other resources

Document Object Members


Document.GoTo Method (Word)

 Copy code hover
[image]

Document.GoTo Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the start position of the specified item, such as a page, bookmark, or field.

Syntax

expression .GoTo(What, Which, Count, Name)

expression Required. A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
What | Optional | Variant | The kind of item to which the range or selection is moved. Can be one of the WdGoToItem constants.
Which | Optional | Variant | The item to which the range or selection is moved. Can be one of the WdGoToDirection constants.
Count | Optional | Variant | The number of the item in the document. The default value is 1. Only positive values are valid. To specify an item that precedes the range or selection, use wdGoToPrevious as the Which argument and specify a value for the Count value.
Name | Optional | Variant | If the What argument is wdGoToBookmark, wdGoToComment, wdGoToField, or wdGoToObject, this argument specifies a name. Only positive values are valid. To specify an item that precedes the range or selection, use wdGoToPrevious as the Which argument and specify a value for the Count argument.

Remarks

When you use the GoTo method with the wdGoToGrammaticalError, wdGoToProofreadingError, or wdGoToSpellingError constant, the Range that's returned includes any grammar error text or spelling error text.

Example

This example sets R1 equal to the first footnote reference mark in the active document.

VBA Copy code Copy code
If ActiveDocument.Footnotes.Count >= 1 Then
 Set R1 = ActiveDocument.GoTo(What:=wdGoToFootnote, _
 Which:=wdGoToFirst)
 R1.Expand Unit:=wdCharacter
End If

See also

Concepts

Document Object

Other resources

Document Object Members


Document.LockServerFile Method (Word)

 Copy code hover
[image]

Document.LockServerFile Method (Word)
See also Send feedback

Published: July 16, 2012

Locks the file on the server preventing anyone else from editing it.

Syntax

expression .LockServerFile

expression An expression that returns a Document object.

Remarks

This method applies only to documents stored on a server running Microsoft Office SharePoint Server 2007.

See also

Concepts

Document Object

Other resources

Document Object Members


Document.MakeCompatibilityDefault Method (Word)

 Copy code hover
[image]

Document.MakeCompatibilityDefault Method (Word)
See also Send feedback

Published: July 16, 2012

Sets the compatibility options.

Syntax

expression .MakeCompatibilityDefault

expression Required. A variable that represents a Document object.

Remarks

The compatibility options are located on the Compatibility tab in the Options dialog box as the default settings for new documents.

Example

This example sets a few compatibility options for the active document and then makes the current compatibility options the default settings.

VBA Copy code Copy code
With ActiveDocument
 .Compatibility(wdSuppressSpBfAfterPgBrk) = True
 .Compatibility(wdExpandShiftReturn) = True
 .Compatibility(wdUsePrinterMetrics) = True
 .Compatibility(wdNoLeading) = False
 .MakeCompatibilityDefault
End With

See also

Concepts

Document Object

Other resources

Document Object Members


Document.ManualHyphenation Method (Word)

 Copy code hover
[image]

Document.ManualHyphenation Method (Word)
See also Send feedback

Published: July 16, 2012

Initiates manual hyphenation of a document, one line at a time.

Syntax

expression .ManualHyphenation

expression Required. A variable that represents a Document object.

Remarks

When you use the ManualHyphenation method, Word prompts he user to accept or decline suggested hyphenations.

Example

This example starts manual hyphenation of the active document.

VBA Copy code Copy code
ActiveDocument.ManualHyphenation

This example sets hyphenation options and then starts manual hyphenation of MyDoc.doc.

VBA Copy code Copy code
With Documents("MyDoc.doc")
 .HyphenationZone = InchesToPoints(0.25)
 .HyphenateCaps = False
 .ManualHyphenation
End With

See also

Concepts

Document Object

Other resources

Document Object Members


Document.Merge Method (Word)

 Copy code hover
[image]

Document.Merge Method (Word)
See also Send feedback

Published: July 16, 2012

Merges the changes marked with revision marks from one document to another.

Syntax

expression .Merge(Name, MergeTarget, DetectFormatChanges, UseFormattingFrom, AddToRecentFiles)

expression Required. A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
Name | Required | String | The path and file name of the document with which to merge.
MergeTarget | Optional | WdMergeTarget | Specifies where to place the final merged content.
DetectFormatChanges | Optional | Boolean | Specifies whether or not to mark formatting differences.
UseFormattingFrom | Optional | WdUseFormattingFrom | Specifies which document to use for formatting in the merged document.
AddToRecentFiles | Optional | Boolean | Specifies whether to add the document in the Name parameter to the list of recent files.

Example

This example merges changes from Sales1.doc into Sales2.doc (the active document).

VBA Copy code Copy code
If InStr(1, ActiveDocument.Name, "sales2.doc", 1) Then _
 ActiveDocument.Merge Name:="C:\Docs\Sales1.doc"

See also

Concepts

Document Object

Other resources

Document Object Members


Document.Post Method (Word)

 Copy code hover
[image]

Document.Post Method (Word)
See also Send feedback

Published: July 16, 2012

Posts the specified document to a public folder in Microsoft Exchange. .

Syntax

expression .Post

expression Required. A variable that represents a Document object.

Remarks

This method displays the Send to Exchange Folder dialog box so that a folder can be selected.

Example

This example displays the Send to Exchange Folder dialog box so that the active document can be posted to a public folder.

VBA Copy code Copy code
ActiveDocument.Post

See also

Concepts

Document Object

Other resources

Document Object Members


Document.PresentIt Method (Word)

 Copy code hover
[image]

Document.PresentIt Method (Word)
See also Send feedback

Published: July 16, 2012

Opens PowerPoint with the specified Word document loaded.

Syntax

expression .PresentIt

expression Required. A variable that represents a Document object.

Example

This example sends a copy of the document named "MyPresentation.doc" to PowerPoint.

VBA Copy code Copy code
Documents("MyPresentation.doc").PresentIt

See also

Concepts

Document Object

Other resources

Document Object Members


Document.PrintOut Method (Word)

 Copy code hover
[image]

Document.PrintOut Method (Word)
See also Send feedback

Published: July 16, 2012

Prints all or part of the specified document.

Syntax

expression .PrintOut(Background, Append, Range, OutputFileName, From, To, Item, Copies, Pages, PageType, PrintToFile, Collate, FileName, ActivePrinterMacGX, ManualDuplexPrint, PrintZoomColumn, PrintZoomRow, PrintZoomPaperWidth, PrintZoomPaperHeight)

expression Required. A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
Background | Optional | Variant | Set to True to have the macro continue while Microsoft Word prints the document.
Append | Optional | Variant | Set to True to append the specified document to the file name specified by the OutputFileName argument. False to overwrite the contents of OutputFileName.
Range | Optional | Variant | The page range. Can be any WdPrintOutRange constant.
OutputFileName | Optional | Variant | If PrintToFile is True, this argument specifies the path and file name of the output file.
From | Optional | Variant | The starting page number when Range is set to wdPrintFromTo.
To | Optional | Variant | The ending page number when Range is set to wdPrintFromTo.
Item | Optional | Variant | The item to be printed. Can be any WdPrintOutItem constant.
Copies | Optional | Variant | The number of copies to be printed.
Pages | Optional | Variant | The page numbers and page ranges to be printed, separated by commas. For example, "2, 6-10" prints page 2 and pages 6 through 10.
PageType | Optional | Variant | The type of pages to be printed. Can be any WdPrintOutPages constant.
PrintToFile | Optional | Variant | True to send printer instructions to a file. Make sure to specify a file name with OutputFileName.
Collate | Optional | Variant | When printing multiple copies of a document, True to print all pages of the document before printing the next copy.
FileName | Optional | Variant | The path and file name of the document to be printed. If this argument is omitted, Word prints the active document. (Available only with the Application object.)
ActivePrinterMacGX | Optional | Variant | This argument is available only in Microsoft Office Macintosh Edition. For additional information about this argument, consult the language reference Help included with Microsoft Office Macintosh Edition.
ManualDuplexPrint | Optional | Variant | True to print a two-sided document on a printer without a duplex printing kit. If this argument is True, the PrintBackground and PrintReverse properties are ignored. Use the PrintOddPagesInAscendingOrder and PrintEvenPagesInAscendingOrder properties to control the output during manual duplex printing. This argument may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.
PrintZoomColumn | Optional | Variant | The number of pages you want Word to fit horizontally on one page. Can be 1, 2, 3, or 4. Use with the PrintZoomRow argument to print multiple pages on a single sheet.
PrintZoomRow | Optional | Variant | The number of pages you want Word to fit vertically on one page. Can be 1, 2, or 4. Use with the PrintZoomColumn argument to print multiple pages on a single sheet.
PrintZoomPaperWidth | Optional | Variant | The width to which you want Word to scale printed pages, in twips (20 twips = 1 point; 72 points = 1 inch).
PrintZoomPaperHeight | Optional | Variant | The height to which you want Word to scale printed pages, in twips (20 twips = 1 point; 72 points = 1 inch).

Example

This example prints the current page of the active document.

VBA Copy code Copy code
ActiveDocument.PrintOut Range:=wdPrintCurrentPage

This example prints all the documents in the current folder. The Dir function is used to return all file names that have the file name extension ".doc".

VBA Copy code Copy code
adoc = Dir("*.DOC")
Do While adoc <> ""
 Application.PrintOut FileName:=adoc
 adoc = Dir()
Loop

This example prints the first three pages of the document in the active window.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.PrintOut _
 Range:=wdPrintFromTo, From:="1", To:="3"

This example prints the comments in the active document.

VBA Copy code Copy code
If ActiveDocument.Comments.Count >= 1 Then
 ActiveDocument.PrintOut Item:=wdPrintComments
End If

This example prints the active document, fitting six pages on each sheet.

VBA Copy code Copy code
ActiveDocument.PrintOut PrintZoomColumn:=3, _
 PrintZoomRow:=2

This example prints the active document at 75% of actual size.

VBA Copy code Copy code
ActiveDocument.PrintOut _
 PrintZoomPaperWidth:=0.75 * (8.5 * 1440), _
 PrintZoomPaperHeight:=0.75 * (11 * 1440)

See also

Concepts

Document Object

Other resources

Document Object Members


Document.PrintPreview Method (Word)

 Copy code hover
[image]

Document.PrintPreview Method (Word)
See also Send feedback

Published: July 16, 2012

Switches the view to print preview.

Syntax

expression .PrintPreview

expression Required. A variable that represents a Document object.

Remarks

In addition to using the PrintPreview method, you can set the PrintPreview property to True or False to switch to or from print preview, respectively. You can also change the view by setting the Type property for the View object to wdPrintPreview.

Example

This example switches the active document to print preview if it is currently in some other view.

VBA Copy code Copy code
If Application.PrintPreview = False Then
 ActiveDocument.PrintPreview
End If

See also

Concepts

Document Object

Other resources

Document Object Members


Document.Protect Method (Word)

 Copy code hover
[image]

Document.Protect Method (Word)
See also Send feedback

Published: July 16, 2012

Protects the specified document from unauthorized changes.

Version information

Version Added: Word 2010

Syntax

expression .Protect(Type,NoReset,Password,UseIRM,EnforceStyleLock)

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data type | Description
Type | Required | WdProtectionType | The type of protection to apply.
NoReset | Optional | VARIANT | False to reset form fields to their default values; True to retain the current form field values if the document is protected. If Type is not wdAllowOnlyFormFields, NoReset is ignored.
Password | Optional | VARIANT | If supplied, the password to be able to edit the document, or to change or remove protection.
UseIRM | Optional | VARIANT | Specifies whether to use Information Rights Management (IRM) when protecting the document from changes.
EnforceStyleLock | Optional | VARIANT | Specifies whether formatting restrictions are enforced for a protected document.
Type | Required | WDPROTECTIONTYPE |
NoReset | Optional | VARIANT |
Password | Optional | VARIANT |
UseIRM | Optional | VARIANT |
EnforceStyleLock | Optional | VARIANT |

Return value

VOID

See also

Concepts

Document Object

Other resources

Document Members


Document.Range Method (Word)

 Copy code hover
[image]

Document.Range Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a Range object by using the specified starting and ending character positions.

Syntax

expression .Range(Start, End)

expression Required. A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
Start | Optional | Variant | The starting character position.
End | Optional | Variant | The ending character position.

Return Value

Range

Example

This example applies bold formatting to the first 10 characters in the active document.

VBA Copy code Copy code
Sub DocumentRange()
 ActiveDocument.Range(Start:=0, End:=10).Bold = True
End Sub

This example creates a range that starts at the beginning of the active document and ends at the cursor position, and then it changes all characters within that range to uppercase.

VBA Copy code Copy code
Sub DocumentRange2()
 Dim r As Range
 Set r = ActiveDocument.Range(Start:=0, End:=Selection.End)
 r.Case = wdUpperCase
End Sub

This example creates and sets the variable myRange to paragraphs three through six in the active document, and then it right-aligns the paragraphs in the range.

VBA Copy code Copy code
Sub DocumentRange3()
 Dim aDoc As Document
 Dim myRange As Range
 Set aDoc = ActiveDocument
 If aDoc.Paragraphs.Count >= 6 Then
 Set myRange = aDoc.Range(aDoc.Paragraphs(2).Range.Start, _
 aDoc.Paragraphs(4).Range.End)
 myRange.Paragraphs.Alignment = wdAlignParagraphRight
 End If
End Sub

See also

Concepts

Document Object

Other resources

Document Object Members


Document.Redo Method (Word)

 Copy code hover
[image]

Document.Redo Method (Word)
See also Send feedback

Published: July 16, 2012

Redoes the last action that was undone (reverses the Undo method). Returns True if the actions were redone successfully.

Syntax

expression .Redo(Times)

expression Required. A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
Times | Optional | Variant | The number of actions to be redone.

Return Value

Boolean

Example

This example redoes the last two actions in the Sales.doc redo list.

VBA Copy code Copy code
Documents("Sales.doc").Redo 2

This example redoes the last action in the active document. If the action is successfully redone, a message is displayed in the status bar.

VBA Copy code Copy code
On Error Resume Next
If ActiveDocument.Redo = False Then _
 StatusBar = "Redo was unsuccessful"

See also

Concepts

Document Object

Other resources

Document Object Members


Document.RejectAllRevisions Method (Word)

 Copy code hover
[image]

Document.RejectAllRevisions Method (Word)
See also Send feedback

Published: July 16, 2012

Rejects all tracked changes in the specified document.

Syntax

expression .RejectAllRevisions

expression Required. A variable that represents a Document object.

Example

This example checks the main story in active document for tracked changes, and if there are any, the example rejects all revisions in all stories in the document.

VBA Copy code Copy code
If ActiveDocument.Revisions.Count >= 1 Then _
 ActiveDocument.RejectAllRevisions

See also

Concepts

Document Object

Other resources

Document Object Members


Document.RejectAllRevisionsShown Method (Word)

 Copy code hover
[image]

Document.RejectAllRevisionsShown Method (Word)
See also Send feedback

Published: July 16, 2012

Rejects all revisions in a document that are displayed on the screen.

Syntax

expression .RejectAllRevisionsShown

expression Required. A variable that represents a Document object.

Example

This example hides revisions made by Jeff Smith and rejects all remaining revisions that are displayed.

VBA Copy code Copy code
Sub RejectAllChanges()
 Dim rev As Reviewer
 With ActiveWindow.View
 'Show all revisions in the document
 .ShowRevisionsAndComments = True
 .ShowFormatChanges = True
 .ShowInsertionsAndDeletions = True

 For Each rev In .Reviewers
 rev.Visible = True
 Next

 'Hide revisions made by "Jeff Smith"
 .Reviewers(Index:="Jeff Smith").Visible = False
 End With

 'Reject all revisions displayed in the active view
 ActiveDocument.RejectAllRevisionsShown
End Sub

See also

Concepts

Document Object

Other resources

Document Object Members


Document.Reload Method (Word)

 Copy code hover
[image]

Document.Reload Method (Word)
See also Send feedback

Published: July 16, 2012

Reloads a cached document by resolving the hyperlink to the document and downloading it.

Syntax

expression .Reload

expression Required. A variable that represents a Document object.

Remarks

This method reloads the document asynchronously; that is, statements following the Reload method in your procedure may execute before the document is actually reloaded. Because of this, you may get unexpected results from using this method in your macros.

Example

This example opens and reloads the hyperlink to the address "main" on a local intranet.

VBA Copy code Copy code
With ActiveDocument
 .FollowHyperlink Address:="http://main"
 .Reload
End With

See also

Concepts

Document Object

Other resources

Document Object Members


Document.ReloadAs Method (Word)

 Copy code hover
[image]

Document.ReloadAs Method (Word)
See also Send feedback

Published: July 16, 2012

Reloads a document based on an HTML document, using the specified document encoding.

Syntax

expression .ReloadAs(Encoding)

expression Required. A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
Encoding | Required | MsoEncoding | Specifies the encoding to use when reloading the document.

Example

This example reloads the current document with Cyrillic encoding.

VBA Copy code Copy code
ActiveDocument.ReloadAs msoEncodingCyrillic

See also

Concepts

Document Object

Other resources

Document Object Members


Document.RemoveDocumentInformation Method (Word)

 Copy code hover
[image]

Document.RemoveDocumentInformation Method (Word)
See also Send feedback

Published: July 16, 2012

Removes sensitive information, properties, comments, and other metadata from a document.

Version Information

Version Added: Word 2007

Syntax

expression .RemoveDocumentInformation(RemoveDocInfoType)

expression An expression that returns a Document object.

Parameters

Name | Required/Optional | Data Type | Description
RemoveDocInfoType | Required | WdRemoveDocInfoType | Specifies what to remove.

See also

Concepts

Document Object

Other resources

Document Object Members


Document.RemoveLockedStyles Method (Word)

 Copy code hover
[image]

Document.RemoveLockedStyles Method (Word)
See also Send feedback

Published: July 16, 2012

Purges a document of locked styles when formatting restrictions have been applied in a document.

Syntax

expression .RemoveLockedStyles

expression Required. A variable that represents a Document object.

Example

The following example purges the locked styles in the active document.

VBA Copy code Copy code
ActiveDocument.RemoveLockedStyles

See also

Concepts

Document Object

Other resources

Document Object Members


Document.RemoveNumbers Method (Word)

 Copy code hover
[image]

Document.RemoveNumbers Method (Word)
See also Send feedback

Published: July 16, 2012

Removes numbers or bullets from the specified document.

Syntax

expression .RemoveNumbers(NumberType)

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
NumberType | Optional | WdNumberType | The type of number to be removed.

Example

This example removes the numbers from the beginning of any numbered paragraphs in the active document.

VBA Copy code Copy code
ActiveDocument.RemoveNumbers wdNumberParagraph

This example removes the bullets or numbers from the third list in MyDocument.doc.

VBA Copy code Copy code
If Documents("MyDocument.doc").Lists.Count >= 3 Then
 Documents("MyDocument.doc").Lists(3).RemoveNumbers
End If

See also

Concepts

Document Object

Other resources

Document Object Members


Document.RemoveTheme Method (Word)

 Copy code hover
[image]

Document.RemoveTheme Method (Word)
See also Send feedback

Published: July 16, 2012

Removes the active theme from the current document.

Syntax

expression .RemoveTheme

expression Required. A variable that represents a Document object.

Example

This example removes the active theme from the current document.

VBA Copy code Copy code
ActiveDocument.RemoveTheme

See also

Concepts

Document Object

Other resources

Document Object Members


Document.Repaginate Method (Word)

 Copy code hover
[image]

Document.Repaginate Method (Word)
See also Send feedback

Published: July 16, 2012

Repaginates the entire document.

Syntax

expression .Repaginate

expression Required. A variable that represents a Document object.

Example

This example repaginates the active document if it has changed since the last time it was saved.

VBA Copy code Copy code
If ActiveDocument.Saved = False Then ActiveDocument.Repaginate

This example repaginates all open documents.

VBA Copy code Copy code
For Each doc In Documents
 doc.Repaginate
Next doc

See also

Concepts

Document Object

Other resources

Document Object Members


Document.ReplyWithChanges Method (Word)

 Copy code hover
[image]

Document.ReplyWithChanges Method (Word)
See also Send feedback

Published: July 16, 2012

Sends an e-mail message to the author of a document that has been sent out for review, notifying them that a reviewer has completed review of the document.

Syntax

expression .ReplyWithChanges(ShowMessage)

expression Required. A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
ShowMessage | Optional | Variant | True to display the message prior to sending. False to automatically send the message without displaying it first. The default value is True.

Remarks

Use the SendForReview method to start a collaborative review of a document. If the ReplyWithChanges method is executed on a document that is not part of a collaborative review cycle, Microsoft Word displays an error message.

Example

This example sends a message notifying the author that a reviewer has completed a review, without first displaying the e-mail message to the reviewer. This example assumes that the current document is part of a collaborative review cycle.

VBA Copy code Copy code
Sub ReplyMsg()
 ActiveDocument.ReplyWithChanges ShowMessage:=False
End Sub

See also

Concepts

Document Object

Other resources

Document Object Members


Document.ResetFormFields Method (Word)

 Copy code hover
[image]

Document.ResetFormFields Method (Word)
See also Send feedback

Published: July 16, 2012

Clears all form fields in a document, preparing the form to be filled in again.

Syntax

expression .ResetFormFields

expression Required. A variable that represents a Document object.

Remarks

Use the ResetFormFields method to clear fields when a document's fields are not locked. To clear fields when a document's fields are locked, use the Protect method.

Example

This example clears the fields in the active document. This example assumes that the active document contains form fields.

VBA Copy code Copy code
Sub ClearFormFields()
 ActiveDocument.ResetFormFields
End Sub

See also

Concepts

Document Object

Other resources

Document Object Members


Document.ReturnToLastReadPosition Method (Word)

 Copy code hover
[image]

Document.ReturnToLastReadPosition Method (Word)
See also Send feedback

Published: July 16, 2012

Returns the active document to the last saved reading position, and returns an integer that represents that position.

Version information

Version Added: Word 2013

Syntax

expression .ReturnToLastReadPosition

expression A variable that represents a Document object.

Return value

INT32

See also

Concepts

Document Object

Other resources

Document Members


Document.RunAutoMacro Method (Word)

 Copy code hover
[image]

Document.RunAutoMacro Method (Word)
See also Send feedback

Published: July 16, 2012

Runs an auto macro that's stored in the specified document. If the specified auto macro doesn't exist, nothing happens.

Syntax

expression .RunAutoMacro(Which)

expression Required. A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
Which | Required | WdAutoMacros | The auto macro to run.

Remarks

Use the Run method to run any macro.

Example

This example runs the AutoOpen macro in the active document.

VBA Copy code Copy code
ActiveDocument.RunAutoMacro Which:=wdAutoOpen

See also

Concepts

Document Object

Other resources

Document Object Members


Document.RunLetterWizard Method (Word)

 Copy code hover
[image]

Document.RunLetterWizard Method (Word)
See also Send feedback

Published: July 16, 2012

Runs the Letter Wizard on the specified document.

Syntax

expression .RunLetterWizard(LetterContent, WizardMode)

expression Required. A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
LetterContent | Optional | Variant | A LetterContent object. Any filled properties in the LetterContent object show up as prefilled elements in the Letter Wizard dialog boxes. If this argument is omitted, the GetLetterContent method is automatically used to get a LetterContent object from the specified document.
WizardMode | Optional | Variant | True to display the Letter Wizard dialog box as a series of steps with a Next, Back, and Finish button. False to display the Letter Wizard dialog box as if it were opened from the Tools menu (a properties dialog box with an OK button and a Cancel button). The default value is True.

Remarks

Use the CreateLetterContent method to return a LetterContent object, given various letter element properties. Use the GetLetterContent method to return a LetterContent object based on the contents of the specified document. You can use the resulting LetterContent object with the RunLetterWizard method to preset elements in the Letter Wizard dialog box.

Example

This example creates a new LetterContent object, sets several properties for it, and then runs the Letter Wizard by using the RunLetterWizard method.

VBA Copy code Copy code
Set myContent = New LetterContent
With myContent
 .Salutation ="Hello"
 .SalutationType = wdSalutationOther
 .SenderName = Application.UserName
 .SenderInitials =Application.UserInitials
End With
Documents.Add.RunLetterWizard _
 LetterContent:=myContent, WizardMode:=True

The following example uses the CreateLetterContent method to create a new LetterContent object in the active document, and then it uses this object with the RunLetterWizard method.

VBA Copy code Copy code
Set myLetter = ActiveDocument _
 .CreateLetterContent(DateFormat:="July 31, 1999", _
 IncludeHeaderFooter:=False, _
 PageDesign:="C:\MSOffice\Templates" _
 & "\Letters & Faxes\Contemporary Letter.dot", _
 LetterStyle:=wdFullBlock, Letterhead:=True, _
 LetterheadLocation:=wdLetterTop, _
 LetterheadSize:=InchesToPoints(1.5), _
 RecipientName:="Dave Edson", _
 RecipientAddress:="436 SE Main St." _
 & vbCr & "Bellevue, WA 98004", _
 Salutation:="Dear Dave,", _
 SalutationType:=wdSalutationInformal, _
 RecipientReference:="", MailingInstructions:="", _
 AttentionLine:="", Subject:="End of year report", _
 CCList:="", ReturnAddress:="", SenderName:="", _
 Closing:="Sincerely yours,", SenderCompany:="", _
 SenderJobTitle:="", SenderInitials:="", _
 EnclosureNumber:=0)
ActiveDocument.RunLetterWizard LetterContent:=myLetter

See also

Concepts

Document Object

Other resources

Document Object Members


Document.Save Method (Word)

 Copy code hover
[image]

Document.Save Method (Word)
See also Send feedback

Published: July 16, 2012

Saves all the documents in the Documents collection.

Syntax

expression .Save(NoPrompt, OriginalFormat)

expression Required. A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
NoPrompt | Optional | Variant | True to have Word automatically save all documents. False to have Word prompt the user to save each document that has changed since it was last saved.
OriginalFormat | Optional | Variant | Specifies the way the documents are saved. Can be one of the WdOriginalFormat constants.

Remarks

If a document has not been saved before, the Save As dialog box prompts the user for a file name.

Example

This example saves the active document if it has changed since it was last saved.

VBA Copy code Copy code
If ActiveDocument.Saved = False Then ActiveDocument.Save

This example saves each document in the Documents collection without first prompting the user.

VBA Copy code Copy code
Documents.Save NoPrompt:=True, _
 OriginalFormat:=wdOriginalDocumentFormat

See also

Concepts

Document Object

Other resources

Document Object Members


Document.SaveAs2 Method (Word)

 Copy code hover
[image]

Document.SaveAs2 Method (Word)
See also Send feedback

Published: July 16, 2012

Saves the specified document with a new name or format. Some of the arguments for this method correspond to the options in the Save As dialog box (File tab).

Version Information

Version Added: Word 2010

Syntax

expression .SaveAs2(FileName, FileFormat, LockComments, Password, AddToRecentFiles, WritePassword, ReadOnlyRecommended, EmbedTrueTypeFonts, SaveNativePictureFormat, SaveFormsData, SaveAsAOCELetter, Encoding, InsertLineBreaks, AllowSubstitutions, LineEnding, AddBiDiMarks, CompatibilityMode)

expression An expression that returns a Document object.

Parameters

Name

Required/Optional

Data Type

Description

FileName

Optional

Variant

The name for the document. The default is the current folder and file name. If the document has never been saved, the default name is used (for example, Doc1.doc). If a document with the specified file name already exists, the document is overwritten without prompting the user.

FileFormat

Optional

Variant

The format in which the document is saved. Can be any WdSaveFormat constant. To save a document in another format, specify the appropriate value for the SaveFormat property of the FileConverter object.

LockComments

Optional

Variant

True to lock the document for comments. The default is False.

Password

Optional

Variant

A password string for opening the document. (See Remarks below.)

AddToRecentFiles

Optional

Variant

True to add the document to the list of recently used files on the File menu. The default is True.

WritePassword

Optional

Variant

A password string for saving changes to the document. (See Remarks below.)

ReadOnlyRecommended

Optional

Variant

True to have Microsoft Word suggest read-only status whenever the document is opened. The default is False.

EmbedTrueTypeFonts

Optional

Variant

True to save TrueType fonts with the document. If omitted, the EmbedTrueTypeFonts argument assumes the value of the EmbedTrueTypeFonts property.

SaveNativePictureFormat

Optional

Variant

If graphics were imported from another platform (for example, Macintosh), True to save only the Microsoft Windows version of the imported graphics.

SaveFormsData

Optional

Variant

True to save the data entered by a user in a form as a record.

SaveAsAOCELetter

Optional

Variant

If the document has an attached mailer, True to save the document as an AOCE letter (the mailer is saved).

Encoding

Optional

Variant

The code page, or character set, to use for documents saved as encoded text files. The default is the system code page. You cannot use all MsoEncoding constants with this parameter.

InsertLineBreaks

Optional

Variant

If the document is saved as a text file, True to insert line breaks at the end of each line of text.

AllowSubstitutions

Optional

Variant

If the document is saved as a text file, True allows Word to replace some symbols with text that looks similar. For example, displaying the copyright symbol as (c). The default is False.

LineEnding

Optional

Variant

The way Word marks the line and paragraph breaks in documents saved as text files. Can be one of the following WdLineEndingType constants: wdCRLF (default) or wdCROnly.

AddBiDiMarks

Optional

Variant

True adds control characters to the output file to preserve bi-directional layout of the text in the original document.

CompatibilityMode

Optional

Variant

The compatibility mode that Word 2010 uses when opening the document. WdCompatibilityMode constant.

Important note Important

By default, if no value is specified for this parameter, Word enters a value of 0, which specifies that the current compatibility mode of the document should be retained.

Return Value

Nothing

Example

The following code example saves the active document as Test.rtf in rich-text format (RTF).

VBA Copy code Copy code
Sub SaveAsRTF()
    ActiveDocument.SaveAs2 FileName:="Text.rtf", _
        FileFormat:=wdFormatRTF
End Sub

The following code example saves the active document in text-file format with the extension ".txt".

VBA Copy code Copy code
Sub SaveAsTextFile()
    Dim strDocName As String
    Dim intPos As Integer

    ' Find position of extension in file name
    strDocName = ActiveDocument.Name
    intPos = InStrRev(strDocName, ".")

    If intPos = 0 Then

        ' If the document has not yet been saved
        ' Ask the user to provide a file name
        strDocName = InputBox("Please enter the name " & _
            "of your document.")
    Else

        ' Strip off extension and add ".txt" extension
        strDocName = Left(strDocName, intPos - 1)
        strDocName = strDocName & ".txt"
    End If

    ' Save file with new extension
    ActiveDocument.SaveAs2 FileName:=strDocName, _
        FileFormat:=wdFormatText
End Sub

The following code example loops through all the installed converters and, if it finds the WordPerfect 6.0 converter, it saves the active document using the converter.

VBA Copy code Copy code
Sub SaveWithConverter()

    Dim cnvWrdPrf As FileConverter

    ' Look for WordPerfect file converter
    ' And save document using the converter
    ' For the FileFormat converter value
    For Each cnvWrdPrf In Application.FileConverters
        If cnvWrdPrf.ClassName = "WrdPrfctWin" Then
            ActiveDocument.SaveAs2 FileName:="MyWP.doc", _
                FileFormat:=cnvWrdPrf.SaveFormat
        End If
    Next cnvWrdPrf

End Sub

The following code example shows a procedure that saves a document with a password.

VBA Copy code Copy code
Sub SaveWithPassword(docCurrent As Document, strPWD As String)
    With docCurrent
        .SaveAs2 WritePassword:=strPWD
    End With
End Sub

See also

Concepts

Document Object

Other resources

Document Object Members


Document.SaveAsQuickStyleSet Method (Word)

 Copy code hover
[image]

Document.SaveAsQuickStyleSet Method (Word)
See also Send feedback

Published: July 16, 2012

Saves the group of quick styles currently in use.

Version Information

Version Added: Word 2007

Syntax

expression .SaveAsQuickStyleSet(FileName)

expression An expression that returns a Document object.

Parameters

Name | Required/Optional | Data Type | Description
FileName | Required | String | The path and file name for the quick style set file.

See also

Concepts

Document Object

Other resources

Document Object Members


Document.Select Method (Word)

 Copy code hover
[image]

Document.Select Method (Word)
See also Send feedback

Published: July 16, 2012

Selects the contents of the specified document.

Syntax

expression .Select

expression Required. A variable that represents a Document object.

Remarks

After using this method, use the Selection property to work with the selected items. For more information, see Working with the Selection Object.

See also

Concepts

Document Object

Other resources

Document Object Members


Document.SelectAllEditableRanges Method (Word)

 Copy code hover
[image]

Document.SelectAllEditableRanges Method (Word)
See also Send feedback

Published: July 16, 2012

Selects all ranges for which the specified user or group of users has permission to modify.

Syntax

expression .SelectAllEditableRanges(EditorID)

expression Required. A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
EditorID | Optional | Variant | Can be either a String that represents the user's e-mail alias (if in the same domain), an e-mail address, or a WdEditorType constant that represents a group of users. If omitted, only ranges for which all users have permissions will be selected.

Example

The following example selects all ranges for which the current user has permission to modify.

VBA Copy code Copy code
ActiveDocument.SelectAllEditableRanges wdEditorCurrent

See also

Concepts

Document Object

Other resources

Document Object Members


Document.SelectContentControlsByTag Method (Word)

 Copy code hover
[image]

Document.SelectContentControlsByTag Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a ContentControls collection that represents all the content controls in a document with the tag value specified in the Tag parameter. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .SelectContentControlsByTag(Tag)

expression An expression that returns a Document object.

Parameters

Name | Required/Optional | Data Type | Description
Tag | Required | String | The tag value of the content controls to return.

Return Value

ContentControls

See also

Concepts

Document Object

Other resources

Document Object Members


Document.SelectContentControlsByTitle Method (Word)

 Copy code hover
[image]

Document.SelectContentControlsByTitle Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a ContentControls collection that represents all the content controls in a document with the title specified in the Title parameter. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .SelectContentControlsByTitle(Title)

expression An expression that returns a Document object.

Parameters

Name | Required/Optional | Data Type | Description
Name | Required | Title | The title of the content controls to return.

Return Value

ContentControls

See also

Concepts

Document Object

Other resources

Document Object Members


Document.SelectLinkedControls Method (Word)

 Copy code hover
[image]

Document.SelectLinkedControls Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a ContentControls collection that represents all content controls in a document that are linked to the specific custom XML node in the document's XML data store as specified by the Node parameter. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .SelectLinkedControls(Node)

expression An expression that returns a Document object.

Parameters

Name | Required/Optional | Data Type | Description
Node | Required | CustomXMLNode | The XML node in the document's data store to which the content controls are linked.

Return Value

ContentControls

See also

Concepts

Document Object

Other resources

Document Object Members


Document.SelectNodes Method (Word)

 Copy code hover
[image]

Document.SelectNodes Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an XMLNodes collection that represents all the nodes that match the XPath parameter in the order in which they appear in the document or range.

Syntax

expression .SelectNodes(XPath, PrefixMapping, FastSearchSkippingTextNodes)

expression Required. A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
XPath | Required | String | A valid XPath string. For more information on XPath, see the XPath reference documentation on the Microsoft Developer Network (MSDN) Web site.
PrefixMapping | Optional | Variant | Provides the prefix in the schema against which to perform the search. Use the PrefixMapping parameter if your XPath parameter uses names to search for elements.
FastSearchSkippingTextNodes | Optional | Boolean | True skips all text nodes while searching for the specified node. False includes text nodes in the search. Default value is False.

Return Value

XMLNodes

Remarks

Setting the FastSearchSkippingTextNodes parameter to True diminishes performance, because Microsoft Word searches all nodes in a document against the text contained in the node.

Example

The following example returns a collection of all book elements in the active document.

VBA Copy code Copy code
Dim objElements As XMLNodes
Dim strElement As String
Dim strPrefix As String

strElement = "/x:catalog/x:book"
strPrefix = "xmlns:x=""" & ActiveDocument _
 .XMLSchemaReferences(1).NamespaceURI & """"

Set objElements = ActiveDocument _
 .SelectNodes(strElement, strPrefix)

See also

Concepts

Document Object

Other resources

Document Object Members


Document.SelectSingleNode Method (Word)

 Copy code hover
[image]

Document.SelectSingleNode Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an XMLNode object that represents the first node that matches the XPath parameter in the specified document.

Syntax

expression .SelectSingleNode(XPath, PrefixMapping, FastSearchSkippingTextNodes)

expression Required. A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
XPath | Required | String | A valid XPath string. For more information on XPath, see the XPath reference documentation on the Microsoft Developer Network (MSDN) Web site.
PrefixMapping | Optional | Variant | Provides the prefix in the schema against which to perform the search. Use the PrefixMapping parameter if your XPath parameter uses names to search for elements.
FastSearchSkippingTextNodes | Optional | Boolean | True skips all text nodes while searching for the specified node. False includes text nodes in the search. Default value is True.

Return Value

XMLNode

Remarks

Setting the FastSearchSkippingTextNodes parameter to False diminishes performance because Microsoft Word searches all nodes in a document against the text contained in the node.

Example

The following example returns the first title element found in the active document that is a child element of the book element.

VBA Copy code Copy code
Dim objElement As XMLNode
Dim strElement As String
Dim strPrefix As String

strElement = "/x:catalog/x:book/x:title"
strPrefix = "xmlns:x=""" & ActiveDocument _
 .XMLSchemaReferences(1).NamespaceURI & """"

Set objElement = ActiveDocument _
 .SelectSingleNode(strElement, strPrefix)

See also

Concepts

Document Object

Other resources

Document Object Members


Document.SelectUnlinkedControls Method (Word)

 Copy code hover
[image]

Document.SelectUnlinkedControls Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a ContentControls collection that represents all content controls in a document that are not linked to an XML node in the document's XML data store. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .SelectUnlinkedControls(Stream)

expression An expression that returns a Document object.

Parameters

Name | Required/Optional | Data Type | Description
Stream | Optional | CustomXMLPart | A custom XML part reference. Setting this parameter filters the returned content controls to include only content controls that reference this CustomXMLPart in their XMLMapping definition.

Return Value

ContentControls

See also

Concepts

Document Object

Other resources

Document Object Members


Document.SendFax Method (Word)

 Copy code hover
[image]

Document.SendFax Method (Word)
See also Send feedback

Published: July 16, 2012

Sends the specified document as a fax, without any user interaction.

Syntax

expression .SendFax(Address, Subject)

expression Required. A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
Address | Required | String | The recipient's fax number.
Subject | Optional | Variant | The text for the subject line. The character limit is 255.

Example

This example sends the active document as a fax.

VBA Copy code Copy code
ActiveDocument.SendFax Address:="12065551234", _
 Subject:="Important Fax"

See also

Concepts

Document Object

Other resources

Document Object Members


Document.SendFaxOverInternet Method (Word)

 Copy code hover
[image]

Document.SendFaxOverInternet Method (Word)
See also Send feedback

Published: July 16, 2012

Sends a document to a fax service provider, who faxes the document to one or more specfied recipients.

Syntax

expression .SendFaxOverInternet(Recipients, Subject, ShowMessage)

expression Required. A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
Recipients | Optional | Variant | A String that represents the fax numbers and e-mail addresses of the people to whom to send the fax. Separate multiple recipients with a semicolon.
Subject | Optional | Variant | A String that represents the subject line for the faxed document.
ShowMessage | Optional | Variant | True displays the fax message before sending it. False sends the fax without displaying the fax message.

Remarks

Using the SendFaxOverInternet method requires that a fax service is enabled on a user's computer. If a fax service is not enabled, the SendFaxOverInternet method will cause a runtime error.

The format used for specifying fax numbers in the Recipients parameter is either recipientsfaxnumber@usersfaxprovider or recipientsname@recipientsfaxnumber. You can access the user's fax provider information using the following registry path:

VBA Copy code Copy code
HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Common\Services\Fax

Use the FaxAddress key value at this registry location to determine the format to use for a user. If this registry entry does not exist, no fax service is available.

Example

The following example sends a fax to the fax service provider, who will fax the message to the recipient.

VBA Copy code Copy code
ActiveDocument.SendFaxOverInternet _
 "14255550101@consolidatedmessenger.com", _
 "For your review", True

See also

Concepts

Document Object

Other resources

Document Object Members


Document.SendForReview Method (Word)

 Copy code hover
[image]

Document.SendForReview Method (Word)
See also Send feedback

Published: July 16, 2012

Sends a document in an e-mail message for review by the specified recipients.

Syntax

expression .SendForReview(Recipients, Subject, ShowMessage, IncludeAttachment)

expression Required. A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
Recipients | Optional | Variant | A string that lists the people to whom to send the message. These can be unresolved names and aliases in an e-mail phone book or full e-mail addresses. Separate multiple recipients with a semicolon (;). If left blank and ShowMessage is False, you will receive an error message and the message will not be sent.
Subject | Optional | Variant | A string for the subject of the message. If left blank, the subject will be: Please review "file name".
ShowMessage | Optional | Variant | A Boolean value that indicates whether the message should be displayed when the method is executed. The default value is True. If set to False, the message is automatically sent to the recipients without first showing the message to the sender.
IncludeAttachment | Optional | Variant | A Boolean value that indicates whether the message should include an attachment or a link to a server location. The default value is True. If set to False, the document must be stored at a shared location.

Remarks

The SendForReview method starts a collaborative review cycle. Use the EndReview method to end a review cycle.

Example

This example automatically sends the current document as an attachment in an e-mail message to the specified recipients.

VBA Copy code Copy code
Sub WebReview()
 ActiveDocument.SendForReview _
 Recipients:="someone@example.com; amy jones", _
 Subject:="Please review this document.", _
 ShowMessage:=False, _
 IncludeAttachment:=True
End Sub

See also

Concepts

Document Object

Other resources

Document Object Members


Document.SendMail Method (Word)

 Copy code hover
[image]

Document.SendMail Method (Word)
See also Send feedback

Published: July 16, 2012

Opens a message window for sending the specified document through Microsoft Exchange.

Syntax

expression .SendMail

expression Required. A variable that represents a Document object.

Remarks

Use the SendMailAttach property to control whether the document is sent as text in the message window or as an attachment.

Example

This example sends the active document as an attachment to a mail message.

VBA Copy code Copy code
Options.SendMailAttach = True
ActiveDocument.SendMail

See also

Concepts

Document Object

Other resources

Document Object Members


Document.SetCompatibilityMode Method (Word)

 Copy code hover
[image]

Document.SetCompatibilityMode Method (Word)
See also Send feedback

Published: July 16, 2012

Sets the compatibility mode for the document.

Version Information

Version Added: Word 2010

Syntax

expression .SetCompatibilityMode(Mode)

expression A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
Mode | Required | Long | Specifies which version of Word to approximate. Use a constant from the WdCompatibilityMode enumeration as an argument for this parameter.

Remarks

When you open a document in Word 2010 that was created in a previous version of Word, Compatibility Mode is turned on. Compatibility Mode ensures that no new or enhanced features in Word 2010 are available while working with a document, so that people who edit the document using previous versions of Word will have full editing capabilities.

Example

The following code example puts Word 2010 in Word 2003 Compatibility Mode.

VBA Copy code Copy code
ActiveDocument.SetCompatibilityMode (wdWord2003)

See also

Concepts

Document Object

Other resources

Document Object Members


Document.SetDefaultTableStyle Method (Word)

 Copy code hover
[image]

Document.SetDefaultTableStyle Method (Word)
See also Send feedback

Published: July 16, 2012

Specifies the table style to use for newly created tables in a document.

Syntax

expression .SetDefaultTableStyle(Style, SetInTemplate)

expression Required. A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
Style | Required | Variant | A string specifying the name of the style.
SetInTemplate | Required | Boolean | True to save the table style in the template attached to the document.

Example

This example checks to see if the default table style used in the active document is named Table Normal and, if it is, changes the default table style to TableStyle1. This example assumes that you have a table style named TableStyle1.

VBA Copy code Copy code
Sub TableDefaultStyle()
 With ActiveDocument
 If .DefaultTableStyle = "Table Normal" Then
 .SetDefaultTableStyle Style:="TableStyle1", _
 SetInTemplate:=True
 End If
 End With
End Sub

See also

Concepts

Document Object

Other resources

Document Object Members


Document.SetLetterContent Method (Word)

 Copy code hover
[image]

Document.SetLetterContent Method (Word)
See also Send feedback

Published: July 16, 2012

Inserts the contents of the specified LetterContent object into a document.

Syntax

expression .SetLetterContent(LetterContent)

expression Required. A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
LetterContent | Required | LetterContent | The that includes the various elements of the letter.

Remarks

This method is similar to the RunLetterWizard method except that it doesn't display the Letter Wizard dialog box. The method adds, deletes, or restyles letter elements in the specified document based on the contents of the LetterContent object.

Example

This example retrieves the Letter Wizard elements from the active document, changes the attention line text, and then uses the SetLetterContent method to update the active document to reflect the changes.

VBA Copy code Copy code
Set myLetterContent = ActiveDocument.GetLetterContent
myLetterContent.AttentionLine = "Greetings"
ActiveDocument.SetLetterContent LetterContent:=myLetterContent

See also

Concepts

Document Object

Other resources

Document Object Members


Document.SetPasswordEncryptionOptions Method (Word)

 Copy code hover
[image]

Document.SetPasswordEncryptionOptions Method (Word)
See also Send feedback

Published: July 16, 2012

Sets the options Microsoft Word uses for encrypting documents with passwords.

Syntax

expression .SetPasswordEncryptionOptions(PasswordEncryptionProvider, PasswordEncryptionAlgorithm, PasswordEncryptionKeyLength, PasswordEncryptionFileProperties)

expression Required. A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
PasswordEncryptionProvider | Required | String | The name of the encryption provider.
PasswordEncryptionAlgorithm | Required | String | The name of the encryption algorithm. Word supports stream-encrypted algorithms.
PasswordEncryptionKeyLength | Required | Long | The encryption key length. Must be a multiple of 8, starting at 40.
PasswordEncryptionFileProperties | Optional | Variant | True for Word to encrypt file properties. Default is True.

Remarks

For enhanced security, do not use Weak Encryption (XOR) (also called "OfficeXor") or "Office97/2000 Compatible" (also called "OfficeStandard") algorithms.

Example

This example sets the password encryption to a stronger encryption if the password encryption algorithm in use is "OfficeXor" or "OfficeStandard."

VBA Copy code Copy code
Sub PasswordSettings()
 With ActiveDocument
 If .PasswordEncryptionAlgorithm = "OfficeXor" Or _
 .PasswordEncryptionAlgorithm = "OfficeStandard" Then

 .SetPasswordEncryptionOptions _
 PasswordEncryptionProvider:="Microsoft RSA SChannel Cryptographic Provider", _
 PasswordEncryptionAlgorithm:="RC4", _
 PasswordEncryptionKeyLength:=56, _
 PasswordEncryptionFileProperties:=True

 End If
 End With
End Sub

See also

Concepts

Document Object

Other resources

Document Object Members


Document.ToggleFormsDesign Method (Word)

 Copy code hover
[image]

Document.ToggleFormsDesign Method (Word)
See also Send feedback

Published: July 16, 2012

Switches form design mode on or off.

Syntax

expression .ToggleFormsDesign

expression Required. A variable that represents a Document object.

Remarks

When Microsoft Word is in form design mode, the Control Toolbox toolbar is displayed. You can use this toolbar to insert Microsoft ActiveX controls such as command buttons, scroll bars, and option buttons. In form design mode, event procedures do not run, and when you click an embedded control, the control's sizing handles appear.

Example

This example switches to form design mode if the Control Toolbox toolbar is not currently displayed.

VBA Copy code Copy code
If CommandBars("Control Toolbox").Visible = False Then
 ActiveDocument.ToggleFormsDesign
End If

See also

Concepts

Document Object

Other resources

Document Object Members


Document.TransformDocument Method (Word)

 Copy code hover
[image]

Document.TransformDocument Method (Word)
See also Send feedback

Published: July 16, 2012

Applies the specified Extensible Stylesheet Language Transformation (XSLT) file to the specified document and replaces the document with the results.

Syntax

expression .TransformDocument(Path, DataOnly)

expression Required. A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
Path | Required | String | The path for the XSLT to use.
DataOnly | Optional | Boolean | True applies the transformation only to the data in the document, excluding Microsoft Word XML. False applies the transform to the entire document, including Word XML. Default value is True.

Example

The following example transforms the active document using the specified XSLT file.

VBA Copy code Copy code
ActiveDocument.TransformDocument _
 ("c:\schemas\simplesample.xslt")

See also

Concepts

Document Object

Other resources

Document Object Members


Document.Undo Method (Word)

 Copy code hover
[image]

Document.Undo Method (Word)
See also Send feedback

Published: July 16, 2012

Undoes the last action or a sequence of actions, which are displayed in the Undo list. Returns True if the actions were successfully undone.

Syntax

expression .Undo(Times)

expression Required. A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
Times | Optional | Variant | The number of actions to be undone.

Return Value

Boolean

Example

This example undoes the last two actions taken in Sales.doc.

VBA Copy code Copy code
Documents("Sales.doc").Undo 2

This example undoes the last action. If the action is successfully undone, a message is displayed in the status bar.

VBA Copy code Copy code
On Error Resume Next
If ActiveDocument.Undo = False Then _
 StatusBar = "Undo was unsuccessful"

See also

Concepts

Document Object

Other resources

Document Object Members


Document.UndoClear Method (Word)

 Copy code hover
[image]

Document.UndoClear Method (Word)
See also Send feedback

Published: July 16, 2012

Clears the list of actions that can be undone for the specified document.

Syntax

expression .UndoClear

expression Required. A variable that represents a Document object.

Remarks

This method corresponds to the list of items that appears when you click the arrow beside the Undo button on the Standard toolbar. Include this method at the end of a macro to keep Visual Basic actions from appearing in the Undo box (for example, "VBA-Selection.InsertAfter").

Example

This example clears the list of actions that can be undone for the active document.

VBA Copy code Copy code
ActiveDocument.UndoClear

See also

Concepts

Document Object

Other resources

Document Object Members


Document.Unprotect Method (Word)

 Copy code hover
[image]

Document.Unprotect Method (Word)
See also Send feedback

Published: July 16, 2012

Removes protection from the specified document. .

Syntax

expression .UnProtect(Password)

expression Required. A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
Password | Optional | Variant | The password string used to protect the document. Passwords are case-sensitive. If the document is protected with a password and the correct password isn't supplied, a dialog box prompts the user for the password.

Security

Avoid using hard-coded passwords in your applications. If a password is required in a procedure, request the password from the user, store it in a variable, and then use the variable in your code. For recommended best practices on how to do this, see Security Notes for Microsoft Office Solution Developers.

Remarks

If the document isn't protected, this method generates an error.

Example

This example removes protection from the active document, using the value of the strPassword variable as the password.

VBA Copy code Copy code
If ActiveDocument.ProtectionType <> wdNoProtection Then
 ActiveDocument.Unprotect Password:=strPassword
End If

This example removes protection from the active document. Text is inserted, and the document is protected for revisions.

VBA Copy code Copy code
Set aDoc = ActiveDocument
If aDoc.ProtectionType <> wdNoProtection Then
 aDoc.Unprotect
 Selection.InsertBefore "department six"
 aDoc.Protect Type:=wdAllowOnlyRevisions, Password:=strPassword
End If

See also

Concepts

Document Object

Other resources

Document Object Members


Document.UpdateStyles Method (Word)

 Copy code hover
[image]

Document.UpdateStyles Method (Word)
See also Send feedback

Published: July 16, 2012

Copies all styles from the attached template into the document, overwriting any existing styles in the document that have the same name.

Syntax

expression .UpdateStyles

expression Required. A variable that represents a Document object.

Example

This example copies the styles from the attached template into each open document, and then it closes each document.

VBA Copy code Copy code
For Each aDoc In Documents
 aDoc.UpdateStyles
 aDoc.Close SaveChanges:=wdSaveChanges
Next aDoc

This example changes the formatting of the Heading 1 style in the template attached to the active document. The UpdateStyles method updates the styles in the active document, including the Heading 1 style.

VBA Copy code Copy code
Set aDoc = ActiveDocument.AttachedTemplate.OpenAsDocument
With aDoc.Styles(wdStyleHeading1).Font
 .Name = "Arial"
 .Bold = False
End With
aDoc.Close SaveChanges:=wdSaveChanges
ActiveDocument.UpdateStyles

See also

Concepts

Document Object

Other resources

Document Object Members


Document.ViewCode Method (Word)

 Copy code hover
[image]

Document.ViewCode Method (Word)
See also Send feedback

Published: July 16, 2012

Displays the code window for the selected Microsoft ActiveX control in the specified document.

Syntax

expression .ViewCode

expression Required. A variable that represents a Document object.

Remarks

This method is available only from outside Microsoft Word.

See also

Concepts

Document Object

Other resources

Document Object Members


Document.ViewPropertyBrowser Method (Word)

 Copy code hover
[image]

Document.ViewPropertyBrowser Method (Word)
See also Send feedback

Published: July 16, 2012

Displays the property window for the selected Microsoft ActiveX control in the specified document.

Syntax

expression .ViewPropertyBrowser

expression Required. A variable that represents a Document object.

Remarks

This method is available only from outside Microsoft Word.

See also

Concepts

Document Object

Other resources

Document Object Members


Document.WebPagePreview Method (Word)

 Copy code hover
[image]

Document.WebPagePreview Method (Word)
See also Send feedback

Published: July 16, 2012

Displays a preview of the current document as it would look if saved as a Web page.

Syntax

expression .WebPagePreview

expression Required. A variable that represents a Document object.

Example

This example displays the current document as it would appear if saved as a Web page.

VBA Copy code Copy code
ActiveDocument.WebPagePreview

See also

Concepts

Document Object

Other resources

Document Object Members


Document Events (Word)

 Copy code hover
[image]

Document Events (Word)
Send feedback

Published: July 16, 2012

This object has the following events:

Events

Name | Description
BuildingBlockInsert | Occurs when you insert a building block into a document. .
Close | Occurs when a document is closed.
ContentControlAfterAdd | Occurs after adding a content control to a document.
ContentControlBeforeContentUpdate | Occurs before updating the content in a content control, but only when the content comes from the Office XML data store.
ContentControlBeforeDelete | Occurs before removing a content control from a document.
ContentControlBeforeStoreUpdate | Occurs before updating the document's XML data store with the value of a content control.
ContentControlOnEnter | Occurs when a user enters a content control.
ContentControlOnExit | Occurs when a user leaves a content control.
New | Occurs when a new document based on the template is created. A procedure for the New event will run only if it is stored in a template.
Open | Occurs when a document is opened.
Sync | This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.
XMLAfterInsert | Occurs when a user adds a new XML element to a document. If more than one element is added to the document at the same time (for example, when cutting and pasting XML), the event fires for each element that is inserted.
XMLBeforeDelete | Occurs when a user deletes an XML element from a document. If more than one element is deleted from the document at the same time (for example, when cutting and pasting XML), the event fires for each element that is deleted.


Document.BuildingBlockInsert Event (Word)

 Copy code hover
[image]

Document.BuildingBlockInsert Event (Word)
See also Send feedback

Published: July 16, 2012

Occurs when you insert a building block into a document. .

Syntax

Private Sub expression _BuildingBlockInsert(Range, Name, Category, Type, Template)

expression An expression that returns a Document object.

Parameters

Name | Required/Optional | Data Type | Description
Range | Required | Range | Specifies the position where the building block is inserted.
Name | Required | String | Specifies the name of the building block.
Category | Required | String | Specifies the building block category.
Type | Required | String | Specifies the type of building block.
Template | Required | String | Specifies the name of the template that contains the building block.

Remarks

For information about using events with a Document object, see Using Events with the Document Object.

See also

Concepts

Document Object

Other resources

Document Object Members


Document.Close Event (Word)

 Copy code hover
[image]

Document.Close Event (Word)
See also Send feedback

Published: July 16, 2012

Occurs when a document is closed.

Syntax

Private Sub expression _Close()

expression A variable that represents a Document object.

Remarks

If the event procedure is stored in a template, the procedure will run when a new document based on that template is closed and when the template itself is closed (after being opened as a document).

For information about using events with a Document object, see Using Events with the Document Object.

Example

This example makes a backup copy of the document on a file server when the document is closed. (The procedure can be stored in the ThisDocument class module of a document or its attached template.)

VBA Copy code Copy code
Private Sub Document_Close()
 ActiveDocument.Save
 ActiveDocument.SaveAs "\\network\backup\" & ThisDocument.Name
End Sub

See also

Concepts

Document Object

Other resources

Document Object Members


Document.ContentControlAfterAdd Event (Word)

 Copy code hover
[image]

Document.ContentControlAfterAdd Event (Word)
See also Send feedback

Published: July 16, 2012

Occurs after adding a content control to a document.

Syntax

Private Sub expression _ContentControlAfterAdd(NewContentControl, InUndoRedo)

expression An expression that returns a Document object.

Parameters

Name | Required/Optional | Data Type | Description
NewContentControl | Required | ContentControl | The content control being added.
InUndoRedo | Required | Boolean | Specifies whether the addition is taking place as part an undo or redo action.

Remarks

For information about using events with the Document object, see Using Events with the Document Object.

See also

Concepts

Document Object

Other resources

Document Object Members


Document.ContentControlBeforeContentUpdate Event (Word)

 Copy code hover
[image]

Document.ContentControlBeforeContentUpdate Event (Word)
See also Send feedback

Published: July 16, 2012

Occurs before updating the content in a content control, but only when the content comes from the Office XML data store.

Syntax

Private Sub expression _ContentControlBeforeContentUpdate(ContentControl, Content)

expression An expression that returns a Document object.

Parameters

Name | Required/Optional | Data Type | Description
ContentControl | Required | ContentControl | The content control being updated.
Content | Required | String | The updated content for a control. Use this parameter to change the contents of the XML data and format it for display.

Remarks

Note Note

This event does not occur for repeating content controls.

For information about using events with the Document object, see Using Events with the Document Object.

See also

Concepts

Document Object

Other resources

Document Object Members


Document.ContentControlBeforeDelete Event (Word)

 Copy code hover
[image]

Document.ContentControlBeforeDelete Event (Word)
See also Send feedback

Published: July 16, 2012

Occurs before removing a content control from a document.

Syntax

Private Sub expression _ContentControlBeforeDelete(OldContentControl, InUndoRedo)

expression An expression that returns a Document object.

Parameters

Name | Required/Optional | Data Type | Description
OldContentControl | Required | ContentControl | The content control being deleted.
InUndoRedo | Required | Boolean | Specifies whether the removal is taking place as part an undo or redo action.

Remarks

For information about using events with the Document object, see Using Events with the Document Object.

See also

Concepts

Document Object

Other resources

Document Object Members


Document.ContentControlBeforeStoreUpdate Event (Word)

 Copy code hover
[image]

Document.ContentControlBeforeStoreUpdate Event (Word)
See also Send feedback

Published: July 16, 2012

Occurs before updating the document's XML data store with the value of a content control.

Syntax

Private Sub expression _ContentControlBeforeStoreUpdate(ContentControl, Content)

expression An expression that returns a Document object.

Parameters

Name | Required/Optional | Data Type | Description
ContentControl | Required | ContentControl | The content control being updated.
Content | Required | String | The content being stored for a control in the document data store. Use this parameter to change the XML data before sending the value to the XML data store.

Remarks

Note Note

This event does not occur for repeating content controls.

For information about using events with the Document object, see Using Events with the Document Object.

See also

Concepts

Document Object

Other resources

Document Object Members


Document.ContentControlOnEnter Event (Word)

 Copy code hover
[image]

Document.ContentControlOnEnter Event (Word)
See also Send feedback

Published: July 16, 2012

Occurs when a user enters a content control.

Syntax

Private Sub expression _ContentControlOnEnter(ContentControl, )

expression An expression that returns a Document object.

Parameters

Name | Required/Optional | Data Type | Description
ContentControl | Required | ContentControl | The content control that the user is entering.

Remarks

Important note Important

This event fires only for the content control that you enter and not for parent content controls. For example, if you have a text box content control nested inside a group content control, and you place the cursor inside the text box content control, this event fires only once for the text box content control; it does not fire for the parent group content control.

For information about using events with the Document object, see Using Events with the Document Object.

See also

Concepts

Document Object

Other resources

Document Object Members


Document.ContentControlOnExit Event (Word)

 Copy code hover
[image]

Document.ContentControlOnExit Event (Word)
See also Send feedback

Published: July 16, 2012

Occurs when a user leaves a content control.

Syntax

Private Sub expression _ContentControlOnExit(ContentControl, Cancel)

expression An expression that returns a Document object.

Parameters

Name | Required/Optional | Data Type | Description
ContentControl | Required | ContentControl | The content control that the user is leaving.
Cancel | Required | Boolean | Specifies whether to cancel the event. True cancels the event and does not allow the user to leave the control.

Remarks

Important note Important

This event fires only for the content control that you exit and not for parent content controls. For example, if you have a text box content control nested inside a group content control, and you move the cursor from inside the text box content control and into another place in the document, this event fires only once for the text box content control; it does not fire for the parent group content control.

For information about using events with the Document object, see Using Events with the Document Object.

See also

Concepts

Document Object

Other resources

Document Object Members


Document.New Event (Word)

 Copy code hover
[image]

Document.New Event (Word)
See also Send feedback

Published: July 16, 2012

Occurs when a new document based on the template is created. A procedure for the New event will run only if it is stored in a template.

Syntax

Private Sub expression _Private Sub Document_New

expression A variable that represents a Document object.

Remarks

For information about using events with the Document object, see Using Events with the Document Object.

Example

This example asks the user whether to save all other open documents when a new document based on the template is created. (This procedure is stored in the ThisDocument class module of a template, not a document.)

VBA Copy code Copy code
Private Sub Document_New()
 Dim intResponse As Integer
 Dim strName As String
 Dim docLoop As Document

 intResponse = MsgBox("Save all other documents?", vbYesNo)

 If intResponse = vbYes Then
 strName = ActiveDocument.Name
 For Each docLoop In Application.Documents
 With docLoop
 If .Name <> strName Then
 .Save
 End If
 End With
 Next docLoop
 End If
End Sub

See also

Concepts

Document Object

Other resources

Document Object Members


Document.Open Event (Word)

 Copy code hover
[image]

Document.Open Event (Word)
See also Send feedback

Published: July 16, 2012

Occurs when a document is opened.

Syntax

Private Sub expression _Private Sub Document_Open

expression A variable that represents a Document object.

Remarks

If the event procedure is stored in a template, the procedure will run when a new document based on that template is opened and when the template itself is opened as a document.

For information about using events with the Document object, see Using Events with the Document Object .

Example

This example displays a message when a document is opened. (The procedure can be stored in the ThisDocument class module of a document or its attached template.)

VBA Copy code Copy code
Private Sub Document_Open()
 MsgBox "This document is copyrighted."
End Sub

See also

Concepts

Document Object

Other resources

Document Object Members


Document.Sync Event (Word)

 Copy code hover
[image]

Document.Sync Event (Word)
See also Send feedback

Published: July 16, 2012

This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.

Syntax

Private Sub expression _Sync(SyncEventType)

expression A variable that represents a Document object that has been declared using the WithEvents keyword in a class module. For information about using events with the Document object, see Using Events with the Document Object.

Parameters

Name | Required/Optional | Data Type | Description
SyncEventType | Required | MsoSyncEventType | The status of the document synchronization.

Example

The following example displays a message if the synchronization of a document in a Document Workspace fails.

VBA Copy code Copy code
Private Sub Document_Sync(ByVal SyncEventType As Office.MsoSyncEventType)

 If SyncEventType = msoSyncEventDownloadFailed Or _
 SyncEventType = msoSyncEventUploadFailed Then

 MsgBox "Document synchronization failed. " & _
 "Please contact your administrator " & vbCrLf & _
 "or try again later."

 End If

End Sub

See also

Concepts

Document Object

Other resources

Document Object Members


Document.XMLAfterInsert Event (Word)

 Copy code hover
[image]

Document.XMLAfterInsert Event (Word)
See also Send feedback

Published: July 16, 2012

Occurs when a user adds a new XML element to a document. If more than one element is added to the document at the same time (for example, when cutting and pasting XML), the event fires for each element that is inserted.

Syntax

Private Sub expression _XMLAfterInsert(NewXMLNode, InUndoRedo)

expression A variable that represents a Document object that has been declared by using the WithEvents keyword in a class module. For information about using events with a Document object, see Using Events with the Document Object.

Parameters

Name | Required/Optional | Data Type | Description
NewXMLNode | Required | XMLNode | The newly added XML node.
InUndoRedo | Required | Boolean | True indicates the action was performed using the Undo or Redo feature in Microsoft Word.

Remarks

If the InUndoRedo parameter is True, never change the XML in a document while the XMLAfterInsert and XMLBeforeDelete events are running.

If the InUndoRedo parameter is False, you can insert and delete the XML in the document, but be careful that the XMLAfterInsert and XMLBeforeDelete events will not try to cancel each other out, causing an infinite loop. You can prevent infinite loops by using a global Boolean variable and check for that at the beginning of the error handler, as shown in the following example.

VBA Copy code Copy code
Dim blnIsXMLInsertRunning As Boolean

Private Sub Document_XMLAfterInsert(ByVal DeletedRange As Range, _
 ByVal OldXMLNode As XMLNode, ByVal InUndoRedo As Boolean)

 If blnIsXMLInsertRunning = False Then
 blnIsXMLInsertRunning = True
 'Insert your event code here.
 Else
 Exit Sub
 End If
End Sub

Example

The following example validates a newly added node and if the node is not valid, displays a message describing the validation error.

VBA Copy code Copy code
Private Sub Document_XMLAfterInsert(ByVal NewXMLNode As XMLNode, _
 ByVal InUndoRedo As Boolean)

 NewXMLNode.Validate

 If NewXMLNode.ValidationStatus <> wdXMLValidationStatusOK Then
 MsgBox NewXMLNode.ValidationErrorText
 End If
End Sub

See also

Concepts

Document Object

Other resources

Document Object Members


Document.XMLBeforeDelete Event (Word)

 Copy code hover
[image]

Document.XMLBeforeDelete Event (Word)
See also Send feedback

Published: July 16, 2012

Occurs when a user deletes an XML element from a document. If more than one element is deleted from the document at the same time (for example, when cutting and pasting XML), the event fires for each element that is deleted.

Syntax

Private Sub expression _XMLBeforeDelete(DeletedRange, OldXMLNode, InUndoRedo)

expression A variable that represents a Document object that has been declared by using the WithEvents keyword in a class module. For information about using events with a Document object, see Using Events with the Document Object.

Parameters

Name | Required/Optional | Data Type | Description
DeletedRange | Required | Range | The contents of the XML element being deleted. If only an element is deleted and not associated text, the DeletedRange parameter will not exist and will, therefore, be set to Nothing.
OldXMLNode | Required | XMLNode | The node that is being deleted.
InUndoRedo | Required | Boolean | True indicates the action was performed using the Undo or Redo feature in Microsoft Word.

Remarks

If the InUndoRedo parameter is True, never change the XML in a document while the XMLAfterInsert and XMLBeforeDelete events are running.

If the InUndoRedo parameter is False, you can insert and delete the XML in the document—but be careful that the XMLAfterInsert and XMLBeforeDelete events will not try to cancel each other out, causing an infinite loop. You can prevent infinite loops by using a global Boolean variable and check for that at the beginning of the error handler, as shown in the following example.

VBA Copy code Copy code
Dim blnIsXMLDeleteRunning As Boolean

Private Sub Document_XMLBeforeDelete(ByVal DeletedRange As Range, _
 ByVal OldXMLNode As XMLNode, ByVal InUndoRedo As Boolean)

 If blnIsXMLDeleteRunning = False Then
 blnIsXMLDeleteRunning = True
 'Insert your event code here.
 Else
 Exit Sub
 End If
End Sub

Example

The following example runs when an XML element is deleted. If the element contains text, a message is displayed asking whether the user wants to delete the text the element contains. If the user reponds by clicking No, the contents of the element are copied to the Clipboard.

VBA Copy code Copy code
Private Sub Document_XMLBeforeDelete(ByVal DeletedRange As Range, _
 ByVal OldXMLNode As XMLNode, ByVal InUndoRedo As Boolean)

 Dim intResponse As Integer

 If InUndoRedo = False Then
 If Not DeletedRange Is Nothing Then
 intResponse = MsgBox("Are you sure you want to delete the text " _
 & vbCrLf & DeletedRange.Text, vbYesNo)

 If intResponse = vbNo Then

 DeletedRange.Copy

 MsgBox "The text has been copied to the Clipboard." & vbCrLf & _
 "Position your cursor where you want to insert it, " & _
 vbCrLf & " and click Paste on the Edit menu."

 End If
 End If
 End If
End Sub

See also

Concepts

Document Object

Other resources

Document Object Members


Documents Object (Word)

 Copy code hover
[image]

Documents Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of all the Document objects that are currently open in Word.

Remarks

Use the Documents property to return the Documents collection. The following example displays the names of the open documents.

VBA Copy code Copy code
For Each aDoc In Documents
 aName = aName & aDoc.Name & vbCr
Next aDoc
MsgBox aName

Use the Add method to create a new empty document and add it to the Documents collection. The following example creates a new document based on the Normal template.

VBA Copy code Copy code
Documents.Add

Use the Open method to open a file. The following example opens the document named "Sales.doc."

VBA Copy code Copy code
Documents.Open FileName:="C:\My Documents\Sales.doc"

Use Documents(Index), where Index is the document name or index number to return a single Document object. The following instruction closes the document named "Report.doc" without saving changes.

VBA Copy code Copy code
Documents("Report.doc").Close SaveChanges:=wdDoNotSaveChanges

The index number represents the position of the document in the Documents collection. The following example activates the first document in the Documents collection.

VBA Copy code Copy code
Documents(1).Activate

The following example enumerates the Documents collection to determine whether the document named "Report.doc" is open. If this document is contained in the Documents collection, the document is activated; otherwise, it is opened.

VBA Copy code Copy code
For Each doc In Documents
 If doc.Name = "Report.doc" Then found = True
Next doc
If found <> True Then
 Documents.Open FileName:="C:\Documents\Report.doc"
Else
 Documents("Report.doc").Activate
End If

See also

Concepts

Word Object Model Reference

Other resources

Documents Object Members


Documents Members (Word)

 Copy code hover
[image]

Documents Members (Word)
Send feedback

Published: July 16, 2012

A collection of all the Document objects that are currently open in Word.

Methods

Name | Description
Add | Returns a Document object that represents a new, empty document added to the collection of open documents.
AddBlogDocument | Returns a Document object that represents a new blog document that Microsoft Word publishes to the account described by the first three parameters.
CanCheckOut | True if Microsoft Word can check out a specified document from a server. Read/write Boolean.
CheckOut | Copies a specified document from a server to a local computer for editing.
Close | Closes the specified documents.
Item | Returns an individual Document object in a collection.
Open | Opens the specified document and adds it to the Documents collection. Returns a Document object.
OpenNoRepairDialog | Opens the specified document and adds it to the Documents collection.
Save | Saves all the documents in the Documents collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of documents in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified Documents object.


Documents Properties (Word)

 Copy code hover
[image]

Documents Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of documents in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified Documents object.


Documents.Application Property (Word)

 Copy code hover
[image]

Documents.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a Documents collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

Documents Collection Object

Other resources

Documents Object Members


Documents.Count Property (Word)

 Copy code hover
[image]

Documents.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of documents in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents a Documents collection.

See also

Concepts

Documents Collection Object

Other resources

Documents Object Members


Documents.Creator Property (Word)

 Copy code hover
[image]

Documents.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a Documents collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Documents Collection Object

Other resources

Documents Object Members


Documents.Parent Property (Word)

 Copy code hover
[image]

Documents.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Documents object.

Syntax

expression .Parent

expression Required. A variable that represents a Documents collection.

See also

Concepts

Documents Collection Object

Other resources

Documents Object Members


Documents Methods (Word)

 Copy code hover
[image]

Documents Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Returns a Document object that represents a new, empty document added to the collection of open documents.
AddBlogDocument | Returns a Document object that represents a new blog document that Microsoft Word publishes to the account described by the first three parameters.
CanCheckOut | True if Microsoft Word can check out a specified document from a server. Read/write Boolean.
CheckOut | Copies a specified document from a server to a local computer for editing.
Close | Closes the specified documents.
Item | Returns an individual Document object in a collection.
Open | Opens the specified document and adds it to the Documents collection. Returns a Document object.
OpenNoRepairDialog | Opens the specified document and adds it to the Documents collection.
Save | Saves all the documents in the Documents collection.


Documents.Add Method (Word)

 Copy code hover
[image]

Documents.Add Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a Document object that represents a new, empty document added to the collection of open documents.

Syntax

expression .Add(Template, NewTemplate, DocumentType, Visible)

expression Required. A variable that represents a Documents collection.

Parameters

Name | Required/Optional | Data Type | Description
Template | Optional | Variant | The name of the template to be used for the new document. If this argument is omitted, the Normal template is used.
NewTemplate | Optional | Variant | True to open the document as a template. The default value is False.
DocumentType | Optional | Variant | Can be one of the following WdNewDocumentType constants: wdNewBlankDocument, wdNewEmailMessage, wdNewFrameset, or wdNewWebPage. The default constant is wdNewBlankDocument.
Visible | Optional | Variant | True to open the document in a visible window. If this value is False, Microsoft Word opens the document but sets the Visible property of the document window to False. The default value is True.

Return Value

Document

Example

This example creates a new document based on the Normal template.

VBA Copy code Copy code
Documents.Add

This example creates a new document based on the Professional Memo template.

VBA Copy code Copy code
Documents.Add Template:="C:\Program Files\Microsoft Office" _
 & "\Templates\Memos\Professional Memo.dot"

This example creates and opens a new template, using the template attached to the active document as a model.

VBA Copy code Copy code
tmpName = ActiveDocument.AttachedTemplate.FullName
Documents.Add Template:=tmpName, NewTemplate:=True

See also

Concepts

Documents Collection Object

Other resources

Documents Object Members


Documents.AddBlogDocument Method (Word)

 Copy code hover
[image]

Documents.AddBlogDocument Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a Document object that represents a new blog document that Microsoft Word publishes to the account described by the first three parameters.

Syntax

expression .AddBlogDocument(ProviderID, PostURL, BlogName, PostID)

expression An expression that returns a Documents object.

Parameters

Name | Required/Optional | Data Type | Description
ProviderID | Required | String | A GUID that is the unique value a provider uses when they register themselves with Word.
PostURL | Required | String | The URL that is used to add posts to the blog.
BlogName | Required | String | A display name for the blog that will be used in Word.
PostID | Optional | String | The ID for an existing post with which to populate the document created by using the AddBlogDocument method.

Remarks

This method creates a new document, and it also registers the specified blog account with Word if it is not already registered. In addition, if the PostID parameter is specified, the new document is populated with the contents of the post specified by the value of the PostID parameter, from the provider's Web site.

See also

Concepts

Documents Collection Object

Other resources

Documents Object Members


Documents.CanCheckOut Method (Word)

 Copy code hover
[image]

Documents.CanCheckOut Method (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word can check out a specified document from a server. Read/write Boolean.

Syntax

expression .CanCheckOut(FileName)

expression Required. A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
FileName | Required | String | The server path and name of the document.

Return Value

Boolean

Remarks

To take advantage of the collaboration features built into Word, documents must be stored on a Microsoft SharePoint Portal Server.

Example

This example verifies that a document is not being edited by another user and that it can be checked out. If the document can be checked out, it copies the document to the local computer for editing.

VBA Copy code Copy code
Sub CheckInOut(docCheckOut As String)
 If Documents.CanCheckOut(docCheckOut) = True Then
 Documents.CheckOut docCheckOut
 Else
 MsgBox "You are unable to check out this document at this time."
 End If
End Sub

To call the CheckInOut subroutine, use the following subroutine and replace the "http://servername/workspace/report.doc" file name with an actual file located on a server mentioned in the Remarks section above.

VBA Copy code Copy code
Sub CheckDocInOut()
 Call CheckInOut (docCheckIn:="http://servername/workspace/report.doc")
End Sub

See also

Concepts

Documents Collection Object

Other resources

Documents Object Members


Documents.CheckOut Method (Word)

 Copy code hover
[image]

Documents.CheckOut Method (Word)
See also Send feedback

Published: July 16, 2012

Copies a specified document from a server to a local computer for editing.

Syntax

expression .CheckOut(FileName)

expression Required. A variable that represents a Document object.

Parameters

Name | Required/Optional | Data Type | Description
FileName | Required | String | The name of the file to check out.

Remarks

To take advantage of the collaboration features built into Word, documents must be stored on a Microsoft SharePoint Portal Server.

Example

This example verifies that a document is not checked out by another user and that it can be checked out. If the document can be checked out, it copies the document to the local computer for editing.

VBA Copy code Copy code
Sub CheckInOut(docCheckOut As String)
 If Documents.CanCheckOut(docCheckOut) = True Then
 Documents.CheckOut docCheckOut
 Else
 MsgBox "You are unable to check out this document at this time."
 End If
End Sub

To call the CheckInOut subroutine above, use the following subroutine and replace the "http://servername/workspace/report.doc" file name with an actual file located on a server mentioned in the Remarks section above.

VBA Copy code Copy code
Sub CheckDocInOut()
 Call CheckInOut (docCheckIn:="http://servername/workspace/report.doc")
End Sub

See also

Concepts

Documents Collection Object

Other resources

Documents Object Members


Documents.Close Method (Word)

 Copy code hover
[image]

Documents.Close Method (Word)
See also Send feedback

Published: July 16, 2012

Closes the specified documents.

Syntax

expression .Close(SaveChanges, OriginalFormat, RouteDocument)

expression Required. A variable that represents a Documents collection.

Parameters

Name | Required/Optional | Data Type | Description
SaveChanges | Optional | Variant | Specifies the save action for the document. Can be one of the following WdSaveOptions constants: wdDoNotSaveChanges, wdPromptToSaveChanges, or wdSaveChanges.
OriginalFormat | Optional | Variant | Specifies the save format for the document. Can be one of the following WdOriginalFormat constants: wdOriginalDocumentFormat, wdPromptUser, or wdWordDocument.
RouteDocument | Optional | Variant | True to route the document to the next recipient. If the document doesn't have a routing slip attached, this argument is ignored.

See also

Concepts

Documents Collection Object

Other resources

Documents Object Members


Documents.Item Method (Word)

 Copy code hover
[image]

Documents.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual Document object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents a Documents collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The individual object to be returned. Can be a Long indicating the ordinal position of the individual object.

Return Value

Document

Example

This example displays the name of the first document in the Documents collection.

VBA Copy code Copy code
Sub DocumentItem()
 If Documents.Count >= 1 Then
 MsgBox Documents.Item(1).Name
 End If
End Sub

See also

Concepts

Documents Collection Object

Other resources

Documents Object Members


Documents.Open Method (Word)

 Copy code hover
[image]

Documents.Open Method (Word)
See also Send feedback

Published: July 16, 2012

Opens the specified document and adds it to the Documents collection. Returns a Document object.

Syntax

expression .Open(FileName, ConfirmConversions, ReadOnly, AddToRecentFiles, PasswordDocument, PasswordTemplate, Revert, WritePasswordDocument, WritePasswordTemplate, Format, Encoding, Visible, OpenConflictDocument, OpenAndRepair, DocumentDirection, NoEncodingDialog)

expression Required. A variable that represents a Documents collection.

Parameters

Name | Required/Optional | Data Type | Description
FileName | Required | Variant | The name of the document (paths are accepted).
ConfirmConversions | Optional | Variant | True to display the Convert File dialog box if the file isn't in Microsoft Word format.
ReadOnly | Optional | Variant | True to open the document as read-only. This argument doesn't override the read-only recommended setting on a saved document. For example, if a document has been saved with read-only recommended turned on, setting the ReadOnly argument to False will not cause the file to be opened as read/write.
AddToRecentFiles | Optional | Variant | True to add the file name to the list of recently used files at the bottom of the File menu.
PasswordDocument | Optional | Variant | The password for opening the document.
PasswordTemplate | Optional | Variant | The password for opening the template.
Revert | Optional | Variant | Controls what happens if FileName is the name of an open document. True to discard any unsaved changes to the open document and reopen the file. False to activate the open document.
WritePasswordDocument | Optional | Variant | The password for saving changes to the document.
WritePasswordTemplate | Optional | Variant | The password for saving changes to the template.
Format | Optional | Variant | The file converter to be used to open the document. Can be one of the WdOpenFormat constants. The default value is wdOpenFormatAuto.
Format | Required | Variant | The file converter to be used to open the document. Can be one of the following WdOpenFormat constants. To specify an external file format, apply the OpenFormat property to a FileConverter object to determine the value to use with this argument.
Encoding | Optional | Variant | The document encoding (code page or character set) to be used by Microsoft Word when you view the saved document. Can be any valid MsoEncoding constant. For the list of valid MsoEncoding constants, see the Object Browser in the Visual Basic Editor. The default value is the system code page.
Visible | Optional | Variant | True if the document is opened in a visible window. The default value is True.
OpenConflictDocument | Optional | Variant | Specifies whether to open the conflict file for a document with an offline conflict.
OpenAndRepair | Optional | Variant | True to repair the document to prevent document corruption.
DocumentDirection | Optional | WdDocumentDirection | Indicates the horizontal flow of text in a document. The default value is wdLeftToRight.
NoEncodingDialog | Optional | Variant | True to skip displaying the Encoding dialog box that Word displays if the text encoding cannot be recognized. The default value is False.

Return Value

Document

Security

Avoid using hard-coded passwords in your applications. If a password is required in a procedure, request the password from the user, store it in a variable, and then use the variable in your code. For recommended best practices on how to do this, see Security Notes for Microsoft Office Solution Developers.

Example

This example opens MyDoc.doc as a read-only document.

VBA Copy code Copy code
Sub OpenDoc()
 Documents.Open FileName:="C:\MyFiles\MyDoc.doc", ReadOnly:=True
End Sub

This example opens Test.wp using the WordPerfect 6.x file converter.

VBA Copy code Copy code
Sub OpenDoc2()
 Dim fmt As Variant
 fmt = Application.FileConverters("WordPerfect6x").OpenFormat
 Documents.Open FileName:="C:\MyFiles\Test.wp", Format:=fmt
End Sub

See also

Concepts

Documents Collection Object

Other resources

Documents Object Members


Documents.OpenNoRepairDialog Method (Word)

 Copy code hover
[image]

Documents.OpenNoRepairDialog Method (Word)
See also Send feedback

Published: July 16, 2012

Opens the specified document and adds it to the Documents collection.

Version Information

Version Added: Word 2007

Syntax

expression .OpenNoRepairDialog(FileName, ConfirmConversions, ReadOnly, AddToRecentFiles, PasswordDocument, PasswordTemplate, Revert, WritePasswordDocument, WritePasswordTemplate, Format, Encoding, Visible, OpenAndRepair, DocumentDirection, NoEncodingDialog, XMLTransform)

expression A variable that represents a Documents object.

Parameters

Name | Required/Optional | Data Type | Description
FileName | Required | Variant | The name of the document (paths are accepted).
ConfirmConversions | Optional | Variant | True to display the Convert File dialog box if the file is not in Microsoft Word format.
ReadOnly | Optional | Variant | True to open the document as read-only. This argument does not override the read-only recommended setting on a saved document. For example, if a document has been saved with read-only recommended turned on, setting the ReadOnly argument to False will not cause the file to be opened as read/write.
AddToRecentFiles | Optional | Variant | True to add the file name to the list of recently used files at the bottom of the File menu.
PasswordDocument | Optional | Variant | The password for opening the document.
PasswordTemplate | Optional | Variant | The password for opening the template.
Revert | Optional | Variant | Controls what happens if FileName is the name of an open document. True to discard any unsaved changes to the open document and reopen the file. False to activate the open document.
WritePasswordDocument | Optional | Variant | The password for saving changes to the document.
WritePasswordTemplate | Optional | Variant | The password for saving changes to the template.
Format | Optional | Variant | The file converter to be used to open the document. Can be one of the WdOpenFormat constants. The default is wdOpenFormatAuto.
Encoding | Optional | Variant | The document encoding (code page or character set) to be used by Word when you view the saved document. Can be any valid MsoEncoding constant. For the list of valid MsoEncoding constants, see the Object Browser in the Visual Basic Editor. The default is the system code page.
Visible | Optional | Variant | True if the document is opened in a visible window. The default is True.
OpenAndRepair | Optional | Variant | True to repair the document to prevent document corruption.
DocumentDirection | Optional | Variant | Indicates the horizontal flow of text in a document. Can be any valid WdDocumentDirection constant. The default is wdLeftToRight.
NoEncodingDialog | Optional | Variant | True to skip displaying the Encoding dialog box that Word displays if the text encoding cannot be recognized. The default is False.
XMLTransform | Optional | Variant | Specifies a transform to use.

Return Value

A Document object that represents the specified document.

Security

Avoid using hard-coded passwords in your applications. If a password is required in a procedure, request the password from the user, store it in a variable, and then use the variable in your code. For recommended best practices on how to do this, see Security Notes for Microsoft Office Solution Developers.

Example

The following example opens MyDoc.doc as a read-only document.

VBA Copy code Copy code
Sub OpenDoc()
 Documents.OpenNoRepairDialog FileName:="C:\MyFiles\MyDoc.doc", ReadOnly:=True
End Sub

The following example opens Test.wp by using the WordPerfect 6.x file converter.

VBA Copy code Copy code
Sub OpenDoc2()
 Dim fmt As Variant
 fmt = Application.FileConverters("WordPerfect6x").OpenFormat
 Documents.OpenNoRepairDialog FileName:="C:\MyFiles\Test.wp", Format:=fmt
End Sub

See also

Concepts

Documents Collection Object

Other resources

Documents Object Members


Documents.Save Method (Word)

 Copy code hover
[image]

Documents.Save Method (Word)
See also Send feedback

Published: July 16, 2012

Saves all the documents in the Documents collection.

Syntax

expression .Save(NoPrompt, OriginalFormat)

expression Required. A variable that represents a Documents collection.

Parameters

Name | Required/Optional | Data Type | Description
NoPrompt | Optional | Variant | True to have Word automatically save all documents. False to have Word prompt the user to save each document that has changed since it was last saved.
OriginalFormat | Optional | Variant | Specifies the way the documents are saved. Can be one of the WdOriginalFormat constants.

Remarks

If a document has not been saved before, the Save As dialog box prompts the user for a file name.

See also

Concepts

Documents Collection Object

Other resources

Documents Object Members


DownBars Object (Word)

 Copy code hover
[image]

DownBars Object (Word)
See also Send feedback

Published: July 16, 2012

Represents the down bars in a chart group.

Version Information

Version Added: Word 2007

Remarks

Down bars connect points on the first series in the chart group with lower values on the last series (the lines go down from the first series). Only 2-D line groups that contain at least two series can have down bars. This object is not a collection. There is no object that represents a single down bar; you either enable up bars and down bars for all points in a chart group or you disable them.

If the HasUpDownBars property is False, most properties of the DownBars object are disabled.

Example

Use the DownBars property to return the DownBars object. The following example enables up and down bars for chart group one of the first chart in the active document. The example then sets the up bar color to blue and the down bar color to red.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.ChartGroups(1)
 .HasUpDownBars = True
 .UpBars.Interior.Color = RGB(0, 0, 255)
 .DownBars.Interior.Color = RGB(255, 0, 0)
 End With
 End If
End With

See also

Concepts

Word Object Model Reference

Other resources

DownBars Object Members


DownBars Members (Word)

 Copy code hover
[image]

DownBars Members (Word)
Send feedback

Published: July 16, 2012

Represents the down bars in a chart group.

Methods

Name | Description
Delete | Deletes the object.
Select | Selects the object.

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Format | Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.
Name | Returns the name of the object. Read-only String.
Parent | Returns the parent for the specified object. Read-only Object.


DownBars Properties (Word)

 Copy code hover
[image]

DownBars Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Format | Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.
Name | Returns the name of the object. Read-only String.
Parent | Returns the parent for the specified object. Read-only Object.


DownBars.Application Property (Word)

 Copy code hover
[image]

DownBars.Application Property (Word)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Application

expression A variable that represents a DownBars object.

Example

The following example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveDocument
If myObject.Application.Value = "Microsoft Word" Then
 MsgBox "This is a Word Application object."
Else
 MsgBox "This is not a Word Application object."
End If

See also

Concepts

DownBars Object

Other resources

DownBars Object Members


DownBars.Creator Property (Word)

 Copy code hover
[image]

DownBars.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version Information

Version Added: Word 2007

Syntax

expression .Creator

expression A variable that represents a DownBars object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD". This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Word has the creator code MSWD. For more information about this property, consult the language reference Help included with Microsoft Office for Mac.

See also

Concepts

DownBars Object

Other resources

DownBars Object Members


DownBars.Format Property (Word)

 Copy code hover
[image]

DownBars.Format Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.

Version Information

Version Added: Word 2007

Syntax

expression .Format

expression A variable that represents a DownBars object.

See also

Concepts

DownBars Object

Other resources

DownBars Object Members


DownBars.Name Property (Word)

 Copy code hover
[image]

DownBars.Name Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the name of the object. Read-only String.

Version Information

Version Added: Word 2007

Syntax

expression .Name

expression A variable that represents a DownBars object.

See also

Concepts

DownBars Object

Other resources

DownBars Object Members


DownBars.Parent Property (Word)

 Copy code hover
[image]

DownBars.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the parent for the specified object. Read-only Object.

Version Information

Version Added: Word 2007

Syntax

expression .Parent

expression A variable that represents a DownBars object.

See also

Concepts

DownBars Object

Other resources

DownBars Object Members


DownBars Methods (Word)

 Copy code hover
[image]

DownBars Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the object.
Select | Selects the object.


DownBars.Delete Method (Word)

 Copy code hover
[image]

DownBars.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Version Information

Version Added: Word 2007

Syntax

expression .Delete

expression A variable that represents a DownBars object.

See also

Concepts

DownBars Object

Other resources

DownBars Object Members


DownBars.Select Method (Word)

 Copy code hover
[image]

DownBars.Select Method (Word)
See also Send feedback

Published: July 16, 2012

Selects the object.

Version Information

Version Added: Word 2007

Syntax

expression .Select

expression A variable that represents a DownBars object.

See also

Concepts

DownBars Object

Other resources

DownBars Object Members


DropCap Object (Word)

 Copy code hover
[image]

DropCap Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a dropped capital letter at the beginning of a paragraph. There is no DropCaps collection; each Paragraph object contains only one DropCap object.

Remarks

Use the DropCap property to return a DropCap object. The following example sets a dropped capital letter for the first letter in the first paragraph in the active document.

VBA Copy code Copy code
With ActiveDocument.Paragraphs(1).DropCap
 .Enable
 .Position = wdDropNormal
End With

See also

Concepts

Word Object Model Reference

Other resources

DropCap Object Members


DropCap Members (Word)

 Copy code hover
[image]

DropCap Members (Word)
Send feedback

Published: July 16, 2012

Represents a dropped capital letter at the beginning of a paragraph. There is no DropCaps collection; each Paragraph object contains only one DropCap object.

Methods

Name | Description
Clear | Removes the dropped capital letter formatting.
Enable | Formats the first character in the specified paragraph as a dropped capital letter.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
DistanceFromText | Returns or sets a Single that represents the distance (in points) between the dropped capital letter and the paragraph text. Read/write.
FontName | Returns or sets a String that represents the name of the font for the dropped capital letter. Read/write.
LinesToDrop | Returns or sets the height (in lines) of the specified dropped capital letter. Read/write Long.
Parent | Returns an Object that represents the parent object of the specified DropCap object.
Position | Returns or sets the position of a dropped capital letter. Read/write WdDropPosition.


DropCap Properties (Word)

 Copy code hover
[image]

DropCap Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
DistanceFromText | Returns or sets a Single that represents the distance (in points) between the dropped capital letter and the paragraph text. Read/write.
FontName | Returns or sets a String that represents the name of the font for the dropped capital letter. Read/write.
LinesToDrop | Returns or sets the height (in lines) of the specified dropped capital letter. Read/write Long.
Parent | Returns an Object that represents the parent object of the specified DropCap object.
Position | Returns or sets the position of a dropped capital letter. Read/write WdDropPosition.


DropCap.Application Property (Word)

 Copy code hover
[image]

DropCap.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a DropCap object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

DropCap Object

Other resources

DropCap Object Members


DropCap.Creator Property (Word)

 Copy code hover
[image]

DropCap.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a DropCap object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

DropCap Object

Other resources

DropCap Object Members


DropCap.DistanceFromText Property (Word)

 Copy code hover
[image]

DropCap.DistanceFromText Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Single that represents the distance (in points) between the dropped capital letter and the paragraph text. Read/write.

Syntax

expression .DistanceFromText

expression A variable that represents a DropCap object.

Example

This example sets a dropped capital letter for the first paragraph in the active document. The offset for the dropped capital letter is then set to 12 points.

VBA Copy code Copy code
With ActiveDocument.Paragraphs(1).DropCap
 .Enable
 .FontName= "Arial"
 .Position = wdDropNormal
 .DistanceFromText = 12
End With

See also

Concepts

DropCap Object

Other resources

DropCap Object Members


DropCap.FontName Property (Word)

 Copy code hover
[image]

DropCap.FontName Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a String that represents the name of the font for the dropped capital letter. Read/write.

Syntax

expression .FontName

expression A variable that represents a DropCap object.

Example

This example sets Arial as the font for the dropped capital letter for the first paragraph in the active document.

VBA Copy code Copy code
With ActiveDocument.Paragraphs(1).DropCap
 .FontName = "Arial"
 .Position = wdDropNormal
 .LinesToDrop = 3
 .DistanceFromText = InchesToPoints(0.1)
End With

See also

Concepts

DropCap Object

Other resources

DropCap Object Members


DropCap.LinesToDrop Property (Word)

 Copy code hover
[image]

DropCap.LinesToDrop Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the height (in lines) of the specified dropped capital letter. Read/write Long.

Syntax

expression .LinesToDrop

expression An expression that returns a DropCap object.

Example

This example formats the first character in the active document as a dropped capital letter with a height of three lines.

VBA Copy code Copy code
With ActiveDocument.Paragraphs(1).DropCap
 .Enable
 .Position = wdDropNormal
 .LinesToDrop = 3
End With

See also

Concepts

DropCap Object

Other resources

DropCap Object Members


DropCap.Parent Property (Word)

 Copy code hover
[image]

DropCap.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified DropCap object.

Syntax

expression .Parent

expression Required. A variable that represents a DropCap object.

See also

Concepts

DropCap Object

Other resources

DropCap Object Members


DropCap.Position Property (Word)

 Copy code hover
[image]

DropCap.Position Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the position of a dropped capital letter. Read/write WdDropPosition.

Syntax

expression .Position

expression Required. A variable that represents a DropCap object.

Example

This example sets the first paragraph in the active document to begin with a dropped capital letter. The position of the DropCap object is set to wdDropNormal.

VBA Copy code Copy code
With ActiveDocument.Paragraphs(1).DropCap
 .Enable
 .FontName= "Arial"
 .Position = wdDropNormal
End With

See also

Concepts

DropCap Object

Other resources

DropCap Object Members


DropCap Methods (Word)

 Copy code hover
[image]

DropCap Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Clear | Removes the dropped capital letter formatting.
Enable | Formats the first character in the specified paragraph as a dropped capital letter.


DropCap.Clear Method (Word)

 Copy code hover
[image]

DropCap.Clear Method (Word)
See also Send feedback

Published: July 16, 2012

Removes the dropped capital letter formatting.

Syntax

expression .Clear

expression A variable that represents a DropCap object.

Example

This example removes dropped capital letter formatting from the first letter in the active document.

VBA Copy code Copy code
Set drop = ActiveDocument.Paragraphs(1).DropCap
If Not (drop Is Nothing) Then drop.Clear

See also

Concepts

DropCap Object

Other resources

DropCap Object Members


DropCap.Enable Method (Word)

 Copy code hover
[image]

DropCap.Enable Method (Word)
See also Send feedback

Published: July 16, 2012

Formats the first character in the specified paragraph as a dropped capital letter.

Syntax

expression .Enable

expression Required. A variable that represents a DropCap object.

Example

This example formats the first paragraph in the selection to begin with a dropped capital letter.

VBA Copy code Copy code
With Selection.Paragraphs(1).DropCap
 .Enable
 .LinesToDrop = 2
 .FontName = "Arial"
End With

See also

Concepts

DropCap Object

Other resources

DropCap Object Members


DropDown Object (Word)

 Copy code hover
[image]

DropDown Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a drop-down form field that contains a list of items in a form.

Remarks

Use FormFields(index), where index is the index number or the bookmark name associated with the drop-down form field, to return a single FormField object. Use the DropDown property with the FormField object to return a DropDown object. The following example selects the first item in the drop-down form field named "DropDown" in the active document.

VBA Copy code Copy code
ActiveDocument.FormFields("DropDown1").DropDown.Value = 1

The index number represents the position of the form field in the FormFields collection. The following example checks the type of the first form field in the active document. If it is a drop-down form field, the second item is selected.

VBA Copy code Copy code
If ActiveDocument.FormFields(1).Type = wdFieldFormDropDown Then
 ActiveDocument.FormFields(1).DropDown.Value = 2
End If

The following example determines whether form field represented by ffield is a valid drop-down form field before adding an item to it.

VBA Copy code Copy code
Set ffield = ActiveDocument.FormFields(1).DropDown
If ffield.Valid = True Then
 ffield.ListEntries.Add Name:="Hello"
Else
 MsgBox "First field is not a drop down"
End If

Use the Add method with the FormFields collection to add a drop-down form field. The following example adds a drop-down form field at the beginning of the active document and then adds items to the form field.

VBA Copy code Copy code
Set ffield = ActiveDocument.FormFields.Add( _
 Range:=ActiveDocument.Range(Start:=0, End:=0), _
 Type:=wdFieldFormDropDown)
With ffield
 .Name = "Colors"
 With .DropDown.ListEntries
 .Add Name:="Blue"
 .Add Name:="Green"
 .Add Name:="Red"
 End With
End With

See also

Concepts

Word Object Model Reference

Other resources

DropDown Object Members


DropDown Members (Word)

 Copy code hover
[image]

DropDown Members (Word)
Send feedback

Published: July 16, 2012

Represents a drop-down form field that contains a list of items in a form.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Default | Returns or sets a Long that represents the default drop-down item. Read/write.
ListEntries | Returns a ListEntries collection that represents all the items in a DropDown object.
Parent | Returns an Object that represents the parent object of the specified DropDown object.
Valid | True if the specified form field object is a valid drop down form field. Read-only Boolean.
Value | Returns or sets the number of the selected item in a drop-down form field. Read/write Long.


DropDown Properties (Word)

 Copy code hover
[image]

DropDown Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Default | Returns or sets a Long that represents the default drop-down item. Read/write.
ListEntries | Returns a ListEntries collection that represents all the items in a DropDown object.
Parent | Returns an Object that represents the parent object of the specified DropDown object.
Valid | True if the specified form field object is a valid drop down form field. Read-only Boolean.
Value | Returns or sets the number of the selected item in a drop-down form field. Read/write Long.


DropDown.Application Property (Word)

 Copy code hover
[image]

DropDown.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a DropDown object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

DropDown Object

Other resources

DropDown Object Members


DropDown.Creator Property (Word)

 Copy code hover
[image]

DropDown.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a DropDown object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

DropDown Object

Other resources

DropDown Object Members


DropDown.Default Property (Word)

 Copy code hover
[image]

DropDown.Default Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Long that represents the default drop-down item. Read/write.

Syntax

expression .Default

expression Required. A variable that represents a DropDown object.

Remarks

The first item in a drop-down form field is 1, the second item is 2, and so on.

Example

This example sets the default item for the drop-down form field named "Colors" in Sales.doc.

VBA Copy code Copy code
Documents("Sales.doc").FormFields("Colors").DropDown _
 .Default = 2

See also

Concepts

DropDown Object

Other resources

DropDown Object Members


DropDown.ListEntries Property (Word)

 Copy code hover
[image]

DropDown.ListEntries Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a ListEntries collection that represents all the items in a DropDown object.

Syntax

expression .ListEntries

expression An expression that returns a DropDown object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example retrieves the text of the active item from the drop-down form field named "DropDown1."

VBA Copy code Copy code
Set myField = ActiveDocument.FormFields("DropDown1").DropDown
num = myField.Value
myName = myField.ListEntries(num).Name

This example retrieves the total number of items in the active drop-down form field (the document should be protected for forms). If there are two or more items, this example sets the second item as the active item.

VBA Copy code Copy code
Set myField = Selection.FormFields(1)
If myfield.Type = wdFieldFormDropDown Then
 num = myField.DropDown.ListEntries.Count
 If num >= 2 Then myField.DropDown.Value = 2
End If

See also

Concepts

DropDown Object

Other resources

DropDown Object Members


DropDown.Parent Property (Word)

 Copy code hover
[image]

DropDown.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified DropDown object.

Syntax

expression .Parent

expression Required. A variable that represents a DropDown object.

See also

Concepts

DropDown Object

Other resources

DropDown Object Members


DropDown.Valid Property (Word)

 Copy code hover
[image]

DropDown.Valid Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified form field object is a valid drop down form field. Read-only Boolean.

Syntax

expression .Valid

expression Required. An expression that returns a DropDown object.

Remarks

Use the Type property of the FormField object to determine the type of form field (wdFieldFormDropDown) before applying the DropDown property. This precaution ensures that the FormField object is of the expected type.

See also

Concepts

DropDown Object

Other resources

DropDown Object Members


DropDown.Value Property (Word)

 Copy code hover
[image]

DropDown.Value Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the number of the selected item in a drop-down form field. Read/write Long.

Syntax

expression .Value

expression Required. A variable that represents a DropDown object.

See also

Concepts

DropDown Object

Other resources

DropDown Object Members


DropLines Object (Word)

 Copy code hover
[image]

DropLines Object (Word)
See also Send feedback

Published: July 16, 2012

Represents the drop lines in a chart group.

Version Information

Version Added: Word 2007

Remarks

Drop lines connect the points in the chart with the x-axis. Only line and area chart groups can have drop lines. This object is not a collection. There is no object that represents a single drop line; you either enable drop lines for all points in a chart group or you disable them.

If the HasDropLines property is False, most properties of the DropLines object are disabled.

Example

Use the DropLines property to return the DropLines object. The following example enables drop lines for chart group one of the first chart in the active document and then sets the drop line color to red.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.ChartGroups(1)
 .HasDropLines = True
 .DropLines.Border.ColorIndex = 3
 End With
 End If
End With

See also

Concepts

Word Object Model Reference

Other resources

DropLines Object Members


DropLines Members (Word)

 Copy code hover
[image]

DropLines Members (Word)
Send feedback

Published: July 16, 2012

Represents the drop lines in a chart group.

Methods

Name | Description
Delete | Deletes the object.
Select | Selects the object.

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
Border | Returns the border of the object. Read-only ChartBorder.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Format | Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.
Name | Returns the name of the object. Read-only String.
Parent | Returns the parent for the specified object. Read-only Object.


DropLines Properties (Word)

 Copy code hover
[image]

DropLines Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
Border | Returns the border of the object. Read-only ChartBorder.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Format | Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.
Name | Returns the name of the object. Read-only String.
Parent | Returns the parent for the specified object. Read-only Object.


DropLines.Application Property (Word)

 Copy code hover
[image]

DropLines.Application Property (Word)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Application

expression A variable that represents a DropLines object.

Example

The following example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveDocument
If myObject.Application.Value = "Microsoft Word" Then
 MsgBox "This is a Word Application object."
Else
 MsgBox "This is not a Word Application object."
End If

See also

Concepts

DropLines Object

Other resources

DropLines Object Members


DropLines.Border Property (Word)

 Copy code hover
[image]

DropLines.Border Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the border of the object. Read-only ChartBorder.

Version Information

Version Added: Word 2007

Syntax

expression .Border

expression A variable that represents a DropLines object.

See also

Concepts

DropLines Object

Other resources

DropLines Object Members


DropLines.Creator Property (Word)

 Copy code hover
[image]

DropLines.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version Information

Version Added: Word 2007

Syntax

expression .Creator

expression A variable that represents a DropLines object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD". This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Word has the creator code MSWD. For more information about this property, consult the language reference Help included with Microsoft Office for Mac.

See also

Concepts

DropLines Object

Other resources

DropLines Object Members


DropLines.Format Property (Word)

 Copy code hover
[image]

DropLines.Format Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.

Version Information

Version Added: Word 2007

Syntax

expression .Format

expression A variable that represents a DropLines object.

See also

Concepts

DropLines Object

Other resources

DropLines Object Members


DropLines.Name Property (Word)

 Copy code hover
[image]

DropLines.Name Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the name of the object. Read-only String.

Version Information

Version Added: Word 2007

Syntax

expression .Name

expression A variable that represents a DropLines object.

See also

Concepts

DropLines Object

Other resources

DropLines Object Members


DropLines.Parent Property (Word)

 Copy code hover
[image]

DropLines.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the parent for the specified object. Read-only Object.

Version Information

Version Added: Word 2007

Syntax

expression .Parent

expression A variable that represents a DropLines object.

See also

Concepts

DropLines Object

Other resources

DropLines Object Members


DropLines Methods (Word)

 Copy code hover
[image]

DropLines Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the object.
Select | Selects the object.


DropLines.Delete Method (Word)

 Copy code hover
[image]

DropLines.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Version Information

Version Added: Word 2007

Syntax

expression .Delete

expression A variable that represents a DropLines object.

See also

Concepts

DropLines Object

Other resources

DropLines Object Members


DropLines.Select Method (Word)

 Copy code hover
[image]

DropLines.Select Method (Word)
See also Send feedback

Published: July 16, 2012

Selects the object.

Version Information

Version Added: Word 2007

Syntax

expression .Select

expression A variable that represents a DropLines object.

See also

Concepts

DropLines Object

Other resources

DropLines Object Members


Editor Object (Word)

 Copy code hover
[image]

Editor Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a single user who has been given specific permissions to edit portions of a document.

Remarks

Users who can be given permissions include individual contributors and groups of users as defined for Document Workspace sites.

The permissions you assign to ranges and selections go into effect only after a document is protected. Use the Editors collection and the Editor object to assign specific permissions to sections of a document. Then use the Protect method to protect the document.

Use the Add method of the Editors collection to give a specified user or group permission to modify a range or selection within a document. The following example gives the current user editing permission to modify the active selection.

VBA Copy code Copy code
Dim objEditor As Editor

Set objEditor = Selection.Editors.Add(wdEditorCurrent)

See also

Concepts

Word Object Model Reference

Other resources

Editor Object Members


Editor Members (Word)

 Copy code hover
[image]

Editor Members (Word)
Send feedback

Published: July 16, 2012

Represents a single user who has been given specific permissions to edit portions of a document.

Methods

Name | Description
Delete | Deletes the specified Editor object.
DeleteAll | Deletes all editing permissions in a document for a specific user.
SelectAll | Selects all the shapes in a document that were inserted or edited by a single user.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
ID | Returns or sets the identifying label for the specified object when the parent document is saved as a Web page. Read-only String.
Name | Returns or sets the name of the specified object. Read-only String.
NextRange | Returns a Range object that represents the next range for which a user has permissions to modify.
Parent | Returns an Object that represents the parent object of the specified Editor object.
Range | Returns a Range object that represents the portion of a document that is contained in the specified object.


Editor Properties (Word)

 Copy code hover
[image]

Editor Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
ID | Returns or sets the identifying label for the specified object when the parent document is saved as a Web page. Read-only String.
Name | Returns or sets the name of the specified object. Read-only String.
NextRange | Returns a Range object that represents the next range for which a user has permissions to modify.
Parent | Returns an Object that represents the parent object of the specified Editor object.
Range | Returns a Range object that represents the portion of a document that is contained in the specified object.


Editor.Application Property (Word)

 Copy code hover
[image]

Editor.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents an Editor object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

Editor Object

Other resources

Editor Object Members


Editor.Creator Property (Word)

 Copy code hover
[image]

Editor.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents an Editor object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Editor Object

Other resources

Editor Object Members


Editor.ID Property (Word)

 Copy code hover
[image]

Editor.ID Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the identifying label for the specified object when the parent document is saved as a Web page. Read-only String.

Syntax

expression .ID

expression Required. A variable that represents an Editor object.

See also

Concepts

Editor Object

Other resources

Editor Object Members


Editor.Name Property (Word)

 Copy code hover
[image]

Editor.Name Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the name of the specified object. Read-only String.

Syntax

expression .Name

expression An expression that represents a Editor object.

See also

Concepts

Editor Object

Other resources

Editor Object Members


Editor.NextRange Property (Word)

 Copy code hover
[image]

Editor.NextRange Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the next range for which a user has permissions to modify.

Syntax

expression .NextRange

expression An expression that returns an Editor object.

Remarks

You can also use the GoToEditableRange method of the Range object to return the next range for which a user has permission to modify.

Example

The following example returns the next range for the first editor in the active selection.

VBA Copy code Copy code
Dim objEditor As Editor
Dim objRange As Range

Set objEditor = Selection.Editors(1)
Set objRange = objEditor.NextRange

See also

Concepts

Editor Object

Other resources

Editor Object Members


Editor.Parent Property (Word)

 Copy code hover
[image]

Editor.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Editor object.

Syntax

expression .Parent

expression Required. A variable that represents an Editor object.

See also

Concepts

Editor Object

Other resources

Editor Object Members


Editor.Range Property (Word)

 Copy code hover
[image]

Editor.Range Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the portion of a document that is contained in the specified object.

Syntax

expression .Range

expression Required. A variable that represents an Editor object.

Remarks

For information about returning a range from a document or returning a shape range from a collection of shapes, see the Range method.

Example

This example applies the Heading 1 style to the first paragraph in the active document.

VBA Copy code Copy code
ActiveDocument.Paragraphs(1).Range.Style = wdStyleHeading1

This example copies the first row in table one.

VBA Copy code Copy code
If ActiveDocument.Tables.Count >= 1 Then _
 ActiveDocument.Tables(1).Rows(1).Range.Copy

This example changes the text of the first comment in the document.

VBA Copy code Copy code
With ActiveDocument.Comments(1).Range
 .Delete
 .InsertBefore "new comment text"
End With

This example inserts text at the end of section one.

VBA Copy code Copy code
Set myRange = ActiveDocument.Sections(1).Range
With myRange
 .MoveEnd Unit:=wdCharacter, Count:=-1
 .Collapse Direction:=wdCollapseEnd
 .InsertParagraphAfter
 .InsertAfter "End of section"
End With

See also

Concepts

Editor Object

Other resources

Editor Object Members


Editor Methods (Word)

 Copy code hover
[image]

Editor Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the specified Editor object.
DeleteAll | Deletes all editing permissions in a document for a specific user.
SelectAll | Selects all the shapes in a document that were inserted or edited by a single user.


Editor.Delete Method (Word)

 Copy code hover
[image]

Editor.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the specified Editor object.

Syntax

expression .Delete

expression Required. A variable that represents an Editor object.

See also

Concepts

Editor Object

Other resources

Editor Object Members


Editor.DeleteAll Method (Word)

 Copy code hover
[image]

Editor.DeleteAll Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes all editing permissions in a document for a specific user.

Syntax

expression .DeleteAll

expression Required. A variable that represents an Editor object.

Example

The following example deletes all editing permissions for the first user in the Editors collection in the active document.

VBA Copy code Copy code
Dim objEditor As Editor

Set objEditor = Selection.Editors(1)

objEditor.DeleteAll

See also

Concepts

Editor Object

Other resources

Editor Object Members


Editor.SelectAll Method (Word)

 Copy code hover
[image]

Editor.SelectAll Method (Word)
See also Send feedback

Published: July 16, 2012

Selects all the shapes in a document that were inserted or edited by a single user.

Syntax

expression .SelectAll

expression Required. A variable that represents an Editor object.

Remarks

This method doesn't select InlineShape objects.

See also

Concepts

Editor Object

Other resources

Editor Object Members


Editors Object (Word)

 Copy code hover
[image]

Editors Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of Editor objects that represents a collection of users or groups of users who have been given specific permissions to edit portions of a document.

Remarks

Use the Add method to give a specified user or group permission to modify a range or selection within a document. The following example gives the current user editing permission to modify the active selection.

VBA Copy code Copy code
Dim objEditor As Editor

Set objEditor = Selection.Editors.Add(wdEditorCurrent)

See also

Concepts

Word Object Model Reference

Other resources

Editors Object Members


Editors Members (Word)

 Copy code hover
[image]

Editors Members (Word)
Send feedback

Published: July 16, 2012

A collection of Editor objects that represents a collection of users or groups of users who have been given specific permissions to edit portions of a document.

Methods

Name | Description
Add | Returns an Editor object that represents a new permission for a specified user to modify a range or selection within a document. .
Item | Returns an Editor object that represents a specific user or a group of users who have been given permission to edit a portion of a document.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a the Long that represents the number of Editor objects in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified Editors object.


Editors Properties (Word)

 Copy code hover
[image]

Editors Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a the Long that represents the number of Editor objects in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified Editors object.


Editors.Application Property (Word)

 Copy code hover
[image]

Editors.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents an Editors collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

Editors Collection

Other resources

Editors Object Members


Editors.Count Property (Word)

 Copy code hover
[image]

Editors.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a the Long that represents the number of Editor objects in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents an Editors collection.

See also

Concepts

Editors Collection

Other resources

Editors Object Members


Editors.Creator Property (Word)

 Copy code hover
[image]

Editors.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents an Editors collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Editors Collection

Other resources

Editors Object Members


Editors.Parent Property (Word)

 Copy code hover
[image]

Editors.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Editors object.

Syntax

expression .Parent

expression Required. A variable that represents an Editors collection.

See also

Concepts

Editors Collection

Other resources

Editors Object Members


Editors Methods (Word)

 Copy code hover
[image]

Editors Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Returns an Editor object that represents a new permission for a specified user to modify a range or selection within a document. .
Item | Returns an Editor object that represents a specific user or a group of users who have been given permission to edit a portion of a document.


Editors.Add Method (Word)

 Copy code hover
[image]

Editors.Add Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an Editor object that represents a new permission for a specified user to modify a range or selection within a document. .

Syntax

expression .Add(EditorID)

expression Required. A variable that represents an Editors collection.

Parameters

Name | Required/Optional | Data Type | Description
EditorID | Optional | Variant | Can be either a String that represents the user's e-mail alias (if in the same domain), an e-mail address, or a WdEditorType that represents a group of users.

Example

The following example gives editing permissions for the selected text to the current user.

VBA Copy code Copy code
Dim objEditor As Editor

Set objEditor = Selection.Editors.Add(wdEditorCurrent)

See also

Concepts

Editors Collection

Other resources

Editors Object Members


Editors.Item Method (Word)

 Copy code hover
[image]

Editors.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an Editor object that represents a specific user or a group of users who have been given permission to edit a portion of a document.

Syntax

expression .Item(Index)

expression Required. A variable that represents an Editors collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | Can be either a String that represents the user's e-mail alias (if in the same domain), an e-mail address, or a WdEditorType constant that represents a group of users.

Return Value

Editor

See also

Concepts

Editors Collection

Other resources

Editors Object Members


Email Object (Word)

 Copy code hover
[image]

Email Object (Word)
See also Send feedback

Published: July 16, 2012

Represents an e-mail message.

Remarks

Use the Email property to return the Email object. The Email object and its properties are valid only if the active document is an unsent forward, reply, or new e-mail message.

This example displays the name of the style associated with the current e-mail author.

VBA Copy code Copy code
MsgBox ActiveDocument.Email _
 .CurrentEmailAuthor.Style.NameLocal

The author style name is the same as the value returned by the UserName property.

Note Note

There is no Emails collection; each Document object contains only one Email object.

See also

Concepts

Word Object Model Reference

Other resources

Email Object Members


Email Members (Word)

 Copy code hover
[image]

Email Members (Word)
Send feedback

Published: July 16, 2012

Represents an e-mail message.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
CurrentEmailAuthor | Returns an EmailAuthor object that represents the author of the current e-mail message. Read-only.
Parent | Returns an Object that represents the parent object of the specified Email object.


Email Properties (Word)

 Copy code hover
[image]

Email Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
CurrentEmailAuthor | Returns an EmailAuthor object that represents the author of the current e-mail message. Read-only.
Parent | Returns an Object that represents the parent object of the specified Email object.


Email.Application Property (Word)

 Copy code hover
[image]

Email.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents an Email object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

Email Object

Other resources

Email Object Members


Email.Creator Property (Word)

 Copy code hover
[image]

Email.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents an Email object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Email Object

Other resources

Email Object Members


Email.CurrentEmailAuthor Property (Word)

 Copy code hover
[image]

Email.CurrentEmailAuthor Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an EmailAuthor object that represents the author of the current e-mail message. Read-only.

Syntax

expression .CurrentEmailAuthor

expression A variable that represents a Email object.

Example

This example returns the name of the style associated with the current e-mail author.

VBA Copy code Copy code
MsgBox ActiveDocument.Email _
 .CurrentEmailAuthor.Style.NameLocal

See also

Concepts

Email Object

Other resources

Email Object Members


Email.Parent Property (Word)

 Copy code hover
[image]

Email.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Email object.

Syntax

expression .Parent

expression Required. A variable that represents an Email object.

See also

Concepts

Email Object

Other resources

Email Object Members


EmailAuthor Object (Word)

 Copy code hover
[image]

EmailAuthor Object (Word)
See also Send feedback

Published: July 16, 2012

Represents the author of an e-mail message.

Remarks

Use the CurrentEmailAuthor property to return the EmailAuthor object. The EmailAuthor object and its properties are valid only if the active document is an unsent forward, reply, or new e-mail message.

This example returns the style associated with the current author for unsent replies, forwards, or new e-mail messages, and displays the name of the font associated with this style.

VBA Copy code Copy code
Set MyEmailStyle = _
 ActiveDocument.Email.CurrentEmailAuthor.Style
Msgbox MyEmailStyle.Font.Name
Note Note

There is no EmailAuthors collection; each Email object contains only one EmailAuthor object.

See also

Concepts

Word Object Model Reference

Other resources

EmailAuthor Object Members


EmailAuthor Members (Word)

 Copy code hover
[image]

EmailAuthor Members (Word)
Send feedback

Published: July 16, 2012

Represents the author of an e-mail message.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified EmailAuthor object.
Style | Returns a Style object that represents the style associated with the current e-mail author for unsent replies, forwards, or new e-mail messages.


EmailAuthor Properties (Word)

 Copy code hover
[image]

EmailAuthor Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified EmailAuthor object.
Style | Returns a Style object that represents the style associated with the current e-mail author for unsent replies, forwards, or new e-mail messages.


EmailAuthor.Application Property (Word)

 Copy code hover
[image]

EmailAuthor.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents an EmailAuthor object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

EmailAuthor Object

Other resources

EmailAuthor Object Members


EmailAuthor.Creator Property (Word)

 Copy code hover
[image]

EmailAuthor.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents an EmailAuthor object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

EmailAuthor Object

Other resources

EmailAuthor Object Members


EmailAuthor.Parent Property (Word)

 Copy code hover
[image]

EmailAuthor.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified EmailAuthor object.

Syntax

expression .Parent

expression Required. A variable that represents an EmailAuthor object.

See also

Concepts

EmailAuthor Object

Other resources

EmailAuthor Object Members


EmailAuthor.Style Property (Word)

 Copy code hover
[image]

EmailAuthor.Style Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Style object that represents the style associated with the current e-mail author for unsent replies, forwards, or new e-mail messages.

Syntax

expression .Style

expression Required. A variable that represents an EmailAuthor object.

Example

This example returns the style associated with the current author for unsent replies, forwards, or new e-mail messages and displays the name of the font associated with this style.

VBA Copy code Copy code
Set MyEmailStyle = _
 ActiveDocument.Email.CurrentEmailAuthor.Style
Msgbox MyEmailStyle.Font.Name

See also

Concepts

EmailAuthor Object

Other resources

EmailAuthor Object Members


EmailOptions Object (Word)

 Copy code hover
[image]

EmailOptions Object (Word)
See also Send feedback

Published: July 16, 2012

Contains global application-level attributes used by Microsoft Word when you create and edit e-mail messages and replies.

Remarks

Use the EmailOptions property to return the EmailOptions object.

This example changes the font color of the default style used to compose new e-mail messages.

VBA Copy code Copy code
Application.EmailOptions.ComposeStyle.Font.Color = _
 wdColorBrightGreen

This example sets Word to mark comments in e-mail messages with the initials "WK."

VBA Copy code Copy code
Application.EmailOptions.MarkCommentsWith = "WK"
Application.EmailOptions.MarkComments = True

This example changes the signatures Word appends to new outgoing e-mail messages and e-mail message replies.

VBA Copy code Copy code
With Application.EmailOptions.EmailSignature
 .NewMessageSignature = "Signature1"
 .ReplyMessageSignature = "Reply2"
End With

See also

Concepts

Word Object Model Reference

Other resources

EmailOptions Object Members


EmailOptions Members (Word)

 Copy code hover
[image]

EmailOptions Members (Word)
Send feedback

Published: July 16, 2012

Contains global application-level attributes used by Microsoft Word when you create and edit e-mail messages and replies.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
AutoFormatAsYouTypeApplyBorders | True if a series of three or more hyphens (-), equal signs (=), or underscore characters (_) are automatically replaced by a specific border line when the ENTER key is pressed. Read/write Boolean.
AutoFormatAsYouTypeApplyBulletedLists | True if bullet characters (such as asterisks, hyphens, and greater-than signs) are replaced with bullets. Read/write Boolean.
AutoFormatAsYouTypeApplyClosings | True for Microsoft Word to automatically apply the Closing style to letter closings as you type. Read/write Boolean.
AutoFormatAsYouTypeApplyDates | True for Microsoft Word to automatically apply the Date style to dates as you type. Read/write.
AutoFormatAsYouTypeApplyFirstIndents | True for Microsoft Word to automatically replace a space entered at the beginning of a paragraph with a first-line indent. Read/write.
AutoFormatAsYouTypeApplyHeadings | True if styles are automatically applied to headings as you type. Read/write Boolean.
AutoFormatAsYouTypeApplyNumberedLists | True if paragraphs are automatically formatted as numbered lists. Read/write Boolean.
AutoFormatAsYouTypeApplyTables | True if Word automatically creates a table when you type a plus sign, a series of hyphens, another plus sign, and so on, and then press ENTER. Read/write Boolean.
AutoFormatAsYouTypeAutoLetterWizard | True for Microsoft Word to automatically start the Letter Wizard when the user enters a letter salutation or closing. Read/write.
AutoFormatAsYouTypeDefineStyles | True if Word automatically creates new styles based on manual formatting. Read/write Boolean.
AutoFormatAsYouTypeDeleteAutoSpaces | True for Microsoft Word to automatically delete spaces inserted between Japanese and Latin text as you type. Read/write.
AutoFormatAsYouTypeFormatListItemBeginning | True if Word repeats character formatting applied to the beginning of a list item to the next list item. Read/write Boolean.
AutoFormatAsYouTypeInsertClosings | True for Microsoft Word to automatically insert the corresponding memo closing when the user enters a memo heading. Read/write.
AutoFormatAsYouTypeInsertOvers | True for Microsoft Word to automatically insert "以上" when the user enters "記" or "案". Read/write Boolean.
AutoFormatAsYouTypeMatchParentheses | True for Microsoft Word to automatically correct improperly paired parentheses. Read/write.
AutoFormatAsYouTypeReplaceFarEastDashes | True for Microsoft Word to automatically correct long vowel sounds and dashes. Read/write.
AutoFormatAsYouTypeReplaceFractions | True if typed fractions are replaced with fractions from the current character set as you type; for example, "1/2" is replaced with "½." Read/write Boolean.
AutoFormatAsYouTypeReplaceHyperlinks | True if e-mail addresses, server and share names (also known as UNC paths), and Internet addresses (also known as URLs) are automatically changed to hyperlinks as you type. Read/write Boolean.
AutoFormatAsYouTypeReplaceOrdinals | True if the ordinal number suffixes "st", "nd", "rd", and "th" are replaced with the same letters in superscript as you type; for example, "1st" is replaced with "1" followed by "st" formatted as superscript. Read/write Boolean.
AutoFormatAsYouTypeReplacePlainTextEmphasis | True if manual emphasis characters are automatically replaced with character formatting as you type; for example, "*bold*" is changed to "bold". Read/write Boolean.
AutoFormatAsYouTypeReplaceQuotes | True if straight quotation marks are automatically changed to smart (curly) quotation marks as you type. Read/write Boolean.
AutoFormatAsYouTypeReplaceSymbols | True if two consecutive hyphens (--) are replaced with an en dash (-) or an em dash (—) as you type. Read/write Boolean.
ComposeStyle | Returns a Style object that represents the style used to compose new e-mail messages. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
EmailSignature | Returns an EmailSignature object that represents the signatures Microsoft Word appends to outgoing e-mail messages. Read-only.
HTMLFidelity | Strips HTML tags used for opening HTML files in Word but not required for display. Read/write WdEmailHTMLFidelity.
MarkComments | True if Microsoft Word marks the user's comments in e-mail messages. Read/write Boolean.
MarkCommentsWith | Returns or sets the string with which Microsoft Word marks comments in e-mail messages. Read/write String.
NewColorOnReply | True specifies whether a user needs to choose a new color for reply text when replying to e-mail. Read/write Boolean.
Parent | Returns an Object that represents the parent object of the specified EmailOptions object.
PlainTextStyle | Returns the Style object that represents the text attributes for e-mail messages that are sent or received using plain text.
RelyOnCSS | True if cascading style sheets (CSS) are used for font formatting when you view a saved document in a Web browser. Read/write Boolean.
ReplyStyle | Returns a Style object that represents the style used when replying to e-mail messages.
TabIndentKey | True if the TAB and BACKSPACE keys can be used to increase and decrease, respectively, the left indent of paragraphs and if the BACKSPACE key can be used to change right-aligned paragraphs to centered paragraphs and centered paragraphs to left-aligned paragraphs. Read/write Boolean.
ThemeName | Returns or sets the name of the theme plus any theme formatting options to use for new e-mail messages. Read/write String.
UseThemeStyle | True if new e-mail messages use the character style defined by the default e-mail message theme. Read/write Boolean.
UseThemeStyleOnReply | True for Microsoft Word to use a theme when replying to e-mail. Read/write Boolean.


EmailOptions Properties (Word)

 Copy code hover
[image]

EmailOptions Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
AutoFormatAsYouTypeApplyBorders | True if a series of three or more hyphens (-), equal signs (=), or underscore characters (_) are automatically replaced by a specific border line when the ENTER key is pressed. Read/write Boolean.
AutoFormatAsYouTypeApplyBulletedLists | True if bullet characters (such as asterisks, hyphens, and greater-than signs) are replaced with bullets. Read/write Boolean.
AutoFormatAsYouTypeApplyClosings | True for Microsoft Word to automatically apply the Closing style to letter closings as you type. Read/write Boolean.
AutoFormatAsYouTypeApplyDates | True for Microsoft Word to automatically apply the Date style to dates as you type. Read/write.
AutoFormatAsYouTypeApplyFirstIndents | True for Microsoft Word to automatically replace a space entered at the beginning of a paragraph with a first-line indent. Read/write.
AutoFormatAsYouTypeApplyHeadings | True if styles are automatically applied to headings as you type. Read/write Boolean.
AutoFormatAsYouTypeApplyNumberedLists | True if paragraphs are automatically formatted as numbered lists. Read/write Boolean.
AutoFormatAsYouTypeApplyTables | True if Word automatically creates a table when you type a plus sign, a series of hyphens, another plus sign, and so on, and then press ENTER. Read/write Boolean.
AutoFormatAsYouTypeAutoLetterWizard | True for Microsoft Word to automatically start the Letter Wizard when the user enters a letter salutation or closing. Read/write.
AutoFormatAsYouTypeDefineStyles | True if Word automatically creates new styles based on manual formatting. Read/write Boolean.
AutoFormatAsYouTypeDeleteAutoSpaces | True for Microsoft Word to automatically delete spaces inserted between Japanese and Latin text as you type. Read/write.
AutoFormatAsYouTypeFormatListItemBeginning | True if Word repeats character formatting applied to the beginning of a list item to the next list item. Read/write Boolean.
AutoFormatAsYouTypeInsertClosings | True for Microsoft Word to automatically insert the corresponding memo closing when the user enters a memo heading. Read/write.
AutoFormatAsYouTypeInsertOvers | True for Microsoft Word to automatically insert "以上" when the user enters "記" or "案". Read/write Boolean.
AutoFormatAsYouTypeMatchParentheses | True for Microsoft Word to automatically correct improperly paired parentheses. Read/write.
AutoFormatAsYouTypeReplaceFarEastDashes | True for Microsoft Word to automatically correct long vowel sounds and dashes. Read/write.
AutoFormatAsYouTypeReplaceFractions | True if typed fractions are replaced with fractions from the current character set as you type; for example, "1/2" is replaced with "½." Read/write Boolean.
AutoFormatAsYouTypeReplaceHyperlinks | True if e-mail addresses, server and share names (also known as UNC paths), and Internet addresses (also known as URLs) are automatically changed to hyperlinks as you type. Read/write Boolean.
AutoFormatAsYouTypeReplaceOrdinals | True if the ordinal number suffixes "st", "nd", "rd", and "th" are replaced with the same letters in superscript as you type; for example, "1st" is replaced with "1" followed by "st" formatted as superscript. Read/write Boolean.
AutoFormatAsYouTypeReplacePlainTextEmphasis | True if manual emphasis characters are automatically replaced with character formatting as you type; for example, "*bold*" is changed to "bold". Read/write Boolean.
AutoFormatAsYouTypeReplaceQuotes | True if straight quotation marks are automatically changed to smart (curly) quotation marks as you type. Read/write Boolean.
AutoFormatAsYouTypeReplaceSymbols | True if two consecutive hyphens (--) are replaced with an en dash (-) or an em dash (—) as you type. Read/write Boolean.
ComposeStyle | Returns a Style object that represents the style used to compose new e-mail messages. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
EmailSignature | Returns an EmailSignature object that represents the signatures Microsoft Word appends to outgoing e-mail messages. Read-only.
HTMLFidelity | Strips HTML tags used for opening HTML files in Word but not required for display. Read/write WdEmailHTMLFidelity.
MarkComments | True if Microsoft Word marks the user's comments in e-mail messages. Read/write Boolean.
MarkCommentsWith | Returns or sets the string with which Microsoft Word marks comments in e-mail messages. Read/write String.
NewColorOnReply | True specifies whether a user needs to choose a new color for reply text when replying to e-mail. Read/write Boolean.
Parent | Returns an Object that represents the parent object of the specified EmailOptions object.
PlainTextStyle | Returns the Style object that represents the text attributes for e-mail messages that are sent or received using plain text.
RelyOnCSS | True if cascading style sheets (CSS) are used for font formatting when you view a saved document in a Web browser. Read/write Boolean.
ReplyStyle | Returns a Style object that represents the style used when replying to e-mail messages.
TabIndentKey | True if the TAB and BACKSPACE keys can be used to increase and decrease, respectively, the left indent of paragraphs and if the BACKSPACE key can be used to change right-aligned paragraphs to centered paragraphs and centered paragraphs to left-aligned paragraphs. Read/write Boolean.
ThemeName | Returns or sets the name of the theme plus any theme formatting options to use for new e-mail messages. Read/write String.
UseThemeStyle | True if new e-mail messages use the character style defined by the default e-mail message theme. Read/write Boolean.
UseThemeStyleOnReply | True for Microsoft Word to use a theme when replying to e-mail. Read/write Boolean.


EmailOptions.Application Property (Word)

 Copy code hover
[image]

EmailOptions.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents an EmailOptions collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

EmailOptions Object

Other resources

EmailOptions Object Members


EmailOptions.AutoFormatAsYouTypeApplyBorders Property (Word)

 Copy code hover
[image]

EmailOptions.AutoFormatAsYouTypeApplyBorders Property (Word)
See also Send feedback

Published: July 16, 2012

True if a series of three or more hyphens (-), equal signs (=), or underscore characters (_) are automatically replaced by a specific border line when the ENTER key is pressed. Read/write Boolean.

Syntax

expression .AutoFormatAsYouTypeApplyBorders

expression A variable that represents an EmailOptions collection.

Remarks

Hyphens (-) are replaced by a 0.75-point line, equal signs (=) are replaced by a 0.75-point double line, and underscore characters (_) are replaced by a 1.5-point line.

Example

This example causes sequences of three or more hyphens (-), equal signs (=), or underscore characters (_) to be transformed into borders.

VBA Copy code Copy code
Options.AutoFormatAsYouTypeApplyBorders = True

This example returns the current setting for the Borders option on the AutoFormat As You Type tab in the AutoCorrect dialog box (Tools menu).

VBA Copy code Copy code
MsgBox Options.AutoFormatAsYouTypeApplyBorders

See also

Concepts

EmailOptions Object

Other resources

EmailOptions Object Members


EmailOptions.AutoFormatAsYouTypeApplyBulletedLists Property (Word)

 Copy code hover
[image]

EmailOptions.AutoFormatAsYouTypeApplyBulletedLists Property (Word)
See also Send feedback

Published: July 16, 2012

True if bullet characters (such as asterisks, hyphens, and greater-than signs) are replaced with bullets. Read/write Boolean.

Syntax

expression .AutoFormatAsYouTypeApplyBulletedLists

expression A variable that represents an EmailOptions collection.

Remarks

If set to True, Word replaces bullet character with bullets defined in the Bullets And Numbering dialog box (Format menu) as you type.

Example

This example causes characters to be replaced with bullets when typed in a list.

VBA Copy code Copy code
Options.AutoFormatAsYouTypeApplyBulletedLists = True

This example returns the status of the Automatic bulleted lists option on the AutoFormat As You Type tab in the AutoCorrect dialog box (Tools menu).

VBA Copy code Copy code
Dim blnAutoFormat as Boolean

blnAutoFormat = Options.AutoFormatAsYouTypeApplyBulletedLists

See also

Concepts

EmailOptions Object

Other resources

EmailOptions Object Members


EmailOptions.AutoFormatAsYouTypeApplyClosings Property (Word)

 Copy code hover
[image]

EmailOptions.AutoFormatAsYouTypeApplyClosings Property (Word)
See also Send feedback

Published: July 16, 2012

True for Microsoft Word to automatically apply the Closing style to letter closings as you type. Read/write Boolean.

Syntax

expression .AutoFormatAsYouTypeApplyClosings

expression Required. A variable that represents an EmailOptions collection.

Example

This example sets Microsoft Word to automatically apply the Closing style to letter closings as you type.

VBA Copy code Copy code
Sub AutoClosings()
 Options.AutoFormatAsYouTypeApplyClosings = True
End Sub

See also

Concepts

EmailOptions Object

Other resources

EmailOptions Object Members


EmailOptions.AutoFormatAsYouTypeApplyDates Property (Word)

 Copy code hover
[image]

EmailOptions.AutoFormatAsYouTypeApplyDates Property (Word)
See also Send feedback

Published: July 16, 2012

True for Microsoft Word to automatically apply the Date style to dates as you type. Read/write.

Syntax

expression .AutoFormatAsYouTypeApplyDates

expression Required. A variable that represents an EmailOptions collection.

Example

This example sets Microsoft Word to automatically apply the Date style to dates as you type.

VBA Copy code Copy code
Sub AutoApplyDates()
 Options.AutoFormatAsYouTypeApplyDates = True
End Sub

See also

Concepts

EmailOptions Object

Other resources

EmailOptions Object Members


EmailOptions.AutoFormatAsYouTypeApplyFirstIndents Property (Word)

 Copy code hover
[image]

EmailOptions.AutoFormatAsYouTypeApplyFirstIndents Property (Word)
See also Send feedback

Published: July 16, 2012

True for Microsoft Word to automatically replace a space entered at the beginning of a paragraph with a first-line indent. Read/write.

Syntax

expression .AutoFormatAsYouTypeApplyFirstIndents

expression Required. A variable that represents an EmailOptions collection.

Example

This example sets Microsoft Word to automatically replace a space entered at the beginning of a paragraph with a first-line indent as you type.

VBA Copy code Copy code
Sub ApplyFirstIndents()
 Options.AutoFormatAsYouTypeApplyFirstIndents = True
End Sub

See also

Concepts

EmailOptions Object

Other resources

EmailOptions Object Members


EmailOptions.AutoFormatAsYouTypeApplyHeadings Property (Word)

 Copy code hover
[image]

EmailOptions.AutoFormatAsYouTypeApplyHeadings Property (Word)
See also Send feedback

Published: July 16, 2012

True if styles are automatically applied to headings as you type. Read/write Boolean.

Syntax

expression .AutoFormatAsYouTypeApplyHeadings

expression A variable that represents an EmailOptions collection.

Example

This example sets Word to automatically apply the Heading1 through Heading 9 styles to headings as you type.

VBA Copy code Copy code
Options.AutoFormatAsYouTypeApplyHeadings = True

This example returns the status of the Headings option on the AutoFormat As You Type tab in the AutoCorrect dialog box (Tools menu).

VBA Copy code Copy code
Dim blnAutoFormat as Boolean

blnAutoFormat = Options.AutoFormatAsYouTypeApplyHeadings

See also

Concepts

EmailOptions Object

Other resources

EmailOptions Object Members


EmailOptions.AutoFormatAsYouTypeApplyNumberedLists Property (Word)

 Copy code hover
[image]

EmailOptions.AutoFormatAsYouTypeApplyNumberedLists Property (Word)
See also Send feedback

Published: July 16, 2012

True if paragraphs are automatically formatted as numbered lists. Read/write Boolean.

Syntax

expression .AutoFormatAsYouTypeApplyNumberedLists

expression A variable that represents an EmailOptions collection.

Remarks

If set to True, numbered lists use a numbering scheme from the Bullets and Numbering dialog box (Format menu), according to what's typed. For example, if a paragraph starts with "1.1" and a tab character, Word automatically inserts "1.2" and a tab character when the ENTER key is pressed.

Example

This example causes lists to be automatically numbered as you type.

VBA Copy code Copy code
Options.AutoFormatAsYouTypeApplyNumberedLists = True

This example returns the status of the Automatic numbered lists option on the AutoFormat As You Type tab in the AutoCorrect dialog box (Tools menu).

VBA Copy code Copy code
Dim blnAutoFormat as Boolean

blnAutoFormat = Options.AutoFormatAsYouTypeApplyNumberedLists

See also

Concepts

EmailOptions Object

Other resources

EmailOptions Object Members


EmailOptions.AutoFormatAsYouTypeApplyTables Property (Word)

 Copy code hover
[image]

EmailOptions.AutoFormatAsYouTypeApplyTables Property (Word)
See also Send feedback

Published: July 16, 2012

True if Word automatically creates a table when you type a plus sign, a series of hyphens, another plus sign, and so on, and then press ENTER. Read/write Boolean.

Syntax

expression .AutoFormatAsYouTypeApplyTables

expression A variable that represents an EmailOptions collection.

Remarks

The plus signs become the column borders, and the hyphens become the column widths.

Example

This example sets Word to automatically create tables as you type.

VBA Copy code Copy code
Options.AutoFormatAsYouTypeApplyTables = True

This example returns the status of the Tables option on the AutoFormat As You Type tab in the AutoCorrect dialog box (Tools menu).

VBA Copy code Copy code
Dim blnAutoFormat as Boolean

blnAutoFormat = Options.AutoFormatAsYouTypeApplyTables

See also

Concepts

EmailOptions Object

Other resources

EmailOptions Object Members


EmailOptions.AutoFormatAsYouTypeAutoLetterWizard Property (Word)

 Copy code hover
[image]

EmailOptions.AutoFormatAsYouTypeAutoLetterWizard Property (Word)
See also Send feedback

Published: July 16, 2012

True for Microsoft Word to automatically start the Letter Wizard when the user enters a letter salutation or closing. Read/write.

Syntax

expression .AutoFormatAsYouTypeAutoLetterWizard

expression Required. A variable that represents an EmailOptions collection.

Example

This example sets Microsoft Word to automatically start the Letter Wizard when the user enters a letter salutation or closing.

VBA Copy code Copy code
Sub AutoLeterWizard()
 Options.AutoFormatAsYouTypeAutoLetterWizard = True
End Sub

See also

Concepts

EmailOptions Object

Other resources

EmailOptions Object Members


EmailOptions.AutoFormatAsYouTypeDefineStyles Property (Word)

 Copy code hover
[image]

EmailOptions.AutoFormatAsYouTypeDefineStyles Property (Word)
See also Send feedback

Published: July 16, 2012

True if Word automatically creates new styles based on manual formatting. Read/write Boolean.

Syntax

expression .AutoFormatAsYouTypeDefineStyles

expression A variable that represents an EmailOptions collection.

Example

This example sets Word to automatically create styles as you type.

VBA Copy code Copy code
Options.AutoFormatAsYouTypeDefineStyles = True

This example returns the status of the Define styles based on your formatting option on the AutoFormat As You Type tab in the AutoCorrect dialog box (Tools menu).

VBA Copy code Copy code
Dim blnAutoFormat as Boolean

blnAutoFormat = Options.AutoFormatAsYouTypeDefineStyles

See also

Concepts

EmailOptions Object

Other resources

EmailOptions Object Members


EmailOptions.AutoFormatAsYouTypeDeleteAutoSpaces Property (Word)

 Copy code hover
[image]

EmailOptions.AutoFormatAsYouTypeDeleteAutoSpaces Property (Word)
See also Send feedback

Published: July 16, 2012

True for Microsoft Word to automatically delete spaces inserted between Japanese and Latin text as you type. Read/write.

Syntax

expression .AutoFormatAsYouTypeDeleteAutoSpaces

expression Required. A variable that represents an EmailOptions collection.

Example

This example sets Microsoft Word to automatically delete spaces inserted between Japanese and Latin text as you type.

VBA Copy code Copy code
Sub AutoDeleteSpaces()
 Options.AutoFormatAsYouTypeDeleteAutoSpaces = True
End Sub

See also

Concepts

EmailOptions Object

Other resources

EmailOptions Object Members


EmailOptions.AutoFormatAsYouTypeFormatListItemBeginning Property (Word)

 Copy code hover
[image]

EmailOptions.AutoFormatAsYouTypeFormatListItemBeginning Property (Word)
See also Send feedback

Published: July 16, 2012

True if Word repeats character formatting applied to the beginning of a list item to the next list item. Read/write Boolean.

Syntax

expression .AutoFormatAsYouTypeFormatListItemBeginning

expression A variable that represents an EmailOptions collection.

Example

This example sets Word to automatically repeat character formatting at the beginning of list items.

VBA Copy code Copy code
Options.AutoFormatAsYouTypeFormatListItemBeginning = True

This example returns the status of the Format beginning of list item like the one before it option in the AutoFormat As You Type tab in the AutoCorrect dialog box (Options menu).

VBA Copy code Copy code
Dim blnAutoFormat as Boolean

blnAutoFormat = _
 Options.AutoFormatAsYouTypeFormatListItemBeginning

See also

Concepts

EmailOptions Object

Other resources

EmailOptions Object Members


EmailOptions.AutoFormatAsYouTypeInsertClosings Property (Word)

 Copy code hover
[image]

EmailOptions.AutoFormatAsYouTypeInsertClosings Property (Word)
See also Send feedback

Published: July 16, 2012

True for Microsoft Word to automatically insert the corresponding memo closing when the user enters a memo heading. Read/write.

Syntax

expression .AutoFormatAsYouTypeInsertClosings

expression Required. A variable that represents an EmailOptions collection.

Example

This example sets Microsoft Word to automatically insert the corresponding memo closing when the user enters a memo heading.

VBA Copy code Copy code
Sub AutoInsertClosings()
 Options.AutoFormatAsYouTypeInsertClosings = True
End Sub

See also

Concepts

EmailOptions Object

Other resources

EmailOptions Object Members


EmailOptions.AutoFormatAsYouTypeInsertOvers Property (Word)

 Copy code hover
[image]

EmailOptions.AutoFormatAsYouTypeInsertOvers Property (Word)
See also Send feedback

Published: July 16, 2012

True for Microsoft Word to automatically insert "以上" when the user enters "記" or "案". Read/write Boolean.

Syntax

expression .AutoFormatAsYouTypeInsertOvers

expression Required. A variable that represents an EmailOptions collection.

Example

This example sets Microsoft Word to automatically insert "以上" when the user enters "記" or "案".

VBA Copy code Copy code
Options.AutoFormatAsYouTypeInsertOvers = True

See also

Concepts

EmailOptions Object

Other resources

EmailOptions Object Members


EmailOptions.AutoFormatAsYouTypeMatchParentheses Property (Word)

 Copy code hover
[image]

EmailOptions.AutoFormatAsYouTypeMatchParentheses Property (Word)
See also Send feedback

Published: July 16, 2012

True for Microsoft Word to automatically correct improperly paired parentheses. Read/write.

Syntax

expression .AutoFormatAsYouTypeMatchParentheses

expression Required. A variable that represents an EmailOptions collection.

Example

This example sets Microsoft Word to automatically correct improperly paired parentheses as you type.

VBA Copy code Copy code
Sub AutoMatchParentheses()
 Options.AutoFormatAsYouTypeMatchParentheses = True
End Sub

See also

Concepts

EmailOptions Object

Other resources

EmailOptions Object Members


EmailOptions.AutoFormatAsYouTypeReplaceFarEastDashes Property (Word)

 Copy code hover
[image]

EmailOptions.AutoFormatAsYouTypeReplaceFarEastDashes Property (Word)
See also Send feedback

Published: July 16, 2012

True for Microsoft Word to automatically correct long vowel sounds and dashes. Read/write.

Syntax

expression .AutoFormatAsYouTypeReplaceFarEastDashes

expression Required. A variable that represents an EmailOptions collection.

Example

This example sets Microsoft Word to automatically correct long vowel sounds and dashes as you type.

VBA Copy code Copy code
Sub AutoFarEastDashes()
 Options.AutoFormatAsYouTypeReplaceFarEastDashes = True
End Sub

See also

Concepts

EmailOptions Object

Other resources

EmailOptions Object Members


EmailOptions.AutoFormatAsYouTypeReplaceFractions Property (Word)

 Copy code hover
[image]

EmailOptions.AutoFormatAsYouTypeReplaceFractions Property (Word)
See also Send feedback

Published: July 16, 2012

True if typed fractions are replaced with fractions from the current character set as you type; for example, "1/2" is replaced with "½." Read/write Boolean.

Syntax

expression .AutoFormatAsYouTypeReplaceFractions

expression A variable that represents an EmailOptions collection.

Example

This example turns off the automatic replacement of typed fractions.

VBA Copy code Copy code
Options.AutoFormatAsYouTypeReplaceFractions = False

This example returns the status of the Fractions (1/2) with fraction character (½) option on the AutoFormat As You Type tab in the AutoCorrect dialog box (Tools menu).

VBA Copy code Copy code
Dim blnAutoFormat as Boolean

blnAutoFormat = Options.AutoFormatAsYouTypeReplaceFractions

See also

Concepts

EmailOptions Object

Other resources

EmailOptions Object Members


EmailOptions.AutoFormatAsYouTypeReplaceHyperlinks Property (Word)

 Copy code hover
[image]

EmailOptions.AutoFormatAsYouTypeReplaceHyperlinks Property (Word)
See also Send feedback

Published: July 16, 2012

True if e-mail addresses, server and share names (also known as UNC paths), and Internet addresses (also known as URLs) are automatically changed to hyperlinks as you type. Read/write Boolean.

Syntax

expression .AutoFormatAsYouTypeReplaceHyperlinks

expression A variable that represents an EmailOptions collection.

Remarks

Word changes any text that looks like an e-mail address, UNC, or URL to a hyperlink. However, Word does not check the validity of the hyperlink.

Example

This example enables Word to automatically replace any Internet or network paths with hyperlinks when the paths are typed.

VBA Copy code Copy code
Options.AutoFormatAsYouTypeReplaceHyperlinks = True

This example returns the status of the Internet and network paths with hyperlinks option on the AutoFormat As You Type tab in the AutoCorrect dialog box (Tools menu).

VBA Copy code Copy code
Dim blnAutoFormat as Boolean

blnAutoFormat = Options.AutoFormatAsYouTypeReplaceHyperlinks

See also

Concepts

EmailOptions Object

Other resources

EmailOptions Object Members


EmailOptions.AutoFormatAsYouTypeReplaceOrdinals Property (Word)

 Copy code hover
[image]

EmailOptions.AutoFormatAsYouTypeReplaceOrdinals Property (Word)
See also Send feedback

Published: July 16, 2012

True if the ordinal number suffixes "st", "nd", "rd", and "th" are replaced with the same letters in superscript as you type; for example, "1st" is replaced with "1" followed by "st" formatted as superscript. Read/write Boolean.

Syntax

expression .AutoFormatAsYouTypeReplaceOrdinals

expression A variable that represents an EmailOptions collection.

Example

This example turns on the automatic replacement of ordinals with superscript letters.

VBA Copy code Copy code
Options.AutoFormatAsYouTypeReplaceOrdinals = True

This example returns the status of the Ordinals (1st) with superscript option on the AutoFormat As You Type tab in the AutoCorrect dialog box (Tools menu).

VBA Copy code Copy code
Dim blnAutoFormat as Boolean

blnAutoFormat = Options.AutoFormatAsYouTypeReplaceOrdinals

See also

Concepts

EmailOptions Object

Other resources

EmailOptions Object Members


EmailOptions.AutoFormatAsYouTypeReplacePlainTextEmphasis Property (Word)

 Copy code hover
[image]

EmailOptions.AutoFormatAsYouTypeReplacePlainTextEmphasis Property (Word)
See also Send feedback

Published: July 16, 2012

True if manual emphasis characters are automatically replaced with character formatting as you type; for example, "*bold*" is changed to "bold". Read/write Boolean.

Syntax

expression .AutoFormatAsYouTypeReplacePlainTextEmphasis

expression A variable that represents an EmailOptions collection.

Example

This example turns on the replacement of manual emphasis characters with character formatting.

VBA Copy code Copy code
Options.AutoFormatAsYouTypeReplacePlainTextEmphasis = True

This example returns the status of the *Bold* and _underline_ with real formatting option on the AutoFormat As You Type tab in the AutoCorrect dialog box (Tools menu).

VBA Copy code Copy code
Dim blnAutoFormat as Boolean

blnAutoFormat = _
 Options.AutoFormatAsYouTypeReplacePlainTextEmphasis

See also

Concepts

EmailOptions Object

Other resources

EmailOptions Object Members


EmailOptions.AutoFormatAsYouTypeReplaceQuotes Property (Word)

 Copy code hover
[image]

EmailOptions.AutoFormatAsYouTypeReplaceQuotes Property (Word)
See also Send feedback

Published: July 16, 2012

True if straight quotation marks are automatically changed to smart (curly) quotation marks as you type. Read/write Boolean.

Syntax

expression .AutoFormatAsYouTypeReplaceQuotes

expression A variable that represents an EmailOptions collection.

Example

This example turns on the automatic replacement of straight quotation marks with smart (curly) quotation marks as you type.

VBA Copy code Copy code
Options.AutoFormatAsYouTypeReplaceQuotes = True

This example returns the status of the Straight quotes with smart quotes option on the AutoFormat As You Type tab in the AutoCorrect dialog box (Tools menu).

VBA Copy code Copy code
Dim blnAutoFormat as Boolean

blnAutoFormat = Options.AutoFormatReplaceQuotes

See also

Concepts

EmailOptions Object

Other resources

EmailOptions Object Members


EmailOptions.AutoFormatAsYouTypeReplaceSymbols Property (Word)

 Copy code hover
[image]

EmailOptions.AutoFormatAsYouTypeReplaceSymbols Property (Word)
See also Send feedback

Published: July 16, 2012

True if two consecutive hyphens (--) are replaced with an en dash (-) or an em dash (—) as you type. Read/write Boolean.

Syntax

expression .AutoFormatAsYouTypeReplaceSymbols

expression A variable that represents an EmailOptions collection.

Remarks

If the hyphens are typed with leading and trailing spaces, Word replaces the hyphens with an en dash; if there are no trailing spaces, the hyphens are replaced with an em dash.

Example

This example turns on the replacement of hyphens with symbols as you type.

VBA Copy code Copy code
EmailOptions.AutoFormatAsYouTypeReplaceSymbols = True

This example returns the status of the Symbol characters (--) with symbols (—) option on the AutoFormat As You Type tab in the AutoCorrect dialog box (Tools menu).

VBA Copy code Copy code
Dim blnAutoFormat as Boolean

blnAutoFormat = EmailOptions.AutoFormatAsYouTypeReplaceSymbols

See also

Concepts

EmailOptions Object

Other resources

EmailOptions Object Members


EmailOptions.ComposeStyle Property (Word)

 Copy code hover
[image]

EmailOptions.ComposeStyle Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Style object that represents the style used to compose new e-mail messages. Read-only.

Syntax

expression .ComposeStyle

expression A variable that represents a EmailOptions object.

Example

This example displays the name of the default style used to compose new e-mail messages.

VBA Copy code Copy code
MsgBox Application.EmailOptions.ComposeStyle.NameLocal

This example changes the font color of the default style used to compose new e-mail messages.

VBA Copy code Copy code
Application.EmailOptions.ComposeStyle.Font.Color = _
 wdColorBrightGreen

See also

Concepts

EmailOptions Object

Other resources

EmailOptions Object Members


EmailOptions.Creator Property (Word)

 Copy code hover
[image]

EmailOptions.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents an EmailOptions collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

EmailOptions Object

Other resources

EmailOptions Object Members


EmailOptions.EmailSignature Property (Word)

 Copy code hover
[image]

EmailOptions.EmailSignature Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an EmailSignature object that represents the signatures Microsoft Word appends to outgoing e-mail messages. Read-only.

Syntax

expression .EmailSignature

expression A variable that represents a EmailOptions object.

Example

This example displays the signature Word appends to new outgoing e-mail messages.

VBA Copy code Copy code
With Application.EmailOptions.EmailSignature
 If .NewMessageSignature = "" Then
 MsgBox "There is no signature for new " _
 & "e-mail messages!"
 Else
 MsgBox "The signature for new e-mail" _
 & "messages is: " & vbLf & vbLf _
 & .NewMessageSignature
 End If
End With

See also

Concepts

EmailOptions Object

Other resources

EmailOptions Object Members


EmailOptions.HTMLFidelity Property (Word)

 Copy code hover
[image]

EmailOptions.HTMLFidelity Property (Word)
See also Send feedback

Published: July 16, 2012

Strips HTML tags used for opening HTML files in Word but not required for display. Read/write WdEmailHTMLFidelity.

Syntax

expression .HTMLFidelity

expression Required. A variable that represents an EmailOptions collection.

Example

This example keeps all HTML tags intact when sending e-mail messages.

VBA Copy code Copy code
Sub HTMLEmail()
 Application.EmailOptions _
 .HTMLFidelity = wdEmailHTMLFidelityHigh
End Sub

See also

Concepts

EmailOptions Object

Other resources

EmailOptions Object Members


EmailOptions.MarkComments Property (Word)

 Copy code hover
[image]

EmailOptions.MarkComments Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word marks the user's comments in e-mail messages. Read/write Boolean.

Syntax

expression .MarkComments

expression An expression that returns an EmailOptions object.

Remarks

This property marks comments with the value of the MarkCommentsWith property. The default value of the MarkCommentsWith property is the value of the UserName property.

Example

This example sets Word to mark comments in e-mail messages with the initials "WK."

VBA Copy code Copy code
Application.EmailOptions.MarkCommentsWith = "WK"
Application.EmailOptions.MarkComments = True

See also

Concepts

EmailOptions Object

Other resources

EmailOptions Object Members


EmailOptions.MarkCommentsWith Property (Word)

 Copy code hover
[image]

EmailOptions.MarkCommentsWith Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the string with which Microsoft Word marks comments in e-mail messages. Read/write String.

Syntax

expression .MarkCommentsWith

expression An expression that returns an EmailOptions object.

Remarks

The default value is the value of the UserName property.

Example

This example sets Word to mark comments in e-mail messages with the initials "WK."

VBA Copy code Copy code
Application.EmailOptions.MarkCommentsWith = "WK"
Application.EmailOptions.MarkComments = True

See also

Concepts

EmailOptions Object

Other resources

EmailOptions Object Members


EmailOptions.NewColorOnReply Property (Word)

 Copy code hover
[image]

EmailOptions.NewColorOnReply Property (Word)
See also Send feedback

Published: July 16, 2012

True specifies whether a user needs to choose a new color for reply text when replying to e-mail. Read/write Boolean.

Syntax

expression .NewColorOnReply

expression An expression that returns an EmailOptions object.

Remarks

Use the NewColorOnReply property if you want the reply text of e-mail messages sent from Microsoft Word to be a different color than the original message.

Example

This example checks to see if a user needs to choose a new color for e-mail reply text and, if not, sets the reply font color to blue.

VBA Copy code Copy code
Sub NewColor()
 With Application.EmailOptions
 If .NewColorOnReply = False Then
 .ReplyStyle.Font.Color = wdColorBlue
 End If
 End With
End Sub

See also

Concepts

EmailOptions Object

Other resources

EmailOptions Object Members


EmailOptions.Parent Property (Word)

 Copy code hover
[image]

EmailOptions.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified EmailOptions object.

Syntax

expression .Parent

expression Required. A variable that represents an EmailOptions collection.

See also

Concepts

EmailOptions Object

Other resources

EmailOptions Object Members


EmailOptions.PlainTextStyle Property (Word)

 Copy code hover
[image]

EmailOptions.PlainTextStyle Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the Style object that represents the text attributes for e-mail messages that are sent or received using plain text.

Syntax

expression .PlainTextStyle

expression A variable that represents a EmailOptions object.

Example

This example sets the plain text font for e-mail messages to Tahoma, size 10.

VBA Copy code Copy code
Sub PlainTxt()
 With Application.EmailOptions.PlainTextStyle
 .Font.Name = "Tahoma"
 .Font.Size = 10
 End With
End Sub

See also

Concepts

EmailOptions Object

Other resources

EmailOptions Object Members


EmailOptions.RelyOnCSS Property (Word)

 Copy code hover
[image]

EmailOptions.RelyOnCSS Property (Word)
See also Send feedback

Published: July 16, 2012

True if cascading style sheets (CSS) are used for font formatting when you view a saved document in a Web browser. Read/write Boolean.

Syntax

expression .RelyOnCSS

expression Required. A variable that represents an EmailOptions collection.

Remarks

Microsoft Word creates a cascading style sheet file and saves it either to the specified folder or to the same folder as your Web page, depending on the value of the OrganizeInFolder property of the WebOptions or DefaultWebOptions object. This property returns False if HTML <FONT> tags and cascading style sheets are used. The default value is True.

You should set this property to True if your Web browser supports cascading style sheets because this will give you more precise layout and formatting control on your Web page and make it look more like your document (as it appears in Microsoft Word).

Example

This example enables the use of cascading style sheets as the global default for the application.

VBA Copy code Copy code
Application.DefaultWebOptions.RelyOnCSS = True

See also

Concepts

EmailOptions Object

Other resources

EmailOptions Object Members


EmailOptions.ReplyStyle Property (Word)

 Copy code hover
[image]

EmailOptions.ReplyStyle Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Style object that represents the style used when replying to e-mail messages.

Syntax

expression .ReplyStyle

expression An expression that returns an EmailOptions object.

Example

This example displays the name of the default style used when replying to e-mail messages.

VBA Copy code Copy code
MsgBox Application.EmailOptions.ReplyStyle.NameLocal

See also

Concepts

EmailOptions Object

Other resources

EmailOptions Object Members


EmailOptions.TabIndentKey Property (Word)

 Copy code hover
[image]

EmailOptions.TabIndentKey Property (Word)
See also Send feedback

Published: July 16, 2012

True if the TAB and BACKSPACE keys can be used to increase and decrease, respectively, the left indent of paragraphs and if the BACKSPACE key can be used to change right-aligned paragraphs to centered paragraphs and centered paragraphs to left-aligned paragraphs. Read/write Boolean.

Syntax

expression .TabIndentKey

expression Required. A variable that represents an EmailOptions collection.

Example

This example sets Word so that the TAB and BACKSPACE keys set the left indent instead of inserting and deleting tabs.

VBA Copy code Copy code
Options.TabIndentKey = True

See also

Concepts

EmailOptions Object

Other resources

EmailOptions Object Members


EmailOptions.ThemeName Property (Word)

 Copy code hover
[image]

EmailOptions.ThemeName Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the name of the theme plus any theme formatting options to use for new e-mail messages. Read/write String.

Syntax

expression .ThemeName

expression A variable that represents a EmailOptions object.

Remarks

For an explanation of the value returned by this property, see the Name argument of the ApplyTheme method. The value returned by this property may not correspond to the theme's display name as it appears in the Theme dialog box. To return a theme's display name, use the ActiveThemeDisplayName property.

You can also use the GetDefaultTheme and SetDefaultTheme methods to return and set the default theme for new e-mail messages.

Example

This example sets Microsoft Word to use the Blueprint theme with Vivid Colors for all new e-mail messages.

VBA Copy code Copy code
Application.EmailOptions.ThemeName = "blueprnt 100"

See also

Concepts

EmailOptions Object

Other resources

EmailOptions Object Members


EmailOptions.UseThemeStyle Property (Word)

 Copy code hover
[image]

EmailOptions.UseThemeStyle Property (Word)
See also Send feedback

Published: July 16, 2012

True if new e-mail messages use the character style defined by the default e-mail message theme. Read/write Boolean.

Syntax

expression .UseThemeStyle

expression A variable that represents a EmailOptions object.

Remarks

If no default e-mail message theme has been specified, the UseThemeStyle property has no effect.

Example

This example sets Microsoft Word to use the Artsy theme as the default theme for new e-mail messages and to use the character style defined in the Artsy theme.

VBA Copy code Copy code
Application.EmailOptions.ThemeName = "artsy"
Application.EmailOptions.UseThemeStyle = True

See also

Concepts

EmailOptions Object

Other resources

EmailOptions Object Members


EmailOptions.UseThemeStyleOnReply Property (Word)

 Copy code hover
[image]

EmailOptions.UseThemeStyleOnReply Property (Word)
See also Send feedback

Published: July 16, 2012

True for Microsoft Word to use a theme when replying to e-mail. Read/write Boolean.

Syntax

expression .UseThemeStyleOnReply

expression An expression that returns an EmailOptions object.

Example

This example tells Word to use a theme when replying to e-mail if Word uses a theme for new messages.

VBA Copy code Copy code
Sub NewTheme()
 With Application.EmailOptions
 If .UseThemeStyle = True Then
 .UseThemeStyleOnReply = True
 End If
 End With
End Sub

See also

Concepts

EmailOptions Object

Other resources

EmailOptions Object Members


EmailSignature Object (Word)

 Copy code hover
[image]

EmailSignature Object (Word)
See also Send feedback

Published: July 16, 2012

Contains information about the e-mail signatures used by Microsoft Word when you create and edit e-mail messages and replies.

Remarks

Use the EmailSignature property to return the EmailSignature object.

This example changes the signatures Word appends to new outgoing e-mail messages and e-mail message replies.

VBA Copy code Copy code
With Application.EmailOptions.EmailSignature
 .NewMessageSignature = "Signature1"
 .ReplyMessageSignature = "Reply2"
End With
Note Note

There is no EmailSignatures collection; each EmailOptions object contains only one EmailSignature object.

See also

Concepts

Word Object Model Reference

Other resources

EmailSignature Object Members


EmailSignature Members (Word)

 Copy code hover
[image]

EmailSignature Members (Word)
Send feedback

Published: July 16, 2012

Contains information about the e-mail signatures used by Microsoft Word when you create and edit e-mail messages and replies.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
EmailSignatureEntries | Returns an EmailSignatureEntries object that represents the e-mail signature entries in Microsoft Word. Read-only.
NewMessageSignature | Returns or sets the signature that Microsoft Word appends to new e-mail messages. Read/write String.
Parent | Returns an Object that represents the parent object of the specified EmailSignature object.
ReplyMessageSignature | Returns or sets the signature that Microsoft Word appends to e-mail message replies. Read/write String.


EmailSignature Properties (Word)

 Copy code hover
[image]

EmailSignature Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
EmailSignatureEntries | Returns an EmailSignatureEntries object that represents the e-mail signature entries in Microsoft Word. Read-only.
NewMessageSignature | Returns or sets the signature that Microsoft Word appends to new e-mail messages. Read/write String.
Parent | Returns an Object that represents the parent object of the specified EmailSignature object.
ReplyMessageSignature | Returns or sets the signature that Microsoft Word appends to e-mail message replies. Read/write String.


EmailSignature.Application Property (Word)

 Copy code hover
[image]

EmailSignature.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents an EmailSignature object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

EmailSignature Object

Other resources

EmailSignature Object Members


EmailSignature.Creator Property (Word)

 Copy code hover
[image]

EmailSignature.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents an EmailSignature object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

EmailSignature Object

Other resources

EmailSignature Object Members


EmailSignature.EmailSignatureEntries Property (Word)

 Copy code hover
[image]

EmailSignature.EmailSignatureEntries Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an EmailSignatureEntries object that represents the e-mail signature entries in Microsoft Word. Read-only.

Syntax

expression .EmailSignatureEntries

expression An expression that returns an EmailSignature object.

Remarks

An e-mail signature is standard text that ends an e-mail message, such as your name and telephone number. Use the EmailSignatureEntries property to create and manage a collection of e-mail signatures that Word will use when creating e-mail messages.

Example

This example creates a new signature entry based on the author's name and the selection in the active document.

VBA Copy code Copy code
Sub NewSignature()
 Application.EmailOptions.EmailSignature _
 .EmailSignatureEntries.Add _
 Name:=ActiveDocument.BuiltInDocumentProperties("Author"), _
 Range:=Selection.Range
End Sub

See also

Concepts

EmailSignature Object

Other resources

EmailSignature Object Members


EmailSignature.NewMessageSignature Property (Word)

 Copy code hover
[image]

EmailSignature.NewMessageSignature Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the signature that Microsoft Word appends to new e-mail messages. Read/write String.

Syntax

expression .NewMessageSignature

expression An expression that returns an EmailSignature object.

Remarks

When setting this property, you must use the name of an e-mail signature that you have created in the E-mail Options dialog box, available from the General tab of the Options dialog box (Tools menu).

Example

This example changes the signature Word appends to new outgoing e-mail messages.

VBA Copy code Copy code
With Application.EmailOptions.EmailSignature
 .NewMessageSignature = "Signature1"
End With

See also

Concepts

EmailSignature Object

Other resources

EmailSignature Object Members


EmailSignature.Parent Property (Word)

 Copy code hover
[image]

EmailSignature.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified EmailSignature object.

Syntax

expression .Parent

expression Required. A variable that represents an EmailSignature object.

See also

Concepts

EmailSignature Object

Other resources

EmailSignature Object Members


EmailSignature.ReplyMessageSignature Property (Word)

 Copy code hover
[image]

EmailSignature.ReplyMessageSignature Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the signature that Microsoft Word appends to e-mail message replies. Read/write String.

Syntax

expression .ReplyMessageSignature

expression An expression that returns an EmailSignature object.

Remarks

When setting this property, you must use the name of an e-mail signature that you have created in the E-mail Options dialog box, available from the General tab of the Options dialog box (Tools menu).

Example

This example changes the signature Word appends to e-mail message replies.

VBA Copy code Copy code
With Application.EmailOptions.EmailSignature
 .ReplyMessageSignature = "Reply2"
End With

See also

Concepts

EmailSignature Object

Other resources

EmailSignature Object Members


EmailSignatureEntries Object (Word)

 Copy code hover
[image]

EmailSignatureEntries Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of EmailSignatureEntry objects that represents all the e-mail signature entries available to Word.

Remarks

Use the EmailSignatureEntries property to return the EmailSignatureEntries collection. Use the Add method of the EmailSignatureEntries object to add an e-mail signature to Word. The following example creates a new e-mail signature entry based on the author's name and a selection in the active document, and then it sets the new signature entry as the default e-mail signature to use for new messages.

VBA Copy code Copy code
Sub NewEmailSignature()
 With Application.EmailOptions.EmailSignature
 .EmailSignatureEntries.Add "Jeff Smith", Selection.Range
 .NewMessageSignature = "Jeff Smith"
 End With
End Sub

See also

Concepts

Word Object Model Reference

Other resources

EmailSignatureEntries Object Members


EmailSignatureEntries Members (Word)

 Copy code hover
[image]

EmailSignatureEntries Members (Word)
Send feedback

Published: July 16, 2012

A collection of EmailSignatureEntry objects that represents all the e-mail signature entries available to Word.

Methods

Name | Description
Add | Returns an EmailSignatureEntry object that represents a new e-mail signature entry.
Item | Returns an individual EmailSignatureEntry object in a collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of e-mail signature entries in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified EmailSignatureEntries object.


EmailSignatureEntries Properties (Word)

 Copy code hover
[image]

EmailSignatureEntries Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of e-mail signature entries in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified EmailSignatureEntries object.


EmailSignatureEntries.Application Property (Word)

 Copy code hover
[image]

EmailSignatureEntries.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents an EmailSignatureEntries collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

EmailSignatureEntries Collection

Other resources

EmailSignatureEntries Object Members


EmailSignatureEntries.Count Property (Word)

 Copy code hover
[image]

EmailSignatureEntries.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of e-mail signature entries in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents an EmailSignatureEntries collection.

See also

Concepts

EmailSignatureEntries Collection

Other resources

EmailSignatureEntries Object Members


EmailSignatureEntries.Creator Property (Word)

 Copy code hover
[image]

EmailSignatureEntries.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents an EmailSignatureEntries collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

EmailSignatureEntries Collection

Other resources

EmailSignatureEntries Object Members


EmailSignatureEntries.Parent Property (Word)

 Copy code hover
[image]

EmailSignatureEntries.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified EmailSignatureEntries object.

Syntax

expression .Parent

expression Required. A variable that represents an EmailSignatureEntries collection.

See also

Concepts

EmailSignatureEntries Collection

Other resources

EmailSignatureEntries Object Members


EmailSignatureEntries Methods (Word)

 Copy code hover
[image]

EmailSignatureEntries Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Returns an EmailSignatureEntry object that represents a new e-mail signature entry.
Item | Returns an individual EmailSignatureEntry object in a collection.


EmailSignatureEntries.Add Method (Word)

 Copy code hover
[image]

EmailSignatureEntries.Add Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an EmailSignatureEntry object that represents a new e-mail signature entry.

Syntax

expression .Add(Name, Range)

expression Required. A variable that represents an EmailSignatureEntries collection.

Parameters

Name | Required/Optional | Data Type | Description
Name | Required | String | The name of the e-mail entry.
Range | Required | Range | The range in the document that will be added as the signature.

Return Value

EmailSignatureEntry

Remarks

An e-mail signature is standard text that ends an e-mail message, such as your name and telephone number. Use the EmailSignatureEntries property to create and manage a collection of e-mail signatures that Microsoft Word will use when creating e-mail messages.

Example

This example adds an automatically numbered footnote at the end of the selection.

VBA Copy code Copy code
Sub NewSignature()
 Application.EmailOptions.EmailSignature _
 .EmailSignatureEntries.Add _
 Name:=ActiveDocument.BuiltInDocumentProperties("Author"), _
 Range:=Selection.Range
End Sub

See also

Concepts

EmailSignatureEntries Collection

Other resources

EmailSignatureEntries Object Members


EmailSignatureEntries.Item Method (Word)

 Copy code hover
[image]

EmailSignatureEntries.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual EmailSignatureEntry object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents an EmailSignatureEntries collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The individual object to be returned. Can be a Long indicating the ordinal position or a String representing the name of the individual object.

Return Value

EmailSignatureEntry

See also

Concepts

EmailSignatureEntries Collection

Other resources

EmailSignatureEntries Object Members


EmailSignatureEntry Object (Word)

 Copy code hover
[image]

EmailSignatureEntry Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a single e-mail signature entry. The EmailSignatureEntry object is a member of the EmailSignatureEntries collection. The EmailSignatureEntries collection contains all the e-mail signature entries available to Word.

Remarks

Use EmailSignatureEntries(Index), where Index is the e-mail signature entry name or item number, to return a single EmailSignatureEntry object. You must match exactly the spelling (but not necessarily the capitalization) of the name. The following example uses the Delete method to delete the signature entry named "Jeff Smith."

VBA Copy code Copy code
Sub DeleteSignature()
 Application.EmailOptions.EmailSignature _
 .EmailSignatureEntries("jeff smith").Delete
End Sub

See also

Concepts

Word Object Model Reference

Other resources

EmailSignatureEntry Object Members


EmailSignatureEntry Members (Word)

 Copy code hover
[image]

EmailSignatureEntry Members (Word)
Send feedback

Published: July 16, 2012

Represents a single e-mail signature entry. The EmailSignatureEntry object is a member of the EmailSignatureEntries collection. The EmailSignatureEntries collection contains all the e-mail signature entries available to Word.

Methods

Name | Description
Delete | Deletes the specified email signature.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Index | Returns a Long that represents the position of an item in a collection. Read-only.
Name | Returns or sets the name of the specified object. Read/write String.
Parent | Returns an Object that represents the parent object of the specified EmailSignatureEntry object.


EmailSignatureEntry Properties (Word)

 Copy code hover
[image]

EmailSignatureEntry Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Index | Returns a Long that represents the position of an item in a collection. Read-only.
Name | Returns or sets the name of the specified object. Read/write String.
Parent | Returns an Object that represents the parent object of the specified EmailSignatureEntry object.


EmailSignatureEntry.Application Property (Word)

 Copy code hover
[image]

EmailSignatureEntry.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents an EmailSignatureEntry object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

EmailSignatureEntry Object

Other resources

EmailSignatureEntry Object Members


EmailSignatureEntry.Creator Property (Word)

 Copy code hover
[image]

EmailSignatureEntry.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents an EmailSignatureEntry object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

EmailSignatureEntry Object

Other resources

EmailSignatureEntry Object Members


EmailSignatureEntry.Index Property (Word)

 Copy code hover
[image]

EmailSignatureEntry.Index Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the position of an item in a collection. Read-only.

Syntax

expression .Index

expression Required. A variable that represents an EmailSignatureEntry object.

See also

Concepts

EmailSignatureEntry Object

Other resources

EmailSignatureEntry Object Members


EmailSignatureEntry.Name Property (Word)

 Copy code hover
[image]

EmailSignatureEntry.Name Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the name of the specified object. Read/write String.

Syntax

expression .Name

expression Required. A variable that represents an EmailSignatureEntry object.

See also

Concepts

EmailSignatureEntry Object

Other resources

EmailSignatureEntry Object Members


EmailSignatureEntry.Parent Property (Word)

 Copy code hover
[image]

EmailSignatureEntry.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified EmailSignatureEntry object.

Syntax

expression .Parent

expression Required. A variable that represents an EmailSignatureEntry object.

See also

Concepts

EmailSignatureEntry Object

Other resources

EmailSignatureEntry Object Members


EmailSignatureEntry Methods (Word)

 Copy code hover
[image]

EmailSignatureEntry Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the specified email signature.


EmailSignatureEntry.Delete Method (Word)

 Copy code hover
[image]

EmailSignatureEntry.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the specified email signature.

Syntax

expression .Delete

expression Required. A variable that represents an EmailSignatureEntry object.

See also

Concepts

EmailSignatureEntry Object

Other resources

EmailSignatureEntry Object Members


Endnote Object (Word)

 Copy code hover
[image]

Endnote Object (Word)
See also Send feedback

Published: July 16, 2012

Represents an endnote. The Endnote object is a member of the Endnotes collection, which represents the endnotes in a selection, range, or document.

Remarks

Use Endnotes(Index), where Index is the index number, to return a single Endnote object. The index number represents the position of the endnote in the selection, range, or document. The following example applies red formatting to the first endnote in the selection.

VBA Copy code Copy code
If Selection.Endnotes.Count >= 1 Then
 Selection.Endnotes(1).Reference.Font.ColorIndex = wdRed
End If

Use the Add method to add an endnote to the Endnotes collection. The following example adds an endnote immediately after the selection.

VBA Copy code Copy code
Selection.Collapse Direction:=wdCollapseEnd
ActiveDocument.Endnotes.Add Range:=Selection.Range , _
 Text:="The Willow Tree, (Lone Creek Press, 1996)."

See also

Concepts

Word Object Model Reference

Other resources

Endnote Object Members


Endnote Members (Word)

 Copy code hover
[image]

Endnote Members (Word)
Send feedback

Published: July 16, 2012

Represents an endnote. The Endnote object is a member of the Endnotes collection, which represents the endnotes in a selection, range, or document.

Methods

Name | Description
Delete | Deletes the specified endnote.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Index | Returns a Long that represents the position of an item in a collection. Read-only.
Parent | Returns an Object that represents the parent object of the specified Endnote object.
Range | Returns a Range object that represents the portion of a document that is contained in the specified object.
Reference | Returns a Range object that represents an endnote reference mark.


Endnote Properties (Word)

 Copy code hover
[image]

Endnote Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Index | Returns a Long that represents the position of an item in a collection. Read-only.
Parent | Returns an Object that represents the parent object of the specified Endnote object.
Range | Returns a Range object that represents the portion of a document that is contained in the specified object.
Reference | Returns a Range object that represents an endnote reference mark.


Endnote.Application Property (Word)

 Copy code hover
[image]

Endnote.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents an Endnote object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

Endnote Object

Other resources

Endnote Object Members


Endnote.Creator Property (Word)

 Copy code hover
[image]

Endnote.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents an Endnote object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Endnote Object

Other resources

Endnote Object Members


Endnote.Index Property (Word)

 Copy code hover
[image]

Endnote.Index Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the position of an item in a collection. Read-only.

Syntax

expression .Index

expression Required. A variable that represents an Endnote object.

See also

Concepts

Endnote Object

Other resources

Endnote Object Members


Endnote.Parent Property (Word)

 Copy code hover
[image]

Endnote.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Endnote object.

Syntax

expression .Parent

expression Required. A variable that represents an Endnote object.

See also

Concepts

Endnote Object

Other resources

Endnote Object Members


Endnote.Range Property (Word)

 Copy code hover
[image]

Endnote.Range Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the portion of a document that is contained in the specified object.

Syntax

expression .Range

expression Required. A variable that represents an Endnote object.

Remarks

For information about returning a range from a document or returning a shape range from a collection of shapes, see the Range method.

Example

This example changes the text of the first endnote in the active document.

VBA Copy code Copy code
With ActiveDocument.Endnotes(1).Range
 .Delete
 .Text = "new endnote text"
End With

See also

Concepts

Endnote Object

Other resources

Endnote Object Members


Endnote.Reference Property (Word)

 Copy code hover
[image]

Endnote.Reference Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents an endnote reference mark.

Syntax

expression .Reference

expression Required. A variable that represents an Endnote object.

Example

This example sets myRange to the first endnote reference mark in the active document and then copies the reference mark.

VBA Copy code Copy code
Set myRange = ActiveDocument.Endnotes(1).Reference
myRange.Copy

See also

Concepts

Endnote Object

Other resources

Endnote Object Members


Endnote Methods (Word)

 Copy code hover
[image]

Endnote Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the specified endnote.


Endnote.Delete Method (Word)

 Copy code hover
[image]

Endnote.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the specified endnote.

Syntax

expression .Delete

expression Required. A variable that represents an Endnote object.

See also

Concepts

Endnote Object

Other resources

Endnote Object Members


EndnoteOptions Object (Word)

 Copy code hover
[image]

EndnoteOptions Object (Word)
See also Send feedback

Published: July 16, 2012

Represents the properties assigned to a range or selection of endnotes in a document.

Remarks

Use the EndnoteOptions property of the Range or Selection object to return an EndnoteOptions object.

Using the EndnoteOptions object, you can assign different endnote properties to different areas of a document. For example, you may want endnotes in the introduction of a long document to be displayed as lowercase Roman numerals, while in the rest of your document they are displayed as Arabic numerals. The following example uses the NumberingRule, NumberStyle, and StartingNumber properties to format the endnotes in the first section ofthe active document.

VBA Copy code Copy code
Sub BookIntro()
 Dim rngIntro As Range

 'Sets the range as section one of the active document
 Set rngIntro = ActiveDocument.Sections(1).Range

 'Formats the EndnoteOptions properties
 With rngIntro.EndnoteOptions
 .NumberingRule = wdRestartSection
 .NumberStyle = wdNoteNumberStyleLowercaseRoman
 .StartingNumber = 1
 End With
End Sub

See also

Concepts

Word Object Model Reference

Other resources

EndnoteOptions Object Members


EndnoteOptions Members (Word)

 Copy code hover
[image]

EndnoteOptions Members (Word)
Send feedback

Published: July 16, 2012

Represents the properties assigned to a range or selection of endnotes in a document.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Location | Returns or sets the position of all endnotes. Read/write WdEndnoteLocation.
NumberingRule | Returns or sets the way footnotes or endnotes are numbered after page breaks or section breaks. Read/write WdNumberingRule.
NumberStyle | Returns or sets the number style for the endnotes. Read/write WdNoteNumberStyle.
Parent | Returns an Object that represents the parent object of the specified EndnoteOptions object.
StartingNumber | Returns or sets the starting endnote number. Read/write Long.


EndnoteOptions Properties (Word)

 Copy code hover
[image]

EndnoteOptions Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Location | Returns or sets the position of all endnotes. Read/write WdEndnoteLocation.
NumberingRule | Returns or sets the way footnotes or endnotes are numbered after page breaks or section breaks. Read/write WdNumberingRule.
NumberStyle | Returns or sets the number style for the endnotes. Read/write WdNoteNumberStyle.
Parent | Returns an Object that represents the parent object of the specified EndnoteOptions object.
StartingNumber | Returns or sets the starting endnote number. Read/write Long.


EndnoteOptions.Application Property (Word)

 Copy code hover
[image]

EndnoteOptions.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents an EndnoteOptions collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

EndnoteOptions Object

Other resources

EndnoteOptions Object Members


EndnoteOptions.Creator Property (Word)

 Copy code hover
[image]

EndnoteOptions.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents an EndnoteOptions collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

EndnoteOptions Object

Other resources

EndnoteOptions Object Members


EndnoteOptions.Location Property (Word)

 Copy code hover
[image]

EndnoteOptions.Location Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the position of all endnotes. Read/write WdEndnoteLocation.

Syntax

expression .Location

expression Required. A variable that represents an EndnoteOptions collection.

Example

This example positions all endnotes at the end of sections.

VBA Copy code Copy code
ActiveDocument.Endnotes.Location = wdEndOfSection

See also

Concepts

EndnoteOptions Object

Other resources

EndnoteOptions Object Members


EndnoteOptions.NumberingRule Property (Word)

 Copy code hover
[image]

EndnoteOptions.NumberingRule Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the way footnotes or endnotes are numbered after page breaks or section breaks. Read/write WdNumberingRule.

Syntax

expression .NumberingRule

expression Required. A variable that represents an EndnoteOptions collection.

Example

This example restarts endnote numbering after each section break in the active document.

VBA Copy code Copy code
ActiveDocument.Endnotes.NumberingRule = wdRestartSection

See also

Concepts

EndnoteOptions Object

Other resources

EndnoteOptions Object Members


EndnoteOptions.NumberStyle Property (Word)

 Copy code hover
[image]

EndnoteOptions.NumberStyle Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the number style for the endnotes. Read/write WdNoteNumberStyle.

Syntax

expression .NumberStyle

expression Required. A variable that represents an EndnoteOptions collection.

Remarks

Some of the WdNoteNumberStyle constants may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.

See also

Concepts

EndnoteOptions Object

Other resources

EndnoteOptions Object Members


EndnoteOptions.Parent Property (Word)

 Copy code hover
[image]

EndnoteOptions.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified EndnoteOptions object.

Syntax

expression .Parent

expression Required. A variable that represents an EndnoteOptions collection.

See also

Concepts

EndnoteOptions Object

Other resources

EndnoteOptions Object Members


EndnoteOptions.StartingNumber Property (Word)

 Copy code hover
[image]

EndnoteOptions.StartingNumber Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the starting endnote number. Read/write Long.

Syntax

expression .StartingNumber

expression Required. A variable that represents an EndnoteOptions collection.

See also

Concepts

EndnoteOptions Object

Other resources

EndnoteOptions Object Members


Endnotes Object (Word)

 Copy code hover
[image]

Endnotes Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of Endnote objects that represents all the endnotes in a selection, range, or document.

Remarks

Use the Endnotes property to return the Endnotes collection. The following example sets the location of endnotes in the active document.

VBA Copy code Copy code
ActiveDocument.Endnotes.Location = wdEndOfSection

Use the Add method to add an endnote to the Endnotes collection. The following example adds an endnote immediately after the selection.

VBA Copy code Copy code
Selection.Collapse Direction:=wdCollapseEnd
ActiveDocument.Endnotes.Add Range:=Selection.Range , _
 Text:="The Willow Tree, (Lone Creek Press, 1996)."

Use Endnotes(Index), where Index is the index number, to return a single Endnote object. The index number represents the position of the endnote in a selection, range, or document. The following example applies red formatting to the first endnote in the selection.

VBA Copy code Copy code
If Selection.Endnotes.Count >= 1 Then
 Selection.Endnotes(1).Reference.Font.ColorIndex = wdRed
End If

See also

Concepts

Word Object Model Reference

Other resources

Endnotes Object Members


Endnotes Members (Word)

 Copy code hover
[image]

Endnotes Members (Word)
Send feedback

Published: July 16, 2012

A collection of Endnote objects that represents all the endnotes in a selection, range, or document.

Methods

Name | Description
Add | Returns an Endnote object that represents an endnote added to a range.
Convert | Converts endnotes to footnotes.
Item | Returns an individual Endnote object in a collection.
ResetContinuationNotice | Resets the endnote continuation notice to the default notice.
ResetContinuationSeparator | Resets the endnote continuation separator to the default separator.
ResetSeparator | Resets the endnote separator to the default separator.
SwapWithFootnotes | Converts all endnotes in a document to footnotes and vice versa.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
ContinuationNotice | Returns a Range object that represents the endnote continuation notice. Read-only.
ContinuationSeparator | Returns a Range object that represents the endnote continuation separator. Read-only.
Count | Returns a Long that represents the number of endnotes in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Location | Returns or sets the position of all endnotes. Read/write WdEndnoteLocation. .
NumberingRule | Returns or sets the way endnotes are numbered after page breaks or section breaks. Read/write WdNumberingRule.
NumberStyle | Returns or sets the number style. Read/write WdNoteNumberStyle.
Parent | Returns an Object that represents the parent object of the specified Endnotes object.
Separator | Returns a Range object that represents the endnote separator.
StartingNumber | Returns or sets the starting note number, line number, or page number. Read/write Long.


Endnotes Properties (Word)

 Copy code hover
[image]

Endnotes Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
ContinuationNotice | Returns a Range object that represents the endnote continuation notice. Read-only.
ContinuationSeparator | Returns a Range object that represents the endnote continuation separator. Read-only.
Count | Returns a Long that represents the number of endnotes in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Location | Returns or sets the position of all endnotes. Read/write WdEndnoteLocation. .
NumberingRule | Returns or sets the way endnotes are numbered after page breaks or section breaks. Read/write WdNumberingRule.
NumberStyle | Returns or sets the number style. Read/write WdNoteNumberStyle.
Parent | Returns an Object that represents the parent object of the specified Endnotes object.
Separator | Returns a Range object that represents the endnote separator.
StartingNumber | Returns or sets the starting note number, line number, or page number. Read/write Long.


Endnotes.Application Property (Word)

 Copy code hover
[image]

Endnotes.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents an Endnotes collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

Endnotes Collection Object

Other resources

Endnotes Object Members


Endnotes.ContinuationNotice Property (Word)

 Copy code hover
[image]

Endnotes.ContinuationNotice Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the endnote continuation notice. Read-only.

Syntax

expression .ContinuationNotice

expression A variable that represents an Endnotes collection.

Example

This example replaces the current footnote continuation notice with the text "Continued...".

VBA Copy code Copy code
With ActiveDocument.Footnotes.ContinuationNotice
 .Delete
 .InsertBefore "Continued..."
End With

See also

Concepts

Endnotes Collection Object

Other resources

Endnotes Object Members


Endnotes.ContinuationSeparator Property (Word)

 Copy code hover
[image]

Endnotes.ContinuationSeparator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the endnote continuation separator. Read-only.

Syntax

expression .ContinuationSeparator

expression A variable that represents an Endnotes collection.

Example

This example replaces the current endnote continuation separator with a series of underscore characters.

VBA Copy code Copy code
With ActiveDocument.Endnotes.ContinuationSeparator
 .Delete
 .InsertBefore "____"
End With

See also

Concepts

Endnotes Collection Object

Other resources

Endnotes Object Members


Endnotes.Count Property (Word)

 Copy code hover
[image]

Endnotes.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of endnotes in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents an Endnotes collection.

See also

Concepts

Endnotes Collection Object

Other resources

Endnotes Object Members


Endnotes.Creator Property (Word)

 Copy code hover
[image]

Endnotes.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents an Endnotes collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Endnotes Collection Object

Other resources

Endnotes Object Members


Endnotes.Location Property (Word)

 Copy code hover
[image]

Endnotes.Location Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the position of all endnotes. Read/write WdEndnoteLocation. .

Syntax

expression .Location

expression An expression that represents a Endnotes object.

Example

This example positions all endnotes at the end of sections.

VBA Copy code Copy code
ActiveDocument.Endnotes.Location = wdEndOfSection

See also

Concepts

Endnotes Collection Object

Other resources

Endnotes Object Members


Endnotes.NumberingRule Property (Word)

 Copy code hover
[image]

Endnotes.NumberingRule Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the way endnotes are numbered after page breaks or section breaks. Read/write WdNumberingRule.

Syntax

expression .NumberingRule

expression Required. A variable that represents an Endnotes collection.

Example

This example restarts endnote numbering after each section break in the active document.

VBA Copy code Copy code
ActiveDocument.Endnotes.NumberingRule = wdRestartSection

See also

Concepts

Endnotes Collection Object

Other resources

Endnotes Object Members


Endnotes.NumberStyle Property (Word)

 Copy code hover
[image]

Endnotes.NumberStyle Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the number style. Read/write WdNoteNumberStyle.

Syntax

expression .NumberStyle

expression An expression that represents a Endnotes object.

Remarks

Some of the constants may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.

Example

This example sets the formatting for footnotes and endnotes in the active document.

VBA Copy code Copy code
With ActiveDocument
 .Footnotes.NumberStyle = wdNoteNumberStyleLowercaseRoman
 .Endnotes.NumberStyle = wdNoteNumberStyleUppercaseRoman
End With

See also

Concepts

Endnotes Collection Object

Other resources

Endnotes Object Members


Endnotes.Parent Property (Word)

 Copy code hover
[image]

Endnotes.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Endnotes object.

Syntax

expression .Parent

expression Required. A variable that represents an Endnotes collection.

See also

Concepts

Endnotes Collection Object

Other resources

Endnotes Object Members


Endnotes.Separator Property (Word)

 Copy code hover
[image]

Endnotes.Separator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the endnote separator.

Syntax

expression .Separator

expression Required. A variable that represents an Endnotes collection.

See also

Concepts

Endnotes Collection Object

Other resources

Endnotes Object Members


Endnotes.StartingNumber Property (Word)

 Copy code hover
[image]

Endnotes.StartingNumber Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the starting note number, line number, or page number. Read/write Long.

Syntax

expression .StartingNumber

expression An expression that represents a Endnotes object.

Remarks

You must be in print layout view to see line numbering.

When applied to page numbers, this property returns or sets the beginning page number for the specified HeaderFooter object. This number may or may not be visible on the first page, depending on the setting of the ShowFirstPageNumber property. The RestartNumberingAtSection property, if set to False, will override the StartingNumber property so that page numbering can continue from the previous section.

Example

This example creates a new document, sets the starting number for footnotes to 10, and then adds a footnote at the insertion point.

VBA Copy code Copy code
Set myDoc = Documents.Add
With myDoc.Footnotes
 .StartingNumber = 10
 .Add Range:=Selection.Range, Text:="Text for a footnote"
End With

This example enables line numbering for the active document. The starting number is set to 5, every fifth line number is shown, and the numbering starts over at the beginning of each section in the document.

VBA Copy code Copy code
With ActiveDocument.PageSetup.LineNumbering
 .Active = True
 .StartingNumber = 5
 .CountBy = 5
 .RestartMode = wdRestartSection
End With

This example sets properties for page numbers, and then it adds page numbers to the header of the active document.

VBA Copy code Copy code
With ActiveDocument.Sections(1) _
 .Headers(wdHeaderFooterPrimary).PageNumbers
 .NumberStyle = wdPageNumberStyleArabic
 .IncludeChapterNumber = False
 .RestartNumberingAtSection = True
 .StartingNumber = 5
 .Add PageNumberAlignment:=wdAlignPageNumberCenter, _
 FirstPage:=True
End With

See also

Concepts

Endnotes Collection Object

Other resources

Endnotes Object Members


Endnotes Methods (Word)

 Copy code hover
[image]

Endnotes Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Returns an Endnote object that represents an endnote added to a range.
Convert | Converts endnotes to footnotes.
Item | Returns an individual Endnote object in a collection.
ResetContinuationNotice | Resets the endnote continuation notice to the default notice.
ResetContinuationSeparator | Resets the endnote continuation separator to the default separator.
ResetSeparator | Resets the endnote separator to the default separator.
SwapWithFootnotes | Converts all endnotes in a document to footnotes and vice versa.


Endnotes.Add Method (Word)

 Copy code hover
[image]

Endnotes.Add Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an Endnote object that represents an endnote added to a range.

Syntax

expression .Add(Range, Reference, Text)

expression Required. A variable that represents an Endnotes collection.

Parameters

Name | Required/Optional | Data Type | Description
Range | Required | Range object | The range marked for the endnote or footnote. This can be a collapsed range.
Reference | Optional | Variant | The text for the custom reference mark. If this argument is omitted, Microsoft Word inserts an automatically-numbered reference mark.
Text | Optional | Variant | The text of the endnote or footnote.

Remarks

To specify a symbol for the Reference argument, use the syntax {FontName CharNum}. FontName is the name of the font that contains the symbol. Names of decorative fonts appear in the Font box in the Symbol dialog box (Insert menu). CharNum is the sum of 31 and the number corresponding to the position of the symbol you want to insert, counting from left to right in the table of symbols. For example, to specify an omega symbol at position 56 in the table of symbols in the Symbol font, the argument would be "{Symbol 87}".

Example

This example adds an endnote to the third paragraph in the active document

VBA Copy code Copy code
Set myRange = ActiveDocument.Paragraphs(3).Range
ActiveDocument.Endnotes.Add Range:=myRange, _
 Text:= "Ibid., 314."

See also

Concepts

Endnotes Collection Object

Other resources

Endnotes Object Members


Endnotes.Convert Method (Word)

 Copy code hover
[image]

Endnotes.Convert Method (Word)
See also Send feedback

Published: July 16, 2012

Converts endnotes to footnotes.

Syntax

expression .Convert

expression Required. A variable that represents an Endnotes object.

Example

This example converts all endnotes in the active document to footnotes.

VBA Copy code Copy code
Set endDocEndnotes = ActiveDocument.Endnotes
If endDocEndnotes.Count > 0 Then myEndnotes.Convert

See also

Concepts

Endnotes Collection Object

Other resources

Endnotes Object Members


Endnotes.Item Method (Word)

 Copy code hover
[image]

Endnotes.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual Endnote object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents an Endnotes collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The individual object to be returned. Can be a Long indicating the ordinal position of the individual object.

Return Value

Endnote

See also

Concepts

Endnotes Collection Object

Other resources

Endnotes Object Members


Endnotes.ResetContinuationNotice Method (Word)

 Copy code hover
[image]

Endnotes.ResetContinuationNotice Method (Word)
See also Send feedback

Published: July 16, 2012

Resets the endnote continuation notice to the default notice.

Syntax

expression .ResetContinuationNotice

expression Required. A variable that represents an Endnotes collection.

Remarks

The default notice is blank (no text).

Example

This example resets the endnote continuation notice for the active document.

VBA Copy code Copy code
ActiveDocument.Endnotes.ResetContinuationNotice

See also

Concepts

Endnotes Collection Object

Other resources

Endnotes Object Members


Endnotes.ResetContinuationSeparator Method (Word)

 Copy code hover
[image]

Endnotes.ResetContinuationSeparator Method (Word)
See also Send feedback

Published: July 16, 2012

Resets the endnote continuation separator to the default separator.

Syntax

expression .ResetContinuationSeparator

expression Required. A variable that represents an Endnotes collection.

Remarks

The default separator is a long horizontal line that separates document text from notes continued from the previous page.

Example

This example resets the endnote continuation separator for the first section in each open document.

VBA Copy code Copy code
Dim docLoop As Document

For Each docLoop In Documents
 docLoop.Sections(1).Range.Endnotes _
 .ResetContinuationSeparator
Next docLoop

See also

Concepts

Endnotes Collection Object

Other resources

Endnotes Object Members


Endnotes.ResetSeparator Method (Word)

 Copy code hover
[image]

Endnotes.ResetSeparator Method (Word)
See also Send feedback

Published: July 16, 2012

Resets the endnote separator to the default separator.

Syntax

expression .ResetSeparator

expression Required. A variable that represents an Endnotes collection.

Remarks

The default separator is a short horizontal line that separates document text from notes.

Example

This example resets the endnote separator for the notes in the document where the selection is located.

VBA Copy code Copy code
Selection.Endnotes.ResetSeparator

See also

Concepts

Endnotes Collection Object

Other resources

Endnotes Object Members


Endnotes.SwapWithFootnotes Method (Word)

 Copy code hover
[image]

Endnotes.SwapWithFootnotes Method (Word)
See also Send feedback

Published: July 16, 2012

Converts all endnotes in a document to footnotes and vice versa.

Syntax

expression .SwapWithFootnotes

expression Required. A variable that represents an Endnotes collection.

Remarks

To convert a range of endnotes to footnotes, use the Convert method.

Example

This example converts the endnotes in the active document to footnotes and converts the footnotes to endnotes.

VBA Copy code Copy code
ActiveDocument.Endnotes.SwapWithFootnotes

See also

Concepts

Endnotes Collection Object

Other resources

Endnotes Object Members


Envelope Object (Word)

 Copy code hover
[image]

Envelope Object (Word)
See also Send feedback

Published: July 16, 2012

Represents an envelope attached to a document.

Remarks

Use the Envelope property to return the Envelope object. The following example adds an envelope to a new document and sets the distance between the top of the envelope and the address to 2.25 inches.

VBA Copy code Copy code
Set myDoc = Documents.Add
addr = "Michael Matey" & vbCr & "123 Skye St." _
 & vbCr & "Redmond, WA 98107"
retaddr = "Cora Edmonds" & vbCr & "456 Erde Lane" & vbCr _
 & "Redmond, WA 98107"
With myDoc.Envelope
 .Insert Address:=addr, ReturnAddress:=retaddr
 .AddressFromTop = InchesToPoints(2.25)
End With

Remarks

The Envelope object is available regardless of whether an envelope has been added to the specified document. However, an error occurs if you use one of the following properties when an envelope has not been added to the document: Address, AddressFromLeft, AddressFromTop, FeedSource, ReturnAddress, ReturnAddressFromLeft, ReturnAddressFromTop, and UpdateDocument.

The following example demonstrates how to use the On Error GoTo statement to trap the error that occurs if an envelope has not been added to the active document. If, however, an envelope has been added to the document, the recipient address is displayed.

VBA Copy code Copy code
On Error GoTo ErrorHandler
MsgBox ActiveDocument.Envelope.Address
ErrorHandler:
If Err = 5852 Then MsgBox _
 "Envelope is not in the specified document"

Use the Insert method to add an envelope to the specified document. Use the PrintOut method to set the properties of an envelope and print it without adding it to the document.

Note Note

There is no Envelopes collection; each Document object contains only one Envelope object.

See also

Concepts

Word Object Model Reference

Other resources

Envelope Object Members


Envelope Members (Word)

 Copy code hover
[image]

Envelope Members (Word)
Send feedback

Published: July 16, 2012

Represents an envelope attached to a document.

Methods

Name | Description
Insert | Inserts an envelope as a separate section at the beginning of the specified document.
Options | Displays the Envelope Options dialog box.
PrintOut | Prints an envelope without adding the envelope to the active document.
UpdateDocument | Updates the envelope in the document with the current envelope settings.

Properties

Name | Description
Address | Returns the envelope delivery address as a Range object. Read-only.
AddressFromLeft | Returns or sets the distance (in points) between the left edge of the envelope and the delivery address. Read/write Single.
AddressFromTop | Returns or sets the distance (in points) between the top edge of the envelope and the delivery address. Read/write Single.
AddressStyle | Returns a Style object that represents the delivery address style for the envelope. Read-only.
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
DefaultFaceUp | True if envelopes are fed face up by default. Read/write Boolean.
DefaultHeight | Returns or sets the default envelope height, in points. Read/write Single.
DefaultOmitReturnAddress | True if the return address is omitted from envelopes by default. Read/write Boolean.
DefaultOrientation | Returns or sets the default orientation for feeding envelopes. Read/write WdEnvelopeOrientation.
DefaultPrintFIMA | True to add a Facing Identification Mark (FIM-A) to envelopes by default. Read/write Boolean.
DefaultSize | Returns or sets the default envelope size. Read/write String.
DefaultWidth | Returns or sets the default envelope width, in points. Read/write Single.
FeedSource | Returns or sets the paper tray for the envelope. Read/write WdPaperTray.
Parent | Returns an Object that represents the parent object of the specified Envelope object.
RecipientNamefromLeft | Returns or sets a Single that represents the position, measured in points, of the recipient's name from the left edge of the envelope. Read/write.
RecipientNamefromTop | Returns or sets a Single that represents the position, measured in points, of the recipient's name from the top edge of the envelope. Read/write.
RecipientPostalfromLeft | Returns or sets a Single that represents the position, measured in points, of the recipient's postal code from the left edge of the envelope. Read/write.
RecipientPostalfromTop | Returns or sets a Single that represents the position, measured in points, of the recipient's postal code from the top edge of the envelope. Read/write.
ReturnAddress | Returns a Range object that represents the envelope return address.
ReturnAddressFromLeft | Returns or sets the distance (in points) between the left edge of the envelope and the return address. Read/write Single.
ReturnAddressFromTop | Returns or sets the distance (in points) between the top edge of the envelope and the return address. Read/write Single.
ReturnAddressStyle | Returns a Style object that represents the return address style for the envelope.
SenderNamefromLeft | Returns or sets a Single that represents the position, measured in points, of the sender's name from the left edge of the envelope. Read/write.
SenderNamefromTop | Returns or sets a Single that represents the position, measured in points, of the sender's name from the top edge of the envelope. Read/write.
SenderPostalfromLeft | Returns or sets a Single that represents the position, measured in points, of the sender's postal code from the left edge of the envelope. Read/write.
SenderPostalfromTop | Returns or sets a Single that represents the position, measured in points, of the sender's postal code from the top edge of the envelope. Read/write.
Vertical | True vertically orients text on Asian envelopes. Read/write Boolean.


Envelope Properties (Word)

 Copy code hover
[image]

Envelope Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Address | Returns the envelope delivery address as a Range object. Read-only.
AddressFromLeft | Returns or sets the distance (in points) between the left edge of the envelope and the delivery address. Read/write Single.
AddressFromTop | Returns or sets the distance (in points) between the top edge of the envelope and the delivery address. Read/write Single.
AddressStyle | Returns a Style object that represents the delivery address style for the envelope. Read-only.
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
DefaultFaceUp | True if envelopes are fed face up by default. Read/write Boolean.
DefaultHeight | Returns or sets the default envelope height, in points. Read/write Single.
DefaultOmitReturnAddress | True if the return address is omitted from envelopes by default. Read/write Boolean.
DefaultOrientation | Returns or sets the default orientation for feeding envelopes. Read/write WdEnvelopeOrientation.
DefaultPrintFIMA | True to add a Facing Identification Mark (FIM-A) to envelopes by default. Read/write Boolean.
DefaultSize | Returns or sets the default envelope size. Read/write String.
DefaultWidth | Returns or sets the default envelope width, in points. Read/write Single.
FeedSource | Returns or sets the paper tray for the envelope. Read/write WdPaperTray.
Parent | Returns an Object that represents the parent object of the specified Envelope object.
RecipientNamefromLeft | Returns or sets a Single that represents the position, measured in points, of the recipient's name from the left edge of the envelope. Read/write.
RecipientNamefromTop | Returns or sets a Single that represents the position, measured in points, of the recipient's name from the top edge of the envelope. Read/write.
RecipientPostalfromLeft | Returns or sets a Single that represents the position, measured in points, of the recipient's postal code from the left edge of the envelope. Read/write.
RecipientPostalfromTop | Returns or sets a Single that represents the position, measured in points, of the recipient's postal code from the top edge of the envelope. Read/write.
ReturnAddress | Returns a Range object that represents the envelope return address.
ReturnAddressFromLeft | Returns or sets the distance (in points) between the left edge of the envelope and the return address. Read/write Single.
ReturnAddressFromTop | Returns or sets the distance (in points) between the top edge of the envelope and the return address. Read/write Single.
ReturnAddressStyle | Returns a Style object that represents the return address style for the envelope.
SenderNamefromLeft | Returns or sets a Single that represents the position, measured in points, of the sender's name from the left edge of the envelope. Read/write.
SenderNamefromTop | Returns or sets a Single that represents the position, measured in points, of the sender's name from the top edge of the envelope. Read/write.
SenderPostalfromLeft | Returns or sets a Single that represents the position, measured in points, of the sender's postal code from the left edge of the envelope. Read/write.
SenderPostalfromTop | Returns or sets a Single that represents the position, measured in points, of the sender's postal code from the top edge of the envelope. Read/write.
Vertical | True vertically orients text on Asian envelopes. Read/write Boolean.


Envelope.Address Property (Word)

 Copy code hover
[image]

Envelope.Address Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the envelope delivery address as a Range object. Read-only.

Syntax

expression .Address

expression Required. A variable that represents an Envelope object.

Example

This example displays the delivery address if an envelope has been added to the document; otherwise, it displays a message.

VBA Copy code Copy code
On Error GoTo errhandler
addr = ActiveDocument.Envelope.Address.Text
MsgBox Prompt:=addr, Title:="Delivery Address"
errhandler:
If Err = 5852 Then MsgBox "Insert an envelope into the document"

See also

Concepts

Envelope Object

Other resources

Envelope Object Members


Envelope.AddressFromLeft Property (Word)

 Copy code hover
[image]

Envelope.AddressFromLeft Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the distance (in points) between the left edge of the envelope and the delivery address. Read/write Single.

Syntax

expression .AddressFromLeft

expression A variable that represents a Envelope object.

Remarks

If you use this property before an envelope has been added to the document, an error occurs.

Example

This example creates a new document and adds an envelope with a predefined delivery address and return address. The example then sets the distance between the left edge of the envelope and the delivery address to 3.75 inches.

VBA Copy code Copy code
Dim strAddress As String
Dim strReturn As String

strAddress = "James Allard" & vbCr & "123 Skye St." & vbCr _
 & "Our Town, WA 98004"
strReturn = "Rich Andrews" & vbCr & "123 Main" & vbCr _
 & "Other Town, WA 98004"

With Documents.Add.Envelope
 .Insert Address:=strAddress, ReturnAddress:=strReturn
 .AddressFromLeft = InchesToPoints(3.75)
End With
ActiveDocument.ActiveWindow.View.Type = wdPrintView

See also

Concepts

Envelope Object

Other resources

Envelope Object Members


Envelope.AddressFromTop Property (Word)

 Copy code hover
[image]

Envelope.AddressFromTop Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the distance (in points) between the top edge of the envelope and the delivery address. Read/write Single.

Syntax

expression .AddressFromTop

expression A variable that represents a Envelope object.

Remarks

If you use this property before an envelope has been added to the document, an error occurs.

Example

This example creates a new document and adds an envelope with a predefined delivery address and return address. The example then sets the distance between the top edge of the envelope and the delivery address to 1.75 inches and sets the distance between the left edge of the envelope and the delivery address is set to 3.75 inches.

VBA Copy code Copy code
Dim strAddress As String
Dim strReturn As String
VBA Copy code Copy code
strAddress = "Michael Bunney" & vbCr & "123 Skye St." & vbCr _
 & "Our Town, WA 98040"
strReturn = "Kate Dresen" & vbCr & "123 Main" & vbCr _
 & "Other Town, WA 98040"

With Documents.Add.Envelope
 .Insert Address:=strAddress, ReturnAddress:=strReturn
 .AddressFromTop = InchesToPoints(1.75)
 .AddressFromLeft = InchesToPoints(3.75)
End With

ActiveDocument.ActiveWindow.View.Type = wdPrintView

See also

Concepts

Envelope Object

Other resources

Envelope Object Members


Envelope.AddressStyle Property (Word)

 Copy code hover
[image]

Envelope.AddressStyle Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Style object that represents the delivery address style for the envelope. Read-only.

Syntax

expression .AddressStyle

expression A variable that represents a Envelope object.

Remarks

If an envelope is added to the document, text formatted with the Envelope Address style is automatically updated.

Example

This example modifies the font formatting associated with the Envelope Address style.

VBA Copy code Copy code
With ActiveDocument.Envelope.AddressStyle.Font
 .Bold = False
 .Name = "Times New Roman"
 .Size = 16
End With

See also

Concepts

Envelope Object

Other resources

Envelope Object Members


Envelope.Application Property (Word)

 Copy code hover
[image]

Envelope.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents an Envelope object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

Envelope Object

Other resources

Envelope Object Members


Envelope.Creator Property (Word)

 Copy code hover
[image]

Envelope.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents an Envelope object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Envelope Object

Other resources

Envelope Object Members


Envelope.DefaultFaceUp Property (Word)

 Copy code hover
[image]

Envelope.DefaultFaceUp Property (Word)
See also Send feedback

Published: July 16, 2012

True if envelopes are fed face up by default. Read/write Boolean.

Syntax

expression .DefaultFaceUp

expression A variable that represents a Envelope object.

Example

This example sets envelopes to be fed face up by default. The UpdateDocument method updates the envelope in the active document.

VBA Copy code Copy code
With ActiveDocument.Envelope
 .DefaultFaceUp = True
 .DefaultOrientation = wdCenterPortrait
 .UpdateDocument
End With

This example displays a message telling the user how to feed the envelopes into the printer based on the default setting.

VBA Copy code Copy code
If ActiveDocument.Envelope.DefaultFaceUp = True Then
 MsgBox "Feed envelopes face up."
Else
 MsgBox "Feed envelopes face down."
End If

See also

Concepts

Envelope Object

Other resources

Envelope Object Members


Envelope.DefaultHeight Property (Word)

 Copy code hover
[image]

Envelope.DefaultHeight Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the default envelope height, in points. Read/write Single.

Syntax

expression .DefaultHeight

expression A variable that represents a Envelope object.

Remarks

If you set either the DefaultHeight or DefaultWidth property, the envelope size is automatically changed to Custom Size in the Envelope Options dialog box (Tools menu). Use the DefaultSize property to set the default size to a predefined size.

Example

This example sets the default envelope size to 4.5 inches by 7.5 inches.

VBA Copy code Copy code
With ActiveDocument.Envelope
 .DefaultHeight = InchesToPoints(4.5)
 .DefaultWidth = InchesToPoints(7.5)
End With

See also

Concepts

Envelope Object

Other resources

Envelope Object Members


Envelope.DefaultOmitReturnAddress Property (Word)

 Copy code hover
[image]

Envelope.DefaultOmitReturnAddress Property (Word)
See also Send feedback

Published: July 16, 2012

True if the return address is omitted from envelopes by default. Read/write Boolean.

Syntax

expression .DefaultOmitReturnAddress

expression A variable that represents a Envelope object.

Example

This example omits return addresses from new envelopes by default.

VBA Copy code Copy code
ActiveDocument.Envelope.DefaultOmitReturnAddress = True

This example displays the return address status in a message box.

VBA Copy code Copy code
If ActiveDocument.Envelope.DefaultOmitReturnAddress = True Then
 MsgBox "A return address is not included by default."
Else
 MsgBox "A return address is included by default."
End If

See also

Concepts

Envelope Object

Other resources

Envelope Object Members


Envelope.DefaultOrientation Property (Word)

 Copy code hover
[image]

Envelope.DefaultOrientation Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the default orientation for feeding envelopes. Read/write WdEnvelopeOrientation.

Syntax

expression .DefaultOrientation

expression Required. A variable that represents an Envelope object.

Example

This example sets envelopes to be fed face up, centered, and in portrait orientation.

VBA Copy code Copy code
With ActiveDocument.Envelope
 .DefaultFaceUp = True
 .DefaultOrientation = wdCenterPortrait
 MsgBox "Feed envelopes centered, face up, " _
 & "in portrait orientation"
End With

See also

Concepts

Envelope Object

Other resources

Envelope Object Members


Envelope.DefaultPrintFIMA Property (Word)

 Copy code hover
[image]

Envelope.DefaultPrintFIMA Property (Word)
See also Send feedback

Published: July 16, 2012

True to add a Facing Identification Mark (FIM-A) to envelopes by default. Read/write Boolean.

Syntax

expression .DefaultPrintFIMA

expression A variable that represents a Envelope object.

Remarks

This property applies to U.S. mail only. A FIM-A code is used to presort courtesy reply mail.

Example

This example sets the default envelope settings to include a Facing Identification Mark (FIM-A).

VBA Copy code Copy code
With ActiveDocument.Envelope
 .DefaultPrintFIMA = True
End With

See also

Concepts

Envelope Object

Other resources

Envelope Object Members


Envelope.DefaultSize Property (Word)

 Copy code hover
[image]

Envelope.DefaultSize Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the default envelope size. Read/write String.

Syntax

expression .DefaultSize

expression A variable that represents a Envelope object.

Remarks

The string that is returned corresponds to the right side of the string that appears in the Envelope Size box in the Envelope Options dialog box. If you set either the DefaultHeight or DefaultWidth property, the envelope size is automatically changed to Custom Size in the Envelope Options dialog box (Tools menu) and this property returns "Custom size."

Example

This example sets the default envelope size to C4 (229 x 324 mm).

VBA Copy code Copy code
ActiveDocument.Envelope.DefaultSize = "C4"

This example asks the user whether or not they want to change the default envelope size to Size 10. If the answer is yes, the default size is changed accordingly. The UpdateDocument method changes the envelope size for the active document. If an envelope has not been added to the active document, a message box is displayed.

VBA Copy code Copy code
Sub exDefaultSize()

 Dim intResponse As Integer

 On Error GoTo errhandler
 intResponse = MsgBox("Do you want to set the " _
 & "default envelope to Size 10?", 4)
 If intResponse = vbYes Then
 With ActiveDocument.Envelope
 .DefaultSize = "Size 10"
 .UpdateDocument
 End With
 End If

 Exit Sub

errhandler:
 If Err = 5852 Then _
 MsgBox "An envelope isn't part of this document"
End Sub

See also

Concepts

Envelope Object

Other resources

Envelope Object Members


Envelope.DefaultWidth Property (Word)

 Copy code hover
[image]

Envelope.DefaultWidth Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the default envelope width, in points. Read/write Single.

Syntax

expression .DefaultWidth

expression A variable that represents a Envelope object.

Remarks

If you set the DefaultHeight or DefaultWidth property, the envelope size is automatically changed to Custom Size in the Envelope Options dialog box (Tools menu). Use the DefaultSize property to set the default size to a predefined size.

Example

This example sets the default custom envelope width and height and adds an envelope to the active document.

VBA Copy code Copy code
Dim strAddress As String
Dim strReturn As String

strAddress = "Tim O' Brien " & vbCr & "123 Skye St." _
 & vbCr & "Bellevue, WA 98004"
strReturn = "Dave Edson" & vbCr & "123 West Main" _
 & vbCr & "Seattle, WA 98004"

With ActiveDocument.Envelope
 .DefaultWidth = InchesToPoints(9)
 .DefaultHeight = InchesToPoints(3.85)
End With

ActiveDocument.Envelope.Insert _
 Address:=strAddress, ReturnAddress:=strReturn

See also

Concepts

Envelope Object

Other resources

Envelope Object Members


Envelope.FeedSource Property (Word)

 Copy code hover
[image]

Envelope.FeedSource Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the paper tray for the envelope. Read/write WdPaperTray.

Syntax

expression .FeedSource

expression Required. A variable that represents an Envelope object.

Example

This example asks the user whether envelopes are fed into the printer manually. If the answer is yes, the example sets the paper tray to manual envelope feed.

VBA Copy code Copy code
Sub exFeedSource()

 Dim intResponse As Integer

 intResponse = _
 MsgBox("Are the envelopes manually fed?", vbYesNo)
 If intResponse = vbYes then
 On Error GoTo errhandler
 ActiveDocument.Envelope.FeedSource = _
 wdPrinterManualEnvelopeFeed
 End If

 Exit Sub

errhandler:
 If Err = 5852 Then MsgBox _
 "Envelope not part of the active document"

End Sub

See also

Concepts

Envelope Object

Other resources

Envelope Object Members


Envelope.Parent Property (Word)

 Copy code hover
[image]

Envelope.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Envelope object.

Syntax

expression .Parent

expression Required. A variable that represents an Envelope object.

See also

Concepts

Envelope Object

Other resources

Envelope Object Members


Envelope.RecipientNamefromLeft Property (Word)

 Copy code hover
[image]

Envelope.RecipientNamefromLeft Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Single that represents the position, measured in points, of the recipient's name from the left edge of the envelope. Read/write.

Syntax

expression .RecipientNamefromLeft

expression An expression that returns an Envelope object.

Remarks

Use this property for Asian language envelopes.

Example

This example checks that the active document is a mail merge envelope and that it is formatted for vertical type. If so, it positions the recipient and sender address information.

VBA Copy code Copy code
Sub NewEnvelopeMerge()
 With ActiveDocument
 If .MailMerge.MainDocumentType = wdEnvelopes Then
 With ActiveDocument.Envelope
 If .Vertical = True Then
 .RecipientNamefromLeft = InchesToPoints(2.5)
 .RecipientNamefromTop = InchesToPoints(2)
 .RecipientPostalfromLeft = InchesToPoints(1.5)
 .RecipientPostalfromTop = InchesToPoints(0.5)
 .SenderNamefromLeft = InchesToPoints(0.5)
 .SenderNamefromTop = InchesToPoints(2)
 .SenderPostalfromLeft = InchesToPoints(0.5)
 .SenderPostalfromTop = InchesToPoints(3)
 End If
 End With
 End If
 End With
End Sub

See also

Concepts

Envelope Object

Other resources

Envelope Object Members


Envelope.RecipientNamefromTop Property (Word)

 Copy code hover
[image]

Envelope.RecipientNamefromTop Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Single that represents the position, measured in points, of the recipient's name from the top edge of the envelope. Read/write.

Syntax

expression .RecipientNamefromTop

expression An expression that returns an Envelope object.

Remarks

Use this property for Asian language envelopes.

Example

This example checks that the active document is a mail merge envelope and that it is formatted for vertical type. If so, it positions the recipient and sender address information.

VBA Copy code Copy code
Sub NewEnvelopeMerge()
 With ActiveDocument
 If .MailMerge.MainDocumentType = wdEnvelopes Then
 With ActiveDocument.Envelope
 If .Vertical = True Then
 .RecipientNamefromLeft = InchesToPoints(2.5)
 .RecipientNamefromTop = InchesToPoints(2)
 .RecipientPostalfromLeft = InchesToPoints(1.5)
 .RecipientPostalfromTop = InchesToPoints(0.5)
 .SenderNamefromLeft = InchesToPoints(0.5)
 .SenderNamefromTop = InchesToPoints(2)
 .SenderPostalfromLeft = InchesToPoints(0.5)
 .SenderPostalfromTop = InchesToPoints(3)
 End If
 End With
 End If
 End With
End Sub

See also

Concepts

Envelope Object

Other resources

Envelope Object Members


Envelope.RecipientPostalfromLeft Property (Word)

 Copy code hover
[image]

Envelope.RecipientPostalfromLeft Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Single that represents the position, measured in points, of the recipient's postal code from the left edge of the envelope. Read/write.

Syntax

expression .RecipientPostalfromLeft

expression An expression that returns an Envelope object.

Remarks

Use this property for Asian language envelopes.

Example

This example checks that the active document is a mail merge envelope and that it is formatted for vertical type. If so, it positions the recipient and sender address information.

VBA Copy code Copy code
Sub NewEnvelopeMerge()
 With ActiveDocument
 If .MailMerge.MainDocumentType = wdEnvelopes Then
 With ActiveDocument.Envelope
 If .Vertical = True Then
 .RecipientNamefromLeft = InchesToPoints(2.5)
 .RecipientNamefromTop = InchesToPoints(2)
 .RecipientPostalfromLeft = InchesToPoints(1.5)
 .RecipientPostalfromTop = InchesToPoints(0.5)
 .SenderNamefromLeft = InchesToPoints(0.5)
 .SenderNamefromTop = InchesToPoints(2)
 .SenderPostalfromLeft = InchesToPoints(0.5)
 .SenderPostalfromTop = InchesToPoints(3)
 End If
 End With
 End If
 End With
End Sub

See also

Concepts

Envelope Object

Other resources

Envelope Object Members


Envelope.RecipientPostalfromTop Property (Word)

 Copy code hover
[image]

Envelope.RecipientPostalfromTop Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Single that represents the position, measured in points, of the recipient's postal code from the top edge of the envelope. Read/write.

Syntax

expression .RecipientPostalfromTop

expression An expression that returns an Envelope object.

Remarks

Use this property for Asian language envelopes.

Example

This example checks that the active document is a mail merge envelope and that it is formatted for vertical type. If so, it positions the recipient and sender address information.

VBA Copy code Copy code
Sub NewEnvelopeMerge()
 With ActiveDocument
 If .MailMerge.MainDocumentType = wdEnvelopes Then
 With ActiveDocument.Envelope
 If .Vertical = True Then
 .RecipientNamefromLeft = InchesToPoints(2.5)
 .RecipientNamefromTop = InchesToPoints(2)
 .RecipientPostalfromLeft = InchesToPoints(1.5)
 .RecipientPostalfromTop = InchesToPoints(0.5)
 .SenderNamefromLeft = InchesToPoints(0.5)
 .SenderNamefromTop = InchesToPoints(2)
 .SenderPostalfromLeft = InchesToPoints(0.5)
 .SenderPostalfromTop = InchesToPoints(3)
 End If
 End With
 End If
 End With
End Sub

See also

Concepts

Envelope Object

Other resources

Envelope Object Members


Envelope.ReturnAddress Property (Word)

 Copy code hover
[image]

Envelope.ReturnAddress Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the envelope return address.

Syntax

expression .ReturnAddress

expression Required. A variable that represents an Envelope object.

Remarks

An error occurs if you use this property before adding an envelope to the document.

Example

This example displays the return address if an envelope has been added to the active document; otherwise, a message box is displayed.

VBA Copy code Copy code
On Error GoTo errhandler
addr = ActiveDocument.Envelope.ReturnAddress.Text
MsgBox Prompt:=addr, Title:="Return Address"
errhandler:
If Err = 5852 Then MsgBox _
 "The active document doesn't include an envelope"

See also

Concepts

Envelope Object

Other resources

Envelope Object Members


Envelope.ReturnAddressFromLeft Property (Word)

 Copy code hover
[image]

Envelope.ReturnAddressFromLeft Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the distance (in points) between the left edge of the envelope and the return address. Read/write Single.

Syntax

expression .ReturnAddressFromLeft

expression An expression that returns an Envelope object.

Remarks

If you use this property before an envelope has been added to the document, an error occurs.

Example

This example creates a new document and adds an envelope with a predefined delivery address and return address. The example then sets the distance between the left edge of the envelope and the return address to 0.75 inch.

VBA Copy code Copy code
addr = "Karin Gallagher" & vbCr & "123 Skye St." _
 & vbCr & "Our Town, WA 98004"
retaddr = "Don Funk" & vbCr & "123 Main" _
 & vbCr & "Other Town, WA 98040"
With Documents.Add.Envelope
 .Insert Address:=addr, ReturnAddress:=retaddr
 .ReturnAddressFromLeft = InchesToPoints(0.75)
End With
ActiveDocument.ActiveWindow.View.Type = wdPrintView

See also

Concepts

Envelope Object

Other resources

Envelope Object Members


Envelope.ReturnAddressFromTop Property (Word)

 Copy code hover
[image]

Envelope.ReturnAddressFromTop Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the distance (in points) between the top edge of the envelope and the return address. Read/write Single.

Syntax

expression .ReturnAddressFromTop

expression An expression that returns an Envelope object.

Remarks

If you use this property before an envelope has been added to the document, an error occurs.

Example

This example creates a new document and adds an envelope with a predefined delivery address and return address. The example then sets the distance between the top edge of the envelope and the return address to 0.5 inch and sets the distance between the left edge of the envelope and the return address to 0.75 inch.

VBA Copy code Copy code
addr = "Eric Lang" & vbCr & "123 Main" _
 & vbCr & "Seattle, WA 98040"
retaddr = "Nate Sun" & vbCr & "123 Main" _
 & vbCr & "Bellevue, WA 98004"
With Documents.Add.Envelope
 .Insert Address:=addr, ReturnAddress:=retaddr
 .ReturnAddressFromTop = InchesToPoints(0.5)
 .ReturnAddressFromLeft = InchesToPoints(0.75)
End With

See also

Concepts

Envelope Object

Other resources

Envelope Object Members


Envelope.ReturnAddressStyle Property (Word)

 Copy code hover
[image]

Envelope.ReturnAddressStyle Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Style object that represents the return address style for the envelope.

Syntax

expression .ReturnAddressStyle

expression An expression that returns an Envelope object.

Remarks

If an envelope is added to the document, text formatted with the Envelope Return style is automatically updated.

Example

This example displays the style name and description of the envelope return address.

VBA Copy code Copy code
Set myStyle = ActiveDocument.Envelope.ReturnAddressStyle
MsgBox Prompt:=myStyle.Description, Title:=myStyle.NameLocal

This example sets the line spacing and space-after formatting for the envelope return address style.

VBA Copy code Copy code
With ActiveDocument.Envelope.ReturnAddressStyle.ParagraphFormat
 .LineSpacingRule = wdLineSpaceExactly
 .LineSpacing = 13
 .SpaceAfter = 6
End With

See also

Concepts

Envelope Object

Other resources

Envelope Object Members


Envelope.SenderNamefromLeft Property (Word)

 Copy code hover
[image]

Envelope.SenderNamefromLeft Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Single that represents the position, measured in points, of the sender's name from the left edge of the envelope. Read/write.

Syntax

expression .SenderNamefromLeft

expression An expression that returns an Envelope object.

Remarks

Use this property for Asian language envelopes.

Example

This example checks that the active document is a mail merge envelope and that it is formatted for vertical type. If so, it positions the recipient and sender address information.

VBA Copy code Copy code
Sub NewEnvelopeMerge()
 With ActiveDocument
 If .MailMerge.MainDocumentType = wdEnvelopes Then
 With ActiveDocument.Envelope
 If .Vertical = True Then
 .RecipientNamefromLeft = InchesToPoints(2.5)
 .RecipientNamefromTop = InchesToPoints(2)
 .RecipientPostalfromLeft = InchesToPoints(1.5)
 .RecipientPostalfromTop = InchesToPoints(0.5)
 .SenderNamefromLeft = InchesToPoints(0.5)
 .SenderNamefromTop = InchesToPoints(2)
 .SenderPostalfromLeft = InchesToPoints(0.5)
 .SenderPostalfromTop = InchesToPoints(3)
 End If
 End With
 End If
 End With
End Sub

See also

Concepts

Envelope Object

Other resources

Envelope Object Members


Envelope.SenderNamefromTop Property (Word)

 Copy code hover
[image]

Envelope.SenderNamefromTop Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Single that represents the position, measured in points, of the sender's name from the top edge of the envelope. Read/write.

Syntax

expression .SenderNamefromTop

expression An expression that returns an Envelope object.

Remarks

Use this property for Asian language envelopes.

Example

This example checks that the active document is a mail merge envelope and that it is formatted for vertical type. If so, it positions the recipient and sender address information.

VBA Copy code Copy code
Sub NewEnvelopeMerge()
 With ActiveDocument
 If .MailMerge.MainDocumentType = wdEnvelopes Then
 With ActiveDocument.Envelope
 If .Vertical = True Then
 .RecipientNamefromLeft = InchesToPoints(2.5)
 .RecipientNamefromTop = InchesToPoints(2)
 .RecipientPostalfromLeft = InchesToPoints(1.5)
 .RecipientPostalfromTop = InchesToPoints(0.5)
 .SenderNamefromLeft = InchesToPoints(0.5)
 .SenderNamefromTop = InchesToPoints(2)
 .SenderPostalfromLeft = InchesToPoints(0.5)
 .SenderPostalfromTop = InchesToPoints(3)
 End If
 End With
 End If
 End With
End Sub

See also

Concepts

Envelope Object

Other resources

Envelope Object Members


Envelope.SenderPostalfromLeft Property (Word)

 Copy code hover
[image]

Envelope.SenderPostalfromLeft Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Single that represents the position, measured in points, of the sender's postal code from the left edge of the envelope. Read/write.

Syntax

expression .SenderPostalfromLeft

expression An expression that returns an Envelope object.

Remarks

Use this property for Asian language envelopes.

Example

This example checks that the active document is a mail merge envelope and that it is formatted for vertical type. If so, it positions the recipient and sender address information.

VBA Copy code Copy code
Sub NewEnvelopeMerge()
 With ActiveDocument
 If .MailMerge.MainDocumentType = wdEnvelopes Then
 With ActiveDocument.Envelope
 If .Vertical = True Then
 .RecipientNamefromLeft = InchesToPoints(2.5)
 .RecipientNamefromTop = InchesToPoints(2)
 .RecipientPostalfromLeft = InchesToPoints(1.5)
 .RecipientPostalfromTop = InchesToPoints(0.5)
 .SenderNamefromLeft = InchesToPoints(0.5)
 .SenderNamefromTop = InchesToPoints(2)
 .SenderPostalfromLeft = InchesToPoints(0.5)
 .SenderPostalfromTop = InchesToPoints(3)
 End If
 End With
 End If
 End With
End Sub

See also

Concepts

Envelope Object

Other resources

Envelope Object Members


Envelope.SenderPostalfromTop Property (Word)

 Copy code hover
[image]

Envelope.SenderPostalfromTop Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Single that represents the position, measured in points, of the sender's postal code from the top edge of the envelope. Read/write.

Syntax

expression .SenderPostalfromTop

expression An expression that returns an Envelope object.

Remarks

Use this property for Asian language envelopes.

Example

This example checks that the active document is a mail merge envelope and that it is formatted for vertical type. If so, it positions the recipient and sender address information.

VBA Copy code Copy code
Sub NewEnvelopeMerge()
 With ActiveDocument
 If .MailMerge.MainDocumentType = wdEnvelopes Then
 With ActiveDocument.Envelope
 If .Vertical = True Then
 .RecipientNamefromLeft = InchesToPoints(2.5)
 .RecipientNamefromTop = InchesToPoints(2)
 .RecipientPostalfromLeft = InchesToPoints(1.5)
 .RecipientPostalfromTop = InchesToPoints(0.5)
 .SenderNamefromLeft = InchesToPoints(0.5)
 .SenderNamefromTop = InchesToPoints(2)
 .SenderPostalfromLeft = InchesToPoints(0.5)
 .SenderPostalfromTop = InchesToPoints(3)
 End If
 End With
 End If
 End With
End Sub

See also

Concepts

Envelope Object

Other resources

Envelope Object Members


Envelope.Vertical Property (Word)

 Copy code hover
[image]

Envelope.Vertical Property (Word)
See also Send feedback

Published: July 16, 2012

True vertically orients text on Asian envelopes. Read/write Boolean.

Syntax

expression .Vertical

expression Required. A variable that represents an Envelope object.

Example

This example determines if the active document is a mail merge envelope document and if the language setting is Chinese, and if so, sets the envelope's orientation to vertical and updates the current document.

VBA Copy code Copy code
Sub VerticalEnvelope()
 If ActiveDocument.MailMerge.MainDocumentType = wdEnvelopes And
 Application.Language = msoLanguageIDChineseHongKong Then
 With ActiveDocument.Envelope
 .Vertical = True
 .UpdateDocument
 End With
 End If
End Sub

See also

Concepts

Envelope Object

Other resources

Envelope Object Members


Envelope Methods (Word)

 Copy code hover
[image]

Envelope Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Insert | Inserts an envelope as a separate section at the beginning of the specified document.
Options | Displays the Envelope Options dialog box.
PrintOut | Prints an envelope without adding the envelope to the active document.
UpdateDocument | Updates the envelope in the document with the current envelope settings.


Envelope.Insert Method (Word)

 Copy code hover
[image]

Envelope.Insert Method (Word)
See also Send feedback

Published: July 16, 2012

Inserts an envelope as a separate section at the beginning of the specified document.

Syntax

expression .Insert(ExtractAddress, Address, AutoText, OmitReturnAddress, ReturnAddress, ReturnAutoText, PrintBarCode, PrintFIMA, Size, Height, Width, FeedSource, AddressFromLeft, AddressFromTop, ReturnAddressFromLeft, ReturnAddressFromTop, DefaultFaceUp, DefaultOrientation, PrintEPostage, Vertical, RecipientNamefromLeft, RecipientNamefromTop, RecipientPostalfromLeft, RecipientPostalfromTop, SenderNamefromLeft, SenderNamefromTop, SenderPostalfromLeft, SenderPostalfromTop)

expression Required. A variable that represents an Envelope object.

Parameters

Name | Required/Optional | Data Type | Description
ExtractAddress | Optional | Variant | True to use the text marked by the EnvelopeAddress bookmark (a user-defined bookmark) as the recipient's address.
Address | Optional | Variant | A string that specifies the recipient's address (ignored if ExtractAddress is True).
AutoText | Optional | Variant | A string that specifies an AutoText entry to use for the address. If specified, Address is ignored.
OmitReturnAddress | Optional | Variant | True to not insert a return address.
ReturnAddress | Optional | Variant | A string that specifies the return address.
ReturnAutoText | Optional | Variant | A string that specifies an AutoText entry to use for the return address. If specified, ReturnAddress is ignored.
PrintBarCode | Optional | Variant | True to add a POSTNET bar code. For U.S. mail only.
PrintFIMA | Optional | Variant | True to add a Facing Identification Mark (FIMA) for use in presorting courtesy reply mail. For U.S. mail only.
Size | Optional | Variant | A string that specifies the envelope size. The string must match one of the sizes listed in the Envelope size box in the Envelope Options dialog box (for example, "Size 10" or "C4").
Height | Optional | Variant | The height of the envelope, measured in points, when the Size argument is set to "Custom size."
Width | Optional | Variant | The width of the envelope, measured in points, when the Size argument is set to "Custom size."
FeedSource | Optional | Variant | True to use the FeedSource property of the Envelope object to specify which paper tray to use when printing the envelope.
AddressFromLeft | Optional | Variant | The distance, measured in points, between the left edge of the envelope and the recipient's address.
AddressFromTop | Optional | Variant | The distance, measured in points, between the top edge of the envelope and the recipient's address.
ReturnAddressFromLeft | Optional | Variant | The distance, measured in points, between the left edge of the envelope and the return address.
ReturnAddressFromTop | Optional | Variant | The distance, measured in points, between the top edge of the envelope and the return address.
DefaultFaceUp | Optional | Variant | True to print the envelope face up, False to print it face down.
DefaultOrientation | Optional | Variant | The orientation for the envelope. Can be any WdEnvelopeOrientation constant.
PrintEPostage | Optional | Variant | True to insert postage from an Internet postage vendor.
Vertical | Optional | Variant | True to print vertical text on the envelope. Used for Asian envelopes. Default is False.
RecipientNamefromLeft | Optional | Variant | Position of the recipient's name, measured in points from the left edge of the envelope. Used for Asian envelopes.
RecipientNamefromTop | Optional | Variant | Position of the recipient's name, measured in points from the top edge of the envelope. Used for Asian envelopes.
RecipientPostalfromLeft | Optional | Variant | Position of the recipient's postal code, measured in points from the left edge of the envelope. Used for Asian envelopes.
RecipientPostalfromTop | Optional | Variant | Position of the recipient's postal code, measured in points from the top edge of the envelope. Used for Asian envelopes.
SenderNamefromLeft | Optional | Variant | Position of the sender's name, measured in points from the left edge of the envelope. Used for Asian envelopes.
SenderNamefromTop | Optional | Variant | Position of the sender's name, measured in points from the top edge of the envelope. Used for Asian envelopes.
SenderPostalfromLeft | Optional | Variant | Position of the sender's postal code, measured in points from the left edge of the envelope. Used for Asian envelopes.
SenderPostalfromTop | Optional | Variant | Position of the sender's postal code, measured in points from the top edge of the envelope. Used for Asian envelopes.

Example

This example adds a Size 10 envelope to the active document by using the addresses stored in the strAddr and strReturnAddr variables.

VBA Copy code Copy code
Sub InsertEnvelope()
 Dim strAddr As String
 Dim strReturnAddr As String
 strAddr = "Max Benson" & vbCr & "123 Skye St." _
 & vbCr & "OurTown, WA 98107"
 strReturnAddr = "Paul Borm" & vbCr & "456 Erde Lane" _
 & vbCr & "OurTown, WA 98107"
 ActiveDocument.Envelope.Insert Address:=strAddr, _
 ReturnAddress:=strReturnAddr, Size:="Size 10"
End Sub

See also

Concepts

Envelope Object

Other resources

Envelope Object Members


Envelope.Options Method (Word)

 Copy code hover
[image]

Envelope.Options Method (Word)
See also Send feedback

Published: July 16, 2012

Displays the Envelope Options dialog box.

Syntax

expression .Options

expression Required. A variable that represents an Envelope object.

Remarks

The Options method works only if the document is the main document of an envelope mail merge.

Example

This example checks that the active document is an envelope mail merge main document, and if it is, displays the Envelope Options dialog box.

VBA Copy code Copy code
Sub EnvelopeOptions()
 If ActiveDocument.MailMerge.MainDocumentType = wdEnvelopes Then
 ActiveDocument.Envelope.Options
 End If
End Sub

See also

Concepts

Envelope Object

Other resources

Envelope Object Members


Envelope.PrintOut Method (Word)

 Copy code hover
[image]

Envelope.PrintOut Method (Word)
See also Send feedback

Published: July 16, 2012

Prints an envelope without adding the envelope to the active document.

Syntax

expression .PrintOut(ExtractAddress, Address, AutoText, OmitReturnAddress, ReturnAddress, ReturnAutoText, PrintBarCode, PrintFIMA, Size, Height, Width, FeedSource, AddressFromLeft, AddressFromTop, ReturnAddressFromLeft, ReturnAddressFromTop, DefaultFaceUp, DefaultOrientation, PrintEPostage, Vertical, RecipientNamefromLeft, RecipientNamefromTop, RecipientPostalfromLeft, RecipientPostalfromTop, SenderNamefromLeft, SenderNamefromTop, SenderPostalfromLeft, SenderPostalfromTop)

expression Required. A variable that represents an Envelope object.

Parameters

Name | Required/Optional | Data Type | Description
ExtractAddress | Optional | Variant | True to use the text marked by the "EnvelopeAddress" bookmark (a user-defined bookmark) as the recipient's address.
Address | Optional | Variant | A string that specifies the recipient's address (ignored if ExtractAddress is True).
AutoText | Optional | Variant | The name of the AutoText entry that includes a recipient's address.
OmitReturnAddress | Optional | Variant | True to omit the return address.
ReturnAddress | Optional | Variant | A string that specifies the return address.
ReturnAutoText | Optional | Variant | The name of the AutoText entry that includes a return address.
PrintBarCode | Optional | Variant | True to add a POSTNET bar code. For U.S. mail only.
PrintFIMA | Optional | Variant | True to add a Facing Identification Mark (FIM-A) for use in presorting courtesy reply mail. For U.S. mail only.
Size | Optional | Variant | A string that specifies the envelope size. The string should match one of the sizes listed on the left side of the Envelope size box in the Envelope Options dialog box (for example, "Size 10").
Height | Optional | Variant | The height of the envelope (in points) when the Size argument is set to "Custom size".
Width | Optional | Variant | The width of the envelope (in points) when the Size argument is set to "Custom size".
FeedSource | Optional | Variant | True to use the FeedSource property of the Envelope object to specify which paper tray to use when printing the envelope.
AddressFromLeft | Optional | Variant | The distance (in points) between the left edge of the envelope and the recipient's address.
AddressFromTop | Optional | Variant | The distance (in points) between the top edge of the envelope and the recipient's address.
ReturnAddressFromLeft | Optional | Variant | The distance (in points) between the left edge of the envelope and the return address.
ReturnAddressFromTop | Optional | Variant | The distance (in points) between the top edge of the envelope and the return address.
DefaultFaceUp | Optional | Variant | True to print the envelope face up; False to print it face down.
DefaultOrientation | Optional | Variant | The orientation of the envelope. Can be any WdEnvelopeOrientation constant.
PrintEPostage | Optional | Variant | True to print postage using an Internet e-postage vendor.
Vertical | Optional | Variant | True prints text vertically on the envelope. Used for Asian-language envelopes.
RecipientNamefromLeft | Optional | Variant | The position of the recipient's name, measured in points, from the left edge of the envelope. Used for Asian-language envelopes.
RecipientNamefromTop | Optional | Variant | The position of the recipient's name, measured in points, from the top edge of the envelope. Used for Asian-language envelopes.
RecipientPostalfromLeft | Optional | Variant | The position of the recipient's postal code, measured in points, from the left edge of the envelope. Used for Asian-language envelopes.
RecipientPostalfromTop | Optional | Variant | The position of the recipient's postal code, measured in points, from the top edge of the envelope. Used for Asian-language envelopes.
SenderNamefromLeft | Optional | Variant | The position of the sender's name, measured in points, from the left edge of the envelope. Used for Asian-language envelopes.
SenderNamefromTop | Optional | Variant | The position of the sender's name, measured in points, from the top edge of the envelope. Used for Asian-language envelopes.
SenderPostalfromLeft | Optional | Variant | The position of the sender's postal code, measured in points, from the left edge of the envelope. Used for Asian-language envelopes.
SenderPostalfromTop | Optional | Variant | The position of the sender's postal code, measured in points, from the top edge of the envelope. Used for Asian-language envelopes.

Example

This example prints an envelope using the user address as the return address and a predefined recipient address.

VBA Copy code Copy code
recep = "Don Funk" & vbCr & "123 Skye St." & vbCr & _
    "OurTown, WA 98107"
ActiveDocument.Envelope.PrintOut Address:=recep, _
    ReturnAddress:=Application.UserAddress, _
    Size:="Size 10", PrintBarCode:=True

See also

Concepts

Envelope Object

Other resources

Envelope Object Members


Envelope.UpdateDocument Method (Word)

 Copy code hover
[image]

Envelope.UpdateDocument Method (Word)
See also Send feedback

Published: July 16, 2012

Updates the envelope in the document with the current envelope settings.

Syntax

expression .UpdateDocument

expression Required. A variable that represents an Envelope object.

Remarks

If you use this property before an envelope has been added to the document, an error occurs.

Example

This example formats the envelope in Report.doc to use a custom envelope size (4.5 inches by 7.5 inches).

VBA Copy code Copy code
Sub UpdateEnvelope()

 On Error GoTo errhandler

 With Documents("Report.doc").Envelope
 .DefaultHeight = InchesToPoints(4.5)
 .DefaultWidth = InchesToPoints(7.5)
 .UpdateDocument
 End With

 Exit Sub

errhandler:

 If Err = 5852 Then _
 MsgBox "Report.doc doesn't include an envelope"

End Sub

This example adds an envelope to the active document, using predefined addresses. The default envelope bar code and Facing Identification Mark (FIM-A) settings are set to True, and the envelope in the active document is updated.

VBA Copy code Copy code
Dim strAddress As String
Dim strReturn As String

strAddress = "Darlene Rudd" & vbCr & "1234 E. Main St." _
 & vbCr & "Our Town, WA 98004"
strReturn = "Patricia Reed" & vbCr & "N. 33rd St." _
 & vbCr & "Other Town, WA 98040"
ActiveDocument.Envelope.Insert _
 Address:=strAddress, ReturnAddress:=strReturn
With ActiveDocument.Envelope
 .DefaultPrintBarCode = True
 .DefaultPrintFIMA = True
 .UpdateDocument
End With

See also

Concepts

Envelope Object

Other resources

Envelope Object Members


ErrorBars Object (Word)

 Copy code hover
[image]

ErrorBars Object (Word)
See also Send feedback

Published: July 16, 2012

Represents the error bars on a chart series.

Version Information

Version Added: Word 2007

Remarks

Error bars indicate the degree of uncertainty for chart data. Only series in area, bar, column, line, and scatter groups on a 2-D chart can have error bars. Only series in scatter groups can have x and y error bars. This object is not a collection. There is no object that represents a single error bar; you either enable x error bars or y error bars for all points in a series or you disable them.

The ErrorBar method changes the error bar format and type.

Example

Use the ErrorBars property to return the ErrorBars object. The following example enables error bars for series one of the first chart in the active document and then sets the end style for the error bars.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.SeriesCollection(1).HasErrorBars = True
 .Chart.SeriesCollection(1).ErrorBars.EndStyle = xlNoCap
 End If
End With

See also

Concepts

Word Object Model Reference

Other resources

ErrorBars Object Members


ErrorBars Members (Word)

 Copy code hover
[image]

ErrorBars Members (Word)
Send feedback

Published: July 16, 2012

Represents the error bars on a chart series.

Methods

Name | Description
ClearFormats | Clears the formatting of the object.
Delete | Deletes the object.
Select | Selects the object.

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
Border | Returns the border of the object. Read-only ChartBorder.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
EndStyle | Returns or sets the end style for the error bars. Read/write Long.
Format | Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.
Name | Returns the name of the object. Read-only String.
Parent | Returns the parent for the specified object. Read-only Object.


ErrorBars Properties (Word)

 Copy code hover
[image]

ErrorBars Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
Border | Returns the border of the object. Read-only ChartBorder.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
EndStyle | Returns or sets the end style for the error bars. Read/write Long.
Format | Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.
Name | Returns the name of the object. Read-only String.
Parent | Returns the parent for the specified object. Read-only Object.


ErrorBars.Application Property (Word)

 Copy code hover
[image]

ErrorBars.Application Property (Word)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Application

expression A variable that represents an ErrorBars object.

Example

The following example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveDocument
If myObject.Application.Value = "Microsoft Word" Then
 MsgBox "This is a Word Application object."
Else
 MsgBox "This is not a Word Application object."
End If

See also

Concepts

ErrorBars Object

Other resources

ErrorBars Object Members


ErrorBars.Border Property (Word)

 Copy code hover
[image]

ErrorBars.Border Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the border of the object. Read-only ChartBorder.

Version Information

Version Added: Word 2007

Syntax

expression .Border

expression A variable that represents an ErrorBars object.

See also

Concepts

ErrorBars Object

Other resources

ErrorBars Object Members


ErrorBars.Creator Property (Word)

 Copy code hover
[image]

ErrorBars.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version Information

Version Added: Word 2007

Syntax

expression .Creator

expression A variable that represents an ErrorBars object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD". This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Word has the creator code MSWD. For more information about this property, consult the language reference Help included with Microsoft Office for Mac.

See also

Concepts

ErrorBars Object

Other resources

ErrorBars Object Members


ErrorBars.EndStyle Property (Word)

 Copy code hover
[image]

ErrorBars.EndStyle Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the end style for the error bars. Read/write Long.

Version Information

Version Added: Word 2007

Syntax

expression .EndStyle

expression A variable that represents an ErrorBars object.

Remarks

The value of this property can be one of the following XlEndStyleCap constants:

  • xlCap

  • xlNoCap

Example

The following example sets the end style for the error bars for series one of the first chart in the active document. You should run the example on a 2-D line chart that has Y error bars for the first series.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.SeriesCollection(1).ErrorBars.EndStyle = xlCap
 End If
End With

See also

Concepts

ErrorBars Object

Other resources

ErrorBars Object Members


ErrorBars.Format Property (Word)

 Copy code hover
[image]

ErrorBars.Format Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.

Version Information

Version Added: Word 2007

Syntax

expression .Format

expression A variable that represents an ErrorBars object.

See also

Concepts

ErrorBars Object

Other resources

ErrorBars Object Members


ErrorBars.Name Property (Word)

 Copy code hover
[image]

ErrorBars.Name Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the name of the object. Read-only String.

Version Information

Version Added: Word 2007

Syntax

expression .Name

expression A variable that represents an ErrorBars object.

See also

Concepts

ErrorBars Object

Other resources

ErrorBars Object Members


ErrorBars.Parent Property (Word)

 Copy code hover
[image]

ErrorBars.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the parent for the specified object. Read-only Object.

Version Information

Version Added: Word 2007

Syntax

expression .Parent

expression A variable that represents an ErrorBars object.

See also

Concepts

ErrorBars Object

Other resources

ErrorBars Object Members


ErrorBars Methods (Word)

 Copy code hover
[image]

ErrorBars Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
ClearFormats | Clears the formatting of the object.
Delete | Deletes the object.
Select | Selects the object.


ErrorBars.ClearFormats Method (Word)

 Copy code hover
[image]

ErrorBars.ClearFormats Method (Word)
See also Send feedback

Published: July 16, 2012

Clears the formatting of the object.

Version Information

Version Added: Word 2007

Syntax

expression .ClearFormats

expression A variable that represents an ErrorBars object.

See also

Concepts

ErrorBars Object

Other resources

ErrorBars Object Members


ErrorBars.Delete Method (Word)

 Copy code hover
[image]

ErrorBars.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Version Information

Version Added: Word 2007

Syntax

expression .Delete

expression A variable that represents an ErrorBars object.

See also

Concepts

ErrorBars Object

Other resources

ErrorBars Object Members


ErrorBars.Select Method (Word)

 Copy code hover
[image]

ErrorBars.Select Method (Word)
See also Send feedback

Published: July 16, 2012

Selects the object.

Version Information

Version Added: Word 2007

Syntax

expression .Select

expression A variable that represents an ErrorBars object.

See also

Concepts

ErrorBars Object

Other resources

ErrorBars Object Members


Field Object (Word)

 Copy code hover
[image]

Field Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a field. The Field object is a member of the Fields collection. The Fields collection represents the fields in a selection, range, or document.

Remarks

Use Fields(Index), where Index is the index number, to return a single Field object. The index number represents the position of the field in the selection, range, or document. The following example displays the field code and the result of the first field in the active document.

VBA Copy code Copy code
If ActiveDocument.Fields.Count >= 1 Then
 MsgBox "Code = " & ActiveDocument.Fields(1).Code & vbCr _
 & "Result = " & ActiveDocument.Fields(1).Result & vbCr
End If

Use the Add method to add a field to the Fields collection. The following example inserts a DATE field at the beginning of the selection and then displays the result.

VBA Copy code Copy code
Selection.Collapse Direction:=wdCollapseStart
Set myField = ActiveDocument.Fields.Add(Range:=Selection.Range, _
 Type:=wdFieldDate)
MsgBox myField.Result
Note Note

The wdFieldDate constant is part of the WdFieldType group of constants, which includes all the various field types.

See also

Concepts

Word Object Model Reference

Other resources

Field Object Members


Field Members (Word)

 Copy code hover
[image]

Field Members (Word)
Send feedback

Published: July 16, 2012

Represents a field. The Field object is a member of the Fields collection. The Fields collection represents the fields in a selection, range, or document.

Methods

Name | Description
Copy | Copies the specified field to the Clipboard.
Cut | Removes the specified field from the document and places it on the Clipboard.
Delete | Deletes the specified field.
DoClick | Clicks the specified field.
Select | Selects the specified field.
Unlink | Replaces the specified field with its most recent result.
Update | Updates the result of the field. Returns True if the field is updated successfully.
UpdateSource | Saves the changes made to the results of an INCLUDETEXT field back to the source document.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Code | Returns a Range object that represents a field's code. Read/write.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Data | Returns or sets data in an ADDIN field. Read/write String.
Index | Returns a Long that represents the position of an item in a collection. Read-only.
InlineShape | Returns an InlineShape object that represents the picture, OLE object, or ActiveX control that is the result of an INCLUDEPICTURE or EMBED field.
Kind | Returns the type of link for a Field object. Read-only WdFieldKind.
LinkFormat | Returns a LinkFormat object that represents the link options of the specified field. Read/only.
Locked | True if the specified field is locked. Read/write Boolean.
Next | Returns the next object in the collection. Read-only.
OLEFormat | Returns an OLEFormat object that represents the OLE characteristics (other than linking) for the specified field. Read-only.
Parent | Returns an Object that represents the parent object of the specified Field object.
Previous | Returns the previous object in the collection. Read-only.
Result | Returns a Range object that represents a field's result. Read/write.
ShowCodes | True if field codes are displayed for the specified field instead of field results. Read/write Boolean.
Type | Returns the field type. Read-only WdFieldType.


Field Properties (Word)

 Copy code hover
[image]

Field Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Code | Returns a Range object that represents a field's code. Read/write.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Data | Returns or sets data in an ADDIN field. Read/write String.
Index | Returns a Long that represents the position of an item in a collection. Read-only.
InlineShape | Returns an InlineShape object that represents the picture, OLE object, or ActiveX control that is the result of an INCLUDEPICTURE or EMBED field.
Kind | Returns the type of link for a Field object. Read-only WdFieldKind.
LinkFormat | Returns a LinkFormat object that represents the link options of the specified field. Read/only.
Locked | True if the specified field is locked. Read/write Boolean.
Next | Returns the next object in the collection. Read-only.
OLEFormat | Returns an OLEFormat object that represents the OLE characteristics (other than linking) for the specified field. Read-only.
Parent | Returns an Object that represents the parent object of the specified Field object.
Previous | Returns the previous object in the collection. Read-only.
Result | Returns a Range object that represents a field's result. Read/write.
ShowCodes | True if field codes are displayed for the specified field instead of field results. Read/write Boolean.
Type | Returns the field type. Read-only WdFieldType.


Field.Application Property (Word)

 Copy code hover
[image]

Field.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a Field object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

Field Object

Other resources

Field Object Members


Field.Code Property (Word)

 Copy code hover
[image]

Field.Code Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents a field's code. Read/write.

Syntax

expression .Code

expression A variable that represents a Field object.

Remarks

A field's code is everything that's enclosed by the field characters ({ }) including the leading space and trailing space characters. You can access a field's code without changing the view from field results.

Example

This example displays the field code for each field in the active document.

VBA Copy code Copy code
Dim fieldLoop As Field

For Each fieldLoop In ActiveDocument.Fields
 MsgBox Chr(34) & fieldLoop.Code.Text & Chr(34)
Next fieldLoop

This example changes the field code for the first field in the active document to CREATEDATE.

VBA Copy code Copy code
Dim rngTemp As Range

Set rngTemp = ActiveDocument.Fields(1).Code
rngTemp.Text = " CREATEDATE "
ActiveDocument.Fields(1).Update

This example determines whether the active document includes a mail merge field named "Title."

VBA Copy code Copy code
Dim fieldLoop As Field

For Each fieldLoop In ActiveDocument.MailMerge.Fields
 If InStr(1, fieldLoop.Code.Text, "Title", 1) Then
 MsgBox "A Title merge field is in this document"
 End If
Next fieldLoop

See also

Concepts

Field Object

Other resources

Field Object Members


Field.Creator Property (Word)

 Copy code hover
[image]

Field.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a Field object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Field Object

Other resources

Field Object Members


Field.Data Property (Word)

 Copy code hover
[image]

Field.Data Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets data in an ADDIN field. Read/write String.

Syntax

expression .Data

expression A variable that represents a Field object.

Remarks

The data is not visible in the field code or result; it is only accessible by returning the value of the Data property. If the field isn't an ADDIN field, this property will cause an error.

Example

This example inserts an ADDIN field at the insertion point in the active document and then sets the data for the field.

VBA Copy code Copy code
Dim fldTemp As Field

Selection.Collapse Direction:=wdCollapseStart
Set fldTemp = _
 ActiveDocument.Fields.Add(Range:=Selection.Range, _
 Type:=wdFieldAddin)
fldTemp.Data = "Hidden information"

See also

Concepts

Field Object

Other resources

Field Object Members


Field.Index Property (Word)

 Copy code hover
[image]

Field.Index Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the position of an item in a collection. Read-only.

Syntax

expression .Index

expression Required. A variable that represents a Field object.

Example

This example returns the position of the selected field in the Fields collection.

VBA Copy code Copy code
num = Selection.Fields(1).Index

See also

Concepts

Field Object

Other resources

Field Object Members


Field.InlineShape Property (Word)

 Copy code hover
[image]

Field.InlineShape Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an InlineShape object that represents the picture, OLE object, or ActiveX control that is the result of an INCLUDEPICTURE or EMBED field.

Syntax

expression .InlineShape

expression An expression that returns a Field object.

Remarks

An InlineShape object is treated like a character and is positioned as a character within a line of text.

Example

This example returns the width of the inline shape associated with the first field in the active document. For this example to work, the field must be an INCLUDEPICTURE field.

VBA Copy code Copy code
If ActiveDocument.Fields(1).Type = wdFieldIncludePicture Then
 MsgBox ActiveDocument.Fields(1).InlineShape.Width
End If

See also

Concepts

Field Object

Other resources

Field Object Members


Field.Kind Property (Word)

 Copy code hover
[image]

Field.Kind Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the type of link for a Field object. Read-only WdFieldKind.

Syntax

expression .Kind

expression Required. A variable that represents a Field object.

Example

This example updates all warm link fields in the active document.

VBA Copy code Copy code
For Each aField In ActiveDocument.Fields
 If aField.Kind = wdFieldKindWarm Then aField.Update
Next aField

See also

Concepts

Field Object

Other resources

Field Object Members


Field.LinkFormat Property (Word)

 Copy code hover
[image]

Field.LinkFormat Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a LinkFormat object that represents the link options of the specified field. Read/only.

Syntax

expression .LinkFormat

expression A variable that represents a Field object.

Example

This example updates any fields in the active document that aren't updated automatically.

VBA Copy code Copy code
For Each afield In ActiveDocument.Fields
 If afield.LinkFormat.AutoUpdate = False _
 Then afield.LinkFormat.Update
Next afield

See also

Concepts

Field Object

Other resources

Field Object Members


Field.Locked Property (Word)

 Copy code hover
[image]

Field.Locked Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified field is locked. Read/write Boolean.

Syntax

expression .Locked

expression Required. A variable that represents a Field object.

Remarks

When a field is locked, you cannot update the field results.

Example

This example inserts a DATE field at the beginning of the selection and then locks the field.

VBA Copy code Copy code
Selection.Collapse Direction:=wdCollapseStart
Set myField = ActiveDocument.Fields.Add(Range:=Selection.Range, _
 Type:=wdFieldDate)
myField.Locked = True

See also

Concepts

Field Object

Other resources

Field Object Members


Field.Next Property (Word)

 Copy code hover
[image]

Field.Next Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the next object in the collection. Read-only.

Syntax

expression .Next

expression A variable that represents a Field object.

Example

This example updates the fields in the first section in the active document as long as the Next method returns a Field object and the field isn't a FILLIN field.

VBA Copy code Copy code
If ActiveDocument.Sections(1).Range.Fields.Count >= 1 Then
 Set myField = ActiveDocument.Fields(1)
 While Not (myField Is Nothing)
 If myField.Type <> wdFieldFillIn Then myField.Update
 Set myField = myField.Next
 Wend
End If

See also

Concepts

Field Object

Other resources

Field Object Members


Field.OLEFormat Property (Word)

 Copy code hover
[image]

Field.OLEFormat Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an OLEFormat object that represents the OLE characteristics (other than linking) for the specified field. Read-only.

Syntax

expression .OLEFormat

expression A variable that represents a Field object.

See also

Concepts

Field Object

Other resources

Field Object Members


Field.Parent Property (Word)

 Copy code hover
[image]

Field.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Field object.

Syntax

expression .Parent

expression Required. A variable that represents a Field object.

See also

Concepts

Field Object

Other resources

Field Object Members


Field.Previous Property (Word)

 Copy code hover
[image]

Field.Previous Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the previous object in the collection. Read-only.

Syntax

expression .Previous

expression A variable that represents a Field object.

Example

This example displays the field code of the second-to-last field in the active document.

VBA Copy code Copy code
Set aField = ActiveDocument _
 .Fields(ActiveDocument.Fields.Count).Previous
MsgBox "Field code = " & aField.Code

See also

Concepts

Field Object

Other resources

Field Object Members


Field.Result Property (Word)

 Copy code hover
[image]

Field.Result Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents a field's result. Read/write.

Syntax

expression .Result

expression Required. A variable that represents a Field object.

Remarks

You can access a field result without changing the view from field codes. Use the Text property to return text from a Range object.

Example

This example applies bold formatting to the first field in the selection.

VBA Copy code Copy code
If Selection.Fields.Count >= 1 Then
 Set myRange = Selection.Fields(1).Result
 myRange.Bold = True
End If

See also

Concepts

Field Object

Other resources

Field Object Members


Field.ShowCodes Property (Word)

 Copy code hover
[image]

Field.ShowCodes Property (Word)
See also Send feedback

Published: July 16, 2012

True if field codes are displayed for the specified field instead of field results. Read/write Boolean.

Syntax

expression .ShowCodes

expression An expression that returns a Field object.

Example

This example selects the next field and displays the field codes.

VBA Copy code Copy code
With Selection
 .GoTo What:=wdGoToField
 .Expand Unit:=wdWord
 If .Fields.Count = 1 Then .Fields(1).ShowCodes = True
End With

This example updates and displays the result of the first field in the active document.

VBA Copy code Copy code
If ActiveDocument.Fields.Count >= 1 Then
 With ActiveDocument.Fields(1)
 .Update
 .ShowCodes = False
 End With
End If

See also

Concepts

Field Object

Other resources

Field Object Members


Field.Type Property (Word)

 Copy code hover
[image]

Field.Type Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the field type. Read-only WdFieldType.

Syntax

expression .Type

expression Required. A variable that represents a Field object.

Remarks

Security note Security Note
Dynamic data exchange (DDE) is an older technology that is not secure. If possible, use a more secure alternative to DDE, such as object linking and embedding (OLE).

See also

Concepts

Field Object

Other resources

Field Object Members


Field Methods (Word)

 Copy code hover
[image]

Field Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Copy | Copies the specified field to the Clipboard.
Cut | Removes the specified field from the document and places it on the Clipboard.
Delete | Deletes the specified field.
DoClick | Clicks the specified field.
Select | Selects the specified field.
Unlink | Replaces the specified field with its most recent result.
Update | Updates the result of the field. Returns True if the field is updated successfully.
UpdateSource | Saves the changes made to the results of an INCLUDETEXT field back to the source document.


Field.Copy Method (Word)

 Copy code hover
[image]

Field.Copy Method (Word)
See also Send feedback

Published: July 16, 2012

Copies the specified field to the Clipboard.

Syntax

expression .Copy

expression Required. A variable that represents a Field object.

See also

Concepts

Field Object

Other resources

Field Object Members


Field.Cut Method (Word)

 Copy code hover
[image]

Field.Cut Method (Word)
See also Send feedback

Published: July 16, 2012

Removes the specified field from the document and places it on the Clipboard.

Syntax

expression .Cut

expression Required. A variable that represents a Field object.

Example

This example deletes the first field in the active document and pastes the field at the insertion point.

VBA Copy code Copy code
If ActiveDocument.Fields.Count >= 1 Then
 ActiveDocument.Fields(1).Cut
 Selection.Collapse Direction:=wdCollapseEnd
 Selection.Paste
End If

This example deletes the first word in the first paragraph and pastes the word at the end of the paragraph.

VBA Copy code Copy code
With ActiveDocument.Paragraphs(1).Range
 .Words(1).Cut
 .Collapse Direction:=wdCollapseEnd
 .Move Unit:=wdCharacter, Count:=-1
 .Paste
End With

This example deletes the contents of the selection and pastes them into a new document.

VBA Copy code Copy code
If Selection.Type = wdSelectionNormal Then
 Selection.Cut
 Documents.Add.Content.Paste
End If

See also

Concepts

Field Object

Other resources

Field Object Members


Field.Delete Method (Word)

 Copy code hover
[image]

Field.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the specified field.

Syntax

expression .Delete

expression Required. A variable that represents a Field object.

See also

Concepts

Field Object

Other resources

Field Object Members


Field.DoClick Method (Word)

 Copy code hover
[image]

Field.DoClick Method (Word)
See also Send feedback

Published: July 16, 2012

Clicks the specified field.

Syntax

expression .DoClick

expression Required. A variable that represents a Field object.

Remarks

If the field is a GOTOBUTTON field, this method moves the insertion point to the specified location or selects the specified bookmark. If the field is a MACROBUTTON field, this method runs the specified macro. If the field is a HYPERLINK field, this method jumps to the target location.

Example

If the first field in the selection is a GOTOBUTTON field, this example clicks it (the insertion point is moved to the specified location, or the specified bookmark is selected).

VBA Copy code Copy code
Dim fldTemp

Set fldTemp = Selection.Fields(1)
If fldTemp.Type = wdFieldGoToButton Then fldTemp.DoClick

See also

Concepts

Field Object

Other resources

Field Object Members


Field.Select Method (Word)

 Copy code hover
[image]

Field.Select Method (Word)
See also Send feedback

Published: July 16, 2012

Selects the specified field.

Syntax

expression .Select

expression Required. A variable that represents a Field object.

Remarks

After using this method, use the Selection object to work with the selected items. For more information, see Working with the Selection Object.

Example

This example updates and selects the first field in the active document.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.View.FieldShading = _
 wdFieldShadingWhenSelected
If ActiveDocument.Fields.Count >= 1 Then
 With ActiveDocument.Fields(1)
 .Update
 .Select
 End With
End If

See also

Concepts

Field Object

Other resources

Field Object Members


Field.Unlink Method (Word)

 Copy code hover
[image]

Field.Unlink Method (Word)
See also Send feedback

Published: July 16, 2012

Replaces the specified field with its most recent result.

Syntax

expression .Unlink

expression Required. A variable that represents a Field object.

Remarks

When you unlink a field, the current result is converted to text or a graphic and can no longer be updated automatically. Note that some fields—such as XE (Index Entry) fields and SEQ (Sequence) fields—cannot be unlinked.

Example

This example unlinks the first field in "Sales.doc."

VBA Copy code Copy code
Documents("Sales.doc").Fields(1).Unlink

See also

Concepts

Field Object

Other resources

Field Object Members


Field.Update Method (Word)

 Copy code hover
[image]

Field.Update Method (Word)
See also Send feedback

Published: July 16, 2012

Updates the result of the field. Returns True if the field is updated successfully.

Syntax

expression .Update

expression Required. A variable that represents a Field object.

Return Value

Boolean

Example

This example updates the first field in the active document. A return value of 0 (zero) indicates that the fields were updated without error.

VBA Copy code Copy code
If ActiveDocument.Fields(0).Update = 0 Then
 MsgBox "Update Successful"
Else
 MsgBox "Field " & ActiveDocument.Fields(0).Update & _
 " has an error"
End If

See also

Concepts

Field Object

Other resources

Field Object Members


Field.UpdateSource Method (Word)

 Copy code hover
[image]

Field.UpdateSource Method (Word)
See also Send feedback

Published: July 16, 2012

Saves the changes made to the results of an INCLUDETEXT field back to the source document.

Syntax

expression .UpdateSource

expression Required. A variable that represents a Field object.

Remarks

The source document must be formatted as a Word document.

Example

This example updates the INCLUDETEXT fields in the active document.

VBA Copy code Copy code
Dim fldLoop As Field

For Each fldLoop In ActiveDocument.Fields
 If fldLoop.Type = wdFieldIncludeText Then _
 fldLoop.UpdateSource
Next fldLoop

See also

Concepts

Field Object

Other resources

Field Object Members


Fields Object (Word)

 Copy code hover
[image]

Fields Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of Field objects that represent all the fields in a selection, range, or document.

Remarks

Use the Fields property to return the Fields collection. The following example updates all the fields in the selection.

Note Note

Use the Fields property with a MailMerge object to return a MailMergeFields collection.

VBA Copy code Copy code
Selection.Fields.Update

Use the Add method to add a field to the Fields collection. The following example inserts a DATE field at the beginning of the selection and then displays the result.

VBA Copy code Copy code
Selection.Collapse Direction:=wdCollapseStart
Set myField = ActiveDocument.Fields.Add(Range:=Selection.Range, _
 Type:=wdFieldDate)
MsgBox myField.Result

Use Fields(Index), where Index is the index number, to return a single Field object. The index number represents the position of the field in the selection, range, or document. The following example displays the field code and the result of the first field in the active document.

VBA Copy code Copy code
If ActiveDocument.Fields.Count >= 1 Then
 MsgBox "Code = " & ActiveDocument.Fields(1).Code & vbCr _
 & "Result = " & ActiveDocument.Fields(1).Result & vbCr
End If

The Count property for this collection in a document returns the number of items in the main story only. To count items in other stories use the collection with the Range object.

See also

Concepts

Word Object Model Reference

Other resources

Fields Object Members


Fields Members (Word)

 Copy code hover
[image]

Fields Members (Word)
Send feedback

Published: July 16, 2012

A collection of Field objects that represent all the fields in a selection, range, or document.

Methods

Name | Description
Add | Adds a Field object to the Fields collection. Returns the Field object at the specified range.
Item | Returns an individual Field object in a collection.
ToggleShowCodes | Switches the display of the fields between field codes and field results. Use the ShowCodes property to control the display of an individual field.
Unlink | Replaces all the fields in the Fields collection with their most recent results.
Update | Updates the result of the fields object.
UpdateSource | Saves the changes made to the results of an INCLUDETEXT field back to the source document.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of fields in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Locked | True if all fields in the Fields collection are locked. Read/write Long.
Parent | Returns an Object that represents the parent object of the specified Fields object.


Fields Properties (Word)

 Copy code hover
[image]

Fields Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of fields in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Locked | True if all fields in the Fields collection are locked. Read/write Long.
Parent | Returns an Object that represents the parent object of the specified Fields object.


Fields.Application Property (Word)

 Copy code hover
[image]

Fields.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a Fields collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

Fields Collection Object

Other resources

Fields Object Members


Fields.Count Property (Word)

 Copy code hover
[image]

Fields.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of fields in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents a Fields collection.

See also

Concepts

Fields Collection Object

Other resources

Fields Object Members


Fields.Creator Property (Word)

 Copy code hover
[image]

Fields.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a Fields collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Fields Collection Object

Other resources

Fields Object Members


Fields.Locked Property (Word)

 Copy code hover
[image]

Fields.Locked Property (Word)
See also Send feedback

Published: July 16, 2012

True if all fields in the Fields collection are locked. Read/write Long.

Syntax

expression .Locked

expression Required. A variable that represents a Fields collection.

Remarks

This property can be True, False, or wdUndefined (if some of the fields in the collection are locked and others are not).

Example

This example locks all the fields in the selection.

VBA Copy code Copy code
Selection.Fields.Locked = True

This example displays a message if some of the fields in the active document are locked.

VBA Copy code Copy code
Set theFields = ActiveDocument.Fields
If theFields.Locked = wdUndefined Then
 MsgBox "Some fields are locked"
ElseIf theFields.Locked = False Then
 MsgBox "No fields are locked"
ElseIf theFields.Locked = True Then
 MsgBox "All fields are locked"
End If

See also

Concepts

Fields Collection Object

Other resources

Fields Object Members


Fields.Parent Property (Word)

 Copy code hover
[image]

Fields.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Fields object.

Syntax

expression .Parent

expression Required. A variable that represents a Fields collection.

See also

Concepts

Fields Collection Object

Other resources

Fields Object Members


Fields Methods (Word)

 Copy code hover
[image]

Fields Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Adds a Field object to the Fields collection. Returns the Field object at the specified range.
Item | Returns an individual Field object in a collection.
ToggleShowCodes | Switches the display of the fields between field codes and field results. Use the ShowCodes property to control the display of an individual field.
Unlink | Replaces all the fields in the Fields collection with their most recent results.
Update | Updates the result of the fields object.
UpdateSource | Saves the changes made to the results of an INCLUDETEXT field back to the source document.


Fields.Add Method (Word)

 Copy code hover
[image]

Fields.Add Method (Word)
See also Send feedback

Published: July 16, 2012

Adds a Field object to the Fields collection. Returns the Field object at the specified range.

Syntax

expression .Add(Range, Type, Text, PreserveFormatting)

expression Required. A variable that represents a Fields collection.

Parameters

Name | Required/Optional | Data Type | Description
Range | Required | Range object | The range where you want to add the field. If the range isn't collapsed, the field replaces the range.
Type | Optional | Variant | Can be any WdFieldType constant. For a list of valid constants, consult the Object Browser. The default value is wdFieldEmpty.
Text | Optional | Variant | Additional text needed for the field. For example, if you want to specify a switch for the field, you would add it here.
PreserveFormatting | Optional | Variant | True to have the formatting that's applied to the field preserved during updates.

Return Value

Field

Remarks

You cannot insert some fields (such as wdFieldOCX and wdFieldFormCheckBox) by using the Add method of the Fields collection. Instead, you must use specific methods such as the AddOLEControl method and the Add method for the FormFields collection.

Example

This example inserts a USERNAME field at the beginning of the selection.

VBA Copy code Copy code
Selection.Collapse Direction:=wdCollapseStart
Set myField = ActiveDocument.Fields.Add(Range:=Selection.Range, _
 Type:=wdFieldUserName)

This example inserts a LISTNUM field at the end of the selection. The starting switch is set to begin at 3.

VBA Copy code Copy code
Selection.Collapse Direction:=wdCollapseEnd
ActiveDocument.Fields.Add Range:=Selection.Range, _
 Type:=wdFieldListNum, Text:="\s 3"

This example inserts a DATE field at the beginning of the selection and then displays the result.

VBA Copy code Copy code
Selection.Collapse Direction:=wdCollapseStart
Set myField = ActiveDocument.Fields.Add(Range:=Selection.Range, _
 Type:=wdFieldDate)
MsgBox myField.Result

See also

Concepts

Fields Collection Object

Other resources

Fields Object Members


Fields.Item Method (Word)

 Copy code hover
[image]

Fields.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual Field object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents a Fields collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The individual object to be returned. Can be a Long indicating the ordinal position of the individual object.

Return Value

Field

See also

Concepts

Fields Collection Object

Other resources

Fields Object Members


Fields.ToggleShowCodes Method (Word)

 Copy code hover
[image]

Fields.ToggleShowCodes Method (Word)
See also Send feedback

Published: July 16, 2012

Switches the display of the fields between field codes and field results. Use the ShowCodes property to control the display of an individual field.

Syntax

expression .ToggleShowCodes

expression Required. A variable that represents a Fields collection.

Example

This example switches on or switches off the display of fields in the selection (the equivalent of pressing SHIFT+F9).

VBA Copy code Copy code
Selection.Fields.ToggleShowCodes

This example switches on or switches off the display of fields in the active document (the equivalent of pressing ALT+F9).

VBA Copy code Copy code
ActiveDocument.Fields.ToggleShowCodes

See also

Concepts

Fields Collection Object

Other resources

Fields Object Members


Fields.Unlink Method (Word)

 Copy code hover
[image]

Fields.Unlink Method (Word)
See also Send feedback

Published: July 16, 2012

Replaces all the fields in the Fields collection with their most recent results.

Syntax

expression .Unlink

expression Required. A variable that represents a Fields collection.

Remarks

When you unlink a field, the current result is converted to text or a graphic and can no longer be updated automatically. Note that some fields—such as XE (Index Entry) fields and SEQ (Sequence) fields—cannot be unlinked.

Example

This example updates and unlinks all the fields in the first section in the active document.

VBA Copy code Copy code
With ActiveDocument.Sections(1).Range.Fields
 .Update
 .Unlink
End With

See also

Concepts

Fields Collection Object

Other resources

Fields Object Members


Fields.Update Method (Word)

 Copy code hover
[image]

Fields.Update Method (Word)
See also Send feedback

Published: July 16, 2012

Updates the result of the fields object.

Syntax

expression .Update

expression Required. A variable that represents a Fields collection.

Return Value

Long

Remarks

Returns 0 (zero) if no errors occur when the fields are updated, or returns a Long that represents the index of the first field that contains an error.

Example

This example updates all the fields in the main story (that is, the main body) of the active document. A return value of 0 (zero) indicates that the fields were updated without error.

VBA Copy code Copy code
If ActiveDocument.Fields.Update = 0 Then
 MsgBox "Update Successful"
Else
 MsgBox "Field " & ActiveDocument.Fields.Update & _
 " has an error"
End If

See also

Concepts

Fields Collection Object

Other resources

Fields Object Members


Fields.UpdateSource Method (Word)

 Copy code hover
[image]

Fields.UpdateSource Method (Word)
See also Send feedback

Published: July 16, 2012

Saves the changes made to the results of an INCLUDETEXT field back to the source document.

Syntax

expression .UpdateSource

expression Required. A variable that represents a Fields collection.

Remarks

The source document must be formatted as a Word document.

See also

Concepts

Fields Collection Object

Other resources

Fields Object Members


FileConverter Object (Word)

 Copy code hover
[image]

FileConverter Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a file converter that's used to open or save files. The FileConverter object is a member of the FileConverters collection. The FileConverters collection contains all the installed file converters for opening and saving files.

Remarks

Use FileConverters(Index), where Index is a class name or index number, to return a single FileConverter object. The following example displays the extensions associated with the Microsoft Excel worksheet converter.

VBA Copy code Copy code
MsgBox FileConverters("MSBiff").Extensions

The index number represents the position of the file converter in the FileConverters collection. The following example displays the format name of the first file converter.

VBA Copy code Copy code
MsgBox FileConverters(1).FormatName

You cannot create a new file converter or add one to the FileConverters collection. FileConverter objects are added during installation of Microsoft Office or by installing supplemental file converters. Use either the CanSave or CanOpen property to determine whether a FileConverter object can be used to open or save document.

File converters for saving documents are listed in the Save As dialog box. File converters for opening documents appear in a dialog box if the Confirm conversion at Open check box is selected on the General tab in the Options dialog box (Tools menu).

See also

Concepts

Word Object Model Reference

Other resources

FileConverter Object Members


FileConverter Members (Word)

 Copy code hover
[image]

FileConverter Members (Word)
Send feedback

Published: July 16, 2012

Represents a file converter that's used to open or save files. The FileConverter object is a member of the FileConverters collection. The FileConverters collection contains all the installed file converters for opening and saving files.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
CanOpen | True if the specified file converter is designed to open files. Read-only Boolean.
CanSave | True if the specified file converter is designed to save files. Read-only Boolean.
ClassName | Returns a unique name that identifies the file converter. Read-only String.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Extensions | Returns the file name extensions associated with the specified FileConverter object. Read-only String.
FormatName | Returns the name of the specified file converter. Read-only String.
Name | Returns name of the specified object. Read-only String.
OpenFormat | Returns the file format of the specified file converter. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified FileConverter object.
Path | Returns the disk or Web path to the specified object. Read-only String.
SaveFormat | Returns the file format of the specified document or file converter. Read-only Long.


FileConverter Properties (Word)

 Copy code hover
[image]

FileConverter Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
CanOpen | True if the specified file converter is designed to open files. Read-only Boolean.
CanSave | True if the specified file converter is designed to save files. Read-only Boolean.
ClassName | Returns a unique name that identifies the file converter. Read-only String.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Extensions | Returns the file name extensions associated with the specified FileConverter object. Read-only String.
FormatName | Returns the name of the specified file converter. Read-only String.
Name | Returns name of the specified object. Read-only String.
OpenFormat | Returns the file format of the specified file converter. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified FileConverter object.
Path | Returns the disk or Web path to the specified object. Read-only String.
SaveFormat | Returns the file format of the specified document or file converter. Read-only Long.


FileConverter.Application Property (Word)

 Copy code hover
[image]

FileConverter.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a FileConverter object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

FileConverter Object

Other resources

FileConverter Object Members


FileConverter.CanOpen Property (Word)

 Copy code hover
[image]

FileConverter.CanOpen Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified file converter is designed to open files. Read-only Boolean.

Syntax

expression .CanOpen

expression A variable that represents a FileConverter object.

Remarks

The CanSave property returns True if the specified file converter can be used to save (export) files.

Example

This example determines whether the first file converter is able to open files.

VBA Copy code Copy code
If FileConverters(1).CanOpen = True Then
 MsgBox FileConverters(1).FormatName & " can open files"
End If

This example determines whether the WordPerfect6x file converter can be used to open files. If the CanOpen property returns True, a document named "Test.wp" is opened.

VBA Copy code Copy code
If FileConverters("WordPerfect6x").CanOpen = True Then
 Documents.Open FileName:="C:\Test.wp", _
 Format:=FileConverters("WordPerfect6x").OpenFormat
End If

See also

Concepts

FileConverter Object

Other resources

FileConverter Object Members


FileConverter.CanSave Property (Word)

 Copy code hover
[image]

FileConverter.CanSave Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified file converter is designed to save files. Read-only Boolean.

Syntax

expression .CanSave

expression A variable that represents a FileConverter object.

Remarks

The CanOpen property returns True if the specified file converter can be used to open (import) files.

Example

This example determines whether the WordPerfect converter can be used to save files. If the return value is True, the active document is saved in WordPerfect 6.x format.

VBA Copy code Copy code
Dim lngSaveFormat As Long

If Application.FileConverters("WordPerfect6x").CanSave = _
 True Then
 lngSaveFormat = _
 Application.FileConverters("WordPerfect6x").SaveFormat
 ActiveDocument.SaveAs FileName:="C:\Document.wp", _
 FileFormat:=lngSaveFormat
End If

This example displays a message that indicates whether the third converter in the FileConverters collection can save files.

VBA Copy code Copy code
If FileConverters(3).CanSave = True Then
 MsgBox FileConverters(3).FormatName & " can save files"
Else
 MsgBox FileConverters(3).FormatName & " cannot save files"
End If

See also

Concepts

FileConverter Object

Other resources

FileConverter Object Members


FileConverter.ClassName Property (Word)

 Copy code hover
[image]

FileConverter.ClassName Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a unique name that identifies the file converter. Read-only String.

Syntax

expression .ClassName

expression A variable that represents a FileConverter object.

Example

This example displays the class name and format name of the first converter in the FileConverters collection.

VBA Copy code Copy code
MsgBox "ClassName= " & FileConverters(1).ClassName & vbCr _
 & "FormatName= " & FileConverters(1).FormatName

If an HTML file converter is available, this example sets the HTML format as the default save format.

VBA Copy code Copy code
Dim fcLoop As FileConverter

For Each fcLoop In FileConverters
 If fcLoop.ClassName = "HTML" Then _
 Application.DefaultSaveFormat = "HTML"
Next fcLoop

See also

Concepts

FileConverter Object

Other resources

FileConverter Object Members


FileConverter.Creator Property (Word)

 Copy code hover
[image]

FileConverter.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a FileConverter object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

FileConverter Object

Other resources

FileConverter Object Members


FileConverter.Extensions Property (Word)

 Copy code hover
[image]

FileConverter.Extensions Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the file name extensions associated with the specified FileConverter object. Read-only String.

Syntax

expression .Extensions

expression A variable that represents a FileConverter object.

Example

This example displays the name and file name extensions for first file converter.

VBA Copy code Copy code
Dim fcTemp As FileConverter

Set fcTemp = FileConverters(1)
MsgBox "The file name extensions for " & fcTemp.FormatName _
 & " files are: " & fcTemp.Extensions

See also

Concepts

FileConverter Object

Other resources

FileConverter Object Members


FileConverter.FormatName Property (Word)

 Copy code hover
[image]

FileConverter.FormatName Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the name of the specified file converter. Read-only String.

Syntax

expression .FormatName

expression A variable that represents a FileConverter object.

Remarks

The format names appear in the Save as type box in the Save As dialog box (File menu).

Example

This example displays the format name of the first converter in the FileConverters collection.

VBA Copy code Copy code
MsgBox FileConverters(1).FormatName

This example uses the AvailableConv() array to store the names of all the available file converters.

VBA Copy code Copy code
Dim intTemp As Integer
Dim fcLoop As FileConverter
Dim AvailableConv As Variant

ReDim AvailableConv(FileConverters.Count - 1)

intTemp = 0

For Each fcLoop In FileConverters
 AvailableConv(intTemp) = fcLoop.FormatName
 intTemp = intTemp + 1
Next fcLoop

See also

Concepts

FileConverter Object

Other resources

FileConverter Object Members


FileConverter.Name Property (Word)

 Copy code hover
[image]

FileConverter.Name Property (Word)
See also Send feedback

Published: July 16, 2012

Returns name of the specified object. Read-only String.

Syntax

expression .Name

expression Required. A variable that represents a FileConverter object.

See also

Concepts

FileConverter Object

Other resources

FileConverter Object Members


FileConverter.OpenFormat Property (Word)

 Copy code hover
[image]

FileConverter.OpenFormat Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the file format of the specified file converter. Read-only Long.

Syntax

expression .OpenFormat

expression Required. A variable that represents a FileConverter object.

Remarks

This property can be any vailid WdOpenFormat constant, or it can be a unique number that represents an external file converter.

Example

This example displays the unique format value and the format name for the converters you can use to open documents.

VBA Copy code Copy code
For Each fc In FileConverters
 If fc.CanOpen = True Then _
 MsgBox fc.OpenFormat & vbCr & fc.FormatName
Next fc

This example opens the file named "Data.wp" by using the WordPerfect 6x file converter.

VBA Copy code Copy code
Documents.Open FileName:="C:\Data.wp", _
 Format:=FileConverters("WordPerfect6x").OpenFormat

See also

Concepts

FileConverter Object

Other resources

FileConverter Object Members


FileConverter.Parent Property (Word)

 Copy code hover
[image]

FileConverter.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified FileConverter object.

Syntax

expression .Parent

expression Required. A variable that represents a FileConverter object.

See also

Concepts

FileConverter Object

Other resources

FileConverter Object Members


FileConverter.Path Property (Word)

 Copy code hover
[image]

FileConverter.Path Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the disk or Web path to the specified object. Read-only String.

Syntax

expression .Path

expression Required. A variable that represents a FileConverter object.

Remarks

The path doesn't include a trailing character — for example, "C:\MSOffice" or "http://MyServer". Use the PathSeparator property to add the character that separates folders and drive letters. Use the Name property to return the file name without the path. You can create the full name of a file converter by concatenating the Path, PathSeparator, and Name properties.

See also

Concepts

FileConverter Object

Other resources

FileConverter Object Members


FileConverter.SaveFormat Property (Word)

 Copy code hover
[image]

FileConverter.SaveFormat Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the file format of the specified document or file converter. Read-only Long.

Syntax

expression .SaveFormat

expression Required. A variable that represents a FileConverter object.

Remarks

This property returns a unique number that specifies an external file converter or a WdSaveFormat constant. Use the value of the SaveFormat property for the FileFormat argument of the SaveAs2 method to save a document in a file format for which there isn't a corresponding WdSaveFormat constant.

Example

This example creates a new document and lists in a table the converters that can be used to save documents and their corresponding SaveFormat values.

VBA Copy code Copy code
Sub FileConverterList()
 Dim cnvFile As FileConverter
 Dim docNew As Document

 'Create a new document and set a tab stop
 Set docNew = Documents.Add
 docNew.Paragraphs.Format.TabStops.Add _
 Position:=InchesToPoints(3)

 'List all the converters in the FileConverters collection
 With docNew.Content
 .InsertAfter "Name" & vbTab & "Number"
 .InsertParagraphAfter
 For Each cnvFile In FileConverters
 If cnvFile.CanSave = True Then
 .InsertAfter cnvFile.FormatName & vbTab & _
 cnvFile.SaveFormat
 .InsertParagraphAfter
 End If
 Next
 .ConvertToTable
 End With

End Sub

This example saves the active document in the WordPerfect 5.1 or 5.2 secondary file format.

VBA Copy code Copy code
ActiveDocument.SaveAs _
 FileFormat:=FileConverters("WrdPrfctDat").SaveFormat

See also

Concepts

FileConverter Object

Other resources

FileConverter Object Members


FileConverters Object (Word)

 Copy code hover
[image]

FileConverters Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of FileConverter objects that represent all the file converters available for opening and saving files.

Remarks

Use the FileConverters property to return the FileConverters collection. The following example determines whether a WordPerfect 6.0 converter is available.

VBA Copy code Copy code
For Each conv In FileConverters
 If conv.FormatName = "WordPerfect 6.x" Then
 MsgBox "WordPerfect 6.0 converter is installed"
 End if
Next conv

The Add method isn't available for the FileConverters collection. FileConverter objects are added during installation of Microsoft Office or by installing supplemental converters.

Use FileConverters(Index), where Index is a class name or index number, to return a single FileConverter object. The following example displays the extensions associated wtih the Microsoft Excel worksheet converter.

VBA Copy code Copy code
MsgBox FileConverters("MSBiff").Extensions

The index number represents the position of the file converter in the FileConverters collection. The following example displays the format name of the first file converter.

VBA Copy code Copy code
MsgBox FileConverters(1).FormatName

File converters for saving documents are listed in the Save As dialog box. File converters for opening documents appear in a dialog box if the Confirm conversion at Open check box is selected on the General tab in the Options dialog box (Tools menu).

See also

Concepts

Word Object Model Reference

Other resources

FileConverters Object Members


FileConverters Members (Word)

 Copy code hover
[image]

FileConverters Members (Word)
Send feedback

Published: July 16, 2012

A collection of FileConverter objects that represent all the file converters available for opening and saving files.

Methods

Name | Description
Item | Returns an individual FileConverter object in a collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
ConvertMacWordChevrons | Controls whether text enclosed in chevron characters (« ») is converted to merge fields. Read/write Long. .
Count | Returns a Long that represents the number of file converters in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified FileConverters object.


FileConverters Properties (Word)

 Copy code hover
[image]

FileConverters Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
ConvertMacWordChevrons | Controls whether text enclosed in chevron characters (« ») is converted to merge fields. Read/write Long. .
Count | Returns a Long that represents the number of file converters in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified FileConverters object.


FileConverters.Application Property (Word)

 Copy code hover
[image]

FileConverters.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a FileConverters collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

FileConverters Collection Object

Other resources

FileConverters Object Members


FileConverters.ConvertMacWordChevrons Property (Word)

 Copy code hover
[image]

FileConverters.ConvertMacWordChevrons Property (Word)
See also Send feedback

Published: July 16, 2012

Controls whether text enclosed in chevron characters (« ») is converted to merge fields. Read/write Long. .

Syntax

expression .ConvertMacWordChevrons

expression A variable that represents a FileConverters collection.

Remarks

The ConvertMacWordChevrons property can be any WdChevronConvertRule constants.

Word for the Macintosh version 4.0 and 5.x documents use chevron characters to denote mail merge fields.

Example

This example sets the ConvertMacWordChevrons property to convert the text enclosed in chevrons to mail merge fields, and then it opens the document named "Mac Word Document."

VBA Copy code Copy code
FileConverters.ConvertMacWordChevrons = wdAlwaysConvert
Documents.Open FileName:="C:\Documents\Mac Word Document"

See also

Concepts

FileConverters Collection Object

Other resources

FileConverters Object Members


FileConverters.Count Property (Word)

 Copy code hover
[image]

FileConverters.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of file converters in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents a FileConverters collection.

See also

Concepts

FileConverters Collection Object

Other resources

FileConverters Object Members


FileConverters.Creator Property (Word)

 Copy code hover
[image]

FileConverters.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a FileConverters collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

FileConverters Collection Object

Other resources

FileConverters Object Members


FileConverters.Parent Property (Word)

 Copy code hover
[image]

FileConverters.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified FileConverters object.

Syntax

expression .Parent

expression Required. A variable that represents a FileConverters collection.

See also

Concepts

FileConverters Collection Object

Other resources

FileConverters Object Members


FileConverters Methods (Word)

 Copy code hover
[image]

FileConverters Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Item | Returns an individual FileConverter object in a collection.


FileConverters.Item Method (Word)

 Copy code hover
[image]

FileConverters.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual FileConverter object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents a FileConverters collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The individual object to be returned. Can be a Long indicating the ordinal position or a String representing the name of the individual object.

Return Value

FileConverter

See also

Concepts

FileConverters Collection Object

Other resources

FileConverters Object Members


FillFormat Object (Word)

 Copy code hover
[image]

FillFormat Object (Word)
See also Send feedback

Published: July 16, 2012

Represents fill formatting for a shape. A shape can have a solid, gradient, texture, pattern, picture, or semi-transparent fill.

Remarks

Use the Fill property to return a FillFormat object. The following example adds a rectangle to the active document and then sets the gradient and color for the rectangle's fill.

VBA Copy code Copy code
With ActiveDocument.Shapes _
 .AddShape(msoShapeRectangle, 90, 90, 90, 80).Fill
 .ForeColor.RGB = RGB(0, 128, 128)
 .OneColorGradient msoGradientHorizontal, 1, 1
End With

Many of the properties of the FillFormat object are read-only. To set one of these properties, you have to apply the corresponding method.

See also

Concepts

Word Object Model Reference

Other resources

FillFormat Object Members


FillFormat Members (Word)

 Copy code hover
[image]

FillFormat Members (Word)
Send feedback

Published: July 16, 2012

Represents fill formatting for a shape. A shape can have a solid, gradient, texture, pattern, picture, or semi-transparent fill.

Methods

Name | Description
OneColorGradient | Sets the specified fill to a one-color gradient.
Patterned | Sets the specified fill to a pattern.
PresetGradient | Sets the specified fill to a preset gradient.
PresetTextured | Sets the specified fill to a preset texture.
Solid | Sets the specified fill to a uniform color. .
TwoColorGradient | Sets the specified fill to a two-color gradient.
UserPicture | Fills the specified shape with one large image. .
UserTextured | Fills the specified shape with small tiles of an image.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
BackColor | Returns or sets a ColorFormat object that represents the background color for the fill Read/write.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
ForeColor | Returns or sets a ColorFormat object that represents the foreground color for the fill. Read/write.
GradientAngle | Returns or sets the angle of the gradient fill for the specified fill format. Read/write.
GradientColorType | Returns the gradient color type for the specified fill. Read-only MsoGradientColorType.
GradientDegree | Returns a value that indicates how dark or light a one-color gradient fill is. Read-only Single.
GradientStops | Returns the GradientStops collection associated with the specified fill format. Read-only.
GradientStyle | Returns the gradient style for the specified fill. Read-only MsoGradientStyle.
GradientVariant | Returns the gradient variant for the specified fill as an integer value from 1 to 4 for most gradient fills. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified FillFormat object.
Pattern | Returns or sets a MsoPatternType constant that represents the pattern applied to the specified fill or line. Read-only.
PictureEffects | Returns a PictureEffects object that can be used to apply picture effects to the specified fill formatting. Read-only.
PresetGradientType | Returns the preset gradient type for the specified fill. Read-only MsoPresetGradientType.
PresetTexture | Returns the preset texture for the specified fill. Read-only MsoPresetTexture.
RotateWithObject | Returns or sets whether the fill rotates with the specified shape. Read/write.
TextureAlignment | Returns or sets the alignment (the origin of the coordinate grid) for the tiling of the texture fill. Read/write.
TextureHorizontalScale | Returns or sets a Single that specifies the horizontal scaling factor for the texture fill. Read/write.
TextureName | Returns the name of the custom texture file for the specified fill. Read-only String.
TextureOffsetX | Returns or sets a Long that specifies the horizontal offset of the texture from the origin in points. Read/write.
TextureOffsetY | Returns or sets a Long that specifies the vertical offset of the texture from the origin in points. Read/write.
TextureTile | Returns or sets whether the texture fill is tiled or centered. Read/write.
TextureType | Returns the texture type for the specified fill. Read-only MsoTextureType.
TextureVerticalScale | Returns or sets a Single that specifies the vertical scaling factor for the texture fill. Read/write.
Transparency | Returns or sets the degree of transparency of the specified fillfor a shape as a value between 0.0 (opaque) and 1.0 (clear). Read/write Single.
Type | Returns the shape fill format type. Read-only MsoFillType.
Visible | True if the specified object, or the formatting applied to it, is visible. Read/write MsoTriState.


FillFormat Properties (Word)

 Copy code hover
[image]

FillFormat Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
BackColor | Returns or sets a ColorFormat object that represents the background color for the fill Read/write.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
ForeColor | Returns or sets a ColorFormat object that represents the foreground color for the fill. Read/write.
GradientAngle | Returns or sets the angle of the gradient fill for the specified fill format. Read/write.
GradientColorType | Returns the gradient color type for the specified fill. Read-only MsoGradientColorType.
GradientDegree | Returns a value that indicates how dark or light a one-color gradient fill is. Read-only Single.
GradientStops | Returns the GradientStops collection associated with the specified fill format. Read-only.
GradientStyle | Returns the gradient style for the specified fill. Read-only MsoGradientStyle.
GradientVariant | Returns the gradient variant for the specified fill as an integer value from 1 to 4 for most gradient fills. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified FillFormat object.
Pattern | Returns or sets a MsoPatternType constant that represents the pattern applied to the specified fill or line. Read-only.
PictureEffects | Returns a PictureEffects object that can be used to apply picture effects to the specified fill formatting. Read-only.
PresetGradientType | Returns the preset gradient type for the specified fill. Read-only MsoPresetGradientType.
PresetTexture | Returns the preset texture for the specified fill. Read-only MsoPresetTexture.
RotateWithObject | Returns or sets whether the fill rotates with the specified shape. Read/write.
TextureAlignment | Returns or sets the alignment (the origin of the coordinate grid) for the tiling of the texture fill. Read/write.
TextureHorizontalScale | Returns or sets a Single that specifies the horizontal scaling factor for the texture fill. Read/write.
TextureName | Returns the name of the custom texture file for the specified fill. Read-only String.
TextureOffsetX | Returns or sets a Long that specifies the horizontal offset of the texture from the origin in points. Read/write.
TextureOffsetY | Returns or sets a Long that specifies the vertical offset of the texture from the origin in points. Read/write.
TextureTile | Returns or sets whether the texture fill is tiled or centered. Read/write.
TextureType | Returns the texture type for the specified fill. Read-only MsoTextureType.
TextureVerticalScale | Returns or sets a Single that specifies the vertical scaling factor for the texture fill. Read/write.
Transparency | Returns or sets the degree of transparency of the specified fillfor a shape as a value between 0.0 (opaque) and 1.0 (clear). Read/write Single.
Type | Returns the shape fill format type. Read-only MsoFillType.
Visible | True if the specified object, or the formatting applied to it, is visible. Read/write MsoTriState.


FillFormat.Application Property (Word)

 Copy code hover
[image]

FillFormat.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a FillFormat object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


FillFormat.BackColor Property (Word)

 Copy code hover
[image]

FillFormat.BackColor Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a ColorFormat object that represents the background color for the fill Read/write.

Syntax

expression .BackColor

expression A variable that represents a FillFormat object.

Example

This example adds a rectangle to the active document and then sets the foreground color, background color, and gradient for the rectangle's fill.

VBA Copy code Copy code
Dim docActive As Document

Set docActive = ActiveDocument

With docActive.Shapes.AddShape(msoShapeRectangle, _
 90, 90, 90, 50).Fill
 .ForeColor.RGB = RGB(128, 0, 0)
 .BackColor.RGB = RGB(170, 170, 170)
 .TwoColorGradient msoGradientHorizontal, 1
End With

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


FillFormat.Creator Property (Word)

 Copy code hover
[image]

FillFormat.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a FillFormat object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


FillFormat.ForeColor Property (Word)

 Copy code hover
[image]

FillFormat.ForeColor Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a ColorFormat object that represents the foreground color for the fill. Read/write.

Syntax

expression .ForeColor

expression A variable that represents a FillFormat object.

Example

This example adds a rectangle to the active document and then sets the foreground color, background color, and gradient for the rectangle's fill.

VBA Copy code Copy code
Dim docActive As Document

Set docActive = ActiveDocument
VBA Copy code Copy code
With docActive.Shapes.AddShape(msoShapeRectangle, _
 90, 90, 90, 50).Fill
 .ForeColor.RGB = RGB(128, 0, 0)
 .BackColor.RGB = RGB(170, 170, 170)
 .TwoColorGradient msoGradientHorizontal, 1
End With

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


FillFormat.GradientAngle Property (Word)

 Copy code hover
[image]

FillFormat.GradientAngle Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the angle of the gradient fill for the specified fill format. Read/write.

Version Information

Version Added: Word 2010

Syntax

expression .GradientAngle

expression An expression that returns a FillFormat object.

Return Value

Single

Remarks

A gradient fill can be specified in the formatting for various elements (shapes) in a chart. For example, you can use the Format Data Series dialog box to format the columns in a Column chart to a gradient fill. In this case, the GradientAngle property corresponds to the setting of the Angle box in the Fill category of the Format Data Series dialog box. The valid range of values for the GradientAngle property is from 0 to 359.9.

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


FillFormat.GradientColorType Property (Word)

 Copy code hover
[image]

FillFormat.GradientColorType Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the gradient color type for the specified fill. Read-only MsoGradientColorType.

Syntax

expression .GradientColorType

expression An expression that represents a FillFormat object.

Remarks

This property is read-only. Use the OneColorGradient, PresetGradient, or TwoColorGradient method to set the gradient type for the fill.

Example

This example changes the fill for all shapes in the active document that have a two-color gradient fill to a preset gradient fill.

VBA Copy code Copy code
Dim docActive As Document
Dim shapeLoop As Shape

Set docActive = ActiveDocument
For Each shapeLoop In docActive.Shapes
 With shapeLoop
 .Fill
 If .GradientColorType = msoGradientTwoColors Then
 .PresetGradient msoGradientHorizontal, 1, _
 msoGradientBrass
 End If
 End With
Next

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


FillFormat.GradientDegree Property (Word)

 Copy code hover
[image]

FillFormat.GradientDegree Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a value that indicates how dark or light a one-color gradient fill is. Read-only Single.

Syntax

expression .GradientDegree

expression A variable that represents a FillFormat object.

Remarks

A value of 0 (zero) means that black is mixed in with the shape's foreground color to form the gradient; a value of 1 means that white is mixed in; and values between 0 and 1 mean that a darker or lighter shade of the foreground color is mixed in.

Use the OneColorGradient method to set the gradient degree for the fill.

Example

This example adds a rectangle to the active document and sets the degree of its fill gradient to match that of the shape named "Rectangle 2." If Rectangle 2 doesn't have a one-color gradient fill, this example fails.

VBA Copy code Copy code
Dim docActive As Document
Dim sngGradient As Single

Set docActive = ActiveDocument
With docActive.Shapes
 sngGradient = .Item("Rectangle 2").Fill.GradientDegree

 With .AddShape(msoShapeRectangle, 0, 0, 40, 80).Fill
 .ForeColor.RGB = RGB(0, 128, 128)
 .OneColorGradient msoGradientHorizontal, 1, sngGradient
 End With
End With

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


FillFormat.GradientStops Property (Word)

 Copy code hover
[image]

FillFormat.GradientStops Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the GradientStops collection associated with the specified fill format. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .GradientStops

expression An expression that returns a FillFormat object.

Remarks

Gradients are a smooth transition from one color state to another. The endpoints of these sections are called stops. You can use the GradientStops.Insert method to add gradient stops to the GradientStops collection for the specified object.

Example

The following code example shows how to add a gradient stop at the 50% position to the GradientStops collection of the fill format of the first shape in the active document. For this code example to work, the shape must already have a gradient fill applied.

VBA Copy code Copy code
Public Sub GradientStops_Example()

 Dim wdShape As Shape
 Dim wdFillFormat As FillFormat
 Dim wdGradientStops As GradientStops

 Set wdShape = ActiveDocument.Shapes(1)
 Set wdFillFormat = wdShape.Fill
 Set wdGradientStops = wdFillFormat.GradientStops

 wdGradientStops.Insert RGB(255, 0, 255), 0.5
End Sub

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


FillFormat.GradientStyle Property (Word)

 Copy code hover
[image]

FillFormat.GradientStyle Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the gradient style for the specified fill. Read-only MsoGradientStyle.

Syntax

expression .GradientStyle

expression An expression that represents a FillFormat object.

Remarks

This property is read-only. Use the OneColorGradient or TwoColorGradient method to set the gradient style for the fill.

Attempting to return this property for a fill that doesn't have a gradient generates an error. Use the Type property to determine whether the fill has a gradient.

Example

This example adds a rectangle to the active document and sets its fill gradient style to match that of the shape named "rect1." For the example to work, rect1 must have a gradient fill.

VBA Copy code Copy code
Dim docActive As Document
Dim lngGradient As Long

Set docActive = ActiveDocument
With docActive.Shapes
 lngGradient = .Item("rect1").Fill.GradientStyle
 With .AddShape(msoShapeRectangle, 0, 0, 40, 80).Fill
 .ForeColor.RGB = RGB(128, 0, 0)
 .OneColorGradient lngGradient, 1, 1
 End With
End With

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


FillFormat.GradientVariant Property (Word)

 Copy code hover
[image]

FillFormat.GradientVariant Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the gradient variant for the specified fill as an integer value from 1 to 4 for most gradient fills. Read-only Long.

Syntax

expression .GradientVariant

expression A variable that represents a FillFormat object.

Remarks

If the gradient style is msoGradientFromCenter, this property returns either 1 or 2. The values for this property correspond to the gradient variants (numbered from left to right and from top to bottom) on the Gradient tab in the Fill Effects dialog box.

Use the OneColorGradient or TwoColorGradient method to set the gradient variant for the fill.

Example

This example adds a rectangle to the active document and sets its fill gradient variant to match that of the shape named "rect1." For the example to work, rect1 must have a gradient fill.

VBA Copy code Copy code
Dim lngGradient As Long

With ActiveDocument.Shapes
 lngGradient = .Item("rect1").Fill.GradientVariant
 With .AddShape(msoShapeRectangle, 0, 0, 40, 80).Fill
 .ForeColor.RGB = RGB(128, 0, 0)
 .OneColorGradient msoGradientHorizontal, _
 lngGradient, 1
 End With
End With

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


FillFormat.Parent Property (Word)

 Copy code hover
[image]

FillFormat.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified FillFormat object.

Syntax

expression .Parent

expression Required. A variable that represents a FillFormat object.

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


FillFormat.Pattern Property (Word)

 Copy code hover
[image]

FillFormat.Pattern Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a MsoPatternType constant that represents the pattern applied to the specified fill or line. Read-only.

Syntax

expression .Pattern

expression An expression that returns a FillFormat object.

Example

This example adds a rectangle to myDocument and sets its fill pattern to match that of the shape named "rect1." The new rectangle has the same pattern as "rect1" but not necessarily the same colors. The colors used in the pattern are set with the BackColor and ForeColor properties.

VBA Copy code Copy code
Set myDocument = ActiveDocument
With myDocument.Shapes
 pattern1 = .Item("rect1").Fill.Pattern
 With .AddShape(msoShapeRectangle, 100, 100, 120, 80).Fill
 .ForeColor.RGB = RGB(128, 0, 0)
 .BackColor.RGB = RGB(0, 0, 255)
 .Patterned pattern1
 End With
End With

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


FillFormat.PictureEffects Property (Word)

 Copy code hover
[image]

FillFormat.PictureEffects Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a PictureEffects object that can be used to apply picture effects to the specified fill formatting. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .PictureEffects

expression An expression that returns a FillFormat object.

Remarks

You use the Insert method of the PictureEffects object to apply picture effects. The Insert takes an MsoPictureEffectType enumeration constant as an argument to specify what type of picture effect to apply.

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


FillFormat.PresetGradientType Property (Word)

 Copy code hover
[image]

FillFormat.PresetGradientType Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the preset gradient type for the specified fill. Read-only MsoPresetGradientType.

Syntax

expression .PresetGradientType

expression An expression that represents a FillFormat object.

Remarks

Use the PresetGradient method to set the preset gradient type for the fill.

Example

This example changes the fill for all shapes in myDocument with the Moss preset gradient fill to the Fog preset gradient fill.

VBA Copy code Copy code
Set myDocument = ActiveDocument
For Each s In myDocument.Shapes
 With s.Fill
 If .PresetGradientType = msoGradientMoss Then
 .PresetGradient msoGradientHorizontal, 1, _
 msoGradientFog
 End If
 End With
Next

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


FillFormat.PresetTexture Property (Word)

 Copy code hover
[image]

FillFormat.PresetTexture Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the preset texture for the specified fill. Read-only MsoPresetTexture.

Syntax

expression .PresetTexture

expression Required. An expression that returns a FillFormat object.

Remarks

Use the PresetTextured method to specify the preset texture for the fill.

Example

This example adds a rectangle to myDocument and sets its preset texture to match that of shape two. For the example to work, shape two must have a preset textured fill.

VBA Copy code Copy code
Set myDocument = ActiveDocument
With myDocument.Shapes
 presetTexture2 = .Item(2).Fill.PresetTexture
 .AddShape(msoShapeRectangle, 100, 0, 40, 80).Fill _
 .PresetTextured presetTexture2
End With

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


FillFormat.RotateWithObject Property (Word)

 Copy code hover
[image]

FillFormat.RotateWithObject Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets whether the fill rotates with the specified shape. Read/write.

Version Information

Version Added: Word 2010

Syntax

expression .RotateWithObject

expression An expression that returns a FillFormat object.

Remarks

The value returned by the RotateWithObject property can be one of the MsoTriState constants listed in the following table.

Constant | Description
msoFalse | The fill does not rotate with the shape.
msoTrue | The fill rotates with the shape.

The setting of the RotateWithObject property corresponds to the setting of the Rotate with shape box on the Fill pane of the Format Picture dialog box in the Word 2010 user interface (under Drawing Tools, on the Format Tab, in the Shape Styles group, click Format Shape.)

Note Note

The Rotate with shape box only appears if you have either the Gradient fill or Picture or texture fill option buttons selected on the Fill pane of the Format Shape dialog box.

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


FillFormat.TextureAlignment Property (Word)

 Copy code hover
[image]

FillFormat.TextureAlignment Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the alignment (the origin of the coordinate grid) for the tiling of the texture fill. Read/write.

Version Information

Version Added: Word 2010

Syntax

expression .TextureAlignment

expression An expression that returns a FillFormat object.

Return Value

MsoTextureAlignment

Remarks

The value returned by the TextureAlignment property can be one of the following MsoTextureAlignment constants:

  • msoTextureTopLeft

  • msoTextureTop

  • msoTextureTopRight

  • msoTextureLeft

  • msoTextureCenter

  • msoTextureRight

  • msoTextureBottomLeft

  • msoTextureBottom

  • msoTextureBottomRight

The setting of the TextureAlignment property corresponds to the setting of the Alignment box under Tiling Options on the Fill pane of the Format Picture dialog box in the Microsoft Word user interface (under Drawing Tools, on the Format Tab, expand the Shape Styles group.)

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


FillFormat.TextureHorizontalScale Property (Word)

 Copy code hover
[image]

FillFormat.TextureHorizontalScale Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Single that specifies the horizontal scaling factor for the texture fill. Read/write.

Version Information

Version Added: Word 2010

Syntax

expression .TextureHorizontalScale

expression An expression that returns a FillFormat object.

Remarks

The setting of the TextureHorizontalScale property corresponds to the setting of the Scale X box under Tiling Options on the Fill pane of the Format Picture dialog box in the Microsoft Word user interface (under Drawing Tools, on the Format tab, expand the Shape Styles group.)

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


FillFormat.TextureName Property (Word)

 Copy code hover
[image]

FillFormat.TextureName Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the name of the custom texture file for the specified fill. Read-only String.

Syntax

expression .TextureName

expression An expression that returns a FillFormat object.

Remarks

Use the UserTextured method to set the texture file for the fill.

Example

This example adds an oval to the active document. If the second shape in the document has a user-defined textured fill, the new oval will have the same fill as shape two. If shape two has any other type of fill, the new oval will have a green marble fill. This example assumes that the active document already has at least two shapes.

VBA Copy code Copy code
With ActiveDocument.Shapes
 Set newFill = .AddShape(msoShapeOval, 0, 0, 200, 90).Fill
 With .Item(2).Fill
 If.TextureType = msoTextureUserDefined Then
 newFill.UserTextured .TextureName
 Else
 newFill.PresetTextured msoTextureGreenMarble
 End If
 End With
End With

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


FillFormat.TextureOffsetX Property (Word)

 Copy code hover
[image]

FillFormat.TextureOffsetX Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Long that specifies the horizontal offset of the texture from the origin in points. Read/write.

Version Information

Version Added: Word 2010

Syntax

expression .TextureOffsetX

expression An expression that returns a FillFormat object.

Remarks

The position of the origin is determined by the setting of the TextureAlignment property.

The setting of the TextureOffsetX property corresponds to the setting of the Offset X box under Tiling Options on the Fill pane of the Format Picture dialog box in the Microsoft Word user interface (under Drawing Tools, on the Format tab, expand the Shape Styles group.)

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


FillFormat.TextureOffsetY Property (Word)

 Copy code hover
[image]

FillFormat.TextureOffsetY Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Long that specifies the vertical offset of the texture from the origin in points. Read/write.

Version Information

Version Added: Word 2010

Syntax

expression .TextureOffsetY

expression An expression that returns a FillFormat object.

Remarks

The position of the origin is determined by the setting of the TextureAlignment property.

The setting of the TextureOffsetY property corresponds to the setting of the Offset Y box under Tiling Options on the Fill pane of the Format Picture dialog box in the Microsoft Word user interface (under Drawing Tools, on the Format tab, expand the Shape Styles group.)

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


FillFormat.TextureTile Property (Word)

 Copy code hover
[image]

FillFormat.TextureTile Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets whether the texture fill is tiled or centered. Read/write.

Version Information

Version Added: Word 2010

Syntax

expression .TextureTile

expression An expression that returns a FillFormat object.

Remarks

The value returned by the TextureTile property can be one of the following MsoTriState constants.

Constant | Description
msoFalse | The texture fill is centered.
msoTrue | The texture fill is tiled.

The setting of the TextureTile property corresponds to the setting of the Tile picture as texture box under Tiling Options on the Fill pane of the Format Picture dialog box in the Microsoft Word user interface (under Drawing Tools, on the Format tab, expand the Shape Styles group.)

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


FillFormat.TextureType Property (Word)

 Copy code hover
[image]

FillFormat.TextureType Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the texture type for the specified fill. Read-only MsoTextureType.

Syntax

expression .TextureType

expression An expression that represents a FillFormat object.

Remarks

This property is read-only. Use the PresetTextured, UserPicture, or UserTextured method to set the texture type for the fill.

Example

This example changes the fill for all shapes in the active document with a custom textured fill to a canvas fill.

VBA Copy code Copy code
For Each s In ActiveDocument.Shapes
 With s.Fill
 If .TextureType = msoTextureUserDefined Then
 .PresetTextured msoTextureCanvas
 End If
 End With
Next

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


FillFormat.TextureVerticalScale Property (Word)

 Copy code hover
[image]

FillFormat.TextureVerticalScale Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Single that specifies the vertical scaling factor for the texture fill. Read/write.

Version Information

Version Added: Word 2010

Syntax

expression .TextureVerticalScale

expression An expression that returns a FillFormat object.

Remarks

The setting of the TextureVerticalScale property corresponds to the setting of the Scale Y box under Tiling Options on the Fill pane of the Format Picture dialog box in the Microsoft Word user interface (under Drawing Tools, on the Format tab, expand the Shape Styles group.)

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


FillFormat.Transparency Property (Word)

 Copy code hover
[image]

FillFormat.Transparency Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the degree of transparency of the specified fillfor a shape as a value between 0.0 (opaque) and 1.0 (clear). Read/write Single.

Syntax

expression .Transparency

expression Required. A variable that represents a FillFormat object.

Remarks

The value of this property affects the appearance of solid-colored fills. It has no effect on the appearance of patterned, gradient, picture, or textured fills.

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


FillFormat.Type Property (Word)

 Copy code hover
[image]

FillFormat.Type Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the shape fill format type. Read-only MsoFillType.

Syntax

expression .Type

expression Required. A variable that represents a FillFormat object.

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


FillFormat.Visible Property (Word)

 Copy code hover
[image]

FillFormat.Visible Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified object, or the formatting applied to it, is visible. Read/write MsoTriState.

Syntax

expression .Visible

expression An expression that represents a FillFormat object.

Remarks

For any object, some methods and properties may be unavailable if the Visible property is False.

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


FillFormat Methods (Word)

 Copy code hover
[image]

FillFormat Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
OneColorGradient | Sets the specified fill to a one-color gradient.
Patterned | Sets the specified fill to a pattern.
PresetGradient | Sets the specified fill to a preset gradient.
PresetTextured | Sets the specified fill to a preset texture.
Solid | Sets the specified fill to a uniform color. .
TwoColorGradient | Sets the specified fill to a two-color gradient.
UserPicture | Fills the specified shape with one large image. .
UserTextured | Fills the specified shape with small tiles of an image.


FillFormat.OneColorGradient Method (Word)

 Copy code hover
[image]

FillFormat.OneColorGradient Method (Word)
See also Send feedback

Published: July 16, 2012

Sets the specified fill to a one-color gradient.

Syntax

expression .OneColorGradient(Style, Variant, Degree)

expression Required. A variable that represents a FillFormat object.

Parameters

Name | Required/Optional | Data Type | Description
Style | Required | MsoGradientStyle | The gradient style. Can be any MsoGradientStyle constant except msoGradientFromTitle which applies only to Microsoft PowerPoint.
Variant | Required | Long | The gradient variant. Can be a value from 1 to 4, corresponding to the four variants on the Gradient tab in the Fill Effects dialog box. If Style is msoGradientFromCenter, this argument can be either 1 or 2.
Degree | Required | Single | The gradient degree. Can be a value from 0.0 (dark) to 1.0 (light).

Example

This example adds a rectangle with a one-color gradient fill to the active document.

VBA Copy code Copy code
With
VBA Copy code Copy code
ActiveDocument
VBA Copy code Copy code
.Shapes.AddShape(msoShapeRectangle, _
 90, 90, 90, 80).Fill
 .ForeColor.RGB = RGB(0, 128, 128)
 .OneColorGradient msoGradientHorizontal, 1, 1
End With

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


FillFormat.Patterned Method (Word)

 Copy code hover
[image]

FillFormat.Patterned Method (Word)
See also Send feedback

Published: July 16, 2012

Sets the specified fill to a pattern.

Syntax

expression .Patterned(Pattern)

expression Required. A variable that represents a FillFormat object.

Parameters

Name | Required/Optional | Data Type | Description
Pattern | Required | MsoPatternType | The pattern to be used for the specified fill.

Remarks

Use the BackColor and ForeColor properties to set the colors used in the pattern.

Example

This example adds an oval with a patterned fill to the active document.

VBA Copy code Copy code
Sub FillPattern()
 With ActiveDocument.Shapes.AddShape _
 (msoShapeOval, 60, 60, 80, 40).Fill
 .ForeColor.RGB = RGB(128, 0, 0)
 .BackColor.RGB = RGB(0, 0, 255)
 .Patterned msoPatternDarkVertical
 End With
End Sub

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


FillFormat.PresetGradient Method (Word)

 Copy code hover
[image]

FillFormat.PresetGradient Method (Word)
See also Send feedback

Published: July 16, 2012

Sets the specified fill to a preset gradient.

Syntax

expression .PresetGradient(Style, Variant, PresetGradientType)

expression Required. A variable that represents a FillFormat object.

Parameters

Name | Required/Optional | Data Type | Description
Style | Required | MsoGradientStyle | The gradient style. Can be any MsoGradientStyle constant except msoGradientFromTitle which applies only to Microsoft PowerPoint.
Variant | Required | Long | The gradient variant. Can be a value from 1 to 4, corresponding to the four variants on the Gradient tab in the Fill Effects dialog box. If Style is msoGradientFromCenter, this argument can be either 1 or 2.
PresetGradientType | Required | MsoPresetGradientType | The gradient type.

Example

This example adds a rectangle with a preset gradient fill to the active document.

VBA Copy code Copy code
ActiveDocument.Shapes.AddShape( _
 msoShapeRectangle, 90, 90, 140, 80).Fill.PresetGradient _
 msoGradientHorizontal, 1, msoGradientBrass

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


FillFormat.PresetTextured Method (Word)

 Copy code hover
[image]

FillFormat.PresetTextured Method (Word)
See also Send feedback

Published: July 16, 2012

Sets the specified fill to a preset texture.

Syntax

expression .PresetTextured(PresetTexture)

expression Required. A variable that represents a FillFormat object.

Parameters

Name | Required/Optional | Data Type | Description
PresetTexture | Required | MsoPresetTexture | The preset texture.

Example

This example adds a rectangle with a green-marble textured fill to the active document.

VBA Copy code Copy code
ActiveDocument.Shapes.AddShape(msoShapeCan, 90, 90, 40, 80) _
 .Fill.PresetTextured msoTextureGreenMarble

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


FillFormat.Solid Method (Word)

 Copy code hover
[image]

FillFormat.Solid Method (Word)
See also Send feedback

Published: July 16, 2012

Sets the specified fill to a uniform color. .

Syntax

expression .Solid

expression Required. A variable that represents a FillFormat object.

Remarks

Use this method to convert a gradient, textured, patterned, or background fill back to a solid fill.

Example

This example converts all fills on the active document to uniform red fills.

VBA Copy code Copy code
Dim shapeLoop As Shape

For Each shapeLoop In ActiveDocument.Shapes
 With shapeLoop.Fill
 .Solid
 .ForeColor.RGB = RGB(255, 0, 0)
 End With
Next

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


FillFormat.TwoColorGradient Method (Word)

 Copy code hover
[image]

FillFormat.TwoColorGradient Method (Word)
See also Send feedback

Published: July 16, 2012

Sets the specified fill to a two-color gradient.

Syntax

expression .TwoColorGradient(Style, Variant)

expression Required. A variable that represents a FillFormat object.

Parameters

Name | Required/Optional | Data Type | Description
Style | Required | MsoGradientStyle | The gradient style. Can be any MsoGradientStyle constant except msoGradientFromTitle which applies only to Microsoft PowerPoint.
Variant | Required | Long | The gradient variant. Can be a value from 1 to 4, corresponding to the four variants on the Gradient tab in the Fill Effects dialog box. If Style is msoGradientFromCenter, this argument can be either 1 or 2.

Example

This example adds a rectangle with a two-color gradient fill to the active document and sets the background and foreground color for the fill.

VBA Copy code Copy code
With ActiveDocument.Shapes.AddShape(msoShapeRectangle, _
 0, 0, 40, 80).Fill
 .ForeColor.RGB = RGB(128, 0, 0)
 .BackColor.RGB = RGB(0, 170, 170)
 .TwoColorGradient msoGradientHorizontal, 1
End With

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


FillFormat.UserPicture Method (Word)

 Copy code hover
[image]

FillFormat.UserPicture Method (Word)
See also Send feedback

Published: July 16, 2012

Fills the specified shape with one large image. .

Syntax

expression .UserPicture(PictureFile)

expression Required. A variable that represents a FillFormat object.

Parameters

Name | Required/Optional | Data Type | Description
PictureFile | Required | String | The name of the picture file.

Remarks

If you want to fill the shape with small tiles of an image, use the UserTextured method.

Example

This example adds two rectangles to the active document. The rectangle on the left is filled with one large image of the picture in Tiles.bmp; the rectangle on the right is filled with many small tiles of the picture in Tiles.bmp.

VBA Copy code Copy code
Sub Pic()
 With ActiveDocument.Shapes
 .AddShape(msoShapeRectangle, 0, 0, 200, 100).Fill _
 .UserPicture "C:\Windows\Tiles.bmp"
 .AddShape(msoShapeRectangle, 300, 0, 200, 100).Fill _
 .UserTextured "C:\Windows\Tiles.bmp"
 End With
End Sub

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


FillFormat.UserTextured Method (Word)

 Copy code hover
[image]

FillFormat.UserTextured Method (Word)
See also Send feedback

Published: July 16, 2012

Fills the specified shape with small tiles of an image.

Syntax

expression .UserTextured(TextureFile)

expression Required. A variable that represents a FillFormat object.

Remarks

If you want to fill the shape with one large image, use the UserPicture method.

Example

This example adds two rectangles to the active document. The rectangle on the left is filled with one large image of the picture in Tiles.bmp; the rectangle on the right is filled with many small tiles of the picture in Tiles.bmp

VBA Copy code Copy code
Sub Texture()
 With ActiveDocument.Shapes
 .AddShape(msoShapeRectangle, 0, 0, 200, 100).Fill _
 .UserPicture "C:\Windows\Tiles.bmp"
 .AddShape(msoShapeRectangle, 300, 0, 200, 100).Fill _
 .UserTextured "C:\Windows\Tiles.bmp"
 End With
End Sub

See also

Concepts

FillFormat Object

Other resources

FillFormat Object Members


Find Object (Word)

 Copy code hover
[image]

Find Object (Word)
See also Send feedback

Published: July 16, 2012

Represents the criteria for a find operation.

Remarks

The properties and methods of the Find object correspond to the options in the Find and Replace dialog box.

Use the Find property to return a Find object. The following example finds and selects the next occurrence of the word "hi."

VBA Copy code Copy code
With Selection.Find
 .ClearFormatting
 .Text = "hi"
 .Execute Forward:=True
End With

The following example finds all occurrences of the word "hi" in the active document and replaces the word with "hello."

VBA Copy code Copy code
Set myRange = ActiveDocument.Content
myRange.Find.Execute FindText:="hi", ReplaceWith:="hello", _
 Replace:=wdReplaceAll

Remarks

If you've gotten to the Find object from the Selection object, the selection is changed when text matching the find criteria is found. The following example selects the next occurrence of the word "blue."

VBA Copy code Copy code
Selection.Find.Execute FindText:="blue", Forward:=True

If you've gotten to the Find object from the Range object, the selection isn't changed when text matching the find criteria is found, but the Range object is redefined. The following example locates the first occurrence of the word "blue" in the active document. If "blue" is found in the document, myRange is redefined and bold formatting is applied to "blue."

VBA Copy code Copy code
Set myRange = ActiveDocument.Content
myRange.Find.Execute FindText:="blue", Forward:=True
If myRange.Find.Found = True Then myRange.Bold = True

See also

Concepts

Word Object Model Reference

Other resources

Find Object Members


Find Members (Word)

 Copy code hover
[image]

Find Members (Word)
Send feedback

Published: July 16, 2012

Represents the criteria for a find operation.

Methods

Name | Description
ClearAllFuzzyOptions | Clears all nonspecific search options associated with Japanese text.
ClearFormatting | Removes text and paragraph formatting from the text specified in a find or replace operation.
ClearHitHighlight | Removes the highlighting for all text located in a hit highlighting find operation, and returns a Boolean that represents whether the operation was successful.
Execute | Runs the specified find operation. Returns True if the find operation is successful. Boolean.
Execute2007 | Runs the specified find operation. Returns True if the find operation is successful.
HitHighlight | Highlights all found matches and returns a Boolean that represents whether matches were found.
SetAllFuzzyOptions | Activates all nonspecific search options associated with Japanese text.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
CorrectHangulEndings | True if Microsoft Word automatically corrects Hangul endings when replacing Hangul text. Read/write Boolean.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Font | Returns or sets a Font object that represents the character formatting of the specified object. Read/write Font.
Format | True if formatting is included in the find operation. Read/write Boolean.
Forward | True if the find operation searches forward through the document. Read/write Boolean.
Found | True if the search produces a match. Read-only Boolean.
Frame | Returns a Frame object that represents the frame formatting for the specified style or find-and-replace operation. Read-only.
HanjaPhoneticHangul | Returns or sets a Boolean that represents whether to locate phonetic Hangul and hanja characters in a Korean langauge find operation. Read/write.
Highlight | True if highlight formatting is included in the find criteria. Read/write Long.
IgnorePunct | Returns or sets a Boolean that represents whether a find operation should ignore punctuation in found text. Read/write.
IgnoreSpace | Returns or sets a Boolean that represents whether a find operation should ignore extra white space in found text. Read/write.
LanguageID | Returns or sets the language for the specified Find object. Read/write WdLanguageID.
LanguageIDFarEast | Returns or sets an East Asian language for the specified object. Read/write WdLanguageID.
LanguageIDOther | Returns or sets the language for the specified object. Read/write WdLanguageID.
MatchAlefHamza | True if find operations match text with matching alef hamzas in an Arabic language document. Read/write Boolean.
MatchAllWordForms | True if all forms of the text to find are found by the find operation (for instance, if the text to find is "sit," "sat" and "sitting" are found as well). Read/write Boolean.
MatchByte | True if Microsoft Word distinguishes between full-width and half-width letters or characters during a search. Read/write Boolean.
MatchCase | True if the find operation is case sensitive. The default is False. Read/write Boolean.
MatchControl | True if find operations match text with matching bidirectional control characters in a right-to-left language document. Read/write Boolean.
MatchDiacritics | True if find operations match text with matching diacritics in a right-to-left language document. Read/write Boolean.
MatchFuzzy | True if Microsoft Word uses the nonspecific search options for Japanese text during a search. Read/write Boolean.
MatchKashida | True if find operations match text with matching kashidas in an Arabic language document. Read/write Boolean.
MatchPhrase | True ignores all white space and control characters between words. Read/write.
MatchPrefix | True to match words beginning with the search string. Read/write.
MatchSoundsLike | True if words that sound similar to the text to find are returned by the find operation. Read/write Boolean.
MatchSuffix | True to match words ending with the search string. Read/write.
MatchWholeWord | True if the find operation locates only entire words and not text that's part of a larger word. Read/write Boolean.
MatchWildcards | True if the text to find contains wildcards. Read/write Boolean.
NoProofing | True if Microsoft Word finds or replaces text that the spelling and grammar checker ignores. Read/write Long.
ParagraphFormat | Returns or sets a ParagraphFormat object that represents the paragraph settings for the specified find operation. Read/write.
Parent | Returns an Object that represents the parent object of the specified Find object.
Replacement | Returns a Replacement object that contains the criteria for a replace operation.
Style | Returns or sets the style for the specified object. Read/write Variant.
Text | Returns or sets the text to find. Read/write String.
Wrap | Returns or sets what happens if the search begins at a point other than the beginning of the document and the end of the document is reached (or vice versa if Forward is set to False) or if the search text isn't found in the specified selection or range. Read/write WdFindWrap.


Find Properties (Word)

 Copy code hover
[image]

Find Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
CorrectHangulEndings | True if Microsoft Word automatically corrects Hangul endings when replacing Hangul text. Read/write Boolean.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Font | Returns or sets a Font object that represents the character formatting of the specified object. Read/write Font.
Format | True if formatting is included in the find operation. Read/write Boolean.
Forward | True if the find operation searches forward through the document. Read/write Boolean.
Found | True if the search produces a match. Read-only Boolean.
Frame | Returns a Frame object that represents the frame formatting for the specified style or find-and-replace operation. Read-only.
HanjaPhoneticHangul | Returns or sets a Boolean that represents whether to locate phonetic Hangul and hanja characters in a Korean langauge find operation. Read/write.
Highlight | True if highlight formatting is included in the find criteria. Read/write Long.
IgnorePunct | Returns or sets a Boolean that represents whether a find operation should ignore punctuation in found text. Read/write.
IgnoreSpace | Returns or sets a Boolean that represents whether a find operation should ignore extra white space in found text. Read/write.
LanguageID | Returns or sets the language for the specified Find object. Read/write WdLanguageID.
LanguageIDFarEast | Returns or sets an East Asian language for the specified object. Read/write WdLanguageID.
LanguageIDOther | Returns or sets the language for the specified object. Read/write WdLanguageID.
MatchAlefHamza | True if find operations match text with matching alef hamzas in an Arabic language document. Read/write Boolean.
MatchAllWordForms | True if all forms of the text to find are found by the find operation (for instance, if the text to find is "sit," "sat" and "sitting" are found as well). Read/write Boolean.
MatchByte | True if Microsoft Word distinguishes between full-width and half-width letters or characters during a search. Read/write Boolean.
MatchCase | True if the find operation is case sensitive. The default is False. Read/write Boolean.
MatchControl | True if find operations match text with matching bidirectional control characters in a right-to-left language document. Read/write Boolean.
MatchDiacritics | True if find operations match text with matching diacritics in a right-to-left language document. Read/write Boolean.
MatchFuzzy | True if Microsoft Word uses the nonspecific search options for Japanese text during a search. Read/write Boolean.
MatchKashida | True if find operations match text with matching kashidas in an Arabic language document. Read/write Boolean.
MatchPhrase | True ignores all white space and control characters between words. Read/write.
MatchPrefix | True to match words beginning with the search string. Read/write.
MatchSoundsLike | True if words that sound similar to the text to find are returned by the find operation. Read/write Boolean.
MatchSuffix | True to match words ending with the search string. Read/write.
MatchWholeWord | True if the find operation locates only entire words and not text that's part of a larger word. Read/write Boolean.
MatchWildcards | True if the text to find contains wildcards. Read/write Boolean.
NoProofing | True if Microsoft Word finds or replaces text that the spelling and grammar checker ignores. Read/write Long.
ParagraphFormat | Returns or sets a ParagraphFormat object that represents the paragraph settings for the specified find operation. Read/write.
Parent | Returns an Object that represents the parent object of the specified Find object.
Replacement | Returns a Replacement object that contains the criteria for a replace operation.
Style | Returns or sets the style for the specified object. Read/write Variant.
Text | Returns or sets the text to find. Read/write String.
Wrap | Returns or sets what happens if the search begins at a point other than the beginning of the document and the end of the document is reached (or vice versa if Forward is set to False) or if the search text isn't found in the specified selection or range. Read/write WdFindWrap.


Find.Application Property (Word)

 Copy code hover
[image]

Find.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a Find object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

Find Object

Other resources

Find Object Members


Find.CorrectHangulEndings Property (Word)

 Copy code hover
[image]

Find.CorrectHangulEndings Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word automatically corrects Hangul endings when replacing Hangul text. Read/write Boolean.

Syntax

expression .CorrectHangulEndings

expression An expression that returns a Find object.

Example

This example sets Microsoft Word to automatically correct Hangul endings when replacing Hangul text.

VBA Copy code Copy code
With Selection.Find
 .Forward = True
 .Wrap = wdFindContinue
 .Format = False
 .CorrectHangulEndings = True
End With

See also

Concepts

Find Object

Other resources

Find Object Members


Find.Creator Property (Word)

 Copy code hover
[image]

Find.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a Find object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Find Object

Other resources

Find Object Members


Find.Font Property (Word)

 Copy code hover
[image]

Find.Font Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Font object that represents the character formatting of the specified object. Read/write Font.

Syntax

expression .Font

expression A variable that represents a Find object.

Remarks

To set this property, specify an expression that returns a Font object.

Example

This example finds the next range of text that's formatted with the Times New Roman font.

VBA Copy code Copy code
With Selection.Find
 .ClearFormatting
 .Font.Name = "Times New Roman"
 .Execute FindText:="", ReplaceWith:="", Format:=True, _
 Forward:=True
End With

See also

Concepts

Find Object

Other resources

Find Object Members


Find.Format Property (Word)

 Copy code hover
[image]

Find.Format Property (Word)
See also Send feedback

Published: July 16, 2012

True if formatting is included in the find operation. Read/write Boolean.

Syntax

expression .Format

expression Required. A variable that represents a Find object.

Example

This example removes all bold formatting in the active document.

VBA Copy code Copy code
With ActiveDocument.Content.Find
 .ClearFormatting
 .Font.Bold = True
 .Format = True
 .Replacement.ClearFormatting
 .Replacement.Font.Bold = False
 .Execute Forward:=True, Replace:=wdReplaceAll, _
 FindText:="", ReplaceWith:=""
End With

See also

Concepts

Find Object

Other resources

Find Object Members


Find.Forward Property (Word)

 Copy code hover
[image]

Find.Forward Property (Word)
See also Send feedback

Published: July 16, 2012

True if the find operation searches forward through the document. Read/write Boolean.

Syntax

expression .Forward

expression A variable that represents a Find object.

Remarks

False causes a Word find operation to search backward through the document.

Example

This example replaces the next occurrence of the word "hi" in the selection with "hello."

VBA Copy code Copy code
With Selection.Find
 .Forward = True
 .Text = "hi"
 .ClearFormatting
 .Replacement.Text = "hello"
 .Execute Replace:=wdReplaceOne
End With

The following example searches backward through the document for the word "Microsoft." If the word is found, it is automatically selected.

VBA Copy code Copy code
Selection.Collapse Direction:=wdCollapseStart
With Selection.Find
 .Forward = False
 .ClearFormatting
 .MatchWholeWord = True
 .MatchCase = False
 .Wrap = wdFindContinue
 .Execute FindText:="Microsoft"
End With

See also

Concepts

Find Object

Other resources

Find Object Members


Find.Found Property (Word)

 Copy code hover
[image]

Find.Found Property (Word)
See also Send feedback

Published: July 16, 2012

True if the search produces a match. Read-only Boolean.

Syntax

expression .Found

expression A variable that represents a Find object.

Example

This example removes formatting from the find criteria before searching the selection. If the word "Hello" with bold formatting is found, the entire paragraph is selected and copied to the Clipboard.

VBA Copy code Copy code
With Selection.Find
 .ClearFormatting
 .Font.Bold = True
 .Execute FindText:="Hello", Format:=True, Forward:=True
 If .Found = True Then
 .Parent.Expand Unit:=wdParagraph
 .Parent.Copy
 End If
End With

See also

Concepts

Find Object

Other resources

Find Object Members


Find.Frame Property (Word)

 Copy code hover
[image]

Find.Frame Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Frame object that represents the frame formatting for the specified style or find-and-replace operation. Read-only.

Syntax

expression .Frame

expression A variable that represents a Find object.

Example

This example finds the first frame with wrap around formatting. If such a frame is found, a message is displayed on the status bar.

VBA Copy code Copy code
With ActiveDocument.Content.Find
 .Text = ""
 .Frame.TextWrap = True
 .Execute Forward:=True, Wrap:=wdFindContinue, Format:=True
 If .Found = True Then StatusBar = "Frame was found"
 .Parent.Select
End With

See also

Concepts

Find Object

Other resources

Find Object Members


Find.HanjaPhoneticHangul Property (Word)

 Copy code hover
[image]

Find.HanjaPhoneticHangul Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents whether to locate phonetic Hangul and hanja characters in a Korean langauge find operation. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .HanjaPhoneticHangul

expression An expression that returns a Find object.

See also

Concepts

Find Object

Other resources

Find Object Members


Find.Highlight Property (Word)

 Copy code hover
[image]

Find.Highlight Property (Word)
See also Send feedback

Published: July 16, 2012

True if highlight formatting is included in the find criteria. Read/write Long.

Syntax

expression .Highlight

expression A variable that represents a Find object.

Remarks

The Highlight property can return or be set to True, False, or wdUndefined. The wdUndefined value can be used with the Find object to ignore the state of highlight formatting in the selection or range that is searched.

Example

This example finds all instances of highlighted text in the active document and removes the highlight formatting by setting the Highlight property of the Replacement object to False.

VBA Copy code Copy code
Dim rngTemp As Range

Set rngTemp = ActiveDocument.Range(Start:=0, End:=0)
With rngTemp.Find
 .ClearFormatting
 .Highlight = True
 With .Replacement
 .ClearFormatting
 .Highlight = False
 End With
 .Execute Replace:=wdReplaceAll, Forward:=True, FindText:="", _
 ReplaceWith:="", Format:=True
End With

See also

Concepts

Find Object

Other resources

Find Object Members


Find.IgnorePunct Property (Word)

 Copy code hover
[image]

Find.IgnorePunct Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents whether a find operation should ignore punctuation in found text. Read/write.

Syntax

expression .IgnorePunct

expression An expression that returns a Find object.

Remarks

This property corresponds to the Ignore punctuation characters check box in the Find and Replace dialog box.

See also

Concepts

Find Object

Other resources

Find Object Members


Find.IgnoreSpace Property (Word)

 Copy code hover
[image]

Find.IgnoreSpace Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents whether a find operation should ignore extra white space in found text. Read/write.

Syntax

expression .IgnoreSpace

expression An expression that returns a Find object.

Remarks

This property corresponds to the Ignore white-space characters check box in the Find and Replace dialog box.

See also

Concepts

Find Object

Other resources

Find Object Members


Find.LanguageID Property (Word)

 Copy code hover
[image]

Find.LanguageID Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the language for the specified Find object. Read/write WdLanguageID.

Syntax

expression .LanguageID

expression An expression that represents a Find object.

Remarks

Some of the WdLanguageID constants may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.

See also

Concepts

Find Object

Other resources

Find Object Members


Find.LanguageIDFarEast Property (Word)

 Copy code hover
[image]

Find.LanguageIDFarEast Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets an East Asian language for the specified object. Read/write WdLanguageID.

Syntax

expression .LanguageIDFarEast

expression Required. A variable that represents a Find object.

Remarks

This is the recommended way to return or set the language of East Asian text in a document created in an East Asian version of Microsoft Word.

See also

Concepts

Find Object

Other resources

Find Object Members


Find.LanguageIDOther Property (Word)

 Copy code hover
[image]

Find.LanguageIDOther Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the language for the specified object. Read/write WdLanguageID.

Syntax

expression .LanguageIDOther

expression Required. A variable that represents a Find object.

Remarks

This is the recommended way to return or set the language of Latin text in a document created in a right-to-left language version of Microsoft Word.

See also

Concepts

Find Object

Other resources

Find Object Members


Find.MatchAlefHamza Property (Word)

 Copy code hover
[image]

Find.MatchAlefHamza Property (Word)
See also Send feedback

Published: July 16, 2012

True if find operations match text with matching alef hamzas in an Arabic language document. Read/write Boolean.

Syntax

expression .MatchAlefHamza

expression An expression that returns a Find object.

Example

This example sets the current find operation to match alef hamzas.

VBA Copy code Copy code
Selection.Find.MatchAlefHamza = True

See also

Concepts

Find Object

Other resources

Find Object Members


Find.MatchAllWordForms Property (Word)

 Copy code hover
[image]

Find.MatchAllWordForms Property (Word)
See also Send feedback

Published: July 16, 2012

True if all forms of the text to find are found by the find operation (for instance, if the text to find is "sit," "sat" and "sitting" are found as well). Read/write Boolean.

Syntax

expression .MatchAllWordForms

expression An expression that returns a Find object.

Remarks

Use the Text property of the Find object or use the FindText argument with the Execute method to specify the text to be located in a document.

Example

This example selects the next form of the word "sit" found in the selection or displays a message box if a form of "sit" isn't found.

VBA Copy code Copy code
With Selection.Find
 .MatchAllWordForms = True
 .Text = "sit"
 .Execute Format:=False
 If .Found = False Then MsgBox "Not Found"
End With

See also

Concepts

Find Object

Other resources

Find Object Members


Find.MatchByte Property (Word)

 Copy code hover
[image]

Find.MatchByte Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word distinguishes between full-width and half-width letters or characters during a search. Read/write Boolean.

Syntax

expression .MatchByte

expression A variable that represents a Find object.

Example

This example searches for the term "マイクロソフト" in the specified range without distinguishing between full-width and half-width characters.

VBA Copy code Copy code
With Selection.Find
    .ClearFormatting
    .MatchWholeWord = True
    .MatchByte = False
    .Execute FindText:="マイクロソフト"
End With

See also

Concepts

Find Object

Other resources

Find Object Members


Find.MatchCase Property (Word)

 Copy code hover
[image]

Find.MatchCase Property (Word)
See also Send feedback

Published: July 16, 2012

True if the find operation is case sensitive. The default is False. Read/write Boolean.

Syntax

expression .MatchCase

expression An expression that returns a Find object.

Remarks

Use the Text property of the Find object or use the FindText argument with the Execute method to specify the text to be located in a document.

Example

This example selects the next occurrence of the word "library" in the selection, regardless of the case.

VBA Copy code Copy code
With Selection.Find
 .ClearFormatting
 .MatchWholeWord = True
 .MatchCase = False
 .Execute FindText:="library"
End With

See also

Concepts

Find Object

Other resources

Find Object Members


Find.MatchControl Property (Word)

 Copy code hover
[image]

Find.MatchControl Property (Word)
See also Send feedback

Published: July 16, 2012

True if find operations match text with matching bidirectional control characters in a right-to-left language document. Read/write Boolean.

Syntax

expression .MatchControl

expression An expression that returns a Find object.

Example

This example sets the current find operation to match bidirectional control characters.

VBA Copy code Copy code
Selection.Find.MatchControl = True

See also

Concepts

Find Object

Other resources

Find Object Members


Find.MatchDiacritics Property (Word)

 Copy code hover
[image]

Find.MatchDiacritics Property (Word)
See also Send feedback

Published: July 16, 2012

True if find operations match text with matching diacritics in a right-to-left language document. Read/write Boolean.

Syntax

expression .MatchDiacritics

expression An expression that returns a Find object.

Example

This example sets the current find operation to match diacritics.

VBA Copy code Copy code
Selection.Find.MatchDiacritics = True

See also

Concepts

Find Object

Other resources

Find Object Members


Find.MatchFuzzy Property (Word)

 Copy code hover
[image]

Find.MatchFuzzy Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word uses the nonspecific search options for Japanese text during a search. Read/write Boolean.

Syntax

expression .MatchFuzzy

expression An expression that returns a Find object.

Example

This example conducts a nonspecific search for "ピアノ" in the selected range and selects the next occurrence.

VBA Copy code Copy code
With Selection.Find
    .ClearFormatting
    .Text = "ピアノ"
    .MatchFuzzy = True
    .Execute Format:=False, Forward:=True, Wrap:=wdFindContinue
End With

See also

Concepts

Find Object

Other resources

Find Object Members


Find.MatchKashida Property (Word)

 Copy code hover
[image]

Find.MatchKashida Property (Word)
See also Send feedback

Published: July 16, 2012

True if find operations match text with matching kashidas in an Arabic language document. Read/write Boolean.

Syntax

expression .MatchKashida

expression An expression that returns a Find object.

Example

This example sets the current find operation to match kashidas.

VBA Copy code Copy code
Selection.Find.MatchKashida = True

See also

Concepts

Find Object

Other resources

Find Object Members


Find.MatchPhrase Property (Word)

 Copy code hover
[image]

Find.MatchPhrase Property (Word)
See also Send feedback

Published: July 16, 2012

True ignores all white space and control characters between words. Read/write.

Syntax

expression .MatchPhrase

expression An expression that returns a Find object.

See also

Concepts

Find Object

Other resources

Find Object Members


Find.MatchPrefix Property (Word)

 Copy code hover
[image]

Find.MatchPrefix Property (Word)
See also Send feedback

Published: July 16, 2012

True to match words beginning with the search string. Read/write.

Syntax

expression .MatchPrefix

expression An expression that returns a Find object.

Remarks

This property corresponds to the Match prefix check box in the Find and Replace dialog box.

See also

Concepts

Find Object

Other resources

Find Object Members


Find.MatchSoundsLike Property (Word)

 Copy code hover
[image]

Find.MatchSoundsLike Property (Word)
See also Send feedback

Published: July 16, 2012

True if words that sound similar to the text to find are returned by the find operation. Read/write Boolean.

Syntax

expression .MatchSoundsLike

expression An expression that returns a Find object.

Remarks

Use the Text property of the Find object or use the FindText argument with the Execute method to specify the text to be located in a document.

Example

This example selects the next word that sounds like the word "fun" (for instance, "funny") in the selection.

VBA Copy code Copy code
With Selection.Find
 .ClearFormatting
 .Text = "fun"
 .MatchFuzzy = False
 .MatchSoundsLike = True
 .Execute Format:=False, Forward:=True, Wrap:=wdFindContinue
End With

See also

Concepts

Find Object

Other resources

Find Object Members


Find.MatchSuffix Property (Word)

 Copy code hover
[image]

Find.MatchSuffix Property (Word)
See also Send feedback

Published: July 16, 2012

True to match words ending with the search string. Read/write.

Syntax

expression .MatchSuffix

expression An expression that returns a Find object.

Remarks

This property corresponds to the Match suffix check box in the Find and Replace dialog box.

See also

Concepts

Find Object

Other resources

Find Object Members


Find.MatchWholeWord Property (Word)

 Copy code hover
[image]

Find.MatchWholeWord Property (Word)
See also Send feedback

Published: July 16, 2012

True if the find operation locates only entire words and not text that's part of a larger word. Read/write Boolean.

Syntax

expression .MatchWholeWord

expression An expression that returns a Find object.

Remarks

Use the Text property of the Find object or the FindText argument with the Execute method to specify the text to be located in a document.

Example

This example clears all formatting from the find and replace criteria before replacing the word "Inc." with "incorporated" throughout the active document.

VBA Copy code Copy code
With ActiveDocument.Content.Find
 .ClearFormatting
 .Replacement.ClearFormatting
 .MatchWholeWord = True
 .Execute FindText:="Inc.", _
 ReplaceWith:="incorporated", Replace:=wdReplaceAll
End With

See also

Concepts

Find Object

Other resources

Find Object Members


Find.MatchWildcards Property (Word)

 Copy code hover
[image]

Find.MatchWildcards Property (Word)
See also Send feedback

Published: July 16, 2012

True if the text to find contains wildcards. Read/write Boolean.

Syntax

expression .MatchWildcards

expression An expression that returns a Find object.

Remarks

The MatchWildcards property corresponds to the Use wildcards check box in the Find and Replace dialog box (Edit menu).

Use the Text property of the Find object or use the FindText argument with the Execute method to specify the text to be located in a document.

Example

This example finds and selects the next three-letter word that begins with "s" and ends with "t."

VBA Copy code Copy code
With Selection.Find
 .ClearFormatting
 .Text = "s?t"
 .MatchAllWordForms = False
 .MatchSoundsLike = False
 .MatchFuzzy = False
 .MatchWildcards = True
 .Execute Format:=False, Forward:=True
End With

See also

Concepts

Find Object

Other resources

Find Object Members


Find.NoProofing Property (Word)

 Copy code hover
[image]

Find.NoProofing Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word finds or replaces text that the spelling and grammar checker ignores. Read/write Long.

Syntax

expression .NoProofing

expression A variable that represents a Find object.

Example

This example searches for the string "hi" in text that the spelling and grammar checker ignores.

VBA Copy code Copy code
With Selection.Find
 .ClearFormatting
 .Text = "hi"
 .NoProofing = True
 .Execute Forward:=True
End With

See also

Concepts

Find Object

Other resources

Find Object Members


Find.ParagraphFormat Property (Word)

 Copy code hover
[image]

Find.ParagraphFormat Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a ParagraphFormat object that represents the paragraph settings for the specified find operation. Read/write.

Syntax

expression .ParagraphFormat

expression A variable that represents a Find object.

Example

This example finds all double-spaced paragraphs in the active document and replaces the formatting with 1.5-line spacing.

VBA Copy code Copy code
With ActiveDocument.Content.Find
 .ClearFormatting
 .ParagraphFormat.Space2
 .Replacement.ClearFormatting
 .Replacement.ParagraphFormat.Space15
 .Execute FindText:="", ReplaceWith:="", _
 Replace:=wdReplaceAll
End With

See also

Concepts

Find Object

Other resources

Find Object Members


Find.Parent Property (Word)

 Copy code hover
[image]

Find.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Find object.

Syntax

expression .Parent

expression Required. A variable that represents a Find object.

See also

Concepts

Find Object

Other resources

Find Object Members


Find.Replacement Property (Word)

 Copy code hover
[image]

Find.Replacement Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Replacement object that contains the criteria for a replace operation.

Syntax

expression .Replacement

expression An expression that returns a Find object.

Example

This example removes bold formatting from the active document. The Bold property of the Font object is True for the Find object and False for the Replacement object.

VBA Copy code Copy code
With ActiveDocument.Content.Find
 .ClearFormatting
 .Font.Bold = True
 With .Replacement
 .ClearFormatting
 .Font.Bold = False
 End With
 .Execute FindText:="", ReplaceWith:="", Format:=True, _
 Replace:=wdReplaceAll
End With

This example finds every instance of the word "Start" in the active document and replaces it with "End." The find operation ignores formatting but matches the case of the text to find ("Start").

VBA Copy code Copy code
Set myRange = ActiveDocument.Range(Start:=0, End:=0)
With myRange.Find
 .ClearFormatting
 .Text = "Start"
 With .Replacement
 .ClearFormatting
 .Text = "End"
 End With
 .Execute Replace:=wdReplaceAll, _
 Format:=True, MatchCase:=True, _
 MatchWholeWord:=True
End With

See also

Concepts

Find Object

Other resources

Find Object Members


Find.Style Property (Word)

 Copy code hover
[image]

Find.Style Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the style for the specified object. Read/write Variant.

Syntax

expression .Style

expression Required. A variable that represents a Find object.

Remarks

To set this property, specify the local name of the style, an integer, a WdBuiltinStyle constant, or an object that represents the style.

See also

Concepts

Find Object

Other resources

Find Object Members


Find.Text Property (Word)

 Copy code hover
[image]

Find.Text Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the text to find. Read/write String.

Syntax

expression .Text

expression A variable that represents a Find object.

Remarks

The Text property returns the plain, unformatted text of the selection or range. When you set this property, the text of the range or selection is replaced.

Example

This example replaces "Hello" with "Goodbye" in the active document.

VBA Copy code Copy code
Set myRange = ActiveDocument.Content
With myRange.Find
 .ClearFormatting
 .Replacement.ClearFormatting
 .Text = "Hello"
 .Replacement.Text = "Goodbye"
 .Execute Replace:=wdReplaceAll
End With

See also

Concepts

Find Object

Other resources

Find Object Members


Find.Wrap Property (Word)

 Copy code hover
[image]

Find.Wrap Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets what happens if the search begins at a point other than the beginning of the document and the end of the document is reached (or vice versa if Forward is set to False) or if the search text isn't found in the specified selection or range. Read/write WdFindWrap.

Syntax

expression .Wrap

expression Required. A variable that represents a Find object.

Example

The following example searches forward through the document for the word "aspirin." When the end of the document is reached, the search continues at the beginning of the document. If the word "aspirin" is found, it is selected.

VBA Copy code Copy code
Sub WordFind()
 With Selection.Find
 .Forward = True
 .ClearFormatting
 .MatchWholeWord = True
 .MatchCase = False
 .Wrap = wdFindContinue
 .Execute FindText:="aspirin"
 End With
End Sub

See also

Concepts

Find Object

Other resources

Find Object Members


Find Methods (Word)

 Copy code hover
[image]

Find Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
ClearAllFuzzyOptions | Clears all nonspecific search options associated with Japanese text.
ClearFormatting | Removes text and paragraph formatting from the text specified in a find or replace operation.
ClearHitHighlight | Removes the highlighting for all text located in a hit highlighting find operation, and returns a Boolean that represents whether the operation was successful.
Execute | Runs the specified find operation. Returns True if the find operation is successful. Boolean.
Execute2007 | Runs the specified find operation. Returns True if the find operation is successful.
HitHighlight | Highlights all found matches and returns a Boolean that represents whether matches were found.
SetAllFuzzyOptions | Activates all nonspecific search options associated with Japanese text.


Find.ClearAllFuzzyOptions Method (Word)

 Copy code hover
[image]

Find.ClearAllFuzzyOptions Method (Word)
See also Send feedback

Published: July 16, 2012

Clears all nonspecific search options associated with Japanese text.

Syntax

expression .ClearAllFuzzyOptions

expression Required. A variable that represents a Find object.

Remarks

This method sets the following properties to False:

MatchFuzzyAY | MatchFuzzyKanji
MatchFuzzyBV | MatchFuzzyKiKu
MatchFuzzyByte | MatchFuzzyOldKana
MatchFuzzyCase | MatchFuzzyProlongedSoundMark
MatchFuzzyDash | MatchFuzzyPunctuation
MatchFuzzyDZ | MatchFuzzySmallKana
MatchFuzzyHF | MatchFuzzySpace
MatchFuzzyHiragana | MatchFuzzyTC
MatchFuzzyIterationMark | MatchFuzzyZJ

Example

This example clears all nonspecific search options before executing a search in the selected range. If the word "バイオリン" is formatted as bold, the entire paragraph will be selected and copied to the Clipboard.

VBA Copy code Copy code
With Selection.Find
    .ClearFormatting
    .ClearAllFuzzyOptions
    .Font.Bold = True
    .Execute FindText:="バイオリン", Format:=True, Forward:=True
    If .Found = True Then
        .Parent.Expand Unit:=wdParagraph
        .Parent.Copy
    End If
End With

See also

Concepts

Find Object

Other resources

Find Object Members


Find.ClearFormatting Method (Word)

 Copy code hover
[image]

Find.ClearFormatting Method (Word)
See also Send feedback

Published: July 16, 2012

Removes text and paragraph formatting from the text specified in a find or replace operation.

Syntax

expression .ClearFormatting

expression A variable that represents a Find object.

Example

This example removes formatting from the find criteria before searching through the selection. If the word "Hello" with bold formatting is found, the entire paragraph is selected and copied to the Clipboard.

VBA Copy code Copy code
Sub ClrFmtgFind()
 With Selection.Find
 .ClearFormatting
 .Font.Bold = True
 .Execute FindText:="Hello", Format:=True, Forward:=True
 If .Found = True Then
 .Parent.Expand Unit:=wdParagraph
 .Parent.Copy
 End If
 End With
End Sub

See also

Concepts

Find Object

Other resources

Find Object Members


Find.ClearHitHighlight Method (Word)

 Copy code hover
[image]

Find.ClearHitHighlight Method (Word)
See also Send feedback

Published: July 16, 2012

Removes the highlighting for all text located in a hit highlighting find operation, and returns a Boolean that represents whether the operation was successful.

Version Information

Version Added: Word 2007

Syntax

expression .ClearHitHighlight

expression An expression that returns a Find object.

Return Value

Boolean

Remarks

Use the HitHighlight method to highlight found text.

See also

Concepts

Find Object

Other resources

Find Object Members


Find.Execute Method (Word)

 Copy code hover
[image]

Find.Execute Method (Word)
See also Send feedback

Published: July 16, 2012

Runs the specified find operation. Returns True if the find operation is successful. Boolean.

Syntax

expression .Execute(FindText, MatchCase, MatchWholeWord, MatchWildcards, MatchSoundsLike, MatchAllWordForms, Forward, Wrap, Format, ReplaceWith, Replace, MatchKashida, MatchDiacritics, MatchAlefHamza, MatchControl)

expression Required. A variable that represents a Find object.

Parameters

Name | Required/Optional | Data Type | Description
FindText | Optional | Variant | The text to be searched for. Use an empty string ("") to search for formatting only. You can search for special characters by specifying appropriate character codes. For example, "^p" corresponds to a paragraph mark and "^t" corresponds to a tab character.
MatchCase | Optional | Variant | True to specify that the find text be case sensitive. Corresponds to the Match case check box in the Find and Replace dialog box (Edit menu).
MatchWholeWord | Optional | Variant | True to have the find operation locate only entire words, not text that is part of a larger word. Corresponds to the Find whole words only check box in the Find and Replace dialog box.
MatchWildcards | Optional | Variant | True to have the find text be a special search operator. Corresponds to the Use wildcards check box in the Find and Replace dialog box.
MatchSoundsLike | Optional | Variant | True to have the find operation locate words that sound similar to the find text. Corresponds to the Sounds like check box in the Find and Replace dialog box.
MatchAllWordForms | Optional | Variant | True to have the find operation locate all forms of the find text (for example, "sit" locates "sitting" and "sat"). Corresponds to the Find all word forms check box in the Find and Replace dialog box.
Forward | Optional | Variant | True to search forward (toward the end of the document).
Wrap | Optional | Variant | Controls what happens if the search begins at a point other than the beginning of the document and the end of the document is reached (or vice versa if Forward is set to False). This argument also controls what happens if there is a selection or range and the search text is not found in the selection or range. Can be one of the WdFindWrap constants.
Format | Optional | Variant | True to have the find operation locate formatting in addition to, or instead of, the find text.
ReplaceWith | Optional | Variant | The replacement text. To delete the text specified by the Find argument, use an empty string (""). You specify special characters and advanced search criteria just as you do for the Find argument. To specify a graphic object or other nontext item as the replacement, move the item to the Clipboard and specify "^c" for ReplaceWith.
Replace | Optional | Variant | Specifies how many replacements are to be made: one, all, or none. Can be any WdReplace constant.
MatchKashida | Optional | Variant | True if find operations match text with matching kashidas in an Arabic-language document. This argument may not be available to you, depending on the language support (U.S. English, for example) that you have selected or installed.
MatchDiacritics | Optional | Variant | True if find operations match text with matching diacritics in a right-to-left language document. This argument may not be available to you, depending on the language support (U.S. English, for example) that you have selected or installed.
MatchAlefHamza | Optional | Variant | True if find operations match text with matching alef hamzas in an Arabic-language document. This argument may not be available to you, depending on the language support (U.S. English, for example) that you have selected or installed.
MatchControl | Optional | Variant | True if find operations match text with matching bidirectional control characters in a right-to-left language document. This argument may not be available to you, depending on the language support (U.S. English, for example) that you have selected or installed.
MatchPrefix | Optional | Variant | True to match words beginning with the search string. Corresponds to the Match prefix check box in the Find and Replace dialog box.
MatchSuffix | Optional | Variant | True to match words ending with the search string. Corresponds to the Match suffix check box in the Find and Replace dialog box.
MatchPhrase | Optional | Variant | True ignores all white space and control characters between words.
IgnoreSpace | Optional | Variant | True ignores all white space between words. Corresponds to the Ignore white-space characters check box in the Find and Replace dialog box.
IgnorePunct | Optional | Variant | True ignores all punctuation characters between words. Corresponds to the Ignore punctuation check box in the Find and Replace dialog box.

Return Value

Boolean

Remarks

If MatchWildcards is True, you can specify wildcard characters and other advanced search criteria for the FindText argument. For example, "*(ing)" finds any word that ends in "ing".

To search for a symbol character, type a caret (^), a zero (0), and then the symbol's character code. For example, "^0151" corresponds to an em dash (—).

Unless otherwise specified, replacement text inherits the formatting of the text it replaces in the document. For example, if you replace the string "abc" with "xyz", occurrences of "abc" with bold formatting are replaced with the string "xyz" with bold formatting.

Also, if MatchCase is False, occurrences of the search text that are uppercase will be replaced with an uppercase version of the replacement text, regardless of the case of the replacement text. Using the previous example, occurrences of "ABC" are replaced with "XYZ".

Example

This example finds and selects the next occurrence of the word "library".

VBA Copy code Copy code
With Selection.Find
    .ClearFormatting
    .MatchWholeWord = True
    .MatchCase = False
    .Execute FindText:="library"
End With

This example finds all occurrences of the word "hi" in the active document and replaces each occurrence with "hello".

VBA Copy code Copy code
Set myRange = ActiveDocument.Content
myRange.Find.Execute FindText:="hi", _
    ReplaceWith:="hello", Replace:=wdReplaceAll

See also

Concepts

Find Object

Other resources

Find Object Members


Find.Execute2007 Method (Word)

 Copy code hover
[image]

Find.Execute2007 Method (Word)
See also Send feedback

Published: July 16, 2012

Runs the specified find operation. Returns True if the find operation is successful.

Version Information

Version Added: Word 2007

Syntax

expression .Execute2007(FindText, MatchCase, MatchWholeWord, MatchWildcards, MatchSoundsLike, MatchAllWordForms, Forward, Wrap, Format, ReplaceWith, Replace, MatchKashida, MatchDiacritics, MatchAlefHamza, MatchControl, MatchPrefix, MatchSuffix, MatchPhrase, IgnoreSpace, IgnorePunct)

expression A variable that represents a Find object.

Parameters

Name | Required/Optional | Data Type | Description
FindText | Optional | Variant | The text to be searched for. Use an empty string ("") to search for formatting only. You can search for special characters by specifying appropriate character codes. For example, "^p" corresponds to a paragraph mark and "^t" corresponds to a tab character.
MatchCase | Optional | Variant | True to specify that the text to find should be case-sensitive. Corresponds to the Match case check box in the Find and Replace dialog box (on the Home tab in the Editing group).
MatchWholeWord | Optional | Variant | True to find only entire words, not text that is part of a larger word. Corresponds to the Find whole words only check box in the Find and Replace dialog box.
MatchWildcards | Optional | Variant | True to use wildcard search operators in the text to find. Corresponds to the Use wildcards check box in the Find and Replace dialog box.
MatchSoundsLike | Optional | Variant | True to locate words that sound similar to the text to find. Corresponds to the Sounds like check box in the Find and Replace dialog box.
MatchAllWordForms | Optional | Variant | True to locate all forms of the text to find (for example, "sit" locates "sitting" and "sat"). Corresponds to the Find all word forms check box in the Find and Replace dialog box.
Forward | Optional | Variant | True to search forward (toward the end of the document).
Wrap | Optional | Variant | One of the WdFindWrap constants that controls what happens if the search begins at a point other than the beginning of the document and the end of the document is reached (or vice versa if Forward is set to False). This argument also controls what happens if there is a selection or range and the search text is not found in the selection or range.
Format | Optional | Variant | True to locate formatting in addition to, or instead of, the text to find.
ReplaceWith | Optional | Variant | The replacement text. To delete the text specified by the Find argument, use an empty string (""). You specify special characters and advanced search criteria just as you do for the Find argument. To specify a graphic object or other nontext item as the replacement, move the item to the Clipboard and specify "^c" for ReplaceWith.
Replace | Optional | Variant | One of the WdReplace constants that specifies how many replacements are to be made: one, all, or none.
MatchKashida | Optional | Variant | True to find matching kashidas in an Arabic-language document. This argument may not be available to you, depending on the language support (for example, U.S. English) that you have selected or installed.
MatchDiacritics | Optional | Variant | True to find matching diacritics in a right-to-left language document. This argument may not be available to you, depending on the language support (for example, U.S. English) that you have selected or installed.
MatchAlefHamza | Optional | Variant | True to find matching alef hamzas in an Arabic-language document. This argument may not be available to you, depending on the language support (for example, U.S. English) that you have selected or installed.
MatchControl | Optional | Variant | True to find matching bidirectional control characters in a right-to-left language document. This argument may not be available to you, depending on the language support (for example, U.S. English) that you have selected or installed.
MatchPrefix | Optional | Variant | True to find words that begin with the search string. Corresponds to the Match prefix check box in the Find and Replace dialog box.
MatchSuffix | Optional | Variant | True to find words that end with the search string. Corresponds to the Match suffix check box in the Find and Replace dialog box.
MatchPhrase | Optional | Variant | True to ignore all white space and control characters between words.
IgnoreSpace | Optional | Variant | True to ignore all white space between words. Corresponds to the Ignore white-space characters check box in the Find and Replace dialog box.
IgnorePunct | Optional | Variant | True to ignore all punctuation characters between words. Corresponds to the Ignore punctuation check box in the Find and Replace dialog box.

Return Value

A Boolean value that indicates whether the find operation was successful.

Remarks

If MatchWildcards is True, you can specify wildcard characters and other advanced search criteria for the FindText argument. For example, "*(ing)" finds any word that ends in "ing".

To search for a symbol character, type a caret (^), a zero (0), and then the symbol's character code. For example, "^0151" corresponds to an em dash (—).

Unless otherwise specified, replacement text inherits the formatting of the text it replaces in the document. For example, if you replace the string "abc" with "xyz", occurrences of "abc" with bold formatting are replaced with the string "xyz" with bold formatting.

Also, if MatchCase is False, occurrences of the search text that are uppercase will be replaced with an uppercase version of the replacement text, regardless of the case of the replacement text. Using the previous example, occurrences of "ABC" are replaced with "XYZ".

Example

The following example finds and selects the next occurrence of the word "library".

VBA Copy code Copy code
With Selection.Find
 .ClearFormatting
 .MatchWholeWord = True
 .MatchCase = False
 .Execute2007 FindText:="library"
End With

The following example finds all occurrences of the word "hi" in the active document and replaces each occurrence with "hello".

VBA Copy code Copy code
Set myRange = ActiveDocument.Content
myRange.Find.Execute2007 FindText:="hi", _
 ReplaceWith:="hello", Replace:=wdReplaceAll

See also

Concepts

Find Object

Other resources

Find Object Members


Find.HitHighlight Method (Word)

 Copy code hover
[image]

Find.HitHighlight Method (Word)
See also Send feedback

Published: July 16, 2012

Highlights all found matches and returns a Boolean that represents whether matches were found.

Syntax

expression .HitHighlight(FindText, HighlightColor, TextColor, MatchCase, MatchWholeWord, MatchPrefix, MatchSuffix, MatchPhrase, MatchWildcards, MatchSoundsLike, MatchAllWordForms, MatchByte, MatchFuzzy, MatchKashida, MatchDiacritics, MatchAlefHamza, MatchControl, IgnoreSpace, IgnorePunct, HanjaPhoneticHangul)

expression An expression that returns a Find object.

Parameters

Name | Required/Optional | Data Type | Description
FindText | Required | Variant | Specifies the text to find. Use an empty string ("") to search for formatting only. You can search for special characters by specifying appropriate character codes. For example, "^p" corresponds to a paragraph mark and "^t" corresponds to a tab character.
HighlightColor | Optional | Variant | Specifies the highlight color for the text. Can be any RGB color or one of the WdColor constants.
TextColor | Optional | Variant | Specifies the color of the text. Can be any RGB color or one of the WdColor constants.
MatchCase | Optional | Variant | True to specify that the find text be case-sensitive. Corresponds to the Match case check box in the Find and Replace dialog box.
MatchWholeWord | Optional | Variant | True to have the find operation locate only entire words, not text that is part of a larger word. Corresponds to the Find whole words only check box in the Find and Replace dialog box.
MatchPrefix | Optional | Variant | True to match words beginning with the search string. Corresponds to the Match prefix check box in the Find and Replace dialog box.
MatchSuffix | Optional | Variant | True to match words ending with the search string. Corresponds to the Match suffix check box in the Find and Replace dialog box.
MatchPhrase | Optional | Variant | True ignores all white space and control characters between words.
MatchWildcards | Optional | Variant | True to have the find text be a special search operator. Corresponds to the Use wildcards check box in the Find and Replace dialog box.
MatchSoundsLike | Optional | Variant | True to have the find operation locate words that sound similar to the find text. Corresponds to the Sounds like check box in the Find and Replace dialog box.
MatchAllWordForms | Optional | Variant | True to have the find operation locate all forms of the find text (for example, "sit" locates "sitting" and "sat"). Corresponds to the Find all word forms check box in the Find and Replace dialog box.
MatchByte | Optional | Variant | True to distinguish between full-width and half-width letters or characters during a search.
MatchFuzzy | Optional | Variant | True to use the nonspecific search options for Japanese text during a search. Read/write.
MatchKashida | Optional | Variant | True if find operations match text with matching kashidas in an Arabic-language document. This argument may not be available to you, depending on the language support (U.S. English, for example) that you have selected or installed.
MatchDiacritics | Optional | Variant | True if find operations match text with matching diacritics in a right-to-left language document. This argument may not be available to you, depending on the language support (U.S. English, for example) that you have selected or installed.
MatchAlefHamza | Optional | Variant | True if find operations match text with matching alef hamzas in an Arabic-language document. This argument may not be available to you, depending on the language support (U.S. English, for example) that you have selected or installed.
MatchControl | Optional | Variant | True if find operations match text with matching bidirectional control characters in a right-to-left language document. This argument may not be available to you, depending on the language support (U.S. English, for example) that you have selected or installed.
IgnoreSpace | Optional | Variant | True ignores all white space between words. Corresponds to the Ignore white-space characters check box in the Find and Replace dialog box.
IgnorePunct | Optional | Variant | True ignores all punctuation characters between words. Corresponds to the Ignore punctuation check box in the Find and Replace dialog box.
HanjaPhoneticHangul | Optional | Variant | True ignores phonetic hangul and hanja characters. Available only if you have support for Korean languages.

Return Value

Boolean

Remarks

The HitHighlight method applies primarily to search highlighting in Microsoft Office Outlook when Microsoft Word is specified as the e-mail editor. However, you can use this method on documents inside Word if you want to highlight found text. Otherwise, use the Execute method.

See also

Concepts

Find Object

Other resources

Find Object Members


Find.SetAllFuzzyOptions Method (Word)

 Copy code hover
[image]

Find.SetAllFuzzyOptions Method (Word)
See also Send feedback

Published: July 16, 2012

Activates all nonspecific search options associated with Japanese text.

Syntax

expression .SetAllFuzzyOptions

expression Required. A variable that represents a Find object.

Remarks

This method sets the following properties to True:

MatchFuzzyAY | MatchFuzzyKanji
MatchFuzzyBV | MatchFuzzyKiKu
MatchFuzzyByte | MatchFuzzyOldKana
MatchFuzzyCase | MatchFuzzyProlongedSoundMark
MatchFuzzyDash | MatchFuzzyPunctuation
MatchFuzzyDZ | MatchFuzzySmallKana
MatchFuzzyHF | MatchFuzzySpace
MatchFuzzyHiragana | MatchFuzzyTC
MatchFuzzyIterationMark | MatchFuzzyZJ

Example

This example activates all nonspecific options before executing a search in the selected range. If the word "バイオリン" is formatted as bold, the entire paragraph is selected and copied to the Clipboard.

VBA Copy code Copy code
With Selection.Find
    .ClearFormatting
    .SetAllFuzzyOptions
    .Font.Bold = True
    .Execute FindText:=" バイオリン", Format:=True, Forward:=True
    If .Found = True Then
        .Parent.Expand Unit:=wdParagraph
        .Parent.Copy
    End If
End With

See also

Concepts

Find Object

Other resources

Find Object Members


FirstLetterException Object (Word)

 Copy code hover
[image]

FirstLetterException Object (Word)
See also Send feedback

Published: July 16, 2012

Represents an abbreviation excluded from automatic correction. The FirstLetterExceptions object is a member of the FirstLetterExceptions collection.

Remarks

The FirstLetterExceptions collection includes all the excluded abbreviations.The first character following a period is automatically capitalized when the CorrectSentenceCaps property is set to True. The character you type following an item in the FirstLetterExceptions collection isn't capitalized.

Use FirstLetterExceptions(Index), where Index is the abbreviation or the index number, to return a single FirstLetterException object. The following example deletes the abbreviation "appt." from the FirstLetterExceptions collection.

VBA Copy code Copy code
AutoCorrect.FirstLetterExceptions("appt.").Delete

The following example displays the name of the first item in the FirstLetterExceptions collection.

VBA Copy code Copy code
MsgBox AutoCorrect.FirstLetterExceptions(1).Name

Use the Add method to add an abbreviation to the list of first-letter exceptions. The following example adds the abbreviation "addr." to this list.

VBA Copy code Copy code
AutoCorrect.FirstLetterExceptions.Add Name:="addr."

See also

Concepts

Word Object Model Reference

Other resources

FirstLetterException Object Members


FirstLetterException Members (Word)

 Copy code hover
[image]

FirstLetterException Members (Word)
Send feedback

Published: July 16, 2012

Represents an abbreviation excluded from automatic correction. The FirstLetterExceptions object is a member of the FirstLetterExceptions collection.

Methods

Name | Description
Delete | Deletes the FirstLetterException object.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Index | Returns a Long that represents the position of an item in a collection. Read-only.
Name | Returns name of the specified object. Read-only String.
Parent | Returns an Object that represents the parent object of the specified FirstLetterException object.


FirstLetterException Properties (Word)

 Copy code hover
[image]

FirstLetterException Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Index | Returns a Long that represents the position of an item in a collection. Read-only.
Name | Returns name of the specified object. Read-only String.
Parent | Returns an Object that represents the parent object of the specified FirstLetterException object.


FirstLetterException.Application Property (Word)

 Copy code hover
[image]

FirstLetterException.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a FirstLetterException object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

FirstLetterException Object

Other resources

FirstLetterException Object Members


FirstLetterException.Creator Property (Word)

 Copy code hover
[image]

FirstLetterException.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a FirstLetterException object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

FirstLetterException Object

Other resources

FirstLetterException Object Members


FirstLetterException.Index Property (Word)

 Copy code hover
[image]

FirstLetterException.Index Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the position of an item in a collection. Read-only.

Syntax

expression .Index

expression Required. A variable that represents a FirstLetterException object.

See also

Concepts

FirstLetterException Object

Other resources

FirstLetterException Object Members


FirstLetterException.Name Property (Word)

 Copy code hover
[image]

FirstLetterException.Name Property (Word)
See also Send feedback

Published: July 16, 2012

Returns name of the specified object. Read-only String.

Syntax

expression .Name

expression Required. A variable that represents a FirstLetterException object.

See also

Concepts

FirstLetterException Object

Other resources

FirstLetterException Object Members


FirstLetterException.Parent Property (Word)

 Copy code hover
[image]

FirstLetterException.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified FirstLetterException object.

Syntax

expression .Parent

expression Required. A variable that represents a FirstLetterException object.

See also

Concepts

FirstLetterException Object

Other resources

FirstLetterException Object Members


FirstLetterException Methods (Word)

 Copy code hover
[image]

FirstLetterException Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the FirstLetterException object.


FirstLetterException.Delete Method (Word)

 Copy code hover
[image]

FirstLetterException.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the FirstLetterException object.

Syntax

expression .Delete

expression Required. A variable that represents a FirstLetterException object.

See also

Concepts

FirstLetterException Object

Other resources

FirstLetterException Object Members


FirstLetterExceptions Object (Word)

 Copy code hover
[image]

FirstLetterExceptions Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of FirstLetterException objects that represent the abbreviations excluded from automatic correction.

Remarks

The first character following a period is automatically capitalized when the CorrectSentenceCaps property is set to True. The FirstLetterExceptions collection includes exceptions to this behavior (for example, abbreviations such as "addr." and "apt.").

Use the FirstLetterExceptions property to return the FirstLetterExceptions collection. The following example deletes the abbreviation "addr." if it is included in the FirstLetterExceptions collection.

VBA Copy code Copy code
For Each aExcept In AutoCorrect.FirstLetterExceptions
 If aExcept.Name = "addr." Then aExcept.Delete
Next aExcept

The following example creates a new document and inserts all the AutoCorrect first-letter exceptions into it.

VBA Copy code Copy code
Documents.Add
For Each aExcept In AutoCorrect.FirstLetterExceptions
 With Selection
 .InsertAfter aExcept.Name
 .InsertParagraphAfter
 .Collapse Direction:=wdCollapseEnd
 End With
Next aExcept

Use the Add method to add an abbreviation to the list of first-letter exceptions. The following example adds the abbreviation "addr." to this list.

VBA Copy code Copy code
AutoCorrect.FirstLetterExceptions.Add Name:="addr."

Use FirstLetterExceptions(Index), where Index is the abbreviation or the index number, to return a single FirstLetterException object. The following example deletes the abbreviation "appt." from the FirstLetterExceptions collection.

VBA Copy code Copy code
AutoCorrect.FirstLetterExceptions("appt.").Delete

The following example displays the name of the first item in the FirstLetterExceptions collection.

VBA Copy code Copy code
MsgBox AutoCorrect.FirstLetterExceptions(1).Name

See also

Concepts

Word Object Model Reference

Other resources

FirstLetterExceptions Object Members


FirstLetterExceptions Members (Word)

 Copy code hover
[image]

FirstLetterExceptions Members (Word)
Send feedback

Published: July 16, 2012

A collection of FirstLetterException objects that represent the abbreviations excluded from automatic correction.

Methods

Name | Description
Add | Returns a FirstLetterException object that represents a new exception added to the list of AutoCorrect exceptions.
Item | Returns an individual FirstLetterException object in a collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of first letter exceptions in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified FirstLetterExceptions object.


FirstLetterExceptions Properties (Word)

 Copy code hover
[image]

FirstLetterExceptions Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of first letter exceptions in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified FirstLetterExceptions object.


FirstLetterExceptions.Application Property (Word)

 Copy code hover
[image]

FirstLetterExceptions.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a FirstLetterExceptions collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

FirstLetterExceptions Collection Object

Other resources

FirstLetterExceptions Object Members


FirstLetterExceptions.Count Property (Word)

 Copy code hover
[image]

FirstLetterExceptions.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of first letter exceptions in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents a FirstLetterExceptions collection.

See also

Concepts

FirstLetterExceptions Collection Object

Other resources

FirstLetterExceptions Object Members


FirstLetterExceptions.Creator Property (Word)

 Copy code hover
[image]

FirstLetterExceptions.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a FirstLetterExceptions collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

FirstLetterExceptions Collection Object

Other resources

FirstLetterExceptions Object Members


FirstLetterExceptions.Parent Property (Word)

 Copy code hover
[image]

FirstLetterExceptions.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified FirstLetterExceptions object.

Syntax

expression .Parent

expression Required. A variable that represents a FirstLetterExceptions collection.

See also

Concepts

FirstLetterExceptions Collection Object

Other resources

FirstLetterExceptions Object Members


FirstLetterExceptions Methods (Word)

 Copy code hover
[image]

FirstLetterExceptions Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Returns a FirstLetterException object that represents a new exception added to the list of AutoCorrect exceptions.
Item | Returns an individual FirstLetterException object in a collection.


FirstLetterExceptions.Add Method (Word)

 Copy code hover
[image]

FirstLetterExceptions.Add Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a FirstLetterException object that represents a new exception added to the list of AutoCorrect exceptions.

Syntax

expression .Add(Name)

expression Required. A variable that represents a FirstLetterExceptions collection.

Parameters

Name | Required/Optional | Data Type | Description
Name | Required | String | The word with two initial capital letters that you want Microsoft Word to overlook.

Return Value

FirstLetterException

Remarks

If the FirstLetterAutoAdd property is True, abbreviations are automatically added to the list of first-letter exceptions.

Example

This example adds the abbreviation addr. to the list of first-letter exceptions.

VBA Copy code Copy code
AutoCorrect.FirstLetterExceptions.Add Name:="addr."

See also

Concepts

FirstLetterExceptions Collection Object

Other resources

FirstLetterExceptions Object Members


FirstLetterExceptions.Item Method (Word)

 Copy code hover
[image]

FirstLetterExceptions.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual FirstLetterException object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents a FirstLetterExceptions collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The individual object to be returned. Can be a Long indicating the ordinal position or a String representing the name of the individual object.

Return Value

FirstLetterException

See also

Concepts

FirstLetterExceptions Collection Object

Other resources

FirstLetterExceptions Object Members


Floor Object (Word)

 Copy code hover
[image]

Floor Object (Word)
See also Send feedback

Published: July 16, 2012

Represents the floor of a 3-D chart.

Version Information

Version Added: Word 2007

Example

Use the Floor property to return the Floor object. The following example sets the floor color for embedded chart one to cyan. The example will fail if the chart is not a 3-D chart.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.Floor.Interior.Color = RGB(0, 255, 255)
 End If
End With

See also

Concepts

Word Object Model Reference

Other resources

Floor Object Members


Floor Members (Word)

 Copy code hover
[image]

Floor Members (Word)
Send feedback

Published: July 16, 2012

Represents the floor of a 3-D chart.

Methods

Name | Description
ClearFormats | Clears the formatting of the object.
Paste | Pastes a picture from the Clipboard on the floor of the specified chart.
Select | Selects the object.

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Format | Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.
Name | Returns the name of the object. Read-only String.
Parent | Returns the parent for the specified object. Read-only Object.
PictureType | Returns or sets a value that specifies how pictures are displayed on the walls and faces of a 3-D chart. Read/write Variant.
Thickness | Returns or sets the thickness of the floor. Read/write Long.


Floor Properties (Word)

 Copy code hover
[image]

Floor Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Format | Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.
Name | Returns the name of the object. Read-only String.
Parent | Returns the parent for the specified object. Read-only Object.
PictureType | Returns or sets a value that specifies how pictures are displayed on the walls and faces of a 3-D chart. Read/write Variant.
Thickness | Returns or sets the thickness of the floor. Read/write Long.


Floor.Application Property (Word)

 Copy code hover
[image]

Floor.Application Property (Word)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Application

expression A variable that represents a Floor object.

Example

The following example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveDocument
If myObject.Application.Value = "Microsoft Word" Then
 MsgBox "This is a Word Application object."
Else
 MsgBox "This is not a Word Application object."
End If

See also

Concepts

Floor Object

Other resources

Floor Object Members


Floor.Creator Property (Word)

 Copy code hover
[image]

Floor.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version Information

Version Added: Word 2007

Syntax

expression .Creator

expression A variable that represents a Floor object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD". This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Word has the creator code MSWD. For more information about this property, consult the language reference Help included with Microsoft Office for Mac.

See also

Concepts

Floor Object

Other resources

Floor Object Members


Floor.Format Property (Word)

 Copy code hover
[image]

Floor.Format Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.

Version Information

Version Added: Word 2007

Syntax

expression .Format

expression A variable that represents a Floor object.

See also

Concepts

Floor Object

Other resources

Floor Object Members


Floor.Name Property (Word)

 Copy code hover
[image]

Floor.Name Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the name of the object. Read-only String.

Version Information

Version Added: Word 2007

Syntax

expression .Name

expression A variable that represents a Floor object.

See also

Concepts

Floor Object

Other resources

Floor Object Members


Floor.Parent Property (Word)

 Copy code hover
[image]

Floor.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the parent for the specified object. Read-only Object.

Version Information

Version Added: Word 2007

Syntax

expression .Parent

expression A variable that represents a Floor object.

See also

Concepts

Floor Object

Other resources

Floor Object Members


Floor.PictureType Property (Word)

 Copy code hover
[image]

Floor.PictureType Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a value that specifies how pictures are displayed on the walls and faces of a 3-D chart. Read/write Variant.

Version Information

Version Added: Word 2007

Syntax

expression .PictureType

expression A variable that represents a Floor object.

Remarks

You can set this property to one of the following XlChartPictureType constants: xlStack or xlStretch.

See also

Concepts

Floor Object

Other resources

Floor Object Members


Floor.Thickness Property (Word)

 Copy code hover
[image]

Floor.Thickness Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the thickness of the floor. Read/write Long.

Version Information

Version Added: Word 2007

Syntax

expression .Thickness

expression A variable that represents a Floor object.

Remarks

Use this property to set the thickness of the floor. The default thickness is zero (0).

See also

Concepts

Floor Object

Other resources

Floor Object Members


Floor Methods (Word)

 Copy code hover
[image]

Floor Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
ClearFormats | Clears the formatting of the object.
Paste | Pastes a picture from the Clipboard on the floor of the specified chart.
Select | Selects the object.


Floor.ClearFormats Method (Word)

 Copy code hover
[image]

Floor.ClearFormats Method (Word)
See also Send feedback

Published: July 16, 2012

Clears the formatting of the object.

Version Information

Version Added: Word 2007

Syntax

expression .ClearFormats

expression A variable that represents a Floor object.

See also

Concepts

Floor Object

Other resources

Floor Object Members


Floor.Paste Method (Word)

 Copy code hover
[image]

Floor.Paste Method (Word)
See also Send feedback

Published: July 16, 2012

Pastes a picture from the Clipboard on the floor of the specified chart.

Version Information

Version Added: Word 2007

Syntax

expression .Paste

expression A variable that represents a Floor object.

Remarks

You can use this method on column, bar, line, or radar charts.

See also

Concepts

Floor Object

Other resources

Floor Object Members


Floor.Select Method (Word)

 Copy code hover
[image]

Floor.Select Method (Word)
See also Send feedback

Published: July 16, 2012

Selects the object.

Version Information

Version Added: Word 2007

Syntax

expression .Select

expression A variable that represents a Floor object.

See also

Concepts

Floor Object

Other resources

Floor Object Members


Font Object (Word)

 Copy code hover
[image]

Font Object (Word)
See also Send feedback

Published: July 16, 2012

Contains font attributes (such as font name, font size and color) for an object.

Remarks

Use the Font property to return the Font object. The following instruction applies bold formatting to the selection.

VBA Copy code Copy code
Selection.Font.Bold = True

The following example formats the first paragraph in the active document as 24point Arial and italic.

VBA Copy code Copy code
Set myRange = ActiveDocument.Paragraphs(1).Range
With myRange.Font
 .Bold = True
 .Name = "Arial"
 .Size = 24
End With

The following example changes the formatting of the Heading 2 style in the active document to Arial and bold.

VBA Copy code Copy code
With ActiveDocument.Styles(wdStyleHeading2).Font
 .Name = "Arial"
 .Italic = True
End With

You can use the New keyword to create a new, stand-alone Font object. The following example creates a Font object, sets some formatting properties, and then applies the Font object to the first paragraph in the active document.

VBA Copy code Copy code
Set myFont = New Font
myFont.Bold = True
myFont.Name = "Arial"
ActiveDocument.Paragraphs(1).Range.Font = myFont

You can also duplicate a Font object by using the Duplicate property. The following example creates a new character style with the character formatting from the selection and italic formatting. The formatting of the selection is not changed.

VBA Copy code Copy code
Set aFont = Selection.Font.Duplicate
aFont.Italic = True
ActiveDocument.Styles.Add(Name:="Italics", _
 Type:=wdStyleTypeCharacter).Font = aFont

See also

Concepts

Word Object Model Reference

Other resources

Font Object Members


Font Members (Word)

 Copy code hover
[image]

Font Members (Word)
Send feedback

Published: July 16, 2012

Contains font attributes (such as font name, font size and color) for an object.

Methods

Name | Description
Grow | Increases the font size to the next available size.
Reset | Removes manual character formatting (formatting not applied using a style). For example, if you manually format a word as bold and the underlying style is plain text (not bold), the Reset method removes the bold format.
SetAsTemplateDefault | Sets the specified font formatting as the default for the active document and all new documents based on the active template.
Shrink | Decreases the font size to the next available size.

Properties

Name | Description
AllCaps | True if the font is formatted as all capital letters. Read/write Long.
Application | Returns an Application object that represents the Microsoft Word application.
Bold | True if the font is formatted as bold. Read/write Long.
BoldBi | True if the font is formatted as bold. Read/write Long.
Borders | Returns a Borders collection that represents all the borders for the specified font.
ColorIndex | Returns or sets a WdColorIndex constant that represents the color for the specified font. Read/write .
ColorIndexBi | Returns or sets the color for the specified Font object in a right-to-left language document. Read/write WdColorIndex.
ContextualAlternates | Specifies whether or not contextual alternates are enabled for the specified font. Read/write Long.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
DiacriticColor | Returns or sets the 24-bit color to be used for diacritics for the specified Font object. Read/write.
DisableCharacterSpaceGrid | True if Microsoft Word ignores the number of characters per line for the corresponding Font object. Read/write Boolean.
DoubleStrikeThrough | True if the specified font is formatted as double strikethrough text. .
Duplicate | Returns a read-only Font object that represents the character formatting of the specified font.
Emboss | True if the specified font is formatted as embossed. Read/write Long.
EmphasisMark | Returns or sets a WdEmphasisMark constant that represents the emphasis mark for a character or designated character string. Read/write.
Engrave | True if the font is formatted as engraved. Read/write Long.
Fill | Returns a FillFormat object that contains fill formatting properties for the font used by the specified range of text. Read-only.
Glow | Returns a GlowFormat object that represents the glow formatting for the font used by the specified range of text. Read-only.
Hidden | True if the font is formatted as hidden text. Read/write Long.
Italic | True if the font or range is formatted as italic. Read/write Long.
ItalicBi | True if the font or range is formatted as italic. Read/write Long.
Kerning | Returns or sets the minimum font size for which Microsoft Word will adjust kerning automatically. Read/write Single.
Ligatures | Returns or sets the ligatures setting for the specified Font object. Read/write WdLigatures.
Line | Returns a LineFormat object that specifies the formatting for a line. Read/write.
Name | Returns or sets the name of the specified object. Read/write String.
NameAscii | Returns or sets the font used for Latin text (characters with character codes from 0 (zero) through 127). Read/write String.
NameBi | Returns or sets the name of the font in a right-to-left language document. Read/write String.
NameFarEast | Returns or sets an East Asian font name. Read/write String.
NameOther | Returns or sets the font used for characters with character codes from 128 through 255. Read/write String.
NumberForm | Returns or sets the number form setting for an OpenType font. Read/write WdNumberForm.
NumberSpacing | Returns or sets the number spacing setting for a font. Read/write WdNumberSpacing.
Outline | True if the font is formatted as outline. Read/write Long.
Parent | Returns an Object that represents the parent object of the specified Font object.
Position | Returns or sets the position of text (in points) relative to the base line. Read/write Long.
Reflection | Returns a ReflectionFormat object that represents the reflection formatting for a shape. Read-only.
Scaling | Returns or sets the scaling percentage applied to the font. Read/write Long.
Shading | Returns a Shading object that refers to the shading formatting for the specified font.
Shadow | True if the specified font is formatted as shadowed. Read/write Long.
Size | Returns or sets the font size, in points. Read/write Single.
SizeBi | Returns or sets the font size in points. Read/write Single.
SmallCaps | True if the font is formatted as small capital letters. Read/write Long.
Spacing | Returns or sets the spacing (in points) between characters. Read/write Single.
StrikeThrough | True if the font is formatted as strikethrough text. Read/write Long.
StylisticSet | Specifies the stylistic set for the specified font. Read/write WdStylisticSet.
Subscript | True if the font is formatted as subscript. Read/write Long.
Superscript | True if the font is formatted as superscript. Read/write Long.
TextColor | Returns a ColorFormat object that represents the color for the specified font. Read-only.
TextShadow | Returns a ShadowFormat object that specifies the shadow formatting for the specified font.
ThreeD | Returns a ThreeDFormat object that contains 3-D effect formatting properties for the specified font. Read-only.
Underline | Returns or sets the type of underline applied to the font. Read/write WdUnderline.
UnderlineColor | Returns or sets the 24-bit color of the underline for the specified Font object. .


Font Properties (Word)

 Copy code hover
[image]

Font Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
AllCaps | True if the font is formatted as all capital letters. Read/write Long.
Application | Returns an Application object that represents the Microsoft Word application.
Bold | True if the font is formatted as bold. Read/write Long.
BoldBi | True if the font is formatted as bold. Read/write Long.
Borders | Returns a Borders collection that represents all the borders for the specified font.
ColorIndex | Returns or sets a WdColorIndex constant that represents the color for the specified font. Read/write .
ColorIndexBi | Returns or sets the color for the specified Font object in a right-to-left language document. Read/write WdColorIndex.
ContextualAlternates | Specifies whether or not contextual alternates are enabled for the specified font. Read/write Long.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
DiacriticColor | Returns or sets the 24-bit color to be used for diacritics for the specified Font object. Read/write.
DisableCharacterSpaceGrid | True if Microsoft Word ignores the number of characters per line for the corresponding Font object. Read/write Boolean.
DoubleStrikeThrough | True if the specified font is formatted as double strikethrough text. .
Duplicate | Returns a read-only Font object that represents the character formatting of the specified font.
Emboss | True if the specified font is formatted as embossed. Read/write Long.
EmphasisMark | Returns or sets a WdEmphasisMark constant that represents the emphasis mark for a character or designated character string. Read/write.
Engrave | True if the font is formatted as engraved. Read/write Long.
Fill | Returns a FillFormat object that contains fill formatting properties for the font used by the specified range of text. Read-only.
Glow | Returns a GlowFormat object that represents the glow formatting for the font used by the specified range of text. Read-only.
Hidden | True if the font is formatted as hidden text. Read/write Long.
Italic | True if the font or range is formatted as italic. Read/write Long.
ItalicBi | True if the font or range is formatted as italic. Read/write Long.
Kerning | Returns or sets the minimum font size for which Microsoft Word will adjust kerning automatically. Read/write Single.
Ligatures | Returns or sets the ligatures setting for the specified Font object. Read/write WdLigatures.
Line | Returns a LineFormat object that specifies the formatting for a line. Read/write.
Name | Returns or sets the name of the specified object. Read/write String.
NameAscii | Returns or sets the font used for Latin text (characters with character codes from 0 (zero) through 127). Read/write String.
NameBi | Returns or sets the name of the font in a right-to-left language document. Read/write String.
NameFarEast | Returns or sets an East Asian font name. Read/write String.
NameOther | Returns or sets the font used for characters with character codes from 128 through 255. Read/write String.
NumberForm | Returns or sets the number form setting for an OpenType font. Read/write WdNumberForm.
NumberSpacing | Returns or sets the number spacing setting for a font. Read/write WdNumberSpacing.
Outline | True if the font is formatted as outline. Read/write Long.
Parent | Returns an Object that represents the parent object of the specified Font object.
Position | Returns or sets the position of text (in points) relative to the base line. Read/write Long.
Reflection | Returns a ReflectionFormat object that represents the reflection formatting for a shape. Read-only.
Scaling | Returns or sets the scaling percentage applied to the font. Read/write Long.
Shading | Returns a Shading object that refers to the shading formatting for the specified font.
Shadow | True if the specified font is formatted as shadowed. Read/write Long.
Size | Returns or sets the font size, in points. Read/write Single.
SizeBi | Returns or sets the font size in points. Read/write Single.
SmallCaps | True if the font is formatted as small capital letters. Read/write Long.
Spacing | Returns or sets the spacing (in points) between characters. Read/write Single.
StrikeThrough | True if the font is formatted as strikethrough text. Read/write Long.
StylisticSet | Specifies the stylistic set for the specified font. Read/write WdStylisticSet.
Subscript | True if the font is formatted as subscript. Read/write Long.
Superscript | True if the font is formatted as superscript. Read/write Long.
TextColor | Returns a ColorFormat object that represents the color for the specified font. Read-only.
TextShadow | Returns a ShadowFormat object that specifies the shadow formatting for the specified font.
ThreeD | Returns a ThreeDFormat object that contains 3-D effect formatting properties for the specified font. Read-only.
Underline | Returns or sets the type of underline applied to the font. Read/write WdUnderline.
UnderlineColor | Returns or sets the 24-bit color of the underline for the specified Font object. .


Font.AllCaps Property (Word)

 Copy code hover
[image]

Font.AllCaps Property (Word)
See also Send feedback

Published: July 16, 2012

True if the font is formatted as all capital letters. Read/write Long.

Syntax

expression .AllCaps

expression A variable that represents a Font object.

Remarks

Returns True, False, or wdUndefined (a mixture of True and False). Can be set to True, False, or wdToggle (reverses the current setting).

Setting AllCaps to True sets SmallCaps to False, and vice versa.

Example

This example checks the third paragraph in the active document for text formatted as all capital letters.

VBA Copy code Copy code
If ActiveDocument.Paragraphs(3).Range.Font.AllCaps = True Then
 MsgBox "Text is all caps."
Else
 MsgBox "Text is not all caps."
End if

This example formats the selected text as all capital letters.

VBA Copy code Copy code
If Selection.Type = wdSelectionNormal Then
 Selection.Font.AllCaps = True
Else
 MsgBox "You need to select some text."
End If

See also

Concepts

Font Object

Other resources

Font Object Members


Font.Application Property (Word)

 Copy code hover
[image]

Font.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a Font object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

Font Object

Other resources

Font Object Members


Font.Bold Property (Word)

 Copy code hover
[image]

Font.Bold Property (Word)
See also Send feedback

Published: July 16, 2012

True if the font is formatted as bold. Read/write Long.

Syntax

expression .Bold

expression A variable that represents a Font object.

Remarks

Returns True, False or wdUndefined (a mixture of True and False). Can be set to True, False, or wdToggle.

Example

This example makes the entire selection bold if part of the selection is formatted as bold.

VBA Copy code Copy code
If Selection.Type = wdSelectionNormal Then
 If Selection.Font.Bold = wdUndefined Then _
 Selection.Font.Bold = True
Else
 MsgBox "You need to select some text."
End If

See also

Concepts

Font Object

Other resources

Font Object Members


Font.BoldBi Property (Word)

 Copy code hover
[image]

Font.BoldBi Property (Word)
See also Send feedback

Published: July 16, 2012

True if the font is formatted as bold. Read/write Long.

Syntax

expression .BoldBi

expression Required. A variable that represents a Font object.

Remarks

This property returns True, False or wdUndefined (for a mixture of bold and non-bold text). Can be set to True, False, or wdToggle.

The BoldBi property applies to text in a right-to-left language.

Example

This example makes the first paragraph in the active right-to-left language document bold.

VBA Copy code Copy code
ActiveDocument.Paragraphs(1).Range.Font.BoldBi = Truee

See also

Concepts

Font Object

Other resources

Font Object Members


Font.Borders Property (Word)

 Copy code hover
[image]

Font.Borders Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Borders collection that represents all the borders for the specified font.

Syntax

expression .Borders

expression Required. A variable that represents a Font object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

See also

Concepts

Font Object

Other resources

Font Object Members


Font.ColorIndex Property (Word)

 Copy code hover
[image]

Font.ColorIndex Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a WdColorIndex constant that represents the color for the specified font. Read/write .

Syntax

expression .ColorIndex

expression Required. A variable that represents a Font object.

Remarks

The wdByAuthor constant is not a valid color for fonts.

Example

This example changes the color of the text in the first paragraph in the active document.

VBA Copy code Copy code
ActiveDocument.Paragraphs(1).Range.Font.ColorIndex = wdGreen

This example formats the selected text to appear in red.

VBA Copy code Copy code
Selection.Font.ColorIndex = wdRed

See also

Concepts

Font Object

Other resources

Font Object Members


Font.ColorIndexBi Property (Word)

 Copy code hover
[image]

Font.ColorIndexBi Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the color for the specified Font object in a right-to-left language document. Read/write WdColorIndex.

Syntax

expression .ColorIndexBi

expression Required. A variable that represents a Font object.

Remarks

The wdByAuthor constant is not valid for Font objects.

Example

This example sets the color of the Font object to teal.

VBA Copy code Copy code
Selection.Font.ColorIndexBi = wdTeal

See also

Concepts

Font Object

Other resources

Font Object Members


Font.ContextualAlternates Property (Word)

 Copy code hover
[image]

Font.ContextualAlternates Property (Word)
See also Send feedback

Published: July 16, 2012

Specifies whether or not contextual alternates are enabled for the specified font. Read/write Long.

Version Information

Version Added: Word 2010

Syntax

expression .ContextualAlternates

expression An expression that returns a Font object.

Remarks

Contextual alternates are ligatures that are applied to individual characters based on the letters around them (their context). Contextual alternates can also be applied to entire words in certain contexts, for example, words frequently used in titles (such as "of" and "the"). When contextual alternates are enabled for a font, they are used instead of the standard ligatures in those contexts defined by the font designer.

Setting this property has the same effect as selecting the check box next to Use Contextual Alternates (in the OpenType Features group, Advanced tab, on the Font dialog in Word 2010).

Example

The following code example enables contextual alternates for the font in the active document.

VBA Copy code Copy code
ActiveDocument.Range.Font.ContextualAlternates = True

See also

Concepts

Font Object

Other resources

Font Object Members


Font.Creator Property (Word)

 Copy code hover
[image]

Font.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a Font object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Font Object

Other resources

Font Object Members


Font.DiacriticColor Property (Word)

 Copy code hover
[image]

Font.DiacriticColor Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the 24-bit color to be used for diacritics for the specified Font object. Read/write.

Syntax

expression .DiacriticColor

expression Required. A variable that represents a Font object.

Remarks

This property can be any valid WdColor constant or a value returned by Visual Basic's RGB function. The value of the UseDiffDiacColor property must be True to use this property.

Example

This example sets the color for diacritics to blue in the current selection.

VBA Copy code Copy code
If Options.UseDiffDiacColor = True Then _
 Selection.Font.DiacriticColor = wdColorBlue

See also

Concepts

Font Object

Other resources

Font Object Members


Font.DisableCharacterSpaceGrid Property (Word)

 Copy code hover
[image]

Font.DisableCharacterSpaceGrid Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word ignores the number of characters per line for the corresponding Font object. Read/write Boolean.

Syntax

expression .DisableCharacterSpaceGrid

expression A variable that represents a Font object.

Remarks

This property returns wdUndefined if the DisableCharacterSpaceGrid property is set to True for only some of the specified text.

Example

This example signals Microsoft Word to ignore the number of characters per line for the selected text.

VBA Copy code Copy code
With Selection.Font
 .DisableCharacterSpaceGrid = True
End With

See also

Concepts

Font Object

Other resources

Font Object Members


Font.DoubleStrikeThrough Property (Word)

 Copy code hover
[image]

Font.DoubleStrikeThrough Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified font is formatted as double strikethrough text. .

Syntax

expression .DoubleStrikeThrough

expression A variable that represents a Font object.

Remarks

Returns True, False, or wdUndefined (a mixture of True and False). Can be set to True, False, or wdToggle. Read/write Long.To set or return single-line strikethrough formatting, use the StrikeThrough property. Setting DoubleStrikeThrough to True sets StrikeThrough to False, and vice versa.

Example

This example applies double strikethrough formatting to the selected text.

VBA Copy code Copy code
If Selection.Type = wdSelectionNormal Then
 Selection.Font.DoubleStrikeThrough = True
Else
 MsgBox "You need to select some text."
End If

This example removes double strikethrough formatting from the first word in the active document and capitalizes the first letter in the word.

VBA Copy code Copy code
With ActiveDocument.Words(1)
 .Font.DoubleStrikeThrough = False
 .Case = wdTitleSentence
End With

See also

Concepts

Font Object

Other resources

Font Object Members


Font.Duplicate Property (Word)

 Copy code hover
[image]

Font.Duplicate Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a read-only Font object that represents the character formatting of the specified font.

Syntax

expression .Duplicate

expression Required. A variable that represents a Font object.

Remarks

You can use the Duplicate property to pick up the settings of all the properties of a duplicated Font object. You can assign the object returned by the Duplicate property to another Font object to apply those settings all at once. Before assigning the duplicate object to another object, you can change any of the properties of the duplicate object without affecting the original.

Example

This example sets the variable MyDupFont to the character formatting of the selection, removes bold formatting from MyDupFont, and adds italic formatting to it instead. The example also creates a new document, inserts text into it, and then applies the formatting stored in MyDupFont to the text.

VBA Copy code Copy code
Set myDupFont = Selection.Font.Duplicate
With myDupFont
 .Bold = False
 .Italic = True
End With
Documents.Add
Selection.InsertAfter "This is some text."
Selection.Font = myDupFont

See also

Concepts

Font Object

Other resources

Font Object Members


Font.Emboss Property (Word)

 Copy code hover
[image]

Font.Emboss Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified font is formatted as embossed. Read/write Long.

Syntax

expression .Emboss

expression A variable that represents a Font object.

Remarks

Returns True, False, or wdUndefined. Can be set to True, False, or wdToggle. Setting Emboss to True sets Engrave to False, and vice versa.

Example

This example embosses the second sentence in a new document.

VBA Copy code Copy code
With Documents.Add.Content
 .InsertAfter "This is the first sentence. "
 .InsertAfter "This is the second sentence. "
 .Sentences(2).Font.Emboss = True
End With

This example embosses the selected text.

VBA Copy code Copy code
If Selection.Type = wdSelectionNormal Then
 Selection.Font.Emboss = True
Else
 MsgBox "You need to select some text."
End If

See also

Concepts

Font Object

Other resources

Font Object Members


Font.EmphasisMark Property (Word)

 Copy code hover
[image]

Font.EmphasisMark Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a WdEmphasisMark constant that represents the emphasis mark for a character or designated character string. Read/write.

Syntax

expression .EmphasisMark

expression Required. A variable that represents a Font object.

Example

This example sets the emphasis mark over the fourth word in the active document to a comma.

VBA Copy code Copy code
ActiveDocument.Words(4).EmphasisMark = wdEmphasisMarkOverComma

See also

Concepts

Font Object

Other resources

Font Object Members


Font.Engrave Property (Word)

 Copy code hover
[image]

Font.Engrave Property (Word)
See also Send feedback

Published: July 16, 2012

True if the font is formatted as engraved. Read/write Long.

Syntax

expression .Engrave

expression A variable that represents a Font object.

Remarks

Returns True, False or wdUndefined (a mixture of True and False). Can be set to True, False, or wdToggle. Setting Engrave to True sets Emboss to False, and vice versa.

Example

This example formats the first letter in the active document as engraved.

VBA Copy code Copy code
Dim rngTemp As Range

Set rngTemp = ActiveDocument.Characters(1)
With rngTemp.Font
 .Size = 20
 .Engrave = True
End With

This example formats the selection as engraved.

VBA Copy code Copy code
If Selection.Type = wdSelectionNormal Then
 Selection.Font.Engrave = True
Else
 MsgBox "You need to select some text."
End If

See also

Concepts

Font Object

Other resources

Font Object Members


Font.Fill Property (Word)

 Copy code hover
[image]

Font.Fill Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a FillFormat object that contains fill formatting properties for the font used by the specified range of text. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .Fill

expression An expression that returns a Font object.

See also

Concepts

Font Object

Other resources

Font Object Members


Font.Glow Property (Word)

 Copy code hover
[image]

Font.Glow Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a GlowFormat object that represents the glow formatting for the font used by the specified range of text. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .Glow

expression An expression that returns a Font object.

See also

Concepts

Font Object

Other resources

Font Object Members


Font.Hidden Property (Word)

 Copy code hover
[image]

Font.Hidden Property (Word)
See also Send feedback

Published: July 16, 2012

True if the font is formatted as hidden text. Read/write Long.

Syntax

expression .Hidden

expression Required. A variable that represents a Font object.

Remarks

This property returns True, False or wdUndefined (a mixture of True and False). Can be set to True, False, or wdToggle.

To control the display of hidden text, use the ShowHiddenText property of the View object.

To control whether properties and methods that return Range objects include or exclude hidden text when hidden text isn't displayed, use the IncludeHiddenText property of the TextRetrievalMode object.

Example

This example checks the selection for hidden text.

VBA Copy code Copy code
If Selection.Type = wdSelectionNormal Then
 If Selection.Font.Hidden = wdUndefined or _
 Selection.Font.Hidden = True Then
 MsgBox "There is hidden text in the selection."
 Else
 MsgBox "No hidden text in the selection."
 End If
Else
 MsgBox "You need to select some text."
End If

This example makes all hidden text in the active window visible and then formats the selection as hidden text.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.View.ShowHiddenText = True
If Selection.Type = wdSelectionNormal Then _
 Selection.Font.Hidden = True

See also

Concepts

Font Object

Other resources

Font Object Members


Font.Italic Property (Word)

 Copy code hover
[image]

Font.Italic Property (Word)
See also Send feedback

Published: July 16, 2012

True if the font or range is formatted as italic. Read/write Long.

Syntax

expression .Italic

expression A variable that represents a Font object.

Remarks

This property returns True, False or wdUndefined (a mixture of True and False). Can be set to True, False, or wdToggle.

Example

This example checks the selection for italic formatting and removes any that it finds.

VBA Copy code Copy code
If Selection.Type = wdSelectionNormal Then
 mySel = Selection.Font.Italic
 If mySel = wdUndefined or mySel = True Then
 MsgBox "there is italic text in selection. " _
 & "Click OK to remove."
 Selection.Font.Italic = False
 Else
 MsgBox "No italic text in the selection."
 End If
Else
 MsgBox "You need to select some text."
End If

See also

Concepts

Font Object

Other resources

Font Object Members


Font.ItalicBi Property (Word)

 Copy code hover
[image]

Font.ItalicBi Property (Word)
See also Send feedback

Published: July 16, 2012

True if the font or range is formatted as italic. Read/write Long.

Syntax

expression .ItalicBi

expression Required. A variable that represents a Font object.

Remarks

This property returns True, False or wdUndefined (for a mixture of italic and non-italic text) and can be set to True, False, or wdToggle.

Use the ItalicBi property for right-to-left languages.

Example

This example italicizes the first paragraph in the active right-to-left language document.

VBA Copy code Copy code
ActiveDocument.Paragraphs(1).Range.ItalicBi = True

See also

Concepts

Font Object

Other resources

Font Object Members


Font.Kerning Property (Word)

 Copy code hover
[image]

Font.Kerning Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the minimum font size for which Microsoft Word will adjust kerning automatically. Read/write Single.

Syntax

expression .Kerning

expression An expression that returns a Font object.

Example

This example sets the minimum font size for automatic kerning to 12 points or larger in the active document.

VBA Copy code Copy code
ActiveDocument.Content.Font.Kerning = 12

This example displays the minimum font size for which Word will automatically adjust kerning in the selected text.

VBA Copy code Copy code
If Selection.Type = wdSelectionNormal Then
 MsgBox Selection.Font.Kerning
Else
 MsgBox "You need to select some text."
End If

See also

Concepts

Font Object

Other resources

Font Object Members


Font.Ligatures Property (Word)

 Copy code hover
[image]

Font.Ligatures Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the ligatures setting for the specified Font object. Read/write WdLigatures.

Version Information

Version Added: Word 2010

Syntax

expression .Ligatures

expression An expression that returns a Font object.

Remarks

Open Type fonts support the use of ligatures. The Ligatures property specifies the Word 2010 ligatures setting to apply to an Open Type font.

The following table lists the four basic values for ligatures.

Value | Description
Standard | Designed to enhance readability and attractiveness. Standard ligatures in Latin languages include "fi", "fl", and "ff".
Contextual | Designed to enhance readability and attractiveness by providing the best ligature choice given the surrounding text.
Historical | Older, ornamental ligatures that may look archaic to the modern reader. Not specifically designed for readability.
Discretional | Designed to be ornamental and not designed to be readable.

Combinations of these four basic values form the set of available values for the Ligatures property. This set of values is represented in the WdLigatures enumeration.

Example

The following code example applies Discretional ligatures to the font in the active document.

VBA Copy code Copy code
ActiveDocument.Range.Font.Ligatures = wdLigaturesDiscretional

See also

Concepts

Font Object

Other resources

Font Object Members


Font.Line Property (Word)

 Copy code hover
[image]

Font.Line Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a LineFormat object that specifies the formatting for a line. Read/write.

Version Information

Version Added: Word 2010

Syntax

expression .Line

expression An expression that returns a Font object.

See also

Concepts

Font Object

Other resources

Font Object Members


Font.Name Property (Word)

 Copy code hover
[image]

Font.Name Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the name of the specified object. Read/write String.

Syntax

expression .Name

expression Required. A variable that represents a Font object.

Example

This example formats the selection as Arial bold.

VBA Copy code Copy code
With Selection.Font
 .Name = "Arial"
 .Bold = True
End With

See also

Concepts

Font Object

Other resources

Font Object Members


Font.NameAscii Property (Word)

 Copy code hover
[image]

Font.NameAscii Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the font used for Latin text (characters with character codes from 0 (zero) through 127). Read/write String.

Syntax

expression .NameAscii

expression An expression that returns a Font object.

Remarks

In the U.S. English version of Microsoft Word, the default value of this property is Times New Roman. Use the Name property to change the font that's applied to all text and that appears in the Font box on the Formatting toolbar.

Example

This example sets the font used for Latin text.

VBA Copy code Copy code
Selection.Font.NameAscii = "Century"

See also

Concepts

Font Object

Other resources

Font Object Members


Font.NameBi Property (Word)

 Copy code hover
[image]

Font.NameBi Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the name of the font in a right-to-left language document. Read/write String.

Syntax

expression .NameBi

expression An expression that returns a Font object.

Example

This example formats the selection with Arial font.

VBA Copy code Copy code
With Selection.Font
 .NameBi = "Arial"
End With

See also

Concepts

Font Object

Other resources

Font Object Members


Font.NameFarEast Property (Word)

 Copy code hover
[image]

Font.NameFarEast Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets an East Asian font name. Read/write String.

Syntax

expression .NameFarEast

expression An expression that returns a Font object.

Remarks

In the U.S. English version of Microsoft Word, the default value of this property is Times New Roman. This is the recommended way to return or set the font for Asian text in a document created in an Asian version of Word.

Example

This example displays the East Asian font name that's applied to the selection.

VBA Copy code Copy code
MsgBox Selection.Font.NameFarEast

See also

Concepts

Font Object

Other resources

Font Object Members


Font.NameOther Property (Word)

 Copy code hover
[image]

Font.NameOther Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the font used for characters with character codes from 128 through 255. Read/write String.

Syntax

expression .NameOther

expression An expression that returns a Font object.

Remarks

In the U.S. English version of Microsoft Word, the default value of this property is Times New Roman. Use the Name property to change the font that's applied to all text and that appears in the Font box on the Formatting toolbar.

Example

This example sets the font used for characters with character codes from 128 through 255.

VBA Copy code Copy code
Selection.Font.NameOther = "Century"

See also

Concepts

Font Object

Other resources

Font Object Members


Font.NumberForm Property (Word)

 Copy code hover
[image]

Font.NumberForm Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the number form setting for an OpenType font. Read/write WdNumberForm.

Version Information

Version Added: Word 2010

Syntax

expression .NumberForm

expression An expression that returns a Font object.

Remarks

Numbers in OpenType fonts can be displayed either with consistent heights along the baseline of the text (called "lining"), or with varying heights (called "hanging" or "old style") where numbers are displayed above or below the baseline of the text. Use the NumberForm property to specify whether numbers are displayed using lining or old-style.

Setting this property has the same effect as selecting an item in the dropdown box next to Number forms: (OpenType features group, Advanced tab in the Font dialog in Word 2010).

Example

The following code example sets the number form to "Old-style" for the font in the active document.

VBA Copy code Copy code
ActiveDocument.Range.Font.NumberForm = wdNumberFormOldStyle

See also

Concepts

Font Object

Other resources

Font Object Members


Font.NumberSpacing Property (Word)

 Copy code hover
[image]

Font.NumberSpacing Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the number spacing setting for a font. Read/write WdNumberSpacing.

Version Information

Version Added: Word 2010

Syntax

expression .NumberSpacing

expression An expression that returns a Font object.

Remarks

OpenType fonts support a proportional and tabular figure feature to control number spacing. Proportional number spacing handles each number as having a different width. For example, "1" is displayed as narrower than "5". Tabular number spacing handles numbers as equal in width so that they align vertically, which increases the readability, especially for financial information.

Example

The following code example sets the number spacing to proportional for the font in the active document.

VBA Copy code Copy code
ActiveDocument.Range.Font.NumberSpacing = wdNumberSpacingProportional

See also

Concepts

Font Object

Other resources

Font Object Members


Font.Outline Property (Word)

 Copy code hover
[image]

Font.Outline Property (Word)
See also Send feedback

Published: July 16, 2012

True if the font is formatted as outline. Read/write Long.

Syntax

expression .Outline

expression An expression that returns a Font object.

Remarks

Returns True, False, or wdUndefined (a mixture of True and False). Can be set to True, False, or wdToggle.

Example

This example applies outline font formatting to the first three words in the active document.

VBA Copy code Copy code
Set myRange = ActiveDocument.Range(Start:= _
 ActiveDocument.Words(1).Start, _
 End:=ActiveDocument.Words(3).End)
myRange.Font.Outline = True

This example toggles outline formatting for the selected text.

VBA Copy code Copy code
Selection.Font.Outline = wdToggle

This example removes outline font formatting from the selection if outline formatting is partially applied to the selection.

VBA Copy code Copy code
Set myFont = Selection.Font
If myFont.Outline = wdUndefined Then
 myFont.Outline = False
End If

See also

Concepts

Font Object

Other resources

Font Object Members


Font.Parent Property (Word)

 Copy code hover
[image]

Font.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Font object.

Syntax

expression .Parent

expression Required. A variable that represents a Font object.

See also

Concepts

Font Object

Other resources

Font Object Members


Font.Position Property (Word)

 Copy code hover
[image]

Font.Position Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the position of text (in points) relative to the base line. Read/write Long.

Syntax

expression .Position

expression Required. A variable that represents a Font object.

Remarks

A positive number raises the text, and a negative number lowers it.

Example

This example lowers the selected text by 2 points.

VBA Copy code Copy code
Selection.Font.Position = -2

See also

Concepts

Font Object

Other resources

Font Object Members


Font.Reflection Property (Word)

 Copy code hover
[image]

Font.Reflection Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a ReflectionFormat object that represents the reflection formatting for a shape. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .Reflection

expression An expression that returns a Font object.

See also

Concepts

Font Object

Other resources

Font Object Members


Font.Scaling Property (Word)

 Copy code hover
[image]

Font.Scaling Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the scaling percentage applied to the font. Read/write Long.

Syntax

expression .Scaling

expression An expression that returns a Font object.

Remarks

This property stretches or compresses text horizontally as a percentage of the current size (the scaling range is from 1 through 600).

Example

This example horizontally stretches the text in the active document to 110 percent of its original size.

VBA Copy code Copy code
ActiveDocument.Content.Font.Scaling = 110

This example compresses the text in the first paragraph in Sales.doc to 90 percent of its original size.

VBA Copy code Copy code
With Documents("Sales.doc").Paragraphs(1).Range.Font
 .Scaling = 90
 .Bold = False
End With

See also

Concepts

Font Object

Other resources

Font Object Members


Font.Shading Property (Word)

 Copy code hover
[image]

Font.Shading Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Shading object that refers to the shading formatting for the specified font.

Syntax

expression .Shading

expression Required. A variable that represents a Font object.

See also

Concepts

Font Object

Other resources

Font Object Members


Font.Shadow Property (Word)

 Copy code hover
[image]

Font.Shadow Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified font is formatted as shadowed. Read/write Long.

Syntax

expression .Shadow

expression Required. A variable that represents a Font object.

Remarks

This property can be True, False, or wdUndefined.

Example

This example applies shadow and bold formatting to the selection.

VBA Copy code Copy code
If Selection.Type = wdSelectionNormal Then
 With Selection.Font
 .Shadow = True
 .Bold = True
 End With
Else
 MsgBox "You need to select some text."
End If

See also

Concepts

Font Object

Other resources

Font Object Members


Font.Size Property (Word)

 Copy code hover
[image]

Font.Size Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the font size, in points. Read/write Single.

Syntax

expression .Size

expression Required. A variable that represents a Font object.

Example

This example inserts text and then sets the font size of the seventh word of the inserted text to 20 points.

VBA Copy code Copy code
Selection.Collapse Direction:=wdCollapseEnd
With Selection.Range
 .Font.Reset
 .InsertBefore "This is a demonstration of font size."
 .Words(7).Font.Size = 20
End With

This example determines the font size of the selected text.

VBA Copy code Copy code
mySel = Selection.Font.Size
If mySel = wdUndefined Then
 MsgBox "there is a mix of font sizes in the selection."
Else
 MsgBox mySel & " points"
End If

See also

Concepts

Font Object

Other resources

Font Object Members


Font.SizeBi Property (Word)

 Copy code hover
[image]

Font.SizeBi Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the font size in points. Read/write Single.

Syntax

expression .SizeBi

expression An expression that returns a Font object.

Remarks

The SizeBi property applies to text in a right-to-left language.

Example

This example sets the font size of the first word to 20 points.

VBA Copy code Copy code
With ActiveDocument.Paragraphs(1).Range
 .Words(1).Font.SizeBi = 20
End With

See also

Concepts

Font Object

Other resources

Font Object Members


Font.SmallCaps Property (Word)

 Copy code hover
[image]

Font.SmallCaps Property (Word)
See also Send feedback

Published: July 16, 2012

True if the font is formatted as small capital letters. Read/write Long.

Syntax

expression .SmallCaps

expression An expression that returns a Font object.

Remarks

Returns True, False or wdUndefined (a mixture of True and False). Can be set to True, False, or wdToggle.

Setting the SmallCaps property to True sets the AllCaps property to False, and vice versa.

Example

This example demonstrates the difference between small capital letters and all capital letters in a new document.

VBA Copy code Copy code
Set myRange = Documents.Add.Content
With myRange
 .InsertAfter "This is a demonstration of SmallCaps."
 .Words(6).Font.SmallCaps = True
 .InsertParagraphAfter
 .InsertAfter "This is a demonstration of AllCaps."
 .Words(14).Font.AllCaps = True
End With

This example formats the entire selection as small capital letters if part of the selection is already formatted as small capital letters.

VBA Copy code Copy code
If Selection.Type = wdSelectionNormal Then
 mySel = Selection.Font.SmallCaps
 If mySel = wdUndefined Then Selection.Font.SmallCaps = True
Else
 MsgBox "You need to select some text."
End If

See also

Concepts

Font Object

Other resources

Font Object Members


Font.Spacing Property (Word)

 Copy code hover
[image]

Font.Spacing Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the spacing (in points) between characters. Read/write Single.

Syntax

expression .Spacing

expression Required. A variable that represents a Font object.

Example

This example demonstrates two different character spacings at the beginning of the active document.

VBA Copy code Copy code
Set myRange = ActiveDocument.Range(Start:=0, End:=0)
With myRange
 .InsertAfter "Demonstration of no character spacing."
 .InsertParagraphAfter
 .InsertAfter "Demonstration of character spacing (1.5pt)."
 .InsertParagraphAfter
End With
ActiveDocument.Paragraphs(2).Range.Font.Spacing = 1.5

This example sets the character spacing of the selected text to 2 points.

VBA Copy code Copy code
If Selection.Type = wdSelectionNormal Then
 Selection.Font.Spacing = 2
Else
 MsgBox "You need to select some text."
End If

See also

Concepts

Font Object

Other resources

Font Object Members


Font.StrikeThrough Property (Word)

 Copy code hover
[image]

Font.StrikeThrough Property (Word)
See also Send feedback

Published: July 16, 2012

True if the font is formatted as strikethrough text. Read/write Long.

Syntax

expression .StrikeThrough

expression An expression that returns a Font object.

Remarks

The StrikeThrough property returns True, False or wdUndefined (a mixture of True and False). Can be set to True, False, or wdToggle.

To set or return double strikethrough formatting, use the DoubleStrikeThrough property.

Example

This example applies strikethrough formatting to the first three words in the active document.

VBA Copy code Copy code
Set myDoc = ActiveDocument
Set myRange = myDoc.Range(Start:=myDoc.Words(1).Start, _
 End:=myDoc.Words(3).End)
myRange.Font.StrikeThrough = True

This example applies strikethrough formatting to the selected text.

VBA Copy code Copy code
If Selection.Type = wdSelectionNormal Then
 Selection.Font.StrikeThrough = True
Else
 MsgBox "You need to select some text."
End If

See also

Concepts

Font Object

Other resources

Font Object Members


Font.StylisticSet Property (Word)

 Copy code hover
[image]

Font.StylisticSet Property (Word)
See also Send feedback

Published: July 16, 2012

Specifies the stylistic set for the specified font. Read/write WdStylisticSet.

Version Information

Version Added: Word 2010

Syntax

expression .StylisticSet

expression An expression that returns a Font object.

Remarks

Some OpenType fonts provide stylistic sets. A stylistic set defines a set of characters within the font that are intended to be used together, usually for the purpose of visual harmony, such as in headings.

Example

The following code example sets the font for the active document to Gabriola and then applies the sixth stylistic set provided by the Gabriola font.

VBA Copy code Copy code
ActiveDocument.Range.Font.Name = "Gabriola"
ActiveDocument.Range.Font.StylisticSet = wdStylisticSet06

See also

Concepts

Font Object

Other resources

Font Object Members


Font.Subscript Property (Word)

 Copy code hover
[image]

Font.Subscript Property (Word)
See also Send feedback

Published: July 16, 2012

True if the font is formatted as subscript. Read/write Long.

Syntax

expression .Subscript

expression An expression that returns a Font object.

Remarks

Returns True, False or wdUndefined (a mixture of True and False). Can be set to True, False, or wdToggle.

Setting the Subscript property to True sets the Superscript property to False, and vice versa.

Example

This example inserts text at the beginning of the active document and formats the tenth character as subscript.

VBA Copy code Copy code
Set myRange = ActiveDocument.Range(Start:=0, End:=0)
myRange.InsertAfter "Water = H20"
myRange.Characters(10).Font.Subscript = True

This example checks the selected text for subscript formatting.

VBA Copy code Copy code
If Selection.Type = wdSelectionNormal Then
 mySel = Selection.Font.Subscript
 If mySel = wdUndefined Or mySel = True Then
 MsgBox "Subscript text exists in the selection."
 Else
 MsgBox "No subscript text in the selection."
 End If
Else
 MsgBox "You need to select some text."
End If

See also

Concepts

Font Object

Other resources

Font Object Members


Font.Superscript Property (Word)

 Copy code hover
[image]

Font.Superscript Property (Word)
See also Send feedback

Published: July 16, 2012

True if the font is formatted as superscript. Read/write Long.

Syntax

expression .Superscript

expression An expression that returns a Font object.

Remarks

Returns True, False, or wdUndefined (a mixture of True and False). Can be set to True, False, or wdToggle.

Setting the Superscript property to True sets the Subscript property to False, and vice versa.

Example

This example inserts text at the beginning of the active document and formats two characters in the fourth word as superscript.

VBA Copy code Copy code
Set myRange = ActiveDocument.Range(Start:=0, End:=0)
myRange.InsertAfter "Superscript in the 4th word."
ActiveDocument.Range(Start:=20, End:=22).Font.Superscript = True

This example formats the selected text as superscript.

VBA Copy code Copy code
If Selection.Type = wdSelectionNormal Then
 Selection.Font.Superscript = True
Else
 MsgBox "You need to select some text."
End If

See also

Concepts

Font Object

Other resources

Font Object Members


Font.TextColor Property (Word)

 Copy code hover
[image]

Font.TextColor Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a ColorFormat object that represents the color for the specified font. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .TextColor

expression An expression that returns a Font object.

See also

Concepts

Font Object

Other resources

Font Object Members


Font.TextShadow Property (Word)

 Copy code hover
[image]

Font.TextShadow Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a ShadowFormat object that specifies the shadow formatting for the specified font.

Version Information

Version Added: Word 2010

Syntax

expression .TextShadow

expression An expression that returns a Font object.

See also

Concepts

Font Object

Other resources

Font Object Members


Font.ThreeD Property (Word)

 Copy code hover
[image]

Font.ThreeD Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a ThreeDFormat object that contains 3-D effect formatting properties for the specified font. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .ThreeD

expression An expression that returns a Font object.

See also

Concepts

Font Object

Other resources

Font Object Members


Font.Underline Property (Word)

 Copy code hover
[image]

Font.Underline Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the type of underline applied to the font. Read/write WdUnderline.

Syntax

expression .Underline

expression Required. A variable that represents a Font object.

Example

This example applies a single underline to the selected text.

VBA Copy code Copy code
If Selection.Type = wdSelectionNormal Then
 Selection.Font.Underline = wdUnderlineSingle
Else
 MsgBox "You need to select some text."
End If

See also

Concepts

Font Object

Other resources

Font Object Members


Font.UnderlineColor Property (Word)

 Copy code hover
[image]

Font.UnderlineColor Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the 24-bit color of the underline for the specified Font object. .

Syntax

expression .UnderlineColor

expression Required. A variable that represents a Font object.

Remarks

This property can be any valid WdColor constant or a value returned by Visual Basic's RGB function. Setting the UnderlineColor property to wdColorAutomatic resets the color of the underline to the color of the text above it.

See also

Concepts

Font Object

Other resources

Font Object Members


Font Methods (Word)

 Copy code hover
[image]

Font Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Grow | Increases the font size to the next available size.
Reset | Removes manual character formatting (formatting not applied using a style). For example, if you manually format a word as bold and the underlying style is plain text (not bold), the Reset method removes the bold format.
SetAsTemplateDefault | Sets the specified font formatting as the default for the active document and all new documents based on the active template.
Shrink | Decreases the font size to the next available size.


Font.Grow Method (Word)

 Copy code hover
[image]

Font.Grow Method (Word)
See also Send feedback

Published: July 16, 2012

Increases the font size to the next available size.

Syntax

expression .Grow

expression Required. A variable that represents a Font object.

Remarks

If the selection or range contains more than one font size, each size is increased to the next available setting.

Example

This example increases the font size of the fourth word in a new document.

VBA Copy code Copy code
Dim rngTemp As Range

Set rngTemp = Documents.Add.Content
rngTemp.InsertAfter "This is a test of the Grow method."
MsgBox "Click OK to increase the font size of the fourth word."
rngTemp.Words(4).Font.Grow

This example increases the font size of the selected text.

VBA Copy code Copy code
If Selection.Type = wdSelectionNormal Then
 Selection.Font.Grow
Else
 MsgBox "You need to select some text."
End If

See also

Concepts

Font Object

Other resources

Font Object Members


Font.Reset Method (Word)

 Copy code hover
[image]

Font.Reset Method (Word)
See also Send feedback

Published: July 16, 2012

Removes manual character formatting (formatting not applied using a style). For example, if you manually format a word as bold and the underlying style is plain text (not bold), the Reset method removes the bold format.

Syntax

expression .Reset

expression Required. A variable that represents a Font object.

Example

This example removes manual formatting from the selection.

VBA Copy code Copy code
Selection.Font.Reset

See also

Concepts

Font Object

Other resources

Font Object Members


Font.SetAsTemplateDefault Method (Word)

 Copy code hover
[image]

Font.SetAsTemplateDefault Method (Word)
See also Send feedback

Published: July 16, 2012

Sets the specified font formatting as the default for the active document and all new documents based on the active template.

Syntax

expression .SetAsTemplateDefault

expression Required. A variable that represents a Font object.

Remarks

The default font formatting is stored in the Normal style.

Example

This example sets the character formatting in the selection as the default.

VBA Copy code Copy code
Selection.Font.SetAsTemplateDefault

See also

Concepts

Font Object

Other resources

Font Object Members


Font.Shrink Method (Word)

 Copy code hover
[image]

Font.Shrink Method (Word)
See also Send feedback

Published: July 16, 2012

Decreases the font size to the next available size.

Syntax

expression .Shrink

expression A variable that represents a Font object.

Remarks

If the selection or range contains more than one font size, each size is decreased to the next available setting.

Example

This example inserts a line of increasingly smaller Z's in a new document.

VBA Copy code Copy code
Set myRange = Documents.Add.Content
myRange.Font.Size = 45
For Count = 1 To 5
 myRange.InsertAfter "Z"
 For Count2 = 1 to 3
 myRange.Characters(Count).Font.Shrink
 Next Count2
Next Count

See also

Concepts

Font Object

Other resources

Font Object Members


FontNames Object (Word)

 Copy code hover
[image]

FontNames Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a list of the names of all the available fonts.

Remarks

Use the FontNames, LandscapeFontNames, or PortraitFontNames property to return the FontNames object. The following example displays the number of portrait fonts available.

VBA Copy code Copy code
MsgBox PortraitFontNames.Count & " fonts available"

This example lists all the font names in the FontNames object at the end of the active document.

VBA Copy code Copy code
For Each aFont In FontNames
 ActiveDocument.Range.InsertAfter aFont & vbCr
Next aFont

Use FontNames(Index), where Index is the index number, to return the name of a font. The following example displays the first font name in the FontNames object.

VBA Copy code Copy code
MsgBox FontNames(1)
Note Note

You cannot add names to or remove names from the list of available font names.

See also

Concepts

Word Object Model Reference

Other resources

FontNames Object Members


FontNames Members (Word)

 Copy code hover
[image]

FontNames Members (Word)
Send feedback

Published: July 16, 2012

Represents a list of the names of all the available fonts.

Methods

Name | Description
Item | Returns a String that represents the name of a font.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of font names in the collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified FontNames object.


FontNames Properties (Word)

 Copy code hover
[image]

FontNames Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of font names in the collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified FontNames object.


FontNames.Application Property (Word)

 Copy code hover
[image]

FontNames.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a FontNames collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

FontNames Object

Other resources

FontNames Object Members


FontNames.Count Property (Word)

 Copy code hover
[image]

FontNames.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of font names in the collection. Read-only Long.

Syntax

expression .Count

expression Required. A variable that represents a FontNames collection.

See also

Concepts

FontNames Object

Other resources

FontNames Object Members


FontNames.Creator Property (Word)

 Copy code hover
[image]

FontNames.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a FontNames collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

FontNames Object

Other resources

FontNames Object Members


FontNames.Parent Property (Word)

 Copy code hover
[image]

FontNames.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified FontNames object.

Syntax

expression .Parent

expression Required. A variable that represents a FontNames collection.

See also

Concepts

FontNames Object

Other resources

FontNames Object Members


FontNames Methods (Word)

 Copy code hover
[image]

FontNames Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Item | Returns a String that represents the name of a font.


FontNames.Item Method (Word)

 Copy code hover
[image]

FontNames.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a String that represents the name of a font.

Syntax

expression .Item(Index)

expression Required. A variable that represents a FontNames collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The individual object to be returned. Can be a Long indicating the ordinal position of the individual object.

Return Value

String

See also

Concepts

FontNames Object

Other resources

FontNames Object Members


Footnote Object (Word)

 Copy code hover
[image]

Footnote Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a footnote positioned at the bottom of the page or beneath text. The Footnote object is a member of the Footnotes collection. The Footnotes collection represents the footnotes in a selection, range, or document.

Remarks

Use Footnotes(Index), where Index is the index number, to return a single Footnote object. The index number represents the position of the footnote in the selection, range, or document. The following example applies red formatting to the first footnote in the selection.

VBA Copy code Copy code
If Selection.Footnotes.Count >= 1 Then
 Selection.Footnotes(1).Reference.Font.ColorIndex = wdRed
End If

Use the Add method to add a footnote to the Footnotes collection. The following example inserts an automatically numbered footnote immediately after the selection.

VBA Copy code Copy code
Selection.Collapse Direction:=wdCollapseEnd
ActiveDocument.Footnotes.Add Range:=Selection.Range , _
 Text:="The Willow Tree, (Lone Creek Press, 1996)."
Note Note

Footnotes positioned at the end of a document or section are considered endnotes and are included in the Endnotes collection.

See also

Concepts

Word Object Model Reference

Other resources

Footnote Object Members


Footnote Members (Word)

 Copy code hover
[image]

Footnote Members (Word)
Send feedback

Published: July 16, 2012

Represents a footnote positioned at the bottom of the page or beneath text. The Footnote object is a member of the Footnotes collection. The Footnotes collection represents the footnotes in a selection, range, or document.

Methods

Name | Description
Delete | Deletes the specified footnote.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Index | Returns a Long that represents the position of an item in a collection. Read-only.
Parent | Returns an Object that represents the parent object of the specified Footnote object.
Range | Returns a Range object that represents the portion of a document that's contained within the footnote.
Reference | Returns a Range object that represents a footnote reference mark.


Footnote Properties (Word)

 Copy code hover
[image]

Footnote Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Index | Returns a Long that represents the position of an item in a collection. Read-only.
Parent | Returns an Object that represents the parent object of the specified Footnote object.
Range | Returns a Range object that represents the portion of a document that's contained within the footnote.
Reference | Returns a Range object that represents a footnote reference mark.


Footnote.Application Property (Word)

 Copy code hover
[image]

Footnote.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a Footnote object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

Footnote Object

Other resources

Footnote Object Members


Footnote.Creator Property (Word)

 Copy code hover
[image]

Footnote.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a Footnote object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Footnote Object

Other resources

Footnote Object Members


Footnote.Index Property (Word)

 Copy code hover
[image]

Footnote.Index Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the position of an item in a collection. Read-only.

Syntax

expression .Index

expression Required. A variable that represents a Footnote object.

See also

Concepts

Footnote Object

Other resources

Footnote Object Members


Footnote.Parent Property (Word)

 Copy code hover
[image]

Footnote.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Footnote object.

Syntax

expression .Parent

expression Required. A variable that represents a Footnote object.

See also

Concepts

Footnote Object

Other resources

Footnote Object Members


Footnote.Range Property (Word)

 Copy code hover
[image]

Footnote.Range Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the portion of a document that's contained within the footnote.

Syntax

expression .Range

expression Required. A variable that represents a Footnote object.

See also

Concepts

Footnote Object

Other resources

Footnote Object Members


Footnote.Reference Property (Word)

 Copy code hover
[image]

Footnote.Reference Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents a footnote reference mark.

Syntax

expression .Reference

expression Required. A variable that represents a Footnote object.

Example

This example sets myRange to the first footnote reference mark in the active document and then copies the reference mark.

VBA Copy code Copy code
Set myRange = ActiveDocument.Footnotes(1).Reference
myRange.Copy

See also

Concepts

Footnote Object

Other resources

Footnote Object Members


Footnote Methods (Word)

 Copy code hover
[image]

Footnote Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the specified footnote.


Footnote.Delete Method (Word)

 Copy code hover
[image]

Footnote.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the specified footnote.

Syntax

expression .Delete

expression Required. A variable that represents a Footnote object.

See also

Concepts

Footnote Object

Other resources

Footnote Object Members


FootnoteOptions Object (Word)

 Copy code hover
[image]

FootnoteOptions Object (Word)
See also Send feedback

Published: July 16, 2012

Represents the properties assigned to a range or selection of footnotes in a document.

Remarks

Use the Range or Selection object to return a FootnoteOptions object. Using the FootnoteOptions object, you can assign different footnote properties to different areas of a document. For example, you may want footnotes in the introduction of a long document to be displayed as lowercase letters, while in the rest of your document they are displayed as asterisks. The following example uses the NumberingRule, NumberStyle, and StartingNumber properties to format the footnotes in the first section of the active document.

VBA Copy code Copy code
Sub BookIntro()
 Dim rngIntro As Range

 'Sets the range as section one of the active document
 Set rngIntro = ActiveDocument.Sections(1).Range

 'Formats the EndnoteOptions properties
 With rngIntro.FootnoteOptions
 .NumberingRule = wdRestartPage
 .NumberStyle = wdNoteNumberStyleLowercaseLetter
 .StartingNumber = 1
 End With
End Sub

See also

Concepts

Word Object Model Reference

Other resources

FootnoteOptions Object Members


FootnoteOptions Members (Word)

 Copy code hover
[image]

FootnoteOptions Members (Word)
Send feedback

Published: July 16, 2012

Represents the properties assigned to a range or selection of footnotes in a document.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
LayoutColumns | Returns or sets the way footnotes are laid out in columns when the section containing the reference mark has multiple columns. Read-Write Long.
Location | Returns or sets the position of all footnotes. Read/write WdFootnoteLocation.
NumberingRule | Returns or sets the way footnotes or endnotes are numbered after page breaks or section breaks. Read/write WdNumberingRule.
NumberStyle | Returns or sets the number style for the footnotes. Read/write WdNoteNumberStyle.
Parent | Returns an Object that represents the parent object of the specified FootnoteOptions object.
StartingNumber | Returns or sets the starting footnote number. Read/write Long.


FootnoteOptions Properties (Word)

 Copy code hover
[image]

FootnoteOptions Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
LayoutColumns | Returns or sets the way footnotes are laid out in columns when the section containing the reference mark has multiple columns. Read-Write Long.
Location | Returns or sets the position of all footnotes. Read/write WdFootnoteLocation.
NumberingRule | Returns or sets the way footnotes or endnotes are numbered after page breaks or section breaks. Read/write WdNumberingRule.
NumberStyle | Returns or sets the number style for the footnotes. Read/write WdNoteNumberStyle.
Parent | Returns an Object that represents the parent object of the specified FootnoteOptions object.
StartingNumber | Returns or sets the starting footnote number. Read/write Long.


FootnoteOptions.Application Property (Word)

 Copy code hover
[image]

FootnoteOptions.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a FootnoteOptions collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

FootnoteOptions Object

Other resources

FootnoteOptions Object Members


FootnoteOptions.Creator Property (Word)

 Copy code hover
[image]

FootnoteOptions.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a FootnoteOptions collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

FootnoteOptions Object

Other resources

FootnoteOptions Object Members


FootnoteOptions.LayoutColumns Property (Word)

 Copy code hover
[image]

FootnoteOptions.LayoutColumns Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the way footnotes are laid out in columns when the section containing the reference mark has multiple columns. Read-Write Long.

Version information

Version Added: Word 2013

Syntax

expression .LayoutColumns

expression A variable that represents a FootnoteOptions object.

Property value

INT32

See also

Concepts

FootnoteOptions Object

Other resources

FootnoteOptions Members


FootnoteOptions.Location Property (Word)

 Copy code hover
[image]

FootnoteOptions.Location Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the position of all footnotes. Read/write WdFootnoteLocation.

Syntax

expression .Location

expression Required. A variable that represents a Footnote object.

Example

This example positions footnotes at the bottom of each page.

VBA Copy code Copy code
ActiveDocument.Footnotes.Location = wdBottomOfPage

See also

Concepts

FootnoteOptions Object

Other resources

FootnoteOptions Object Members


FootnoteOptions.NumberingRule Property (Word)

 Copy code hover
[image]

FootnoteOptions.NumberingRule Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the way footnotes or endnotes are numbered after page breaks or section breaks. Read/write WdNumberingRule.

Syntax

expression .NumberingRule

expression Required. A variable that represents a FootnoteOptions collection.

Example

If the footnote numbering in section one is set to restart after each section break, this example sets the numbering to restart on each page.

VBA Copy code Copy code
Set myRange = ActiveDocument.Sections(1).Range
If myRange.Footnotes.NumberingRule = wdRestartSection Then
 myRange.Footnotes.NumberingRule = wdRestartPage
End If

See also

Concepts

FootnoteOptions Object

Other resources

FootnoteOptions Object Members


FootnoteOptions.NumberStyle Property (Word)

 Copy code hover
[image]

FootnoteOptions.NumberStyle Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the number style for the footnotes. Read/write WdNoteNumberStyle.

Syntax

expression .NumberStyle

expression Required. A variable that represents a FootnoteOptions collection.

Remarks

Some of the WdNoteNumberStyle constants may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.

See also

Concepts

FootnoteOptions Object

Other resources

FootnoteOptions Object Members


FootnoteOptions.Parent Property (Word)

 Copy code hover
[image]

FootnoteOptions.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified FootnoteOptions object.

Syntax

expression .Parent

expression Required. A variable that represents a FootnoteOptions collection.

See also

Concepts

FootnoteOptions Object

Other resources

FootnoteOptions Object Members


FootnoteOptions.StartingNumber Property (Word)

 Copy code hover
[image]

FootnoteOptions.StartingNumber Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the starting footnote number. Read/write Long.

Syntax

expression .StartingNumber

expression Required. A variable that represents a FootnoteOptions collection.

See also

Concepts

FootnoteOptions Object

Other resources

FootnoteOptions Object Members


Footnotes Object (Word)

 Copy code hover
[image]

Footnotes Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of Footnote objects that represent all the footnotes in a selection, range, or document.

Version Information

Version Added: Word 2010

Remarks

Use the Footnotes property to return the Footnotes collection. The following example changes all of the footnotes in the active document to endnotes.

VBA Copy code Copy code
ActiveDocument.Footnotes.SwapWithEndnotes

Use the Add method to add a footnote to the Footnotes collection. The following example adds a footnote immediately after the selection.

VBA Copy code Copy code
Selection.Collapse Direction:=wdCollapseEnd
ActiveDocument.Footnotes.Add Range:=Selection.Range , _
 Text:="The Willow Tree, (Lone Creek Press, 1996)."

Use Footnotes(index), where index is the index number, to return a single Footnote object. The index number represents the position of the footnote in the selection, range, or document. The following example applies red formatting to the first footnote in the selection.

VBA Copy code Copy code
If Selection.Footnotes.Count >= 1 Then
 Selection.Footnotes(1).Reference.Font.ColorIndex = wdRed
End If
Note Note

Footnotes positioned at the end of a document or section are considered endnotes and are included in the Endnotes collection.

See also

Concepts

Word Object Model Reference

Other resources

Footnotes Object Members


Footnotes Members (Word)

 Copy code hover
[image]

Footnotes Members (Word)
Send feedback

Published: July 16, 2012

A collection of Footnote objects that represent all the footnotes in a selection, range, or document.

Methods

Name | Description
Add | Returns a Footnote object that represents a footnote added to a range.
Convert | Converts endnotes to footnotes, or vice versa.
Item | Returns an individual Footnote object in a collection.
ResetContinuationNotice | Resets the footnote or endnote continuation notice to the default notice.
ResetContinuationSeparator | Resets the footnote or endnote continuation separator to the default separator.
ResetSeparator | Resets the footnote separator to the default separator.
SwapWithEndnotes | Converts all footnotes in a document to endnotes and vice versa.To convert a range of footnotes to endnotes, use the Convert method.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
ContinuationNotice | Returns a Range object that represents the footnote continuation notice. Read-only.
ContinuationSeparator | Returns a Range object that represents the footnote continuation separator. Read-only.
Count | Returns a Long that represents the number of footnotes in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Location | Returns or sets the position of all footnotes. Read/write WdFootnoteLocation.
NumberingRule | Returns or sets the way footnotes or endnotes are numbered after page breaks or section breaks. Read/write WdNumberingRule.
NumberStyle | Returns or sets the number style for the footnotes. Read/write WdNoteNumberStyle.
Parent | Returns an Object that represents the parent object of the specified Footnotes object.
Separator | Returns a Range object that represents the footnote separator.
StartingNumber | Returns or sets the starting note number, line number, or page number. Read/write Long.


Footnotes Properties (Word)

 Copy code hover
[image]

Footnotes Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
ContinuationNotice | Returns a Range object that represents the footnote continuation notice. Read-only.
ContinuationSeparator | Returns a Range object that represents the footnote continuation separator. Read-only.
Count | Returns a Long that represents the number of footnotes in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Location | Returns or sets the position of all footnotes. Read/write WdFootnoteLocation.
NumberingRule | Returns or sets the way footnotes or endnotes are numbered after page breaks or section breaks. Read/write WdNumberingRule.
NumberStyle | Returns or sets the number style for the footnotes. Read/write WdNoteNumberStyle.
Parent | Returns an Object that represents the parent object of the specified Footnotes object.
Separator | Returns a Range object that represents the footnote separator.
StartingNumber | Returns or sets the starting note number, line number, or page number. Read/write Long.


Footnotes.Application Property (Word)

 Copy code hover
[image]

Footnotes.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a Footnotes collection.

Remarks

The Visual Basic functions CreateObject and GetObject enable access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

Footnotes Collection Object

Other resources

Footnotes Object Members


Footnotes.ContinuationNotice Property (Word)

 Copy code hover
[image]

Footnotes.ContinuationNotice Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the footnote continuation notice. Read-only.

Syntax

expression .ContinuationNotice

expression A variable that represents a Footnotes collection.

Example

This example replaces the current footnote continuation notice with the text "Continued...".

VBA Copy code Copy code
With ActiveDocument.Footnotes.ContinuationNotice
 .Delete
 .InsertBefore "Continued..."
End With

See also

Concepts

Footnotes Collection Object

Other resources

Footnotes Object Members


Footnotes.ContinuationSeparator Property (Word)

 Copy code hover
[image]

Footnotes.ContinuationSeparator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the footnote continuation separator. Read-only.

Syntax

expression .ContinuationSeparator

expression A variable that represents a Footnotes collection.

Example

This example replaces the current endnote continuation separator with a series of underscore characters.

VBA Copy code Copy code
With ActiveDocument.Footnotes.ContinuationSeparator
 .Delete
 .InsertBefore "____"
End With

See also

Concepts

Footnotes Collection Object

Other resources

Footnotes Object Members


Footnotes.Count Property (Word)

 Copy code hover
[image]

Footnotes.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of footnotes in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents a Footnotes collection.

See also

Concepts

Footnotes Collection Object

Other resources

Footnotes Object Members


Footnotes.Creator Property (Word)

 Copy code hover
[image]

Footnotes.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a Footnotes collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Footnotes Collection Object

Other resources

Footnotes Object Members


Footnotes.Location Property (Word)

 Copy code hover
[image]

Footnotes.Location Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the position of all footnotes. Read/write WdFootnoteLocation.

Syntax

expression .Location

expression Required. A variable that represents a Footnotes collection.

Example

This example positions footnotes at the bottom of each page.

VBA Copy code Copy code
ActiveDocument.Footnotes.Location = wdBottomOfPage

See also

Concepts

Footnotes Collection Object

Other resources

Footnotes Object Members


Footnotes.NumberingRule Property (Word)

 Copy code hover
[image]

Footnotes.NumberingRule Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the way footnotes or endnotes are numbered after page breaks or section breaks. Read/write WdNumberingRule.

Version Information

Version Added: Word 2010

Syntax

expression .NumberingRule

expression Required. A variable that represents a Footnotes collection.

Example

If the footnote numbering in section one is set to restart after each section break, this example sets the numbering to restart on each page.

VBA Copy code Copy code
Set myRange = ActiveDocument.Sections(1).Range
If myRange.Footnotes.NumberingRule = wdRestartSection Then
 myRange.Footnotes.NumberingRule = wdRestartPage
End If

See also

Concepts

Footnotes Collection Object

Other resources

Footnotes Object Members


Footnotes.NumberStyle Property (Word)

 Copy code hover
[image]

Footnotes.NumberStyle Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the number style for the footnotes. Read/write WdNoteNumberStyle.

Syntax

expression .NumberStyle

expression Required. A variable that represents a Footnotes collection.

Remarks

Some of the WdNoteNumberStyle constants may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.

See also

Concepts

Footnotes Collection Object

Other resources

Footnotes Object Members


Footnotes.Parent Property (Word)

 Copy code hover
[image]

Footnotes.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Footnotes object.

Syntax

expression .Parent

expression Required. A variable that represents a Footnotes collection.

See also

Concepts

Footnotes Collection Object

Other resources

Footnotes Object Members


Footnotes.Separator Property (Word)

 Copy code hover
[image]

Footnotes.Separator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the footnote separator.

Version Information

Version Added: Word 2010

Syntax

expression .Separator

expression Required. A variable that represents a Footnotes collection.

Example

This example changes the footnote separator to a single border indented 3 inches from the right margin.

VBA Copy code Copy code
With ActiveDocument.Footnotes.Separator
 .Delete
 .Borders(wdBorderTop).LineStyle = wdLineStyleSingle
 .ParagraphFormat.RightIndent = InchesToPoints(3)
End With

See also

Concepts

Footnotes Collection Object

Other resources

Footnotes Object Members


Footnotes.StartingNumber Property (Word)

 Copy code hover
[image]

Footnotes.StartingNumber Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the starting note number, line number, or page number. Read/write Long.

Syntax

expression .StartingNumber

expression Required. A variable that represents a Footnotes collection.

Remarks

You must be in print layout view to see line numbering.

When applied to page numbers, this property returns or sets the beginning page number for the specified HeaderFooter object. This number may or may not be visible on the first page, depending on the setting of the ShowFirstPageNumber property. The RestartNumberingAtSection property, if set to False, will override the StartingNumber property so that page numbering can continue from the previous section.

Example

This example creates a new document, sets the starting number for footnotes to 10, and then adds a footnote at the insertion point.

VBA Copy code Copy code
Set myDoc = Documents.Add
With myDoc.Footnotes
 .StartingNumber = 10
 .Add Range:=Selection.Range, Text:="Text for a footnote"
End With

See also

Concepts

Footnotes Collection Object

Other resources

Footnotes Object Members


Footnotes Methods (Word)

 Copy code hover
[image]

Footnotes Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Returns a Footnote object that represents a footnote added to a range.
Convert | Converts endnotes to footnotes, or vice versa.
Item | Returns an individual Footnote object in a collection.
ResetContinuationNotice | Resets the footnote or endnote continuation notice to the default notice.
ResetContinuationSeparator | Resets the footnote or endnote continuation separator to the default separator.
ResetSeparator | Resets the footnote separator to the default separator.
SwapWithEndnotes | Converts all footnotes in a document to endnotes and vice versa.To convert a range of footnotes to endnotes, use the Convert method.


Footnotes.Add Method (Word)

 Copy code hover
[image]

Footnotes.Add Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a Footnote object that represents a footnote added to a range.

Syntax

expression .Add(Range, Reference, Text)

expression Required. A variable that represents a Footnotes collection.

Parameters

Name | Required/Optional | Data Type | Description
Range | Required | Range object | The range marked for the endnote or footnote. This can be a collapsed range.
Reference | Optional | Variant | The text for the custom reference mark. If this argument is omitted, Microsoft Word inserts an automatically-numbered reference mark.
Text | Optional | Variant | The text of the endnote or footnote.

Return Value

Footnote

Remarks

To specify a symbol for the Reference argument, use the syntax {FontName CharNum}. FontName is the name of the font that contains the symbol. Names of decorative fonts appear in the Font box in the Symbol dialog box (Insert menu). CharNum is the sum of 31 and the number corresponding to the position of the symbol you want to insert, counting from left to right in the table of symbols. For example, to specify an omega symbol at position 56 in the table of symbols in the Symbol font, the argument would be "{Symbol 87}".

Example

The following code example adds an automatically-numbered footnote at the end of the selection.

VBA Copy code Copy code
ActiveDocument.Footnotes.Add Range:= Selection.Range , _
 Text:= "The Willow Tree, (Lone Creek Press, 1996)."

The following code example adds a footnote that uses a custom symbol for the reference mark.

VBA Copy code Copy code
ActiveDocument.Footnotes.Add Range:= Selection.Range , _
 Text:= "More information in the full report.", _
 Reference:= "{Symbol -3998}"

See also

Concepts

Footnotes Collection Object

Other resources

Footnotes Object Members


Footnotes.Convert Method (Word)

 Copy code hover
[image]

Footnotes.Convert Method (Word)
See also Send feedback

Published: July 16, 2012

Converts endnotes to footnotes, or vice versa.

Syntax

expression .Convert

expression Required. A variable that represents a Footnotes object.

Example

This example converts the footnotes in the selection to endnotes.

VBA Copy code Copy code
If Selection.Footnotes.Count > 0 Then Selection.Footnotes.Convert

See also

Concepts

Footnotes Collection Object

Other resources

Footnotes Object Members


Footnotes.Item Method (Word)

 Copy code hover
[image]

Footnotes.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual Footnote object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents a Footnotes collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The individual object to be returned. Can be a Long indicating the ordinal position of the individual object.

Return Value

Footnote

See also

Concepts

Footnotes Collection Object

Other resources

Footnotes Object Members


Footnotes.ResetContinuationNotice Method (Word)

 Copy code hover
[image]

Footnotes.ResetContinuationNotice Method (Word)
See also Send feedback

Published: July 16, 2012

Resets the footnote or endnote continuation notice to the default notice.

Syntax

expression .ResetContinuationNotice

expression Required. A variable that represents a Footnotes collection.

Remarks

The default notice is blank (no text).

Example

This example resets the footnote continuation notice and sets the starting number for footnote reference marks to 2 in Sales.doc.

VBA Copy code Copy code
With Documents("Sales.doc").Sections(1).Range.Footnotes
 .ResetContinuationNotice
 .NumberingRule = wdRestartContinuous
 .StartingNumber = 2
End With

See also

Concepts

Footnotes Collection Object

Other resources

Footnotes Object Members


Footnotes.ResetContinuationSeparator Method (Word)

 Copy code hover
[image]

Footnotes.ResetContinuationSeparator Method (Word)
See also Send feedback

Published: July 16, 2012

Resets the footnote or endnote continuation separator to the default separator.

Syntax

expression .ResetContinuationSeparator

expression Required. A variable that represents a Footnotes collection.

Remarks

The default separator is a long horizontal line that separates document text from notes continued from the previous page.

Example

This example resets the footnote continuation separator to the default separator line.

VBA Copy code Copy code
ActiveDocument.Footnotes.ResetContinuationSeparator

See also

Concepts

Footnotes Collection Object

Other resources

Footnotes Object Members


Footnotes.ResetSeparator Method (Word)

 Copy code hover
[image]

Footnotes.ResetSeparator Method (Word)
See also Send feedback

Published: July 16, 2012

Resets the footnote separator to the default separator.

Syntax

expression .ResetSeparator

expression Required. A variable that represents a Footnotes collection.

Remarks

The default separator is a short horizontal line that separates document text from notes.

Example

This example resets the footnote separator to the default separator line.

VBA Copy code Copy code
ActiveDocument.Footnotes.ResetSeparator

See also

Concepts

Footnotes Collection Object

Other resources

Footnotes Object Members


Footnotes.SwapWithEndnotes Method (Word)

 Copy code hover
[image]

Footnotes.SwapWithEndnotes Method (Word)
See also Send feedback

Published: July 16, 2012

Converts all footnotes in a document to endnotes and vice versa.To convert a range of footnotes to endnotes, use the Convert method.

Syntax

expression .SwapWithEndnotes

expression Required. A variable that represents a Footnotes collection.

Example

This example converts the footnotes in the active document to endnotes and converts the endnotes to footnotes.

VBA Copy code Copy code
ActiveDocument.Footnotes.SwapWithEndnotes

See also

Concepts

Footnotes Collection Object

Other resources

Footnotes Object Members


FormField Object (Word)

 Copy code hover
[image]

FormField Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a single form field. The FormField object is a member of the FormFields collection.

Remarks

Use FormFields(index), where index is a bookmark name or index number, to return a single FormField object. The following example sets the result of the Text1 form field to "Don Funk."

VBA Copy code Copy code
ActiveDocument.FormFields("Text1").Result = "Don Funk"

The index number represents the position of the form field in the selection, range, or document. The following example displays the name of the first form field in the selection.

VBA Copy code Copy code
If Selection.FormFields.Count >= 1 Then
 MsgBox Selection.FormFields(1).Name
End If

Use the Add method with the FormFields object to add a form field. The following example adds a check box at the beginning of the active document and then selects the check box.

VBA Copy code Copy code
Set ffield = ActiveDocument.FormFields.Add( _
 Range:=ActiveDocument.Range(Start:=0, End:=0), _
 Type:=wdFieldFormCheckBox)
ffield.CheckBox.Value = True

Use the CheckBox , DropDown , and TextInput properties with the FormField object to return the CheckDown, DropDown, and TextInput objects. The following example selects the check box named "Check1."

VBA Copy code Copy code
ActiveDocument.FormFields("Check1").CheckBox.Value = True

See also

Concepts

Word Object Model Reference

Other resources

FormField Object Members


FormField Members (Word)

 Copy code hover
[image]

FormField Members (Word)
Send feedback

Published: July 16, 2012

Represents a single form field. The FormField object is a member of the FormFields collection.

Methods

Name | Description
Copy | Copies the specified form field to the Clipboard.
Cut | Removes the specified form field from the document and places it on the Clipboard.
Delete | Deletes the specified form field.
Select | Selects the specified object.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
CalculateOnExit | True if references to the specified form field are automatically updated whenever the field is exited. Read/write Boolean.
CheckBox | Returns a CheckBox object that represents a check box form field. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
DropDown | Returns a DropDown object that represents a drop-down form field. Read-only.
Enabled | True if a form field is enabled. Read/write Boolean.
EntryMacro | Returns or sets an entry macro name for the specified form field (CheckBox, DropDown, or TextInput). Read/write String.
ExitMacro | Returns or sets an exit macro name for the specified form field (CheckBox, DropDown, or TextInput). Read/write String.
HelpText | Returns or sets the text that's displayed in a message box when the form field has the focus and the user presses F1. Read/write String.
Name | Returns or sets the name of the specified object. Read/write String.
Next | Returns the next form field in the collection. Read-only.
OwnHelp | Specifies the source of the text that's displayed in a message box when a form field has the focus and the user presses F1. Read/write Boolean.
OwnStatus | Specifies the source of the text that's displayed in the status bar when a form field has the focus. Read/write Boolean.
Parent | Returns an Object that represents the parent object of the specified FormField object.
Previous | Returns the previous form field in the collection. Read-only.
Range | Returns a Range object that represents the portion of a document that is contained within the form field.
Result | Returns a String that represents the result of the specified form field. Read/write.
StatusText | Returns or sets the text that is displayed in the status bar when a form field has the focus. Read/write String.
TextInput | Returns a TextInput object that represents a text form field.
Type | Returns the field type. Read-only WdFieldType.


FormField Properties (Word)

 Copy code hover
[image]

FormField Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
CalculateOnExit | True if references to the specified form field are automatically updated whenever the field is exited. Read/write Boolean.
CheckBox | Returns a CheckBox object that represents a check box form field. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
DropDown | Returns a DropDown object that represents a drop-down form field. Read-only.
Enabled | True if a form field is enabled. Read/write Boolean.
EntryMacro | Returns or sets an entry macro name for the specified form field (CheckBox, DropDown, or TextInput). Read/write String.
ExitMacro | Returns or sets an exit macro name for the specified form field (CheckBox, DropDown, or TextInput). Read/write String.
HelpText | Returns or sets the text that's displayed in a message box when the form field has the focus and the user presses F1. Read/write String.
Name | Returns or sets the name of the specified object. Read/write String.
Next | Returns the next form field in the collection. Read-only.
OwnHelp | Specifies the source of the text that's displayed in a message box when a form field has the focus and the user presses F1. Read/write Boolean.
OwnStatus | Specifies the source of the text that's displayed in the status bar when a form field has the focus. Read/write Boolean.
Parent | Returns an Object that represents the parent object of the specified FormField object.
Previous | Returns the previous form field in the collection. Read-only.
Range | Returns a Range object that represents the portion of a document that is contained within the form field.
Result | Returns a String that represents the result of the specified form field. Read/write.
StatusText | Returns or sets the text that is displayed in the status bar when a form field has the focus. Read/write String.
TextInput | Returns a TextInput object that represents a text form field.
Type | Returns the field type. Read-only WdFieldType.


FormField.Application Property (Word)

 Copy code hover
[image]

FormField.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a FormField object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

FormField Object

Other resources

FormField Object Members


FormField.CalculateOnExit Property (Word)

 Copy code hover
[image]

FormField.CalculateOnExit Property (Word)
See also Send feedback

Published: July 16, 2012

True if references to the specified form field are automatically updated whenever the field is exited. Read/write Boolean.

Syntax

expression .CalculateOnExit

expression A variable that represents a FormField object.

Remarks

A REF field can be used to reference the contents of a form field. For example, {REF SubTotal} references the form field marked by the SubTotal bookmark.

Example

This example keeps references to form fields in Form.doc from being automatically updated whenever the form field is exited.

VBA Copy code Copy code
Dim ffLoop As FormField

For Each ffLoop In Documents("Form.doc").FormFields
 ffLoop.CalculateOnExit = False
Next ffLoop

This example adds a text form field and a REF field in a new document. Whenever text is typed and the Text1 field is exited, the REF field is automatically updated.

VBA Copy code Copy code
With Documents.Add
 .FormFields.Add Range:=Selection.Range, _
 Type:=wdFieldFormTextInput
 .Fields.Add Range:=Selection.Range, _
 Type:=wdFieldRef, Text:="Text1"
 .FormFields("Text1").CalculateOnExit = True
 .Protect Type:=wdAllowOnlyFormFields
End With

See also

Concepts

FormField Object

Other resources

FormField Object Members


FormField.CheckBox Property (Word)

 Copy code hover
[image]

FormField.CheckBox Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a CheckBox object that represents a check box form field. Read-only.

Syntax

expression .CheckBox

expression A variable that represents a FormField object.

Remarks

If the CheckBox property is applied to a FormField object that isn't a check box form field, the property won't fail, but the Valid property for the returned object will be False.

Example

This example clears the check box named "Blue."

VBA Copy code Copy code
ActiveDocument.FormFields("Blue").CheckBox.Value = False

This example compares the current value with the default value of the check box named "Check1." If the values are equal, the blnSame variable is set to True.

VBA Copy code Copy code
Dim ffTemp As FormField
Dim blnSame As Boolean

Set ffTemp = ActiveDocument.FormFields("Check1").CheckBox
If ffTemp.Default = ffTemp.Value Then
 blnSame = True
Else
 blnSame = False
End If

See also

Concepts

FormField Object

Other resources

FormField Object Members


FormField.Creator Property (Word)

 Copy code hover
[image]

FormField.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a FormField object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

FormField Object

Other resources

FormField Object Members


FormField.DropDown Property (Word)

 Copy code hover
[image]

FormField.DropDown Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a DropDown object that represents a drop-down form field. Read-only.

Syntax

expression .DropDown

expression A variable that represents a FormField object.

Remarks

If the DropDown property is applied to a FormField object that isn't a drop-down form field, the property won't fail, but the Valid property for the returned object will be False.

Example

This example displays the text of the item selected in the drop-down form field named "Colors."

VBA Copy code Copy code
Dim ffDrop As FormField

Set ffDrop = ActiveDocument.FormFields("Colors").DropDown

MsgBox ffDrop.ListEntries(ffDrop.Value).Name

This example adds "Seattle" to the drop-down form field named "Places" in Form.doc.

VBA Copy code Copy code
With Documents("Form.doc").FormFields("Places") _
 .DropDown.ListEntries
 .Add Name:="Seattle"
End With

See also

Concepts

FormField Object

Other resources

FormField Object Members


FormField.Enabled Property (Word)

 Copy code hover
[image]

FormField.Enabled Property (Word)
See also Send feedback

Published: July 16, 2012

True if a form field is enabled. Read/write Boolean.

Syntax

expression .Enabled

expression An expression that represents a FormField object.

Remarks

If a form field is enabled, its contents can be changed as the form is filled in.

Example

If the first form field in the active document is an enabled check box, this example selects the check box.

VBA Copy code Copy code
Dim ffFirst As FormField

Set ffFirst = ActiveDocument.FormFields(1)
If ffFirst.Enabled = True And _
 ffFirst.Type = wdFieldFormCheckBox Then
 ffFirst.CheckBox.Value = True
End If

See also

Concepts

FormField Object

Other resources

FormField Object Members


FormField.EntryMacro Property (Word)

 Copy code hover
[image]

FormField.EntryMacro Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets an entry macro name for the specified form field (CheckBox, DropDown, or TextInput). Read/write String.

Syntax

expression .EntryMacro

expression A variable that represents a FormField object.

Remarks

The entry macro runs when the form field gets the focus.

Example

This example assigns the macro named "Blue" to the first form field in "Form.doc."

VBA Copy code Copy code
Documents("Form.doc").FormFields(1).EntryMacro = "Blue"

This example assigns the macro named "Breadth" to the form field named "Text1" in the active document.

VBA Copy code Copy code
ActiveDocument.FormFields("Text1").EntryMacro = "Breadth"

See also

Concepts

FormField Object

Other resources

FormField Object Members


FormField.ExitMacro Property (Word)

 Copy code hover
[image]

FormField.ExitMacro Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets an exit macro name for the specified form field (CheckBox, DropDown, or TextInput). Read/write String.

Syntax

expression .ExitMacro

expression A variable that represents a FormField object.

Remarks

The exit macro runs when the form field loses the focus.

Example

This example assigns the macro named "Reformat" to the first form field in the selection.

VBA Copy code Copy code
If Selection.FormFields.Count > 0 Then _
 Selection.FormFields(1).ExitMacro = "Reformat"

This example assigns the macro named "Blue" to the last form field in "Form.doc."

VBA Copy code Copy code
Dim intMax As Integer

intMax = Documents("Form.doc").FormFields.Count
Documents("Form.doc").FormFields(intMax).ExitMacro = "Blue"

See also

Concepts

FormField Object

Other resources

FormField Object Members


FormField.HelpText Property (Word)

 Copy code hover
[image]

FormField.HelpText Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the text that's displayed in a message box when the form field has the focus and the user presses F1. Read/write String.

Syntax

expression .HelpText

expression A variable that represents a FormField object.

Remarks

If the OwnHelp property is set to True, HelpText specifies the text string value. If OwnHelp is set to False, HelpText specifies the name of an AutoText entry that contains help text for the form field.

Example

This example sets the help text for the form field named "Name."

VBA Copy code Copy code
With ActiveDocument.FormFields("Name")
 .OwnHelp = True
 .HelpText = "Type your full legal name."
End With

See also

Concepts

FormField Object

Other resources

FormField Object Members


FormField.Name Property (Word)

 Copy code hover
[image]

FormField.Name Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the name of the specified object. Read/write String.

Syntax

expression .Name

expression Required. A variable that represents a FormField object.

See also

Concepts

FormField Object

Other resources

FormField Object Members


FormField.Next Property (Word)

 Copy code hover
[image]

FormField.Next Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the next form field in the collection. Read-only.

Syntax

expression .Next

expression A variable that represents a FormField object.

See also

Concepts

FormField Object

Other resources

FormField Object Members


FormField.OwnHelp Property (Word)

 Copy code hover
[image]

FormField.OwnHelp Property (Word)
See also Send feedback

Published: July 16, 2012

Specifies the source of the text that's displayed in a message box when a form field has the focus and the user presses F1. Read/write Boolean.

Syntax

expression .OwnHelp

expression An expression that returns a FormField object.

Remarks

If True, the text specified by the HelpText property is displayed. If False, the text in the AutoText entry specified by the HelpText property is displayed.

Example

This example sets the help text for the first form field in the current section to the contents of the AutoText entry named "Sample."

VBA Copy code Copy code
With Selection.Sections(1).Range.FormFields(1)
 .OwnHelp = False
 .HelpText = "Sample"
End With

See also

Concepts

FormField Object

Other resources

FormField Object Members


FormField.OwnStatus Property (Word)

 Copy code hover
[image]

FormField.OwnStatus Property (Word)
See also Send feedback

Published: July 16, 2012

Specifies the source of the text that's displayed in the status bar when a form field has the focus. Read/write Boolean.

Syntax

expression .OwnStatus

expression An expression that returns a FormField object.

Remarks

If True, the text specified by the StatusText property is displayed. If False, the text of the AutoText entry specified by the StatusText property is displayed.

Example

This example sets the status bar text for the form field named "Account" to the contents of the AutoText entry named "Acct."

VBA Copy code Copy code
With ActiveDocument.FormFields("Account")
 .OwnStatus = False
 .StatusText = "Acct"
End With

See also

Concepts

FormField Object

Other resources

FormField Object Members


FormField.Parent Property (Word)

 Copy code hover
[image]

FormField.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified FormField object.

Syntax

expression .Parent

expression Required. A variable that represents a FormField object.

See also

Concepts

FormField Object

Other resources

FormField Object Members


FormField.Previous Property (Word)

 Copy code hover
[image]

FormField.Previous Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the previous form field in the collection. Read-only.

Syntax

expression .Previous

expression A variable that represents a FormField object.

Example

This example displays the field code of the second-to-last form field in the active document.

VBA Copy code Copy code
Set aField = ActiveDocument _
 .FormFields(ActiveDocument.FormFields.Count).Previous
MsgBox "Form field code = " & aField.Code

See also

Concepts

FormField Object

Other resources

FormField Object Members


FormField.Range Property (Word)

 Copy code hover
[image]

FormField.Range Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the portion of a document that is contained within the form field.

Syntax

expression .Range

expression Required. A variable that represents a FormField object.

See also

Concepts

FormField Object

Other resources

FormField Object Members


FormField.Result Property (Word)

 Copy code hover
[image]

FormField.Result Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a String that represents the result of the specified form field. Read/write.

Syntax

expression .Result

expression Required. A variable that represents a FormField object.

Example

This example displays the result of each form field in the active document.

VBA Copy code Copy code
For Each aField In ActiveDocument.FormFields
 MsgBox aField.Result
Next aField

See also

Concepts

FormField Object

Other resources

FormField Object Members


FormField.StatusText Property (Word)

 Copy code hover
[image]

FormField.StatusText Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the text that is displayed in the status bar when a form field has the focus. Read/write String.

Syntax

expression .StatusText

expression A variable that represents a FormField object.

Remarks

If the OwnStatus property is set to True, the StatusText property specifies the status bar text. If the OwnStatus property is set to False, the StatusText property specifies the name of an AutoText entry that contains status bar text for the form field.

Example

This example sets the status bar help text for the form field named "Age."

VBA Copy code Copy code
With ActiveDocument.FormFields("Age")
 .OwnStatus = True
 .StatusText = "Type your current age."
End With

See also

Concepts

FormField Object

Other resources

FormField Object Members


FormField.TextInput Property (Word)

 Copy code hover
[image]

FormField.TextInput Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a TextInput object that represents a text form field.

Syntax

expression .TextInput

expression An expression that returns a FormField object.

Remarks

If the TextInput property is applied to a FormField object that isn't a drop-down form field, the property won't fail, but the Valid property for the returned object will be False.

Use the Result property with the FormField object to return or set the contents of a TextInput object, as follows:

Example

This example protects the active document for forms and deletes the contents of the form field named "Text1."

VBA Copy code Copy code
ActiveDocument.Protect Type:=wdAllowOnlyFormFields
ActiveDocument.FormFields("Text1").TextInput.Clear

If the first form field in the active document is a text form field that accepts regular text, this example sets the contents of the form field.

VBA Copy code Copy code
Set myField = ActiveDocument.FormFields(1)
If myField.Type = wdFieldFormTextInput And _
 myField.TextInput.Type = wdRegularText Then
 myField.Result = "Hello"
End If

See also

Concepts

FormField Object

Other resources

FormField Object Members


FormField.Type Property (Word)

 Copy code hover
[image]

FormField.Type Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the field type. Read-only WdFieldType.

Syntax

expression .Type

expression Required. A variable that represents a FormField object.

Remarks

Security note Security Note
Dynamic data exchange (DDE) is an older technology that is not secure. If possible, use a more secure alternative to DDE, such as object linking and embedding (OLE).

See also

Concepts

FormField Object

Other resources

FormField Object Members


FormField Methods (Word)

 Copy code hover
[image]

FormField Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Copy | Copies the specified form field to the Clipboard.
Cut | Removes the specified form field from the document and places it on the Clipboard.
Delete | Deletes the specified form field.
Select | Selects the specified object.


FormField.Copy Method (Word)

 Copy code hover
[image]

FormField.Copy Method (Word)
See also Send feedback

Published: July 16, 2012

Copies the specified form field to the Clipboard.

Syntax

expression .Copy

expression Required. A variable that represents a FormField object.

See also

Concepts

FormField Object

Other resources

FormField Object Members


FormField.Cut Method (Word)

 Copy code hover
[image]

FormField.Cut Method (Word)
See also Send feedback

Published: July 16, 2012

Removes the specified form field from the document and places it on the Clipboard.

Syntax

expression .Cut

expression Required. A variable that represents a FormField object.

Example

This example deletes the first field in the active document and pastes the field at the insertion point.

VBA Copy code Copy code
If ActiveDocument.Fields.Count >= 1 Then
 ActiveDocument.Fields(1).Cut
 Selection.Collapse Direction:=wdCollapseEnd
 Selection.Paste
End If

This example deletes the first word in the first paragraph and pastes the word at the end of the paragraph.

VBA Copy code Copy code
With ActiveDocument.Paragraphs(1).Range
 .Words(1).Cut
 .Collapse Direction:=wdCollapseEnd
 .Move Unit:=wdCharacter, Count:=-1
 .Paste
End With

This example deletes the contents of the selection and pastes them into a new document.

VBA Copy code Copy code
If Selection.Type = wdSelectionNormal Then
 Selection.Cut
 Documents.Add.Content.Paste
End If

See also

Concepts

FormField Object

Other resources

FormField Object Members


FormField.Delete Method (Word)

 Copy code hover
[image]

FormField.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the specified form field.

Syntax

expression .Delete

expression Required. A variable that represents a FormField object.

See also

Concepts

FormField Object

Other resources

FormField Object Members


FormField.Select Method (Word)

 Copy code hover
[image]

FormField.Select Method (Word)
See also Send feedback

Published: July 16, 2012

Selects the specified object.

Syntax

expression .Select

expression Required. A variable that represents a FormField object.

Remarks

After using this method, use the Selection object to work with the selected items. For more information, see Working with the Selection Object.

See also

Concepts

FormField Object

Other resources

FormField Object Members


FormFields Object (Word)

 Copy code hover
[image]

FormFields Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of FormField objects that represent all the form fields in a selection, range, or document.

Remarks

Use the FormFields property to return the FormFields collection. The following example counts the number of text box form fields in the active document.

VBA Copy code Copy code
For Each aField In ActiveDocument.FormFields
 If aField.Type = wdFieldFormTextInput Then count = count + 1
Next aField
MsgBox "There are " & count & " text boxes in this document"

Use the Add method with the FormFields object to add a form field. The following example adds a check box at the beginning of the active document and then selects the check box.

VBA Copy code Copy code
Set ffield = ActiveDocument.FormFields.Add( _
 Range:=ActiveDocument.Range(Start:=0,End:=0), _
 Type:=wdFieldFormCheckBox)
ffield.CheckBox.Value = True

Use FormFields(Index), where Index is a bookmark name or index number, to return a single FormField object. The following example sets the result of the Text1 form field to "Don Funk."

VBA Copy code Copy code
ActiveDocument.FormFields("Text1").Result = "Don Funk"

The index number represents the position of the form field in the selection, range, or document. The following example displays the name of the first form field in the selection.

VBA Copy code Copy code
If Selection.FormFields.Count >= 1 Then
 MsgBox Selection.FormFields(1).Name
End If

See also

Concepts

Word Object Model Reference

Other resources

FormFields Object Members


FormFields Members (Word)

 Copy code hover
[image]

FormFields Members (Word)
Send feedback

Published: July 16, 2012

A collection of FormField objects that represent all the form fields in a selection, range, or document.

Methods

Name | Description
Add | Returns a FormField object that represents a new form field added at a range.
Item | Returns an individual FormField object in a collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of fields in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified FormFields object.
Shaded | True if shading is applied to form fields. Read/write Boolean.


FormFields Properties (Word)

 Copy code hover
[image]

FormFields Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of fields in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified FormFields object.
Shaded | True if shading is applied to form fields. Read/write Boolean.


FormFields.Application Property (Word)

 Copy code hover
[image]

FormFields.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a FormFields collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

FormFields Collection Object

Other resources

FormFields Object Members


FormFields.Count Property (Word)

 Copy code hover
[image]

FormFields.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of fields in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents a FormFields collection.

See also

Concepts

FormFields Collection Object

Other resources

FormFields Object Members


FormFields.Creator Property (Word)

 Copy code hover
[image]

FormFields.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a FormFields collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

FormFields Collection Object

Other resources

FormFields Object Members


FormFields.Parent Property (Word)

 Copy code hover
[image]

FormFields.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified FormFields object.

Syntax

expression .Parent

expression Required. A variable that represents a FormFields collection.

See also

Concepts

FormFields Collection Object

Other resources

FormFields Object Members


FormFields.Shaded Property (Word)

 Copy code hover
[image]

FormFields.Shaded Property (Word)
See also Send feedback

Published: July 16, 2012

True if shading is applied to form fields. Read/write Boolean.

Syntax

expression .Shaded

expression An expression that returns a FormFields collection object.

Remarks

Shading makes form fields easier to locate in a document and doesn't affect the printed output.

Example

This example removes shading from form fields in Employment Form.doc.

VBA Copy code Copy code
Documents("Employment Form.doc").FormFields.Shaded = False

This example adds shading to the form fields in the active document and protects the document for forms.

VBA Copy code Copy code
With ActiveDocument
 .FormFields.Shaded = True
 .Protect Type:=wdAllowOnlyFormFields, NoReset:=True
End With

See also

Concepts

FormFields Collection Object

Other resources

FormFields Object Members


FormFields Methods (Word)

 Copy code hover
[image]

FormFields Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Returns a FormField object that represents a new form field added at a range.
Item | Returns an individual FormField object in a collection.


FormFields.Add Method (Word)

 Copy code hover
[image]

FormFields.Add Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a FormField object that represents a new form field added at a range.

Syntax

expression .Add(Range, Type)

expression Required. A variable that represents a FormFields collection.

Parameters

Name | Required/Optional | Data Type | Description
Range | Required | Range object | The range where you want to add the form field. If the range isn't collapsed, the form field replaces the range.
Type | Required | WdFieldType | The type of form field to add.

Return Value

FormField

Remarks

Security note Security Note
Dynamic data exchange (DDE) is an older technology that is not secure. If possible, use a more secure alternative to DDE, such as object linking and embedding (OLE).

Example

This example adds a check box at the end of the selection, gives it a name, and then selects it.

VBA Copy code Copy code
Selection.Collapse Direction:=wdCollapseEnd
Set ffield = ActiveDocument.FormFields _
 .Add(Range:=Selection.Range, Type:=wdFieldFormCheckBox)
With ffield
 .Name = "Check_Box_1"
 .CheckBox.Value = True
End With

See also

Concepts

FormFields Collection Object

Other resources

FormFields Object Members


FormFields.Item Method (Word)

 Copy code hover
[image]

FormFields.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual FormField object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents a FormFields collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The individual object to be returned. Can be a Long indicating the ordinal position or a String representing the name of the individual object.

Return Value

FormField

See also

Concepts

FormFields Collection Object

Other resources

FormFields Object Members


Frame Object (Word)

 Copy code hover
[image]

Frame Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a frame. The Frame object is a member of the Frames collection. The Frames collection includes all frames in a selection, range, or document.

Remarks

Use Frames(Index), where Index is the index number, to return a single Frame object. The index number represents the position of the frame in the selection, range, or document. The following example allows text to wrap around the first frame in the active document.

VBA Copy code Copy code
ActiveDocument.Frames(1).TextWrap = True

Use the Add method to add a frame around a range. The following example adds a frame around the first paragraph in the active document.

VBA Copy code Copy code
ActiveDocument.Frames.Add _
 Range:=ActiveDocument.Paragraphs(1).Range

You can wrap text around Shape or ShapeRange objects by using the WrapFormat property. You can position a Shape or ShapeRange object by using the Top and Left properties.

See also

Concepts

Word Object Model Reference

Other resources

Frame Object Members


Frame Members (Word)

 Copy code hover
[image]

Frame Members (Word)
Send feedback

Published: July 16, 2012

Represents a frame. The Frame object is a member of the Frames collection. The Frames collection includes all frames in a selection, range, or document.

Methods

Name | Description
Copy | Copies the specified frame to the Clipboard.
Cut | Removes the specified frame from the document and places it on the Clipboard.
Delete | Deletes the specified frame.
Select | Selects the specified object.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Borders | Returns a Borders collection that represents all the borders for the specified frame.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Height | Returns or sets a Single that represents the height of the specified frame. Read/write .
HeightRule | Returns or sets a WdFrameSizeRule that represents the rule for determining the height of the specified frame. Read/write.
HorizontalDistanceFromText | Returns or sets the horizontal distance between a frame and the surrounding text, in points. Read/write Single.
HorizontalPosition | Returns or sets the horizontal distance between the edge of the frame and the item specified by the RelativeHorizontalPosition property. Read/write Single.
LockAnchor | True if the specified frame is locked. Read/write Boolean.
Parent | Returns an Object that represents the parent object of the specified Frame object.
Range | Returns a Range object that represents the portion of a document that's contained within the frame.
RelativeHorizontalPosition | Specifies the relative horizontal position of a frame. Read/write WdRelativeHorizontalPosition.
RelativeVerticalPosition | Specifies the relative vertical position of a frame. Read/write WdRelativeVerticalPosition.
Shading | Returns a Shading object that refers to the shading formatting for the specified object.
TextWrap | True if document text wraps around the specified frame. Read/write Boolean.
VerticalDistanceFromText | Returns or sets the vertical distance (in points) between a frame and the surrounding text. Read/write Single.
VerticalPosition | Returns or sets the vertical distance between the edge of the frame and the item specified by the RelativeVerticalPosition property. Read/write Single.
Width | Returns or sets the width of the frame, in points. Read/write Long.
WidthRule | Returns or sets the rule used to determine the width of a frame. Read/write WdFrameSizeRule.


Frame Properties (Word)

 Copy code hover
[image]

Frame Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Borders | Returns a Borders collection that represents all the borders for the specified frame.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Height | Returns or sets a Single that represents the height of the specified frame. Read/write .
HeightRule | Returns or sets a WdFrameSizeRule that represents the rule for determining the height of the specified frame. Read/write.
HorizontalDistanceFromText | Returns or sets the horizontal distance between a frame and the surrounding text, in points. Read/write Single.
HorizontalPosition | Returns or sets the horizontal distance between the edge of the frame and the item specified by the RelativeHorizontalPosition property. Read/write Single.
LockAnchor | True if the specified frame is locked. Read/write Boolean.
Parent | Returns an Object that represents the parent object of the specified Frame object.
Range | Returns a Range object that represents the portion of a document that's contained within the frame.
RelativeHorizontalPosition | Specifies the relative horizontal position of a frame. Read/write WdRelativeHorizontalPosition.
RelativeVerticalPosition | Specifies the relative vertical position of a frame. Read/write WdRelativeVerticalPosition.
Shading | Returns a Shading object that refers to the shading formatting for the specified object.
TextWrap | True if document text wraps around the specified frame. Read/write Boolean.
VerticalDistanceFromText | Returns or sets the vertical distance (in points) between a frame and the surrounding text. Read/write Single.
VerticalPosition | Returns or sets the vertical distance between the edge of the frame and the item specified by the RelativeVerticalPosition property. Read/write Single.
Width | Returns or sets the width of the frame, in points. Read/write Long.
WidthRule | Returns or sets the rule used to determine the width of a frame. Read/write WdFrameSizeRule.


Frame.Application Property (Word)

 Copy code hover
[image]

Frame.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a Frame object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

Frame Object

Other resources

Frame Object Members


Frame.Borders Property (Word)

 Copy code hover
[image]

Frame.Borders Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Borders collection that represents all the borders for the specified frame.

Syntax

expression .Borders

expression Required. A variable that represents a Frame object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection .

See also

Concepts

Frame Object

Other resources

Frame Object Members


Frame.Creator Property (Word)

 Copy code hover
[image]

Frame.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a Frame object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Frame Object

Other resources

Frame Object Members


Frame.Height Property (Word)

 Copy code hover
[image]

Frame.Height Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Single that represents the height of the specified frame. Read/write .

Syntax

expression .Height

expression A variable that represents a Frame object.

See also

Concepts

Frame Object

Other resources

Frame Object Members


Frame.HeightRule Property (Word)

 Copy code hover
[image]

Frame.HeightRule Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a WdFrameSizeRule that represents the rule for determining the height of the specified frame. Read/write.

Syntax

expression .HeightRule

expression Required. A variable that represents a Frame object.

Example

This example sets both the height and width of the first frame in the active document to exactly 1 inch.

VBA Copy code Copy code
If ActiveDocument.Frames.Count >= 1 Then
 With ActiveDocument.Frames(1)
 .HeightRule = wdFrameExact
 .Height = InchesToPoints(1)
 .WidthRule = wdFrameExact
 .Width = InchesToPoints(1)
 End With
End If

See also

Concepts

Frame Object

Other resources

Frame Object Members


Frame.HorizontalDistanceFromText Property (Word)

 Copy code hover
[image]

Frame.HorizontalDistanceFromText Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the horizontal distance between a frame and the surrounding text, in points. Read/write Single.

Syntax

expression .HorizontalDistanceFromText

expression A variable that represents a Frame object.

Example

This example adds a frame around the selection and sets the horizontal distance between the frame and the text to 12 points.

VBA Copy code Copy code
Dim frmNew As Frame

Set frmNew = ActiveDocument.Frames.Add(Range:=Selection.Range)
frmNew.HorizontalDistanceFromText = 12

This example adds a frame around the first paragraph and sets several properties of the frame.

VBA Copy code Copy code
Dim frmNew As Frame

Set frmNew = ActiveDocument.Frames.Add _
 (Range:=ActiveDocument.Paragraphs(1).Range)

With frmNew
 .HorizontalDistanceFromText = InchesToPoints(0.25)
 .VerticalDistanceFromText = InchesToPoints(0.25)
 .HeightRule = wdFrameAuto
 .WidthRule = wdFrameAuto
 .Borders.Enable = False
End With

See also

Concepts

Frame Object

Other resources

Frame Object Members


Frame.HorizontalPosition Property (Word)

 Copy code hover
[image]

Frame.HorizontalPosition Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the horizontal distance between the edge of the frame and the item specified by the RelativeHorizontalPosition property. Read/write Single.

Syntax

expression .HorizontalPosition

expression A variable that represents a Frame object.

Remarks

This property can be a number that indicates a measurement in points, or can be one of the WdFramePosition constants.

Example

This example aligns the first frame in the active document horizontally with the right margin.

VBA Copy code Copy code
If ActiveDocument.Frames.Count >= 1 Then
 With ActiveDocument.Frames(1)
 .RelativeHorizontalPosition = _
 wdRelativeHorizontalPositionMargin
 .HorizontalPosition = wdFrameRight
 End With
End If

See also

Concepts

Frame Object

Other resources

Frame Object Members


Frame.LockAnchor Property (Word)

 Copy code hover
[image]

Frame.LockAnchor Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified frame is locked. Read/write Boolean.

Syntax

expression .LockAnchor

expression Required. A variable that represents a Frame object.

Remarks

The frame anchor indicates where the frame will appear in Normal view. You cannot reposition a locked frame anchor.

Example

This example locks the anchor of the first frame in section two of the active document.

VBA Copy code Copy code
Set myRange = ActiveDocument.Sections(2).Range
If TypeName(myRange) <> "Nothing" And myRange.Frames.Count > 0 Then
 myRange.Frames(1).LockAnchor = True
End If

See also

Concepts

Frame Object

Other resources

Frame Object Members


Frame.Parent Property (Word)

 Copy code hover
[image]

Frame.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Frame object.

Syntax

expression .Parent

expression Required. A variable that represents a Frame object.

See also

Concepts

Frame Object

Other resources

Frame Object Members


Frame.Range Property (Word)

 Copy code hover
[image]

Frame.Range Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the portion of a document that's contained within the frame.

Syntax

expression .Range

expression Required. A variable that represents a Frame object.

See also

Concepts

Frame Object

Other resources

Frame Object Members


Frame.RelativeHorizontalPosition Property (Word)

 Copy code hover
[image]

Frame.RelativeHorizontalPosition Property (Word)
See also Send feedback

Published: July 16, 2012

Specifies the relative horizontal position of a frame. Read/write WdRelativeHorizontalPosition.

Syntax

expression .RelativeHorizontalPosition

expression An expression that represents a Frame object.

Example

This example adds a frame around the selection and aligns the frame horizontally with the right margin.

VBA Copy code Copy code
Set myFrame = ActiveDocument.Frames.Add(Range:=Selection.Range)
With myFrame
 .RelativeHorizontalPosition = _
 wdRelativeHorizontalPositionMargin
 .HorizontalPosition = wdFrameRight
End With

See also

Concepts

Frame Object

Other resources

Frame Object Members


Frame.RelativeVerticalPosition Property (Word)

 Copy code hover
[image]

Frame.RelativeVerticalPosition Property (Word)
See also Send feedback

Published: July 16, 2012

Specifies the relative vertical position of a frame. Read/write WdRelativeVerticalPosition.

Syntax

expression .RelativeVerticalPosition

expression A variable that represents a Frame object.

Example

This example adds a frame around the selection and aligns the frame vertically with the top of the page.

VBA Copy code Copy code
Set myFrame = ActiveDocument.Frames.Add(Range:=Selection.Range)
With myFrame
 .RelativeVerticalPosition = wdRelativeVerticalPositionPage
 .VerticalPosition = wdFrameTop
End With

See also

Concepts

Frame Object

Other resources

Frame Object Members


Frame.Shading Property (Word)

 Copy code hover
[image]

Frame.Shading Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Shading object that refers to the shading formatting for the specified object.

Syntax

expression .Shading

expression Required. A variable that represents a Frame object.

See also

Concepts

Frame Object

Other resources

Frame Object Members


Frame.TextWrap Property (Word)

 Copy code hover
[image]

Frame.TextWrap Property (Word)
See also Send feedback

Published: July 16, 2012

True if document text wraps around the specified frame. Read/write Boolean.

Syntax

expression .TextWrap

expression An expression that returns a Frame object.

Example

This example causes text to not wrap around the first frame in the active document.

VBA Copy code Copy code
If ActiveDocument.Frames.Count >= 1 Then
 ActiveDocument.Frames(1).TextWrap = False
End If

This example causes text to wrap around all frames in the active document.

VBA Copy code Copy code
For Each aFrame In ActiveDocument.Frames
 aFrame.TextWrap = True
Next aFrame

See also

Concepts

Frame Object

Other resources

Frame Object Members


Frame.VerticalDistanceFromText Property (Word)

 Copy code hover
[image]

Frame.VerticalDistanceFromText Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the vertical distance (in points) between a frame and the surrounding text. Read/write Single.

Syntax

expression .VerticalDistanceFromText

expression An expression that returns a Frame object.

Example

This example sets the vertical distance between the selected frame and the surrounding text to 12 points.

VBA Copy code Copy code
If Selection.Frames.Count = 1 Then
 Selection.Frames(1).VerticalDistanceFromText = 12
End If

This example adds a frame around the selection and sets several properties of the frame.

VBA Copy code Copy code
Set aFrame = ActiveDocument.Frames.Add(Range:=Selection.Range)
With aFrame
 .HorizontalDistanceFromText = InchesToPoints(0.13)
 .VerticalDistanceFromText = InchesToPoints(0.13)
 .HeightRule = wdFrameAuto
 .WidthRule = wdFrameAuto
End With

See also

Concepts

Frame Object

Other resources

Frame Object Members


Frame.VerticalPosition Property (Word)

 Copy code hover
[image]

Frame.VerticalPosition Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the vertical distance between the edge of the frame and the item specified by the RelativeVerticalPosition property. Read/write Single.

Syntax

expression .VerticalPosition

expression Required. A variable that represents a Frame object.

Remarks

Can be a number that indicates a measurement in points, or can be any valid WdFramePosition constant.

Example

This example vertically aligns the first frame in the active document with the top of the page.

VBA Copy code Copy code
Set myFrame = ActiveDocument.Frames(1)
With myFrame
 .RelativeVerticalPosition = wdRelativeVerticalPositionPage
 .VerticalPosition = wdFrameTop
End With

This example adds a frame around the first shape in the active document and positions the frame 1 inch from the top margin.

VBA Copy code Copy code
If ActiveDocument.Shapes.Count >= 1 Then
 ActiveDocument.Shapes(1).Select
 Set aFrame = ActiveDocument.Frames.Add(Range:=Selection.Range)
 With aFrame
 .RelativeVerticalPosition = _
 wdRelativeVerticalPositionMargin
 .VerticalPosition = InchesToPoints(1)
 End With
End If

This example vertically aligns the first table in the active document with the top of the page.

VBA Copy code Copy code
Set myTable = ActiveDocument.Tables(1).Rows
With myTable
 .RelativeVerticalPosition = wdRelativeVerticalPositionPage
 .VerticalPosition = wdTableTop
End With

See also

Concepts

Frame Object

Other resources

Frame Object Members


Frame.Width Property (Word)

 Copy code hover
[image]

Frame.Width Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the width of the frame, in points. Read/write Long.

Syntax

expression .Width

expression A variable that represents a Frame object.

See also

Concepts

Frame Object

Other resources

Frame Object Members


Frame.WidthRule Property (Word)

 Copy code hover
[image]

Frame.WidthRule Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the rule used to determine the width of a frame. Read/write WdFrameSizeRule.

Syntax

expression .WidthRule

expression Required. A variable that represents a Frame object.

Example

This example sets the width of the last frame in the active document to exactly 72 points (1 inch).

VBA Copy code Copy code
If ActiveDocument.Frames.Count >= 1 Then
 With ActiveDocument.Frames(ActiveDocument.Frames.Count)
 .WidthRule = wdFrameExact
 .Width = 72
 End With
End If

See also

Concepts

Frame Object

Other resources

Frame Object Members


Frame Methods (Word)

 Copy code hover
[image]

Frame Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Copy | Copies the specified frame to the Clipboard.
Cut | Removes the specified frame from the document and places it on the Clipboard.
Delete | Deletes the specified frame.
Select | Selects the specified object.


Frame.Copy Method (Word)

 Copy code hover
[image]

Frame.Copy Method (Word)
See also Send feedback

Published: July 16, 2012

Copies the specified frame to the Clipboard.

Syntax

expression .Copy

expression Required. A variable that represents a Frame object.

See also

Concepts

Frame Object

Other resources

Frame Object Members


Frame.Cut Method (Word)

 Copy code hover
[image]

Frame.Cut Method (Word)
See also Send feedback

Published: July 16, 2012

Removes the specified frame from the document and places it on the Clipboard.

Syntax

expression .Cut

expression Required. A variable that represents a Frame object.

See also

Concepts

Frame Object

Other resources

Frame Object Members


Frame.Delete Method (Word)

 Copy code hover
[image]

Frame.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the specified frame.

Syntax

expression .Delete

expression Required. A variable that represents a Frame object.

See also

Concepts

Frame Object

Other resources

Frame Object Members


Frame.Select Method (Word)

 Copy code hover
[image]

Frame.Select Method (Word)
See also Send feedback

Published: July 16, 2012

Selects the specified object.

Syntax

expression .Select

expression Required. A variable that represents a Frame object.

Remarks

After using this method, use the Selection object to work with the selected items. For more information, see Working with the Selection Object.

See also

Concepts

Frame Object

Other resources

Frame Object Members


Frames Object (Word)

 Copy code hover
[image]

Frames Object (Word)
See also Send feedback

Published: July 16, 2012

See also

Concepts

Word Object Model Reference

Other resources

Frames Object Members


Frames Members (Word)

 Copy code hover
[image]

Frames Members (Word)
Send feedback

Published: July 16, 2012

Methods

Name | Description
Add | Returns a Frame object that represents a new frame added to a range, selection, or document.
Delete | Deletes the specified Frames collection.
Item | Returns an individual Frames object in a collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application. Read-only.
Count | Returns a Long that represents the number of frames in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified Frames object.


Frames Properties (Word)

 Copy code hover
[image]

Frames Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application. Read-only.
Count | Returns a Long that represents the number of frames in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified Frames object.


Frames.Application Property (Word)

 Copy code hover
[image]

Frames.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .Application

expression An expression that returns a Frames object.

See also

Concepts

Frames Object

Other resources

Frames Object Members


Frames.Count Property (Word)

 Copy code hover
[image]

Frames.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of frames in the collection. Read-only.

Version information

Version Added: Word 2010

Syntax

expression .Count

expression A variable that represents a Frames object.

Property value

INT32

See also

Concepts

Frames Collection

Other resources

Frames Members


Frames.Creator Property (Word)

 Copy code hover
[image]

Frames.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version Information

Version Added: Word 2010

Syntax

expression .Creator

expression An expression that returns a Frames object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD". This property was primarily designed to be used on the Apple Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For more information about this property, see the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

Frames Object

Other resources

Frames Object Members


Frames.Parent Property (Word)

 Copy code hover
[image]

Frames.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Frames object.

Version Information

Version Added: Word 2010

Syntax

expression .Parent

expression An expression that returns a Frames object.

See also

Concepts

Frames Object

Other resources

Frames Object Members


Frames Methods (Word)

 Copy code hover
[image]

Frames Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Returns a Frame object that represents a new frame added to a range, selection, or document.
Delete | Deletes the specified Frames collection.
Item | Returns an individual Frames object in a collection.


Frames.Add Method (Word)

 Copy code hover
[image]

Frames.Add Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a Frame object that represents a new frame added to a range, selection, or document.

Version Information

Version Added: Word 2010

Syntax

expression .Add(Range)

expression An expression that returns a Frames object.

Parameters

Name | Required/Optional | Data Type | Description
Range | Required | [RANGE] | The range that you want the frame to surround.

Return Value

Frame

Example

This example adds a frame around the selection.

VBA Copy code Copy code
ActiveDocument.Frames.Add Range:=Selection.Range

This example adds a frame around the third paragraph in the selection.

VBA Copy code Copy code
Set myFrame = Selection.Frames _
 .Add(Range:=Selection.Paragraphs(3).Range)

See also

Concepts

Frames Object

Other resources

Frames Object Members


Frames.Delete Method (Word)

 Copy code hover
[image]

Frames.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the specified Frames collection.

Version Information

Version Added: Word 2010

Syntax

expression .Delete

expression An expression that returns a Frames object.

Return Value

Nothing

See also

Concepts

Frames Object

Other resources

Frames Object Members


Frames.Item Method (Word)

 Copy code hover
[image]

Frames.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual Frames object in a collection.

Version Information

Version Added: Word 2010

Syntax

expression .Item(Index)

expression An expression that returns a Frames object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The individual object to be returned.

Return Value

Frame

See also

Concepts

Frames Object

Other resources

Frames Object Members


Frameset Object (Word)

 Copy code hover
[image]

Frameset Object (Word)
See also Send feedback

Published: July 16, 2012

Represents an entire frames page or a single frame on a frames page.

Remarks

Use the Frameset propertyof a Document or Pane object to return a Frameset object.

  • For properties or methods that affect all frames on a frames page, use the Frameset object from the Document object (ActiveWindow.Document.Frameset).

  • For properties or methods that affect individual frames on a frames page, use the Frameset object from the Pane object (ActiveWindow.ActivePane.Frameset).

This example opens a file named "Proposal.doc," creates a frames page based on the file, and adds a frame (on the left side of the page) containing a table of contents for the file.

VBA Copy code Copy code
Documents.Open "C:\My Documents\proposal.doc"
ActiveDocument.ActiveWindow.ActivePane.NewFrameset
ActiveDocument.ActiveWindow.ActivePane.TOCInFrameset

This example adds a new frame to the right of the specified frame.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.ActivePane.Frameset _
 .AddNewFrame wdFramesetNewRight

This example sets the name of the third child Frameset object of the frames page to "BottomFrame."

VBA Copy code Copy code
ActiveWindow.Document.Frameset _
 .ChildFramesetItem(3).FrameName = "BottomFrame"

This example links the specified frame to a local file called "Order.htm." It sets the frame to be resizable, to appear with scrollbars in a Web browser, and to be 25% as high as the active window.

VBA Copy code Copy code
With ActiveDocument.ActiveWindow.ActivePane.Frameset
 .FrameDefaultURL = "C:\My Documents\order.htm"
 .FrameLinkToFile = True
 .FrameResizable = True
 .FrameScrollbarType = wdScrollbarTypeYes
 .HeightType = wdFramesetSizeTypePercent
 .Height = 25
End With

This example sets Microsoft Word to display frame borders in the specified frames page.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.ActivePane.Frameset _
 .FrameDisplayBorders = True

This example sets the frame borders on the frames page to be 6 points wide and tan.

VBA Copy code Copy code
With ActiveWindow.Document.Frameset
 .FramesetBorderColor = wdColorTan
 .FramesetBorderWidth = 6
End With
Note Note

For more information on creating frames pages, see Creating frames pages.

See also

Concepts

Word Object Model Reference

Other resources

Frameset Object Members


Frameset Members (Word)

 Copy code hover
[image]

Frameset Members (Word)
Send feedback

Published: July 16, 2012

Represents an entire frames page or a single frame on a frames page.

Methods

Name | Description
AddNewFrame | Adds a new frame to a frames page.
Delete | Deletes the specified Frameset object.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
ChildFramesetCount | Returns the number of child Frameset objects associated with the specified Frameset object. Read-only Long.
ChildFramesetItem | Returns the Frameset object that represents the child Frameset object specified by the Index argument. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
FrameDefaultURL | Returns or sets the Web page or other document to be displayed in the specified frame when the frames page is opened. Read/write String.
FrameDisplayBorders | True if the frame borders on the specified frames page are displayed. Read/write Boolean.
FrameLinkToFile | True if the Web page or other document specified by the FrameDefaultURL property is an external file to which Microsoft Word maintains only a link from the specified frame. Read/write Boolean.
FrameName | Returns or sets the name of the specified frame on a frames page. Read/write String.
FrameResizable | True if the user can resize the specified frame when the frames page is viewed in a Web browser. Read/write Boolean.
FrameScrollbarType | Returns or sets when scroll bars are available for the specified frame when viewing its frames page in a Web browser. Read/write WdScrollbarType.
FramesetBorderColor | Returns or sets the color of the frame borders on the specified frames page. Read/write.
FramesetBorderWidth | Returns or sets the width (in points) of the borders surrounding the frames on the specified frames page. Read/write Single.
Height | Returns or sets a Float that represents the height of the specified Frameset object. Read/write.
HeightType | Returns or sets the width type for the specified frame on a frames page. Read/write WdFramesetSizeType.
Parent | Returns an Object that represents the parent object of the specified Frameset object.
ParentFrameset | Returns a Frameset object that represents the parent of the specified Frameset object on a frames page.
Type | Returns the Frameset object type. Read-only WdFramesetType.
Width | Returns or sets the width of the specified Frameset object. Read/write Long.
WidthType | Returns or sets the width type for the specified Frameset object. Read/write WdFramesetSizeType.


Frameset Properties (Word)

 Copy code hover
[image]

Frameset Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
ChildFramesetCount | Returns the number of child Frameset objects associated with the specified Frameset object. Read-only Long.
ChildFramesetItem | Returns the Frameset object that represents the child Frameset object specified by the Index argument. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
FrameDefaultURL | Returns or sets the Web page or other document to be displayed in the specified frame when the frames page is opened. Read/write String.
FrameDisplayBorders | True if the frame borders on the specified frames page are displayed. Read/write Boolean.
FrameLinkToFile | True if the Web page or other document specified by the FrameDefaultURL property is an external file to which Microsoft Word maintains only a link from the specified frame. Read/write Boolean.
FrameName | Returns or sets the name of the specified frame on a frames page. Read/write String.
FrameResizable | True if the user can resize the specified frame when the frames page is viewed in a Web browser. Read/write Boolean.
FrameScrollbarType | Returns or sets when scroll bars are available for the specified frame when viewing its frames page in a Web browser. Read/write WdScrollbarType.
FramesetBorderColor | Returns or sets the color of the frame borders on the specified frames page. Read/write.
FramesetBorderWidth | Returns or sets the width (in points) of the borders surrounding the frames on the specified frames page. Read/write Single.
Height | Returns or sets a Float that represents the height of the specified Frameset object. Read/write.
HeightType | Returns or sets the width type for the specified frame on a frames page. Read/write WdFramesetSizeType.
Parent | Returns an Object that represents the parent object of the specified Frameset object.
ParentFrameset | Returns a Frameset object that represents the parent of the specified Frameset object on a frames page.
Type | Returns the Frameset object type. Read-only WdFramesetType.
Width | Returns or sets the width of the specified Frameset object. Read/write Long.
WidthType | Returns or sets the width type for the specified Frameset object. Read/write WdFramesetSizeType.


Frameset.Application Property (Word)

 Copy code hover
[image]

Frameset.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a Frameset object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

Frameset Object

Other resources

Frameset Object Members


Frameset.ChildFramesetCount Property (Word)

 Copy code hover
[image]

Frameset.ChildFramesetCount Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the number of child Frameset objects associated with the specified Frameset object. Read-only Long.

Syntax

expression .ChildFramesetCount

expression A variable that represents a Frameset object.

Remarks

This property applies only to Frameset objects of type wdFramesetTypeFrameset. For more information on creating frames pages, see Creating Frames Pages.

Example

This example displays the number of child Frameset objects contained by the Frameset object that represents the specified frames page.

VBA Copy code Copy code
MsgBox ActiveWindow.Document_
 .Frameset.ChildFramesetCount

See also

Concepts

Frameset Object

Other resources

Frameset Object Members


Frameset.ChildFramesetItem Property (Word)

 Copy code hover
[image]

Frameset.ChildFramesetItem Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the Frameset object that represents the child Frameset object specified by the Index argument. Read-only.

Syntax

expression .ChildFramesetItem(Index)

expression An expression that returns a Frameset object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The index number of the specified frame.

Remarks

This property applies only to Frameset objects of type wdFramesetTypeFrameset.

For more information on creating frames pages, see Creating Frames Pages.

Example

This example sets the name of the third child frame of the specified frame to "BottomFrame".

VBA Copy code Copy code
ActiveWindow.Document.Frameset _
 .ChildFramesetItem(3).FrameName = "BottomFrame"

See also

Concepts

Frameset Object

Other resources

Frameset Object Members


Frameset.Creator Property (Word)

 Copy code hover
[image]

Frameset.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a Frameset object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Frameset Object

Other resources

Frameset Object Members


Frameset.FrameDefaultURL Property (Word)

 Copy code hover
[image]

Frameset.FrameDefaultURL Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the Web page or other document to be displayed in the specified frame when the frames page is opened. Read/write String.

Syntax

expression .FrameDefaultURL

expression A variable that represents a Frameset object.

Remarks

For more information on creating frames pages, see Creating Frames Pages.

Example

This example sets the specified frame to display a local file named "Order.htm".

VBA Copy code Copy code
With ActiveDocument.ActiveWindow.ActivePane.Frameset
 .FrameDefaultURL = "C:\Documents\Order.htm"
 .FrameLinkToFile = True
End With

See also

Concepts

Frameset Object

Other resources

Frameset Object Members


Frameset.FrameDisplayBorders Property (Word)

 Copy code hover
[image]

Frameset.FrameDisplayBorders Property (Word)
See also Send feedback

Published: July 16, 2012

True if the frame borders on the specified frames page are displayed. Read/write Boolean.

Syntax

expression .FrameDisplayBorders

expression A variable that represents a Frameset object.

Remarks

For more information on creating frames pages, see Creating Frames Pages.

Example

This example sets Microsoft Word to display frame borders in the specified frames page.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.ActivePane.Frameset _
 .FrameDisplayBorders = True

See also

Concepts

Frameset Object

Other resources

Frameset Object Members


Frameset.FrameLinkToFile Property (Word)

 Copy code hover
[image]

Frameset.FrameLinkToFile Property (Word)
See also Send feedback

Published: July 16, 2012

True if the Web page or other document specified by the FrameDefaultURL property is an external file to which Microsoft Word maintains only a link from the specified frame. Read/write Boolean.

Syntax

expression .FrameLinkToFile

expression A variable that represents a Frameset object.

Remarks

For more information on creating frames pages, see Creating Frames Pages.

Example

This example sets Microsoft Word to maintain only a link from the specified frame to the document "Order.htm".

VBA Copy code Copy code
With ActiveDocument.ActiveWindow.ActivePane.Frameset
 .FrameDefaultURL = "C:\Documents\Order.htm"
 .FrameLinkToFile = True
End With

See also

Concepts

Frameset Object

Other resources

Frameset Object Members


Frameset.FrameName Property (Word)

 Copy code hover
[image]

Frameset.FrameName Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the name of the specified frame on a frames page. Read/write String.

Syntax

expression .FrameName

expression A variable that represents a Frameset object.

Remarks

For more information on creating frames pages, see Creating Frames Pages.

Example

This example sets the name of the specified frame to "BottomFrame".

VBA Copy code Copy code
ActiveWindow.Document.Frameset _
 .ChildFramesetItem(3).FrameName = "BottomFrame"

See also

Concepts

Frameset Object

Other resources

Frameset Object Members


Frameset.FrameResizable Property (Word)

 Copy code hover
[image]

Frameset.FrameResizable Property (Word)
See also Send feedback

Published: July 16, 2012

True if the user can resize the specified frame when the frames page is viewed in a Web browser. Read/write Boolean.

Syntax

expression .FrameResizable

expression A variable that represents a Frameset object.

Remarks

For more information on creating frames pages, see Creating Frames Pages.

Example

This example sets the specified frame to be resizable when viewed in a Web browser.

VBA Copy code Copy code
With ActiveDocument.ActiveWindow.ActivePane.Frameset
 .FrameDefaultURL = "C:\Documents\Order.htm"
 .FrameResizable = True
End With

See also

Concepts

Frameset Object

Other resources

Frameset Object Members


Frameset.FrameScrollbarType Property (Word)

 Copy code hover
[image]

Frameset.FrameScrollbarType Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets when scroll bars are available for the specified frame when viewing its frames page in a Web browser. Read/write WdScrollbarType.

Syntax

expression .FrameScrollbarType

expression Required. A variable that represents a Frameset object.

Remarks

For more information on creating frames pages, see Creating frames pages.

Example

This example makes scroll bars always available for the specified frame, regardless of whether the contents of the frame require scrolling.

VBA Copy code Copy code
With ActiveDocument.ActiveWindow.ActivePane.Frameset
 .FrameDefaultURL = "C:\Documents\Order.htm"
 .FrameScrollBarType = wdScrollBarTypeYes
End With

See also

Concepts

Frameset Object

Other resources

Frameset Object Members


Frameset.FramesetBorderColor Property (Word)

 Copy code hover
[image]

Frameset.FramesetBorderColor Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the color of the frame borders on the specified frames page. Read/write.

Syntax

expression .FramesetBorderColor

expression Required. A variable that represents a Frameset object.

Remarks

This property can be any of the WdColor constants or a value returned by Visual Basic's RGB function. For more information on creating frames pages, see Creating frames pages.

Example

This example sets the color of frame borders in the specified frames page to tan.

VBA Copy code Copy code
With ActiveWindow.Document.Frameset
 .FramesetBorderColor = wdColorTan
 .FramesetBorderWidth = 6
End With

See also

Concepts

Frameset Object

Other resources

Frameset Object Members


Frameset.FramesetBorderWidth Property (Word)

 Copy code hover
[image]

Frameset.FramesetBorderWidth Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the width (in points) of the borders surrounding the frames on the specified frames page. Read/write Single.

Syntax

expression .FramesetBorderWidth

expression A variable that represents a Frameset object.

Remarks

For more information on creating frames pages, see Creating Frames Pages.

Example

This example sets the width of frame borders in the specified frames page to 6 points.

VBA Copy code Copy code
With ActiveWindow.Document.Frameset
 .FramesetBorderColor = wdColorTan
 .FramesetBorderWidth = 6
End With

See also

Concepts

Frameset Object

Other resources

Frameset Object Members


Frameset.Height Property (Word)

 Copy code hover
[image]

Frameset.Height Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Float that represents the height of the specified Frameset object. Read/write.

Syntax

expression .Height

expression A variable that represents a Frameset object.

Remarks

The HeightType property determines the type of unit in which this value is expressed.

Example

This example sets the height of the specified Frameset object to 25% of the window height.

VBA Copy code Copy code
With ActiveWindow.ActivePane.Frameset
 .HeightType = wdFramesetSizeTypePercent
 .Height = 25
End With

See also

Concepts

Frameset Object

Other resources

Frameset Object Members


Frameset.HeightType Property (Word)

 Copy code hover
[image]

Frameset.HeightType Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the width type for the specified frame on a frames page. Read/write WdFramesetSizeType.

Syntax

expression .HeightType

expression Required. A variable that represents a Frameset object.

Example

This example sets the height of the first Frameset object in the specified frames page to 25 percent of the window height.

VBA Copy code Copy code
With ActiveDocument.ActiveWindow.Panes(1).Frameset
 .HeightType = wdFramesetSizeTypePercent
 .Height = 25
End With

See also

Concepts

Frameset Object

Other resources

Frameset Object Members


Frameset.Parent Property (Word)

 Copy code hover
[image]

Frameset.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Frameset object.

Syntax

expression .Parent

expression Required. A variable that represents a Frameset object.

See also

Concepts

Frameset Object

Other resources

Frameset Object Members


Frameset.ParentFrameset Property (Word)

 Copy code hover
[image]

Frameset.ParentFrameset Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Frameset object that represents the parent of the specified Frameset object on a frames page.

Syntax

expression .ParentFrameset

expression An expression that returns a Frameset object.

Remarks

For more information on creating frames pages, see Creating Frames Pages.

Example

This example returns the number of child Frameset objects belonging to the parent Frameset object of the specified frame.

VBA Copy code Copy code
MsgBox ActiveDocument.ActiveWindow.ActivePane _
 .Frameset.ParentFrameset.ChildFramesetCount

See also

Concepts

Frameset Object

Other resources

Frameset Object Members


Frameset.Type Property (Word)

 Copy code hover
[image]

Frameset.Type Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the Frameset object type. Read-only WdFramesetType.

Syntax

expression .Type

expression Required. A variable that represents a Frameset object.

See also

Concepts

Frameset Object

Other resources

Frameset Object Members


Frameset.Width Property (Word)

 Copy code hover
[image]

Frameset.Width Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the width of the specified Frameset object. Read/write Long.

Syntax

expression .Width

expression A variable that represents a Frameset object.

Remarks

Use the WidthType property to specify the type of unit in which this value is expressed.

Example

This example sets the width of the specified Frameset object to 25% of the window width.

VBA Copy code Copy code
With ActiveWindow.ActivePane.Frameset
 .WidthType = wdFramesetSizeTypePercent
 .Width = 25
End With

See also

Concepts

Frameset Object

Other resources

Frameset Object Members


Frameset.WidthType Property (Word)

 Copy code hover
[image]

Frameset.WidthType Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the width type for the specified Frameset object. Read/write WdFramesetSizeType.

Syntax

expression .WidthType

expression Required. A variable that represents a Frameset object.

Example

This example sets the width of the first Frameset object in the active document to 25% of the window width.

VBA Copy code Copy code
With ActiveDocument.ActiveWindow.Panes(1).Frameset
 .WidthType = wdFramesetSizeTypePercent
 .Width = 25
End With

See also

Concepts

Frameset Object

Other resources

Frameset Object Members


Frameset Methods (Word)

 Copy code hover
[image]

Frameset Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
AddNewFrame | Adds a new frame to a frames page.
Delete | Deletes the specified Frameset object.


Frameset.AddNewFrame Method (Word)

 Copy code hover
[image]

Frameset.AddNewFrame Method (Word)
See also Send feedback

Published: July 16, 2012

Adds a new frame to a frames page.

Syntax

expression .AddNewFrame(Where)

expression Required. A variable that represents a Frameset object.

Parameters

Name | Required/Optional | Data Type | Description
Where | Required | WdFramesetNewFrameLocation | Sets the location where the new frame is to be added in relation to the specified frame.

Remarks

For more information on creating frames pages, see Creating frames pages.

Example

This example adds a new frame to the immediate right of the specified frame.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.ActivePane.Frameset _
 .AddNewFrame wdFramesetNewFrameRight

See also

Concepts

Frameset Object

Other resources

Frameset Object Members


Frameset.Delete Method (Word)

 Copy code hover
[image]

Frameset.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the specified Frameset object.

Syntax

expression .Delete

expression Required. A variable that represents a Frameset object.

See also

Concepts

Frameset Object

Other resources

Frameset Object Members


FreeformBuilder Object (Word)

 Copy code hover
[image]

FreeformBuilder Object (Word)
See also Send feedback

Published: July 16, 2012

Represents the geometry of a freeform while it is being built.

Remarks

Use the BuildFreeform method of the Shapes or CanvasShapes object to return a FreeformBuilder object. Use the AddNodes method to add nodes to the freeform. Use the ConvertToShape method to create the shape defined in the FreeformBuilder object and add it to the Shapes collection. The following example adds a freeform with four segments to the active document.

VBA Copy code Copy code
With ActiveDocument.Shapes _
 .BuildFreeform(msoEditingCorner, 360, 200)
 .AddNodes msoSegmentCurve, msoEditingCorner, _
 380, 230, 400, 250, 450, 300
 .AddNodes msoSegmentCurve, msoEditingAuto, 480, 200
 .AddNodes msoSegmentLine, msoEditingAuto, 480, 400
 .AddNodes msoSegmentLine, msoEditingAuto, 360, 200
 .ConvertToShape
End With

See also

Concepts

Word Object Model Reference

Other resources

FreeformBuilder Object Members


FreeformBuilder Members (Word)

 Copy code hover
[image]

FreeformBuilder Members (Word)
Send feedback

Published: July 16, 2012

Represents the geometry of a freeform while it is being built.

Methods

Name | Description
AddNodes | Inserts a new segment at the end of the freeform that's being created, and adds the nodes that define the segment.
ConvertToShape | Creates a shape that has the geometric characteristics of the specified object. Returns a Shape object that represents the new shape.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified FreeformBuilder object.


FreeformBuilder Properties (Word)

 Copy code hover
[image]

FreeformBuilder Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified FreeformBuilder object.


FreeformBuilder.Application Property (Word)

 Copy code hover
[image]

FreeformBuilder.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a FreeformBuilder object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

FreeformBuilder Object

Other resources

FreeformBuilder Object Members


FreeformBuilder.Creator Property (Word)

 Copy code hover
[image]

FreeformBuilder.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a FreeformBuilder object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

FreeformBuilder Object

Other resources

FreeformBuilder Object Members


FreeformBuilder.Parent Property (Word)

 Copy code hover
[image]

FreeformBuilder.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified FreeformBuilder object.

Syntax

expression .Parent

expression Required. A variable that represents a FreeformBuilder object.

See also

Concepts

FreeformBuilder Object

Other resources

FreeformBuilder Object Members


FreeformBuilder Methods (Word)

 Copy code hover
[image]

FreeformBuilder Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
AddNodes | Inserts a new segment at the end of the freeform that's being created, and adds the nodes that define the segment.
ConvertToShape | Creates a shape that has the geometric characteristics of the specified object. Returns a Shape object that represents the new shape.


FreeformBuilder.AddNodes Method (Word)

 Copy code hover
[image]

FreeformBuilder.AddNodes Method (Word)
See also Send feedback

Published: July 16, 2012

Inserts a new segment at the end of the freeform that's being created, and adds the nodes that define the segment.

Syntax

expression .AddNodes(SegmentType, EditingType, X1, Y1, X2, Y2, X3, Y3)

expression Required. A variable that represents a FreeformBuilder object.

Parameters

Name | Required/Optional | Data Type | Description
SegmentType | Required | MsoSegmentType | The type of segment to be added.
EditingType | Required | MsoEditingType | The editing property of the vertex. If SegmentType is msoSegmentLine, EditingType must be msoEditingAuto.
X1 | Required | Single | If the EditingType of the new segment is msoEditingAuto, this argument specifies the horizontal distance (in points) from the upper-left corner of the document to the endpoint of the new segment. If the EditingType of the new node is msoEditingCorner, this argument specifies the horizontal distance (in points) from the upper-left corner of the document to the first control point for the new segment.
Y1 | Required | Single | If the EditingType of the new segment is msoEditingAuto, this argument specifies the vertical distance (in points) from the upper-left corner of the document to the endpoint of the new segment. If the EditingType of the new node is msoEditingCorner, this argument specifies the vertical distance (in points) from the upper-left corner of the document to the first control point for the new segment.
X2 | Optional | Single | If the EditingType of the new segment is msoEditingCorner, this argument specifies the horizontal distance (in points) from the upper-left corner of the document to the second control point for the new segment. If the EditingType of the new segment is msoEditingAuto, don't specify a value for this argument.
Y2 | Optional | Single | If the EditingType of the new segment is msoEditingCorner, this argument specifies the vertical distance (in points) from the upper-left corner of the document to the second control point for the new segment. If the EditingType of the new segment is msoEditingAuto, do not specify a value for this argument.
X3 | Optional | Single | If the EditingType of the new segment is msoEditingCorner, this argument specifies the horizontal distance (in points) from the upper-left corner of the document to the endpoint of the new segment. If the EditingType of the new segment is msoEditingAuto, don't specify a value for this argument.
Y3 | Optional | Single | If the EditingType of the new segment is msoEditingCorner, this argument specifies the vertical distance (in points) from the upper-left corner of the document to the endpoint of the new segment. If the EditingType of the new segment is msoEditingAuto, don't specify a value for this argument.

Remarks

You can use this method as many times as you want to add nodes to the freeform you are creating. When you finish adding nodes, use the ConvertToShape method to create the freeform you've just defined. To add nodes to a freeform after it has been created, use the Insert method of the ShapeNodes collection.

Example

This example adds a freeform with five vertices to the active document.

VBA Copy code Copy code
Dim docActive As Document

Set docActive = ActiveDocument

With docActive.Shapes.BuildFreeform(msoEditingCorner, 360, 200)
 .AddNodes msoSegmentCurve, msoEditingCorner, _
 380, 230, 400, 250, 450, 300
 .AddNodes msoSegmentCurve, msoEditingAuto, 480, 200
 .AddNodes msoSegmentLine, msoEditingAuto, 480, 400
 .AddNodes msoSegmentLine, msoEditingAuto, 360, 200
 .ConvertToShape
End With

See also

Concepts

FreeformBuilder Object

Other resources

FreeformBuilder Object Members


FreeformBuilder.ConvertToShape Method (Word)

 Copy code hover
[image]

FreeformBuilder.ConvertToShape Method (Word)
See also Send feedback

Published: July 16, 2012

Creates a shape that has the geometric characteristics of the specified object. Returns a Shape object that represents the new shape.

Syntax

expression .ConvertToShape(Anchor)

expression Required. A variable that represents a FreeformBuilder object.

Parameters

Name | Required/Optional | Data Type | Description
Anchor | Optional | Variant | A Range object that represents the text to which the shape is bound. If Anchor is specified, the anchor is positioned at the beginning of the first paragraph in the anchoring range. If this argument is omitted, the anchoring range is selected automatically and the shape is positioned relative to the top and left edges of the page.

Remarks

You must apply the AddNodes method to a FreeformBuilder object at least once before you use the ConvertToShape method.

See also

Concepts

FreeformBuilder Object

Other resources

FreeformBuilder Object Members


FullSeriesCollection Object (Word)

 Copy code hover
[image]

FullSeriesCollection Object (Word)
See also Send feedback

Published: July 16, 2012

Represents the full collection of all chart series, both filtered and unfiltered.

Version information

Version Added: Word 2013

See also

Other resources

FullSeriesCollection Members


FullSeriesCollection Members (Word)

 Copy code hover
[image]

FullSeriesCollection Members (Word)
Send feedback

Published: July 16, 2012

Represents the full collection of all chart series, both filtered and unfiltered.

Methods

Name | Description
Item | Returns an individual full series item from the collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of full series in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified FullSeriesCollection object.


FullSeriesCollection Properties (Word)

 Copy code hover
[image]

FullSeriesCollection Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of full series in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified FullSeriesCollection object.


FullSeriesCollection.Application Property (Word)

 Copy code hover
[image]

FullSeriesCollection.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Version information

Version Added: Word 2013

Syntax

expression .Application

expression A variable that represents a FullSeriesCollection object.

Property value

OBJECT

See also

Other resources

FullSeriesCollection Object Members


FullSeriesCollection.Count Property (Word)

 Copy code hover
[image]

FullSeriesCollection.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of full series in the collection. Read-only.

Version information

Version Added: Word 2013

Syntax

expression .Count

expression A variable that represents a FullSeriesCollection object.

Property value

INT32

See also

Other resources

FullSeriesCollection Object Members


FullSeriesCollection.Creator Property (Word)

 Copy code hover
[image]

FullSeriesCollection.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version information

Version Added: Word 2013

Syntax

expression .Creator

expression A variable that represents a FullSeriesCollection object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

Property value

INT32

See also

Other resources

FullSeriesCollection Object
FullSeriesCollection Object Members


FullSeriesCollection.Parent Property (Word)

 Copy code hover
[image]

FullSeriesCollection.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified FullSeriesCollection object.

Version information

Version Added: Word 2013

Syntax

expression .Parent

expression A variable that represents a FullSeriesCollection object.

Property value

OBJECT

See also

Other resources

FullSeriesCollection Object
FullSeriesCollection Object Members


FullSeriesCollection Methods (Word)

 Copy code hover
[image]

FullSeriesCollection Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Item | Returns an individual full series item from the collection.


FullSeriesCollection.Item Method (Word)

 Copy code hover
[image]

FullSeriesCollection.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual full series item from the collection.

Version information

Version Added: Word 2013

Syntax

expression .Item(Index)

expression A variable that represents a FullSeriesCollection object.

Parameters

Name | Required/Optional | Data type | Description
Index | Required | VARIANT | The name or index number of the item to return.

Return value

SERIES

See also

Other resources

FullSeriesCollection Object
FullSeriesCollection Object Members


Global Object (Word)

 Copy code hover
[image]

Global Object (Word)
See also Send feedback

Published: July 16, 2012

Contains top-level properties and methods that do not need to be preceded by the Application property.

Remarks

The following two statements have the same result. One statement uses the Application property to access the Documents collection, and one does not. Both statements are equal and achieve the same result.

VBA Copy code Copy code
Documents(1).Content.Bold = True
Application.Documents(1).Content.Bold = True

See also

Concepts

Word Object Model Reference

Other resources

Global Object Members


Global Members (Word)

 Copy code hover
[image]

Global Members (Word)
Send feedback

Published: July 16, 2012

Contains top-level properties and methods that do not need to be preceded by the Application property.

Methods

Name | Description
BuildKeyCode | Returns a unique number for the specified key combination.
CentimetersToPoints | Converts a measurement from centimeters to points (1 cm = 28.35 points). Returns the converted measurement as a Single.
ChangeFileOpenDirectory | Sets the folder in which Word searches for documents. .
CheckSpelling | Checks a string for spelling errors. Returns a Boolean to indicate whether the string contains spelling errors. True if the string has no spelling errors.
CleanString | Removes nonprinting characters (character codes 1 - 29) and special Word characters from the specified string or changes them to spaces (character code 32), as described in the "Remarks" section. Returns the result as a String.
DDEExecute | Sends a command or series of commands to an application through the specified dynamic data exchange (DDE) channel.
DDEInitiate | Opens a dynamic data exchange (DDE) channel to another application, and returns the channel number.
DDEPoke | Uses an open dynamic data exchange (DDE) channel to send data to an application.
DDERequest | Uses an open dynamic data exchange (DDE) channel to request information from the receiving application, and returns the information as a string.
DDETerminate | Closes the specified dynamic data exchange (DDE) channel to another application.
DDETerminateAll | Closes all dynamic data exchange (DDE) channels opened by Microsoft Word. .
GetSpellingSuggestions | Returns a SpellingSuggestions collection that represents the words suggested as spelling replacements for a given word.
Help | Displays on-line Help information.
InchesToPoints | Converts a measurement from inches to points (1 inch = 72 points). Returns the converted measurement as a Single.
KeyString | Returns the key combination string for the specified keys (for example, CTRL+SHIFT+A).
LinesToPoints | Converts a measurement from lines to points (1 line = 12 points). Returns the converted measurement as a Single.
MillimetersToPoints | Converts a measurement from millimeters to points (1 mm = 2.85 points). Returns the converted measurement as a Single.
NewWindow | Opens a new window with the same document as the specified window. Returns a Window object.
PicasToPoints | Converts a measurement from picas to points (1 pica = 12 points). Returns the converted measurement as a Single.
PixelsToPoints | Converts a measurement from pixels to points. Returns the converted measurement as a Single.
PointsToCentimeters | Converts a measurement from points to centimeters (1 centimeter = 28.35 points). Returns the converted measurement as a Single.
PointsToInches | Converts a measurement from points to inches (1 inch = 72 points). Returns the converted measurement as a Single.
PointsToLines | Converts a measurement from points to lines (1 line = 12 points). Returns the converted measurement as a Single.
PointsToMillimeters | Converts a measurement from points to millimeters (1 millimeter = 2.835 points). Returns the converted measurement as a Single.
PointsToPicas | Converts a measurement from points to picas (1 pica = 12 points). Returns the converted measurement as a Single.
PointsToPixels | Converts a measurement from points to pixels. Returns the converted measurement as a Single.
Repeat | Repeats the most recent editing action one or more times. Returns True if the commands were repeated successfully.

Properties

Name | Description
ActiveDocument | Returns a Document object that represents the active document (the document with the focus). Read-only.
ActivePrinter | Returns or sets the name of the active printer. Read/write String.
ActiveProtectedViewWindow | Returns a ProtectedViewWindow object that represents the active protected view window (the protected view window with the focus). Read-only.
ActiveWindow | Returns a Window object that represents the active window (the window with the focus). Read-only.
AddIns | Returns an AddIns collection that represents all available add-ins, regardless of whether they're currently loaded. Read-only.
Application | Returns an Application object that represents the Microsoft Word application.
AutoCaptions | Returns an AutoCaptions collection that represents the captions that are automatically added when items such as tables and pictures are inserted into a document. Read-only.
AutoCorrect | Returns an AutoCorrect object that contains the current AutoCorrect options, entries, and exceptions. Read-only.
AutoCorrectEmail | Returns an AutoCorrect object that represents automatic corrections made to e-mail messages.
CaptionLabels | Returns a CaptionLabels collection that represents all the available caption labels. Read-only.
CommandBars | Returns a CommandBars collection that represents the menu bar and all the toolbars in Microsoft Word.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
CustomDictionaries | Returns a Dictionaries object that represents the collection of active custom dictionaries. Read-only.
CustomizationContext | Returns or sets a Template or Document object that represents the template or document in which changes to menu bars, toolbars, and key bindings are stored. Read/write. .
Dialogs | Returns a Dialogs collection that represents all the built-in dialog boxes in Word. Read-only.
Documents | Returns a Documents collection that represents all the open documents. Read-only.
FileConverters | Returns a FileConverters collection that represents all the file converters available to Microsoft Word. Read-only.
FindKey | Returns a KeyBinding object that represents the specified key combination. Read-only.
FontNames | Returns a FontNames object that includes the names of all the available fonts. Read-only.
HangulHanjaDictionaries | Returns a HangulHanjaConversionDictionaries collection that represents all the active custom conversion dictionaries.
IsObjectValid | True if the specified variable that references an object is valid. Read-only Boolean.
IsSandboxed | True if the application window is a protected view window. Read-only.
KeyBindings | Returns a KeyBindings collection that represents customized key assignments, which include a key code, a key category, and a command.
KeysBoundTo | Returns a KeysBoundTo object that represents all the key combinations assigned to the specified item.
LandscapeFontNames | Returns a FontNames object that includes the names of all the available landscape fonts.
Languages | Returns a Languages collection that represents the proofing languages listed in the Language dialog box.
LanguageSettings | Returns a LanguageSettings object, which contains information about the language settings in Microsoft Word.
ListGalleries | Returns a ListGalleries collection that represents the three list template galleries (Bulleted, Numbered, and Outline Numbered).
MacroContainer | Returns a Template or Document object that represents the template or document in which the module that contains the running procedure is stored.
Name | Returns name of the specified object. Read-only String.
NormalTemplate | Returns a Template object that represents the Normal template.
Options | Returns an Options object that represents application settings in Microsoft Word.
Parent | Returns an Object that represents the parent object of the specified Global object.
PortraitFontNames | Returns a FontNames object that includes the names of all the available portrait fonts.
PrintPreview | True if print preview is the current view. Read/write Boolean.
ProtectedViewWindows | Returns a ProtectedViewWindows object that represents the open protected view windows. Read-only.
RecentFiles | Returns a RecentFiles collection that represents the most recently accessed files.
Selection | Returns a Selection object that represents a selected range or the insertion point. Read-only.
ShowVisualBasicEditor | True if the Visual Basic Editor window is visible. Read/write Boolean.
StatusBar | This property is no longer supported in Microsoft Word Visual Basic for Applications.
SynonymInfo | Returns a SynonymInfo object that contains information from the thesaurus on synonyms, antonyms, or related words and expressions for the specified word or phrase.
System | Returns a System object, which can be used to return system-related information and perform system-related tasks.
Tasks | Returns a Tasks collection that represents all the applications that are running.
Templates | Returns a Templates collection that represents all the available templates—global templates and those attached to open documents.
VBE | Returns a VBE object that represents the Visual Basic Editor.
Windows | Returns a Windows collection that represents all open document windows. Read-only.
WordBasic | Returns an Automation object (Word.Basic) that includes methods for all the WordBasic statements and functions available in Word version 6.0 and Word for Windows 95. Read-only.


Global Properties (Word)

 Copy code hover
[image]

Global Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
ActiveDocument | Returns a Document object that represents the active document (the document with the focus). Read-only.
ActivePrinter | Returns or sets the name of the active printer. Read/write String.
ActiveProtectedViewWindow | Returns a ProtectedViewWindow object that represents the active protected view window (the protected view window with the focus). Read-only.
ActiveWindow | Returns a Window object that represents the active window (the window with the focus). Read-only.
AddIns | Returns an AddIns collection that represents all available add-ins, regardless of whether they're currently loaded. Read-only.
Application | Returns an Application object that represents the Microsoft Word application.
AutoCaptions | Returns an AutoCaptions collection that represents the captions that are automatically added when items such as tables and pictures are inserted into a document. Read-only.
AutoCorrect | Returns an AutoCorrect object that contains the current AutoCorrect options, entries, and exceptions. Read-only.
AutoCorrectEmail | Returns an AutoCorrect object that represents automatic corrections made to e-mail messages.
CaptionLabels | Returns a CaptionLabels collection that represents all the available caption labels. Read-only.
CommandBars | Returns a CommandBars collection that represents the menu bar and all the toolbars in Microsoft Word.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
CustomDictionaries | Returns a Dictionaries object that represents the collection of active custom dictionaries. Read-only.
CustomizationContext | Returns or sets a Template or Document object that represents the template or document in which changes to menu bars, toolbars, and key bindings are stored. Read/write. .
Dialogs | Returns a Dialogs collection that represents all the built-in dialog boxes in Word. Read-only.
Documents | Returns a Documents collection that represents all the open documents. Read-only.
FileConverters | Returns a FileConverters collection that represents all the file converters available to Microsoft Word. Read-only.
FindKey | Returns a KeyBinding object that represents the specified key combination. Read-only.
FontNames | Returns a FontNames object that includes the names of all the available fonts. Read-only.
HangulHanjaDictionaries | Returns a HangulHanjaConversionDictionaries collection that represents all the active custom conversion dictionaries.
IsObjectValid | True if the specified variable that references an object is valid. Read-only Boolean.
IsSandboxed | True if the application window is a protected view window. Read-only.
KeyBindings | Returns a KeyBindings collection that represents customized key assignments, which include a key code, a key category, and a command.
KeysBoundTo | Returns a KeysBoundTo object that represents all the key combinations assigned to the specified item.
LandscapeFontNames | Returns a FontNames object that includes the names of all the available landscape fonts.
Languages | Returns a Languages collection that represents the proofing languages listed in the Language dialog box.
LanguageSettings | Returns a LanguageSettings object, which contains information about the language settings in Microsoft Word.
ListGalleries | Returns a ListGalleries collection that represents the three list template galleries (Bulleted, Numbered, and Outline Numbered).
MacroContainer | Returns a Template or Document object that represents the template or document in which the module that contains the running procedure is stored.
Name | Returns name of the specified object. Read-only String.
NormalTemplate | Returns a Template object that represents the Normal template.
Options | Returns an Options object that represents application settings in Microsoft Word.
Parent | Returns an Object that represents the parent object of the specified Global object.
PortraitFontNames | Returns a FontNames object that includes the names of all the available portrait fonts.
PrintPreview | True if print preview is the current view. Read/write Boolean.
ProtectedViewWindows | Returns a ProtectedViewWindows object that represents the open protected view windows. Read-only.
RecentFiles | Returns a RecentFiles collection that represents the most recently accessed files.
Selection | Returns a Selection object that represents a selected range or the insertion point. Read-only.
ShowVisualBasicEditor | True if the Visual Basic Editor window is visible. Read/write Boolean.
StatusBar | This property is no longer supported in Microsoft Word Visual Basic for Applications.
SynonymInfo | Returns a SynonymInfo object that contains information from the thesaurus on synonyms, antonyms, or related words and expressions for the specified word or phrase.
System | Returns a System object, which can be used to return system-related information and perform system-related tasks.
Tasks | Returns a Tasks collection that represents all the applications that are running.
Templates | Returns a Templates collection that represents all the available templates—global templates and those attached to open documents.
VBE | Returns a VBE object that represents the Visual Basic Editor.
Windows | Returns a Windows collection that represents all open document windows. Read-only.
WordBasic | Returns an Automation object (Word.Basic) that includes methods for all the WordBasic statements and functions available in Word version 6.0 and Word for Windows 95. Read-only.


Global.ActiveDocument Property (Word)

 Copy code hover
[image]

Global.ActiveDocument Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Document object that represents the active document (the document with the focus). Read-only.

Syntax

expression .ActiveDocument

expression A variable that represents a Global object.

Remarks

If there are no documents open, using this property causes an error.

Example

This example displays the name of the active document, or if there are no documents open, it displays a message.

VBA Copy code Copy code
If Application.Documents.Count >= 1 Then
 MsgBox ActiveDocument.Name
Else
 MsgBox "No documents are open"
End If

This example collapses the selection to an insertion point and then creates a range for the next five characters in the selection.

VBA Copy code Copy code
Dim rngTemp As Range

Selection.Collapse Direction:=wdCollapseStart
Set rngTemp = ActiveDocument.Range(Start:=Selection.Start, _
 End:=Selection.Start + 5)

This example inserts texts at the beginning of the active document and then prints the document.

VBA Copy code Copy code
Dim rngTemp As Range

Set rngTemp = ActiveDocument.Range(Start:=0, End:=0)
With rngTemp
 .InsertBefore "Company Report"
 .Font.Name = "Arial"
 .Font.Size = 24
 .InsertParagraphAfter
End With

ActiveDocument.PrintOut

See also

Concepts

Global Object

Other resources

Global Object Members


Global.ActivePrinter Property (Word)

 Copy code hover
[image]

Global.ActivePrinter Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the name of the active printer. Read/write String.

Syntax

expression .ActivePrinter

expression A variable that represents a Global object.

Remarks

Setting the printer using the ActivePrinter property changes the default printer. For more information, see Setting ActivePrinter Changes System Default Printer.

Example

This example displays the name of the active printer.

VBA Copy code Copy code
MsgBox "The name of the active printer is " & ActivePrinter

This example makes a network HP LaserJet IIISi printer the active printer.

VBA Copy code Copy code
Application.ActivePrinter = "HP LaserJet IIISi on \\printers\laser"

This example makes a local HP LaserJet 4 printer on LPT1 the active printer.

VBA Copy code Copy code
Application.ActivePrinter = "HP LaserJet 4 local on LPT1:"

See also

Concepts

Global Object

Other resources

Global Object Members


Global.ActiveProtectedViewWindow Property (Word)

 Copy code hover
[image]

Global.ActiveProtectedViewWindow Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a ProtectedViewWindow object that represents the active protected view window (the protected view window with the focus). Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .ActiveProtectedViewWindow

expression An expression that returns a Global object.

Remarks

If there are no windows open, using this property causes an error.

Example

The following code example displays the caption text for the active protected view window.

VBA Copy code Copy code
Sub WindowCaption()
 MsgBox ActiveProtectedViewWindow.Caption
End Sub

See also

Concepts

Global Object

Other resources

Global Object Members


Global.ActiveWindow Property (Word)

 Copy code hover
[image]

Global.ActiveWindow Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Window object that represents the active window (the window with the focus). Read-only.

Syntax

expression .ActiveWindow

expression A variable that represents a Global object.

Remarks

If there are no windows open, using this property causes an error.

Example

This example displays the caption text for the active window.

VBA Copy code Copy code
Sub WindowCaption()
 MsgBox ActiveDocument.ActiveWindow.Caption
End Sub

This example opens a new window for the active window of the active document and then tiles all the windows.

VBA Copy code Copy code
Sub WindowTiled()
 Dim wndTileWindow As Window

 Set wndTileWindow = ActiveDocument.ActiveWindow.NewWindow
 Windows.Arrange ArrangeStyle:=wdTiled
End Sub

This example splits the first document window.

VBA Copy code Copy code
Sub WindowSplit()
 Documents(1).ActiveWindow.Split = True
End Sub

See also

Concepts

Global Object

Other resources

Global Object Members


Global.AddIns Property (Word)

 Copy code hover
[image]

Global.AddIns Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an AddIns collection that represents all available add-ins, regardless of whether they're currently loaded. Read-only.

Syntax

expression .AddIns

expression A variable that represents a Global object.

Remarks

The AddIns collection includes the global templates and Word add-in libraries (WLLs) listed in the Templates and Add-ins dialog box (Tools menu).

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example returns the total number of add-ins.

VBA Copy code Copy code
Dim intAddIns as Integer

intAddIns = AddIns.Count

This example displays the name of each add-in in the Addins collection.

VBA Copy code Copy code
Dim addinLoop as AddIn

For Each addinLoop In AddIns
 MsgBox addinLoop.Name
Next addinLoop

See also

Concepts

Global Object

Other resources

Global Object Members


Global.Application Property (Word)

 Copy code hover
[image]

Global.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a Global object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

Global Object

Other resources

Global Object Members


Global.AutoCaptions Property (Word)

 Copy code hover
[image]

Global.AutoCaptions Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an AutoCaptions collection that represents the captions that are automatically added when items such as tables and pictures are inserted into a document. Read-only.

Syntax

expression .AutoCaptions

expression A variable that represents a Global object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example displays the name of each item that automatically gets a caption when inserted into the document.

VBA Copy code Copy code
Dim captionLoop as AutoCaption

For Each captionLoop In AutoCaptions
 If captionLoop.AutoInsert Then MsgBox captionLoop.Name
Next captionLoop

See also

Concepts

Global Object

Other resources

Global Object Members


Global.AutoCorrect Property (Word)

 Copy code hover
[image]

Global.AutoCorrect Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an AutoCorrect object that contains the current AutoCorrect options, entries, and exceptions. Read-only.

Syntax

expression .AutoCorrect

expression A variable that represents a Global object.

Example

This example adds an AutoCorrect replacement entry. After this code runs, every instance of "sr" that's typed in a document will automatically be replaced with "Stella Richards."

VBA Copy code Copy code
AutoCorrect.Entries.Add Name:= "sr", Value:= "Stella Richards"

This example deletes the specified AutoCorrect entry it if it exists.

VBA Copy code Copy code
Dim strInput as String
Dim aceLoop as AutoCorrectEntry
Dim blnMatch as Boolean
Dim intConfirm as Integer

blnMatch = False

strInput = InputBox("Enter the AutoCorrect entry to delete.")

For Each aceLoop in AutoCorrect.Entries
 With aceLoop
 If .Name = strInput Then
 blnMatch = True
 intConfirm = _
 MsgBox("Are you sure you want to delete " & _
 .Name, 4)
 If intConfirm = vbYes Then
 .Delete
 End If
 End If
 End With
Next aceLoop

If blnMatch <> True Then
 MsgBox "There was no AutoCorrect entry: " & strInput
End If

See also

Concepts

Global Object

Other resources

Global Object Members


Global.AutoCorrectEmail Property (Word)

 Copy code hover
[image]

Global.AutoCorrectEmail Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an AutoCorrect object that represents automatic corrections made to e-mail messages.

Syntax

expression .AutoCorrectEmail

expression Required. A variable that represents a Global object.

Example

This example adds AutoCorrect entries for e-mail messages. After this code runs, every instance of "allways," "hte," and "hwen" that's typed in an e-mail message will be replaced with "always," "the," and "when," respectively.

VBA Copy code Copy code
Sub AutoCorrectEMailAddress()
 With Application.AutoCorrectEmail
 .Entries.Add Name:="allways", Value:="always"
 .Entries.Add Name:="hte", Value:="the"
 .Entries.Add Name:="hwen", Value:="when"
 End With
End Sub

See also

Concepts

Global Object

Other resources

Global Object Members


Global.CaptionLabels Property (Word)

 Copy code hover
[image]

Global.CaptionLabels Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a CaptionLabels collection that represents all the available caption labels. Read-only.

Syntax

expression .CaptionLabels

expression A variable that represents a Global object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example sets the numbering style for table captions.

VBA Copy code Copy code
CaptionLabels(wdCaptionTable).NumberStyle = _
 wdCaptionNumberStyleLowercaseRoman

This example adds a new caption label named "Photo" and then inserts a photo caption.

VBA Copy code Copy code
CaptionLabels.Add Name:="Photo"
With Selection
 .InsertParagraphAfter
 .InsertCaption Label:="Photo"
End With

See also

Concepts

Global Object

Other resources

Global Object Members


Global.CommandBars Property (Word)

 Copy code hover
[image]

Global.CommandBars Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a CommandBars collection that represents the menu bar and all the toolbars in Microsoft Word.

Syntax

expression .CommandBars

expression Required. A variable that represents a Global object.

Remarks

Use the CustomizationContext property to set the template or document context prior to accessing the CommandBars collection.

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example enlarges all command bar buttons and enables ToolTips.

VBA Copy code Copy code
With CommandBars
 .LargeButtons = True
 .DisplayTooltips = True
End With

This example displays the Drawing toolbar at the bottom of the application window.

VBA Copy code Copy code
With CommandBars("Drawing")
 .Visible = True
 .Position = msoBarBottom
End With

This example adds the Versions command button to the Standard toolbar.

VBA Copy code Copy code
CustomizationContext = NormalTemplate
CommandBars("Standard").Controls.Add Type:=msoControlButton, _
 ID:=2522, Before:=4

See also

Concepts

Global Object

Other resources

Global Object Members


Global.Creator Property (Word)

 Copy code hover
[image]

Global.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a Global object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Global Object

Other resources

Global Object Members


Global.CustomDictionaries Property (Word)

 Copy code hover
[image]

Global.CustomDictionaries Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Dictionaries object that represents the collection of active custom dictionaries. Read-only.

Syntax

expression .CustomDictionaries

expression A variable that represents a Global object.

Remarks

Active custom dictionaries are marked with a check in the Custom Dictionaries dialog box.

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example adds a new, blank custom dictionary to the collection. The path and file name of the new custom dictionary are then displayed in a message box.

VBA Copy code Copy code
Dim dicHome As Dictionary
Set dicHome = CustomDictionaries.Add(Filename:="Home.dic")
Msgbox dicHome.Path & Application.PathSeparator & dicHome.Name

This example removes all custom dictionaries so that no custom dictionaries are active. The custom dictionary files aren't deleted, though.

VBA Copy code Copy code
CustomDictionaries.ClearAll

This example displays the name of each custom dictionary in the collection.

VBA Copy code Copy code
Dim dicLoop As Dictionary

For Each dicLoop In CustomDictionaries
 MsgBox dicLoop.Name
Next dicLoop

See also

Concepts

Global Object

Other resources

Global Object Members


Global.CustomizationContext Property (Word)

 Copy code hover
[image]

Global.CustomizationContext Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Template or Document object that represents the template or document in which changes to menu bars, toolbars, and key bindings are stored. Read/write. .

Syntax

expression .CustomizationContext

expression A variable that represents a Global object.

Remarks

Corresponds to the value of the Save in box on the Commands tab in the Customize dialog box (Tools menu).

Example

This example adds the ALT+CTRL+W key combination to the FileClose command. The keyboard customization is saved in the Normal template.

VBA Copy code Copy code
CustomizationContext = NormalTemplate
KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyControl, _
 wdKeyAlt, wdKeyW), _
 KeyCategory:=wdKeyCategoryCommand, Command:="FileClose"

This example adds the File Versions button to the Standard toolbar. The command bar customization is saved in the template attached to the active document.

VBA Copy code Copy code
CustomizationContext = ActiveDocument.AttachedTemplate
Application.CommandBars("Standard").Controls.Add _
 Type:=msoControlButton, _
 ID:=2522, Before:=8

See also

Concepts

Global Object

Other resources

Global Object Members


Global.Dialogs Property (Word)

 Copy code hover
[image]

Global.Dialogs Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Dialogs collection that represents all the built-in dialog boxes in Word. Read-only.

Syntax

expression .Dialogs

expression A variable that represents a Global object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example displays the built-in Find dialog box, with "Hello" in the Find What box.

VBA Copy code Copy code
Dim dlgFind As Dialog

Set dlgFind = Dialogs(wdDialogEditFind)

With dlgFind
 .Find = "Hello"
 .Show
End With

This example displays the built-in Open dialog box showing all file types.

VBA Copy code Copy code
With Dialogs(wdDialogFileOpen)
 .Name = "*.*"
 .Show
End With

This example prints the active document, using the settings from the Print dialog box.

VBA Copy code Copy code
Dialogs(wdDialogFilePrint).Execute

See also

Concepts

Global Object

Other resources

Global Object Members


Global.Documents Property (Word)

 Copy code hover
[image]

Global.Documents Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Documents collection that represents all the open documents. Read-only.

Syntax

expression .Documents

expression A variable that represents a Global object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example creates a new document based on the Normal template and then displays the Save As dialog box.

VBA Copy code Copy code
Documents.Add.Save

This example saves open documents that have changed since they were last saved.

VBA Copy code Copy code
Dim docLoop As Document

For Each docLoop In Documents
 If docLoop.Saved = False Then docLoop.Save
Next docLoop

This example prints each open document after setting the left and right margins to 0.5 inch.

VBA Copy code Copy code
Dim docLoop As Document

For Each docLoop In Documents
 With docLoop
 .PageSetup.LeftMargin = InchesToPoints(0.5)
 .PageSetup.RightMargin = InchesToPoints(0.5)
 .PrintOut
 End With
Next docLoop

This example opens Doc.doc as a read-only document.

VBA Copy code Copy code
Documents.Open FileName:="C:\Files\Doc.doc", ReadOnly:=True

See also

Concepts

Global Object

Other resources

Global Object Members


Global.FileConverters Property (Word)

 Copy code hover
[image]

Global.FileConverters Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a FileConverters collection that represents all the file converters available to Microsoft Word. Read-only.

Syntax

expression .FileConverters

expression A variable that represents a Global object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example displays the path of the WordPerfect 5.0 file converter.

VBA Copy code Copy code
MsgBox FileConverters("WrdPrfctDOS50").Path

This example displays a message that indicates whether the third converter in the FileConverters collection can save files.

VBA Copy code Copy code
If FileConverters(3).CanSave = True Then
 MsgBox FileConverters(3).FormatName & " can save files"
Else
 MsgBox FileConverters(3).FormatName & " cannot save files"
End If

This example displays the name of the last file converter.

VBA Copy code Copy code
Dim fcTemp As FileConverter

Set fcTemp = FileConverters(FileConverters.Count)
MsgBox "The file name extensions for " & fcTemp.FormatName & _
 " files are: " & fcTemp.Extensions

See also

Concepts

Global Object

Other resources

Global Object Members


Global.FindKey Property (Word)

 Copy code hover
[image]

Global.FindKey Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a KeyBinding object that represents the specified key combination. Read-only.

Syntax

expression .FindKey(KeyCode, KeyCode2)

expression A variable that represents a Global object. Optional.

Parameters

Name | Required/Optional | Data Type | Description
KeyCode | Required | Long | A key you specify by using one of the WdKey constants.
KeyCode2 | Optional | Variant | A second key you specify by using one of the WdKey constants.

Remarks

You can use the BuildKeyCode method to create the KeyCode or KeyCode2 argument.

Example

This example disables the ALT+SHIFT+F12 key combination in the template attached to the active document. To return a KeyBinding object that includes more than two keys, use the BuildKeyCode method, as shown in the example.

VBA Copy code Copy code
CustomizationContext = ActiveDocument.AttachedTemplate
FindKey(KeyCode:=BuildKeyCode(wdKeyAlt, wdKeyShift, _
 wdKeyF12)).Disable

This example displays the command assigned to the F1 key.

VBA Copy code Copy code
CustomizationContext = NormalTemplate
MsgBox FindKey(KeyCode:=wdKeyF1).Command

See also

Concepts

Global Object

Other resources

Global Object Members


Global.FontNames Property (Word)

 Copy code hover
[image]

Global.FontNames Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a FontNames object that includes the names of all the available fonts. Read-only.

Syntax

expression .FontNames

expression A variable that represents a Global object.

Example

This example displays the font names in the FontNames collection.

VBA Copy code Copy code
Dim strFont As String
Dim intResponse As Integer

For Each strFont In FontNames
 intResponse = MsgBox(Prompt:=strFont, Buttons:=vbOKCancel)
 If intResponse = vbCancel Then Exit For
Next strFont

See also

Concepts

Global Object

Other resources

Global Object Members


Global.HangulHanjaDictionaries Property (Word)

 Copy code hover
[image]

Global.HangulHanjaDictionaries Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a HangulHanjaConversionDictionaries collection that represents all the active custom conversion dictionaries.

Syntax

expression .HangulHanjaDictionaries

expression Required. A variable that represents a Global object.

Remarks

Active custom conversion dictionaries are marked with a check in the Custom Dictionaries dialog box (on the Tools menu, click Options, then click the Spelling & Grammar tab, and then click the Custom Dictionaries button).

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example adds a new, blank custom dictionary to the collection. The path and file name of the new custom dictionary are then displayed in a message box.

VBA Copy code Copy code
Set myHome = _
 HangulHanjaDictionaries.Add(Filename:="Home.hhd")
Msgbox myHome.Path & Application.PathSeparator _
 & myHome.Name

This example deactivates all custom dictionaries but does not delete the custom dictionary files.

VBA Copy code Copy code
HangulHanjaDictionaries.ClearAll

This example displays the name of each custom dictionary in the collection.

VBA Copy code Copy code
For Each di In HangulHanjaDictionaries
 MsgBox di.Name
Next di

See also

Concepts

Global Object

Other resources

Global Object Members


Global.IsObjectValid Property (Word)

 Copy code hover
[image]

Global.IsObjectValid Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified variable that references an object is valid. Read-only Boolean.

Syntax

expression .IsObjectValid(Object)

expression A variable that represents a Global object. Optional.

Parameters

Name | Required/Optional | Data Type | Description
Object | Required | Object | A variable that references an object.

Remarks

This property returns False if the object referenced by the variable has been deleted.

Example

This example adds a table to the active document and assigns it to the variable aTable. The example then deletes the first table from the document. If the table that aTable refers to was not the first table in the document (that is, if aTable is still a valid object), the example also removes any borders from that table.

VBA Copy code Copy code
Dim aTable As Table

Set aTable = ActiveDocument.Tables.Add(Range:=Selection.Range, _
 NumRows:=2, NumColumns:=3)

ActiveDocument.Tables(1).Delete
If IsObjectValid(aTable) = True Then _
 aTable.Borders.Enable = False

See also

Concepts

Global Object

Other resources

Global Object Members


Global.IsSandboxed Property (Word)

 Copy code hover
[image]

Global.IsSandboxed Property (Word)
See also Send feedback

Published: July 16, 2012

True if the application window is a protected view window. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .IsSandboxed

expression An expression that returns a Global object.

Example

The following code example displays whether or not the document referenced by doc is in a protected view window.

VBA Copy code Copy code
If doc.Application.IsSandboxed Then
 MsgBox "The document " & _
 """" & doc.Name & """" & _
 " is in a protected view window."
Else
 MsgBox "The document " & _
 """" & doc.Name & """" & _
 " is not in a protected view window."
End If

See also

Concepts

Global Object

Other resources

Global Object Members


Global.KeyBindings Property (Word)

 Copy code hover
[image]

Global.KeyBindings Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a KeyBindings collection that represents customized key assignments, which include a key code, a key category, and a command.

Syntax

expression .KeyBindings

expression Required. A variable that represents a Global object.

Example

This example assigns the CTRL+ALT+W key combination to the FileClose command. This keyboard customization is saved in the Normal template.

VBA Copy code Copy code
CustomizationContext = NormalTemplate
KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyControl, wdKeyAlt, _
 wdKeyW), KeyCategory:=wdKeyCategoryCommand, _
 Command:="FileClose"

This example inserts the command name and key combination string for each item in the KeyBindings collection.

VBA Copy code Copy code
Dim kbLoop As KeyBinding

CustomizationContext = NormalTemplate
For Each kbLoop In KeyBindings
 Selection.InsertAfter kbLoop.Command & vbTab _
 & kbLoop.KeyString & vbCr
 Selection.Collapse Direction:=wdCollapseEnd
Next kbLoop

See also

Concepts

Global Object

Other resources

Global Object Members


Global.KeysBoundTo Property (Word)

 Copy code hover
[image]

Global.KeysBoundTo Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a KeysBoundTo object that represents all the key combinations assigned to the specified item.

Syntax

expression .KeysBoundTo(KeyCategory, Command, CommandParameter)

expression A variable that represents a Global object. Optional.

Parameters

Name | Required/Optional | Data Type | Description
KeyCategory | Required | WdKeyCategory | The category of the key combination.
Command | Required | String | The name of the command.
CommandParameter | Optional | Variant | Additional text, if any, required for the command specified by Command. For more information, see the "Remarks" section in the Add method for the KeyBindings object.

Example

This example displays all the key combinations assigned to the FileOpen command in the template attached to the active document.

VBA Copy code Copy code
Dim kbLoop As KeyBinding
Dim strOutput As String

CustomizationContext = ActiveDocument.AttachedTemplate

For Each kbLoop In _
 KeysBoundTo(KeyCategory:=wdKeyCategoryCommand, _
 Command:="FileOpen")
 strOutput = strOutput & kbLoop.KeyString & vbCr
Next kbLoop

MsgBox strOutput

This example removes all key assignments from Macro1 in the Normal template.

VBA Copy code Copy code
Dim aKey As KeyBinding

CustomizationContext = NormalTemplate
For Each aKey In _
 KeysBoundTo(KeyCategory:=wdKeyCategoryMacro, _
 Command:="Macro1")
 aKey.Disable
Next aKey

See also

Concepts

Global Object

Other resources

Global Object Members


Global.LandscapeFontNames Property (Word)

 Copy code hover
[image]

Global.LandscapeFontNames Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a FontNames object that includes the names of all the available landscape fonts.

Syntax

expression .LandscapeFontNames

expression Required. A variable that represents a Global object.

Example

This example creates a sorted list in a new document of the landscape font names in the FontNames object.

VBA Copy code Copy code
Sub ListLandscapeFonts()
 Dim docNew As Document
 Dim intCount As Integer

 Set docNew = Documents.Add
 docNew.Content.InsertAfter "Landscape Fonts" & vbLf

 For intCount = 1 To LandscapeFontNames.Count
 docNew.Content.InsertAfter LandscapeFontNames(intCount) _
 & vbLf
 Next

 With docNew
 .Range(Start:=.Paragraphs(2).Range.Start, End:=.Paragraphs _
 (docNew.Paragraphs.Count).Range.End).Select
 End With

 Selection.Sort
End Sub

See also

Concepts

Global Object

Other resources

Global Object Members


Global.Languages Property (Word)

 Copy code hover
[image]

Global.Languages Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Languages collection that represents the proofing languages listed in the Language dialog box.

Syntax

expression .Languages

expression Required. A variable that represents a Global object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example returns the full path and file name of the active spelling dictionary.

VBA Copy code Copy code
Dim dicSpell As Dictionary

Set dicSpell = _
 Languages(Selection.LanguageID).ActiveSpellingDictionary

MsgBox dicSpell.Path & Application.PathSeparator & dicSpell.Name

This example uses the aLang() array to store the proofing language names.

VBA Copy code Copy code
Dim intCount As Integer
Dim langLoop As Language
Dim aLang(Languages.Count - 1) As String

intCount = 0
For Each langLoop In Languages
 aLang(intCount) = langLoop.NameLocal
 intCount = intCount + 1
Next langLoop

See also

Concepts

Global Object

Other resources

Global Object Members


Global.LanguageSettings Property (Word)

 Copy code hover
[image]

Global.LanguageSettings Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a LanguageSettings object, which contains information about the language settings in Microsoft Word.

Syntax

expression .LanguageSettings

expression Required. A variable that represents a Global object.

See also

Concepts

Global Object

Other resources

Global Object Members


Global.ListGalleries Property (Word)

 Copy code hover
[image]

Global.ListGalleries Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a ListGalleries collection that represents the three list template galleries (Bulleted, Numbered, and Outline Numbered).

Syntax

expression .ListGalleries

expression Required. A variable that represents a Global object.

Remarks

Each gallery corresponds to a tab in the Bullets and Numbering dialog box. For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example sets the variable mylsttmp to the second list template on the Outline Numbered tab in the Bullets and Numbering dialog box. The example then applies that template to the first list in the active document.

VBA Copy code Copy code
Set mylsttmp = _
 ListGalleries(wdOutlineNumberGallery).ListTemplates(2)
ActiveDocument.Lists(1).ApplyListTemplate ListTemplate:=mylsttmp

This example cycles through the ListGalleries collection and changes the templates in each list template gallery back to the built-in template.

VBA Copy code Copy code
For Each listgal In ListGalleries
 For i = 1 To 7
 listgal.Reset(i)
 Next i
Next listgal

See also

Concepts

Global Object

Other resources

Global Object Members


Global.MacroContainer Property (Word)

 Copy code hover
[image]

Global.MacroContainer Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Template or Document object that represents the template or document in which the module that contains the running procedure is stored.

Syntax

expression .MacroContainer

expression Required. A variable that represents a Global object.

Example

This example displays the name of the document or template in which the running procedure is stored.

VBA Copy code Copy code
Set cntnr = MacroContainer
MsgBox cntnr.Name

See also

Concepts

Global Object

Other resources

Global Object Members


Global.Name Property (Word)

 Copy code hover
[image]

Global.Name Property (Word)
See also Send feedback

Published: July 16, 2012

Returns name of the specified object. Read-only String.

Syntax

expression .Name

expression Required. A variable that represents a Global object.

See also

Concepts

Global Object

Other resources

Global Object Members


Global.NormalTemplate Property (Word)

 Copy code hover
[image]

Global.NormalTemplate Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Template object that represents the Normal template.

Syntax

expression .NormalTemplate

expression Required. A variable that represents a Global object.

Example

This example inserts the AutoText entry named "Test" from the Normal template, if this entry is contained in the AutoTextEntries collection.

VBA Copy code Copy code
For Each entry In NormalTemplate.AutoTextEntries
 If entry.Name = "Test" Then entry.Insert Where:=Selection.Range
Next entry

This example saves the Normal template if changes have been made to it.

VBA Copy code Copy code
If NormalTemplate.Saved = False Then NormalTemplate.Save

See also

Concepts

Global Object

Other resources

Global Object Members


Global.Options Property (Word)

 Copy code hover
[image]

Global.Options Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Options object that represents application settings in Microsoft Word.

Syntax

expression .Options

expression Required. A variable that represents a Global object.

Example

This example disables fast saves and then saves the active document.

VBA Copy code Copy code
Options.AllowFastSave = False
ActiveDocument.Save

This example prints Sales.doc with comments and field results.

VBA Copy code Copy code
With Options
 .PrintFieldCodes = False
 .PrintComments = True
End With
Documents("Sales.doc").PrintOut

See also

Concepts

Global Object

Other resources

Global Object Members


Global.Parent Property (Word)

 Copy code hover
[image]

Global.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Global object.

Syntax

expression .Parent

expression Required. A variable that represents a Global object.

See also

Concepts

Global Object

Other resources

Global Object Members


Global.PortraitFontNames Property (Word)

 Copy code hover
[image]

Global.PortraitFontNames Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a FontNames object that includes the names of all the available portrait fonts.

Syntax

expression .PortraitFontNames

expression Required. A variable that represents a Global object.

Example

This example inserts a list of portrait fonts at the insertion point.

VBA Copy code Copy code
For Each aFont In PortraitFontNames
 With Selection
 .Collapse Direction:=wdCollapseEnd
 .InsertAfter aFont
 .InsertParagraphAfter
 .Collapse Direction:=wdCollapseEnd
 End With
Next aFont

See also

Concepts

Global Object

Other resources

Global Object Members


Global.PrintPreview Property (Word)

 Copy code hover
[image]

Global.PrintPreview Property (Word)
See also Send feedback

Published: July 16, 2012

True if print preview is the current view. Read/write Boolean.

Syntax

expression .PrintPreview

expression Required. A variable that represents a Global object.

Example

This example switches the view to print preview.

VBA Copy code Copy code
PrintPreview = True

This example switches the active window from print preview to normal view.

VBA Copy code Copy code
PrintPreview = False
ActiveDocument.ActiveWindow.View.Type = wdNormalView

See also

Concepts

Global Object

Other resources

Global Object Members


Global.ProtectedViewWindows Property (Word)

 Copy code hover
[image]

Global.ProtectedViewWindows Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a ProtectedViewWindows object that represents the open protected view windows. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .ProtectedViewWindows

expression An expression that returns a Global object.

See also

Concepts

Global Object

Other resources

Global Object Members


Global.RecentFiles Property (Word)

 Copy code hover
[image]

Global.RecentFiles Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a RecentFiles collection that represents the most recently accessed files.

Syntax

expression .RecentFiles

expression Required. A variable that represents a Global object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example opens the first item in the RecentFiles collection (the first document name listed on the File menu).

VBA Copy code Copy code
If RecentFiles.Count >= 1 Then RecentFiles(1).Open

This example displays the name of each file in the RecentFiles collection.

VBA Copy code Copy code
For Each rFile In RecentFiles
 MsgBox rFile.Name
Next rFile

See also

Concepts

Global Object

Other resources

Global Object Members


Global.Selection Property (Word)

 Copy code hover
[image]

Global.Selection Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Selection object that represents a selected range or the insertion point. Read-only.

Syntax

expression .Selection

expression A variable that represents a Global object.

Example

This example displays the selected text.

VBA Copy code Copy code
If Selection.Type = wdSelectionNormal Then MsgBox Selection.Text

This example applies the Arial font and bold formatting to the selection.

VBA Copy code Copy code
With Selection.Font
 .Bold = True
 .Italic = False
 .Name = "Arial"
End With

If the insertion point isn't located in a table, the selection is moved to the next table.

VBA Copy code Copy code
If Selection.Information(wdWithInTable) = False Then
 Selection.GoToNext What:=wdGoToTable
End If

See also

Concepts

Global Object

Other resources

Global Object Members


Global.ShowVisualBasicEditor Property (Word)

 Copy code hover
[image]

Global.ShowVisualBasicEditor Property (Word)
See also Send feedback

Published: July 16, 2012

True if the Visual Basic Editor window is visible. Read/write Boolean.

Syntax

expression .ShowVisualBasicEditor

expression Required. A variable that represents a Global object.

Example

This example makes the Visual Basic Editor window visible.

VBA Copy code Copy code
Application.ShowVisualBasicEditor = True

See also

Concepts

Global Object

Other resources

Global Object Members


Global.StatusBar Property (Word)

 Copy code hover
[image]

Global.StatusBar Property (Word)
See also Send feedback

Published: July 16, 2012

This property is no longer supported in Microsoft Word Visual Basic for Applications.

See also

Concepts

Global Object

Other resources

Global Object Members


Global.SynonymInfo Property (Word)

 Copy code hover
[image]

Global.SynonymInfo Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a SynonymInfo object that contains information from the thesaurus on synonyms, antonyms, or related words and expressions for the specified word or phrase.

Syntax

expression .SynonymInfo(Word, LanguageID)

expression Required. A variable that represents a Global object.

Parameters

Name | Required/Optional | Data Type | Description
Word | Required | String | The specified word or phrase.
LanguageID | Optional | Variant | The language used for the thesaurus. Can be one of the WdLanguageID constants (although some of the constants may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed).

Example

This example returns a list of antonyms for the word "big" in U.S. English.

VBA Copy code Copy code
Alist = SynonymInfo(Word:="big", _
 LanguageID:=wdEnglishUS).AntonymList
For i = 1 To UBound(Alist)
 Msgbox Alist(i)
Next i

See also

Concepts

Global Object

Other resources

Global Object Members


Global.System Property (Word)

 Copy code hover
[image]

Global.System Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a System object, which can be used to return system-related information and perform system-related tasks.

Syntax

expression .System

expression Required. A variable that represents a Global object.

Example

This example returns information about the system.

VBA Copy code Copy code
processor = System.ProcessorType
enviro = System.OperatingSystem

This example establishes a connection to a network drive.

VBA Copy code Copy code
System.Connect Path:="\\Project\Info"

See also

Concepts

Global Object

Other resources

Global Object Members


Global.Tasks Property (Word)

 Copy code hover
[image]

Global.Tasks Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Tasks collection that represents all the applications that are running.

Syntax

expression .Tasks

expression Required. A variable that represents a Global object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example displays the calculator. If the calculator is not already running, then Word starts the task and then displays the calculator.

VBA Copy code Copy code
If Tasks.Exists("Calculator") Then
 With Tasks("Calculator")
 .Activate
 .WindowState = wdWindowStateNormal
 End With
Else
 Shell "calc.exe"
 Tasks("Calculator").WindowState = wdWindowStateNormal
End If

This example checks to see whether Microsoft Excel is currently running. If the task is running, the example activates Microsoft Excel; otherwise, a message box is displayed.

VBA Copy code Copy code
If Tasks.Exists("Microsoft Excel") = True Then
 With Tasks("Microsoft Excel")
 .Activate
 .WindowState = wdWindowStateMaximize
 End With
Else
 Msgbox "Microsoft Excel is not currently running."
End If

See also

Concepts

Global Object

Other resources

Global Object Members


Global.Templates Property (Word)

 Copy code hover
[image]

Global.Templates Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Templates collection that represents all the available templates—global templates and those attached to open documents.

Syntax

expression .Templates

expression Required. A variable that represents a Global object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example displays the name of each template in the Templates collection.

VBA Copy code Copy code
Count = 1
For Each aTemplate In Templates
 MsgBox aTemplate.Name & " is template number " & Count
 Count = Count + 1
Next aTemplate

In this example, if template one is a global template, its path is stored in thePath. The ChDir statement is used to make the folder with the path stored in thePath the current folder. When this change is made, the Open dialog box is displayed.

VBA Copy code Copy code
If Templates(1).Type = wdGlobalTemplate Then
 thePath = Templates(1).Path
 If thePath <> "" Then ChDir thePath
 Dialogs(wdDialogFileOpen).Show
End If

See also

Concepts

Global Object

Other resources

Global Object Members


Global.VBE Property (Word)

 Copy code hover
[image]

Global.VBE Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a VBE object that represents the Visual Basic Editor.

Syntax

expression .VBE

expression Required. A variable that represents a Global object.

Example

This example displays the number of references available for the active project.

VBA Copy code Copy code
MsgBox "References = " & VBE.ActiveVBProject.References.Count

See also

Concepts

Global Object

Other resources

Global Object Members


Global.Windows Property (Word)

 Copy code hover
[image]

Global.Windows Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Windows collection that represents all open document windows. Read-only.

Syntax

expression .Windows

expression A variable that represents a Global object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example arranges all open windows so that they don't overlap.

VBA Copy code Copy code
Windows.Arrange ArrangeStyle:=wdTiled

See also

Concepts

Global Object

Other resources

Global Object Members


Global.WordBasic Property (Word)

 Copy code hover
[image]

Global.WordBasic Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Automation object (Word.Basic) that includes methods for all the WordBasic statements and functions available in Word version 6.0 and Word for Windows 95. Read-only.

Syntax

expression .WordBasic

expression A variable that represents a Global object.

Remarks

In Word 2000 and later, when you open a Word version 6.0 or Word for Windows 95 template that contains WordBasic macros, the macros are automatically converted to Visual Basic modules. Each WordBasic statement and function in the macro is converted to the corresponding Word.Basic method.

For information about WordBasic statements and functions, see WordBasic Help in Word version 6.0 or Word for Windows 95. For information about converting WordBasic to Visual Basic, see Converting WordBasic Macros to Visual Basic. For general information, see Conceptual Differences Between WordBasic and Visual Basic.

Example

This example uses the Word.Basic object to create a new document in Word version 6.0 or Word for Windows 95 and insert the available font names. Each font name is formatted in its corresponding font.

VBA Copy code Copy code
With WordBasic
 .FileNewDefault
 For aCount = 1 To .CountFonts()
 .Font .[Font$](aCount)
 .Insert .[Font$](aCount)
 .InsertPara
 Next
End With

See also

Concepts

Global Object

Other resources

Global Object Members


Global Methods (Word)

 Copy code hover
[image]

Global Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
BuildKeyCode | Returns a unique number for the specified key combination.
CentimetersToPoints | Converts a measurement from centimeters to points (1 cm = 28.35 points). Returns the converted measurement as a Single.
ChangeFileOpenDirectory | Sets the folder in which Word searches for documents. .
CheckSpelling | Checks a string for spelling errors. Returns a Boolean to indicate whether the string contains spelling errors. True if the string has no spelling errors.
CleanString | Removes nonprinting characters (character codes 1 - 29) and special Word characters from the specified string or changes them to spaces (character code 32), as described in the "Remarks" section. Returns the result as a String.
DDEExecute | Sends a command or series of commands to an application through the specified dynamic data exchange (DDE) channel.
DDEInitiate | Opens a dynamic data exchange (DDE) channel to another application, and returns the channel number.
DDEPoke | Uses an open dynamic data exchange (DDE) channel to send data to an application.
DDERequest | Uses an open dynamic data exchange (DDE) channel to request information from the receiving application, and returns the information as a string.
DDETerminate | Closes the specified dynamic data exchange (DDE) channel to another application.
DDETerminateAll | Closes all dynamic data exchange (DDE) channels opened by Microsoft Word. .
GetSpellingSuggestions | Returns a SpellingSuggestions collection that represents the words suggested as spelling replacements for a given word.
Help | Displays on-line Help information.
InchesToPoints | Converts a measurement from inches to points (1 inch = 72 points). Returns the converted measurement as a Single.
KeyString | Returns the key combination string for the specified keys (for example, CTRL+SHIFT+A).
LinesToPoints | Converts a measurement from lines to points (1 line = 12 points). Returns the converted measurement as a Single.
MillimetersToPoints | Converts a measurement from millimeters to points (1 mm = 2.85 points). Returns the converted measurement as a Single.
NewWindow | Opens a new window with the same document as the specified window. Returns a Window object.
PicasToPoints | Converts a measurement from picas to points (1 pica = 12 points). Returns the converted measurement as a Single.
PixelsToPoints | Converts a measurement from pixels to points. Returns the converted measurement as a Single.
PointsToCentimeters | Converts a measurement from points to centimeters (1 centimeter = 28.35 points). Returns the converted measurement as a Single.
PointsToInches | Converts a measurement from points to inches (1 inch = 72 points). Returns the converted measurement as a Single.
PointsToLines | Converts a measurement from points to lines (1 line = 12 points). Returns the converted measurement as a Single.
PointsToMillimeters | Converts a measurement from points to millimeters (1 millimeter = 2.835 points). Returns the converted measurement as a Single.
PointsToPicas | Converts a measurement from points to picas (1 pica = 12 points). Returns the converted measurement as a Single.
PointsToPixels | Converts a measurement from points to pixels. Returns the converted measurement as a Single.
Repeat | Repeats the most recent editing action one or more times. Returns True if the commands were repeated successfully.


Global.BuildKeyCode Method (Word)

 Copy code hover
[image]

Global.BuildKeyCode Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a unique number for the specified key combination.

Syntax

expression .BuildKeyCode(Arg1, Arg2, Arg3, Arg4)

expression A variable that represents a Global object. Optional.

Parameters

Name | Required/Optional | Data Type | Description
Arg1 | Required | WdKey | A key you specify by using one of the WdKey constants.
Arg2 | Optional | WdKey | A key you specify by using one of the WdKey constants.
Arg3 | Optional | WdKey | A key you specify by using one of the WdKey constants.
Arg4 | Optional | WdKey | A key you specify by using one of the WdKey constants.

Example

This example assigns the ALT + F1 key combination to the Organizer command.

VBA Copy code Copy code
CustomizationContext = NormalTemplate
KeyBindings.Add KeyCode:=BuildKeyCode(Arg1:=wdKeyAlt, _
 Arg2:=wdKeyF1), KeyCategory:=wdKeyCategoryCommand, _
 Command:="Organizer"

This example removes the ALT+F1 key assignment from the Normal template.

VBA Copy code Copy code
CustomizationContext = NormalTemplate
FindKey(BuildKeyCode(Arg1:=wdKeyAlt, Arg2:=wdKeyF1)).Clear

This example displays the command assigned to the F1 key.

VBA Copy code Copy code
CustomizationContext = NormalTemplate
MsgBox FindKey(BuildKeyCode(Arg1:=wdKeyF1)).Command

See also

Concepts

Global Object

Other resources

Global Object Members


Global.CentimetersToPoints Method (Word)

 Copy code hover
[image]

Global.CentimetersToPoints Method (Word)
See also Send feedback

Published: July 16, 2012

Converts a measurement from centimeters to points (1 cm = 28.35 points). Returns the converted measurement as a Single.

Syntax

expression .CentimetersToPoints(Centimeters)

expression A variable that represents a Global object. Optional.

Parameters

Name | Required/Optional | Data Type | Description
Centimeters | Required | Single | The centimeter value to be converted to points.

Example

This example adds a centered tab stop to all the paragraphs in the selection. The tab stop is positioned at 1.5 centimeters from the left margin.

VBA Copy code Copy code
Selection.Paragraphs.TabStops.Add _
 Position:=CentimetersToPoints(1.5), _
 Alignment:=wdAlignTabCenter

This example sets a first-line indent of 2.5 centimeters for the first paragraph in the active document.

VBA Copy code Copy code
ActiveDocument.Paragraphs(1).FirstLineIndent = _
 CentimetersToPoints(2.5)

See also

Concepts

Global Object

Other resources

Global Object Members


Global.ChangeFileOpenDirectory Method (Word)

 Copy code hover
[image]

Global.ChangeFileOpenDirectory Method (Word)
See also Send feedback

Published: July 16, 2012

Sets the folder in which Word searches for documents. .

Syntax

expression .ChangeFileOpenDirectory(Path)

expression A variable that represents a Global object. Optional.

Parameters

Name | Required/Optional | Data Type | Description
Path | Required | String | The path to the folder in which Word searches for documents.

Remarks

The contents of the specified folder are listed the next time the Open dialog box (File menu) is displayed.Word searches the specified folder for documents until the user changes the folder in the Open dialog box or the current Word session ends. Use the DefaultFilePath property to change the default folder for documents in every Word session.

Example

This example changes the folder in which Word searches for documents, and then opens a file named "Test.doc."

VBA Copy code Copy code
ChangeFileOpenDirectory "C:\Documents"
Documents.Open FileName:="Test.doc"

This example changes the folder in which Word searches for documents, and then displays the Open dialog box.

VBA Copy code Copy code
ChangeFileOpenDirectory "C:\"
Dialogs(wdDialogFileOpen).Show

See also

Concepts

Global Object

Other resources

Global Object Members


Global.CheckSpelling Method (Word)

 Copy code hover
[image]

Global.CheckSpelling Method (Word)
See also Send feedback

Published: July 16, 2012

Checks a string for spelling errors. Returns a Boolean to indicate whether the string contains spelling errors. True if the string has no spelling errors.

Syntax

expression .CheckSpelling(Word, CustomDictionary, IgnoreUppercase, MainDictionary, CustomDictionary2, CustomDictionary3, CustomDictionary4, CustomDictionary5, CustomDictionary6, CustomDictionary7, CustomDictionary8, CustomDictionary9, CustomDictionary10)

expression Required. A variable that represents a Global object.

Parameters

Name | Required/Optional | Data Type | Description
Word | Required | String | The text whose spelling is to be checked.
CustomDictionary | Optional | Variant | Either an expression that returns a Dictionary object or the file name of the custom dictionary.
IgnoreUppercase | Optional | Variant | True if capitalization is ignored. If this argument is omitted, the current value of the IgnoreUppercase property is used.
MainDictionary | Optional | Variant | Either an expression that returns a Dictionary object or the file name of the main dictionary.
CustomDictionary2 | Optional | Variant | Either an expression that returns a Dictionary object or the file name of an additional custom dictionary.
CustomDictionary3 | Optional | Variant | Either an expression that returns a Dictionary object or the file name of an additional custom dictionary.
CustomDictionary4 | Optional | Variant | Either an expression that returns a Dictionary object or the file name of an additional custom dictionary.
CustomDictionary5 | Optional | Variant | Either an expression that returns a Dictionary object or the file name of an additional custom dictionary.
CustomDictionary6 | Optional | Variant | Either an expression that returns a Dictionary object or the file name of an additional custom dictionary.
CustomDictionary7 | Optional | Variant | Either an expression that returns a Dictionary object or the file name of an additional custom dictionary.
CustomDictionary8 | Optional | Variant | Either an expression that returns a Dictionary object or the file name of an additional custom dictionary.
CustomDictionary9 | Optional | Variant | Either an expression that returns a Dictionary object or the file name of an additional custom dictionary.
CustomDictionary10 | Optional | Variant | Either an expression that returns a Dictionary object or the file name of an additional custom dictionary.

Return Value

Boolean

See also

Concepts

Global Object

Other resources

Global Object Members


Global.CleanString Method (Word)

 Copy code hover
[image]

Global.CleanString Method (Word)
See also Send feedback

Published: July 16, 2012

Removes nonprinting characters (character codes 1 - 29) and special Word characters from the specified string or changes them to spaces (character code 32), as described in the "Remarks" section. Returns the result as a String.

Syntax

expression .CleanString(String)

expression A variable that represents a Global object. Optional.

Parameters

Name | Required/Optional | Data Type | Description
String | Required | String | The source string.

Remarks

The following characters are converted as described in this table.

Character code | Description
7 (beep) | Removed unless preceded by character 13 (paragraph), then converted to character 9 (tab).
10 (line feed) | Converted to character 13 (paragraph) unless preceded by character 13, then removed.
13 (paragraph) | Unchanged.
31 (optional hyphen) | Removed.
160 (nonbreaking space) | Converted to character 32 (space).
172 (optional hyphen) | Removed.
176 (nonbreaking space) | Converted to character 32 (space).
182 (paragraph mark) | Removed.
183 (bullet) | Converted to character 32 (space).

Example

This example removes nonprinting characters from the selected text and inserts the result into a new document.

VBA Copy code Copy code
Dim strClean As String
Dim docNew As Document

strClean = Application.CleanString(Selection.Text)
Set docNew = Documents.Add
docNew.Content.InsertAfter strClean

This example removes nonprinting characters from the selected field code and then displays the result.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.View.ShowFieldCodes = True
ActiveDocument.Fields(1).Select
MsgBox Application.CleanString(Selection.Text)

See also

Concepts

Global Object

Other resources

Global Object Members


Global.DDEExecute Method (Word)

 Copy code hover
[image]

Global.DDEExecute Method (Word)
See also Send feedback

Published: July 16, 2012

Sends a command or series of commands to an application through the specified dynamic data exchange (DDE) channel.

Syntax

expression .DDEExecute(Channel, Command)

expression A variable that represents a Global object. Optional.

Parameters

Name | Required/Optional | Data Type | Description
Channel | Required | Long | The channel number returned by the DDEInitiate method.
Command | Required | String | A command or series of commands recognized by the receiving application (the DDE server). If the receiving application cannot perform the specified command, an error occurs.

Remarks

Security note Security Note
Dynamic data exchange (DDE) is an older technology that is not secure. If possible, use a more secure alternative to DDE, such as object linking and embedding (OLE).

Example

This example creates a new worksheet in Microsoft Excel. The XLM macro instruction to create a new worksheet is New(1).

VBA Copy code Copy code
Dim lngChannel As Long

lngChannel = DDEInitiate(App:="Excel", Topic:="System")
DDEExecute Channel:=lngChannel, Command:="[New(1)]"
DDETerminate Channel:=lngChannel

This example runs the Microsoft Excel macro named "Macro1" in Personal.xls.

VBA Copy code Copy code
Dim lngChannel As Long

lngChannel = DDEInitiate(App:="Excel", Topic:="System")
DDEExecute Channel:=lngChannel, Command:="[Run(" & Chr(34) & _
 "Personal.xls!Macro1" & Chr(34) & ")]"
DDETerminate Channel:=lngChannel

See also

Concepts

Global Object

Other resources

Global Object Members


Global.DDEInitiate Method (Word)

 Copy code hover
[image]

Global.DDEInitiate Method (Word)
See also Send feedback

Published: July 16, 2012

Opens a dynamic data exchange (DDE) channel to another application, and returns the channel number.

Syntax

expression .DDEInitiate(App, Topic)

expression A variable that represents a Global object. Optional.

Parameters

Name | Required/Optional | Data Type | Description
App | Required | String | The name of the application.
Topic | Required | String | The name of a DDE topic—for example, the name of an open document—recognized by the application to which you are opening a channel.

Remarks

Security note Security Note
Dynamic data exchange (DDE) is an older technology that is not secure. If possible, use a more secure alternative to DDE, such as object linking and embedding (OLE).

If it is successful, the DDEInitiate method returns the number of the open channel. All subsequent DDE functions use this number to specify the channel.

Example

This example initiates a DDE conversation with the System topic and opens the Microsoft Office Excel workbook Sales.xls. The example terminates the DDE channel, initiates a channel to Sales.xls, and then inserts text into cell R1C1.

VBA Copy code Copy code
Dim lngChannel As Long

lngChannel = DDEInitiate(App:="Excel", Topic:="System")
DDEExecute Channel:=lngChannel, Command:="[OPEN(" & Chr(34) _
 & "C:\Sales.xls" & Chr(34) & ")]
DDETerminate Channel:=lngChannel
lngChannel = DDEInitiate(App:="Excel", Topic:="Sales.xls")
DDEPoke Channel:=lngChannel, Item:="R1C1", Data:="1996 Sales"
DDETerminate Channel:=lngChannel

See also

Concepts

Global Object

Other resources

Global Object Members


Global.DDEPoke Method (Word)

 Copy code hover
[image]

Global.DDEPoke Method (Word)
See also Send feedback

Published: July 16, 2012

Uses an open dynamic data exchange (DDE) channel to send data to an application.

Syntax

expression .DDEPoke(Channel, Item, Data)

expression A variable that represents a Global object. Optional.

Parameters

Name | Required/Optional | Data Type | Description
Channel | Required | Long | The channel number returned by the DDEInitiate method.
Item | Required | String | The item within a DDE topic to which the specified data is to be sent.
Data | Required | String | The data to be sent to the receiving application (the DDE server).

Remarks

Security note Security Note
Dynamic data exchange (DDE) is an older technology that is not secure. If possible, use a more secure alternative to DDE, such as object linking and embedding (OLE).

If the DDEPoke method isn't successful, an error occurs.

Example

This example opens the Microsoft Excel workbook Sales.xls and inserts "1996 Sales" into cell R1C1.

VBA Copy code Copy code
Dim lngChannel As Long

lngChannel = DDEInitiate(App:="Excel", Topic:="System")
DDEExecute Channel:=lngChannel, Command:="[OPEN(" & Chr(34) _
 & "C:\Sales.xls" & Chr(34) & ")]
DDETerminate Channel:=lngChannel
lngChannel = DDEInitiate(App:="Excel", Topic:="Sales.xls")
DDEPoke Channel:=lngChannel, Item:="R1C1", Data:="1996 Sales"
DDETerminate Channel:=lngChannel

See also

Concepts

Global Object

Other resources

Global Object Members


Global.DDERequest Method (Word)

 Copy code hover
[image]

Global.DDERequest Method (Word)
See also Send feedback

Published: July 16, 2012

Uses an open dynamic data exchange (DDE) channel to request information from the receiving application, and returns the information as a string.

Syntax

expression .DDERequest(Channel, Item)

expression A variable that represents a Global object. Optional.

Parameters

Name | Required/Optional | Data Type | Description
Channel | Required | Long | The channel number returned by the DDEInitiate method.
Item | Required | String | The item to be requested.

Remarks

Security note Security Note
Dynamic data exchange (DDE) is an older technology that is not secure. If possible, use a more secure alternative to DDE, such as object linking and embedding (OLE).

When you request information from the topic in the server application, you must specify the item in that topic whose contents you are requesting. In Microsoft Excel, for example, cells are valid items, and you refer to them by using either the "R1C1" format or named references.

Microsoft Excel and other applications that support DDE recognize a topic named "System." Three standard items in the System topic are described in the following table. Note that you can get a list of the other items in the System topic by using the SysItems item.

Item in System topic | Effect
SysItems | Returns a list of all the items in the System topic.
Topics | Returns a list of all the available topics.
Formats | Returns a list of all the Clipboard formats supported by Word.

Example

This example opens the Microsoft Excel workbook Book1.xls and retrieves the contents of cell R1C1.

VBA Copy code Copy code
Dim lngChannel As Long

lngChannel = DDEInitiate(App:="Excel", Topic:="System")
DDEExecute Channel:=lngChannel, Command:="[OPEN(" & Chr(34) _
 & "C:\Documents\Book1.xls" & Chr(34) & ")]"
DDETerminate Channel:=lngChannel
lngChannel = DDEInitiate(App:="Excel", Topic:="Book1.xls")
MsgBox DDERequest(Channel:=lngChannel, Item:="R1C1")
DDETerminateAll

This example opens a channel to the System topic in Microsoft Excel and then uses the Topics item to return a list of available topics. The example inserts the topic list, which includes all open workbooks, after the selection.

VBA Copy code Copy code
Dim lngChannel As Long
Dim strTopicList As String

lngChannel = DDEInitiate(App:="Excel", Topic:="System")
strTopicList = DDERequest(Channel:=lngChannel, Item:="Topics")
Selection.InsertAfter strTopicList
DDETerminate Channel:=lngChannel

See also

Concepts

Global Object

Other resources

Global Object Members


Global.DDETerminate Method (Word)

 Copy code hover
[image]

Global.DDETerminate Method (Word)
See also Send feedback

Published: July 16, 2012

Closes the specified dynamic data exchange (DDE) channel to another application.

Syntax

expression .DDETerminate(Channel)

expression A variable that represents a Global object. Optional.

Parameters

Name | Required/Optional | Data Type | Description
Channel | Required | Long | The channel number returned by the DDEInitiate method.

Remarks

Security note Security Note
Dynamic data exchange (DDE) is an older technology that is not secure. If possible, use a more secure alternative to DDE, such as object linking and embedding (OLE).

Example

This example creates a new workbook in Microsoft Excel and then terminates the DDE conversation.

VBA Copy code Copy code
Dim lngChannel As Long

lngChannel = DDEInitiate(App:="Excel", Topic:="System")
DDEExecute Channel:=lngChannel, Command:="[New(1)]"
DDETerminate Channel:=lngChannel

See also

Concepts

Global Object

Other resources

Global Object Members


Global.DDETerminateAll Method (Word)

 Copy code hover
[image]

Global.DDETerminateAll Method (Word)
See also Send feedback

Published: July 16, 2012

Closes all dynamic data exchange (DDE) channels opened by Microsoft Word. .

Syntax

expression .DDETerminateAll

expression A variable that represents a Global object. Optional.

Remarks

This method does not close channels opened to Word by client applications. Using this method is the same as using the DDETerminate method for each open channel.

Security note Security Note
Dynamic data exchange (DDE) is an older technology that is not secure. If possible, use a more secure alternative to DDE, such as object linking and embedding (OLE).

If you interrupt a macro that opens a DDE channel, you may inadvertently leave a channel open. Open channels are not closed automatically when a macro ends, and each open channel uses system resources. For this reason, it is a good idea to use this method when you are debugging a macro that opens one or more DDE channels.

Example

This example opens the Microsoft Office Excel workbook Book1.xls, inserts text into cell R2C3, saves the workbook, and then terminates all DDE channels.

VBA Copy code Copy code
Dim lngChannel As Long

lngChannel = DDEInitiate(App:="Excel", Topic:="System")
DDEExecute Channel:=lngChannel, Command:="[OPEN(" & Chr(34) & _
 "C:\Documents\Book1.xls" & Chr(34) & ")]"
DDETerminate Channel:=lngChannel
lngChannel = DDEInitiate(App:="Excel", Topic:="Book1.xls")
DDEPoke Channel:=lngChannel, Item:="R2C3", Data:="Hello World"
DDEExecute Channel:=lngChannel, Command:="[Save]"
DDETerminateAll

See also

Concepts

Global Object

Other resources

Global Object Members


Global.GetSpellingSuggestions Method (Word)

 Copy code hover
[image]

Global.GetSpellingSuggestions Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a SpellingSuggestions collection that represents the words suggested as spelling replacements for a given word.

Syntax

expression .GetSpellingSuggestions(Word, CustomDictionary, IgnoreUppercase, MainDictionary, SuggestionMode, CustomDictionary2, CustomDictionary3, CustomDictionary4, CustomDictionary5, CustomDictionary6, CustomDictionary7, CustomDictionary8, CustomDictionary9, CustomDictionary10)

expression Required. A variable that represents a Global object.

Parameters

Name | Required/Optional | Data Type | Description
Word | Required | String | The word whose spelling is to be checked.
IgnoreUppercase | Optional | Variant | True to ignore words in all uppercase letters. If this argument is omitted, the current value of the IgnoreUppercase property is used.
SuggestionMode | Optional | Variant | Specifies the way Word makes spelling suggestions. Can be one of the following WdSpellingWordType constants: wdAnagram, wdSpellword, orwdWildcard. The default value is WdSpellword.

Remarks

If the word is spelled correctly, the Count property of the SpellingSuggestions object returns 0 (zero).

Example

This example looks for the alternate spelling suggestions for the word "?ook." Suggestions include replacements for the ? wildcard character. Any suggested spellings are displayed in message boxes.

VBA Copy code Copy code
Sub DisplaySuggestions()
 Dim sugList As SpellingSuggestions
 Dim sug As SpellingSuggestion
 Dim strSugList As String
 Set sugList = GetSpellingSuggestions(Word:="lrok", _
 SuggestionMode:=wdSpellword)
 If sugList.Count = 0 Then
 MsgBox "No suggestions."
 Else
 For Each sug In sugList
 strSugList = strSugList & vbTab & sug.Name & vbLf
 Next sug
 MsgBox "The suggestions for this word are: " _
 & vbLf & strSugList
 End If
End Sub

See also

Concepts

Global Object

Other resources

Global Object Members


Global.Help Method (Word)

 Copy code hover
[image]

Global.Help Method (Word)
See also Send feedback

Published: July 16, 2012

Displays on-line Help information.

Syntax

expression .Help(HelpType)

expression A variable that represents a Global object.

Parameters

Name | Required/Optional | Data Type | Description
HelpType | Required | Variant | The on-line Help topic or window. Can be any of these WdHelpType constants.

Remarks

Some of the constants listed above may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.

Example

This example displays the Help Topics dialog box.

VBA Copy code Copy code
Help HelpType:=wdHelp

This example displays a list of Help topics that describe how to use Help.

VBA Copy code Copy code
Help HelpType:=wdHelpUsingHelp

See also

Concepts

Global Object

Other resources

Global Object Members


Global.InchesToPoints Method (Word)

 Copy code hover
[image]

Global.InchesToPoints Method (Word)
See also Send feedback

Published: July 16, 2012

Converts a measurement from inches to points (1 inch = 72 points). Returns the converted measurement as a Single.

Syntax

expression .InchesToPoints(Inches)

expression A variable that represents a Global object. Optional.

Parameters

Name | Required/Optional | Data Type | Description
Inches | Required | Single | The inch value to be converted to points.

Return Value

Single

Example

This example sets the space before for the selected paragraphs to 0.25 inch.

VBA Copy code Copy code
Selection.ParagraphFormat.SpaceBefore = InchesToPoints(0.25)

This example prints each open document after setting the left and right margins to 0.65 inch.

VBA Copy code Copy code
Dim docLoop As Document

For Each docLoop in Documents
 With docLoop
 .PageSetup.LeftMargin = InchesToPoints(0.65)
 .PageSetup.RightMargin = InchesToPoints(0.65)
 .PrintOut
 End With
Next docLoop

See also

Concepts

Global Object

Other resources

Global Object Members


Global.KeyString Method (Word)

 Copy code hover
[image]

Global.KeyString Method (Word)
See also Send feedback

Published: July 16, 2012

Returns the key combination string for the specified keys (for example, CTRL+SHIFT+A).

Syntax

expression .KeyString(KeyCode, KeyCode2)

expression A variable that represents a Global object.

Parameters

Name | Required/Optional | Data Type | Description
KeyCode | Required | Long | A key you specify by using one of the WdKey constants.
KeyCode2 | Optional | Variant | A second key you specify by using one of the WdKey constants.

Return Value

String

Remarks

You can use the BuildKeyCode method to create the KeyCode or KeyCode2 argument.

Example

This example displays the key combination string (CTRL+SHIFT+A) for the following WdKey constants: wdKeyControl, wdKeyShift, and wdKeyA.

VBA Copy code Copy code
CustomizationContext = ActiveDocument.AttachedTemplate
MsgBox KeyString(KeyCode:=BuildKeyCode(wdKeyControl, _
 wdKeyShift, wdKeyA))

See also

Concepts

Global Object

Other resources

Global Object Members


Global.LinesToPoints Method (Word)

 Copy code hover
[image]

Global.LinesToPoints Method (Word)
See also Send feedback

Published: July 16, 2012

Converts a measurement from lines to points (1 line = 12 points). Returns the converted measurement as a Single.

Syntax

expression .LinesToPoints(Lines)

expression A variable that represents a Global object. Optional.

Parameters

Name | Required/Optional | Data Type | Description
Lines | Required | Single | The line value to be converted to points.

Return Value

Single

Example

This example sets the paragraph line spacing in the selection to three lines.

VBA Copy code Copy code
With Selection.ParagraphFormat
 .LineSpacingRule = wdLineSpaceMultiple
 .LineSpacing = LinesToPoints(3)
End With

See also

Concepts

Global Object

Other resources

Global Object Members


Global.MillimetersToPoints Method (Word)

 Copy code hover
[image]

Global.MillimetersToPoints Method (Word)
See also Send feedback

Published: July 16, 2012

Converts a measurement from millimeters to points (1 mm = 2.85 points). Returns the converted measurement as a Single.

Syntax

expression .MillimetersToPoints(Millimeters)

expression A variable that represents a Global object. Optional.

Parameters

Name | Required/Optional | Data Type | Description
Millimeters | Required | Single | The millimeter value to be converted to points.

Return Value

Single

Example

This example sets the hyphenation zone in the active document to 8.8 millimeters.

VBA Copy code Copy code
ActiveDocument.HyphenationZone = MillimetersToPoints(8.8)

This example expands the spacing of the selected characters to 2.8 points.

VBA Copy code Copy code
Selection.Font.Spacing = MillimetersToPoints(1)

See also

Concepts

Global Object

Other resources

Global Object Members


Global.NewWindow Method (Word)

 Copy code hover
[image]

Global.NewWindow Method (Word)
See also Send feedback

Published: July 16, 2012

Opens a new window with the same document as the specified window. Returns a Window object.

Syntax

expression .NewWindow

expression Required. A variable that represents a Global object.

Return Value

Window

Remarks

If the NewWindow method is used with the Application object, a new window is opened for the active window. The following two instructions are functionally equivalent.

VBA Copy code Copy code
Set myWindow = ActiveDocument.ActiveWindow.NewWindow
Set myWindow = NewWindow

Example

This example posts a message that indicates the number of windows that exist before and after you open a new window for Document1.

VBA Copy code Copy code
MsgBox Windows.Count & " windows open"
Windows("Document1").NewWindow
MsgBox Windows.Count & " windows open"

This example opens a new window, arranges all the open windows, closes the new window, and then rearranges the open windows.

VBA Copy code Copy code
Set myWindow = NewWindow
Windows.Arrange ArrangeStyle:=wdTiled
myWindow.Close
Windows.Arrange ArrangeStyle:=wdTiled

See also

Concepts

Global Object

Other resources

Global Object Members


Global.PicasToPoints Method (Word)

 Copy code hover
[image]

Global.PicasToPoints Method (Word)
See also Send feedback

Published: July 16, 2012

Converts a measurement from picas to points (1 pica = 12 points). Returns the converted measurement as a Single.

Syntax

expression .PicasToPoints(Picas)

expression A variable that represents a Global object. Optional.

Parameters

Name | Required/Optional | Data Type | Description
Picas | Required | Single | The pica value to be converted to points.

Return Value

Single

Example

This example adds line numbers to the active document and sets the distance between the line numbers and the document text to 4 picas.

VBA Copy code Copy code
With ActiveDocument.PageSetup.LineNumbering
 .Active = True
 .DistanceFromText = PicasToPoints(4)
End With

This example sets the first-line indent for the selected paragraphs to 3 picas.

VBA Copy code Copy code
Selection.ParagraphFormat.FirstLineIndent = PicasToPoints(3)

See also

Concepts

Global Object

Other resources

Global Object Members


Global.PixelsToPoints Method (Word)

 Copy code hover
[image]

Global.PixelsToPoints Method (Word)
See also Send feedback

Published: July 16, 2012

Converts a measurement from pixels to points. Returns the converted measurement as a Single.

Syntax

expression .PixelsToPoints(Pixels, fVertical)

expression Required. A variable that represents a Global object.

Parameters

Name | Required/Optional | Data Type | Description
Pixels | Required | Single | The pixel value to be converted to points.
fVertical | Optional | Variant | True to convert vertical pixels; False to convert horizontal pixels.

Return Value

Single

Example

This example displays the height and width in points of an object measured in pixels.

VBA Copy code Copy code
MsgBox "320x240 pixels is equivalent to " _
 & PixelsToPoints(320, False) & "x" _
 & PixelsToPoints(240, True) _
 & " points on this display."

See also

Concepts

Global Object

Other resources

Global Object Members


Global.PointsToCentimeters Method (Word)

 Copy code hover
[image]

Global.PointsToCentimeters Method (Word)
See also Send feedback

Published: July 16, 2012

Converts a measurement from points to centimeters (1 centimeter = 28.35 points). Returns the converted measurement as a Single.

Syntax

expression .PointsToCentimeters(Points)

expression A variable that represents a Global object. Optional.

Parameters

Name | Required/Optional | Data Type | Description
Points | Required | Single | The measurement, in points.

Return Value

Single

Example

This example converts a measurement of 30 points to the corresponding number of centimeters.

VBA Copy code Copy code
MsgBox PointsToCentimeters(30) & " centimeters"

This example converts the value of the variable sngData (a measurement in points) to centimeters, inches, lines, millimeters, or picas, depending on the value of the variable intUnit (a value from 1 through 5 that indicates the resulting unit of measurement).

VBA Copy code Copy code
Function ConvertPoints(ByVal intUnit As Integer, _
 sngData As Single) As Single

 Select Case intUnit
 Case 1
 ConvertPoints = PointsToCentimeters(sngData)
 Case 2
 ConvertPoints = PointsToInches(sngData)
 Case 3
 ConvertPoints = PointsToLines(sngData)
 Case 4
 ConvertPoints = PointsToMillimeters(sngData)
 Case 5
 ConvertPoints = PointsToPicas(sngData)
 Case Else
 Error 5
 End Select

End Function

See also

Concepts

Global Object

Other resources

Global Object Members


Global.PointsToInches Method (Word)

 Copy code hover
[image]

Global.PointsToInches Method (Word)
See also Send feedback

Published: July 16, 2012

Converts a measurement from points to inches (1 inch = 72 points). Returns the converted measurement as a Single.

Syntax

expression .PointsToInches(Points)

expression A variable that represents a Global object. Optional.

Parameters

Name | Required/Optional | Data Type | Description
Points | Required | Single | The measurement, in points.

Return Value

Single

Example

This example converts the measurement of the top margin for the active document to inches and displays the result in a message box.

VBA Copy code Copy code
MsgBox PointsToInches(ActiveDocument.Sections(1) _
 .PageSetup.TopMargin)

This example converts the value of the variable sngData (a measurement in points) to centimeters, inches, lines, millimeters, or picas, depending on the value of the variable intUnit (a value from 1 through 5 that indicates the resulting unit of measurement).

VBA Copy code Copy code
Function ConvertPoints(ByVal intUnit As Integer, _
 sngData As Single) As Single

 Select Case intUnit
 Case 1
 ConvertPoints = PointsToCentimeters(sngData)
 Case 2
 ConvertPoints = PointsToInches(sngData)
 Case 3
 ConvertPoints = PointsToLines(sngData)
 Case 4
 ConvertPoints = PointsToMillimeters(sngData)
 Case 5
 ConvertPoints = PointsToPicas(sngData)
 Case Else
 Error 5
 End Select

End Function

See also

Concepts

Global Object

Other resources

Global Object Members


Global.PointsToLines Method (Word)

 Copy code hover
[image]

Global.PointsToLines Method (Word)
See also Send feedback

Published: July 16, 2012

Converts a measurement from points to lines (1 line = 12 points). Returns the converted measurement as a Single.

Syntax

expression .PointsToLines(Points)

expression A variable that represents a Global object. Optional.

Parameters

Name | Required/Optional | Data Type | Description
Points | Required | Single | The measurement, in points.

Return Value

Single

Example

This example converts the line spacing value of the first paragraph in the selection from points to lines.

VBA Copy code Copy code
MsgBox PointsToLines(Selection.Paragraphs(1).LineSpacing) _
 & " lines"

This example converts the value of the variable sngData (a measurement in points) to centimeters, inches, lines, millimeters, or picas, depending on the value of the variable intUnit (a value from 1 through 5 that indicates the resulting unit of measurement).

VBA Copy code Copy code
Function ConvertPoints(ByVal intUnit As Integer, _
 sngData As Single) As Single

 Select Case intUnit
 Case 1
 ConvertPoints = PointsToCentimeters(sngData)
 Case 2
 ConvertPoints = PointsToInches(sngData)
 Case 3
 ConvertPoints = PointsToLines(sngData)
 Case 4
 ConvertPoints = PointsToMillimeters(sngData)
 Case 5
 ConvertPoints = PointsToPicas(sngData)
 Case Else
 Error 5
 End Select

End Function

See also

Concepts

Global Object

Other resources

Global Object Members


Global.PointsToMillimeters Method (Word)

 Copy code hover
[image]

Global.PointsToMillimeters Method (Word)
See also Send feedback

Published: July 16, 2012

Converts a measurement from points to millimeters (1 millimeter = 2.835 points). Returns the converted measurement as a Single.

Syntax

expression .PointsToMillimeters(Points)

expression A variable that represents a Global object. Optional.

Parameters

Name | Required/Optional | Data Type | Description
Points | Required | Single | The measurement, in points.

Return Value

Single

Example

This example converts 72 points to the corresponding number of millimeters.

VBA Copy code Copy code
MsgBox PointsToMillimeters(72) & " millimeters"

This example converts the value of the variable sngData (a measurement in points) to centimeters, inches, lines, millimeters, or picas, depending on the value of the variable intUnit (a value from 1 through 5 that indicates the resulting unit of measurement).

VBA Copy code Copy code
Function ConvertPoints(ByVal intUnit As Integer, _
 sngData As Single) As Single

 Select Case intUnit
 Case 1
 ConvertPoints = PointsToCentimeters(sngData)
 Case 2
 ConvertPoints = PointsToInches(sngData)
 Case 3
 ConvertPoints = PointsToLines(sngData)
 Case 4
 ConvertPoints = PointsToMillimeters(sngData)
 Case 5
 ConvertPoints = PointsToPicas(sngData)
 Case Else
 Error 5
 End Select

End Function

See also

Concepts

Global Object

Other resources

Global Object Members


Global.PointsToPicas Method (Word)

 Copy code hover
[image]

Global.PointsToPicas Method (Word)
See also Send feedback

Published: July 16, 2012

Converts a measurement from points to picas (1 pica = 12 points). Returns the converted measurement as a Single.

Syntax

expression .PointsToPicas(Points)

expression A variable that represents a Global object. Optional.

Parameters

Name | Required/Optional | Data Type | Description
Points | Required | Single | The measurement, in points.

Return Value

Single

Example

This example converts 36 points to the corresponding number of picas.

VBA Copy code Copy code
MsgBox PointsToPicas(36) & " picas"

This example converts the value of the variable sngData (a measurement in points) to centimeters, inches, lines, millimeters, or picas, depending on the value of the variable intUnit (a value from 1 through 5 that indicates the resulting unit of measurement).

VBA Copy code Copy code
Function ConvertPoints(ByVal intUnit As Integer, _
 sngData As Single) As Single

 Select Case intUnit
 Case 1
 ConvertPoints = PointsToCentimeters(sngData)
 Case 2
 ConvertPoints = PointsToInches(sngData)
 Case 3
 ConvertPoints = PointsToLines(sngData)
 Case 4
 ConvertPoints = PointsToMillimeters(sngData)
 Case 5
 ConvertPoints = PointsToPicas(sngData)
 Case Else
 Error 5
 End Select

End Function

See also

Concepts

Global Object

Other resources

Global Object Members


Global.PointsToPixels Method (Word)

 Copy code hover
[image]

Global.PointsToPixels Method (Word)
See also Send feedback

Published: July 16, 2012

Converts a measurement from points to pixels. Returns the converted measurement as a Single.

Syntax

expression .PointsToPixels(Points, fVertical)

expression Required. A variable that represents a Global object.

Parameters

Name | Required/Optional | Data Type | Description
Points | Required | Single | The point value to be converted to pixels.
fVertical | Optional | Variant | True to return the result as vertical pixels; False to return the result as horizontal pixels.

Return Value

Single

Example

This example displays the height and width in pixels of an object measured in points.

VBA Copy code Copy code
MsgBox "180x120 points is equivalent to " _
 & PointsToPixels(180, False) & "x" _
 & PointsToPixels(120, True) _
 & " pixels on this display."

See also

Concepts

Global Object

Other resources

Global Object Members


Global.Repeat Method (Word)

 Copy code hover
[image]

Global.Repeat Method (Word)
See also Send feedback

Published: July 16, 2012

Repeats the most recent editing action one or more times. Returns True if the commands were repeated successfully.

Syntax

expression .Repeat(Times)

expression A variable that represents a Global object. Optional.

Parameters

Name | Required/Optional | Data Type | Description
Times | Optional | Variant | The number of times you want to repeat the last command.

Return Value

Boolean

Remarks

Using this method is the equivalent to using the Repeat command on the Edit menu.

Example

This example inserts the text "Hello" followed by two paragraphs (the second typing action is repeated once).

VBA Copy code Copy code
Selection.TypeText "Hello"
Selection.TypeParagraph
Repeat

This example repeats the last command three times (if it can be repeated).

VBA Copy code Copy code
On Error Resume Next
If Repeat(3) = True Then StatusBar = "Action repeated"

See also

Concepts

Global Object

Other resources

Global Object Members


GlowFormat Object (Word)

 Copy code hover
[image]

GlowFormat Object (Word)
See also Send feedback

Published: July 16, 2012

Represents the glow formatting for a shape or range of shapes.

Version Information

Version Added: Word 2007

See also

Concepts

Word Object Model Reference

Other resources

GlowFormat Object Members


GlowFormat Members (Word)

 Copy code hover
[image]

GlowFormat Members (Word)
Send feedback

Published: July 16, 2012

Represents the glow formatting for a shape or range of shapes.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application. Read-only.
Color | Returns a ColorFormat object that represents the color for a glow effect. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified GlowFormat object.
Radius | Returns or sets a Single that represents the length of the radius for a glow effect. Read/write.
Transparency | Returns or sets the degree of transparency for the glow effect as a value between 0.0 (opaque) and 1.0 (clear). Read/write Single.


GlowFormat Properties (Word)

 Copy code hover
[image]

GlowFormat Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application. Read-only.
Color | Returns a ColorFormat object that represents the color for a glow effect. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified GlowFormat object.
Radius | Returns or sets a Single that represents the length of the radius for a glow effect. Read/write.
Transparency | Returns or sets the degree of transparency for the glow effect as a value between 0.0 (opaque) and 1.0 (clear). Read/write Single.


GlowFormat.Application Property (Word)

 Copy code hover
[image]

GlowFormat.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .Application

expression An expression that returns a GlowFormat object.

See also

Concepts

GlowFormat Object

Other resources

GlowFormat Object Members


GlowFormat.Color Property (Word)

 Copy code hover
[image]

GlowFormat.Color Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a ColorFormat object that represents the color for a glow effect. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Color

expression An expression that returns a GlowFormat object.

See also

Concepts

GlowFormat Object

Other resources

GlowFormat Object Members


GlowFormat.Creator Property (Word)

 Copy code hover
[image]

GlowFormat.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version Information

Version Added: Word 2010

Syntax

expression .Creator

expression An expression that returns a GlowFormat object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD". This property was primarily designed to be used on the Apple Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For more information about this property, see the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

GlowFormat Object

Other resources

GlowFormat Object Members


GlowFormat.Parent Property (Word)

 Copy code hover
[image]

GlowFormat.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified GlowFormat object.

Version Information

Version Added: Word 2010

Syntax

expression .Parent

expression An expression that returns a GlowFormat object.

See also

Concepts

GlowFormat Object

Other resources

GlowFormat Object Members


GlowFormat.Radius Property (Word)

 Copy code hover
[image]

GlowFormat.Radius Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Single that represents the length of the radius for a glow effect. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .Radius

expression An expression that returns a GlowFormat object.

See also

Concepts

GlowFormat Object

Other resources

GlowFormat Object Members


GlowFormat.Transparency Property (Word)

 Copy code hover
[image]

GlowFormat.Transparency Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the degree of transparency for the glow effect as a value between 0.0 (opaque) and 1.0 (clear). Read/write Single.

Version Information

Version Added: Word 2010

Syntax

expression .Transparency

expression An expression that returns a GlowFormat object.

See also

Concepts

GlowFormat Object

Other resources

GlowFormat Object Members


Gridlines Object (Word)

 Copy code hover
[image]

Gridlines Object (Word)
See also Send feedback

Published: July 16, 2012

Represents major or minor gridlines on a chart axis.

Version Information

Version Added: Word 2007

Remarks

Gridlines extend the tick marks on a chart axis to make it easier to see the values associated with the data markers. This object is not a collection. There is no object that represents a single gridline; you either enable all gridlines for an axis or disable all of them.

Use the MajorGridlines property to return the GridLines object that represents the major gridlines for the axis. Use the MinorGridlines property to return the GridLines object that represents the minor gridlines. It is possible to return both major and minor gridlines at the same time.

Example

The following example enables major gridlines for the category axis of the first chart in the active document and then formats the gridlines to be blue dashed lines.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.Axes(xlCategory)
 .HasMajorGridlines = True
 .MajorGridlines.Border.Color = RGB(0, 0, 255)
 .MajorGridlines.Border.LineStyle = xlDash
 End With
 End If
End With

See also

Concepts

Word Object Model Reference

Other resources

Gridlines Object Members


Gridlines Members (Word)

 Copy code hover
[image]

Gridlines Members (Word)
Send feedback

Published: July 16, 2012

Represents major or minor gridlines on a chart axis.

Methods

Name | Description
Delete | Deletes the object.
Select | Selects the object.

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
Border | Returns the border of the object. Read-only ChartBorder.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Format | Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.
Name | Returns the name of the object. Read-only String.
Parent | Returns the parent for the specified object. Read-only Object.


Gridlines Properties (Word)

 Copy code hover
[image]

Gridlines Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
Border | Returns the border of the object. Read-only ChartBorder.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Format | Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.
Name | Returns the name of the object. Read-only String.
Parent | Returns the parent for the specified object. Read-only Object.


Gridlines.Application Property (Word)

 Copy code hover
[image]

Gridlines.Application Property (Word)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Application

expression A variable that represents a GridLines object.

Example

The following example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveDocument
If myObject.Application.Value = "Microsoft Word" Then
 MsgBox "This is a Word Application object."
Else
 MsgBox "This is not a Word Application object."
End If

See also

Concepts

GridLines Object

Other resources

Gridlines Object Members


Gridlines.Border Property (Word)

 Copy code hover
[image]

Gridlines.Border Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the border of the object. Read-only ChartBorder.

Version Information

Version Added: Word 2007

Syntax

expression .Border

expression A variable that represents a GridLines object.

See also

Concepts

GridLines Object

Other resources

Gridlines Object Members


Gridlines.Creator Property (Word)

 Copy code hover
[image]

Gridlines.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version Information

Version Added: Word 2007

Syntax

expression .Creator

expression A variable that represents a GridLines object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD". This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Word has the creator code MSWD. For more information about this property, consult the language reference Help included with Microsoft Office for Mac.

See also

Concepts

GridLines Object

Other resources

Gridlines Object Members


Gridlines.Format Property (Word)

 Copy code hover
[image]

Gridlines.Format Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.

Version Information

Version Added: Word 2007

Syntax

expression .Format

expression A variable that represents a GridLines object.

See also

Concepts

GridLines Object

Other resources

Gridlines Object Members


Gridlines.Name Property (Word)

 Copy code hover
[image]

Gridlines.Name Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the name of the object. Read-only String.

Version Information

Version Added: Word 2007

Syntax

expression .Name

expression A variable that represents a GridLines object.

See also

Concepts

GridLines Object

Other resources

Gridlines Object Members


Gridlines.Parent Property (Word)

 Copy code hover
[image]

Gridlines.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the parent for the specified object. Read-only Object.

Version Information

Version Added: Word 2007

Syntax

expression .Parent

expression A variable that represents a GridLines object.

See also

Concepts

GridLines Object

Other resources

Gridlines Object Members


Gridlines Methods (Word)

 Copy code hover
[image]

Gridlines Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the object.
Select | Selects the object.


Gridlines.Delete Method (Word)

 Copy code hover
[image]

Gridlines.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Version Information

Version Added: Word 2007

Syntax

expression .Delete

expression A variable that represents a GridLines object.

See also

Concepts

GridLines Object

Other resources

Gridlines Object Members


Gridlines.Select Method (Word)

 Copy code hover
[image]

Gridlines.Select Method (Word)
See also Send feedback

Published: July 16, 2012

Selects the object.

Version Information

Version Added: Word 2007

Syntax

expression .Select

expression A variable that represents a GridLines object.

See also

Concepts

GridLines Object

Other resources

Gridlines Object Members


GroupShapes Object (Word)

 Copy code hover
[image]

GroupShapes Object (Word)
See also Send feedback

Published: July 16, 2012

Represents the individual shapes within a grouped shape. Each shape contained within a group of shapes is represented by a Shape object.

Remarks

Use the GroupItems property to return the GroupShapes collection. Use GroupItems(Index), where Index is the number of the individual shape within the grouped shape, to return a single shape from the GroupShapes collection. The following example adds three triangles to the active document, groups them, sets a color for the entire group, and then changes the color for the second triangle only.

VBA Copy code Copy code
With ActiveDocument.Shapes
 .AddShape(msoShapeIsoscelesTriangle, _
 10, 10, 100, 100).Name = "shpOne"
 .AddShape(msoShapeIsoscelesTriangle, _
 150, 10, 100, 100).Name = "shpTwo"
 .AddShape(msoShapeIsoscelesTriangle, _
 300, 10, 100, 100).Name = "shpThree"
 With .Range(Array("shpOne", "shpTwo", "shpThree")).Group
 .Fill.PresetTextured msoTextureBlueTissuePaper
 .GroupItems(2).Fill.PresetTextured msoTextureGreenMarble
 End With
End With

See also

Concepts

Word Object Model Reference

Other resources

GroupShapes Object Members


GroupShapes Members (Word)

 Copy code hover
[image]

GroupShapes Members (Word)
Send feedback

Published: July 16, 2012

Represents the individual shapes within a grouped shape. Each shape contained within a group of shapes is represented by a Shape object.

Methods

Name | Description
Item | Returns an individual Shape object in a collection.
Range | Returns a ShapeRange object.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of shapes in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified GroupShapes object.


GroupShapes Properties (Word)

 Copy code hover
[image]

GroupShapes Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of shapes in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified GroupShapes object.


GroupShapes.Application Property (Word)

 Copy code hover
[image]

GroupShapes.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a GroupShapes collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

GroupShapes Collection Object

Other resources

GroupShapes Object Members


GroupShapes.Count Property (Word)

 Copy code hover
[image]

GroupShapes.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of shapes in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents a GroupShapes collection.

See also

Concepts

GroupShapes Collection Object

Other resources

GroupShapes Object Members


GroupShapes.Creator Property (Word)

 Copy code hover
[image]

GroupShapes.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a GroupShapes collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

GroupShapes Collection Object

Other resources

GroupShapes Object Members


GroupShapes.Parent Property (Word)

 Copy code hover
[image]

GroupShapes.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified GroupShapes object.

Syntax

expression .Parent

expression Required. A variable that represents a GroupShapes collection.

See also

Concepts

GroupShapes Collection Object

Other resources

GroupShapes Object Members


GroupShapes Methods (Word)

 Copy code hover
[image]

GroupShapes Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Item | Returns an individual Shape object in a collection.
Range | Returns a ShapeRange object.


GroupShapes.Item Method (Word)

 Copy code hover
[image]

GroupShapes.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual Shape object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents a GroupShapes collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The individual object to be returned. Can be a Long indicating the ordinal position or a String representing the name of the individual object.

Return Value

Shape

See also

Concepts

GroupShapes Collection Object

Other resources

GroupShapes Object Members


GroupShapes.Range Method (Word)

 Copy code hover
[image]

GroupShapes.Range Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a ShapeRange object.

Syntax

expression .Range(Index)

expression Required. A variable that represents a GroupShapes collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | Specifies which shapes are to be included in the specified range. Can be an integer that specifies the index number of a shape within the Shapes collection, a string that specifies the name of a shape, or a array that contains integers or strings.

Return Value

ShapeRange

Remarks

ShapeRange objects don't include InlineShape objects. An InlineShape object is equivalent to a character and is positioned as a character within a range of text. Shape objects are anchored to a range of text (the selection, by default), but they can be positioned anywhere on the page. A Shape object will always appear on the same page as the range it is anchored to.

Most operations that you can do with a Shape object you can also do with a ShapeRange object that contains a single shape. Some operations, when performed on a ShapeRange object that contains multiple shapes, produce an error.

Example

This example sets the fill foreground color to purple for the first shape in the active document.

VBA Copy code Copy code
Sub ShRange()
 With ActiveDocument.Shapes.Range(1).Fill
 .ForeColor.RGB = RGB(255, 0, 255)
 .Visible = msoTrue
 End With
End Sub

This example applies a shadow to a variable shape in the active document.

VBA Copy code Copy code
Sub ShpRange2(strShpName As String)
 ActiveDocument.Shapes.Range(strShpName).Shadow.Type = msoShadow6
End Sub

To call the preceding subroutine, enter the following code into a standard code module.

VBA Copy code Copy code
Sub CallShpRange2()
 Dim shpArrow As Shape
 Dim strName As String

 Set shpArrow = ActiveDocument.Shapes.AddShape(Type:=msoShapeLeftArrow, _
 Left:=200, Top:=400, Width:=50, Height:=75)

 shpArrow.Name = "myShape"
 strName = shpArrow.Name
 ShpRange2 strShpName:=strName
End Sub

This example selects shapes one and three in the active document.

VBA Copy code Copy code
Sub SelectShapeRange()
 ActiveDocument.Shapes.Range(Array(1, 3)).Select
End Sub

This example selects and deletes the shapes in the first shape in the active document. This example assumes that the first shape is a canvas shape.

VBA Copy code Copy code
Sub CanvasShapeRange()
 Dim rngCanvasShapes As Range
 Set rngCanvasShapes = ActiveDocument.Shapes(1).CanvasItems.Range(1)
 rngCanvasShapes.Select
 rngCanvasShapes.Delete
End Sub

See also

Concepts

GroupShapes Collection Object

Other resources

GroupShapes Object Members


HangulAndAlphabetException Object (Word)

 Copy code hover
[image]

HangulAndAlphabetException Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a single Hangul or alphabet AutoCorrect exception. The HangulAndAlphabetException object is a member of the HangulAndAlphabetExceptions collection.

Remarks

Use HangulAndAlphabetExceptions(Index), where Index is the Hangul or alphabet AutoCorrect exception name or the index number, to return a single HangulAndAlphabetException object. The following example deletes the alphabet AutoCorrect exception named "hello."

VBA Copy code Copy code
AutoCorrect.HangulAndAlphabetExceptions("hello").Delete

The index number represents the position of the Hangul or alphabet AutoCorrect exception in the HangulAndAlphabetExceptions collection. The following example displays the name of the first item in the HangulAndAlphabetExceptions collection.

VBA Copy code Copy code
MsgBox AutoCorrect.HangulAndAlphabetExceptions(1).Name

If the value of the HangulAndAlphabetAutoAdd property is True, words are automatically added to the list of Hangul and alphabet AutoCorrect exceptions. Use the Add method to add an item to the HangulAndAlphabetExceptions collection. The following example adds "goodbye" to the list of alphabet AutoCorrect exceptions.

VBA Copy code Copy code
AutoCorrect.HangulAndAlphabetExceptions.Add Name:="goodbye"
Note Note

The HangulAndAlphabetExceptions collection includes all Hangul and alphabet AutoCorrect exceptions and corresponds to the items listed on the Korean tab in the AutoCorrect Exceptions dialog box.

See also

Concepts

Word Object Model Reference

Other resources

HangulAndAlphabetException Object Members


HangulAndAlphabetException Members (Word)

 Copy code hover
[image]

HangulAndAlphabetException Members (Word)
Send feedback

Published: July 16, 2012

Represents a single Hangul or alphabet AutoCorrect exception. The HangulAndAlphabetException object is a member of the HangulAndAlphabetExceptions collection.

Methods

Name | Description
Delete | Deletes the specified exception.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Index | Returns a Long that represents the position of an item in a collection. Read-only.
Name | Returns the name of the specified object. Read-only String.
Parent | Returns an Object that represents the parent object of the specified HangulAndAlphabetException object.


HangulAndAlphabetException Properties (Word)

 Copy code hover
[image]

HangulAndAlphabetException Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Index | Returns a Long that represents the position of an item in a collection. Read-only.
Name | Returns the name of the specified object. Read-only String.
Parent | Returns an Object that represents the parent object of the specified HangulAndAlphabetException object.


HangulAndAlphabetException.Application Property (Word)

 Copy code hover
[image]

HangulAndAlphabetException.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a HangulAndAlphabetException object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

HangulAndAlphabetException Object

Other resources

HangulAndAlphabetException Object Members


HangulAndAlphabetException.Creator Property (Word)

 Copy code hover
[image]

HangulAndAlphabetException.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a HangulAndAlphabetException object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

HangulAndAlphabetException Object

Other resources

HangulAndAlphabetException Object Members


HangulAndAlphabetException.Index Property (Word)

 Copy code hover
[image]

HangulAndAlphabetException.Index Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the position of an item in a collection. Read-only.

Syntax

expression .Index

expression Required. A variable that represents a HangulAndAlphabetException object.

See also

Concepts

HangulAndAlphabetException Object

Other resources

HangulAndAlphabetException Object Members


HangulAndAlphabetException.Name Property (Word)

 Copy code hover
[image]

HangulAndAlphabetException.Name Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the name of the specified object. Read-only String.

Syntax

expression .Name

expression Required. A variable that represents a HangulAndAlphabetException object.

See also

Concepts

HangulAndAlphabetException Object

Other resources

HangulAndAlphabetException Object Members


HangulAndAlphabetException.Parent Property (Word)

 Copy code hover
[image]

HangulAndAlphabetException.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified HangulAndAlphabetException object.

Syntax

expression .Parent

expression Required. A variable that represents a HangulAndAlphabetException object.

See also

Concepts

HangulAndAlphabetException Object

Other resources

HangulAndAlphabetException Object Members


HangulAndAlphabetException Methods (Word)

 Copy code hover
[image]

HangulAndAlphabetException Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the specified exception.


HangulAndAlphabetException.Delete Method (Word)

 Copy code hover
[image]

HangulAndAlphabetException.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the specified exception.

Syntax

expression .Delete

expression Required. A variable that represents a HangulAndAlphabetException object.

See also

Concepts

HangulAndAlphabetException Object

Other resources

HangulAndAlphabetException Object Members


HangulAndAlphabetExceptions Object (Word)

 Copy code hover
[image]

HangulAndAlphabetExceptions Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of HangulAndAlphabetException objects that represents all Hangul and alphabet AutoCorrect exceptions.

Remarks

Use the HangulAndAlphabetExceptions property to return the HangulAndAlphabetExceptions collection. The following example displays the items in this collection.

VBA Copy code Copy code
For Each aHan In AutoCorrect.HangulAndAlphabetExceptions
 MsgBox aHan.Name
Next aHan

If the value of the HangulAndAlphabetAutoAdd property is True, words are automatically added to the list of Hangul and alphabet AutoCorrect exceptions. Use the Add method to add an item to the HangulAndAlphabetExceptions collection. The following example adds "hello" to the list of alphabet AutoCorrect exceptions.

VBA Copy code Copy code
AutoCorrect.HangulAndAlphabetExceptions.Add Name:="hello"

Use HangulAndAlphabetExceptions(Index), where Index is the Hangul or alphabet AutoCorrect exception name or the index number, to return a single HangulAndAlphabetException object. The following example deletes the alphabet AutoCorrect exception named "goodbye."

VBA Copy code Copy code
AutoCorrect.HangulAndAlphabetExceptions("goodbye").Delete

The index number represents the position of the hangul or alphabet AutoCorrect exception in the HangulAndAlphabetExceptions collection. The following example displays the name of the first item in the HangulAndAlphabetExceptions collection.

VBA Copy code Copy code
MsgBox AutoCorrect.HangulAndAlphabetExceptions(1).Name
Note Note

The list of Hangul and alphabet AutoCorrect exceptions corresponds to the list of AutoCorrect exceptions on the Korean tab in the AutoCorrect Exceptions dialog box.

See also

Concepts

Word Object Model Reference

Other resources

HangulAndAlphabetExceptions Object Members


HangulAndAlphabetExceptions Members (Word)

 Copy code hover
[image]

HangulAndAlphabetExceptions Members (Word)
Send feedback

Published: July 16, 2012

A collection of HangulAndAlphabetException objects that represents all Hangul and alphabet AutoCorrect exceptions.

Methods

Name | Description
Add | Returns a HangulAndAlphabetException object that represents a new exception to the list of AutoCorrect exceptions.
Item | Returns an individual HangulAndAlphabetException object in a collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of exceptions in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified HangulAndAlphabetExceptions object.


HangulAndAlphabetExceptions Properties (Word)

 Copy code hover
[image]

HangulAndAlphabetExceptions Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of exceptions in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified HangulAndAlphabetExceptions object.


HangulAndAlphabetExceptions.Application Property (Word)

 Copy code hover
[image]

HangulAndAlphabetExceptions.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a HangulAndAlphabetExceptions collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

HangulAndAlphabetExceptions Collection Object

Other resources

HangulAndAlphabetExceptions Object Members


HangulAndAlphabetExceptions.Count Property (Word)

 Copy code hover
[image]

HangulAndAlphabetExceptions.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of exceptions in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents a HangulAndAlphabetExceptions collection.

See also

Concepts

HangulAndAlphabetExceptions Collection Object

Other resources

HangulAndAlphabetExceptions Object Members


HangulAndAlphabetExceptions.Creator Property (Word)

 Copy code hover
[image]

HangulAndAlphabetExceptions.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a HangulAndAlphabetExceptions collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

HangulAndAlphabetExceptions Collection Object

Other resources

HangulAndAlphabetExceptions Object Members


HangulAndAlphabetExceptions.Parent Property (Word)

 Copy code hover
[image]

HangulAndAlphabetExceptions.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified HangulAndAlphabetExceptions object.

Syntax

expression .Parent

expression Required. A variable that represents a HangulAndAlphabetExceptions collection.

See also

Concepts

HangulAndAlphabetExceptions Collection Object

Other resources

HangulAndAlphabetExceptions Object Members


HangulAndAlphabetExceptions Methods (Word)

 Copy code hover
[image]

HangulAndAlphabetExceptions Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Returns a HangulAndAlphabetException object that represents a new exception to the list of AutoCorrect exceptions.
Item | Returns an individual HangulAndAlphabetException object in a collection.


HangulAndAlphabetExceptions.Add Method (Word)

 Copy code hover
[image]

HangulAndAlphabetExceptions.Add Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a HangulAndAlphabetException object that represents a new exception to the list of AutoCorrect exceptions.

Syntax

expression .Add(Name)

expression Required. A variable that represents a HangulAndAlphabetExceptions collection.

Parameters

Name | Required/Optional | Data Type | Description
Name | Required | String | The word that you don't want Microsoft Word to correct automatically.

Return Value

HangulAndAlphabetException

Remarks

If the HangulAndAlphabetAutoAdd property is set to True, words are automatically added to the list of hangul and alphabet AutoCorrect exceptions.

For more information on using Word with East Asian languages, see Word features for East Asian languages .

Example

This example adds test to the list of hangul and alphabet AutoCorrect exceptions on the Korean tab in the AutoCorrect Exceptions dialog box.

VBA Copy code Copy code
AutoCorrect.HangulAndAlphabetExceptions.Add Name:="test"

See also

Concepts

HangulAndAlphabetExceptions Collection Object

Other resources

HangulAndAlphabetExceptions Object Members


HangulAndAlphabetExceptions.Item Method (Word)

 Copy code hover
[image]

HangulAndAlphabetExceptions.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual HangulAndAlphabetException object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents a HangulAndAlphabetExceptions collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The individual object to be returned. Can be a Long indicating the ordinal position or a String representing the name of the individual object.

Return Value

HangulAndAlphabetException

See also

Concepts

HangulAndAlphabetExceptions Collection Object

Other resources

HangulAndAlphabetExceptions Object Members


HangulHanjaConversionDictionaries Object (Word)

 Copy code hover
[image]

HangulHanjaConversionDictionaries Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of Dictionary objects that includes the active custom Hangul-Hanja conversion dictionaries.

Remarks

Use the HangulHanjaDictionaries property to return the collection of currently active custom conversion dictionaries. The following example displays the names of all the active custom conversion dictionaries.

VBA Copy code Copy code
For Each d In HangulHanjaDictionaries
 Msgbox d.Name
Next d

Use the Add method to add a new custom conversion dictionary to the collection of active custom conversion dictionaries. If there isn't a file with the name specified by FileName, Microsoft Word creates it. The following example adds "Hanja1.hhd" to the collection of custom conversion dictionaries.

VBA Copy code Copy code
CustomDictionaries.Add FileName:="Hanja1.hhd"

Use the ClearAll method to unload all custom conversion dictionaries. Note, however, that this method doesn't delete the dictionary files. After you use this method, the number of custom conversion dictionaries in the collection is 0 (zero). The following example clears the custom conversion dictionaries and creates a new custom conversion dictionary file. The new dictionary is set as the active custom dictionary to which Word will automatically add any new words it encounters.

VBA Copy code Copy code
With HangulHanjaDictionaries
 .ClearAll
 .Add FileName:= "Hanja1.hhd"
 .ActiveCustomDictionary = HangulHanjaDictionaries(1)
End With

You set the custom dictionary to which new words are added by using the ActiveCustomDictionary property. If you try to set this property to a dictionary that isn't a custom conversion dictionary, an error occurs.

The Maximum property returns the maximum number of simultaneous custom conversion dictionaries that the application can support. For Word, this maximum is 10.

See also

Concepts

Word Object Model Reference

Other resources

HangulHanjaConversionDictionaries Object Members


HangulHanjaConversionDictionaries Members (Word)

 Copy code hover
[image]

HangulHanjaConversionDictionaries Members (Word)
Send feedback

Published: July 16, 2012

A collection of Dictionary objects that includes the active custom Hangul-Hanja conversion dictionaries.

Methods

Name | Description
Add | Returns a Dictionary object that represents a new custom spelling or conversion dictionary added to the collection of active custom spelling or conversion dictionaries.
ClearAll | Unloads all of the custom or conversion dictionaries.
Item | Returns an individual Dictionary object in a collection.

Properties

Name | Description
ActiveCustomDictionary | Returns or sets a Dictionary object that represents the custom dictionary to which words will be added. Read/write.
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of dictionaries in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Maximum | Returns the maximum number of custom or conversion dictionaries allowed. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified HangulHanjaConversionDictionaries object.


HangulHanjaConversionDictionaries Properties (Word)

 Copy code hover
[image]

HangulHanjaConversionDictionaries Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
ActiveCustomDictionary | Returns or sets a Dictionary object that represents the custom dictionary to which words will be added. Read/write.
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of dictionaries in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Maximum | Returns the maximum number of custom or conversion dictionaries allowed. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified HangulHanjaConversionDictionaries object.


HangulHanjaConversionDictionaries.ActiveCustomDictionary Property (Word)

 Copy code hover
[image]

HangulHanjaConversionDictionaries.ActiveCustomDictionary Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Dictionary object that represents the custom dictionary to which words will be added. Read/write.

Syntax

expression .ActiveCustomDictionary

expression A variable that represents a HangulHanjaConversionDictionaries collection.

Example

This example displays the full path and file name of the active custom dictionary.

VBA Copy code Copy code
Set dicCustom = Application.CustomDictionaries.ActiveCustomDictionary
MsgBox dicCustom.Path & Application.PathSeparator & dicCustom.Name

This example clears all existing custom dictionaries, adds a custom dictionary named "Home.dic," and then loads the new dictionary.

VBA Copy code Copy code
Dim dicCustom As Dictionary

Application.CustomDictionaries.ClearAll

Set dicCustom = Application.CustomDictionaries _
 .Add(FileName:="C:\Program Files" _
 & "\Microsoft Office\Office\Home.dic")
Application.CustomDictionaries.ActiveCustomDictionary = dicCustom

See also

Concepts

HangulHanjaConversionDictionaries Collection Object

Other resources

HangulHanjaConversionDictionaries Object Members


HangulHanjaConversionDictionaries.Application Property (Word)

 Copy code hover
[image]

HangulHanjaConversionDictionaries.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a HangulHanjaConversionDictionaries collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

HangulHanjaConversionDictionaries Collection Object

Other resources

HangulHanjaConversionDictionaries Object Members


HangulHanjaConversionDictionaries.Count Property (Word)

 Copy code hover
[image]

HangulHanjaConversionDictionaries.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of dictionaries in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents a HangulHanjaConversionDictionaries collection.

See also

Concepts

HangulHanjaConversionDictionaries Collection Object

Other resources

HangulHanjaConversionDictionaries Object Members


HangulHanjaConversionDictionaries.Creator Property (Word)

 Copy code hover
[image]

HangulHanjaConversionDictionaries.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a HangulHanjaConversionDictionaries collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

HangulHanjaConversionDictionaries Collection Object

Other resources

HangulHanjaConversionDictionaries Object Members


HangulHanjaConversionDictionaries.Maximum Property (Word)

 Copy code hover
[image]

HangulHanjaConversionDictionaries.Maximum Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the maximum number of custom or conversion dictionaries allowed. Read-only Long.

Syntax

expression .Maximum

expression Required. A variable that represents a HangulHanjaConversionDictionaries collection.

See also

Concepts

HangulHanjaConversionDictionaries Collection Object

Other resources

HangulHanjaConversionDictionaries Object Members


HangulHanjaConversionDictionaries.Parent Property (Word)

 Copy code hover
[image]

HangulHanjaConversionDictionaries.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified HangulHanjaConversionDictionaries object.

Syntax

expression .Parent

expression Required. A variable that represents a HangulHanjaConversionDictionaries collection.

See also

Concepts

HangulHanjaConversionDictionaries Collection Object

Other resources

HangulHanjaConversionDictionaries Object Members


HangulHanjaConversionDictionaries Methods (Word)

 Copy code hover
[image]

HangulHanjaConversionDictionaries Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Returns a Dictionary object that represents a new custom spelling or conversion dictionary added to the collection of active custom spelling or conversion dictionaries.
ClearAll | Unloads all of the custom or conversion dictionaries.
Item | Returns an individual Dictionary object in a collection.


HangulHanjaConversionDictionaries.Add Method (Word)

 Copy code hover
[image]

HangulHanjaConversionDictionaries.Add Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a Dictionary object that represents a new custom spelling or conversion dictionary added to the collection of active custom spelling or conversion dictionaries.

Syntax

expression .Add(FileName)

expression Required. A variable that represents a HangulHanjaConversionDictionaries collection.

Parameters

Name | Required/Optional | Data Type | Description
FileName | Required | String | The string name of the dictionary file. If no path is specified in the string, the proofing tools path is used.

Return Value

Dictionary

Remarks

If a file with the name specified by the FileName parameter doesn't exist, Microsoft Word creates one.

The Dictionaries collection includes only the active custom spelling dictionaries. Dictionary objects that are derived from the Languages collection don't have an Add method. These include the Dictionary objects returned by the ActiveSpellingDictionary, ActiveGrammarDictionary, ActiveThesaurusDictionary, and ActiveHyphenationDictionary properties.

Use the HangulHanjaDictionaries property to return the collection of custom conversion dictionaries. The HangulHanjaConversionDictionaries collection includes only the active custom conversion dictionaries.

Example

This example removes all dictionaries from the list of custom conversion dictionaries and creates a new custom dictionary file. The new dictionary is assigned to be the active custom dictionary, to which new words are automatically added.

VBA Copy code Copy code
With HangulHanjaDictionaries
 .ClearAll
 .Add FileName:="C:\My Documents\MyCustom.hhd"
 .ActiveCustomDictionary = CustomDictionaries(1)
End With

See also

Concepts

HangulHanjaConversionDictionaries Collection Object

Other resources

HangulHanjaConversionDictionaries Object Members


HangulHanjaConversionDictionaries.ClearAll Method (Word)

 Copy code hover
[image]

HangulHanjaConversionDictionaries.ClearAll Method (Word)
See also Send feedback

Published: July 16, 2012

Unloads all of the custom or conversion dictionaries.

Syntax

expression .ClearAll

expression Required. A variable that represents a HangulHanjaConversionDictionaries collection.

Remarks

The ClearAll method does not delete the conversion dictionary files. After using this method, the number of conversion dictionaries in the collection is 0 (zero).

Example

This example unloads all of the conversion dictionaries.

VBA Copy code Copy code
HangulHanjaDictionaries.ClearAll

See also

Concepts

HangulHanjaConversionDictionaries Collection Object

Other resources

HangulHanjaConversionDictionaries Object Members


HangulHanjaConversionDictionaries.Item Method (Word)

 Copy code hover
[image]

HangulHanjaConversionDictionaries.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual Dictionary object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents a HangulHanjaConversionDictionaries collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The individual object to be returned. Can be a Long indicating the ordinal position or a String representing the name of the individual object.

Return Value

Dictionary

See also

Concepts

HangulHanjaConversionDictionaries Collection Object

Other resources

HangulHanjaConversionDictionaries Object Members


HeaderFooter Object (Word)

 Copy code hover
[image]

HeaderFooter Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a single header or footer. The HeaderFooter object is a member of the HeadersFooters collection. The HeadersFooters collection includes all headers and footers in the specified document section.

Remarks

Use Headers(Index) or Footers(Index), where index is one of the WdHeaderFooterIndex constants (wdHeaderFooterEvenPages, wdHeaderFooterFirstPage, or wdHeaderFooterPrimary), to return a single HeaderFooter object. The following example changes the text of both the primary header and the primary footer in the first section of the active document.

VBA Copy code Copy code
With ActiveDocument.Sections(1)
 .Headers(wdHeaderFooterPrimary).Range.Text = "Header text"
 .Footers(wdHeaderFooterPrimary).Range.Text = "Footer text"
End With

You can also return a single HeaderFooter object by using the HeaderFooter property with a Selection object.

Note Note

You cannot add HeaderFooter objects to the HeadersFooters collection.

Use the DifferentFirstPageHeaderFooter property with the PageSetup object to specify a different first page. The following example inserts text into the first page footer in the active document.

VBA Copy code Copy code
With ActiveDocument
 .PageSetup.DifferentFirstPageHeaderFooter = True
 .Sections(1).Footers(wdHeaderFooterFirstPage) _
 .Range.InsertBefore _
 "Written by Joe Smith"
End With

Use the OddAndEvenPagesHeaderFooter property with the PageSetup object to specify different odd and even page headers and footers. If the OddAndEvenPagesHeaderFooter property is True, you can return an odd header or footer by using wdHeaderFooterPrimary, and you can return an even header or footer by using wdHeaderFooterEvenPages.

Use the Add method with the PageNumbers object to add a page number to a header or footer. The following example adds page numbers to the primary footer in the first section of the active document.

VBA Copy code Copy code
With ActiveDocument.Sections(1)
 .Footers(wdHeaderFooterPrimary).PageNumbers.Add
End With

See also

Concepts

Word Object Model Reference

Other resources

HeaderFooter Object Members


HeaderFooter Members (Word)

 Copy code hover
[image]

HeaderFooter Members (Word)
Send feedback

Published: July 16, 2012

Represents a single header or footer. The HeaderFooter object is a member of the HeadersFooters collection. The HeadersFooters collection includes all headers and footers in the specified document section.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Exists | True if the specified HeaderFooter object exists. Read/write Boolean.
Index | Returns a WdHeaderFooterIndex that represents the specified header or footer in a document or section. Read-only.
IsHeader | True if the specified HeaderFooter object is a header. Read-only Boolean.
LinkToPrevious | True if the specified header or footer is linked to the corresponding header or footer in the previous section. Read/write Boolean.
PageNumbers | Returns a PageNumbers collection that represents all the page number fields included in the specified header or footer.
Parent | Returns an Object that represents the parent object of the specified HeaderFooter object.
Range | Returns a Range object that represents the portion of a document that is contained within the specified header or footer.
Shapes | Returns a Shapes collection that represents all the Shape objects in a header or footer. Read-only.


HeaderFooter Properties (Word)

 Copy code hover
[image]

HeaderFooter Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Exists | True if the specified HeaderFooter object exists. Read/write Boolean.
Index | Returns a WdHeaderFooterIndex that represents the specified header or footer in a document or section. Read-only.
IsHeader | True if the specified HeaderFooter object is a header. Read-only Boolean.
LinkToPrevious | True if the specified header or footer is linked to the corresponding header or footer in the previous section. Read/write Boolean.
PageNumbers | Returns a PageNumbers collection that represents all the page number fields included in the specified header or footer.
Parent | Returns an Object that represents the parent object of the specified HeaderFooter object.
Range | Returns a Range object that represents the portion of a document that is contained within the specified header or footer.
Shapes | Returns a Shapes collection that represents all the Shape objects in a header or footer. Read-only.


HeaderFooter.Application Property (Word)

 Copy code hover
[image]

HeaderFooter.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a HeaderFooter object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

HeaderFooter Object

Other resources

HeaderFooter Object Members


HeaderFooter.Creator Property (Word)

 Copy code hover
[image]

HeaderFooter.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a HeaderFooter object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

HeaderFooter Object

Other resources

HeaderFooter Object Members


HeaderFooter.Exists Property (Word)

 Copy code hover
[image]

HeaderFooter.Exists Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified HeaderFooter object exists. Read/write Boolean.

Syntax

expression .Exists

expression A variable that represents a HeaderFooter object.

Remarks

The primary header and footer exist in all new documents by default. Use this method to determine whether a first-page or odd-page header or footer exists. You can also use the DifferentFirstPageHeaderFooter or OddAndEvenPagesHeaderFooter property to return or set the number of headers and footers in the specified document or section.

Example

If a first-page header exists in section one, this example sets the text for the header.

VBA Copy code Copy code
Dim secTemp As Section

Set secTemp = ActiveDocument.Sections(1)
If secTemp.Headers(wdHeaderFooterFirstPage).Exists = True Then
 secTemp.Headers(wdHeaderFooterFirstPage).Range.Text = _
 "First Page"
End If

See also

Concepts

HeaderFooter Object

Other resources

HeaderFooter Object Members


HeaderFooter.Index Property (Word)

 Copy code hover
[image]

HeaderFooter.Index Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a WdHeaderFooterIndex that represents the specified header or footer in a document or section. Read-only.

Syntax

expression .Index

expression Required. A variable that represents a HeaderFooter object.

Example

This example adds a shape to the first page header in the active document if the specified variable references the first page header.

VBA Copy code Copy code
Sub ChangeFirstPageFooter()
 Dim hdrFirstPage As HeaderFooter

 Set hdrFirstPage = ActiveDocument.Sections(1).Headers(wdHeaderFooterFirstPage)

 If hdrFirstPage.Index = wdHeaderFooterFirstPage Then
 With hdrFirstPage.Shapes.AddShape(Type:=msoShapeHeart, _
 Left:=36, Top:=36, Width:=36, Height:=36)
 .Fill.ForeColor.RGB = RGB(Red:=255, Green:=0, Blue:=0)
 End With
 End If

End Sub

See also

Concepts

HeaderFooter Object

Other resources

HeaderFooter Object Members


HeaderFooter.IsHeader Property (Word)

 Copy code hover
[image]

HeaderFooter.IsHeader Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified HeaderFooter object is a header. Read-only Boolean.

Syntax

expression .IsHeader

expression An expression that returns a HeaderFooter object.

Example

This example selects the footer and adds a page number.

VBA Copy code Copy code
With ActiveDocument.ActiveWindow.ActivePane.View
 .Type = wdPrintView
 .SeekView = wdSeekCurrentPageHeader
End With

If Selection.HeaderFooter.IsHeader = True Then
 ActiveDocument.ActiveWindow.ActivePane.View _
 .SeekView = wdSeekCurrentPageFooter
End If

Selection.HeaderFooter.PageNumbers.Add

See also

Concepts

HeaderFooter Object

Other resources

HeaderFooter Object Members


HeaderFooter.LinkToPrevious Property (Word)

 Copy code hover
[image]

HeaderFooter.LinkToPrevious Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified header or footer is linked to the corresponding header or footer in the previous section. Read/write Boolean.

Syntax

expression .LinkToPrevious

expression An expression that returns a HeaderFooter object.

Remarks

When a header or footer is linked, its contents are the same as in the previous header or footer. Because the LinkToPrevious property is set to True by default, you can add headers, footers, and page numbers to your entire document by working with the headers, footers, and page numbers in the first section. For instance, the following example adds page numbers to the header on all pages in all sections of the active document.

VBA Copy code Copy code
ActiveDocument.Sections(1) _
 .Headers(wdHeaderFooterPrimary).PageNumbers.Add

The LinkToPrevious property applies to each header or footer individually. For example, the LinkToPrevious property could be set to True for the even-numbered-page header but False for the even-numbered-page footer.

Example

The first part of this example creates a new document with two sections. The second part creates unique headers for even-numbered and odd-numbered pages in sections one and two in the new document.

VBA Copy code Copy code
Documents.Add
With Selection
 For j = 1 to 4
 .TypeParagraph
 .InsertBreak
 .TypeParagraph
 Next j
End With
With ActiveDocument
 .Paragraphs(5).Range.InsertBreak Type:=wdSectionBreakNextPage
 .PageSetup.OddAndEvenPagesHeaderFooter = True
End With
With ActiveDocument.Sections(2)
 With .Headers(wdHeaderFooterPrimary)
 .LinkToPrevious = False
 .Range.InsertBefore "Section 2 Odd Header"
 End With
 With .Headers(wdHeaderFooterEvenPages)
 .LinkToPrevious = False
 .Range.InsertBefore "Section 2 Even Header"
 End With
End With
With ActiveDocument.Sections(1)
 .Headers(wdHeaderFooterPrimary) _
 .Range.InsertBefore "Section 1 Odd Header"
 .Headers(wdHeaderFooterEvenPages) _
 .Range.InsertBefore "Section 1 Even Header"
End With

See also

Concepts

HeaderFooter Object

Other resources

HeaderFooter Object Members


HeaderFooter.PageNumbers Property (Word)

 Copy code hover
[image]

HeaderFooter.PageNumbers Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a PageNumbers collection that represents all the page number fields included in the specified header or footer.

Syntax

expression .PageNumbers

expression An expression that returns a HeaderFooter object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example creates a new document and adds page numbers to the footer.

VBA Copy code Copy code
Set myDoc = Documents.Add
With myDoc.Sections(1).Footers(wdHeaderFooterPrimary)
 .PageNumbers.Add PageNumberAlignment := wdAlignPageNumberCenter
End With

See also

Concepts

HeaderFooter Object

Other resources

HeaderFooter Object Members


HeaderFooter.Parent Property (Word)

 Copy code hover
[image]

HeaderFooter.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified HeaderFooter object.

Syntax

expression .Parent

expression Required. A variable that represents a HeaderFooter object.

See also

Concepts

HeaderFooter Object

Other resources

HeaderFooter Object Members


HeaderFooter.Range Property (Word)

 Copy code hover
[image]

HeaderFooter.Range Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the portion of a document that is contained within the specified header or footer.

Syntax

expression .Range

expression Required. A variable that represents a HeaderFooter object.

See also

Concepts

HeaderFooter Object

Other resources

HeaderFooter Object Members


HeaderFooter.Shapes Property (Word)

 Copy code hover
[image]

HeaderFooter.Shapes Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Shapes collection that represents all the Shape objects in a header or footer. Read-only.

Syntax

expression .Shapes

expression A variable that represents a HeaderFooter object.

Remarks

This collection can contain drawings, shapes, pictures, OLE objects, ActiveX controls, text objects, and callouts. For information about returning a single member of a collection, see Returning an Object from a Collection.

The Shapes property, when applied to a document, returns all the Shape objects in the main story of the document, excluding the headers and footers. When applied to a HeaderFooter object, the Shapes property returns all the Shape objects found in all the headers and footers in the document.

Example

This example displays a count of all the shapes in the primary header and footer of the first section of the active document.

VBA Copy code Copy code
MsgBox ActiveDocument.Sections(1). _
 Headers(wdHeaderFooterPrimary).Shapes.Count

See also

Concepts

HeaderFooter Object

Other resources

HeaderFooter Object Members


HeadersFooters Object (Word)

 Copy code hover
[image]

HeadersFooters Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of HeaderFooter objects that represent the headers or footers in the specified section of a document.

Remarks

Use the Headers or Footers property to return the HeadersFooters collection. The following example displays the text from the primary footer in the first section of the active document.

VBA Copy code Copy code
With ActiveDocument.Sections(1).Footers(wdHeaderFooterPrimary)
 If .Range.Text <> vbCr Then
 MsgBox .Range.Text
 Else
 MsgBox "Footer is empty"
 End If
End With
Note Note

You cannot add HeaderFooter objects to the HeadersFooters collection.

Use Headers(Index) or Footers(Index), where index is one of the WdHeaderFooterIndex constants (wdHeaderFooterEvenPages, wdHeaderFooterFirstPage, or wdHeaderFooterPrimary), to return a single HeaderFooter object. The following example changes the text of both the primary header and the primary footer the first section of the active document.

VBA Copy code Copy code
With ActiveDocument.Sections(1)
 .Headers(wdHeaderFooterPrimary).Range.Text = "Header text"
 .Footers(wdHeaderFooterPrimary).Range.Text = "Footer text"
End With

You can also return a single HeaderFooter object by using the HeaderFooter property with a Selection object.

Use the DifferentFirstPageHeaderFooter property with the PageSetup object to specify a different first page. The following example inserts text into the first page footer in the active document.

VBA Copy code Copy code
With ActiveDocument
 .PageSetup.DifferentFirstPageHeaderFooter = True
 .Sections(1).Footers(wdHeaderFooterFirstPage) _
 .Range.InsertBefore _
 "Written by Kate Edson"
End With

Use the OddAndEvenPagesHeaderFooter property with the PageSetup object to specify different odd and even page headers and footers. If the OddAndEvenPagesHeaderFooter property is True, you can return an odd header or footer by using wdHeaderFooterPrimary, and you can return an even header or footer by using wdHeaderFooterEvenPages.

Use the Add method with the PageNumbers object to add a page number to a header or footer. The following example adds page numbers to the first page footer in the first section in the active document.

VBA Copy code Copy code
With ActiveDocument.Sections(1)
 .PageSetup.DifferentFirstPageHeaderFooter = True
 .Footers(wdHeaderFooterPrimary).PageNumbers.Add _
 FirstPage:=True
End With

See also

Concepts

Word Object Model Reference

Other resources

HeadersFooters Object Members


HeadersFooters Members (Word)

 Copy code hover
[image]

HeadersFooters Members (Word)
Send feedback

Published: July 16, 2012

A collection of HeaderFooter objects that represent the headers or footers in the specified section of a document.

Methods

Name | Description
Item | Returns a HeaderFooter object that represents a header or footer in a range or section.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of headers and/or footers in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified HeadersFooters object.


HeadersFooters Properties (Word)

 Copy code hover
[image]

HeadersFooters Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of headers and/or footers in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified HeadersFooters object.


HeadersFooters.Application Property (Word)

 Copy code hover
[image]

HeadersFooters.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a HeadersFooters collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

HeadersFooters Collection Object

Other resources

HeadersFooters Object Members


HeadersFooters.Count Property (Word)

 Copy code hover
[image]

HeadersFooters.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of headers and/or footers in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents a HeadersFooters collection.

See also

Concepts

HeadersFooters Collection Object

Other resources

HeadersFooters Object Members


HeadersFooters.Creator Property (Word)

 Copy code hover
[image]

HeadersFooters.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a HeadersFooters collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

HeadersFooters Collection Object

Other resources

HeadersFooters Object Members


HeadersFooters.Parent Property (Word)

 Copy code hover
[image]

HeadersFooters.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified HeadersFooters object.

Syntax

expression .Parent

expression Required. A variable that represents a HeadersFooters collection.

See also

Concepts

HeadersFooters Collection Object

Other resources

HeadersFooters Object Members


HeadersFooters Methods (Word)

 Copy code hover
[image]

HeadersFooters Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Item | Returns a HeaderFooter object that represents a header or footer in a range or section.


HeadersFooters.Item Method (Word)

 Copy code hover
[image]

HeadersFooters.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a HeaderFooter object that represents a header or footer in a range or section.

Syntax

expression .Item(Index)

expression Required. A variable that represents a HeadersFooters collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | WdHeaderFooterIndex | A constant that specifies the header or footer in the range or section.

Return Value

HeaderFooter

Example

This example creates and formats a first page header in the active document.

VBA Copy code Copy code
Sub HeadFootItem()
 ActiveDocument.PageSetup.DifferentFirstPageHeaderFooter = True
 With ActiveDocument.Sections(1).Headers _
 .Item(wdHeaderFooterFirstPage).Range
 .InsertBefore "Sales Report"
 With .Font
 .Bold = True
 .Size = "15"
 .Color = wdColorBlue
 End With
 .Paragraphs.Alignment = wdAlignParagraphCenter
 End With
End Sub

See also

Concepts

HeadersFooters Collection Object

Other resources

HeadersFooters Object Members


HeadingStyle Object (Word)

 Copy code hover
[image]

HeadingStyle Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a style used to build a table of contents or figures. The HeadingStyle object is a member of the HeadingStyles collection.

Remarks

Use HeadingStyles(Index), where Index is the index number, to return a single HeadingStyle object. The index number represents the position of the style in the HeadingStyles collection. The following example adds (at the beginning of the active document) a table of figures built from the Title style, and then displays the name of the first style in the HeadingStyles collection.

VBA Copy code Copy code
Set myTOF = ActiveDocument.TablesOfFigures.Add _
 (Range:=ActiveDocument.Range(0, 0), AddedStyles:="Title")
MsgBox myTOF.HeadingStyles(1).Style

Use the Add method to add a style to the HeadingStyles collection. The following example adds a table of contents at the beginning of the active document and then adds the Title style to the list of styles used to build a table of contents.

VBA Copy code Copy code
Set myToc = ActiveDocument.TablesOfContents.Add _
 (Range:=ActiveDocument.Range(0, 0), UseHeadingStyles:=True, _
 LowerHeadingLevel:=3, UpperHeadingLevel:=1)
myToc.HeadingStyles.Add Style:="Title", Level:=2

See also

Concepts

Word Object Model Reference

Other resources

HeadingStyle Object Members


HeadingStyle Members (Word)

 Copy code hover
[image]

HeadingStyle Members (Word)
Send feedback

Published: July 16, 2012

Represents a style used to build a table of contents or figures. The HeadingStyle object is a member of the HeadingStyles collection.

Methods

Name | Description
Delete | Deletes the specified heading style.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Level | Returns or sets the level for the heading style in a table of contents or table of figures. Read/write Integer.
Parent | Returns an Object that represents the parent object of the specified HeadingStyle object.
Style | Returns or sets the style for a heading. Read/write Variant.


HeadingStyle Properties (Word)

 Copy code hover
[image]

HeadingStyle Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Level | Returns or sets the level for the heading style in a table of contents or table of figures. Read/write Integer.
Parent | Returns an Object that represents the parent object of the specified HeadingStyle object.
Style | Returns or sets the style for a heading. Read/write Variant.


HeadingStyle.Application Property (Word)

 Copy code hover
[image]

HeadingStyle.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a HeadingStyle object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

HeadingStyle Object

Other resources

HeadingStyle Object Members


HeadingStyle.Creator Property (Word)

 Copy code hover
[image]

HeadingStyle.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a HeadingStyle object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

HeadingStyle Object

Other resources

HeadingStyle Object Members


HeadingStyle.Level Property (Word)

 Copy code hover
[image]

HeadingStyle.Level Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the level for the heading style in a table of contents or table of figures. Read/write Integer.

Syntax

expression .Level

expression Required. A variable that represents a HeadingStyle object.

Example

This example adds a table of contents at the insertion point in the active document, and then it changes the levels for the heading styles.

VBA Copy code Copy code
ActiveDocument.TablesOfContents.Add _
 Range:=Selection.Range, _
 RightAlignPageNumbers:=True, _
 UseHeadingStyles:=True, _
 UpperHeadingLevel:=1, _
 LowerHeadingLevel:=3, _
 IncludePageNumbers:=True, _
 TableID:=wdTOCFormal
With ActiveDocument.TablesOfContents(1).HeadingStyles
 .Add Style:="Title", Level:=1
 .Add Style:="SubTitle", Level:=2
 .Add Style:="List Bullet", Level:=3
End With
With ActiveDocument.TablesOfContents(1)
 .HeadingStyles(1).Level = 2
 .HeadingStyles(2).Level = 4
 .HeadingStyles(3).Level = 6
End With

See also

Concepts

HeadingStyle Object

Other resources

HeadingStyle Object Members


HeadingStyle.Parent Property (Word)

 Copy code hover
[image]

HeadingStyle.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified HeadingStyle object.

Syntax

expression .Parent

expression Required. A variable that represents a HeadingStyle object.

See also

Concepts

HeadingStyle Object

Other resources

HeadingStyle Object Members


HeadingStyle.Style Property (Word)

 Copy code hover
[image]

HeadingStyle.Style Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the style for a heading. Read/write Variant.

Syntax

expression .Style

expression Required. A variable that represents a HeadingStyle object.

Remarks

To set this property, specify the local name of the style, an integer, a WdBuiltinStyle constant, or an object that represents the style.

See also

Concepts

HeadingStyle Object

Other resources

HeadingStyle Object Members


HeadingStyle Methods (Word)

 Copy code hover
[image]

HeadingStyle Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the specified heading style.


HeadingStyle.Delete Method (Word)

 Copy code hover
[image]

HeadingStyle.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the specified heading style.

Syntax

expression .Delete

expression Required. A variable that represents a HeadingStyle object.

See also

Concepts

HeadingStyle Object

Other resources

HeadingStyle Object Members


HeadingStyles Object (Word)

 Copy code hover
[image]

HeadingStyles Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of HeadingStyle objects that represent the styles used to compile a table of figures or table of contents.

Remarks

Use the HeadingStyles property to return the HeadingStyles collection. The following example displays the number of items in the HeadingStyles collection for the first table of contents in the active document.

VBA Copy code Copy code
MsgBox ActiveDocument.TablesOfContents(1).HeadingStyles.Count

Use the Add method to add a style to the HeadingStyles collection. The following example adds a table of contents at the beginning of the active document and then adds the Title style to the list of styles used to build a table of contents.

VBA Copy code Copy code
Set myToc = ActiveDocument.TablesOfContents.Add _
 (Range:=ActiveDocument.Range(0, 0), UseHeadingStyles:=True, _
 LowerHeadingLevel:=3, UpperHeadingLevel:=1)
myToc.HeadingStyles.Add Style:="Title", Level:=2

Use HeadingStyles(Index), where Index is the index number, to return a single HeadingStyle object. The index number represents the position of the style in the HeadingStyles collection. The following example adds (at the beginning of the active document) a table of figures built from the Title style, and then displays the name of the first style in the HeadingStyles collection.

VBA Copy code Copy code
Set myTOF = ActiveDocument.TablesOfFigures.Add _
 (Range:=ActiveDocument.Range(0, 0), AddedStyles:="Title")
MsgBox myTOF.HeadingStyles(1).Style

See also

Concepts

Word Object Model Reference

Other resources

HeadingStyles Object Members


HeadingStyles Members (Word)

 Copy code hover
[image]

HeadingStyles Members (Word)
Send feedback

Published: July 16, 2012

A collection of HeadingStyle objects that represent the styles used to compile a table of figures or table of contents.

Methods

Name | Description
Add | Returns a HeadingStyle object that represents a new heading style added to a document. The new heading style will be included whenever you compile a table of contents or table of figures.
Item | Returns an individual HeadingStyle object in a collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of heading styles in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified HeadingStyles object.


HeadingStyles Properties (Word)

 Copy code hover
[image]

HeadingStyles Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of heading styles in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified HeadingStyles object.


HeadingStyles.Application Property (Word)

 Copy code hover
[image]

HeadingStyles.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a HeadingStyles collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

HeadingStyles Collection Object

Other resources

HeadingStyles Object Members


HeadingStyles.Count Property (Word)

 Copy code hover
[image]

HeadingStyles.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of heading styles in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents a HeadingStyles collection.

See also

Concepts

HeadingStyles Collection Object

Other resources

HeadingStyles Object Members


HeadingStyles.Creator Property (Word)

 Copy code hover
[image]

HeadingStyles.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a HeadingStyles collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

HeadingStyles Collection Object

Other resources

HeadingStyles Object Members


HeadingStyles.Parent Property (Word)

 Copy code hover
[image]

HeadingStyles.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified HeadingStyles object.

Syntax

expression .Parent

expression Required. A variable that represents a HeadingStyles collection.

See also

Concepts

HeadingStyles Collection Object

Other resources

HeadingStyles Object Members


HeadingStyles Methods (Word)

 Copy code hover
[image]

HeadingStyles Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Returns a HeadingStyle object that represents a new heading style added to a document. The new heading style will be included whenever you compile a table of contents or table of figures.
Item | Returns an individual HeadingStyle object in a collection.


HeadingStyles.Add Method (Word)

 Copy code hover
[image]

HeadingStyles.Add Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a HeadingStyle object that represents a new heading style added to a document. The new heading style will be included whenever you compile a table of contents or table of figures.

Syntax

expression .Add(Style, Level)

expression Required. A variable that represents a HeadingStyles collection.

Parameters

Name | Required/Optional | Data Type | Description
Style | Required | Variant | The style you want to add. You can specify this argument by using either the string name for the style or a Style object.
Level | Required | Integer | A number that represents the level of the heading.

Return Value

HeadingStyle

Example

This example adds a table of contents at the beginning of the active document and then adds the Title style to the list of styles used to build a table of contents.

VBA Copy code Copy code
Set myToc = ActiveDocument.TablesOfContents _
 .Add(Range:=ActiveDocument.Range(0, 0), _
 UseHeadingStyles:=True, UpperHeadingLevel:=1, _
 LowerHeadingLevel:=3)
myToc.HeadingStyles.Add Style:="Title", Level:=2

See also

Concepts

HeadingStyles Collection Object

Other resources

HeadingStyles Object Members


HeadingStyles.Item Method (Word)

 Copy code hover
[image]

HeadingStyles.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual HeadingStyle object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents a HeadingStyles collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The individual object to be returned. Can be a Long indicating the ordinal position of the individual object.

Return Value

HeadingStyle

See also

Concepts

HeadingStyles Collection Object

Other resources

HeadingStyles Object Members


HiLoLines Object (Word)

 Copy code hover
[image]

HiLoLines Object (Word)
See also Send feedback

Published: July 16, 2012

Represents the high-low lines in a chart group.

Version Information

Version Added: Word 2007

Remarks

High-low lines connect the highest point with the lowest point in every category in the chart group. Only 2-D line groups can have high-low lines. This object is not a collection. There is no object that represents a single high-low line; you either enable high-low lines for all points in a chart group or disable them.

If the HasHiLoLines property is False, most properties of the HiLoLines object are disabled.

Example

Use the HiLoLines property to return the HiLoLines object. The following example uses the HasHiLowLines property to add high-low lines to the first chart (the chart must be a line chart) in the active document. The example then makes the high-low lines blue.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With Chart.ChartGroups(1)
 .HasHighLowLines = True
 .HiLoLines.Border.Color = RGB(0, 0, 255)
 End With
 End If
End With

See also

Concepts

Word Object Model Reference

Other resources

HiLoLines Object Members


HiLoLines Members (Word)

 Copy code hover
[image]

HiLoLines Members (Word)
Send feedback

Published: July 16, 2012

Represents the high-low lines in a chart group.

Methods

Name | Description
Delete | Deletes the object.
Select | Selects the object.

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
Border | Returns the border of the object. Read-only ChartBorder.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Format | Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.
Name | Returns the name of the object. Read-only String.
Parent | Returns the parent for the specified object. Read-only Object.


HiLoLines Properties (Word)

 Copy code hover
[image]

HiLoLines Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
Border | Returns the border of the object. Read-only ChartBorder.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Format | Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.
Name | Returns the name of the object. Read-only String.
Parent | Returns the parent for the specified object. Read-only Object.


HiLoLines.Application Property (Word)

 Copy code hover
[image]

HiLoLines.Application Property (Word)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Application

expression A variable that represents a HiLoLines object.

Example

The following example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveDocument
If myObject.Application.Value = "Microsoft Word" Then
 MsgBox "This is a Word Application object."
Else
 MsgBox "This is not a Word Application object."
End If

See also

Concepts

HiLoLines Object

Other resources

HiLoLines Object Members


HiLoLines.Border Property (Word)

 Copy code hover
[image]

HiLoLines.Border Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the border of the object. Read-only ChartBorder.

Version Information

Version Added: Word 2007

Syntax

expression .Border

expression A variable that represents a HiLoLines object.

See also

Concepts

HiLoLines Object

Other resources

HiLoLines Object Members


HiLoLines.Creator Property (Word)

 Copy code hover
[image]

HiLoLines.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version Information

Version Added: Word 2007

Syntax

expression .Creator

expression A variable that represents a HiLoLines object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD". This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Word has the creator code MSWD. For more information about this property, consult the language reference Help included with Microsoft Office for Mac.

See also

Concepts

HiLoLines Object

Other resources

HiLoLines Object Members


HiLoLines.Format Property (Word)

 Copy code hover
[image]

HiLoLines.Format Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.

Version Information

Version Added: Word 2007

Syntax

expression .Format

expression A variable that represents a HiLoLines object.

See also

Concepts

HiLoLines Object

Other resources

HiLoLines Object Members


HiLoLines.Name Property (Word)

 Copy code hover
[image]

HiLoLines.Name Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the name of the object. Read-only String.

Version Information

Version Added: Word 2007

Syntax

expression .Name

expression A variable that represents a HiLoLines object.

See also

Concepts

HiLoLines Object

Other resources

HiLoLines Object Members


HiLoLines.Parent Property (Word)

 Copy code hover
[image]

HiLoLines.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the parent for the specified object. Read-only Object.

Version Information

Version Added: Word 2007

Syntax

expression .Parent

expression A variable that represents a HiLoLines object.

See also

Concepts

HiLoLines Object

Other resources

HiLoLines Object Members


HiLoLines Methods (Word)

 Copy code hover
[image]

HiLoLines Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the object.
Select | Selects the object.


HiLoLines.Delete Method (Word)

 Copy code hover
[image]

HiLoLines.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Version Information

Version Added: Word 2007

Syntax

expression .Delete

expression A variable that represents a HiLoLines object.

See also

Concepts

HiLoLines Object

Other resources

HiLoLines Object Members


HiLoLines.Select Method (Word)

 Copy code hover
[image]

HiLoLines.Select Method (Word)
See also Send feedback

Published: July 16, 2012

Selects the object.

Version Information

Version Added: Word 2007

Syntax

expression .Select

expression A variable that represents a HiLoLines object.

See also

Concepts

HiLoLines Object

Other resources

HiLoLines Object Members


HorizontalLineFormat Object (Word)

 Copy code hover
[image]

HorizontalLineFormat Object (Word)
See also Send feedback

Published: July 16, 2012

Represents horizontal line formatting.

Remarks

Use the HorizontalLineFormat property to return a HorizontalLineFormat object. This example sets the alignment for a new horizontal line.

VBA Copy code Copy code
Selection.InlineShapes.AddHorizontalLineStandard
ActiveDocument.InlineShapes(1) _
 .HorizontalLineFormat.Alignment = _
 wdHorizontalLineAlignLeft

This example adds a horizontal line without any 3-D shading.

VBA Copy code Copy code
Selection.InlineShapes.AddHorizontalLineStandard
ActiveDocument.InlineShapes(1) _
 .HorizontalLineFormat.NoShade = True

This example adds a horizontal line and sets its length to 50% of the window width.

VBA Copy code Copy code
Selection.InlineShapes.AddHorizontalLineStandard
ActiveDocument.InlineShapes(1) _
 .HorizontalLineFormat.PercentWidth = 50

See also

Concepts

Word Object Model Reference

Other resources

HorizontalLineFormat Object Members


HorizontalLineFormat Members (Word)

 Copy code hover
[image]

HorizontalLineFormat Members (Word)
Send feedback

Published: July 16, 2012

Represents horizontal line formatting.

Properties

Name | Description
Alignment | Returns or sets a WdHorizontalLineAlignment constant that represents the alignment for the specified horizontal line. Read/write.
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
NoShade | True if Microsoft Word draws the specified horizontal line without 3-D shading. Read/write Boolean.
Parent | Returns an Object that represents the parent object of the specified HorizontalLineFormat object.
PercentWidth | Returns or sets the length of the specified horizontal line expressed as a percentage of the window width. Read/write Single.
WidthType | Returns or sets the width type for the specified HorizontalLineFormat object. Read/write WdHorizontalLineWidthType.


HorizontalLineFormat Properties (Word)

 Copy code hover
[image]

HorizontalLineFormat Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Alignment | Returns or sets a WdHorizontalLineAlignment constant that represents the alignment for the specified horizontal line. Read/write.
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
NoShade | True if Microsoft Word draws the specified horizontal line without 3-D shading. Read/write Boolean.
Parent | Returns an Object that represents the parent object of the specified HorizontalLineFormat object.
PercentWidth | Returns or sets the length of the specified horizontal line expressed as a percentage of the window width. Read/write Single.
WidthType | Returns or sets the width type for the specified HorizontalLineFormat object. Read/write WdHorizontalLineWidthType.


HorizontalLineFormat.Alignment Property (Word)

 Copy code hover
[image]

HorizontalLineFormat.Alignment Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a WdHorizontalLineAlignment constant that represents the alignment for the specified horizontal line. Read/write.

Syntax

expression .Alignment

expression Required. A variable that represents a HorizontalLineFormat object.

See also

Concepts

HorizontalLineFormat Object

Other resources

HorizontalLineFormat Object Members


HorizontalLineFormat.Application Property (Word)

 Copy code hover
[image]

HorizontalLineFormat.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a HorizontalLineFormat object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

HorizontalLineFormat Object

Other resources

HorizontalLineFormat Object Members


HorizontalLineFormat.Creator Property (Word)

 Copy code hover
[image]

HorizontalLineFormat.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a HorizontalLineFormat object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

HorizontalLineFormat Object

Other resources

HorizontalLineFormat Object Members


HorizontalLineFormat.NoShade Property (Word)

 Copy code hover
[image]

HorizontalLineFormat.NoShade Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word draws the specified horizontal line without 3-D shading. Read/write Boolean.

Syntax

expression .NoShade

expression An expression that returns a HorizontalLineFormat object.

Remarks

You can only use this property with horizontal lines that are not based on an existing image file.

Example

This example adds a horizontal line without any 3-D shading.

VBA Copy code Copy code
Selection.InlineShapes.AddHorizontalLineStandard
ActiveDocument.InlineShapes(1) _
 .HorizontalLineFormat.NoShade = True

See also

Concepts

HorizontalLineFormat Object

Other resources

HorizontalLineFormat Object Members


HorizontalLineFormat.Parent Property (Word)

 Copy code hover
[image]

HorizontalLineFormat.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified HorizontalLineFormat object.

Syntax

expression .Parent

expression Required. A variable that represents a HorizontalLineFormat object.

See also

Concepts

HorizontalLineFormat Object

Other resources

HorizontalLineFormat Object Members


HorizontalLineFormat.PercentWidth Property (Word)

 Copy code hover
[image]

HorizontalLineFormat.PercentWidth Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the length of the specified horizontal line expressed as a percentage of the window width. Read/write Single.

Syntax

expression .PercentWidth

expression An expression that returns a HorizontalLineFormat object.

Remarks

Setting this property also sets the WidthType property to wdHorizontalLinePercentWidth.

Example

This example adds a horizontal line and sets its length to 50% of the window width.

VBA Copy code Copy code
Selection.InlineShapes.AddHorizontalLineStandard
ActiveDocument.InlineShapes(1) _
 .HorizontalLineFormat.PercentWidth = 50

See also

Concepts

HorizontalLineFormat Object

Other resources

HorizontalLineFormat Object Members


HorizontalLineFormat.WidthType Property (Word)

 Copy code hover
[image]

HorizontalLineFormat.WidthType Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the width type for the specified HorizontalLineFormat object. Read/write WdHorizontalLineWidthType.

Syntax

expression .WidthType

expression Required. A variable that represents a HorizontalLineFormat object.

Example

This example adds horizontal lines to the active document and compares their width types.

VBA Copy code Copy code
Dim temp As InlineShape
Set temp = _
 ActiveDocument.InlineShapes.AddHorizontalLineStandard
MsgBox "AddHorizontalLineStandard - WidthType = " _
 & temp.HorizontalLineFormat.WidthType
Set temp = _
 ActiveDocument.InlineShapes.AddHorizontalLine _
 ("C:\My Documents\ArtsyRule.gif")
MsgBox "AddHorizontalLine - WidthType = " _
 & temp.HorizontalLineFormat.WidthType

See also

Concepts

HorizontalLineFormat Object

Other resources

HorizontalLineFormat Object Members


HTMLDivision Object (Word)

 Copy code hover
[image]

HTMLDivision Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a single HTML DIV element within a Web document. The HTMLDivision object is a member of the HTMLDivisions collection.

Remarks

Use HTMLDivisions (Index), where Index refers to the HTML division in the document, to return a single HTMLDivision object. Use the Borders property to format border properties for an HTML division. This example formats three nested divisions in the active document. This example assumes that the active document is an HTML document with at least three divisions.

VBA Copy code Copy code
Sub FormatHTMLDivisions()
 With ActiveDocument.HTMLDivisions(1)
 With .Borders(wdBorderLeft)
 .Color = wdColorRed
 .LineStyle = wdLineStyleSingle
 End With
 With .Borders(wdBorderTop)
 .Color = wdColorRed
 .LineStyle = wdLineStyleSingle
 End With
 With .HTMLDivisions(1)
 .LeftIndent = InchesToPoints(1)
 .RightIndent = InchesToPoints(1)
 With .Borders(wdBorderRight)
 .Color = wdColorBlue
 .LineStyle = wdLineStyleDouble
 End With
 End With
 With .Borders(wdBorderBottom)
 .Color = wdColorBlue
 .LineStyle = wdLineStyleDouble
 End With
 With .HTMLDivisions(1)
 .LeftIndent = InchesToPoints(1)
 .RightIndent = InchesToPoints(1)
 With .Borders(wdBorderLeft)
 .Color = wdColorBlack
 .LineStyle = wdLineStyleDot
 End With
 With .Borders(wdBorderTop)
 .Color = wdColorBlack
 .LineStyle = wdLineStyleDot
 End With
 End With
 End With
 End With

End Sub

HTML divisions can be nested within multiple HTML divisions. Use the HTMLDivisionParent method to access a parent HTML division of the current HTML division. This example formats the borders for two HTML divisions in the active document. This example assumes that the active document is an HTML document with at least two divisions.

VBA Copy code Copy code
Sub FormatHTMLDivisions()
 With ActiveDocument.HTMLDivisions(1)
 With .HTMLDivisions(1)
 .LeftIndent = InchesToPoints(1)
 .RightIndent = InchesToPoints(1)
 With .Borders(wdBorderLeft)
 .Color = wdColorBlue
 .LineStyle = wdLineStyleDouble
 End With
 With .Borders(wdBorderRight)
 .Color = wdColorBlue
 .LineStyle = wdLineStyleDouble
 End With
 With .HTMLDivisionParent
 .LeftIndent = InchesToPoints(1)
 .RightIndent = InchesToPoints(1)
 With .Borders(wdBorderTop)
 .Color = wdColorBlack
 .LineStyle = wdLineStyleDot
 End With
 With .Borders(wdBorderBottom)
 .Color = wdColorBlack
 .LineStyle = wdLineStyleDot
 End With
 End With
 End With
 End With
End Sub

See also

Concepts

Word Object Model Reference

Other resources

HTMLDivision Object Members


HTMLDivision Members (Word)

 Copy code hover
[image]

HTMLDivision Members (Word)
Send feedback

Published: July 16, 2012

Represents a single HTML DIV element within a Web document. The HTMLDivision object is a member of the HTMLDivisions collection.

Methods

Name | Description
Delete | Deletes the specified HTML division.
HTMLDivisionParent | Returns an HTMLDivision object that represents a parent division of the current HTML division.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Borders | Returns a Borders collection that represents all the borders for the specified object.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
HTMLDivisions | Returns an HTMLDivisions object that represents an HTML division in a Web document.
LeftIndent | Returns or sets a Single that represents the left indent value (in points) for the specified HTML division. Read/write.
Parent | Returns an Object that represents the parent object of the specified HTMLDivision object.
Range | Returns a Range object that represents the portion of a document that's contained in the specified object.
RightIndent | Returns or sets the right indent (in points) for the specified paragraphs. Read/write Single.
SpaceAfter | Returns or sets the amount of spacing (in points) after the specified HTML DIV element. Read/write Single.
SpaceBefore | Returns or sets the spacing (in points) before the specified HTML DIV element. Read/write Single.


HTMLDivision Properties (Word)

 Copy code hover
[image]

HTMLDivision Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Borders | Returns a Borders collection that represents all the borders for the specified object.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
HTMLDivisions | Returns an HTMLDivisions object that represents an HTML division in a Web document.
LeftIndent | Returns or sets a Single that represents the left indent value (in points) for the specified HTML division. Read/write.
Parent | Returns an Object that represents the parent object of the specified HTMLDivision object.
Range | Returns a Range object that represents the portion of a document that's contained in the specified object.
RightIndent | Returns or sets the right indent (in points) for the specified paragraphs. Read/write Single.
SpaceAfter | Returns or sets the amount of spacing (in points) after the specified HTML DIV element. Read/write Single.
SpaceBefore | Returns or sets the spacing (in points) before the specified HTML DIV element. Read/write Single.


HTMLDivision.Application Property (Word)

 Copy code hover
[image]

HTMLDivision.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents an HTMLDivision object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

HTMLDivision Object

Other resources

HTMLDivision Object Members


HTMLDivision.Borders Property (Word)

 Copy code hover
[image]

HTMLDivision.Borders Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Borders collection that represents all the borders for the specified object.

Syntax

expression .Borders

expression Required. A variable that represents an HTMLDivision object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection .

See also

Concepts

HTMLDivision Object

Other resources

HTMLDivision Object Members


HTMLDivision.Creator Property (Word)

 Copy code hover
[image]

HTMLDivision.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents an HTMLDivision object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

HTMLDivision Object

Other resources

HTMLDivision Object Members


HTMLDivision.HTMLDivisions Property (Word)

 Copy code hover
[image]

HTMLDivision.HTMLDivisions Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an HTMLDivisions object that represents an HTML division in a Web document.

Syntax

expression .HTMLDivisions

expression Required. A variable that represents an HTMLDivision object.

Example

This example formats three nested divisions in the active document. This example assumes that the active document is an HTML document with at least three divisions.

VBA Copy code Copy code
Sub FormatHTMLDivisions()
 With ActiveDocument.HTMLDivisions(1)
 With .Borders(wdBorderLeft)
 .Color = wdColorRed
 .LineStyle = wdLineStyleSingle
 End With
 With .Borders(wdBorderRight)
 .Color = wdColorRed
 .LineStyle = wdLineStyleSingle
 End With
 With .HTMLDivisions(1)
 .LeftIndent = InchesToPoints(1)
 .RightIndent = InchesToPoints(1)
 With .Borders(wdBorderTop)
 .Color = wdColorBlue
 .LineStyle = wdLineStyleDouble
 End With
 With .Borders(wdBorderBottom)
 .Color = wdColorBlue
 .LineStyle = wdLineStyleDouble
 End With
 With .HTMLDivisions(1)
 .LeftIndent = InchesToPoints(1)
 .RightIndent = InchesToPoints(1)
 With .Borders(wdBorderLeft)
 .LineStyle = wdLineStyleDot
 End With
 With .Borders(wdBorderRight)
 .LineStyle = wdLineStyleDot
 End With
 With .Borders(wdBorderTop)
 .LineStyle = wdLineStyleDot
 End With
 With .Borders(wdBorderBottom)
 .LineStyle = wdLineStyleDot
 End With
 End With
 End With
 End With

End Sub

See also

Concepts

HTMLDivision Object

Other resources

HTMLDivision Object Members


HTMLDivision.LeftIndent Property (Word)

 Copy code hover
[image]

HTMLDivision.LeftIndent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Single that represents the left indent value (in points) for the specified HTML division. Read/write.

Syntax

expression .LeftIndent

expression A variable that represents an HTMLDivision object.

See also

Concepts

HTMLDivision Object

Other resources

HTMLDivision Object Members


HTMLDivision.Parent Property (Word)

 Copy code hover
[image]

HTMLDivision.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified HTMLDivision object.

Syntax

expression .Parent

expression Required. A variable that represents an HTMLDivision object.

See also

Concepts

HTMLDivision Object

Other resources

HTMLDivision Object Members


HTMLDivision.Range Property (Word)

 Copy code hover
[image]

HTMLDivision.Range Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the portion of a document that's contained in the specified object.

Syntax

expression .Range

expression Required. A variable that represents an HTMLDivision object.

See also

Concepts

HTMLDivision Object

Other resources

HTMLDivision Object Members


HTMLDivision.RightIndent Property (Word)

 Copy code hover
[image]

HTMLDivision.RightIndent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the right indent (in points) for the specified paragraphs. Read/write Single.

Syntax

expression .RightIndent

expression Required. A variable that represents an HTMLDivision object.

Example

This example sets the right indent for all paragraphs in the active document to 1 inch from the right margin. The InchesToPoints method is used to convert inches to points.

VBA Copy code Copy code
ActiveDocument.Paragraphs.RightIndent = InchesToPoints(1)

See also

Concepts

HTMLDivision Object

Other resources

HTMLDivision Object Members


HTMLDivision.SpaceAfter Property (Word)

 Copy code hover
[image]

HTMLDivision.SpaceAfter Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the amount of spacing (in points) after the specified HTML DIV element. Read/write Single.

Syntax

expression .SpaceAfter

expression Required. A variable that represents an HTMLDivision object.

See also

Concepts

HTMLDivision Object

Other resources

HTMLDivision Object Members


HTMLDivision.SpaceBefore Property (Word)

 Copy code hover
[image]

HTMLDivision.SpaceBefore Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the spacing (in points) before the specified HTML DIV element. Read/write Single.

Syntax

expression .SpaceBefore

expression Required. A variable that represents an HTMLDivision object.

See also

Concepts

HTMLDivision Object

Other resources

HTMLDivision Object Members


HTMLDivision Methods (Word)

 Copy code hover
[image]

HTMLDivision Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the specified HTML division.
HTMLDivisionParent | Returns an HTMLDivision object that represents a parent division of the current HTML division.


HTMLDivision.Delete Method (Word)

 Copy code hover
[image]

HTMLDivision.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the specified HTML division.

Syntax

expression .Delete

expression Required. A variable that represents an HTMLDivision object.

See also

Concepts

HTMLDivision Object

Other resources

HTMLDivision Object Members


HTMLDivision.HTMLDivisionParent Method (Word)

 Copy code hover
[image]

HTMLDivision.HTMLDivisionParent Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an HTMLDivision object that represents a parent division of the current HTML division.

Syntax

expression .HTMLDivisionParent(LevelsUp)

expression Required. A variable that represents an HTMLDivision object.

Parameters

Name | Required/Optional | Data Type | Description
LevelsUp | Optional | Long | The number of parent divisions to count back to return the desired division. If the LevelsUp argument is omitted, the HTML division returned is one level up from the current HTML division.

Return Value

HTMLDivision

Example

This example formats the borders for two HTML divisions in the active document. This example assumes that the active document is an HTML document with at least two divisions.

VBA Copy code Copy code
Sub FormatHTMLDivisions()
 With ActiveDocument.HTMLDivisions(1)
 With .HTMLDivisions(1)
 .LeftIndent = InchesToPoints(1)
 .RightIndent = InchesToPoints(1)
 With .Borders(wdBorderLeft)
 .Color = wdColorBlue
 .LineStyle = wdLineStyleDouble
 End With
 With .Borders(wdBorderRight)
 .Color = wdColorBlue
 .LineStyle = wdLineStyleDouble
 End With
 With .HTMLDivisionParent
 .LeftIndent = InchesToPoints(1)
 .RightIndent = InchesToPoints(1)
 With .Borders(wdBorderTop)
 .Color = wdColorBlack
 .LineStyle = wdLineStyleDot
 End With
 With .Borders(wdBorderBottom)
 .Color = wdColorBlack
 .LineStyle = wdLineStyleDot
 End With
 End With
 End With
 End With
End Sub

See also

Concepts

HTMLDivision Object

Other resources

HTMLDivision Object Members


HTMLDivisions Object (Word)

 Copy code hover
[image]

HTMLDivisions Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of HTMLDivision objects that represents the HTML DIV elements that exist in a Web document.

Remarks

Use the HTMLDivisions property to return the HTMLDivisions collection. Use the Add method to add an HTML division to a Web document. This example adds a new HTML division to the active document, adds text to the division, and formats the borders around the division.

VBA Copy code Copy code
Sub NewDivision()

 With ActiveDocument.HTMLDivisions
 .Add
 .Item(Index:=1).Range.Text = "This is a new HTML division."
 With .Item(1)
 With .Borders(wdBorderBottom)
 .LineStyle = wdLineStyleTriple
 .LineWidth = wdLineWidth025pt
 .Color = wdColorRed
 End With
 With .Borders(wdBorderTop)
 .LineStyle = wdLineStyleDot
 .LineWidth = wdLineWidth050pt
 .Color = wdColorBlue
 End With
 With .Borders(wdBorderLeft)
 .LineStyle = wdLineStyleDouble
 .LineWidth = wdLineWidth075pt
 .Color = wdColorBrightGreen
 End With
 With .Borders(wdBorderRight)
 .LineStyle = wdLineStyleDashDotDot
 .LineWidth = wdLineWidth075pt
 .Color = wdColorTurquoise
 End With
 End With
 End With

End Sub

See also

Concepts

Word Object Model Reference

Other resources

HTMLDivisions Object Members


HTMLDivisions Members (Word)

 Copy code hover
[image]

HTMLDivisions Members (Word)
Send feedback

Published: July 16, 2012

A collection of HTMLDivision objects that represents the HTML DIV elements that exist in a Web document.

Methods

Name | Description
Add | Returns an HTMLDivision object that represents a new HTML division added to a Web document.
Item | Returns an individual HTMLDivision object in a collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of HTML DIV elements in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
NestingLevel | Returns the nesting level of the specified HTML DIV elements. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified HTMLDivisions object.


HTMLDivisions Properties (Word)

 Copy code hover
[image]

HTMLDivisions Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of HTML DIV elements in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
NestingLevel | Returns the nesting level of the specified HTML DIV elements. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified HTMLDivisions object.


HTMLDivisions.Application Property (Word)

 Copy code hover
[image]

HTMLDivisions.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents an HTMLDivisions collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

HTMLDivisions Collection

Other resources

HTMLDivisions Object Members


HTMLDivisions.Count Property (Word)

 Copy code hover
[image]

HTMLDivisions.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of HTML DIV elements in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents an HTMLDivisions collection.

See also

Concepts

HTMLDivisions Collection

Other resources

HTMLDivisions Object Members


HTMLDivisions.Creator Property (Word)

 Copy code hover
[image]

HTMLDivisions.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents an HTMLDivisions collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

HTMLDivisions Collection

Other resources

HTMLDivisions Object Members


HTMLDivisions.NestingLevel Property (Word)

 Copy code hover
[image]

HTMLDivisions.NestingLevel Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the nesting level of the specified HTML DIV elements. Read-only Long.

Syntax

expression .NestingLevel

expression Required. A variable that represents an HTMLDivisions collection.

See also

Concepts

HTMLDivisions Collection

Other resources

HTMLDivisions Object Members


HTMLDivisions.Parent Property (Word)

 Copy code hover
[image]

HTMLDivisions.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified HTMLDivisions object.

Syntax

expression .Parent

expression Required. A variable that represents an HTMLDivisions collection.

See also

Concepts

HTMLDivisions Collection

Other resources

HTMLDivisions Object Members


HTMLDivisions Methods (Word)

 Copy code hover
[image]

HTMLDivisions Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Returns an HTMLDivision object that represents a new HTML division added to a Web document.
Item | Returns an individual HTMLDivision object in a collection.


HTMLDivisions.Add Method (Word)

 Copy code hover
[image]

HTMLDivisions.Add Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an HTMLDivision object that represents a new HTML division added to a Web document.

Syntax

expression .Add(Range)

expression Required. A variable that represents an HTMLDivisions collection.

Parameters

Name | Required/Optional | Data Type | Description
Range | Optional | Variant | An existing HTML division around which to place the new HTML division.

Return Value

HTMLDivision

See also

Concepts

HTMLDivisions Collection

Other resources

HTMLDivisions Object Members


HTMLDivisions.Item Method (Word)

 Copy code hover
[image]

HTMLDivisions.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual HTMLDivision object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents an HTMLDivisions collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The individual object to be returned. Can be a Long indicating the ordinal position of the individual object.

Return Value

HTMLDivision

See also

Concepts

HTMLDivisions Collection

Other resources

HTMLDivisions Object Members


Hyperlink Object (Word)

 Copy code hover
[image]

Hyperlink Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a hyperlink. The Hyperlink object is a member of the Hyperlinks collection.

Remarks

Use the Hyperlink property to return a Hyperlink object associated with a shape (a shape can have only one hyperlink). The following example activates the hyperlink associated with the first shape in the active document.

VBA Copy code Copy code
ActiveDocument.Shapes(1).Hyperlink.Follow

Use Hyperlinks(Index), where Index is the index number, to return a single Hyperlink object from a document, range, or selection. The following example activates the first hyperlink in the selection.

VBA Copy code Copy code
If Selection.HyperLinks.Count >= 1 Then
 Selection.HyperLinks(1).Follow
End If

See also

Concepts

Word Object Model Reference

Other resources

Hyperlink Object Members


Hyperlink Members (Word)

 Copy code hover
[image]

Hyperlink Members (Word)
Send feedback

Published: July 16, 2012

Represents a hyperlink. The Hyperlink object is a member of the Hyperlinks collection.

Methods

Name | Description
AddToFavorites | Creates a shortcut to the document or hyperlink and adds it to the Favorites folder.
CreateNewDocument | Creates a new document linked to the specified hyperlink.
Delete | Deletes the specified hyperlink.
Follow | Displays a cached document associated with the specified Hyperlink object, if it has already been downloaded. Otherwise, this method resolves the hyperlink, downloads the target document, and displays the document in the appropriate application.

Properties

Name | Description
Address | Returns or sets the address (for example, a file name or URL) of the specified hyperlink. Read/write String.
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
EmailSubject | Returns or sets the text string for the specified hyperlink's subject line. Read/write String.
ExtraInfoRequired | True if extra information is required to resolve the specified hyperlink. Read-only Boolean.
Name | Returns the name of the specified object. Read-only String.
Parent | Returns an Object that represents the parent object of the specified Hyperlink object.
Range | Returns a Range object that represents the portion of a document that is contained within a hyperlink.
ScreenTip | Returns or sets the text that appears as a ScreenTip when the mouse pointer is positioned over the specified hyperlink. Read/write String.
Shape | Returns a Shape object for the specified hyperlink or diagram node.
SubAddress | Returns or sets a named location in the destination of the specified hyperlink. Read/write String.
Target | Returns or sets the name of the frame or window in which to load the hyperlink. Read/write String.
TextToDisplay | Returns or sets the specified hyperlink's visible text in a document. Read/write String.
Type | Returns the hyperlink type. Read-only MsoHyperlinkType.


Hyperlink Properties (Word)

 Copy code hover
[image]

Hyperlink Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Address | Returns or sets the address (for example, a file name or URL) of the specified hyperlink. Read/write String.
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
EmailSubject | Returns or sets the text string for the specified hyperlink's subject line. Read/write String.
ExtraInfoRequired | True if extra information is required to resolve the specified hyperlink. Read-only Boolean.
Name | Returns the name of the specified object. Read-only String.
Parent | Returns an Object that represents the parent object of the specified Hyperlink object.
Range | Returns a Range object that represents the portion of a document that is contained within a hyperlink.
ScreenTip | Returns or sets the text that appears as a ScreenTip when the mouse pointer is positioned over the specified hyperlink. Read/write String.
Shape | Returns a Shape object for the specified hyperlink or diagram node.
SubAddress | Returns or sets a named location in the destination of the specified hyperlink. Read/write String.
Target | Returns or sets the name of the frame or window in which to load the hyperlink. Read/write String.
TextToDisplay | Returns or sets the specified hyperlink's visible text in a document. Read/write String.
Type | Returns the hyperlink type. Read-only MsoHyperlinkType.


Hyperlink.Address Property (Word)

 Copy code hover
[image]

Hyperlink.Address Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the address (for example, a file name or URL) of the specified hyperlink. Read/write String.

Syntax

expression .Address

expression Required. A variable that represents a Hyperlink object.

Remarks

If there is no hyperlink associated with an object, setting the Address property returns an error occurs. In this case, use the Add method for the Hyperlinks collection to add a hyperlink. The following example shows how to do this.

VBA Copy code Copy code
ActiveDocument.Hyperlinks.Add Selection.Range, "http://www.microsoft.com"

Example

This example adds a hyperlink to the selection in the active document, sets the address, and then displays the address in a message box.

VBA Copy code Copy code
Set aHLink = ActiveDocument.Hyperlinks.Add( _
 Anchor:=Selection.Range, _
 Address:="http://forms")
MsgBox "The hyperlink goes to " & aHLink.Address

If the active document includes hyperlinks, this example inserts a list of the hyperlink destinations at the end of the document.

VBA Copy code Copy code
Set myRange = ActiveDocument _
 .Range(Start:=ActiveDocument.Content.End - 1)
Count = 0
For Each aHyperlink In ActiveDocument.Hyperlinks
 Count = Count + 1
 With myRange
 .InsertAfter "Hyperlink #" & Count & vbTab
 .InsertAfter aHyperlink.Address
 .InsertParagraphAfter
 End With
Next aHyperlink

See also

Concepts

Hyperlink Object

Other resources

Hyperlink Object Members


Hyperlink.Application Property (Word)

 Copy code hover
[image]

Hyperlink.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a Hyperlink object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

Hyperlink Object

Other resources

Hyperlink Object Members


Hyperlink.Creator Property (Word)

 Copy code hover
[image]

Hyperlink.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a Hyperlink object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Hyperlink Object

Other resources

Hyperlink Object Members


Hyperlink.EmailSubject Property (Word)

 Copy code hover
[image]

Hyperlink.EmailSubject Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the text string for the specified hyperlink's subject line. Read/write String.

Syntax

expression .EmailSubject

expression A variable that represents a Hyperlink object.

Remarks

The subject line is appended to the hyperlink's Internet address, or URL. This property is commonly used with e-mail hyperlinks. The value of this property takes precedence over any e-mail subject specified in the Address property of the same Hyperlink object.

Example

This example checks the active document for e-mail hyperlinks; if it finds any that have a blank subject line, it adds the subject "NewProducts".

VBA Copy code Copy code
Dim hypLoop As Hyperlink

For Each hypLoop In ActiveDocument.Hyperlinks
 If hypLoop.Address Like "mailto*" And _
 hypLoop.Address = hypLoop.EmailSubject Then
 hypLoop.EmailSubject = "NewProducts"
 End If
Next hypLoop

See also

Concepts

Hyperlink Object

Other resources

Hyperlink Object Members


Hyperlink.ExtraInfoRequired Property (Word)

 Copy code hover
[image]

Hyperlink.ExtraInfoRequired Property (Word)
See also Send feedback

Published: July 16, 2012

True if extra information is required to resolve the specified hyperlink. Read-only Boolean.

Syntax

expression .ExtraInfoRequired

expression A variable that represents a Hyperlink object.

Remarks

You can specify extra information by using the ExtraInfo argument with the Follow or FollowHyperlink method. For example, you can use ExtraInfo to specify the coordinates of an image map, the contents of a form, or a FAT file name.

Example

This example inserts a hyperlink to www.msn.com and then follows the hyperlink if extra information isn't required.

VBA Copy code Copy code
Dim hypTemp As Hyperlink

With Selection
 .Collapse Direction:=wdCollapseEnd
 .InsertAfter "MSN "
 .Previous
End With
Set hypTemp = ActiveDocument.Hyperlinks.Add( _
 Address:="http://www.msn.com", _
 Anchor:=Selection.Range)
If hypTemp.ExtraInfoRequired = False Then
 hypTemp.Follow
End If

See also

Concepts

Hyperlink Object

Other resources

Hyperlink Object Members


Hyperlink.Name Property (Word)

 Copy code hover
[image]

Hyperlink.Name Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the name of the specified object. Read-only String.

Syntax

expression .Name

expression Required. A variable that represents a Hyperlink object.

See also

Concepts

Hyperlink Object

Other resources

Hyperlink Object Members


Hyperlink.Parent Property (Word)

 Copy code hover
[image]

Hyperlink.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Hyperlink object.

Syntax

expression .Parent

expression Required. A variable that represents a Hyperlink object.

See also

Concepts

Hyperlink Object

Other resources

Hyperlink Object Members


Hyperlink.Range Property (Word)

 Copy code hover
[image]

Hyperlink.Range Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the portion of a document that is contained within a hyperlink.

Syntax

expression .Range

expression Required. A variable that represents a Hyperlink object.

See also

Concepts

Hyperlink Object

Other resources

Hyperlink Object Members


Hyperlink.ScreenTip Property (Word)

 Copy code hover
[image]

Hyperlink.ScreenTip Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the text that appears as a ScreenTip when the mouse pointer is positioned over the specified hyperlink. Read/write String.

Syntax

expression .ScreenTip

expression An expression that returns a Hyperlink object.

Example

This example sets the ScreenTip text for the first hyperlink in the active document.

VBA Copy code Copy code
ActiveDocument.Hyperlinks(1).ScreenTip = _
 "Home"

See also

Concepts

Hyperlink Object

Other resources

Hyperlink Object Members


Hyperlink.Shape Property (Word)

 Copy code hover
[image]

Hyperlink.Shape Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Shape object for the specified hyperlink or diagram node.

Syntax

expression .Shape

expression Required. A variable that represents a Hyperlink object.

Remarks

If a hyperlink isn't represented by a shape, an error occurs.

Example

This example changes the fill color for the shape that represents the first hyperlink in the active document. For this example to work, the hyperlink must be represented by a shape.

VBA Copy code Copy code
ActiveDocument.Hyperlinks(1).Shape.Fill.ForeColor.RGB = _
 RGB(255, 255, 0)

See also

Concepts

Hyperlink Object

Other resources

Hyperlink Object Members


Hyperlink.SubAddress Property (Word)

 Copy code hover
[image]

Hyperlink.SubAddress Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a named location in the destination of the specified hyperlink. Read/write String.

Syntax

expression .SubAddress

expression An expression that returns a Hyperlink object.

Remarks

The named location can be a bookmark in a Microsoft Word document, a named cell or cell reference in a Microsoft Excel worksheet, a named object in a Microsoft Access database, or a slide number in a Microsoft PowerPoint presentation.

Example

This example displays the subaddress of the selected hyperlink.

VBA Copy code Copy code
If Selection.Range.Hyperlinks.Count >= 1 Then
 MsgBox Selection.Range.Hyperlinks(1).SubAddress
End If

This example adds a hyperlink to the selection in the active document, sets the hyperlink destination and subaddress, and then displays them in a message box.

VBA Copy code Copy code
Set SCut = ActiveDocument.Hyperlinks.Add( _
 Anchor:= Selection.Range, _
 Address:="C:\My Documents\Other.doc", SubAddress:= "temp")
MsgBox "The hyperlink goes to " & SCut.SubAddress

See also

Concepts

Hyperlink Object

Other resources

Hyperlink Object Members


Hyperlink.Target Property (Word)

 Copy code hover
[image]

Hyperlink.Target Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the name of the frame or window in which to load the hyperlink. Read/write String.

Syntax

expression .Target

expression Required. A variable that represents a Hyperlink object.

Example

This example sets the specified hyperlink to open in a new browser window.

VBA Copy code Copy code
ActiveDocument.Hyperlinks(1).Target = "_blank"

This example sets the specified hyperlink to open in the frame called "left."

VBA Copy code Copy code
ActiveDocument.Hyperlinks(1).Target = "left"

See also

Concepts

Hyperlink Object

Other resources

Hyperlink Object Members


Hyperlink.TextToDisplay Property (Word)

 Copy code hover
[image]

Hyperlink.TextToDisplay Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the specified hyperlink's visible text in a document. Read/write String.

Syntax

expression .TextToDisplay

expression An expression that returns a Hyperlink object.

Example

This example sets the display text for the first hyperlink in the active document.

VBA Copy code Copy code
ActiveDocument.Hyperlinks(1).TextToDisplay = _
 "Follow this link for more information..."

See also

Concepts

Hyperlink Object

Other resources

Hyperlink Object Members


Hyperlink.Type Property (Word)

 Copy code hover
[image]

Hyperlink.Type Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the hyperlink type. Read-only MsoHyperlinkType.

Syntax

expression .Type

expression Required. A variable that represents a Hyperlink object.

See also

Concepts

Hyperlink Object

Other resources

Hyperlink Object Members


Hyperlink Methods (Word)

 Copy code hover
[image]

Hyperlink Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
AddToFavorites | Creates a shortcut to the document or hyperlink and adds it to the Favorites folder.
CreateNewDocument | Creates a new document linked to the specified hyperlink.
Delete | Deletes the specified hyperlink.
Follow | Displays a cached document associated with the specified Hyperlink object, if it has already been downloaded. Otherwise, this method resolves the hyperlink, downloads the target document, and displays the document in the appropriate application.


Hyperlink.AddToFavorites Method (Word)

 Copy code hover
[image]

Hyperlink.AddToFavorites Method (Word)
See also Send feedback

Published: July 16, 2012

Creates a shortcut to the document or hyperlink and adds it to the Favorites folder.

Syntax

expression .AddToFavorites

expression Required. A variable that represents a Hyperlink object.

Example

This example creates a shortcut for each hyperlink in the active document and adds it to the Favorites folder.

VBA Copy code Copy code
For Each myHyperlink In ActiveDocument.Hyperlinks
 myHyperlink.AddToFavorites
Next myHyperlink

This example creates a shortcut to Sales.doc and adds it to the Favorites folder. If Sales.doc isn't currently open, this example opens it from the C:\Documents folder.

VBA Copy code Copy code
For Each doc in Documents
 If LCase(doc.Name) = "sales.doc" Then isOpen = True
Next doc
If isOpen <> True Then Documents.Open _
 FileName:="C:\Documents\Sales.doc"
Documents("Sales.doc").AddToFavorites

See also

Concepts

Hyperlink Object

Other resources

Hyperlink Object Members


Hyperlink.CreateNewDocument Method (Word)

 Copy code hover
[image]

Hyperlink.CreateNewDocument Method (Word)
See also Send feedback

Published: July 16, 2012

Creates a new document linked to the specified hyperlink.

Syntax

expression .CreateNewDocument(FileName, EditNow, Overwrite)

expression Required. A variable that represents a Hyperlink object.

Parameters

Name | Required/Optional | Data Type | Description
FileName | Required | String | The file name of the specified document.
EditNow | Required | Boolean | True to have the specified document open immediately in its associated editing environment. The default value is True.
Overwrite | Required | Boolean | True to overwrite any existing file of the same name in the same folder. False if any existing file of the same name is preserved and the FileName argument specifies a new file name. The default value is False.

Example

This example creates a new document based on the new hyperlink in the first document and then loads the new document into Microsoft Word for editing. The document is called "Overview.doc," and it overwrites any file of the same name in the \\Server1\Annual folder.

VBA Copy code Copy code
With Documents(1)
 Set objHyper = _
 .Hyperlinks.Add(Anchor:=Selection.Range, _
 Address:="\\Server1\Annual\Overview.doc")
 objHyper.CreateNewDocument _
 FileName:="\\Server1\Annual\Overview.doc", _
 EditNow:=True, Overwrite:=True
End With

See also

Concepts

Hyperlink Object

Other resources

Hyperlink Object Members


Hyperlink.Delete Method (Word)

 Copy code hover
[image]

Hyperlink.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the specified hyperlink.

Syntax

expression .Delete

expression Required. A variable that represents a Hyperlink object.

See also

Concepts

Hyperlink Object

Other resources

Hyperlink Object Members


Hyperlink.Follow Method (Word)

 Copy code hover
[image]

Hyperlink.Follow Method (Word)
See also Send feedback

Published: July 16, 2012

Displays a cached document associated with the specified Hyperlink object, if it has already been downloaded. Otherwise, this method resolves the hyperlink, downloads the target document, and displays the document in the appropriate application.

Syntax

expression .Follow(NewWindow, AddHistory, ExtraInfo, Method, HeaderInfo)

expression Required. A variable that represents a Hyperlink object.

Parameters

Name | Required/Optional | Data Type | Description
NewWindow | Optional | Variant | True to display the target document in a new window. The default value is False.
AddHistory | Optional | Variant | This argument is reserved for future use.
ExtraInfo | Optional | Variant | A string or byte array that specifies additional information for HTTP to use to resolve the hyperlink. For example, you can use ExtraInfo to specify the coordinates of an image map, the contents of a form, or a FAT file name. The string is either posted or appended, depending on the value of Method. Use the ExtraInfoRequired property to determine whether extra information is required.
Method | Optional | Variant | Specifies the way additional information for HTTP is handled. Can be any MsoExtraInfoMethod constant.
HeaderInfo | Optional | Variant | A string that specifies header information for the HTTP request. The default value is an empty string. You can combine several header lines into a single string by using the following syntax: "string1" & vbCr & "string2". The specified string is automatically converted into ANSI characters. Note that the HeaderInfo argument may overwrite default HTTP header fields.

Remarks

If the hyperlink uses the file protocol, this method opens the document instead of downloading it.

Example

This example follows the first hyperlink in Home.doc.

VBA Copy code Copy code
Documents("Home.doc").HyperLinks(1).Follow

This example inserts a hyperlink to www.msn.com and then follows the hyperlink.

VBA Copy code Copy code
Dim hypTemp As Hyperlink

With Selection
 .Collapse Direction:=wdCollapseEnd
 .InsertAfter "MSN "
 .Previous
End With

Set hypTemp = ActiveDocument.Hyperlinks.Add( _
 Address:="http://www.msn.com", _
 Anchor:=Selection.Range)
hypTemp.Follow NewWindow:=False, AddHistory:=True

See also

Concepts

Hyperlink Object

Other resources

Hyperlink Object Members


Hyperlinks Object (Word)

 Copy code hover
[image]

Hyperlinks Object (Word)
See also Send feedback

Published: July 16, 2012

Represents the collection of Hyperlink objects in a document, range, or selection.

Remarks

Use the Hyperlinks property to return the Hyperlinks collection. The following example checks all the hyperlinks in document one for a link that contains the word "Microsoft" in the address. If a hyperlink is found, it is activated with the Follow method.

VBA Copy code Copy code
For Each hLink In Documents(1).Hyperlinks
 If InStr(hLink.Address, "Microsoft") <> 0 Then
 hLink.Follow
 Exit For
 End If
Next hLink

Use the Add method to create a hyperlink and add it to the Hyperlinks collection. The following example creates a new hyperlink to the MSN Web site.

VBA Copy code Copy code
ActiveDocument.Hyperlinks.Add Address:="http://www.msn.com/", _
 Anchor:=Selection.Range

Use Hyperlinks(Index), where Index is the index number, to return a single Hyperlink object in a document, range, or selection. The following example activates the first hyperlink in the selection.

VBA Copy code Copy code
If Selection.HyperLinks.Count >= 1 Then
 Selection.HyperLinks(1).Follow
End If

The Count property for this collection in a document returns the number of items in the main story only. To count items in other stories use the collection with the Range object.

See also

Concepts

Word Object Model Reference

Other resources

Hyperlinks Object Members


Hyperlinks Members (Word)

 Copy code hover
[image]

Hyperlinks Members (Word)
Send feedback

Published: July 16, 2012

Represents the collection of Hyperlink objects in a document, range, or selection.

Methods

Name | Description
Add | Returns a Hyperlink object that represents a new hyperlink added to a range, selection, or document.
Item | Returns an individual Hyperlink object in a collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of hyperlinks in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified Hyperlinks object.


Hyperlinks Properties (Word)

 Copy code hover
[image]

Hyperlinks Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of hyperlinks in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified Hyperlinks object.


Hyperlinks.Application Property (Word)

 Copy code hover
[image]

Hyperlinks.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a Hyperlinks collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

Hyperlinks Collection Object

Other resources

Hyperlinks Object Members


Hyperlinks.Count Property (Word)

 Copy code hover
[image]

Hyperlinks.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of hyperlinks in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents a Hyperlinks collection.

See also

Concepts

Hyperlinks Collection Object

Other resources

Hyperlinks Object Members


Hyperlinks.Creator Property (Word)

 Copy code hover
[image]

Hyperlinks.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a Hyperlinks collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Hyperlinks Collection Object

Other resources

Hyperlinks Object Members


Hyperlinks.Parent Property (Word)

 Copy code hover
[image]

Hyperlinks.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Hyperlinks object.

Syntax

expression .Parent

expression Required. A variable that represents a Hyperlinks collection.

See also

Concepts

Hyperlinks Collection Object

Other resources

Hyperlinks Object Members


Hyperlinks Methods (Word)

 Copy code hover
[image]

Hyperlinks Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Returns a Hyperlink object that represents a new hyperlink added to a range, selection, or document.
Item | Returns an individual Hyperlink object in a collection.


Hyperlinks.Add Method (Word)

 Copy code hover
[image]

Hyperlinks.Add Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a Hyperlink object that represents a new hyperlink added to a range, selection, or document.

Syntax

expression .Add(Anchor, Address, SubAddress, ScreenTip, TextToDisplay, Target)

expression Required. A variable that represents a Hyperlinks collection.

Parameters

Name | Required/Optional | Data Type | Description
Anchor | Required | Object | The text or graphic that you want turned into a hyperlink.
Address | Optional | Variant | The address for the specified link. The address can be an e-mail address, an Internet address, or a file name. Note that Microsoft Word doesn't check the accuracy of the address.
SubAddress | Optional | Variant | The name of a location within the destination file, such as a bookmark, named range, or slide number.
ScreenTip | Optional | Variant | The text that appears as a ScreenTip when the mouse pointer is positioned over the specified hyperlink. The default value is "Address".
TextToDisplay | Optional | Variant | The display text of the specified hyperlink. The value of this argument replaces the text or graphic specified by Anchor.
Target | Optional | Variant | The name of the frame or window in which you want to load the specified hyperlink.

Return Value

Hyperlink

Example

This example turns the selection into a hyperlink to the Microsoft address on the World Wide Web.

VBA Copy code Copy code
ActiveDocument.Hyperlinks.Add Anchor:=Selection.Range, _
 Address:="http:\\www.microsoft.com"

This example turns the selection into a hyperlink that links to the bookmark named MyBookMark in MyFile.doc.

VBA Copy code Copy code
ActiveDocument.Hyperlinks.Add Anchor:=Selection.Range, _
 Address:="C:\My Documents\MyFile.doc", SubAddress:="MyBookMark"

This example turns the first shape in the selection into a hyperlink.

VBA Copy code Copy code
ActiveDocument.Hyperlinks.Add Anchor:=Selection.ShapeRange(1), _
 Address:="http:\\www.microsoft.com"

See also

Concepts

Hyperlinks Collection Object

Other resources

Hyperlinks Object Members


Hyperlinks.Item Method (Word)

 Copy code hover
[image]

Hyperlinks.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual Hyperlink object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents a Hyperlinks collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The individual object to be returned. Can be a Long indicating the ordinal position or a String representing the name of the individual object.

Return Value

Hyperlink

See also

Concepts

Hyperlinks Collection Object

Other resources

Hyperlinks Object Members


Index Object (Word)

 Copy code hover
[image]

Index Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a single index. The Index object is a member of the Indexes collection. The Indexes collection includes all the indexes in the specified document.

Remarks

Use Indexes(Index), where Index is the index number, to return a single Index object. The index number represents the position of the Index object in the document. The following example updates the first index in the active document.

VBA Copy code Copy code
If ActiveDocument.Indexes.Count >= 1 Then
 ActiveDocument.Indexes(1).Update
End If

Use the Add method to create an index and add it to the Indexes collection. The following example creates an index at the end of the active document.

VBA Copy code Copy code
Set myRange = ActiveDocument.Content
myRange.Collapse Direction:=wdCollapseEnd
ActiveDocument.Indexes.Add Range:=myRange, Type:=wdIndexRunin

See also

Concepts

Word Object Model Reference

Other resources

Index Object Members


Index Members (Word)

 Copy code hover
[image]

Index Members (Word)
Send feedback

Published: July 16, 2012

Represents a single index. The Index object is a member of the Indexes collection. The Indexes collection includes all the indexes in the specified document.

Methods

Name | Description
Delete | Deletes the specified index.
Update | Updates the entries shown in specified index.

Properties

Name | Description
AccentedLetters | True if the specified index contains separate headings for accented letters (for example, words that begin with "À" are under one heading and words that begin with "A" are under another). Read/write Boolean.
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Filter | Returns or sets a value that specifies how Microsoft Word classifies the first character of entries in the specified index.read/write Long. Can be one of the following wdIndexFilter constants.
HeadingSeparator | Returns or sets the text between alphabetical groups (entries that start with the same letter) in the index. Corresponds to the \h switch for an INDEX field. Read/write WdHeadingSeparator.
IndexLanguage | Returns or sets a WdLanguageID constant that represents the sorting language to use for the specified index. Read/write .
NumberOfColumns | Sets or returns the number of columns for each page of an index. Read/write Long.
Parent | Returns an Object that represents the parent object of the specified Index object.
Range | Returns a Range object that represents the portion of a document that is contained within an index.
RightAlignPageNumbers | True if page numbers are aligned with the right margin in an index. Read/write Boolean.
SortBy | Returns or sets the sorting criteria for the specified index. Read/write WdIndexSortBy.
TabLeader | Returns or sets the leader character between entries in an index and their associated page numbers. Read/write WdTabLeader.
Type | Returns or sets the index type. Read/write WdIndexType.


Index Properties (Word)

 Copy code hover
[image]

Index Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
AccentedLetters | True if the specified index contains separate headings for accented letters (for example, words that begin with "À" are under one heading and words that begin with "A" are under another). Read/write Boolean.
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Filter | Returns or sets a value that specifies how Microsoft Word classifies the first character of entries in the specified index.read/write Long. Can be one of the following wdIndexFilter constants.
HeadingSeparator | Returns or sets the text between alphabetical groups (entries that start with the same letter) in the index. Corresponds to the \h switch for an INDEX field. Read/write WdHeadingSeparator.
IndexLanguage | Returns or sets a WdLanguageID constant that represents the sorting language to use for the specified index. Read/write .
NumberOfColumns | Sets or returns the number of columns for each page of an index. Read/write Long.
Parent | Returns an Object that represents the parent object of the specified Index object.
Range | Returns a Range object that represents the portion of a document that is contained within an index.
RightAlignPageNumbers | True if page numbers are aligned with the right margin in an index. Read/write Boolean.
SortBy | Returns or sets the sorting criteria for the specified index. Read/write WdIndexSortBy.
TabLeader | Returns or sets the leader character between entries in an index and their associated page numbers. Read/write WdTabLeader.
Type | Returns or sets the index type. Read/write WdIndexType.


Index.AccentedLetters Property (Word)

 Copy code hover
[image]

Index.AccentedLetters Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified index contains separate headings for accented letters (for example, words that begin with "À" are under one heading and words that begin with "A" are under another). Read/write Boolean.

Syntax

expression .AccentedLetters

expression A variable that represents a Index object.

Example

This example formats the first index in the active document in a single column, with the appropriate letter preceding each alphabetical group and separate headings for accented letters.

VBA Copy code Copy code
If ActiveDocument.Indexes.Count >= 1 Then
 With ActiveDocument.Indexes(1)
 .HeadingSeparator = wdHeadingSeparatorLetter
 .NumberOfColumns = 1
 .AccentedLetters = True
 End With
End If

See also

Concepts

Index Object

Other resources

Index Object Members


Index.Application Property (Word)

 Copy code hover
[image]

Index.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents an Index object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

Index Object

Other resources

Index Object Members


Index.Creator Property (Word)

 Copy code hover
[image]

Index.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents an Index object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Index Object

Other resources

Index Object Members


Index.Filter Property (Word)

 Copy code hover
[image]

Index.Filter Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a value that specifies how Microsoft Word classifies the first character of entries in the specified index.read/write Long. Can be one of the following wdIndexFilter constants.

Syntax

expression .Filter

expression A variable that represents an Index object.

Example

This example inserts an index at the end of the active document. right-aligns the page numbers, and then sets Microsoft Word to classify index entries as "wdIndexFilterAkasatana".

VBA Copy code Copy code
Set myRange = ActiveDocument.Range _
 (Start:=ActiveDocument.Content.End -1, _
 End:=ActiveDocument.Content.End -1)
ActiveDocument.Indexes.Add(Range:=myRange, Type:=wdIndexIndent, _
 RightAlignPageNumbers:=True).Filter = wdIndexFilterAkasatana

See also

Concepts

Index Object

Other resources

Index Object Members


Index.HeadingSeparator Property (Word)

 Copy code hover
[image]

Index.HeadingSeparator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the text between alphabetical groups (entries that start with the same letter) in the index. Corresponds to the \h switch for an INDEX field. Read/write WdHeadingSeparator.

Syntax

expression .HeadingSeparator

expression Required. A variable that represents an Index object.

Example

This example formats the first index for the active document in a single column, with the appropriate letter preceding each alphabetical group.

VBA Copy code Copy code
If ActiveDocument.Indexes.Count >= 1 Then
 With ActiveDocument.Indexes(1)
 .HeadingSeparator = wdHeadingSeparatorLetter
 .NumberOfColumns = 1
 End With
End If

See also

Concepts

Index Object

Other resources

Index Object Members


Index.IndexLanguage Property (Word)

 Copy code hover
[image]

Index.IndexLanguage Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a WdLanguageID constant that represents the sorting language to use for the specified index. Read/write .

Syntax

expression IndexLanguage

expression Required. An expression that returns an Index object.

Remarks

Some of the WdLanguageID constants may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.

Example

This example sets the sorting language of the first index in the active document to New Zealand English.

VBA Copy code Copy code
ActiveDocument.Indexes(1).IndexLanguage = _
 wdEnglishNewZealand

See also

Concepts

Index Object

Other resources

Index Object Members


Index.NumberOfColumns Property (Word)

 Copy code hover
[image]

Index.NumberOfColumns Property (Word)
See also Send feedback

Published: July 16, 2012

Sets or returns the number of columns for each page of an index. Read/write Long.

Syntax

expression .NumberOfColumns

expression An expression that an Index object.

Remarks

Specifying 0 (zero) sets the number of columns in the index to the same number as in the document.

Example

This example sets the number of columns in the first index to the same number as in the active document.

VBA Copy code Copy code
ActiveDocument.Indexes(1).NumberOfColumns = 0

This example sets a two-column format for each index in the active document.

VBA Copy code Copy code
For Each myIndex In ActiveDocument.Indexes
 myIndex.NumberOfColumns = 2
Next myIndex

See also

Concepts

Index Object

Other resources

Index Object Members


Index.Parent Property (Word)

 Copy code hover
[image]

Index.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Index object.

Syntax

expression .Parent

expression Required. A variable that represents an Index object.

See also

Concepts

Index Object

Other resources

Index Object Members


Index.Range Property (Word)

 Copy code hover
[image]

Index.Range Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the portion of a document that is contained within an index.

Syntax

expression .Range

expression Required. A variable that represents an Index object.

See also

Concepts

Index Object

Other resources

Index Object Members


Index.RightAlignPageNumbers Property (Word)

 Copy code hover
[image]

Index.RightAlignPageNumbers Property (Word)
See also Send feedback

Published: July 16, 2012

True if page numbers are aligned with the right margin in an index. Read/write Boolean.

Syntax

expression .RightAlignPageNumbers

expression Required. A variable that represents an Index object.

See also

Concepts

Index Object

Other resources

Index Object Members


Index.SortBy Property (Word)

 Copy code hover
[image]

Index.SortBy Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the sorting criteria for the specified index. Read/write WdIndexSortBy.

Syntax

expression .SortBy

expression Required. A variable that represents an Index object.

Example

This example sets the first index in the current document to sort by the number of strokes.

VBA Copy code Copy code
ActiveDocument.Indexes(1).SortBy = _
 wdIndexSortByStroke

See also

Concepts

Index Object

Other resources

Index Object Members


Index.TabLeader Property (Word)

 Copy code hover
[image]

Index.TabLeader Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the leader character between entries in an index and their associated page numbers. Read/write WdTabLeader.

Syntax

expression .TabLeader

expression Required. A variable that represents an Index object.

Example

This example adds an index at the end of the active document. The page numbers are right-aligned with a dashed-line tab leader.

VBA Copy code Copy code
Set myRange = ActiveDocument.Range( _
 Start:=ActiveDocument.Content.End -1, _
 End:=ActiveDocument.Content.End -1)
ActiveDocument.Indexes.Add(Range:=myRange, Type:=wdIndexIndent, _
 RightAlignPageNumbers:=True).TabLeader = wdTabLeaderDashes

See also

Concepts

Index Object

Other resources

Index Object Members


Index.Type Property (Word)

 Copy code hover
[image]

Index.Type Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the index type. Read/write WdIndexType.

Syntax

expression .Type

expression Required. A variable that represents an Index object.

See also

Concepts

Index Object

Other resources

Index Object Members


Index Methods (Word)

 Copy code hover
[image]

Index Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the specified index.
Update | Updates the entries shown in specified index.


Index.Delete Method (Word)

 Copy code hover
[image]

Index.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the specified index.

Syntax

expression .Delete

expression Required. A variable that represents an Index object.

See also

Concepts

Index Object

Other resources

Index Object Members


Index.Update Method (Word)

 Copy code hover
[image]

Index.Update Method (Word)
See also Send feedback

Published: July 16, 2012

Updates the entries shown in specified index.

Syntax

expression .Update

expression Required. A variable that represents an Index object.

Remarks

Use the UpdatePageNumbers method to update the page numbers of items in a table of contents or figures.

See also

Concepts

Index Object

Other resources

Index Object Members


Indexes Object (Word)

 Copy code hover
[image]

Indexes Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of Index objects that represents all the indexes in the specified document.

Remarks

Use the Indexes property to return the Indexes collection. The following example formats indexes in the active document with the classic format.

VBA Copy code Copy code
ActiveDocument.Indexes.Format = wdIndexClassic

Use the Add method to create an index and add it to the Indexes collection. The following example creates an index at the end of the active document.

VBA Copy code Copy code
Set myRange = ActiveDocument.Content
myRange.Collapse Direction:=wdCollapseEnd
ActiveDocument.Indexes.Add Range:=myRange, Type:=wdIndexRunin

Use Indexes(Index), where Index is the index number, to return a single Index object. The index number represents the position of the Index object in the document. The following example updates the first index in the active document.

VBA Copy code Copy code
If ActiveDocument.Indexes.Count >= 1 Then
 ActiveDocument.Indexes(1).Update
End If

See also

Concepts

Word Object Model Reference

Other resources

Indexes Object Members


Indexes Members (Word)

 Copy code hover
[image]

Indexes Members (Word)
Send feedback

Published: July 16, 2012

A collection of Index objects that represents all the indexes in the specified document.

Methods

Name | Description
Add | Returns an Index object that represents a new index added to a document.
AutoMarkEntries | Automatically adds XE (Index Entry) fields to the specified document, using the entries from a concordance file.
Item | Returns an individual Index object in a collection.
MarkAllEntries | Inserts an XE (Index Entry) field after all instances of the text in Range.
MarkEntry | Inserts an XE (Index Entry) field after the specified range. The method returns a Field object representing the XE field.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of indexes in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Format | Returns or sets a WdIndexFormat that represents the formatting for the indexes in the specified document. Read/write.
Parent | Returns an Object that represents the parent object of the specified Indexes object.


Indexes Properties (Word)

 Copy code hover
[image]

Indexes Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of indexes in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Format | Returns or sets a WdIndexFormat that represents the formatting for the indexes in the specified document. Read/write.
Parent | Returns an Object that represents the parent object of the specified Indexes object.


Indexes.Application Property (Word)

 Copy code hover
[image]

Indexes.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents an Indexes collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

Indexes Collection Object

Other resources

Indexes Object Members


Indexes.Count Property (Word)

 Copy code hover
[image]

Indexes.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of indexes in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents an Indexes collection.

See also

Concepts

Indexes Collection Object

Other resources

Indexes Object Members


Indexes.Creator Property (Word)

 Copy code hover
[image]

Indexes.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents an Indexes collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Indexes Collection Object

Other resources

Indexes Object Members


Indexes.Format Property (Word)

 Copy code hover
[image]

Indexes.Format Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a WdIndexFormat that represents the formatting for the indexes in the specified document. Read/write.

Syntax

expression .Format

expression Required. A variable that represents an Indexes collection.

See also

Concepts

Indexes Collection Object

Other resources

Indexes Object Members


Indexes.Parent Property (Word)

 Copy code hover
[image]

Indexes.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Indexes object.

Syntax

expression .Parent

expression Required. A variable that represents an Indexes collection.

See also

Concepts

Indexes Collection Object

Other resources

Indexes Object Members


Indexes Methods (Word)

 Copy code hover
[image]

Indexes Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Returns an Index object that represents a new index added to a document.
AutoMarkEntries | Automatically adds XE (Index Entry) fields to the specified document, using the entries from a concordance file.
Item | Returns an individual Index object in a collection.
MarkAllEntries | Inserts an XE (Index Entry) field after all instances of the text in Range.
MarkEntry | Inserts an XE (Index Entry) field after the specified range. The method returns a Field object representing the XE field.


Indexes.Add Method (Word)

 Copy code hover
[image]

Indexes.Add Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an Index object that represents a new index added to a document.

Syntax

expression .Add(Range, HeadingSeparator, RightAlignPageNumbers, Type, NumberOfColumns, AccentedLetters, SortBy, IndexLanguage)

expression Required. A variable that represents an Indexes collection.

Parameters

Name | Required/Optional | Data Type | Description
Range | Required | Range | The range where you want the index to appear. The index replaces the range, if the range is not collapsed.
HeadingSeparator | Optional | Variant | The text between alphabetical groups (entries that start with the same letter) in the index. Can be one of the WdHeadingSeparator constants.
RightAlignPageNumbers | Optional | Variant | True to align page numbers with the right margin.
Type | Optional | Variant | Specifies whether subentries are on the same line (run-in) as the main entry or on a separate line (indented) from the main entry. Can be either of the following WdIndexType constants: wdIndexIndent or wdIndexRunin.
NumberOfColumns | Optional | Variant | The number of columns for each page of the index. Specifying 0 (zero) sets the number of columns in the index to the same number as in the document.
AccentedLetters | Optional | Variant | True to include separate headings for accented letters in the index (for example, words that begin with "À" and words that begin with "A" are listed under separate headings).
SortBy | Optional | Variant | The sorting criteria to be used for the specified index. Can be either of the following WdIndexSortBy constants: wdIndexSortByStroke or wdIndexSortBySyllable.
IndexLanguage | Optional | Variant | The sorting language to be used for the specified index. Can be any of the WdLanguageID constants. For the list of valid WdLanguageID constants, see the Object Browser in the Visual Basic Editor.

Return Value

Index

Remarks

An index is built from Index Entry (XE) fields in a document. Use the MarkEntry method to mark index entries to be included in an index.

Example

This example marks an index entry, and then it creates an index at the end of the active document.

VBA Copy code Copy code
ActiveDocument.Indexes.MarkEntry _
 Range:=Selection.Range, Entry:="My Entry"
Set MyRange = ActiveDocument.Content
MyRange.Collapse Direction:=wdCollapseEnd
ActiveDocument.Indexes.Add Range:=MyRange, Type:=wdIndexRunin

See also

Concepts

Indexes Collection Object

Other resources

Indexes Object Members


Indexes.AutoMarkEntries Method (Word)

 Copy code hover
[image]

Indexes.AutoMarkEntries Method (Word)
See also Send feedback

Published: July 16, 2012

Automatically adds XE (Index Entry) fields to the specified document, using the entries from a concordance file.

Syntax

expression .AutoMarkEntries(ConcordanceFileName)

expression Required. A variable that represents an Indexes collection.

Parameters

Name | Required/Optional | Data Type | Description
ConcordanceFileName | Required | String | The concordance file name that includes a list of items to be indexed.

Remarks

A concordance file is a Word document that contains a two-column table, with terms to index in the first column and index entries in the second column.

Example

This example adds index entries to Thesis.doc based on the entries in C:\Documents\List.doc.

VBA Copy code Copy code
Documents("Thesis.doc").Indexes.AutoMarkEntries _
 ConcordanceFileName:="C:\Documents\List.doc"

See also

Concepts

Indexes Collection Object

Other resources

Indexes Object Members


Indexes.Item Method (Word)

 Copy code hover
[image]

Indexes.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual Index object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents an Indexes collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The individual object to be returned. Can be a Long indicating the ordinal position of the individual object.

Return Value

Index

See also

Concepts

Indexes Collection Object

Other resources

Indexes Object Members


Indexes.MarkAllEntries Method (Word)

 Copy code hover
[image]

Indexes.MarkAllEntries Method (Word)
See also Send feedback

Published: July 16, 2012

Inserts an XE (Index Entry) field after all instances of the text in Range.

Syntax

expression .MarkAllEntries(Range, Entry, EntryAutoText, CrossReference, CrossReferenceAutoText, BookmarkName, Bold, Italic)

expression Required. A variable that represents an Indexes collection.

Parameters

Name | Required/Optional | Data Type | Description
Range | Required | Range object | The range whose text is marked with an XE field throughout the document.
Entry | Optional | Variant | The text you want to appear in the index, in the form MainEntry[:Subentry].
EntryAutoText | Optional | Variant | The AutoText entry that contains the text you want to appear in the index (if this argument is specified, Entry is ignored).
CrossReference | Optional | Variant | A cross-reference that will appear in the index.
CrossReferenceAutoText | Optional | Variant | The name of the AutoText entry that contains the text for a cross-reference (if this argument is specified, CrossReference is ignored).
BookmarkName | Optional | Variant | The bookmark name that marks the range of pages you want to appear in the index. If this argument is omitted, the number of the page that contains the XE field appears in the index.
Bold | Optional | Variant | True to add bold formatting to page numbers for index entries.
Italic | Optional | Variant | True to add italic formatting to page numbers for index entries.

Example

This example marks the selected text with TA fields throughout the active document and then updates the first index in the document. The entry text in the index matches the selected text.

VBA Copy code Copy code
If Selection.Type = wdSelectionNormal Then
 ActiveDocument.Indexes.MarkAllEntries _
 Range:=Selection.Range, _
 Entry:=Selection.Range.Text, Italic:=True
 ActiveDocument.Indexes(1).Update
End If

See also

Concepts

Indexes Collection Object

Other resources

Indexes Object Members


Indexes.MarkEntry Method (Word)

 Copy code hover
[image]

Indexes.MarkEntry Method (Word)
See also Send feedback

Published: July 16, 2012

Inserts an XE (Index Entry) field after the specified range. The method returns a Field object representing the XE field.

Syntax

expression .MarkEntry(Range, Entry, EntryAutoText, CrossReference, CrossReferenceAutoText, BookmarkName, Bold, Italic, Reading)

expression Required. A variable that represents an Indexes collection.

Parameters

Name | Required/Optional | Data Type | Description
Range | Required | Range object | The location of the entry. The XE field is inserted after Range.
Entry | Optional | Variant | The text that appears in the index. To indicate a subentry, include the main entry text and the subentry text, separated by a colon (:) (for example, "Introduction:The Product").
EntryAutoText | Optional | Variant | The AutoText entry name that includes text for the index, table of figures, or table of contents (Entry is ignored).
CrossReference | Optional | Variant | A cross-reference that will appear in the index (for example, "See Apples").
CrossReferenceAutoText | Optional | Variant | The AutoText entry name that contains the text for a cross-reference (CrossReference is ignored).
BookmarkName | Optional | Variant | The name of the bookmark that marks the range of pages you want to appear in the index. If this argument is omitted, the number of the page containing the XE field appears in the index.
Bold | Optional | Variant | True to add bold formatting to the entry page numbers in the index.
Italic | Optional | Variant | True to add italic formatting to the entry page numbers in the index.
Reading | Optional | Variant | True shows an index entry in the right location when indexes are sorted phonetically (East Asian languages only).

Return Value

Field

Example

This example inserts an index entry after the selection in the active document. The subentry text is the text from the selection.

VBA Copy code Copy code
If Selection.Type = wdSelectionNormal Then
 ActiveDocument.Indexes.MarkEntry Range:=Selection.Range, _
 Entry:="Introduction:" & Selection.Range.Text, Italic:=True
End If

See also

Concepts

Indexes Collection Object

Other resources

Indexes Object Members


InlineShape Object (Word)

 Copy code hover
[image]

InlineShape Object (Word)
See also Send feedback

Published: July 16, 2012

Represents an object in the text layer of a document. An inline shape can only be a picture, an OLE object, or an ActiveX control. The InlineShape object is a member of the InlineShapes collection. The InlineShapes collection contains all the shapes that appear inline in a document, range, or selection.

Remarks

InlineShape objects are treated like characters and are positioned as characters within a line of text.

Use InlineShapes(Index), where Index is the index number, to return a single InlineShape object. Inline shapes don't have names. The following example activates the first inline shape in the active document.

VBA Copy code Copy code
ActiveDocument.InlineShapes(1).Activate

Shape objects are anchored to a range of text but are free-floating and can be positioned anywhere on the page. You can use the ConvertToInlineShape method and the ConvertToShape method to convert shapes from one type to the other. You can convert only pictures, OLE objects, and ActiveX controls to inline shapes. Use the Type property to return the type of inline shape: picture, linked picture, embedded OLE object, linked OLE object, or ActiveX control.

Note Note

When you open a document created in an earlier version of Word, pictures are converted to inline shapes.

See also

Concepts

Word Object Model Reference

Other resources

InlineShape Object Members


InlineShape Members (Word)

 Copy code hover
[image]

InlineShape Members (Word)
Send feedback

Published: July 16, 2012

Represents an object in the text layer of a document. An inline shape can only be a picture, an OLE object, or an ActiveX control. The InlineShape object is a member of the InlineShapes collection. The InlineShapes collection contains all the shapes that appear inline in a document, range, or selection.

Methods

Name | Description
ConvertToShape | Converts an inline shape to a free-floating shape. Returns a Shape object that represents the new shape.
Delete | Deletes the specified inline shape.
Reset | Removes changes that were made to an inline shape.
Select | Selects the specified inline shape.

Properties

Name | Description
AlternativeText | Returns or sets a String that represents the alternative text associated with a shape in a Web page. Read/write.
Application | Returns an Application object that represents the Microsoft Word application.
Borders | Returns a Borders collection that represents all the borders for the specified shape.
Chart | Returns a Chart object that represents a chart within the collection of inline shapes in a document. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Field | Returns a Field object that represents the field associated with the specified inline shape. Read-only.
Fill | Returns a FillFormat object that contains fill formatting properties for the specified shape. Read-only.
Glow | Returns a GlowFormat object that represents the formatting properties for a glow effect. Read-only.
GroupItems | Returns a GroupShapes collection that represents the shapes that are grouped together for an inline shape. Read-only.
HasChart | True if the specified shape is a chart. Read-only.
HasSmartArt | Returns True if there is a SmartArt diagram present on the shape. Read-only.
Height | Returns or sets the height of an inline shape. Read/write Single.
HorizontalLineFormat | Returns a HorizontalLineFormat object that contains the horizontal line formatting for the specified InlineShape object. Read-only.
Hyperlink | Returns a Hyperlink object that represents the hyperlink associated with the specified inline shape. Read-only.
IsPictureBullet | True indicates that an InlineShape object is a picture bullet. Read-only Boolean.
Line | Returns a LineFormat object that contains line formatting properties for the specified shape. Read-only.
LinkFormat | Returns a LinkFormat object that represents the link options of the specified inline shape that is linked to a file. Read/only.
LockAspectRatio | MsoTrue if the specified shape retains its original proportions when you resize it. MsoFalse if you can change the height and width of the shape independently of one another when you resize it. Read/write MsoTriState.
OLEFormat | Returns an OLEFormat object that represents the OLE characteristics (other than linking) for the specified inline shape. Read-only.
Parent | Returns an Object that represents the parent object of the specified InlineShape object.
PictureFormat | Returns a PictureFormat object that contains picture formatting properties for the inline shape. Read-only.
Range | Returns a Range object that represents the portion of a document that is contained within an inline shape.
Reflection | Returns a ReflectionFormat object that represents the reflection formatting for a shape. Read-only.
ScaleHeight | Scales the height of the specified inline shape relative to its original size. Read/write Single.
ScaleWidth | Scales the width of the specified inline shape relative to its original size. Read/write Single.
Script | Returns a Script object, which represents a block of script or code associated with an image on the specified Web page.
Shadow | Returns a ShadowFormat object that represents the shadow formatting for the specified shape. Read-only.
SmartArt | Returns a SmartArt object that provides a way to work with the SmartArt associated with the specified inline shape. Read-only.
SoftEdge | Returns a SoftEdgeFormat object that represents the soft edge formatting for a shape. Read-only.
TextEffect | Returns a TextEffectFormat object that contains text-effect formatting properties for the specified inline shape. Read-only.
Title | Returns or sets a String that contains a title for the specified inline shape. Read/write.
Type | Returns the type of inline shape. Read-only WdInlineShapeType.
Width | Returns or sets the width, in points, of the specified inline shape. Read/write Long.


InlineShape Properties (Word)

 Copy code hover
[image]

InlineShape Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
AlternativeText | Returns or sets a String that represents the alternative text associated with a shape in a Web page. Read/write.
Application | Returns an Application object that represents the Microsoft Word application.
Borders | Returns a Borders collection that represents all the borders for the specified shape.
Chart | Returns a Chart object that represents a chart within the collection of inline shapes in a document. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Field | Returns a Field object that represents the field associated with the specified inline shape. Read-only.
Fill | Returns a FillFormat object that contains fill formatting properties for the specified shape. Read-only.
Glow | Returns a GlowFormat object that represents the formatting properties for a glow effect. Read-only.
GroupItems | Returns a GroupShapes collection that represents the shapes that are grouped together for an inline shape. Read-only.
HasChart | True if the specified shape is a chart. Read-only.
HasSmartArt | Returns True if there is a SmartArt diagram present on the shape. Read-only.
Height | Returns or sets the height of an inline shape. Read/write Single.
HorizontalLineFormat | Returns a HorizontalLineFormat object that contains the horizontal line formatting for the specified InlineShape object. Read-only.
Hyperlink | Returns a Hyperlink object that represents the hyperlink associated with the specified inline shape. Read-only.
IsPictureBullet | True indicates that an InlineShape object is a picture bullet. Read-only Boolean.
Line | Returns a LineFormat object that contains line formatting properties for the specified shape. Read-only.
LinkFormat | Returns a LinkFormat object that represents the link options of the specified inline shape that is linked to a file. Read/only.
LockAspectRatio | MsoTrue if the specified shape retains its original proportions when you resize it. MsoFalse if you can change the height and width of the shape independently of one another when you resize it. Read/write MsoTriState.
OLEFormat | Returns an OLEFormat object that represents the OLE characteristics (other than linking) for the specified inline shape. Read-only.
Parent | Returns an Object that represents the parent object of the specified InlineShape object.
PictureFormat | Returns a PictureFormat object that contains picture formatting properties for the inline shape. Read-only.
Range | Returns a Range object that represents the portion of a document that is contained within an inline shape.
Reflection | Returns a ReflectionFormat object that represents the reflection formatting for a shape. Read-only.
ScaleHeight | Scales the height of the specified inline shape relative to its original size. Read/write Single.
ScaleWidth | Scales the width of the specified inline shape relative to its original size. Read/write Single.
Script | Returns a Script object, which represents a block of script or code associated with an image on the specified Web page.
Shadow | Returns a ShadowFormat object that represents the shadow formatting for the specified shape. Read-only.
SmartArt | Returns a SmartArt object that provides a way to work with the SmartArt associated with the specified inline shape. Read-only.
SoftEdge | Returns a SoftEdgeFormat object that represents the soft edge formatting for a shape. Read-only.
TextEffect | Returns a TextEffectFormat object that contains text-effect formatting properties for the specified inline shape. Read-only.
Title | Returns or sets a String that contains a title for the specified inline shape. Read/write.
Type | Returns the type of inline shape. Read-only WdInlineShapeType.
Width | Returns or sets the width, in points, of the specified inline shape. Read/write Long.


InlineShape.AlternativeText Property (Word)

 Copy code hover
[image]

InlineShape.AlternativeText Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a String that represents the alternative text associated with a shape in a Web page. Read/write.

Syntax

expression .AlternativeText

expression A variable that represents an InlineShape object.

Example

The following example sets the alternative text for the selected shape in the active window. The selected shape is a picture of a mallard duck.

VBA Copy code Copy code
ActiveWindow.Selection.Shapes(1) _
 .AlternativeText = "This is a mallard duck."

See also

Concepts

InlineShape Object

Other resources

InlineShape Object Members


InlineShape.Application Property (Word)

 Copy code hover
[image]

InlineShape.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents an InlineShape object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

InlineShape Object

Other resources

InlineShape Object Members


InlineShape.Borders Property (Word)

 Copy code hover
[image]

InlineShape.Borders Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Borders collection that represents all the borders for the specified shape.

Syntax

expression .Borders

expression Required. A variable that represents an InlineShape object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection .

See also

Concepts

InlineShape Object

Other resources

InlineShape Object Members


InlineShape.Chart Property (Word)

 Copy code hover
[image]

InlineShape.Chart Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Chart object that represents a chart within the collection of inline shapes in a document. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Chart

expression An expression that returns a InlineShape object.

See also

Concepts

InlineShape Object

Other resources

InlineShape Object Members


InlineShape.Creator Property (Word)

 Copy code hover
[image]

InlineShape.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents an InlineShape object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

InlineShape Object

Other resources

InlineShape Object Members


InlineShape.Field Property (Word)

 Copy code hover
[image]

InlineShape.Field Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Field object that represents the field associated with the specified inline shape. Read-only.

Syntax

expression .Field

expression A variable that represents an InlineShape object.

Remarks

Use the Fields property to return the Fields collection.

Example

This example inserts a graphic as an inline shape (using an INCLUDEPICTURE field) and then displays the shape's field code.

VBA Copy code Copy code
Dim iShapeNew As InlineShape

Set iShapeNew = _
 ActiveDocument.InlineShapes _
 .AddPicture(FileName:="C:\Windows\Tiles.bmp", _
 LinkToFile:=True, SaveWithDocument:=False, _
 Range:=Selection.Range)

MsgBox iShapeNew.Field.Code.Text

See also

Concepts

InlineShape Object

Other resources

InlineShape Object Members


InlineShape.Fill Property (Word)

 Copy code hover
[image]

InlineShape.Fill Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a FillFormat object that contains fill formatting properties for the specified shape. Read-only.

Syntax

expression .Fill

expression A variable that represents an InlineShape object.

Example

This example adds a rectangle to myDocument and then sets the foreground color, background color, and gradient for the rectangle's fill.

VBA Copy code Copy code
Set myDocument = Documents(1)
With myDocument.Shapes.AddShape(msoShapeRectangle, _
 90, 90, 90, 50).Fill
 .ForeColor.RGB = RGB(128, 0, 0)
 .BackColor.RGB = RGB(170, 170, 170)
 .TwoColorGradient msoGradientHorizontal, 1
End With

See also

Concepts

InlineShape Object

Other resources

InlineShape Object Members


InlineShape.Glow Property (Word)

 Copy code hover
[image]

InlineShape.Glow Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a GlowFormat object that represents the formatting properties for a glow effect. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Glow

expression An expression that returns an InlineShape object.

See also

Concepts

InlineShape Object

Other resources

InlineShape Object Members


InlineShape.GroupItems Property (Word)

 Copy code hover
[image]

InlineShape.GroupItems Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a GroupShapes collection that represents the shapes that are grouped together for an inline shape. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .GroupItems

expression An expression that returns an InlineShape object.

See also

Concepts

InlineShape Object

Other resources

InlineShape Object Members


InlineShape.HasChart Property (Word)

 Copy code hover
[image]

InlineShape.HasChart Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified shape is a chart. Read-only.

Syntax

expression .HasChart

expression An expression that returns an InlineShape object.

Remarks

This property always returns false for OLE charts. For OLE charts, use InlineShape.OLEFormat.ProgID and check for the following possible values: "Excel.Chart.8", "MSGraph.Chart.8", "Excel.Sheet.8", "Excel.Chart.5", "MSGraph.Chart.5", or "Excel.Sheet.5".

See also

Concepts

InlineShape Object

Other resources

InlineShape Object Members


InlineShape.HasSmartArt Property (Word)

 Copy code hover
[image]

InlineShape.HasSmartArt Property (Word)
See also Send feedback

Published: July 16, 2012

Returns True if there is a SmartArt diagram present on the shape. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .HasSmartArt

expression A variable that represents an InlineShape object.

Example

The following code example displays whether or not the first inline shape in the active document contains SmartArt.

VBA Copy code Copy code
Dim myInlineShape As InlineShape

Set myInlineShape = ActiveDocument.InlineShapes(1)

If myInlineShape.HasSmartArt Then
 MsgBox "The first shape contains SmartArt."
Else
 MsgBox "The first shape contains no SmartArt."
End If

See also

Concepts

InlineShape Object

Other resources

InlineShape Object Members


InlineShape.Height Property (Word)

 Copy code hover
[image]

InlineShape.Height Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the height of an inline shape. Read/write Single.

Syntax

expression .Height

expression An expression that represents a InlineShape object.

See also

Concepts

InlineShape Object

Other resources

InlineShape Object Members


InlineShape.HorizontalLineFormat Property (Word)

 Copy code hover
[image]

InlineShape.HorizontalLineFormat Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a HorizontalLineFormat object that contains the horizontal line formatting for the specified InlineShape object. Read-only.

Syntax

expression .HorizontalLineFormat

expression A variable that represents a InlineShape object.

Example

This example sets the length of the specified horizontal line to 50% of the window width.

VBA Copy code Copy code
ActiveDocument.InlineShapes(1).HorizontalLineFormat _
 .PercentWidth = 50

See also

Concepts

InlineShape Object

Other resources

InlineShape Object Members


InlineShape.Hyperlink Property (Word)

 Copy code hover
[image]

InlineShape.Hyperlink Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Hyperlink object that represents the hyperlink associated with the specified inline shape. Read-only.

Syntax

expression .Hyperlink

expression A variable that represents an InlineShape object.

Remarks

If there is no hyperlink associated with the specified shape, an error occurs. In this case, use the Add method for the Hyperlinks collection to add a hyperlink to the specified shape. The following example shows how to do this.

VBA Copy code Copy code
ActiveDocument.Hyperlinks.Add Selection.InlineShapes(1), "http://www.microsoft.com"

Example

This example displays the address for the hyperlink for the first shape in the active document.

VBA Copy code Copy code
MsgBox ActiveDocument.Shapes(1).Hyperlink.Address

See also

Concepts

InlineShape Object

Other resources

InlineShape Object Members


InlineShape.IsPictureBullet Property (Word)

 Copy code hover
[image]

InlineShape.IsPictureBullet Property (Word)
See also Send feedback

Published: July 16, 2012

True indicates that an InlineShape object is a picture bullet. Read-only Boolean.

Syntax

expression .IsPictureBullet

expression An expression that returns a InlineShape object.

Remarks

Although picture bullets are considered inline shapes, searching a document's InlineShapes collection will not return picture bullets.

Example

This example formats the selected list if the list if formatted with a picture bullet. If not, a message is displayed.

VBA Copy code Copy code
Sub IsSelectionAPictureBullet(shp As InlineShape)
 On Error GoTo ErrorHandler
 If shp.IsPictureBullet = True Then
 shp.Width = InchesToPoints(0.5)
 shp.Height = InchesToPoints(0.05)
 End If
 Exit Sub
ErrorHandler:
 MsgBox "The selection is not a list or " & _
 "does not contain picture bullets."
End Sub

Use the following code to call the routine above.

VBA Copy code Copy code
Sub CallPic()
 Call IsSelectionAPictureBullet(shp:=Selection _
 .Range.ListFormat.ListPictureBullet)
End Sub

See also

Concepts

InlineShape Object

Other resources

InlineShape Object Members


InlineShape.Line Property (Word)

 Copy code hover
[image]

InlineShape.Line Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a LineFormat object that contains line formatting properties for the specified shape. Read-only.

Syntax

expression .Line

expression A variable that represents an InlineShape object.

Remarks

For an inline shape with a border, the LineFormat object represents the border.

See also

Concepts

InlineShape Object

Other resources

InlineShape Object Members


InlineShape.LinkFormat Property (Word)

 Copy code hover
[image]

InlineShape.LinkFormat Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a LinkFormat object that represents the link options of the specified inline shape that is linked to a file. Read/only.

Syntax

expression .LinkFormat

expression A variable that represents an InlineShape object.

See also

Concepts

InlineShape Object

Other resources

InlineShape Object Members


InlineShape.LockAspectRatio Property (Word)

 Copy code hover
[image]

InlineShape.LockAspectRatio Property (Word)
See also Send feedback

Published: July 16, 2012

MsoTrue if the specified shape retains its original proportions when you resize it. MsoFalse if you can change the height and width of the shape independently of one another when you resize it. Read/write MsoTriState.

Syntax

expression .LockAspectRatio

expression Required. A variable that represents an InlineShape object.

See also

Concepts

InlineShape Object

Other resources

InlineShape Object Members


InlineShape.OLEFormat Property (Word)

 Copy code hover
[image]

InlineShape.OLEFormat Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an OLEFormat object that represents the OLE characteristics (other than linking) for the specified inline shape. Read-only.

Syntax

expression .OLEFormat

expression A variable that represents an InlineShape object.

See also

Concepts

InlineShape Object

Other resources

InlineShape Object Members


InlineShape.Parent Property (Word)

 Copy code hover
[image]

InlineShape.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified InlineShape object.

Syntax

expression .Parent

expression Required. A variable that represents an InlineShape object.

See also

Concepts

InlineShape Object

Other resources

InlineShape Object Members


InlineShape.PictureFormat Property (Word)

 Copy code hover
[image]

InlineShape.PictureFormat Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a PictureFormat object that contains picture formatting properties for the inline shape. Read-only.

Syntax

expression .PictureFormat

expression A variable that represents an InlineShape object.

Remarks

Applies to InlineShape objects that represent pictures or OLE objects.

See also

Concepts

InlineShape Object

Other resources

InlineShape Object Members


InlineShape.Range Property (Word)

 Copy code hover
[image]

InlineShape.Range Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the portion of a document that is contained within an inline shape.

Syntax

expression .Range

expression Required. A variable that represents an InlineShape object.

See also

Concepts

InlineShape Object

Other resources

InlineShape Object Members


InlineShape.Reflection Property (Word)

 Copy code hover
[image]

InlineShape.Reflection Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a ReflectionFormat object that represents the reflection formatting for a shape. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Reflection

expression An expression that returns an InlineShape object.

See also

Concepts

InlineShape Object

Other resources

InlineShape Object Members


InlineShape.ScaleHeight Property (Word)

 Copy code hover
[image]

InlineShape.ScaleHeight Property (Word)
See also Send feedback

Published: July 16, 2012

Scales the height of the specified inline shape relative to its original size. Read/write Single.

Syntax

expression .ScaleHeight

expression Required. A variable that represents an InlineShape object.

Example

This example sets the height and width of the first inline shape in the active document to 150 percent of the shape's original height and width.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 .ScaleHeight = 150
 .ScaleWidth = 150
End With

See also

Concepts

InlineShape Object

Other resources

InlineShape Object Members


InlineShape.ScaleWidth Property (Word)

 Copy code hover
[image]

InlineShape.ScaleWidth Property (Word)
See also Send feedback

Published: July 16, 2012

Scales the width of the specified inline shape relative to its original size. Read/write Single.

Syntax

expression .ScaleWidth

expression Required. A variable that represents an InlineShape object.

Example

This example sets the height and width of the first inline shape in the active document to 150 percent of the shape's original height and width.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 .ScaleHeight = 150
 .ScaleWidth = 150
End With

See also

Concepts

InlineShape Object

Other resources

InlineShape Object Members


InlineShape.Script Property (Word)

 Copy code hover
[image]

InlineShape.Script Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Script object, which represents a block of script or code associated with an image on the specified Web page.

Syntax

expression .Script

expression Required. A variable that represents an InlineShape object.

Remarks

If the page contains no script, nothing is returned.

See also

Concepts

InlineShape Object

Other resources

InlineShape Object Members


InlineShape.Shadow Property (Word)

 Copy code hover
[image]

InlineShape.Shadow Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a ShadowFormat object that represents the shadow formatting for the specified shape. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Shadow

expression An expression that returns an InlineShape object.

See also

Concepts

InlineShape Object

Other resources

InlineShape Object Members


InlineShape.SmartArt Property (Word)

 Copy code hover
[image]

InlineShape.SmartArt Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a SmartArt object that provides a way to work with the SmartArt associated with the specified inline shape. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .SmartArt

expression A variable that represents an InlineShape object.

Remarks

The SmartArt property provides an entry point for interacting with a SmartArt graphic associated with the inline shape.

Example

The following code example adds a SmartArt graphic to the active document.

VBA Copy code Copy code
Dim myDoc As Document
Dim myInlineShape As InlineShape
Dim mySmartArt As SmartArt

Set myDoc = ActiveDocument
Set myInlineShape = myDoc.InlineShapes.AddSmartArt(Application.SmartArtLayouts(2), myDoc.Paragraphs(2).Range)
Set mySmartArt = myShape.SmartArt

See also

Concepts

InlineShape Object

Other resources

InlineShape Object Members


InlineShape.SoftEdge Property (Word)

 Copy code hover
[image]

InlineShape.SoftEdge Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a SoftEdgeFormat object that represents the soft edge formatting for a shape. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .SoftEdge

expression An expression that returns an InlineShape object.

See also

Concepts

InlineShape Object

Other resources

InlineShape Object Members


InlineShape.TextEffect Property (Word)

 Copy code hover
[image]

InlineShape.TextEffect Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a TextEffectFormat object that contains text-effect formatting properties for the specified inline shape. Read-only.

Syntax

expression .TextEffect

expression A variable that represents an InlineShape object.

Example

This example sets the font style to bold for shape three on myDocument if the shape is WordArt.

VBA Copy code Copy code
Set myDocument = ActiveDocument
With myDocument.Shapes(3)
 If .Type = msoTextEffect Then
 .TextEffect.FontBold = True
 End If
End With

See also

Concepts

InlineShape Object

Other resources

InlineShape Object Members


InlineShape.Title Property (Word)

 Copy code hover
[image]

InlineShape.Title Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a String that contains a title for the specified inline shape. Read/write.

Version Information

Version Added: Word 2010

Syntax

expression .Title

expression A variable that represents an InlineShape object.

Remarks

Use the Title property to provide an alternative text title for an inline shape. This property adds title text to the Title text box on the Alt Text pane of the Format Shape dialog in Word 2010.

Note Note

Web browsers display alternative text while tables are loading or if they are missing. Web search engines use the alternative text to help find Web pages. Alternative text is also used to assist disabilities.

Example

The following code example adds an alternative text title to the first inline shape in the active document.

VBA Copy code Copy code
ActiveDocument.InlineShapes(1).Title = "Desktop screenshot."

See also

Concepts

InlineShape Object

Other resources

InlineShape Object Members


InlineShape.Type Property (Word)

 Copy code hover
[image]

InlineShape.Type Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the type of inline shape. Read-only WdInlineShapeType.

Syntax

expression .Type

expression Required. A variable that represents an InlineShape object.

See also

Concepts

InlineShape Object

Other resources

InlineShape Object Members


InlineShape.Width Property (Word)

 Copy code hover
[image]

InlineShape.Width Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the width, in points, of the specified inline shape. Read/write Long.

Syntax

expression .Width

expression A variable that represents an InlineShape object.

See also

Concepts

InlineShape Object

Other resources

InlineShape Object Members


InlineShape Methods (Word)

 Copy code hover
[image]

InlineShape Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
ConvertToShape | Converts an inline shape to a free-floating shape. Returns a Shape object that represents the new shape.
Delete | Deletes the specified inline shape.
Reset | Removes changes that were made to an inline shape.
Select | Selects the specified inline shape.


InlineShape.ConvertToShape Method (Word)

 Copy code hover
[image]

InlineShape.ConvertToShape Method (Word)
See also Send feedback

Published: July 16, 2012

Converts an inline shape to a free-floating shape. Returns a Shape object that represents the new shape.

Syntax

expression .ConvertToShape

expression Required. A variable that represents an InlineShape object.

Remarks

You must apply the AddNodes method to a FreeformBuilder object at least once before you use the ConvertToShape method.

Example

This example converts the first inline shape in the active document to a floating shape.

VBA Copy code Copy code
ActiveDocument.InlineShapes(1).ConvertToShape

See also

Concepts

InlineShape Object

Other resources

InlineShape Object Members


InlineShape.Delete Method (Word)

 Copy code hover
[image]

InlineShape.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the specified inline shape.

Syntax

expression .Delete

expression Required. A variable that represents an InlineShape object.

See also

Concepts

InlineShape Object

Other resources

InlineShape Object Members


InlineShape.Reset Method (Word)

 Copy code hover
[image]

InlineShape.Reset Method (Word)
See also Send feedback

Published: July 16, 2012

Removes changes that were made to an inline shape.

Syntax

expression .Reset

expression Required. A variable that represents an InlineShape object.

Example

This example inserts a picture as an inline shape, changes the brightness, and then resets the picture to its original brightness.

VBA Copy code Copy code
Set aInLine = ActiveDocument.InlineShapes.AddPicture _
 (FileName:="C:\Windows\Bubbles.bmp", Range:=Selection.Range)
aInLine.PictureFormat.Brightness = 0.5
MsgBox "Changing brightness back"
aInLine.Reset

See also

Concepts

InlineShape Object

Other resources

InlineShape Object Members


InlineShape.Select Method (Word)

 Copy code hover
[image]

InlineShape.Select Method (Word)
See also Send feedback

Published: July 16, 2012

Selects the specified inline shape.

Syntax

expression .Select

expression Required. A variable that represents an InlineShape object.

Remarks

After using this method, use the Selection property to work with the selected items. For more information, see Working with the Selection Object.

See also

Concepts

InlineShape Object

Other resources

InlineShape Object Members


InlineShapes Object (Word)

 Copy code hover
[image]

InlineShapes Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of InlineShape objects that represent all the inline shapes in a document, range, or selection.

Remarks

Use the InlineShapes property to return the InlineShapes collection. The following example converts each inline shape in the active document to a Shape object.

VBA Copy code Copy code
For Each iShape In ActiveDocument.InlineShapes
 iShape.ConvertToShape
Next iShape

Use the New method to create a new picture as an inline shape. You can use the AddPicture and AddOLEObject methods to add pictures or OLE objects and link them to a source file. Use the AddOLEControl method to add an ActiveX control.

Shape objects are anchored to a range of text but are free-floating and can be positioned anywhere on the page. You can use the ConvertToInlineShape method and the ConvertToShape method to convert shapes from one type to the other. You can convert only pictures, OLE objects, and ActiveX controls to inline shapes.

The Count property for this collection in a document returns the number of items in the main story only. To count items in other stories use the collection with the Range object.

When you open a document created in an earlier version of Word, pictures are converted to inline shapes.

See also

Concepts

Word Object Model Reference

Other resources

InlineShapes Object Members


InlineShapes Members (Word)

 Copy code hover
[image]

InlineShapes Members (Word)
Send feedback

Published: July 16, 2012

A collection of InlineShape objects that represent all the inline shapes in a document, range, or selection.

Methods

Name | Description
AddChart2 | Adds a chart to the document. Returns an InlineShape object that represents the chart and adds it to the specified collection.
AddHorizontalLine | Adds a horizontal line based on an image file to the current document.
AddHorizontalLineStandard | Adds a horizontal line to the current document.
AddOLEControl | Creates an ActiveX control (formerly known as an OLE control). Returns the InlineShape object that represents the new ActiveX control.
AddOLEObject | Creates an OLE object. Returns the InlineShape object that represents the new OLE object.
AddPicture | Adds a picture to a document. Returns an InlineShape object that represents the picture.
AddPictureBullet | Adds a picture bullet based on an image file to the current document. Returns an InlineShape object.
AddSmartArt | Inserts a SmartArt graphic as an inline shape into the active document.
AddWebVideo | Adds a new web video to the document.
Item | Returns an individual InlineShape object in a collection.
New | Inserts an empty, 1-inch-square Word picture object surrounded by a border. This method returns the new graphic as an InlineShape object.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of inline shapes in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified InlineShapes object.


InlineShapes Properties (Word)

 Copy code hover
[image]

InlineShapes Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of inline shapes in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified InlineShapes object.


InlineShapes.Application Property (Word)

 Copy code hover
[image]

InlineShapes.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents an InlineShapes collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

InlineShapes Collection Object

Other resources

InlineShapes Object Members


InlineShapes.Count Property (Word)

 Copy code hover
[image]

InlineShapes.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of inline shapes in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents an InlineShapes collection.

See also

Concepts

InlineShapes Collection Object

Other resources

InlineShapes Object Members


InlineShapes.Creator Property (Word)

 Copy code hover
[image]

InlineShapes.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents an InlineShapes collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

InlineShapes Collection Object

Other resources

InlineShapes Object Members


InlineShapes.Parent Property (Word)

 Copy code hover
[image]

InlineShapes.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified InlineShapes object.

Syntax

expression .Parent

expression Required. A variable that represents an InlineShapes collection.

See also

Concepts

InlineShapes Collection Object

Other resources

InlineShapes Object Members


InlineShapes Methods (Word)

 Copy code hover
[image]

InlineShapes Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
AddChart2 | Adds a chart to the document. Returns an InlineShape object that represents the chart and adds it to the specified collection.
AddHorizontalLine | Adds a horizontal line based on an image file to the current document.
AddHorizontalLineStandard | Adds a horizontal line to the current document.
AddOLEControl | Creates an ActiveX control (formerly known as an OLE control). Returns the InlineShape object that represents the new ActiveX control.
AddOLEObject | Creates an OLE object. Returns the InlineShape object that represents the new OLE object.
AddPicture | Adds a picture to a document. Returns an InlineShape object that represents the picture.
AddPictureBullet | Adds a picture bullet based on an image file to the current document. Returns an InlineShape object.
AddSmartArt | Inserts a SmartArt graphic as an inline shape into the active document.
AddWebVideo | Adds a new web video to the document.
Item | Returns an individual InlineShape object in a collection.
New | Inserts an empty, 1-inch-square Word picture object surrounded by a border. This method returns the new graphic as an InlineShape object.


InlineShapes.AddChart2 Method (Word)

 Copy code hover
[image]

InlineShapes.AddChart2 Method (Word)
See also Send feedback

Published: July 16, 2012

Adds a chart to the document. Returns an InlineShape object that represents the chart and adds it to the specified collection.

Version information

Version Added: Word 2013

Syntax

expression .AddChart2(Style,Type,Range,NewLayout)

expression A variable that represents a InlineShapes object.

Parameters

Name | Required/Optional | Data type | Description
Style | Optional | INT32 | The chart style.
Type | Optional | XLCHARTTYPE | The type of chart.
Range | Optional | VARIANT | The range where the chart will be placed in the text. The chart replaces the range, unless the range is collapsed. If this argument is omitted, the chart is placed automatically.
NewLayout | Optional | VARIANT | If NewLayout is true, the chart is inserted by using the new dynamic formatting rules (Title is on, and Legend is on only if there are multiple series).
Type | Optional | XLCHARTTYPE |

Return value

INLINESHAPE

See also

Concepts

InlineShapes Collection

Other resources

InlineShapes Members


InlineShapes.AddHorizontalLine Method (Word)

 Copy code hover
[image]

InlineShapes.AddHorizontalLine Method (Word)
See also Send feedback

Published: July 16, 2012

Adds a horizontal line based on an image file to the current document.

Syntax

expression .AddHorizontalLine(FileName, Range)

expression Required. A variable that represents an InlineShapes collection.

Parameters

Name | Required/Optional | Data Type | Description
FileName | Required | String | The file name of the image you want to use for the horizontal line.
Range | Optional | Variant | The range above which Microsoft Word places the horizontal line. If this argument is omitted, Word places the horizontal line above the current selection.

Remarks

To add a horizontal line that isn't based on an existing image file, use the AddHorizontalLineStandard method.

Example

This example adds a horizontal line above the current selection in the active document using a file called "ArtsyRule.gif."

VBA Copy code Copy code
Selection.InlineShapes.AddHorizontalLine _
 "C:\Art files\ArtsyRule.gif"

See also

Concepts

InlineShapes Collection Object

Other resources

InlineShapes Object Members


InlineShapes.AddHorizontalLineStandard Method (Word)

 Copy code hover
[image]

InlineShapes.AddHorizontalLineStandard Method (Word)
See also Send feedback

Published: July 16, 2012

Adds a horizontal line to the current document.

Syntax

expression .AddHorizontalLineStandard(Range)

expression Required. A variable that represents an InlineShapes collection.

Parameters

Name | Required/Optional | Data Type | Description
Range | Optional | Variant | The range above which Microsoft Word places the horizontal line. If this argument is omitted, Word places the horizontal line above the current selection.

Remarks

To add a horizontal line based on an existing image file, use the AddHorizontalLine method.

Example

This example adds a horizontal line above the fifth paragraph in the active document.

VBA Copy code Copy code
ActiveDocument.Paragraphs(5).Range _
 .InlineShapes.AddHorizontalLineStandard

See also

Concepts

InlineShapes Collection Object

Other resources

InlineShapes Object Members


InlineShapes.AddOLEControl Method (Word)

 Copy code hover
[image]

InlineShapes.AddOLEControl Method (Word)
See also Send feedback

Published: July 16, 2012

Creates an ActiveX control (formerly known as an OLE control). Returns the InlineShape object that represents the new ActiveX control.

Syntax

expression .AddOLEControl(ClassType, Range)

expression Required. A variable that represents an InlineShapes collection.

Parameters

Name | Required/Optional | Data Type | Description
ClassType | Optional | Variant | The programmatic identifier for the ActiveX control to be created.
Range | Optional | Variant | The range where the ActiveX control will be placed in the text. The ActiveX control replaces the range, if the range isn't collapsed. If this argument is omitted, the Active X control is placed automatically.

Remarks

ActiveX controls are represented as either Shape objects or InlineShape objects in Microsoft Word. To modify the properties for an ActiveX control, you use the Object property of the OLEFormat object for the specified shape or inline shape.

For information about available ActiveX control class types, see OLE Programmatic Identifiers .

See also

Concepts

InlineShapes Collection Object

Other resources

InlineShapes Object Members


InlineShapes.AddOLEObject Method (Word)

 Copy code hover
[image]

InlineShapes.AddOLEObject Method (Word)
See also Send feedback

Published: July 16, 2012

Creates an OLE object. Returns the InlineShape object that represents the new OLE object.

Syntax

expression .AddOLEObject(ClassType, FileName, LinkToFile, DisplayAsIcon, IconFileName, IconIndex, IconLabel, Range)

expression Required. A variable that represents an InlineShapes collection.

Parameters

Name | Required/Optional | Data Type | Description
ClassType | Optional | Variant | The name of the application used to activate the specified OLE object.
FileName | Optional | Variant | The file from which the object is to be created. If this argument is omitted, the current folder is used. You must specify either the ClassType or FileName argument for the object, but not both.
LinkToFile | Optional | Variant | True to link the OLE object to the file from which it was created. False to make the OLE object an independent copy of the file. If you specified a value for ClassType, the LinkToFile argument must be False. The default value is False.
DisplayAsIcon | Optional | Variant | True to display the OLE object as an icon. The default value is False.
IconFileName | Optional | Variant | The file that contains the icon to be displayed.
IconIndex | Optional | Variant | The index number of the icon within IconFileName. The order of icons in the specified file corresponds to the order in which the icons appear in the Change Icon dialog box (Insert menu, Object dialog box) when the Display as icon check box is selected. The first icon in the file has the index number 0 (zero). If an icon with the given index number doesn't exist in IconFileName, the icon with the index number 1 (the second icon in the file) is used. The default value is 0 (zero).
IconLabel | Optional | Variant | A label (caption) to be displayed beneath the icon.
Range | Optional | Variant | The range where the OLE object will be placed in the text. The OLE object replaces the range, unless the range is collapsed. If this argument is omitted, the object is placed automatically.

Example

This example adds a new Microsoft Excel worksheet to the active document at the second paragraph.

VBA Copy code Copy code
ActiveDocument.InlineShapes.AddOLEObject _
 ClassType:="Excel.Sheet", DisplayAsIcon:=False, _
 Range:=ActiveDocument.Paragraphs(2).Range

See also

Concepts

InlineShapes Collection Object

Other resources

InlineShapes Object Members


InlineShapes.AddPicture Method (Word)

 Copy code hover
[image]

InlineShapes.AddPicture Method (Word)
See also Send feedback

Published: July 16, 2012

Adds a picture to a document. Returns an InlineShape object that represents the picture.

Syntax

expression .AddPicture(FileName, LinkToFile, SaveWithDocument, Range)

expression Required. A variable that represents an InlineShapes collection.

Parameters

Name | Required/Optional | Data Type | Description
FileName | Required | String | The path and file name of the picture.
LinkToFile | Optional | Variant | True to link the picture to the file from which it was created. False to make the picture an independent copy of the file. The default value is False.
SaveWithDocument | Optional | Variant | True to save the linked picture with the document. The default value is False.
Range | Optional | Variant | The location where the picture will be placed in the text. If the range isn't collapsed, the picture replaces the range; otherwise, the picture is inserted. If this argument is omitted, the picture is placed automatically.

See also

Concepts

InlineShapes Collection Object

Other resources

InlineShapes Object Members


InlineShapes.AddPictureBullet Method (Word)

 Copy code hover
[image]

InlineShapes.AddPictureBullet Method (Word)
See also Send feedback

Published: July 16, 2012

Adds a picture bullet based on an image file to the current document. Returns an InlineShape object.

Syntax

expression .AddPictureBullet(FileName, Range)

expression Required. A variable that represents an InlineShapes collection.

Parameters

Name | Required/Optional | Data Type | Description
FileName | Required | String | The file name of the image you want to use for the picture bullet.
Range | Optional | Variant | The range to which Microsoft Word adds the picture bullet. Word adds the picture bullet to each paragraph in the range. If this argument is omitted, Word adds the picture bullet to each paragraph in the current selection.

Return Value

InlineShape

Example

This example adds a picture bullet to each paragraph in the selected text using a file called "RedBullet.gif."

VBA Copy code Copy code
Selection.InlineShapes.AddPictureBullet _
 "C:\Art files\RedBullet.gif"

See also

Concepts

InlineShapes Collection Object

Other resources

InlineShapes Object Members


InlineShapes.AddSmartArt Method (Word)

 Copy code hover
[image]

InlineShapes.AddSmartArt Method (Word)
See also Send feedback

Published: July 16, 2012

Inserts a SmartArt graphic as an inline shape into the active document.

Version Information

Version Added: Word 2010

Syntax

expression .AddSmartArt(Layout, Range)

expression An expression that returns a InlineShapes object.

Parameters

Name | Required/Optional | Data Type | Description
Layout | Required | [SMARTARTLAYOUT] | A SmartArtLayoutobject that specifies the layout for the SmartArt graphic.
Range | Optional | Variant | Specifies the text to which the SmartArt graphic is bound. If Range is specified, the SmartArt graphic is positioned at the beginning of the first paragraph in the range. If this argument is omitted, the range is selected automatically, and the SmartArt graphic is positioned relative to the top and left edges of the page.

Return Value

InlineShape

See also

Concepts

InlineShapes Collection Object

Other resources

InlineShapes Object Members


InlineShapes.AddWebVideo Method (Word)

 Copy code hover
[image]

InlineShapes.AddWebVideo Method (Word)
See also Send feedback

Published: July 16, 2012

Adds a new web video to the document.

Version information

Version Added: Word 2013

Syntax

expression .AddWebVideo(EmbedCode,VideoWidth,VideoHeight,PosterFrameImage,Url,Range)

expression A variable that represents a InlineShapes object.

Parameters

Name | Required/Optional | Data type | Description
EmbedCode | Required | STRING | The embed code for the video.
VideoWidth | Required | VARIANT | An integer that represents the width of the web video in pixels.
VideoHeight | Required | VARIANT | An integer that represents the height of the web video in pixels.
PosterFrameImage | Optional | VARIANT | A string that points to the file to use as the poster frame for the web video.
Url | Optional | VARIANT | The URL to the video.
Range | Optional | VARIANT | The range at which to insert the web video. If Range is omitted, the current selection is used.

Return value

INLINESHAPE

See also

Concepts

InlineShapes Collection

Other resources

InlineShapes Members


InlineShapes.Item Method (Word)

 Copy code hover
[image]

InlineShapes.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual InlineShape object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents an InlineShapes collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The individual object to be returned. Can be a Long indicating the ordinal position of the individual object.

Return Value

InlineShape

See also

Concepts

InlineShapes Collection Object

Other resources

InlineShapes Object Members


InlineShapes.New Method (Word)

 Copy code hover
[image]

InlineShapes.New Method (Word)
See also Send feedback

Published: July 16, 2012

Inserts an empty, 1-inch-square Word picture object surrounded by a border. This method returns the new graphic as an InlineShape object.

Syntax

expression .New(Range)

expression Required. A variable that represents an InlineShapes collection.

Parameters

Name | Required/Optional | Data Type | Description
Range | Required | Range object | The location of the new graphic.

Return Value

InlineShape

Example

This example inserts a new, empty picture in the active document and applies a shadow border around the picture.

VBA Copy code Copy code
Dim ishapeNew As InlineShape

Set ishapeNew = _
 ActiveDocument.InlineShapes.New(Range:=Selection.Range)

ishapeNew.Borders.Shadow = True
ActiveDocument.ActiveWindow.View.ShowFieldCodes = False

See also

Concepts

InlineShapes Collection Object

Other resources

InlineShapes Object Members


Interior Object (Word)

 Copy code hover
[image]

Interior Object (Word)
See also Send feedback

Published: July 16, 2012

Represents the interior of an object.

Version Information

Version Added: Word 2007

Example

The following example enables up and down bars, and then sets the interior color of the up bars to green, for the first chart group of the first chart in the active document. Use the UpBars.Interior property to return the Interior object.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.ChartGroups(1)
 .HasUpDownBars = True
 .UpBars.Interior.ColorIndex = 4
 End With
 End If
End With

See also

Concepts

Word Object Model Reference

Other resources

Interior Object Members


Interior Members (Word)

 Copy code hover
[image]

Interior Members (Word)
Send feedback

Published: July 16, 2012

Represents the interior of an object.

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
Color | Returns or sets the primary color of the object. Read/write Variant.
ColorIndex | Returns or sets the color of the interior. Read/write Variant.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
InvertIfNegative | True if Microsoft Word inverts the pattern in the object when it corresponds to a negative number. Read/write Variant.
Parent | Returns the parent for the specified object. Read-only Object.
Pattern | Returns or sets a Variant value, containing an XlPattern constant, that represents the interior pattern.
PatternColor | Returns or sets the color of the interior pattern as an RGB value. Read/write Variant.
PatternColorIndex | Returns or sets the color of the interior pattern as an index into the current color palette, or as one of the following XlColorIndex constants: xlColorIndexAutomatic or xlColorIndexNone. Read/write Long.


Interior Properties (Word)

 Copy code hover
[image]

Interior Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
Color | Returns or sets the primary color of the object. Read/write Variant.
ColorIndex | Returns or sets the color of the interior. Read/write Variant.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
InvertIfNegative | True if Microsoft Word inverts the pattern in the object when it corresponds to a negative number. Read/write Variant.
Parent | Returns the parent for the specified object. Read-only Object.
Pattern | Returns or sets a Variant value, containing an XlPattern constant, that represents the interior pattern.
PatternColor | Returns or sets the color of the interior pattern as an RGB value. Read/write Variant.
PatternColorIndex | Returns or sets the color of the interior pattern as an index into the current color palette, or as one of the following XlColorIndex constants: xlColorIndexAutomatic or xlColorIndexNone. Read/write Long.


Interior.Application Property (Word)

 Copy code hover
[image]

Interior.Application Property (Word)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Application

expression A variable that represents an Interior object.

Example

The following example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveDocument
If myObject.Application.Value = "Microsoft Word" Then
 MsgBox "This is a Word Application object."
Else
 MsgBox "This is not a Word Application object."
End If

See also

Concepts

Interior Object

Other resources

Interior Object Members


Interior.Color Property (Word)

 Copy code hover
[image]

Interior.Color Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the primary color of the object. Read/write Variant.

Version Information

Version Added: Word 2007

Syntax

expression .Color

expression A variable that represents an Interior object.

See also

Concepts

Interior Object

Other resources

Interior Object Members


Interior.ColorIndex Property (Word)

 Copy code hover
[image]

Interior.ColorIndex Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the color of the interior. Read/write Variant.

Version Information

Version Added: Word 2007

Syntax

expression .ColorIndex

expression A variable that represents an Interior object.

Remarks

The color is specified as an index value into the current color palette, or as one of the following XlColorIndex constants:

  • xlColorIndexAutomatic

  • xlColorIndexNone

See also

Concepts

Interior Object

Other resources

Interior Object Members


Interior.Creator Property (Word)

 Copy code hover
[image]

Interior.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version Information

Version Added: Word 2007

Syntax

expression .Creator

expression A variable that represents an Interior object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD". This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Word has the creator code MSWD. For more information about this property, consult the language reference Help included with Microsoft Office for Mac.

See also

Concepts

Interior Object

Other resources

Interior Object Members


Interior.InvertIfNegative Property (Word)

 Copy code hover
[image]

Interior.InvertIfNegative Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word inverts the pattern in the object when it corresponds to a negative number. Read/write Variant.

Version Information

Version Added: Word 2007

Syntax

expression .InvertIfNegative

expression A variable that represents an Interior object.

See also

Concepts

Interior Object

Other resources

Interior Object Members


Interior.Parent Property (Word)

 Copy code hover
[image]

Interior.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the parent for the specified object. Read-only Object.

Version Information

Version Added: Word 2007

Syntax

expression .Parent

expression A variable that represents an Interior object.

See also

Concepts

Interior Object

Other resources

Interior Object Members


Interior.Pattern Property (Word)

 Copy code hover
[image]

Interior.Pattern Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Variant value, containing an XlPattern constant, that represents the interior pattern.

Version Information

Version Added: Word 2007

Syntax

expression .Pattern

expression A variable that represents an Interior object.

Example

The following example enables up and down bars, then adds a criss-cross pattern to the down bars and sets the pattern color to red, for the first chart group of the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.ChartGroups(1)
 .HasUpDownBars = True
 .DownBars.Interior.Pattern = xlPatternCrissCross
 .DownBars.Interior.PatternColorIndex = 3
 End With
 End If
End With

See also

Concepts

Interior Object

Other resources

Interior Object Members


Interior.PatternColor Property (Word)

 Copy code hover
[image]

Interior.PatternColor Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the color of the interior pattern as an RGB value. Read/write Variant.

Version Information

Version Added: Word 2007

Syntax

expression .PatternColor

expression A variable that represents an Interior object.

Example

The following example enables up and down bars, then adds a criss-cross pattern to the down bars and sets the pattern color to blue, for the first chart group of the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.ChartGroups(1)
 .HasUpDownBars = True
 .DownBars.Interior.Pattern = xlPatternCrissCross
 .DownBars.Interior.PatternColor = RGB(0, 0, 255)
 End With
 End If
End With

See also

Concepts

Interior Object

Other resources

Interior Object Members


Interior.PatternColorIndex Property (Word)

 Copy code hover
[image]

Interior.PatternColorIndex Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the color of the interior pattern as an index into the current color palette, or as one of the following XlColorIndex constants: xlColorIndexAutomatic or xlColorIndexNone. Read/write Long.

Version Information

Version Added: Word 2007

Syntax

expression .PatternColorIndex

expression A variable that represents an Interior object.

Remarks

Set this property to xlColorIndexAutomatic to specify the automatic fill style for drawing objects. Set this property to xlColorIndexNone to specify that you do not want a pattern (this is the same as setting the Pattern property of the Interior object to xlPatternNone).

Example

The following example enables up and down bars, then adds a criss-cross pattern to the down bars and sets the pattern color to red, for the first chart group of the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.ChartGroups(1)
 .HasUpDownBars = True
 .DownBars.Interior.Pattern = xlPatternCrissCross
 .DownBars.Interior.PatternColorIndex = 3
 End With
 End If
End With

See also

Concepts

Interior Object

Other resources

Interior Object Members


KeyBinding Object (Word)

 Copy code hover
[image]

KeyBinding Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a custom key assignment in the current context. The KeyBinding object is a member of the KeyBindings collection.

Remarks

Use KeyBindings(Index), where Index is the index number, to return a single KeyBinding object. The following example displays the command associated with the first KeyBinding object in the KeyBindings collection.

VBA Copy code Copy code
MsgBox KeyBindings(1).Command

You can also use the FindKey property and the Key method to return a KeyBinding object.

Note Note

Custom key assignments are made in the Customize Keyboard dialog box.

See also

Concepts

Word Object Model Reference

Other resources

KeyBinding Object Members


KeyBinding Members (Word)

 Copy code hover
[image]

KeyBinding Members (Word)
Send feedback

Published: July 16, 2012

Represents a custom key assignment in the current context. The KeyBinding object is a member of the KeyBindings collection.

Methods

Name | Description
Clear | Removes the specified key binding from the KeyBindings collection and resets a built-in command to its default key assignment.
Disable | Removes the specified key combination if it is currently assigned to a command. After you use this method, the key combination has no effect.
Execute | Runs the command associated with the specified key combination.
Rebind | Changes the command assigned to the specified key binding.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Command | Returns the command assigned to the specified key combination. Read-only String.
CommandParameter | Returns the command parameter assigned to the specified shortcut key. Read-only String.
Context | Returns an Object that represents the storage location of the specified key binding. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
KeyCategory | Returns the type of item assigned to the specified key binding. Read-only WdKeyCategory.
KeyCode | Returns a unique number for the first key in the specified key binding. Read-only Long.
KeyCode2 | Returns a unique number for the second key in the specified key binding. Read-only Long.
KeyString | Returns the key combination string for the specified keys (for example, CTRL+SHIFT+A). Read-only String.
Parent | Returns an Object that represents the parent object of the specified KeyBinding object.
Protected | True if you cannot change the specified key binding in the Customize Keyboard dialog box. Read-only Boolean.


KeyBinding Properties (Word)

 Copy code hover
[image]

KeyBinding Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Command | Returns the command assigned to the specified key combination. Read-only String.
CommandParameter | Returns the command parameter assigned to the specified shortcut key. Read-only String.
Context | Returns an Object that represents the storage location of the specified key binding. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
KeyCategory | Returns the type of item assigned to the specified key binding. Read-only WdKeyCategory.
KeyCode | Returns a unique number for the first key in the specified key binding. Read-only Long.
KeyCode2 | Returns a unique number for the second key in the specified key binding. Read-only Long.
KeyString | Returns the key combination string for the specified keys (for example, CTRL+SHIFT+A). Read-only String.
Parent | Returns an Object that represents the parent object of the specified KeyBinding object.
Protected | True if you cannot change the specified key binding in the Customize Keyboard dialog box. Read-only Boolean.


KeyBinding.Application Property (Word)

 Copy code hover
[image]

KeyBinding.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a KeyBinding object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

KeyBinding Object

Other resources

KeyBinding Object Members


KeyBinding.Command Property (Word)

 Copy code hover
[image]

KeyBinding.Command Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the command assigned to the specified key combination. Read-only String.

Syntax

expression .Command

expression A variable that represents a KeyBinding object.

Example

This example displays the keys assigned to font names. A message is displayed if no keys have been assigned to fonts.

VBA Copy code Copy code
Dim kbLoop As KeyBinding

For Each kbLoop In KeyBindings
 If kbLoop.KeyCategory = wdKeyCategoryFont Then
 Count = Count + 1
 MsgBox kbLoop.Command & vbCr & kbLoop.KeyString
 End If
Next kbLoop

If Count = 0 Then MsgBox "Keys haven't been assigned to fonts"

See also

Concepts

KeyBinding Object

Other resources

KeyBinding Object Members


KeyBinding.CommandParameter Property (Word)

 Copy code hover
[image]

KeyBinding.CommandParameter Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the command parameter assigned to the specified shortcut key. Read-only String.

Syntax

expression .CommandParameter

expression A variable that represents a KeyBinding object.

Remarks

For information about commands that take parameters, see the Add method. Use the Command property to return the command name assigned to the specified shortcut key.

Example

This example assigns a shortcut key to the FontSize command, with a command parameter of 8. Use the CommandParameter property to display the command parameter along with the command name and key string.

VBA Copy code Copy code
Dim kbNew As KeyBinding

Set kbNew = KeyBindings.Add(KeyCategory:=wdKeyCategoryCommand, _
 Command:="FontSize", _
 KeyCode:=BuildKeyCode(wdKeyControl, wdKeyAlt, wdKeyS), _
 CommandParameter:="8")
MsgBox kbNew.Command & Chr$(32) & kbNew.CommandParameter _
 & vbCr & kbNew.KeyString

See also

Concepts

KeyBinding Object

Other resources

KeyBinding Object Members


KeyBinding.Context Property (Word)

 Copy code hover
[image]

KeyBinding.Context Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the storage location of the specified key binding. Read-only.

Syntax

expression .Context

expression A variable that represents a KeyBinding object.

Remarks

This property can return a Document, Template, or Application object. Built-in key assignments (for example, CTRL+I for Italic) return the Application object as the context. Any key bindings you add will return a Document or Template object, depending on the customization context in effect when the KeyBinding object was added.

Example

This example adds the F2 key to the Italic command and then uses the For Each...Next loop to display the keys assigned to the Italic command along with the context.

VBA Copy code Copy code
Dim kbLoop As KeyBinding

CustomizationContext = NormalTemplate
KeyBindings.Add KeyCategory:=wdKeyCategoryCommand, _
 Command:="Italic", KeyCode:=wdKeyF2
For Each kbLoop In _
 KeysBoundTo(KeyCategory:=wdKeyCategoryCommand, _
 Command:="Italic")
 MsgBox kbLoop.KeyString & vbCr & kbLoop.Context.Name
Next kbLoop

See also

Concepts

KeyBinding Object

Other resources

KeyBinding Object Members


KeyBinding.Creator Property (Word)

 Copy code hover
[image]

KeyBinding.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a KeyBinding object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

KeyBinding Object

Other resources

KeyBinding Object Members


KeyBinding.KeyCategory Property (Word)

 Copy code hover
[image]

KeyBinding.KeyCategory Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the type of item assigned to the specified key binding. Read-only WdKeyCategory.

Syntax

expression .KeyCategory

expression Required. A variable that represents a KeyBinding object.

Example

This example displays the keys assigned to font names. A message is displayed if no keys have been assigned to fonts.

VBA Copy code Copy code
Dim kbLoop As KeyBinding
Dim intCount As Integer

intCount = 0

For Each kbLoop In KeyBindings
 If kbLoop.KeyCategory = wdKeyCategoryFont Then
 intCount = intCount + 1
 MsgBox kbLoop.Command & vbCr & kbLoop.KeyString
 End If
Next kbLoop

If intCount = 0 Then _
 MsgBox "Keys haven't been assigned to fonts"

See also

Concepts

KeyBinding Object

Other resources

KeyBinding Object Members


KeyBinding.KeyCode Property (Word)

 Copy code hover
[image]

KeyBinding.KeyCode Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a unique number for the first key in the specified key binding. Read-only Long.

Syntax

expression .KeyCode

expression An expression that returns a KeyBinding object.

Remarks

You create this number by using the BuildKeyCode method when you are adding key bindings by using the Add method of the KeyBindings object.

Example

This example displays a message if the KeyBindings collection includes the ALT+CTRL+W key combination.

VBA Copy code Copy code
Dim lngCode As Long
Dim kbLoop As KeyBinding

CustomizationContext = NormalTemplate
lngCode = BuildKeyCode(wdKeyAlt, wdKeyControl, wdKeyW)
For Each kbLoop In KeyBindings
 If lngCode = kbLoop.KeyCode Then
 MsgBox kbLoop.KeyString & " is already in use"
 End If
Next kbLoop

See also

Concepts

KeyBinding Object

Other resources

KeyBinding Object Members


KeyBinding.KeyCode2 Property (Word)

 Copy code hover
[image]

KeyBinding.KeyCode2 Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a unique number for the second key in the specified key binding. Read-only Long.

Syntax

expression .KeyCode2

expression An expression that returns a KeyBinding object.

Example

This example displays the key codes of each key in the KeyBindings collection (the collection of all the customized keys in the active document).

VBA Copy code Copy code
Dim aKey As KeyBinding

CustomizationContext = ActiveDocument
For Each aKey In KeyBindings
 If aKey.KeyCode2 <> wdNoKey Then
 MsgBox aKey.KeyString & vbCr _
 & "KeyCode1 = " & aKey.KeyCode & vbCr _
 & "KeyCode2 = " & aKey.KeyCode2
 Else
 MsgBox aKey.KeyString & vbCr _
 & "KeyCode1 = " & aKey.KeyCode
 End If
Next aKey

See also

Concepts

KeyBinding Object

Other resources

KeyBinding Object Members


KeyBinding.KeyString Property (Word)

 Copy code hover
[image]

KeyBinding.KeyString Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the key combination string for the specified keys (for example, CTRL+SHIFT+A). Read-only String.

Syntax

expression .KeyString

expression Required. A variable that represents a KeyBinding object.

Example

This example displays the key combination string for the first customized key combination in the Normal template.

VBA Copy code Copy code
CustomizationContext = NormalTemplate
If KeyBindings.Count >= 1 Then
 MsgBox KeyBindings(1).KeyString
End If

This example displays a message if the KeyBindings collection includes the ALT+CTRL+W key combination.

VBA Copy code Copy code
Dim aCode As Long
Dim aKey As KeyBinding

CustomizationContext = NormalTemplate
aCode = BuildKeyCode(wdKeyAlt, wdKeyControl, wdKeyW)
For Each aKey In KeyBindings
 If aCode = aKey.KeyCode Then
 MsgBox aKey.KeyString & " is already in use"
 End If
Next aKey

See also

Concepts

KeyBinding Object

Other resources

KeyBinding Object Members


KeyBinding.Parent Property (Word)

 Copy code hover
[image]

KeyBinding.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified KeyBinding object.

Syntax

expression .Parent

expression Required. A variable that represents a KeyBinding object.

See also

Concepts

KeyBinding Object

Other resources

KeyBinding Object Members


KeyBinding.Protected Property (Word)

 Copy code hover
[image]

KeyBinding.Protected Property (Word)
See also Send feedback

Published: July 16, 2012

True if you cannot change the specified key binding in the Customize Keyboard dialog box. Read-only Boolean.

Syntax

expression .Protected

expression An expression that returns a KeyBinding object.

Remarks

You can access the Customize Keyboard dialog box from the Tools menu; click Customize, and then click the Keyboard button.

Use the Add method of the KeyBindings object to add a key binding regardless of the protected status.

Example

This example displays the protection status for the CTRL+S key binding.

VBA Copy code Copy code
CustomizationContext = ActiveDocument.AttachedTemplate
MsgBox FindKey(BuildKeyCode(wdKeyControl, wdKeyS)).Protected

This example displays a message if the A key binding is protected.

VBA Copy code Copy code
CustomizationContext = NormalTemplate
If FindKey(BuildKeyCode(wdKeyA)).Protected = True Then
 MsgBox "The A key is protected"
End If

See also

Concepts

KeyBinding Object

Other resources

KeyBinding Object Members


KeyBinding Methods (Word)

 Copy code hover
[image]

KeyBinding Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Clear | Removes the specified key binding from the KeyBindings collection and resets a built-in command to its default key assignment.
Disable | Removes the specified key combination if it is currently assigned to a command. After you use this method, the key combination has no effect.
Execute | Runs the command associated with the specified key combination.
Rebind | Changes the command assigned to the specified key binding.


KeyBinding.Clear Method (Word)

 Copy code hover
[image]

KeyBinding.Clear Method (Word)
See also Send feedback

Published: July 16, 2012

Removes the specified key binding from the KeyBindings collection and resets a built-in command to its default key assignment.

Syntax

expression .Clear

expression A variable that represents a KeyBinding object.

Example

This example removes the ALT+F1 key assignment from the Normal template.

VBA Copy code Copy code
CustomizationContext = NormalTemplateFindKey(BuildKeyCode(Arg1:=wdKeyAlt, Arg2:=wdKeyF1)).Clear

See also

Concepts

KeyBinding Object

Other resources

KeyBinding Object Members


KeyBinding.Disable Method (Word)

 Copy code hover
[image]

KeyBinding.Disable Method (Word)
See also Send feedback

Published: July 16, 2012

Removes the specified key combination if it is currently assigned to a command. After you use this method, the key combination has no effect.

Syntax

expression .Disable

expression Required. A variable that represents a KeyBinding object.

Remarks

Using this method is the equivalent to clicking the Remove button in the Customize Keyboard dialog box. Use the Clear method with a KeyBinding object to reset a built-in command to its default key assignment. You don't need to remove or rebind a KeyBinding object before adding it elsewhere.

Example

This example removes the CTRL+SHIFT+B key assignment. This key combination is assigned to the Bold command by default.

VBA Copy code Copy code
CustomizationContext = NormalTemplate
FindKey(BuildKeyCode(wdKeyControl, wdKeyShift, wdKeyB)).Disable

This example assigns the CTRL+SHIFT+O key combination to the Organizer command. The example then uses the Disable method to remove the CTRL+SHIFT+O key combination and displays a message.

VBA Copy code Copy code
CustomizationContext = NormalTemplate
KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyO, _
 wdKeyControl, wdKeyShift), _
 KeyCategory:=wdKeyCategoryCommand, Command:="Organizer"
With FindKey(BuildKeyCode(wdKeyO, wdKeyControl, wdKeyShift))
 MsgBox .Command & " is assigned to CTRL+Shift+O"
 .Disable
 If .Command = "" Then MsgBox _
 "Nothing is assigned to CTRL+Shift+O"
End With

This example removes all key assignments for the global macro named "Macro1."

VBA Copy code Copy code
Dim kbLoop As KeyBinding

CustomizationContext = NormalTemplate
For Each kbLoop In KeysBoundTo _
 (KeyCategory:=wdKeyCategoryMacro, Command:="Macro1")
 kbLoop.Disable
Next kbLoop

See also

Concepts

KeyBinding Object

Other resources

KeyBinding Object Members


KeyBinding.Execute Method (Word)

 Copy code hover
[image]

KeyBinding.Execute Method (Word)
See also Send feedback

Published: July 16, 2012

Runs the command associated with the specified key combination.

Syntax

expression .Execute

expression Required. A variable that represents a KeyBinding object.

Example

This example assigns the CTRL+SHIFT+C key combination to the FileClose command and then executes the key combination (the document is closed).

VBA Copy code Copy code
CustomizationContext = ActiveDocument.AttachedTemplate
Keybindings.Add KeyCode:=BuildKeyCode(wdKeyControl, _
 wdKeyShift, wdKeyC), KeyCategory:=wdKeyCategoryCommand, _
 Command:="FileClose"
FindKey(BuildKeyCode(wdKeyControl, wdKeyShift, wdKeyC)).Execute

See also

Concepts

KeyBinding Object

Other resources

KeyBinding Object Members


KeyBinding.Rebind Method (Word)

 Copy code hover
[image]

KeyBinding.Rebind Method (Word)
See also Send feedback

Published: July 16, 2012

Changes the command assigned to the specified key binding.

Syntax

expression .Rebind(KeyCategory, Command, CommandParameter)

expression Required. A variable that represents a KeyBinding object.

Parameters

Name | Required/Optional | Data Type | Description
KeyCategory | Required | WdKeyCategory | The key category of the specified key binding.
Command | Required | String | The name of the specified command.
CommandParameter | Optional | Variant | Additional text, if any, required for the command specified by Command. For information about values for this argument, see the Add method.

Example

This example reassigns the CTRL+SHIFT+S key binding to the FileSaveAs command.

VBA Copy code Copy code
Dim kbTemp As KeyBinding

CustomizationContext = NormalTemplate
Set kbTemp = _
 FindKey(BuildKeyCode(wdKeyControl, wdKeyShift, wdKeyS))
kbTemp.Rebind KeyCategory:=wdKeyCategoryCommand, _
 Command:="FileSaveAs"

This example rebinds all keys assigned to the macro named "Macro1" to the macro named "ReportMacro."

VBA Copy code Copy code
Dim kbLoop As KeyBinding

CustomizationContext = ActiveDocument.AttachedTemplate
For Each kbLoop In _
 KeysBoundTo(KeyCategory:=wdKeyCategoryMacro, _
 Command:="Macro1")
 kbLoop.Rebind KeyCategory:=wdKeyCategoryMacro, _
 Command:="ReportMacro"
Next kbLoop

See also

Concepts

KeyBinding Object

Other resources

KeyBinding Object Members


KeyBindings Object (Word)

 Copy code hover
[image]

KeyBindings Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of KeyBinding objects that represent the custom key assignments in the current context. Custom key assignments are made in the Customize Keyboard dialog box.

Remarks

Use the KeyBindings property to return the KeyBindings collection. The following example inserts after the selection the command name and key combination for each item in the KeyBindings collection.

VBA Copy code Copy code
CustomizationContext = NormalTemplate
For Each aKey In KeyBindings
 Selection.InsertAfter aKey.Command & vbTab _
 & aKey.KeyString & vbCr
 Selection.Collapse Direction:=wdCollapseEnd
Next aKey

Use the Add method to add a KeyBinding object to the KeyBindings collection. The following example adds the CTRL+ALT+H key combination to the Heading 1 style in the active document.

VBA Copy code Copy code
CustomizationContext = ActiveDocument
KeyBindings.Add KeyCategory:=wdKeyCategoryStyle, _
 Command:="Heading 1", _
 KeyCode:=BuildKeyCode(wdKeyControl, wdKeyAlt, wdKeyH)

Use KeyBindings(Index), where Index is the index number, to return a single KeyBinding object. The following example displays the command associated with the first KeyBinding object in the KeyBindings collection.

VBA Copy code Copy code
MsgBox KeyBindings(1).Command

See also

Concepts

Word Object Model Reference

Other resources

KeyBindings Object Members


KeyBindings Members (Word)

 Copy code hover
[image]

KeyBindings Members (Word)
Send feedback

Published: July 16, 2012

A collection of KeyBinding objects that represent the custom key assignments in the current context. Custom key assignments are made in the Customize Keyboard dialog box.

Methods

Name | Description
Add | Returns a KeyBinding object that represents a new shortcut key for a macro, built-in command, font, AutoText entry, style, or symbol.
ClearAll | Clears all the customized key assignments and restores the original Microsoft Word shortcut key assignments.
Item | Returns an individual KeyBinding object in a collection.
Key | Returns a KeyBinding object that represents the specified custom key combination.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Context | Returns an Object that represents the storage location of the specified key binding. Read-only.
Count | Returns a Long that represents the number of key bindings in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified KeyBindings object.


KeyBindings Properties (Word)

 Copy code hover
[image]

KeyBindings Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Context | Returns an Object that represents the storage location of the specified key binding. Read-only.
Count | Returns a Long that represents the number of key bindings in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified KeyBindings object.


KeyBindings.Application Property (Word)

 Copy code hover
[image]

KeyBindings.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a KeyBindings collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

KeyBindings Collection Object

Other resources

KeyBindings Object Members


KeyBindings.Context Property (Word)

 Copy code hover
[image]

KeyBindings.Context Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the storage location of the specified key binding. Read-only.

Syntax

expression .Context

expression A variable that represents a KeyBindings collection.

Remarks

This property can return a Document, Template, or Application object. Built-in key assignments (for example, CTRL+I for Italic) return the Application object as the context. Any key bindings you add will return a Document or Template object, depending on the customization context in effect when the KeyBinding object was added.

See also

Concepts

KeyBindings Collection Object

Other resources

KeyBindings Object Members


KeyBindings.Count Property (Word)

 Copy code hover
[image]

KeyBindings.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of key bindings in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents a KeyBindings collection.

See also

Concepts

KeyBindings Collection Object

Other resources

KeyBindings Object Members


KeyBindings.Creator Property (Word)

 Copy code hover
[image]

KeyBindings.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a KeyBindings collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

KeyBindings Collection Object

Other resources

KeyBindings Object Members


KeyBindings.Parent Property (Word)

 Copy code hover
[image]

KeyBindings.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified KeyBindings object.

Syntax

expression .Parent

expression Required. A variable that represents a KeyBindings collection.

See also

Concepts

KeyBindings Collection Object

Other resources

KeyBindings Object Members


KeyBindings Methods (Word)

 Copy code hover
[image]

KeyBindings Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Returns a KeyBinding object that represents a new shortcut key for a macro, built-in command, font, AutoText entry, style, or symbol.
ClearAll | Clears all the customized key assignments and restores the original Microsoft Word shortcut key assignments.
Item | Returns an individual KeyBinding object in a collection.
Key | Returns a KeyBinding object that represents the specified custom key combination.


KeyBindings.Add Method (Word)

 Copy code hover
[image]

KeyBindings.Add Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a KeyBinding object that represents a new shortcut key for a macro, built-in command, font, AutoText entry, style, or symbol.

Syntax

expression .Add(KeyCategory, Command, KeyCode, KeyCode2, CommandParameter)

expression Required. A variable that represents a KeyBindings collection.

Parameters

Name | Required/Optional | Data Type | Description
KeyCategory | Required | WdKeyCategory | The category of the key assignment.
Command | Required | String | The command that the specified key combination executes.
KeyCode | Required | Long | A key you specify by using one of the WdKey constants.
KeyCode2 | Optional | Variant | A second key you specify by using one of the WdKey constants.
CommandParameter | Optional | Variant | Additional text, if any, required for the command specified by Command. For details, see the Remarks section below.

Return Value

KeyBinding

Remarks

You can use the BuildKeyCode method to create the KeyCode or KeyCode2 argument.

In the following table, the left column contains commands that require a command value, and the right column describes what you must do to specify CommandParameter for each of these commands. (The equivalent action in the Customize Keyboard dialog box (Tools menu) to specifying CommandParameter is selecting an item in the list box that appears when you select one of the following commands in the Commands box.)

If Command is set to | CommandParameter must be
Borders, Color, or Shading | A number — specified as text — corresponding to the position of the setting selected in the list box that contains values, where 0 (zero) is the first item, 1 is the second item, and so on
Columns | A number between 1 and 45 — specified as text — corresponding to the number of columns you want to apply
Condensed | A text measurement between 0.1 point and 12.75 points specified in 0.05-point increments (72 points = 1 inch)
Expanded | A text measurement between 0.1 point and 12.75 points specified in 0.05-point increments (72 points = 1 inch)
FileOpenFile | The path and file name of the file to be opened. If the path isn't specified, the current folder is used.
Font Size | A positive text measurement, specified in 0.5-point increments (72 points = 1 inch)
Lowered, Raised | A text measurement between 1 point and 64 points, specified in 0.5-point increments (72 points = 1 inch)
Symbol | A string created by concatenating a Chr() instruction and the name of a symbol font (for example, Chr(167) & "Symbol")

Example

This example adds the CTRL+ALT+W key combination to the FileClose command. The keyboard customization is saved in the Normal template.

VBA Copy code Copy code
CustomizationContext = NormalTemplate
KeyBindings.Add _
    KeyCategory:=wdKeyCategoryCommand, _
    Command:="FileClose", _
    KeyCode:=BuildKeyCode(wdKeyControl, wdKeyAlt, wdKeyW)

This example adds the ALT+F4 key combination to the Arial font and then displays the number of items in the KeyBindings collection. The example then clears the ALT+F4 key combination (returned it to its default setting) and redisplays the number of items in the KeyBindings collection.

VBA Copy code Copy code
CustomizationContext = ActiveDocument.AttachedTemplate
Set myKey = KeyBindings.Add(KeyCategory:=wdKeyCategoryFont, _
    Command:="Arial", KeyCode:=BuildKeyCode(wdKeyAlt, wdKeyF4))
MsgBox KeyBindings.Count & " keys in KeyBindings collection"
myKey.Clear
MsgBox KeyBindings.Count & " keys in KeyBindings collection"

This example adds the CTRL+ALT+S key combination to the Font command with 8 points specified for the font size.

VBA Copy code Copy code
CustomizationContext = NormalTemplate
KeyBindings.Add KeyCategory:=wdKeyCategoryCommand, _
    Command:="FontSize", _
    KeyCode:=BuildKeyCode(wdKeyControl, wdKeyAlt, wdKeyS), _
    CommandParameter:="8"

This example adds the CTRL+ALT+H key combination to the Heading 1 style in the active document.

VBA Copy code Copy code
CustomizationContext = ActiveDocument
KeyBindings.Add KeyCategory:=wdKeyCategoryStyle, _
    Command:="Heading 1", _
    KeyCode:=BuildKeyCode(wdKeyControl, wdKeyAlt, wdKeyH)

This example adds the CTRL+ALT+O key combination to the AutoText entry named "Hello."

VBA Copy code Copy code
CustomizationContext = ActiveDocument
KeyBindings.Add KeyCategory:=wdKeyCategoryAutoText, _
    Command:="Hello", _
    KeyCode:=BuildKeyCode(wdKeyControl, wdKeyAlt, wdKeyO)

See also

Concepts

KeyBindings Collection Object

Other resources

KeyBindings Object Members


KeyBindings.ClearAll Method (Word)

 Copy code hover
[image]

KeyBindings.ClearAll Method (Word)
See also Send feedback

Published: July 16, 2012

Clears all the customized key assignments and restores the original Microsoft Word shortcut key assignments.

Syntax

expression .ClearAll

expression A variable that represents a KeyBindings collection.

Example

This example clears the customized key assignments in the Normal template. The key assignments are reset to the default settings.

VBA Copy code Copy code
CustomizationContext = NormalTemplateKeyBindings.ClearAll

See also

Concepts

KeyBindings Collection Object

Other resources

KeyBindings Object Members


KeyBindings.Item Method (Word)

 Copy code hover
[image]

KeyBindings.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual KeyBinding object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents a KeyBindings collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The individual object to be returned. Can be a Long indicating the ordinal position of the individual object.

Return Value

KeyBinding

See also

Concepts

KeyBindings Collection Object

Other resources

KeyBindings Object Members


KeyBindings.Key Method (Word)

 Copy code hover
[image]

KeyBindings.Key Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a KeyBinding object that represents the specified custom key combination.

Syntax

expression .Key(KeyCode, KeyCode2)

expression A variable that represents a KeyBindings collection.

Parameters

Name | Required/Optional | Data Type | Description
KeyCode | Required | Long | A key you specify by using one of the WdKey constants.
KeyCode2 | Optional | Variant | A second key you specify by using one of the WdKey constants.

Return Value

KeyBinding

Remarks

If the key combination doesn't exist, this method returns Nothing.

You can use the BuildKeyCode method to create the KeyCode or KeyCode2 argument.

Example

This example assigns the ALT+F4 key combination to the Arial font and then displays the number of items in the KeyBindings collection. The example then clears the key combinations (returns it to its default setting) and redisplays the number of items in the KeyBindings collection.

VBA Copy code Copy code
CustomizationContext = NormalTemplate
KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyAlt, wdKeyF4), _
 KeyCategory:=wdKeyCategoryFont, Command:="Arial"
MsgBox KeyBindings.Count & " keys in KeyBindings collection"
KeyBindings.Key(KeyCode:=BuildKeyCode(wdKeyAlt, wdKeyF4)).Clear
MsgBox KeyBindings.Count & " keys in KeyBindings collection"

This example assigns the CTRL+SHIFT+U key combination to the macro named "Macro1" in the active document. The example uses the Key property to return a KeyBinding object so that Word can retrieve and display the command name.

VBA Copy code Copy code
CustomizationContext = ActiveDocument
KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyControl, _
 wdKeyShift, wdKeyU), KeyCategory:=wdKeyCategoryMacro, _
 Command:="Macro1"
MsgBox KeyBindings.Key(BuildKeyCode(wdKeyControl, _
 wdKeyShift, wdKeyU)).Command

This example determines whether the CTRL+SHIFT+A key combination is part of the KeyBindings collection.

VBA Copy code Copy code
Dim kbTemp As KeyBinding

CustomizationContext = NormalTemplate
Set kbTemp = KeyBindings.Key(BuildKeyCode(wdKeyControl, _
 wdKeyShift,wdKeyA))
If (kbTemp Is Nothing) Then MsgBox _
 "Key is not in the KeyBindings collection"

See also

Concepts

KeyBindings Collection Object

Other resources

KeyBindings Object Members


KeysBoundTo Object (Word)

 Copy code hover
[image]

KeysBoundTo Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of KeyBinding objects assigned to a command, style, macro, or other item in the current context.

Remarks

Use the KeysBoundTo property to return the KeysBoundTo collection. The following example displays the key combinations assigned to the FileNew command in the Normal template.

VBA Copy code Copy code
CustomizationContext = NormalTemplate
For Each myKey In KeysBoundTo(KeyCategory:=wdKeyCategoryCommand, _
 Command:="FileNew")
 myStr = myStr & myKey.KeyString & vbCr
Next myKey
MsgBox myStr

The following example displays the name of the document or template where the keys for the macro named "Macro1" are stored.

VBA Copy code Copy code
Set kb = KeysBoundTo(KeyCategory:=wdKeyCategoryMacro, _
 Command:="Macro1")
MsgBox kb.Context.Name

See also

Concepts

Word Object Model Reference

Other resources

KeysBoundTo Object Members


KeysBoundTo Members (Word)

 Copy code hover
[image]

KeysBoundTo Members (Word)
Send feedback

Published: July 16, 2012

A collection of KeyBinding objects assigned to a command, style, macro, or other item in the current context.

Methods

Name | Description
Item | Returns an individual KeyBinding object in a collection.
Key | Returns a KeyBinding object that represents the specified custom key combination.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Command | Returns a String that represents the command assigned to the specified key combination. Read-only.
CommandParameter | Returns the command parameter assigned to the specified shortcut key. Read-only String.
Context | Returns an Object that represents the storage location of the specified key binding. Read-only.
Count | Returns a Long that represents the number of keys in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
KeyCategory | Returns the type of item assigned to the specified key binding. Read-only WdKeyCategory.
Parent | Returns an Object that represents the parent object of the specified KeysBoundTo object.


KeysBoundTo Properties (Word)

 Copy code hover
[image]

KeysBoundTo Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Command | Returns a String that represents the command assigned to the specified key combination. Read-only.
CommandParameter | Returns the command parameter assigned to the specified shortcut key. Read-only String.
Context | Returns an Object that represents the storage location of the specified key binding. Read-only.
Count | Returns a Long that represents the number of keys in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
KeyCategory | Returns the type of item assigned to the specified key binding. Read-only WdKeyCategory.
Parent | Returns an Object that represents the parent object of the specified KeysBoundTo object.


KeysBoundTo.Application Property (Word)

 Copy code hover
[image]

KeysBoundTo.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a KeysBoundTo object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

KeysBoundTo Collection Object

Other resources

KeysBoundTo Object Members


KeysBoundTo.Command Property (Word)

 Copy code hover
[image]

KeysBoundTo.Command Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a String that represents the command assigned to the specified key combination. Read-only.

Syntax

expression .Command

expression A variable that represents a KeysBoundTo object.

Example

This example displays the keys assigned to font names. A message is displayed if no keys have been assigned to fonts.

VBA Copy code Copy code
Dim kbLoop As KeyBinding

For Each kbLoop In KeyBindings
 If kbLoop.KeyCategory = wdKeyCategoryFont Then
 Count = Count + 1
 MsgBox kbLoop.Command & vbCr & kbLoop.KeyString
 End If
Next kbLoop

If Count = 0 Then MsgBox "Keys haven't been assigned to fonts"

See also

Concepts

KeysBoundTo Collection Object

Other resources

KeysBoundTo Object Members


KeysBoundTo.CommandParameter Property (Word)

 Copy code hover
[image]

KeysBoundTo.CommandParameter Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the command parameter assigned to the specified shortcut key. Read-only String.

Syntax

expression .CommandParameter

expression A variable that represents a KeysBoundTo object.

Remarks

For information about commands that take parameters, see the Add method. Use the Command property to return the command name assigned to the specified shortcut key.

Example

This example assigns a shortcut key to the FontSize command, with a command parameter of 8. Use the CommandParameter property to display the command parameter along with the command name and key string.

VBA Copy code Copy code
Dim kbNew As KeyBinding

Set kbNew = KeyBindings.Add(KeyCategory:=wdKeyCategoryCommand, _
 Command:="FontSize", _
 KeyCode:=BuildKeyCode(wdKeyControl, wdKeyAlt, wdKeyS), _
 CommandParameter:="8")
MsgBox kbNew.Command & Chr$(32) & kbNew.CommandParameter _
 & vbCr & kbNew.KeyString

See also

Concepts

KeysBoundTo Collection Object

Other resources

KeysBoundTo Object Members


KeysBoundTo.Context Property (Word)

 Copy code hover
[image]

KeysBoundTo.Context Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the storage location of the specified key binding. Read-only.

Syntax

expression .Context

expression A variable that represents a KeysBoundTo object.

Remarks

This property can return a Document, Template, or Application object. Built-in key assignments (for example, CTRL+I for Italic) return the Application object as the context. Any key bindings you add will return a Document or Template object, depending on the customization context in effect when the KeyBinding object was added.

Example

This example displays the name of the document or template where the macro named "Macro1" is stored.

VBA Copy code Copy code
Sub TestContext1()
 Dim kbMacro1 As KeysBoundTo

 Set kbMacro1 = KeysBoundTo(KeyCategory:=wdKeyCategoryMacro, _
 Command:="Macro1")
 MsgBox kbMacro1.Context.Name
End Sub

See also

Concepts

KeysBoundTo Collection Object

Other resources

KeysBoundTo Object Members


KeysBoundTo.Count Property (Word)

 Copy code hover
[image]

KeysBoundTo.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of keys in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents a KeysBoundTo object.

See also

Concepts

KeysBoundTo Collection Object

Other resources

KeysBoundTo Object Members


KeysBoundTo.Creator Property (Word)

 Copy code hover
[image]

KeysBoundTo.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a KeysBoundTo object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

KeysBoundTo Collection Object

Other resources

KeysBoundTo Object Members


KeysBoundTo.KeyCategory Property (Word)

 Copy code hover
[image]

KeysBoundTo.KeyCategory Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the type of item assigned to the specified key binding. Read-only WdKeyCategory.

Syntax

expression .KeyCategory

expression Required. A variable that represents a KeysBoundTo object.

See also

Concepts

KeysBoundTo Collection Object

Other resources

KeysBoundTo Object Members


KeysBoundTo.Parent Property (Word)

 Copy code hover
[image]

KeysBoundTo.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified KeysBoundTo object.

Syntax

expression .Parent

expression Required. A variable that represents a KeysBoundTo object.

See also

Concepts

KeysBoundTo Collection Object

Other resources

KeysBoundTo Object Members


KeysBoundTo Methods (Word)

 Copy code hover
[image]

KeysBoundTo Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Item | Returns an individual KeyBinding object in a collection.
Key | Returns a KeyBinding object that represents the specified custom key combination.


KeysBoundTo.Item Method (Word)

 Copy code hover
[image]

KeysBoundTo.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual KeyBinding object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents a KeysBoundTo object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The individual object to be returned. Can be a Long indicating the ordinal position of the individual object.

Return Value

KeyBinding

See also

Concepts

KeysBoundTo Collection Object

Other resources

KeysBoundTo Object Members


KeysBoundTo.Key Method (Word)

 Copy code hover
[image]

KeysBoundTo.Key Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a KeyBinding object that represents the specified custom key combination.

Syntax

expression .Key(KeyCode, KeyCode2)

expression A variable that represents a KeysBoundTo object.

Parameters

Name | Required/Optional | Data Type | Description
KeyCode | Required | Long | A key you specify by using one of the WdKey constants.
KeyCode2 | Optional | Variant | A second key you specify by using one of the WdKey constants.

Return Value

KeyBinding

Remarks

If the key combination doesn't exist, this method returns Nothing.

You can use the BuildKeyCode method to create the KeyCode or KeyCode2 argument.

See also

Concepts

KeysBoundTo Collection Object

Other resources

KeysBoundTo Object Members


Language Object (Word)

 Copy code hover
[image]

Language Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a language used for proofing or formatting in Microsoft Word. The Language object is a member of the Languages collection.

Remarks

Use Languages(Index) to return a single Language object, where Index can be the value of the Name property, the value of the NameLocal property, one of the WdLanguageID constants, or one of the MsoLanguageID constants. (For the list of valid WdLanguageID or MsoLanguageID constants, see the Object Browser in the Visual Basic Editor.)

The Name property returns the name of a language, whereas the NameLocal property returns the name of a language in the language of the user. The following example returns the string "Italiano" for Name and "Italian (Standard)" for NameLocal when it is run in the U.S. English version of Word.

VBA Copy code Copy code
Sub ShowItalianNames()
 Msgbox Languages(wdItalian).Name
 Msgbox Languages(wdItalian).NameLocal
End Sub

For each language for which proofing tools are installed, you can use the ActiveGrammarDictionary, ActiveHyphenationDictionary, ActiveSpellingDictionary, and ActiveThesaurusDictionary properties to return the corresponding Dictionary object. The following example returns the full path for the active spelling dictionary used in the U.S. English version of Word.

VBA Copy code Copy code
Sub ShowDictionaryPath
 Set myspell = Languages(wdEnglishUS).ActiveSpellingDictionary
 MsgBox mySpell.Path & Application.PathSeparator & mySpell.Name
End Sub

The writing style is the set of rules used by the grammar checker. The WritingStyleList property returns an array of strings that represent the available writing styles for the specified language. The following example returns the list of writing styles for U.S. English.

VBA Copy code Copy code
Sub ListWritingStyles()
 WrStyles = Languages(wdEnglishUS).WritingStyleList
 For i = 1 To UBound(WrStyles)
 MsgBox WrStyles(i)
 Next i
End Sub

Use the DefaultWritingStyle property to set the default writing style you want Word to use.

VBA Copy code Copy code
Languages(wdEnglishUS).DefaultWritingStyle = "Casual"

You can override the default writing style with the ActiveWritingStyle property. This property is applied to a specified document for text marked in a specified language. The following example sets the writing style to be used for checking U.S. English, French, and German in the active document.

VBA Copy code Copy code
Sub SetWritingStyle()
 With ActiveDocument
 .ActiveWritingStyle(wdEnglishUS) = "Technical"
 .ActiveWritingStyle(wdFrench) = "Commercial"
 .ActiveWritingStyle(wdGerman) = "Technisch/Wiss"
 End With
End Sub

If you mark text as wdNoProofing, Word skips the marked text when running a spelling or grammar check.

Note Note

You must have the proofing tools installed for each language you intend to check. For more information on working in other languages, see Language-specific information.

See also

Concepts

Word Object Model Reference

Other resources

Language Object Members


Language Members (Word)

 Copy code hover
[image]

Language Members (Word)
Send feedback

Published: July 16, 2012

Represents a language used for proofing or formatting in Microsoft Word. The Language object is a member of the Languages collection.

Properties

Name | Description
ActiveGrammarDictionary | Returns a Dictionary object that represents the active grammar dictionary for the specified language. Read-only.
ActiveHyphenationDictionary | Returns a Dictionary object that represents the active hyphenation dictionary for the specified language. Read-only.
ActiveSpellingDictionary | Returns a Dictionary object that represents the active spelling dictionary for the specified language.
ActiveThesaurusDictionary | Returns a Dictionary object that represents the active thesaurus dictionary for the specified language.
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
DefaultWritingStyle | Returns or sets the default writing style used by the grammar checker for the specified language. Read/write String.
ID | Returns a number that identifies the specified language. Read-only WdLanguageID.
Name | Returns the name of the specified object. Read-only String.
NameLocal | Returns the name of a proofing tool language in the language of the user. Read-only String.
Parent | Returns an Object that represents the parent object of the specified Language object.
SpellingDictionaryType | Returns or sets the proofing tool type. Read/write WdDictionaryType.
WritingStyleList | Returns a string array that contains the names of all writing styles available for the specified language. Read-only Variant.


Language Properties (Word)

 Copy code hover
[image]

Language Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
ActiveGrammarDictionary | Returns a Dictionary object that represents the active grammar dictionary for the specified language. Read-only.
ActiveHyphenationDictionary | Returns a Dictionary object that represents the active hyphenation dictionary for the specified language. Read-only.
ActiveSpellingDictionary | Returns a Dictionary object that represents the active spelling dictionary for the specified language.
ActiveThesaurusDictionary | Returns a Dictionary object that represents the active thesaurus dictionary for the specified language.
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
DefaultWritingStyle | Returns or sets the default writing style used by the grammar checker for the specified language. Read/write String.
ID | Returns a number that identifies the specified language. Read-only WdLanguageID.
Name | Returns the name of the specified object. Read-only String.
NameLocal | Returns the name of a proofing tool language in the language of the user. Read-only String.
Parent | Returns an Object that represents the parent object of the specified Language object.
SpellingDictionaryType | Returns or sets the proofing tool type. Read/write WdDictionaryType.
WritingStyleList | Returns a string array that contains the names of all writing styles available for the specified language. Read-only Variant.


Language.ActiveGrammarDictionary Property (Word)

 Copy code hover
[image]

Language.ActiveGrammarDictionary Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Dictionary object that represents the active grammar dictionary for the specified language. Read-only.

Syntax

expression .ActiveGrammarDictionary

expression A variable that represents a Language object.

Remarks

If there is no grammar dictionary installed for the specified language, this property returns Nothing.

Example

This example displays the full path and file name of the active grammar dictionary.

VBA Copy code Copy code
Dim lngLanguage As Long
Dim dicGrammar As Dictionary

lngLanguage = Selection.LanguageID
Set dicGrammar = Languages(lngLanguage).ActiveGrammarDictionary
MsgBox dicGrammar.Path & Application.PathSeparator & dicGrammar.Name

See also

Concepts

Language Object

Other resources

Language Object Members


Language.ActiveHyphenationDictionary Property (Word)

 Copy code hover
[image]

Language.ActiveHyphenationDictionary Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Dictionary object that represents the active hyphenation dictionary for the specified language. Read-only.

Syntax

expression .ActiveHyphenationDictionary

expression A variable that represents a Language object.

Remarks

If there is no hyphenation dictionary installed for the specified language, this property returns Nothing.

Example

This example displays the full path and file name of the active hyphenation dictionary.

VBA Copy code Copy code
Dim lngLanguage As Long
Dim dicHyphen As Dictionary

lngLanguage = Selection.LanguageID
Set dicHyphen = Languages(lngLanguage).ActiveHyphenationDictionary
If dicHyphen Is Nothing Then
 MsgBox "No hyphenation dictionary installed!"
Else
 MsgBox dicHyphen.Path & Application.PathSeparator & dicHyphen.Name
End If

See also

Concepts

Language Object

Other resources

Language Object Members


Language.ActiveSpellingDictionary Property (Word)

 Copy code hover
[image]

Language.ActiveSpellingDictionary Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Dictionary object that represents the active spelling dictionary for the specified language.

Syntax

expression .ActiveSpellingDictionary

expression An expression that returns a Language object.

Remarks

If there is no spelling dictionary installed for the specified language, this property returns Nothing.

Example

This example returns the full path and file name of the active spelling dictionary.

VBA Copy code Copy code
Dim lngLanguage As Long
Dim dicSpelling As Dictionary

lngLanguage = Selection.LanguageID
Set dicSpelling = Languages(lngLanguage).ActiveSpellingDictionary
If dicSpelling Is Nothing Then
 MsgBox "No spelling dictionary installed!"
Else
 MsgBox dicSpelling.Path & Application.PathSeparator _
 & dicSpelling.Name
End If

See also

Concepts

Language Object

Other resources

Language Object Members


Language.ActiveThesaurusDictionary Property (Word)

 Copy code hover
[image]

Language.ActiveThesaurusDictionary Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Dictionary object that represents the active thesaurus dictionary for the specified language.

Syntax

expression .ActiveThesaurusDictionary

expression An expression that returns a Language object.

Remarks

If there is no thesaurus dictionary installed for the specified language, this property returns Nothing.

Example

This example returns the full path and file name of the active thesaurus dictionary.

VBA Copy code Copy code
Dim lngLanguage As Long
Dim dicThesaurus As Dictionary

lngLanguage = Selection.LanguageID
Set dicThesaurus = Languages(lngLanguage).ActiveThesaurusDictionary
If dicThesaurus Is Nothing Then
 MsgBox "No thesaurus dictionary installed!"
Else
 MsgBox dicThesaurus.Path & Application.PathSeparator _
 & dicThesaurus.Name
End If

See also

Concepts

Language Object

Other resources

Language Object Members


Language.Application Property (Word)

 Copy code hover
[image]

Language.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a Language object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

Language Object

Other resources

Language Object Members


Language.Creator Property (Word)

 Copy code hover
[image]

Language.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a Language object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Language Object

Other resources

Language Object Members


Language.DefaultWritingStyle Property (Word)

 Copy code hover
[image]

Language.DefaultWritingStyle Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the default writing style used by the grammar checker for the specified language. Read/write String.

Syntax

expression .DefaultWritingStyle

expression A variable that represents a Language object.

Remarks

This property controls the global setting for the writing style. The name of the writing style is the localized name for the specified language. When setting this property, you must use the exact name found in the Writing style box on the Spelling & Grammar tab in the Options dialog box (Tools menu).

The ActiveWritingStyle property sets the writing style for each language in a document. The ActiveWritingStyle setting overrides the DefaultWritingStyle setting.

Example

This example returns the default writing style in a message box.

VBA Copy code Copy code
Dim lngLanguage As Long

lngLanguage = Selection.LanguageID
Msgbox Languages(lngLanguage).DefaultWritingStyle

This example sets the writing style for U.S. English to Casual, and then it checks spelling and grammar in the active document.

VBA Copy code Copy code
Languages(wdEnglishUS).DefaultWritingStyle = "Casual"
ActiveDocument.CheckGrammar

See also

Concepts

Language Object

Other resources

Language Object Members


Language.ID Property (Word)

 Copy code hover
[image]

Language.ID Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a number that identifies the specified language. Read-only WdLanguageID.

Syntax

expression .ID

expression Required. A variable that represents a Language object.

Example

This example formats the selection with the Icelandic proofing tools language.

VBA Copy code Copy code
Selection.LanguageID = Languages("Icelandic").ID

See also

Concepts

Language Object

Other resources

Language Object Members


Language.Name Property (Word)

 Copy code hover
[image]

Language.Name Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the name of the specified object. Read-only String.

Syntax

expression .Name

expression Required. A variable that represents a Language object.

See also

Concepts

Language Object

Other resources

Language Object Members


Language.NameLocal Property (Word)

 Copy code hover
[image]

Language.NameLocal Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the name of a proofing tool language in the language of the user. Read-only String.

Syntax

expression .NameLocal

expression Required. A variable that represents a Language object.

Example

This example displays the name of the German language two different ways — first in the language of the user, and then in German.

VBA Copy code Copy code
MsgBox Languages(wdGerman).NameLocal
MsgBox Languages(wdGerman).Name

See also

Concepts

Language Object

Other resources

Language Object Members


Language.Parent Property (Word)

 Copy code hover
[image]

Language.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Language object.

Syntax

expression .Parent

expression Required. A variable that represents a Language object.

See also

Concepts

Language Object

Other resources

Language Object Members


Language.SpellingDictionaryType Property (Word)

 Copy code hover
[image]

Language.SpellingDictionaryType Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the proofing tool type. Read/write WdDictionaryType.

Syntax

expression .SpellingDictionaryType

expression Required. A variable that represents a Language object.

Remarks

You can use this property to change the active spelling dictionary to one of the available add-on dictionaries that work with Word. For example, there are legal, medical, and complete spelling dictionaries you can use instead of the standard dictionary.

Some of the constants listed above may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.

Example

This example returns the type of spelling dictionary used for U.S. English.

VBA Copy code Copy code
myType = Languages(wdEnglishUS).SpellingDictionaryType

This example makes the legal dictionary the active spelling dictionary.

VBA Copy code Copy code
Languages(wdEnglishUS).SpellingDictionaryType = wdSpellingLegal

See also

Concepts

Language Object

Other resources

Language Object Members


Language.WritingStyleList Property (Word)

 Copy code hover
[image]

Language.WritingStyleList Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a string array that contains the names of all writing styles available for the specified language. Read-only Variant.

Syntax

expression .WritingStyleList

expression An expression that returns a Language object.

Example

This example displays each writing style available for U.S. English. Each writing style and its number in the array are also displayed in the Immediate window of the Visual Basic editor.

VBA Copy code Copy code
Sub WritingStyles()
 Dim WrStyles As Variant
 Dim i As Integer

 WrStyles = Languages(wdEnglishUS).WritingStyleList
 For i = 1 To UBound(WrStyles)
 MsgBox WrStyles(i)
 Debug.Print WrStyles(i) & " [" & Trim(Str$(i)) & "]"
 Next i
End Sub

See also

Concepts

Language Object

Other resources

Language Object Members


Languages Object (Word)

 Copy code hover
[image]

Languages Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of Language objects that represent languages used for proofing or formatting in Word.

Remarks

Use the Languages property to return the Languages collection. The following example displays the localized name for each language.

VBA Copy code Copy code
For Each la In Languages
 Msgbox la.NameLocal
Next la

Use Languages(index) to return a single Language object, where index can be the value of the Name property, the value of the NameLocal property, one of the WdLanguageID constants, or one of the MsoLanguageID constants. (For the list of valid MsoLanguageID constants, see the Object Browser in the Visual Basic Editor.)

The Count property returns the number of languages for which you can mark text (languages for which proofing tools are available). To check proofing, you must install the appropriate tools for each language you intend to check. You need both a .dll file and an .lex file for each of the following: the thesaurus, spelling checker, grammar checker, and hyphenation tools.

If you mark text as wdNoProofing, Word skips the marked text when running a spelling or grammar check. To mark text for a specified language or for no proofing, use the Set Language command.

See also

Concepts

Word Object Model Reference

Other resources

Languages Object Members


Languages Members (Word)

 Copy code hover
[image]

Languages Members (Word)
Send feedback

Published: July 16, 2012

A collection of Language objects that represent languages used for proofing or formatting in Word.

Methods

Name | Description
Item | Returns an individual Language object in a collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of languages in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified Languages object.


Languages Properties (Word)

 Copy code hover
[image]

Languages Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of languages in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified Languages object.


Languages.Application Property (Word)

 Copy code hover
[image]

Languages.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a Languages collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

Languages Collection Object

Other resources

Languages Object Members


Languages.Count Property (Word)

 Copy code hover
[image]

Languages.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of languages in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents a Languages collection.

See also

Concepts

Languages Collection Object

Other resources

Languages Object Members


Languages.Creator Property (Word)

 Copy code hover
[image]

Languages.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a Languages collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Languages Collection Object

Other resources

Languages Object Members


Languages.Parent Property (Word)

 Copy code hover
[image]

Languages.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Languages object.

Syntax

expression .Parent

expression Required. A variable that represents a Languages collection.

See also

Concepts

Languages Collection Object

Other resources

Languages Object Members


Languages Methods (Word)

 Copy code hover
[image]

Languages Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Item | Returns an individual Language object in a collection.


Languages.Item Method (Word)

 Copy code hover
[image]

Languages.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual Language object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents a Languages collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The individual object to be returned. Can be a Long indicating the ordinal position or a String representing the name of the individual object.

Return Value

Language

See also

Concepts

Languages Collection Object

Other resources

Languages Object Members


LeaderLines Object (Word)

 Copy code hover
[image]

LeaderLines Object (Word)
See also Send feedback

Published: July 16, 2012

Represents leader lines on a chart. Leader lines connect data labels to data points.

Version Information

Version Added: Word 2007

Remarks

This object is not a collection; there is no object that represents a single leader line.

This object applies only to pie charts.

Example

Use the LeaderLines property to return the LeaderLines object. The following example adds data labels and blue leader lines to series one on the first chart in the active document. If no leader lines are visible, this example code will fail. In this situation, you can manually drag one of the data labels away from the pie chart to make a leader line show up.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.SeriesCollection(1)
 .HasDataLabels = True
 .DataLabels.Position = xlLabelPositionBestFit
 .HasLeaderLines = True
 .LeaderLines.Border.ColorIndex = 5
 End With
 End If
End With

See also

Concepts

Word Object Model Reference

Other resources

LeaderLines Object Members


LeaderLines Members (Word)

 Copy code hover
[image]

LeaderLines Members (Word)
Send feedback

Published: July 16, 2012

Represents leader lines on a chart. Leader lines connect data labels to data points.

Methods

Name | Description
Delete | Deletes the object.
Select | Selects the object.

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
Border | Returns the border of the object. Read-only ChartBorder.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Format | Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.
Parent | Returns the parent for the specified object. Read-only Object.


LeaderLines Properties (Word)

 Copy code hover
[image]

LeaderLines Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
Border | Returns the border of the object. Read-only ChartBorder.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Format | Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.
Parent | Returns the parent for the specified object. Read-only Object.


LeaderLines.Application Property (Word)

 Copy code hover
[image]

LeaderLines.Application Property (Word)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Application

expression A variable that represents a LeaderLines object.

Example

The following example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveDocument
If myObject.Application.Value = "Microsoft Word" Then
 MsgBox "This is a Word Application object."
Else
 MsgBox "This is not a Word Application object."
End If

See also

Concepts

LeaderLines Object

Other resources

LeaderLines Object Members


LeaderLines.Border Property (Word)

 Copy code hover
[image]

LeaderLines.Border Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the border of the object. Read-only ChartBorder.

Version Information

Version Added: Word 2007

Syntax

expression .Border

expression A variable that represents a LeaderLines object.

See also

Concepts

LeaderLines Object

Other resources

LeaderLines Object Members


LeaderLines.Creator Property (Word)

 Copy code hover
[image]

LeaderLines.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version Information

Version Added: Word 2007

Syntax

expression .Creator

expression A variable that represents a LeaderLines object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD". This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Word has the creator code MSWD. For more information about this property, consult the language reference Help included with Microsoft Office for Mac.

See also

Concepts

LeaderLines Object

Other resources

LeaderLines Object Members


LeaderLines.Format Property (Word)

 Copy code hover
[image]

LeaderLines.Format Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.

Version Information

Version Added: Word 2007

Syntax

expression .Format

expression A variable that represents a LeaderLines object.

See also

Concepts

LeaderLines Object

Other resources

LeaderLines Object Members


LeaderLines.Parent Property (Word)

 Copy code hover
[image]

LeaderLines.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the parent for the specified object. Read-only Object.

Version Information

Version Added: Word 2007

Syntax

expression .Parent

expression A variable that represents a LeaderLines object.

See also

Concepts

LeaderLines Object

Other resources

LeaderLines Object Members


LeaderLines Methods (Word)

 Copy code hover
[image]

LeaderLines Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the object.
Select | Selects the object.


LeaderLines.Delete Method (Word)

 Copy code hover
[image]

LeaderLines.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Version Information

Version Added: Word 2007

Syntax

expression .Delete

expression A variable that represents a LeaderLines object.

See also

Concepts

LeaderLines Object

Other resources

LeaderLines Object Members


LeaderLines.Select Method (Word)

 Copy code hover
[image]

LeaderLines.Select Method (Word)
See also Send feedback

Published: July 16, 2012

Selects the object.

Version Information

Version Added: Word 2007

Syntax

expression .Select

expression A variable that represents a LeaderLines object.

See also

Concepts

LeaderLines Object

Other resources

LeaderLines Object Members


Legend Object (Word)

 Copy code hover
[image]

Legend Object (Word)
See also Send feedback

Published: July 16, 2012

Represents the legend in a chart. Each chart can have only one legend.

Version Information

Version Added: Word 2007

Remarks

The Legend object contains one or more LegendEntry objects; each LegendEntry object contains a LegendKey object.

The chart legend is not visible unless the HasLegend property is True. If this property is False, properties and methods of the Legend object will fail.

Example

Use the Legend property to return the Legend object. The following example sets the font style for the legend of the first chart in the active document to bold.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.Legend.Font.Bold = True
 End If
End With

See also

Concepts

Word Object Model Reference

Other resources

Legend Object Members


Legend Members (Word)

 Copy code hover
[image]

Legend Members (Word)
Send feedback

Published: July 16, 2012

Represents the legend in a chart. Each chart can have only one legend.

Methods

Name | Description
Clear | Clears the entire object.
Delete | Deletes the object.
LegendEntries | Returns a collection of legend entries for the legend.
Select | Selects the object.

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Format | Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.
Height | Returns or sets the height, in points, of the object. Read/write Double.
IncludeInLayout | True if a legend will occupy the chart layout space when a chart layout is being determined. The default is True. Read/write Boolean.
Left | Returns the distance, in points, from the left edge of the object to the left edge of the chart area. Read-only Double.
Name | Returns the name of the object. Read-only String.
Parent | Returns the parent for the specified object. Read-only Object.
Position | Returns or sets the position of the legend on the chart. Read/write XlLegendPosition.
Shadow | Returns or sets a value that indicates whether the object has a shadow. Read/write Boolean.
Top | Returns or sets the distance, in points, from the top edge of the object to the top of the first row (on a worksheet) or the top of the chart area (on a chart). Read/write Double.
Width | Returns or sets the width, in points, of the object. Read/write Double.


Legend Properties (Word)

 Copy code hover
[image]

Legend Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Format | Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.
Height | Returns or sets the height, in points, of the object. Read/write Double.
IncludeInLayout | True if a legend will occupy the chart layout space when a chart layout is being determined. The default is True. Read/write Boolean.
Left | Returns the distance, in points, from the left edge of the object to the left edge of the chart area. Read-only Double.
Name | Returns the name of the object. Read-only String.
Parent | Returns the parent for the specified object. Read-only Object.
Position | Returns or sets the position of the legend on the chart. Read/write XlLegendPosition.
Shadow | Returns or sets a value that indicates whether the object has a shadow. Read/write Boolean.
Top | Returns or sets the distance, in points, from the top edge of the object to the top of the first row (on a worksheet) or the top of the chart area (on a chart). Read/write Double.
Width | Returns or sets the width, in points, of the object. Read/write Double.


Legend.Application Property (Word)

 Copy code hover
[image]

Legend.Application Property (Word)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Application

expression A variable that represents a Legend object.

Example

The following example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveDocument
If myObject.Application.Value = "Microsoft Word" Then
 MsgBox "This is a Word Application object."
Else
 MsgBox "This is not a Word Application object."
End If

See also

Concepts

Legend Object

Other resources

Legend Object Members


Legend.Creator Property (Word)

 Copy code hover
[image]

Legend.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version Information

Version Added: Word 2007

Syntax

expression .Creator

expression A variable that represents a Legend object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD". This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Word has the creator code MSWD. For more information about this property, consult the language reference Help included with Microsoft Office for Mac.

See also

Concepts

Legend Object

Other resources

Legend Object Members


Legend.Format Property (Word)

 Copy code hover
[image]

Legend.Format Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.

Version Information

Version Added: Word 2007

Syntax

expression .Format

expression A variable that represents a Legend object.

See also

Concepts

Legend Object

Other resources

Legend Object Members


Legend.Height Property (Word)

 Copy code hover
[image]

Legend.Height Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the height, in points, of the object. Read/write Double.

Version Information

Version Added: Word 2007

Syntax

expression .Height

expression A variable that represents a Legend object.

See also

Concepts

Legend Object

Other resources

Legend Object Members


Legend.IncludeInLayout Property (Word)

 Copy code hover
[image]

Legend.IncludeInLayout Property (Word)
See also Send feedback

Published: July 16, 2012

True if a legend will occupy the chart layout space when a chart layout is being determined. The default is True. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .IncludeInLayout

expression A variable that represents a Legend object.

Remarks

This property does not affect whether a chart is in autolayout mode or not. If the user adds a title by using the Above Chart command, the chart will resize smaller, as in previous versions of Microsoft Office. If the user then removes the title or selects one of the overlay title options, the chart will resize larger, as if the title were not on the chart.

See also

Concepts

Legend Object

Other resources

Legend Object Members


Legend.Left Property (Word)

 Copy code hover
[image]

Legend.Left Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the distance, in points, from the left edge of the object to the left edge of the chart area. Read-only Double.

Version Information

Version Added: Word 2007

Syntax

expression .Left

expression A variable that represents a Legend object.

See also

Concepts

Legend Object

Other resources

Legend Object Members


Legend.Name Property (Word)

 Copy code hover
[image]

Legend.Name Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the name of the object. Read-only String.

Version Information

Version Added: Word 2007

Syntax

expression .Name

expression A variable that represents a Legend object.

See also

Concepts

Legend Object

Other resources

Legend Object Members


Legend.Parent Property (Word)

 Copy code hover
[image]

Legend.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the parent for the specified object. Read-only Object.

Version Information

Version Added: Word 2007

Syntax

expression .Parent

expression A variable that represents a Legend object.

See also

Concepts

Legend Object

Other resources

Legend Object Members


Legend.Position Property (Word)

 Copy code hover
[image]

Legend.Position Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the position of the legend on the chart. Read/write XlLegendPosition.

Version Information

Version Added: Word 2007

Syntax

expression .Position

expression A variable that represents a Legend object.

Example

The following example moves the chart legend to the bottom of the chart.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.Legend.Position = xlLegendPositionBottom
 End If
End With

See also

Concepts

Legend Object

Other resources

Legend Object Members


Legend.Shadow Property (Word)

 Copy code hover
[image]

Legend.Shadow Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a value that indicates whether the object has a shadow. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .Shadow

expression A variable that represents a Legend object.

See also

Concepts

Legend Object

Other resources

Legend Object Members


Legend.Top Property (Word)

 Copy code hover
[image]

Legend.Top Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the distance, in points, from the top edge of the object to the top of the first row (on a worksheet) or the top of the chart area (on a chart). Read/write Double.

Version Information

Version Added: Word 2007

Syntax

expression .Top

expression A variable that represents a Legend object.

See also

Concepts

Legend Object

Other resources

Legend Object Members


Legend.Width Property (Word)

 Copy code hover
[image]

Legend.Width Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the width, in points, of the object. Read/write Double.

Version Information

Version Added: Word 2007

Syntax

expression .Width

expression A variable that represents a Legend object.

See also

Concepts

Legend Object

Other resources

Legend Object Members


Legend Methods (Word)

 Copy code hover
[image]

Legend Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Clear | Clears the entire object.
Delete | Deletes the object.
LegendEntries | Returns a collection of legend entries for the legend.
Select | Selects the object.


Legend.Clear Method (Word)

 Copy code hover
[image]

Legend.Clear Method (Word)
See also Send feedback

Published: July 16, 2012

Clears the entire object.

Version Information

Version Added: Word 2007

Syntax

expression .Clear

expression A variable that represents a Legend object.

See also

Concepts

Legend Object

Other resources

Legend Object Members


Legend.Delete Method (Word)

 Copy code hover
[image]

Legend.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Version Information

Version Added: Word 2007

Syntax

expression .Delete

expression A variable that represents a Legend object.

See also

Concepts

Legend Object

Other resources

Legend Object Members


Legend.LegendEntries Method (Word)

 Copy code hover
[image]

Legend.LegendEntries Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a collection of legend entries for the legend.

Version Information

Version Added: Word 2007

Syntax

expression .LegendEntries

expression A variable that represents a Legend object.

Return Value

A LegendEntries object that represents the legend entries for the legend.

Example

The following example sets the font for legend entry one on the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.Legend.LegendEntries(1).Font.Name = "Arial"
 End If
End With

See also

Concepts

Legend Object

Other resources

Legend Object Members


Legend.Select Method (Word)

 Copy code hover
[image]

Legend.Select Method (Word)
See also Send feedback

Published: July 16, 2012

Selects the object.

Version Information

Version Added: Word 2007

Syntax

expression .Select

expression A variable that represents a Legend object.

See also

Concepts

Legend Object

Other resources

Legend Object Members


LegendEntries Object (Word)

 Copy code hover
[image]

LegendEntries Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of all the LegendEntry objects in the specified chart legend.

Version Information

Version Added: Word 2007

Remarks

Each legend entry has two parts:

  • The text of the entry, which is the name of the series or trendline associated with the legend entry.

  • The entry marker, which visually links the legend entry with its associated series or trendline in the chart.

The formatting properties for the entry marker and its associated series or trendline are contained in the LegendKey object.

Example

Use the LegendEntries method to return the LegendEntries collection. The following example loops through the collection of legend entries for the first chart in the active document and changes their font color.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.Legend
 For i = 1 To .LegendEntries.Count
 .LegendEntries(i).Font.ColorIndex = 5
 Next
 End With
 End If
End With

Use LegendEntries(index), where index is the legend entry index number, to return a single LegendEntry object. You cannot return legend entries by name.

The index number represents the position of the legend entry in the legend. LegendEntries(1) is at the top of the legend; LegendEntries(LegendEntries.Count) is at the bottom. The following example changes the font style for the text of the legend entry at the top of the legend (this is usually the legend for series one) for the first chart in the active document to italic.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.Legend.LegendEntries(1).Font.Italic = True
 End If
End With

See also

Concepts

Word Object Model Reference

Other resources

LegendEntries Object Members


LegendEntries Members (Word)

 Copy code hover
[image]

LegendEntries Members (Word)
Send feedback

Published: July 16, 2012

A collection of all the LegendEntry objects in the specified chart legend.

Methods

Name | Description
Item | Returns a single object from a collection.

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
Count | Returns the number of objects in the collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns the parent for the specified object. Read-only Object.


LegendEntries Properties (Word)

 Copy code hover
[image]

LegendEntries Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
Count | Returns the number of objects in the collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns the parent for the specified object. Read-only Object.


LegendEntries.Application Property (Word)

 Copy code hover
[image]

LegendEntries.Application Property (Word)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Application

expression A variable that represents a LegendEntries object.

Example

The following example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveDocument
If myObject.Application.Value = "Microsoft Word" Then
 MsgBox "This is a Word Application object."
Else
 MsgBox "This is not a Word Application object."
End If

See also

Concepts

LegendEntries Object

Other resources

LegendEntries Object Members


LegendEntries.Count Property (Word)

 Copy code hover
[image]

LegendEntries.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the number of objects in the collection. Read-only Long.

Version Information

Version Added: Word 2007

Syntax

expression .Count

expression A variable that represents a LegendEntries object.

See also

Concepts

LegendEntries Object

Other resources

LegendEntries Object Members


LegendEntries.Creator Property (Word)

 Copy code hover
[image]

LegendEntries.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version Information

Version Added: Word 2007

Syntax

expression .Creator

expression A variable that represents a LegendEntries object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD". This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Word has the creator code MSWD. For more information about this property, consult the language reference Help included with Microsoft Office for Mac.

See also

Concepts

LegendEntries Object

Other resources

LegendEntries Object Members


LegendEntries.Parent Property (Word)

 Copy code hover
[image]

LegendEntries.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the parent for the specified object. Read-only Object.

Version Information

Version Added: Word 2007

Syntax

expression .Parent

expression A variable that represents a LegendEntries object.

See also

Concepts

LegendEntries Object

Other resources

LegendEntries Object Members


LegendEntries Methods (Word)

 Copy code hover
[image]

LegendEntries Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Item | Returns a single object from a collection.


LegendEntries.Item Method (Word)

 Copy code hover
[image]

LegendEntries.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a single object from a collection.

Version Information

Version Added: Word 2007

Syntax

expression .Item(Index)

expression A variable that represents a LegendEntries object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The index number for the object.

Return Value

A LegendEntry object that the collection contains.

Example

The following example changes the font for the text of the legend entry at the top of the legend (this is usually the legend for series one) for the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.Legend.LegendEntries.Item(1). _
 Font.Italic = True
 End If
End With

See also

Concepts

LegendEntries Object

Other resources

LegendEntries Object Members


LegendEntry Object (Word)

 Copy code hover
[image]

LegendEntry Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a legend entry in a chart legend.

Version Information

Version Added: Word 2007

Remarks

The LegendEntry object is a member of the LegendEntries collection. The LegendEntries collection contains all the LegendEntry objects in the legend.

Each legend entry has two parts:

  • The text of the entry, which is the name of the series or trendline associated with the legend entry.

  • The entry marker, which visually links the legend entry with its associated series or trendline in the chart.

The formatting properties for the entry marker and its associated series or trendline are contained in the LegendKey object.

The text of a legend entry cannot be changed. LegendEntry objects support font formatting, and they can be deleted. No pattern formatting is supported for legend entries. The position and size of entries is fixed.

There is no direct way to return the series or trendline that corresponds to the legend entry.

After legend entries have been deleted, the only way to restore them is to remove and re-create the legend that contained them by setting the HasLegend property for the chart to False and then back to True.

Example

Use LegendEntries(index), where index is the legend entry index number, to return a single LegendEntry object. You cannot return legend entries by name.

The index number represents the position of the legend entry in the legend. LegendEntries(1) is at the top of the legend, and LegendEntries(LegendEntries.Count) is at the bottom. The following example changes the font for the text of the legend entry at the top of the legend (this is usually the legend for series one) for the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.Legend.LegendEntries(1).Font.Italic = True
 End If
End With

See also

Concepts

Word Object Model Reference

Other resources

LegendEntry Object Members


LegendEntry Members (Word)

 Copy code hover
[image]

LegendEntry Members (Word)
Send feedback

Published: July 16, 2012

Represents a legend entry in a chart legend.

Methods

Name | Description
Delete | Deletes the object.
Select | Selects the object.

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Font | Returns the font of the specified object. Read-only ChartFont.
Format | Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.
Height | Returns the height, in points, of the object. Read-only Double.
Index | Returns the index number of the object within the collection of similar objects. Read-only Long.
Left | Returns the distance, in points, from the left edge of the object to the left edge of the chart area. Read-only Double.
LegendKey | Returns the legend key that is associated with the entry. Read-only LegendKey.
Parent | Returns the parent for the specified object. Read-only Object.
Top | Returns the distance, in points, from the top edge of the object to the top of the first row (on a worksheet) or the top of the chart area (on a chart). Read-only Double.
Width | Returns the width, in points, of the object. Read-only Double.


LegendEntry Properties (Word)

 Copy code hover
[image]

LegendEntry Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Font | Returns the font of the specified object. Read-only ChartFont.
Format | Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.
Height | Returns the height, in points, of the object. Read-only Double.
Index | Returns the index number of the object within the collection of similar objects. Read-only Long.
Left | Returns the distance, in points, from the left edge of the object to the left edge of the chart area. Read-only Double.
LegendKey | Returns the legend key that is associated with the entry. Read-only LegendKey.
Parent | Returns the parent for the specified object. Read-only Object.
Top | Returns the distance, in points, from the top edge of the object to the top of the first row (on a worksheet) or the top of the chart area (on a chart). Read-only Double.
Width | Returns the width, in points, of the object. Read-only Double.


LegendEntry.Application Property (Word)

 Copy code hover
[image]

LegendEntry.Application Property (Word)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Application

expression A variable that represents a LegendEntry object.

Example

The following example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveDocument
If myObject.Application.Value = "Microsoft Word" Then
 MsgBox "This is a Word Application object."
Else
 MsgBox "This is not a Word Application object."
End If

See also

Concepts

LegendEntry Object

Other resources

LegendEntry Object Members


LegendEntry.Creator Property (Word)

 Copy code hover
[image]

LegendEntry.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version Information

Version Added: Word 2007

Syntax

expression .Creator

expression A variable that represents a LegendEntry object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD". This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Word has the creator code MSWD. For more information about this property, consult the language reference Help included with Microsoft Office for Mac.

See also

Concepts

LegendEntry Object

Other resources

LegendEntry Object Members


LegendEntry.Font Property (Word)

 Copy code hover
[image]

LegendEntry.Font Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the font of the specified object. Read-only ChartFont.

Version Information

Version Added: Word 2007

Syntax

expression .Font

expression A variable that represents a LegendEntry object.

See also

Concepts

LegendEntry Object

Other resources

LegendEntry Object Members


LegendEntry.Format Property (Word)

 Copy code hover
[image]

LegendEntry.Format Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.

Version Information

Version Added: Word 2007

Syntax

expression .Format

expression A variable that represents a LegendEntry object.

See also

Concepts

LegendEntry Object

Other resources

LegendEntry Object Members


LegendEntry.Height Property (Word)

 Copy code hover
[image]

LegendEntry.Height Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the height, in points, of the object. Read-only Double.

Version Information

Version Added: Word 2007

Syntax

expression .Height

expression A variable that represents a LegendEntry object.

See also

Concepts

LegendEntry Object

Other resources

LegendEntry Object Members


LegendEntry.Index Property (Word)

 Copy code hover
[image]

LegendEntry.Index Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the index number of the object within the collection of similar objects. Read-only Long.

Version Information

Version Added: Word 2007

Syntax

expression .Index

expression A variable that represents a LegendEntry object.

See also

Concepts

LegendEntry Object

Other resources

LegendEntry Object Members


LegendEntry.Left Property (Word)

 Copy code hover
[image]

LegendEntry.Left Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the distance, in points, from the left edge of the object to the left edge of the chart area. Read-only Double.

Version Information

Version Added: Word 2007

Syntax

expression .Left

expression A variable that represents a LegendEntry object.

See also

Concepts

LegendEntry Object

Other resources

LegendEntry Object Members


LegendEntry.LegendKey Property (Word)

 Copy code hover
[image]

LegendEntry.LegendKey Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the legend key that is associated with the entry. Read-only LegendKey.

Version Information

Version Added: Word 2007

Syntax

expression .LegendKey

expression A variable that represents a LegendEntry object.

Example

The following example sets the legend key for legend entry one on the first chart in the active document to be a triangle. You should run the example on a 2-D line chart.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.Legend.LegendEntries(1).LegendKey _
 .MarkerStyle = xlMarkerStyleTriangle
 End If
End With

See also

Concepts

LegendEntry Object

Other resources

LegendEntry Object Members


LegendEntry.Parent Property (Word)

 Copy code hover
[image]

LegendEntry.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the parent for the specified object. Read-only Object.

Version Information

Version Added: Word 2007

Syntax

expression .Parent

expression A variable that represents a LegendEntry object.

See also

Concepts

LegendEntry Object

Other resources

LegendEntry Object Members


LegendEntry.Top Property (Word)

 Copy code hover
[image]

LegendEntry.Top Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the distance, in points, from the top edge of the object to the top of the first row (on a worksheet) or the top of the chart area (on a chart). Read-only Double.

Version Information

Version Added: Word 2007

Syntax

expression .Top

expression A variable that represents a LegendEntry object.

See also

Concepts

LegendEntry Object

Other resources

LegendEntry Object Members


LegendEntry.Width Property (Word)

 Copy code hover
[image]

LegendEntry.Width Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the width, in points, of the object. Read-only Double.

Version Information

Version Added: Word 2007

Syntax

expression .Width

expression A variable that represents a LegendEntry object.

See also

Concepts

LegendEntry Object

Other resources

LegendEntry Object Members


LegendEntry Methods (Word)

 Copy code hover
[image]

LegendEntry Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the object.
Select | Selects the object.


LegendEntry.Delete Method (Word)

 Copy code hover
[image]

LegendEntry.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Version Information

Version Added: Word 2007

Syntax

expression .Delete

expression A variable that represents a LegendEntry object.

See also

Concepts

LegendEntry Object

Other resources

LegendEntry Object Members


LegendEntry.Select Method (Word)

 Copy code hover
[image]

LegendEntry.Select Method (Word)
See also Send feedback

Published: July 16, 2012

Selects the object.

Version Information

Version Added: Word 2007

Syntax

expression .Select

expression A variable that represents a LegendEntry object.

See also

Concepts

LegendEntry Object

Other resources

LegendEntry Object Members


LegendKey Object (Word)

 Copy code hover
[image]

LegendKey Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a legend key in a chart legend.

Version Information

Version Added: Word 2007

Remarks

Each legend key is a graphic that visually links a legend entry with its associated series or trendline in the chart. The legend key is linked to its associated series or trendline in such a way that changing the formatting of one simultaneously changes the formatting of the other.

Example

Use the LegendKey property to return the LegendKey object. The following example changes the marker background color for the legend entry at the top of the legend for the first chart in the active document. This simultaneously changes the format of every point in the series associated with this legend entry. The associated series must support data markers.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.Legend.LegendEntries(1).LegendKey _
 .MarkerBackgroundColorIndex = 5
 End If
End With

See also

Concepts

Word Object Model Reference

Other resources

LegendKey Object Members


LegendKey Members (Word)

 Copy code hover
[image]

LegendKey Members (Word)
Send feedback

Published: July 16, 2012

Represents a legend key in a chart legend.

Methods

Name | Description
ClearFormats | Clears the formatting of the object.
Delete | Deletes the object.

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Format | Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.
Height | Returns the height, in points, of the object. Read-only Double.
InvertIfNegative | True if Microsoft Word inverts the pattern in the object when it corresponds to a negative number. Read/write Variant.
Left | Returns the distance, in points, from the left edge of the object to the left edge of the chart area. Read-only Double.
MarkerBackgroundColor | Sets the marker background color as an RGB value or returns the corresponding color index value. Read/write Long.
MarkerBackgroundColorIndex | Returns or sets the marker background color as an index into the current color palette, or as one of the following XlColorIndex constants: xlColorIndexAutomatic or xlColorIndexNone. Read/write Long.
MarkerForegroundColor | Sets the marker foreground color as an RGB value or returns the corresponding color index value. Read/write Long.
MarkerForegroundColorIndex | Returns or sets the marker foreground color as an index into the current color palette, or as one of the following XlColorIndex constants: xlColorIndexAutomatic or xlColorIndexNone. Read/write Long.
MarkerSize | Returns or sets the data-marker size, in points. Read/write Long.
MarkerStyle | Returns or sets the marker style for a point or series in a line chart, scatter chart, or radar chart. Read/write XlMarkerStyle.
Parent | Returns the parent for the specified object. Read-only Object.
PictureType | Returns or sets the way pictures are displayed on a legend key. Read/write XlChartPictureType.
PictureUnit2 | Returns or sets the unit for each picture on the chart if the PictureType property is set to xlStackScale; otherwise, this property is ignored. Read/write Double.
Shadow | Returns or sets a value that indicates whether the object has a shadow. Read/write Boolean.
Smooth | True if curve smoothing is turned on for the legend key. Read/write Boolean.
Top | Returns the distance, in points, from the top edge of the object to the top of the first row (on a worksheet) or the top of the chart area (on a chart). Read-only Double.
Width | Returns the width, in points, of the object. Read-only Double.


LegendKey Properties (Word)

 Copy code hover
[image]

LegendKey Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Format | Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.
Height | Returns the height, in points, of the object. Read-only Double.
InvertIfNegative | True if Microsoft Word inverts the pattern in the object when it corresponds to a negative number. Read/write Variant.
Left | Returns the distance, in points, from the left edge of the object to the left edge of the chart area. Read-only Double.
MarkerBackgroundColor | Sets the marker background color as an RGB value or returns the corresponding color index value. Read/write Long.
MarkerBackgroundColorIndex | Returns or sets the marker background color as an index into the current color palette, or as one of the following XlColorIndex constants: xlColorIndexAutomatic or xlColorIndexNone. Read/write Long.
MarkerForegroundColor | Sets the marker foreground color as an RGB value or returns the corresponding color index value. Read/write Long.
MarkerForegroundColorIndex | Returns or sets the marker foreground color as an index into the current color palette, or as one of the following XlColorIndex constants: xlColorIndexAutomatic or xlColorIndexNone. Read/write Long.
MarkerSize | Returns or sets the data-marker size, in points. Read/write Long.
MarkerStyle | Returns or sets the marker style for a point or series in a line chart, scatter chart, or radar chart. Read/write XlMarkerStyle.
Parent | Returns the parent for the specified object. Read-only Object.
PictureType | Returns or sets the way pictures are displayed on a legend key. Read/write XlChartPictureType.
PictureUnit2 | Returns or sets the unit for each picture on the chart if the PictureType property is set to xlStackScale; otherwise, this property is ignored. Read/write Double.
Shadow | Returns or sets a value that indicates whether the object has a shadow. Read/write Boolean.
Smooth | True if curve smoothing is turned on for the legend key. Read/write Boolean.
Top | Returns the distance, in points, from the top edge of the object to the top of the first row (on a worksheet) or the top of the chart area (on a chart). Read-only Double.
Width | Returns the width, in points, of the object. Read-only Double.


LegendKey.Application Property (Word)

 Copy code hover
[image]

LegendKey.Application Property (Word)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Application

expression A variable that represents a LegendKey object.

Example

The following example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveDocument
If myObject.Application.Value = "Microsoft Word" Then
 MsgBox "This is a Word Application object."
Else
 MsgBox "This is not a Word Application object."
End If

See also

Concepts

LegendKey Object

Other resources

LegendKey Object Members


LegendKey.Creator Property (Word)

 Copy code hover
[image]

LegendKey.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version Information

Version Added: Word 2007

Syntax

expression .Creator

expression A variable that represents a LegendKey object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD". This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Word has the creator code MSWD. For more information about this property, consult the language reference Help included with Microsoft Office for Mac.

See also

Concepts

LegendKey Object

Other resources

LegendKey Object Members


LegendKey.Format Property (Word)

 Copy code hover
[image]

LegendKey.Format Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.

Version Information

Version Added: Word 2007

Syntax

expression .Format

expression A variable that represents a LegendKey object.

See also

Concepts

LegendKey Object

Other resources

LegendKey Object Members


LegendKey.Height Property (Word)

 Copy code hover
[image]

LegendKey.Height Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the height, in points, of the object. Read-only Double.

Version Information

Version Added: Word 2007

Syntax

expression .Height

expression A variable that represents a LegendKey object.

See also

Concepts

LegendKey Object

Other resources

LegendKey Object Members


LegendKey.InvertIfNegative Property (Word)

 Copy code hover
[image]

LegendKey.InvertIfNegative Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word inverts the pattern in the object when it corresponds to a negative number. Read/write Variant.

Version Information

Version Added: Word 2007

Syntax

expression .InvertIfNegative

expression A variable that represents a LegendKey object.

See also

Concepts

LegendKey Object

Other resources

LegendKey Object Members


LegendKey.Left Property (Word)

 Copy code hover
[image]

LegendKey.Left Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the distance, in points, from the left edge of the object to the left edge of the chart area. Read-only Double.

Version Information

Version Added: Word 2007

Syntax

expression .Left

expression A variable that represents a LegendKey object.

See also

Concepts

LegendKey Object

Other resources

LegendKey Object Members


LegendKey.MarkerBackgroundColor Property (Word)

 Copy code hover
[image]

LegendKey.MarkerBackgroundColor Property (Word)
See also Send feedback

Published: July 16, 2012

Sets the marker background color as an RGB value or returns the corresponding color index value. Read/write Long.

Version Information

Version Added: Word 2007

Syntax

expression .MarkerBackgroundColor

expression A variable that represents a LegendKey object.

Remarks

This property applies only to line, scatter, and radar charts.

See also

Concepts

LegendKey Object

Other resources

LegendKey Object Members


LegendKey.MarkerBackgroundColorIndex Property (Word)

 Copy code hover
[image]

LegendKey.MarkerBackgroundColorIndex Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the marker background color as an index into the current color palette, or as one of the following XlColorIndex constants: xlColorIndexAutomatic or xlColorIndexNone. Read/write Long.

Version Information

Version Added: Word 2007

Syntax

expression .MarkerBackgroundColorIndex

expression A variable that represents a LegendKey object.

Remarks

This property applies only to line, scatter, and radar charts.

See also

Concepts

LegendKey Object

Other resources

LegendKey Object Members


LegendKey.MarkerForegroundColor Property (Word)

 Copy code hover
[image]

LegendKey.MarkerForegroundColor Property (Word)
See also Send feedback

Published: July 16, 2012

Sets the marker foreground color as an RGB value or returns the corresponding color index value. Read/write Long.

Version Information

Version Added: Word 2007

Syntax

expression .MarkerForegroundColor

expression A variable that represents a LegendKey object.

Remarks

This property applies only to line, scatter, and radar charts.

See also

Concepts

LegendKey Object

Other resources

LegendKey Object Members


LegendKey.MarkerForegroundColorIndex Property (Word)

 Copy code hover
[image]

LegendKey.MarkerForegroundColorIndex Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the marker foreground color as an index into the current color palette, or as one of the following XlColorIndex constants: xlColorIndexAutomatic or xlColorIndexNone. Read/write Long.

Version Information

Version Added: Word 2007

Syntax

expression .MarkerForegroundColorIndex

expression A variable that represents a LegendKey object.

Remarks

This property applies only to line, scatter, and radar charts.

See also

Concepts

LegendKey Object

Other resources

LegendKey Object Members


LegendKey.MarkerSize Property (Word)

 Copy code hover
[image]

LegendKey.MarkerSize Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the data-marker size, in points. Read/write Long.

Version Information

Version Added: Word 2007

Syntax

expression .MarkerSize

expression A variable that represents a LegendKey object.

Remarks

The value of this property can be from 2 through 72.

See also

Concepts

LegendKey Object

Other resources

LegendKey Object Members


LegendKey.MarkerStyle Property (Word)

 Copy code hover
[image]

LegendKey.MarkerStyle Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the marker style for a point or series in a line chart, scatter chart, or radar chart. Read/write XlMarkerStyle.

Version Information

Version Added: Word 2007

Syntax

expression .MarkerStyle

expression A variable that represents a LegendKey object.

Remarks

MarkerStyle can be one of the following XlMarkerStyle constants:

  • xlMarkerStyleAutomatic—Automatic markers.

  • xlMarkerStyleCircle—Circular markers.

  • xlMarkerStyleDash—Long bar markers.

  • xlMarkerStyleDiamond—Diamond-shaped markers.

  • xlMarkerStyleDot—Short bar markers.

  • xlMarkerStyleNone—No markers.

  • xlMarkerStylePicture—Picture markers.

  • xlMarkerStylePlus—Square markers with a plus sign.

  • xlMarkerStyleSquare—Square markers.

  • xlMarkerStyleStar—Square markers with an asterisk.

  • xlMarkerStyleTriangle—Triangular markers.

  • xlMarkerStyleX—Square markers with an X.

See also

Concepts

LegendKey Object

Other resources

LegendKey Object Members


LegendKey.Parent Property (Word)

 Copy code hover
[image]

LegendKey.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the parent for the specified object. Read-only Object.

Version Information

Version Added: Word 2007

Syntax

expression .Parent

expression A variable that represents a LegendKey object.

See also

Concepts

LegendKey Object

Other resources

LegendKey Object Members


LegendKey.PictureType Property (Word)

 Copy code hover
[image]

LegendKey.PictureType Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the way pictures are displayed on a legend key. Read/write XlChartPictureType.

Version Information

Version Added: Word 2007

Syntax

expression .PictureType

expression A variable that represents a LegendKey object.

See also

Concepts

LegendKey Object

Other resources

LegendKey Object Members


LegendKey.PictureUnit2 Property (Word)

 Copy code hover
[image]

LegendKey.PictureUnit2 Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the unit for each picture on the chart if the PictureType property is set to xlStackScale; otherwise, this property is ignored. Read/write Double.

Version Information

Version Added: Word 2007

Syntax

expression .PictureUnit2

expression A variable that represents a LegendKey object.

See also

Concepts

LegendKey Object

Other resources

LegendKey Object Members


LegendKey.Shadow Property (Word)

 Copy code hover
[image]

LegendKey.Shadow Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a value that indicates whether the object has a shadow. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .Shadow

expression A variable that represents a LegendKey object.

See also

Concepts

LegendKey Object

Other resources

LegendKey Object Members


LegendKey.Smooth Property (Word)

 Copy code hover
[image]

LegendKey.Smooth Property (Word)
See also Send feedback

Published: July 16, 2012

True if curve smoothing is turned on for the legend key. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .Smooth

expression A variable that represents a LegendKey object.

See also

Concepts

LegendKey Object

Other resources

LegendKey Object Members


LegendKey.Top Property (Word)

 Copy code hover
[image]

LegendKey.Top Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the distance, in points, from the top edge of the object to the top of the first row (on a worksheet) or the top of the chart area (on a chart). Read-only Double.

Version Information

Version Added: Word 2007

Syntax

expression .Top

expression A variable that represents a LegendKey object.

See also

Concepts

LegendKey Object

Other resources

LegendKey Object Members


LegendKey.Width Property (Word)

 Copy code hover
[image]

LegendKey.Width Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the width, in points, of the object. Read-only Double.

Version Information

Version Added: Word 2007

Syntax

expression .Width

expression A variable that represents a LegendKey object.

See also

Concepts

LegendKey Object

Other resources

LegendKey Object Members


LegendKey Methods (Word)

 Copy code hover
[image]

LegendKey Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
ClearFormats | Clears the formatting of the object.
Delete | Deletes the object.


LegendKey.ClearFormats Method (Word)

 Copy code hover
[image]

LegendKey.ClearFormats Method (Word)
See also Send feedback

Published: July 16, 2012

Clears the formatting of the object.

Version Information

Version Added: Word 2007

Syntax

expression .ClearFormats

expression A variable that represents a LegendKey object.

See also

Concepts

LegendKey Object

Other resources

LegendKey Object Members


LegendKey.Delete Method (Word)

 Copy code hover
[image]

LegendKey.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Version Information

Version Added: Word 2007

Syntax

expression .Delete

expression A variable that represents a LegendKey object.

Remarks

Deleting a LegendKey object deletes the entire series.

See also

Concepts

LegendKey Object

Other resources

LegendKey Object Members


LetterContent Object (Word)

 Copy code hover
[image]

LetterContent Object (Word)
See also Send feedback

Published: July 16, 2012

Represents the elements of a letter created by the Letter Wizard.

Remarks

Use the GetLetterContent or CreateLetterContent method to return a LetterContent object. The following example retrieves and displays the letter recipient's name from the active document.

VBA Copy code Copy code
Set myLetterContent = ActiveDocument.GetLetterContent
MsgBox myLetterContent.RecipientName

The following example uses the CreateLetterContent method to create a new LetterContent object, which is then used with the RunLetterWizard method.

VBA Copy code Copy code
Set myLetter = ActiveDocument _
 .CreateLetterContent(DateFormat:="July 11, 1996", _
 IncludeHeaderFooter:=False, _
 PageDesign:="C:\MSOffice\Templates\Letters & " _
 & "Faxes\Contemporary Letter.dot", _
 LetterStyle:=wdFullBlock, Letterhead:=True, _
 LetterheadLocation:=wdLetterTop, _
 LetterheadSize:=InchesToPoints(1.5), _
 RecipientName:="Dave Edson", _
 RecipientAddress:="100 Main St." & vbCr _
 & "Bellevue, WA 98004", _
 Salutation:="Dear Dave,", _
 SalutationType:=wdSalutationInformal, _
 RecipientReference:="", MailingInstructions:="", _
 AttentionLine:="", _
 Subject:="End of year report", CCList:="", ReturnAddress:="", _
 SenderName:="", Closing:="Sincerely yours,", _
 SenderCompany:="", _
 SenderJobTitle:="", SenderInitials:="", EnclosureNumber:=0)
ActiveDocument.RunLetterWizard _
 LetterContent:=myLetter, WizardMode:=True

The CreateLetterContent method creates a LetterContent object; however, there are numerous required arguments. If you want to set only a few properties, use the New keyword to create a new, stand-alone LetterContent object. The following example creates a LetterContent object, sets some of its properties, and then uses the LetterContent object with the RunLetterWizard method to run the Letter Wizard, using the preset values as the default settings.

VBA Copy code Copy code
Set myLetter = New LetterContent
With myLetter
 .AttentionLine = "Read this"
 .EnclosureNumber = 1
 .Letterhead = True
 .LetterheadLocation = wdLetterTop
 .LetterheadSize = InchesToPoints(2)
End With
Documents.Add.RunLetterWizard LetterContent:=myLetter, _
 WizardMode:=True

You can duplicate a LetterContent object by using the Duplicate property. The following example retrieves the letter elements in the active document and makes a duplicate copy. The example assigns the duplicate copy to aLetter and resets the recipient's name and address to empty strings. The RunLetterWizard method is used to run the Letter Wizard, using the values in the revised LetterContent object (aLetter) as the default settings.

VBA Copy code Copy code
Set aLetter = ActiveDocument.GetLetterContent.Duplicate
With aLetter
 .RecipientName = ""
 .RecipientAddress = ""
End With
Documents.Add.RunLetterWizard LetterContent:=aLetter, _
 WizardMode:=True

The SetLetterContent method inserts the contents of the specified LetterContent object in a document. The following example retrieves the letter elements from the active document, changes the attention line, and then uses the SetLetterContent method to update the active document to reflect the change.

VBA Copy code Copy code
Set myLetterContent = ActiveDocument.GetLetterContent
myLetterContent.AttentionLine = "Greetings"
ActiveDocument.SetLetterContent LetterContent:=myLetterContent

See also

Concepts

Word Object Model Reference

Other resources

LetterContent Object Members


LetterContent Members (Word)

 Copy code hover
[image]

LetterContent Members (Word)
Send feedback

Published: July 16, 2012

Represents the elements of a letter created by the Letter Wizard.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
AttentionLine | Returns or sets the attention line text for a letter created by the Letter Wizard. Read/write String.
CCList | Returns or sets the carbon copy (CC) recipients for a letter created by the Letter Wizard. Read/write String.
Closing | Returns or sets the closing text for a letter created by the Letter Wizard (for example, "Sincerely yours"). Read/write String.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
DateFormat | Returns or sets the date for a letter created by the Letter Wizard. Read/write String.
Duplicate | Returns a read-only LetterContent object that represents the contents of a letter created by the Letter Wizard.
EnclosureNumber | Returns or sets the number of enclosures for a letter created by the Letter Wizard. Read/write String.
IncludeHeaderFooter | True if the header and footer from the page design template are included in a letter created by the Letter Wizard. Read/write Boolean. Use the PageDesign property to set the name of the template attached to a document created by the Letter Wizard.
InfoBlock | Associated with the Letter Wizard in Microsoft Word. Not used in the U.S. English version of Word.
Letterhead | True if space is reserved for a preprinted letterhead in a letter created by the Letter Wizard. Read/write Boolean. The LetterheadSize property controls the size of the reserved letterhead space.
LetterheadLocation | Returns or sets the location of the preprinted letterhead in a letter created by the Letter Wizard. Read/write WdLetterheadLocation.
LetterheadSize | Returns or sets the amount of space (in points) to be reserved for a preprinted letterhead in a letter created by the Letter Wizard. Read/write Single.
LetterStyle | Returns or sets the layout of a letter created by the Letter Wizard. Read/write WdLetterStyle.
MailingInstructions | Returns or sets the mailing instruction text for a letter created by the Letter Wizard (for example, "Certified Mail"). Read/write String.
PageDesign | Returns or sets the name of the template attached to the document created by the Letter Wizard. Read/write String.
Parent | Returns an Object that represents the parent object of the specified LetterContent object.
RecipientAddress | Returns or sets the mailing address of the person who'll be receiving the letter created by the Letter Wizard. Read/write String.
RecipientCode | Returns or sets the recipient code. Read/write String.
RecipientGender | Returns or sets the recipient's gender, if known. Not used in the U.S. English version of Microsoft Word. Read/write WdSalutationGender.
RecipientName | Returns or sets the name of the person who'll be receiving the letter created by the Letter Wizard. Read/write String.
RecipientReference | Returns or sets the reference line (for example, "In reply to:") for a letter created by the Letter Wizard. Read/write String.
ReturnAddress | Returns or sets the return address for a letter created with the Letter Wizard. Read/write String.
ReturnAddressShortForm | Returns or sets the short form address. Read/write String.
Salutation | Returns or sets the salutation text for a letter created by the Letter Wizard. Read/write String.
SalutationType | Returns or sets the type of salutation for a letter created by the Letter Wizard. Read/write WdSalutationType.
SenderCity | Returns or sets the sender's city. Not used in the U.S. English version of Microsoft Word. Read/write String.
SenderCode | Returns or sets the sender code. Not used in the U.S. English version of Microsoft Word. Read/write String.
SenderCompany | Returns or sets the company name of the person creating a letter with the Letter Wizard. Read/write String.
SenderGender | Returns or sets the gender used with the salutation. Not used in the U.S. English version of Microsoft Word. Read/write WdSalutationGender.
SenderInitials | Returns or sets the initials of the person creating a letter with the Letter Wizard. Read/write String.
SenderJobTitle | Returns or sets the job title of the person creating a letter with the Letter Wizard. Read/write String.
SenderName | Returns or sets the name of the person creating a letter with the Letter Wizard. Read/write String.
SenderReference | Not used in the U.S. English version of Microsoft Word. Read/write String.
Subject | Returns or sets the subject text of a letter created by the Letter Wizard. Read/write String.


LetterContent Properties (Word)

 Copy code hover
[image]

LetterContent Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
AttentionLine | Returns or sets the attention line text for a letter created by the Letter Wizard. Read/write String.
CCList | Returns or sets the carbon copy (CC) recipients for a letter created by the Letter Wizard. Read/write String.
Closing | Returns or sets the closing text for a letter created by the Letter Wizard (for example, "Sincerely yours"). Read/write String.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
DateFormat | Returns or sets the date for a letter created by the Letter Wizard. Read/write String.
Duplicate | Returns a read-only LetterContent object that represents the contents of a letter created by the Letter Wizard.
EnclosureNumber | Returns or sets the number of enclosures for a letter created by the Letter Wizard. Read/write String.
IncludeHeaderFooter | True if the header and footer from the page design template are included in a letter created by the Letter Wizard. Read/write Boolean. Use the PageDesign property to set the name of the template attached to a document created by the Letter Wizard.
InfoBlock | Associated with the Letter Wizard in Microsoft Word. Not used in the U.S. English version of Word.
Letterhead | True if space is reserved for a preprinted letterhead in a letter created by the Letter Wizard. Read/write Boolean. The LetterheadSize property controls the size of the reserved letterhead space.
LetterheadLocation | Returns or sets the location of the preprinted letterhead in a letter created by the Letter Wizard. Read/write WdLetterheadLocation.
LetterheadSize | Returns or sets the amount of space (in points) to be reserved for a preprinted letterhead in a letter created by the Letter Wizard. Read/write Single.
LetterStyle | Returns or sets the layout of a letter created by the Letter Wizard. Read/write WdLetterStyle.
MailingInstructions | Returns or sets the mailing instruction text for a letter created by the Letter Wizard (for example, "Certified Mail"). Read/write String.
PageDesign | Returns or sets the name of the template attached to the document created by the Letter Wizard. Read/write String.
Parent | Returns an Object that represents the parent object of the specified LetterContent object.
RecipientAddress | Returns or sets the mailing address of the person who'll be receiving the letter created by the Letter Wizard. Read/write String.
RecipientCode | Returns or sets the recipient code. Read/write String.
RecipientGender | Returns or sets the recipient's gender, if known. Not used in the U.S. English version of Microsoft Word. Read/write WdSalutationGender.
RecipientName | Returns or sets the name of the person who'll be receiving the letter created by the Letter Wizard. Read/write String.
RecipientReference | Returns or sets the reference line (for example, "In reply to:") for a letter created by the Letter Wizard. Read/write String.
ReturnAddress | Returns or sets the return address for a letter created with the Letter Wizard. Read/write String.
ReturnAddressShortForm | Returns or sets the short form address. Read/write String.
Salutation | Returns or sets the salutation text for a letter created by the Letter Wizard. Read/write String.
SalutationType | Returns or sets the type of salutation for a letter created by the Letter Wizard. Read/write WdSalutationType.
SenderCity | Returns or sets the sender's city. Not used in the U.S. English version of Microsoft Word. Read/write String.
SenderCode | Returns or sets the sender code. Not used in the U.S. English version of Microsoft Word. Read/write String.
SenderCompany | Returns or sets the company name of the person creating a letter with the Letter Wizard. Read/write String.
SenderGender | Returns or sets the gender used with the salutation. Not used in the U.S. English version of Microsoft Word. Read/write WdSalutationGender.
SenderInitials | Returns or sets the initials of the person creating a letter with the Letter Wizard. Read/write String.
SenderJobTitle | Returns or sets the job title of the person creating a letter with the Letter Wizard. Read/write String.
SenderName | Returns or sets the name of the person creating a letter with the Letter Wizard. Read/write String.
SenderReference | Not used in the U.S. English version of Microsoft Word. Read/write String.
Subject | Returns or sets the subject text of a letter created by the Letter Wizard. Read/write String.


LetterContent.Application Property (Word)

 Copy code hover
[image]

LetterContent.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a LetterContent object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

LetterContent Object

Other resources

LetterContent Object Members


LetterContent.AttentionLine Property (Word)

 Copy code hover
[image]

LetterContent.AttentionLine Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the attention line text for a letter created by the Letter Wizard. Read/write String.

Syntax

expression .AttentionLine

expression A variable that represents a LetterContent object.

Example

This example retrieves the Letter Wizard elements from the active document. If the attention line isn't blank, the example displays the text in a message box.

VBA Copy code Copy code
If ActiveDocument.GetLetterContent.AttentionLine <> "" Then
 MsgBox ActiveDocument.GetLetterContent.AttentionLine
End If

This example retrieves the Letter Wizard elements from the active document, changes the attention line text, and then uses the SetLetterContent method to update the document to reflect the changes.

VBA Copy code Copy code
Dim lcTemp As LetterContent

Set lcTemp = ActiveDocument.GetLetterContent

lcTemp.AttentionLine = "Greetings"
ActiveDocument.SetLetterContent LetterContent:=lcTemp

See also

Concepts

LetterContent Object

Other resources

LetterContent Object Members


LetterContent.CCList Property (Word)

 Copy code hover
[image]

LetterContent.CCList Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the carbon copy (CC) recipients for a letter created by the Letter Wizard. Read/write String.

Syntax

expression .CCList

expression A variable that represents a LetterContent object.

Example

This example displays the CC list text for the active document.

VBA Copy code Copy code
MsgBox ActiveDocument.GetLetterContent.CCList

This example creates a new LetterContent object, sets the courtesy copies by setting the CClist property, and then runs the Letter Wizard by using the RunLetterWizard method.

VBA Copy code Copy code
Dim lcNew As New LetterContent

lcNew.CCList = "K. Jordan, D. Funk, D. Morrison"
ActiveDocument.RunLetterWizard LetterContent:=lcNew

See also

Concepts

LetterContent Object

Other resources

LetterContent Object Members


LetterContent.Closing Property (Word)

 Copy code hover
[image]

LetterContent.Closing Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the closing text for a letter created by the Letter Wizard (for example, "Sincerely yours"). Read/write String.

Syntax

expression .Closing

expression A variable that represents a LetterContent object.

Example

This example displays the closing text from the active document.

VBA Copy code Copy code
MsgBox ActiveDocument.GetLetterContent.Closing

This example retrieves letter elements from the active document, changes the closing text by setting the Closing property, and then uses the SetLetterContent method to update the document to reflect the changes.

VBA Copy code Copy code
Dim lcCurrent As LetterContent

Set lcCurrent = ActiveDocument.GetLetterContent
lcCurrent.Closing = "Sincerely yours,"
ActiveDocument.SetLetterContent LetterContent:=lcCurrent

See also

Concepts

LetterContent Object

Other resources

LetterContent Object Members


LetterContent.Creator Property (Word)

 Copy code hover
[image]

LetterContent.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a LetterContent object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

LetterContent Object

Other resources

LetterContent Object Members


LetterContent.DateFormat Property (Word)

 Copy code hover
[image]

LetterContent.DateFormat Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the date for a letter created by the Letter Wizard. Read/write String.

Syntax

expression .DateFormat

expression A variable that represents a LetterContent object.

Example

This example displays the date from the letter that appears in the active document.

VBA Copy code Copy code
MsgBox ActiveDocument.GetLetterContent.DateFormat

This example creates a new LetterContent object, sets the date line to the current date, and then runs the Letter Wizard by using the RunLetterWizard method.

VBA Copy code Copy code
Dim lcNew As LetterContent

Set lcNew = New LetterContent
lcNew.DateFormat = Date$
ActiveDocument.RunLetterWizard LetterContent:=lcNew

See also

Concepts

LetterContent Object

Other resources

LetterContent Object Members


LetterContent.Duplicate Property (Word)

 Copy code hover
[image]

LetterContent.Duplicate Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a read-only LetterContent object that represents the contents of a letter created by the Letter Wizard.

Syntax

expression .Duplicate

expression Required. A variable that represents a LetterContent object.

Remarks

You can use the Duplicate property to pick up the settings of all the properties of a duplicated LetterContent object. You can assign the object returned by the Duplicate property to another LetterContent object to apply those settings all at once. Before assigning the duplicate object to another object, you can change any of the properties of the duplicate object without affecting the original.

See also

Concepts

LetterContent Object

Other resources

LetterContent Object Members


LetterContent.EnclosureNumber Property (Word)

 Copy code hover
[image]

LetterContent.EnclosureNumber Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the number of enclosures for a letter created by the Letter Wizard. Read/write String.

Syntax

expression .EnclosureNumber

expression A variable that represents a LetterContent object.

Example

This example displays the number of enclosures specified in the active document.

VBA Copy code Copy code
MsgBox ActiveDocument.GetLetterContent.EnclosureNumber

This example retrieves letter elements from the active document, changes the number of enclosures by setting the EnclosureNumber property, and then uses the SetLetterContent method to update the active document to reflect the changes.

VBA Copy code Copy code
Dim lcTemp As LetterContent

Set lcTemp = ActiveDocument.GetLetterContent
lcTemp.EnclosureNumber = "5"
ActiveDocument.SetLetterContent LetterContent:=lcTemp

See also

Concepts

LetterContent Object

Other resources

LetterContent Object Members


LetterContent.IncludeHeaderFooter Property (Word)

 Copy code hover
[image]

LetterContent.IncludeHeaderFooter Property (Word)
See also Send feedback

Published: July 16, 2012

True if the header and footer from the page design template are included in a letter created by the Letter Wizard. Read/write Boolean. Use the PageDesign property to set the name of the template attached to a document created by the Letter Wizard.

Syntax

expression .IncludeHeaderFooter

expression An expression that returns LetterContent object.

Example

This example creates a new LetterContent object, includes the header and footer from the Contemporary Letter template, and then runs the Letter Wizard by using the RunLetterWizard method.

VBA Copy code Copy code
Dim lcNew As LetterContent

Set lcNew = New LetterContent

With lcNew
 .PageDesign = "C:\Program Files\Microsoft Office\" _
 & "Templates\1033\Contemporary Letter.dot"
 .IncludeHeaderFooter = True
End With

Documents.Add.RunLetterWizard LetterContent:=lcNew

See also

Concepts

LetterContent Object

Other resources

LetterContent Object Members


LetterContent.InfoBlock Property (Word)

 Copy code hover
[image]

LetterContent.InfoBlock Property (Word)
See also Send feedback

Published: July 16, 2012

Associated with the Letter Wizard in Microsoft Word. Not used in the U.S. English version of Word.

Syntax

expression .InfoBlock

expression A variable that represents a LetterContent object.

Remarks

This property may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.

See also

Concepts

LetterContent Object

Other resources

LetterContent Object Members


LetterContent.Letterhead Property (Word)

 Copy code hover
[image]

LetterContent.Letterhead Property (Word)
See also Send feedback

Published: July 16, 2012

True if space is reserved for a preprinted letterhead in a letter created by the Letter Wizard. Read/write Boolean. The LetterheadSize property controls the size of the reserved letterhead space.

Syntax

expression .Letterhead

expression An expression that returns a LetterContent object.

Example

This example creates a new LetterContent object, reserves an inch of space at the top of the page for a preprinted letterhead, and then runs the Letter Wizard by using the RunLetterWizard method.

VBA Copy code Copy code
Dim lcNew As LetterContent

Set lcNew = New LetterContent

With lcNew
 .Letterhead = True
 .LetterheadLocation = wdLetterTop
 .LetterheadSize = InchesToPoints(1)
End With
ActiveDocument.RunLetterWizard _
 LetterContent:=lcNew, WizardMode:=True

See also

Concepts

LetterContent Object

Other resources

LetterContent Object Members


LetterContent.LetterheadLocation Property (Word)

 Copy code hover
[image]

LetterContent.LetterheadLocation Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the location of the preprinted letterhead in a letter created by the Letter Wizard. Read/write WdLetterheadLocation.

Syntax

expression .LetterheadLocation

expression Required. A variable that represents a LetterContent object.

Example

This example creates a new LetterContent object, reserves an inch of space at the top of the page for a preprinted letterhead, and then runs the Letter Wizard by using the RunLetterWizard method.

VBA Copy code Copy code
Dim lcNew As LetterContent

Set lcNew = New LetterContent

With lcNew
 .Letterhead = True
 .LetterheadLocation = wdLetterTop
 .LetterheadSize = InchesToPoints(1)
End With

ActiveDocument.RunLetterWizard LetterContent:=lcNew

See also

Concepts

LetterContent Object

Other resources

LetterContent Object Members


LetterContent.LetterheadSize Property (Word)

 Copy code hover
[image]

LetterContent.LetterheadSize Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the amount of space (in points) to be reserved for a preprinted letterhead in a letter created by the Letter Wizard. Read/write Single.

Syntax

expression .LetterheadSize

expression An expression that returns a LetterContent object.

Example

This example retrieves the Letter Wizard elements from the active document, changes the preprinted letterhead settings, and then uses the SetLetterContent method to update the active document to reflect the changes.

VBA Copy code Copy code
Set myLetterContent = ActiveDocument.GetLetterContent
With myLetterContent
 .Letterhead = True
 .LetterheadLocation = wdLetterTop
 .LetterheadSize = InchesToPoints(1.5)
End With
ActiveDocument.SetLetterContent LetterContent:=myLetterContent

See also

Concepts

LetterContent Object

Other resources

LetterContent Object Members


LetterContent.LetterStyle Property (Word)

 Copy code hover
[image]

LetterContent.LetterStyle Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the layout of a letter created by the Letter Wizard. Read/write WdLetterStyle.

Syntax

expression .LetterStyle

expression Required. A variable that represents a LetterContent object.

Example

This example creates a new LetterContent object, selects a letter style, and then runs the Letter Wizard by using the RunLetterWizard method.

VBA Copy code Copy code
Set aLetterContent = New LetterContent
aLetterContent.LetterStyle = wdFullBlock
ActiveDocument.RunLetterWizard _
 LetterContent:=aLetterContent, WizardMode:=True

See also

Concepts

LetterContent Object

Other resources

LetterContent Object Members


LetterContent.MailingInstructions Property (Word)

 Copy code hover
[image]

LetterContent.MailingInstructions Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the mailing instruction text for a letter created by the Letter Wizard (for example, "Certified Mail"). Read/write String.

Syntax

expression .MailingInstructions

expression An expression that returns a LetterContent object.

Example

This example retrieves the Letter Wizard elements from the active document, changes the text of the mailing instructions, and then uses the SetLetterContent method to update the active document to reflect the changes.

VBA Copy code Copy code
Set myLetterContent = ActiveDocument.GetLetterContent
myLetterContent.MailingInstructions = "Air Mail"
ActiveDocument.SetLetterContent LetterContent:=myLetterContent

This example creates a new LetterContent object, sets several properties (including the mailing instruction text), and then runs the Letter Wizard by using the RunLetterWizard method.

VBA Copy code Copy code
Set myContent = New LetterContent
With myContent
 .RecipientReference = "In reply to:"
 .Salutation = "Hello"
 .MailingInstructions = "Certified Mail"
End With
Documents.Add.RunLetterWizard LetterContent:=myContent

See also

Concepts

LetterContent Object

Other resources

LetterContent Object Members


LetterContent.PageDesign Property (Word)

 Copy code hover
[image]

LetterContent.PageDesign Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the name of the template attached to the document created by the Letter Wizard. Read/write String.

Syntax

expression .PageDesign

expression An expression that returns a LetterContent object.

Example

This example creates a new LetterContent object, includes the header and footer from the Contemporary Letter template, and then runs the Letter Wizard by using the RunLetterWizard method.

VBA Copy code Copy code
Set myContent = New LetterContent
With myContent
 .PageDesign = "C:\MSOffice\Templates\" _
 & "Letters & Faxes\Contemporary Letter.dot"
 .IncludeHeaderFooter = True
End With
Documents.Add.RunLetterWizard LetterContent:=myContent

See also

Concepts

LetterContent Object

Other resources

LetterContent Object Members


LetterContent.Parent Property (Word)

 Copy code hover
[image]

LetterContent.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified LetterContent object.

Syntax

expression .Parent

expression Required. A variable that represents a LetterContent object.

See also

Concepts

LetterContent Object

Other resources

LetterContent Object Members


LetterContent.RecipientAddress Property (Word)

 Copy code hover
[image]

LetterContent.RecipientAddress Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the mailing address of the person who'll be receiving the letter created by the Letter Wizard. Read/write String.

Syntax

expression .RecipientAddress

expression An expression that returns a LetterContent object.

Example

This example creates a new LetterContent object, sets several properties (including the recipient address), and then runs the Letter Wizard by using the RunLetterWizard method.

VBA Copy code Copy code
Dim oLC as New LetterContent
With oLC
 .ReturnAddress = Application.UserAddress
 .RecipientName = "Amy Anderson"
 .RecipientAddress = "123 Main" & vbCr & "Bellevue, WA 98004"
End With
Documents.Add.RunLetterWizard LetterContent:=oLC, WizardMode:=True

See also

Concepts

LetterContent Object

Other resources

LetterContent Object Members


LetterContent.RecipientCode Property (Word)

 Copy code hover
[image]

LetterContent.RecipientCode Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the recipient code. Read/write String.

Syntax

expression .RecipientCode

expression An expression that returns a LetterContent object.

Remarks

Not used in the U.S. English version of Microsoft Word. This property may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.

See also

Concepts

LetterContent Object

Other resources

LetterContent Object Members


LetterContent.RecipientGender Property (Word)

 Copy code hover
[image]

LetterContent.RecipientGender Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the recipient's gender, if known. Not used in the U.S. English version of Microsoft Word. Read/write WdSalutationGender.

Syntax

expression .RecipientGender

expression Required. A variable that represents a LetterContent object.

Remarks

This property may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.

See also

Concepts

LetterContent Object

Other resources

LetterContent Object Members


LetterContent.RecipientName Property (Word)

 Copy code hover
[image]

LetterContent.RecipientName Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the name of the person who'll be receiving the letter created by the Letter Wizard. Read/write String.

Syntax

expression .RecipientName

expression An expression that returns a LetterContent object.

Example

This example displays the salutation and recipient name for the active document.

VBA Copy code Copy code
MsgBox ActiveDocument.GetLetterContent.Salutation _
 & Space(1) & ActiveDocument.GetLetterContent.RecipientName

See also

Concepts

LetterContent Object

Other resources

LetterContent Object Members


LetterContent.RecipientReference Property (Word)

 Copy code hover
[image]

LetterContent.RecipientReference Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the reference line (for example, "In reply to:") for a letter created by the Letter Wizard. Read/write String.

Syntax

expression .RecipientReference

expression An expression that returns a LetterContent object.

Example

This example creates a new LetterContent object, sets several properties (including the reference line), and then runs the Letter Wizard by using the RunLetterWizard method.

VBA Copy code Copy code
Set myContent = New LetterContent
With myContent
 .RecipientReference = "In reply to:"
 .Salutation ="Hello"
 .MailingInstructions = "Certified Mail"
End With
Documents.Add.RunLetterWizard LetterContent:=myContent

See also

Concepts

LetterContent Object

Other resources

LetterContent Object Members


LetterContent.ReturnAddress Property (Word)

 Copy code hover
[image]

LetterContent.ReturnAddress Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the return address for a letter created with the Letter Wizard. Read/write String.

Syntax

expression .ReturnAddress

expression Required. A variable that represents a LetterContent object.

Example

This example creates a new LetterContent object, sets the return address and several other properties, and then runs the Letter Wizard by using the RunLetterWizard method.

VBA Copy code Copy code
Dim oLC as New LetterContent
With oLC
 .LetterStyle = wdFullBlock
 .Salutation ="Hello"
 .SalutationType = wdSalutationOther
 .ReturnAddress = Application.UserAddress
End With
Documents.Add.RunLetterWizard LetterContent:=oLC

See also

Concepts

LetterContent Object

Other resources

LetterContent Object Members


LetterContent.ReturnAddressShortForm Property (Word)

 Copy code hover
[image]

LetterContent.ReturnAddressShortForm Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the short form address. Read/write String.

Syntax

expression .ReturnAddressShortForm

expression An expression that returns a LetterContent object.

Remarks

Not used in the U.S. English version of Microsoft Word. This property may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.

See also

Concepts

LetterContent Object

Other resources

LetterContent Object Members


LetterContent.Salutation Property (Word)

 Copy code hover
[image]

LetterContent.Salutation Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the salutation text for a letter created by the Letter Wizard. Read/write String.

Syntax

expression .Salutation

expression An expression that returns a LetterContent object.

Example

This example creates a new LetterContent object, sets several properties (including the salutation text), and then runs the Letter Wizard by using the RunLetterWizard method.

VBA Copy code Copy code
Set myContent = New LetterContent
myContent.Salutation ="Hello,"
Documents.Add.RunLetterWizard LetterContent:=myContent

See also

Concepts

LetterContent Object

Other resources

LetterContent Object Members


LetterContent.SalutationType Property (Word)

 Copy code hover
[image]

LetterContent.SalutationType Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the type of salutation for a letter created by the Letter Wizard. Read/write WdSalutationType.

Syntax

expression .SalutationType

expression Required. A variable that represents a LetterContent object.

Example

This example creates a new LetterContent object, sets several properties (including the salutation text), and then runs the Letter Wizard by using the RunLetterWizard method.

VBA Copy code Copy code
Set myContent = New LetterContent
myContent.SalutationType = wdSalutationBusiness
Documents.Add.RunLetterWizard _
 LetterContent:=myContent, WizardMode:=True

See also

Concepts

LetterContent Object

Other resources

LetterContent Object Members


LetterContent.SenderCity Property (Word)

 Copy code hover
[image]

LetterContent.SenderCity Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the sender's city. Not used in the U.S. English version of Microsoft Word. Read/write String.

Syntax

expression .SenderCity

expression An expression that returns a LetterContent object.

Remarks

This property may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.

See also

Concepts

LetterContent Object

Other resources

LetterContent Object Members


LetterContent.SenderCode Property (Word)

 Copy code hover
[image]

LetterContent.SenderCode Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the sender code. Not used in the U.S. English version of Microsoft Word. Read/write String.

Syntax

expression .SenderCode

expression An expression that returns a LetterContent object.

Remarks

This property may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.

See also

Concepts

LetterContent Object

Other resources

LetterContent Object Members


LetterContent.SenderCompany Property (Word)

 Copy code hover
[image]

LetterContent.SenderCompany Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the company name of the person creating a letter with the Letter Wizard. Read/write String.

Syntax

expression .SenderCompany

expression An expression that returns a LetterContent object.

Example

This example retrieves the Letter Wizard elements from the active document. If the sender's company name isn't blank, the example displays the text in a message box.

VBA Copy code Copy code
If ActiveDocument.GetLetterContent.SenderCompany <> "" Then
 MsgBox ActiveDocument.GetLetterContent.SenderCompany
End If

See also

Concepts

LetterContent Object

Other resources

LetterContent Object Members


LetterContent.SenderGender Property (Word)

 Copy code hover
[image]

LetterContent.SenderGender Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the gender used with the salutation. Not used in the U.S. English version of Microsoft Word. Read/write WdSalutationGender.

Syntax

expression .SenderGender

expression Required. A variable that represents a LetterContent object.

Remarks

This property may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.

See also

Concepts

LetterContent Object

Other resources

LetterContent Object Members


LetterContent.SenderInitials Property (Word)

 Copy code hover
[image]

LetterContent.SenderInitials Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the initials of the person creating a letter with the Letter Wizard. Read/write String.

Syntax

expression .SenderInitials

expression An expression that returns a LetterContent object.

Example

This example creates a new LetterContent object with the sender name and initials from the User Information tab in the Options dialog box (Tools menu). The example creates a new document and then runs the Letter Wizard by using the RunLetterWizard method.

VBA Copy code Copy code
Set myContent = New LetterContent
With myContent
 .SenderName = Application.UserName
 .SenderInitials =Application.UserInitials
End With
Documents.Add.RunLetterWizard _
 LetterContent:=myContent, WizardMode:=True

See also

Concepts

LetterContent Object

Other resources

LetterContent Object Members


LetterContent.SenderJobTitle Property (Word)

 Copy code hover
[image]

LetterContent.SenderJobTitle Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the job title of the person creating a letter with the Letter Wizard. Read/write String.

Syntax

expression .SenderJobTitle

expression An expression that returns a LetterContent object.

Example

This example retrieves the Letter Wizard elements from the active document and displays the sender's job title.

VBA Copy code Copy code
Set myLetterContent = ActiveDocument.GetLetterContent
MsgBox myLetterContent.SenderJobTitle

See also

Concepts

LetterContent Object

Other resources

LetterContent Object Members


LetterContent.SenderName Property (Word)

 Copy code hover
[image]

LetterContent.SenderName Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the name of the person creating a letter with the Letter Wizard. Read/write String.

Syntax

expression .SenderName

expression An expression that returns a LetterContent object.

Example

This example creates a new LetterContent object, with the sender name and initials from the User Information tab in the Options dialog box (Tools menu). The example creates a new document and then runs the Letter Wizard by using the RunLetterWizard method.

VBA Copy code Copy code
Set myContent = New LetterContent
With myContent
 .SenderName = Application.UserName
 .SenderInitials =Application.UserInitials
End With
Documents.Add.RunLetterWizard _
 LetterContent:=myContent, WizardMode:=True

See also

Concepts

LetterContent Object

Other resources

LetterContent Object Members


LetterContent.SenderReference Property (Word)

 Copy code hover
[image]

LetterContent.SenderReference Property (Word)
See also Send feedback

Published: July 16, 2012

Not used in the U.S. English version of Microsoft Word. Read/write String.

Syntax

expression .SenderReference

expression An expression that returns a LetterContent object.

Remarks

This property may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.

See also

Concepts

LetterContent Object

Other resources

LetterContent Object Members


LetterContent.Subject Property (Word)

 Copy code hover
[image]

LetterContent.Subject Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the subject text of a letter created by the Letter Wizard. Read/write String.

Syntax

expression .Subject

expression Required. A variable that represents a LetterContent object.

Example

This example displays the subject of a letter created by the Letter Wizard, unless the subject is an empty string.

VBA Copy code Copy code
If ActiveDocument.GetLetterContent.Subject <> "" Then
 MsgBox ActiveDocument.GetLetterContent.Subject
End If

See also

Concepts

LetterContent Object

Other resources

LetterContent Object Members


Line Object (Word)

 Copy code hover
[image]

Line Object (Word)
See also Send feedback

Published: July 16, 2012

Represents an individual line in a Rectangle object of type wdTextRectangle. Use the Line object and related methods and properties to programmatically define page layout in a document.

Remarks

Use the Item method to return a specific Line object. The following example accesses the first line in the first rectangle in the first page of the active document.

VBA Copy code Copy code
Dim objLine As Line

Set objLine = ActiveDocument.ActiveWindow _
 .Panes(1).Pages(1).Rectangles(1).Lines.Item(1)

Use the LineType property to determine whether the specified line is a text line (wdTextLine) or a table row (wdTableRow). Then use the Range property to access the contents and formatting for the line. The following example creates a reference to the table if the specified line type is wdTableRow.

VBA Copy code Copy code
Dim objLine As Line
Dim objTable As Table

Set objLine = ActiveDocument.ActiveWindow _
 .Panes(1).Pages(1).Rectangles(1).Lines.Item(1)

If objLine.LineType = wdTableRow Then _
 Set objTable = objLine.Range.Tables(1)

See also

Concepts

Word Object Model Reference

Other resources

Line Object Members


Line Members (Word)

 Copy code hover
[image]

Line Members (Word)
Send feedback

Published: July 16, 2012

Represents an individual line in a Rectangle object of type wdTextRectangle. Use the Line object and related methods and properties to programmatically define page layout in a document.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Height | Returns or sets the height of a line.
Left | Returns a Long that represents the number of pixels from the left edge of the page to the left edge of a line.
LineType | Returns a wdLineType constant that indicates whether a line is a text line or a table row.
Parent | Returns an Object that represents the parent object of the specified Line object.
Range | Returns a Range object that represents the portion of a document that is contained within a line.
Rectangles | Returns a Rectangles collection that represents a portion of text or graphics in a page in a document.
Top | Returns a Long that represents the number of pixels from the top of the page to the top of a line.
Width | Returns or sets the width, in points, of a line. Read/write Long.


Line Properties (Word)

 Copy code hover
[image]

Line Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Height | Returns or sets the height of a line.
Left | Returns a Long that represents the number of pixels from the left edge of the page to the left edge of a line.
LineType | Returns a wdLineType constant that indicates whether a line is a text line or a table row.
Parent | Returns an Object that represents the parent object of the specified Line object.
Range | Returns a Range object that represents the portion of a document that is contained within a line.
Rectangles | Returns a Rectangles collection that represents a portion of text or graphics in a page in a document.
Top | Returns a Long that represents the number of pixels from the top of the page to the top of a line.
Width | Returns or sets the width, in points, of a line. Read/write Long.


Line.Application Property (Word)

 Copy code hover
[image]

Line.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a Line object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

Line Object

Other resources

Line Object Members


Line.Creator Property (Word)

 Copy code hover
[image]

Line.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a Line object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Line Object

Other resources

Line Object Members


Line.Height Property (Word)

 Copy code hover
[image]

Line.Height Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the height of a line.

Syntax

expression .Height

expression An expression that represents a Line object.

See also

Concepts

Line Object

Other resources

Line Object Members


Line.Left Property (Word)

 Copy code hover
[image]

Line.Left Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of pixels from the left edge of the page to the left edge of a line.

Syntax

expression .Left

expression An expression that represents a Line object.

See also

Concepts

Line Object

Other resources

Line Object Members


Line.LineType Property (Word)

 Copy code hover
[image]

Line.LineType Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a wdLineType constant that indicates whether a line is a text line or a table row.

Syntax

expression .LineType

expression Required. A variable that represents a Line object.

Example

The following example creates a reference to the table if the specified line type is wdTableRow.

VBA Copy code Copy code
Dim objLine As Line
Dim objTable As Table

Set objLine = ActiveDocument.ActiveWindow _
 .Panes(1).Pages(1).Rectangles(1).Lines.Item(1)

If objLine.LineType = wdTableRow Then _
 Set objTable = objLine.Range.Tables(1)

See also

Concepts

Line Object

Other resources

Line Object Members


Line.Parent Property (Word)

 Copy code hover
[image]

Line.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Line object.

Syntax

expression .Parent

expression Required. A variable that represents a Line object.

See also

Concepts

Line Object

Other resources

Line Object Members


Line.Range Property (Word)

 Copy code hover
[image]

Line.Range Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the portion of a document that is contained within a line.

Syntax

expression .Range

expression Required. A variable that represents a Line object.

See also

Concepts

Line Object

Other resources

Line Object Members


Line.Rectangles Property (Word)

 Copy code hover
[image]

Line.Rectangles Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Rectangles collection that represents a portion of text or graphics in a page in a document.

Syntax

expression .Rectangles

expression Required. A variable that represents a Line object.

Remarks

Use the Rectangles collection and related objects and properties for programmatically defining page layout in a document. Rectangles correspond to portions of text or graphics on a page in a document.

Example

The following example returns the Rectangles collection for the first page in the active document.

VBA Copy code Copy code
Dim objRectangles As Rectangles

Set objRectangles = ActiveDocument.ActiveWindow _
 .Panes(1).Pages(1).Rectangles

See also

Concepts

Line Object

Other resources

Line Object Members


Line.Top Property (Word)

 Copy code hover
[image]

Line.Top Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of pixels from the top of the page to the top of a line.

Syntax

expression .Top

expression An expression that represents a Line object.

See also

Concepts

Line Object

Other resources

Line Object Members


Line.Width Property (Word)

 Copy code hover
[image]

Line.Width Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the width, in points, of a line. Read/write Long.

Syntax

expression .Width

expression A variable that represents a Line object.

See also

Concepts

Line Object

Other resources

Line Object Members


LineFormat Object (Word)

 Copy code hover
[image]

LineFormat Object (Word)
See also Send feedback

Published: July 16, 2012

Represents line and arrowhead formatting. For a line, the LineFormat object contains formatting information for the line itself; for a shape with a border, this object contains formatting information for the shape's border.

Remarks

Use the Line property to return a LineFormat object. The following example adds a blue, dashed line to the active document. There is a short, narrow oval at the line's starting point and a long, wide triangle at its endpoint.

VBA Copy code Copy code
With ActiveDocument.Shapes.AddLine(100, 100, 200, 300).Line
 .DashStyle = msoLineDashDotDot
 .ForeColor.RGB = RGB(50, 0, 128)
 .BeginArrowheadLength = msoArrowheadShort
 .BeginArrowheadStyle = msoArrowheadOval
 .BeginArrowheadWidth = msoArrowheadNarrow
 .EndArrowheadLength = msoArrowheadLong
 .EndArrowheadStyle = msoArrowheadTriangle
 .EndArrowheadWidth = msoArrowheadWide
End With

See also

Concepts

Word Object Model Reference

Other resources

LineFormat Object Members


LineFormat Members (Word)

 Copy code hover
[image]

LineFormat Members (Word)
Send feedback

Published: July 16, 2012

Represents line and arrowhead formatting. For a line, the LineFormat object contains formatting information for the line itself; for a shape with a border, this object contains formatting information for the shape's border.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
BackColor | Returns or sets a ColorFormat object that represents the background color for a patterned line. Read/write.
BeginArrowheadLength | Returns or sets the length of the arrowhead at the beginning of the specified line. Read/write MsoArrowheadLength.
BeginArrowheadStyle | Returns or sets the style of the arrowhead at the beginning of the specified line. Read/write MsoArrowheadStyle.
BeginArrowheadWidth | Returns or sets the width of the arrowhead at the beginning of the specified line. Read/write MsoArrowheadWidth.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
DashStyle | Returns or sets the dash style for the specified line. Read/write MsoLineDashStyle.
EndArrowheadLength | Returns or sets the length of the arrowhead at the end of the specified line. Read/write MsoArrowheadLength.
EndArrowheadStyle | Returns or sets the style of the arrowhead at the end of the specified line. Read/write MsoArrowheadStyle.
EndArrowheadWidth | Returns or sets the width of the arrowhead at the end of the specified line. Read/write MsoArrowheadWidth.
ForeColor | Returns or sets a ColorFormat object that represents the foreground color for the line. Read/write.
InsetPen | MsoTrue to draw lines inside a specified shape. Read/write MsoTriState.
Parent | Returns an Object that represents the parent object of the specified LineFormat object.
Pattern | Returns or sets a value that represents the pattern applied to the specified line. Read/write MsoPatternType.
Style | Returns or sets the line format style. Read/write MsoLineStyle.
Transparency | Returns or sets the degree of transparency of line. Read/write Single.
Visible | True if the specified object, or the formatting applied to it, is visible. Read/write MsoTriState.
Weight | Returns or sets the thickness of the specified line in points. Read/write Single.


LineFormat Properties (Word)

 Copy code hover
[image]

LineFormat Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
BackColor | Returns or sets a ColorFormat object that represents the background color for a patterned line. Read/write.
BeginArrowheadLength | Returns or sets the length of the arrowhead at the beginning of the specified line. Read/write MsoArrowheadLength.
BeginArrowheadStyle | Returns or sets the style of the arrowhead at the beginning of the specified line. Read/write MsoArrowheadStyle.
BeginArrowheadWidth | Returns or sets the width of the arrowhead at the beginning of the specified line. Read/write MsoArrowheadWidth.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
DashStyle | Returns or sets the dash style for the specified line. Read/write MsoLineDashStyle.
EndArrowheadLength | Returns or sets the length of the arrowhead at the end of the specified line. Read/write MsoArrowheadLength.
EndArrowheadStyle | Returns or sets the style of the arrowhead at the end of the specified line. Read/write MsoArrowheadStyle.
EndArrowheadWidth | Returns or sets the width of the arrowhead at the end of the specified line. Read/write MsoArrowheadWidth.
ForeColor | Returns or sets a ColorFormat object that represents the foreground color for the line. Read/write.
InsetPen | MsoTrue to draw lines inside a specified shape. Read/write MsoTriState.
Parent | Returns an Object that represents the parent object of the specified LineFormat object.
Pattern | Returns or sets a value that represents the pattern applied to the specified line. Read/write MsoPatternType.
Style | Returns or sets the line format style. Read/write MsoLineStyle.
Transparency | Returns or sets the degree of transparency of line. Read/write Single.
Visible | True if the specified object, or the formatting applied to it, is visible. Read/write MsoTriState.
Weight | Returns or sets the thickness of the specified line in points. Read/write Single.


LineFormat.Application Property (Word)

 Copy code hover
[image]

LineFormat.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a LineFormat object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

LineFormat Object

Other resources

LineFormat Object Members


LineFormat.BackColor Property (Word)

 Copy code hover
[image]

LineFormat.BackColor Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a ColorFormat object that represents the background color for a patterned line. Read/write.

Syntax

expression .BackColor

expression A variable that represents a LineFormat object.

Example

This example adds a patterned line to the active document.

VBA Copy code Copy code
Dim docActive As Document

Set docActive = ActiveDocument

With docActive.Shapes.AddLine(10, 100, 250, 0).Line
 .Weight = 6
 .ForeColor.RGB = RGB(0, 0, 255)
 .BackColor.RGB = RGB(128, 0, 0)
 .Pattern = msoPatternDarkDownwardDiagonal
End With

See also

Concepts

LineFormat Object

Other resources

LineFormat Object Members


LineFormat.BeginArrowheadLength Property (Word)

 Copy code hover
[image]

LineFormat.BeginArrowheadLength Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the length of the arrowhead at the beginning of the specified line. Read/write MsoArrowheadLength.

Syntax

expression .BeginArrowheadLength

expression Required. A variable that represents a LineFormat object.

Example

This example adds a line to the active document. There is a short, narrow oval on the line's starting point and a long, wide triangle on its endpoint.

VBA Copy code Copy code
Dim docActive As Document

Set docActive = ActiveDocument

With docActive.Shapes.AddLine(100, 100, 200, 300).Line
 .BeginArrowheadLength = msoArrowheadShort
 .BeginArrowheadStyle = msoArrowheadOval
 .BeginArrowheadWidth = msoArrowheadNarrow
 .EndArrowheadLength = msoArrowheadLong
 .EndArrowheadStyle = msoArrowheadTriangle
 .EndArrowheadWidth = msoArrowheadWide
End With

See also

Concepts

LineFormat Object

Other resources

LineFormat Object Members


LineFormat.BeginArrowheadStyle Property (Word)

 Copy code hover
[image]

LineFormat.BeginArrowheadStyle Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the style of the arrowhead at the beginning of the specified line. Read/write MsoArrowheadStyle.

Syntax

expression .BeginArrowheadStyle

expression Required. A variable that represents a LineFormat object.

Example

This example adds a line to the active document. There is a short, narrow oval on the line's starting point and a long, wide triangle on its endpoint.

VBA Copy code Copy code
Dim docActive As Document

Set docActive = ActiveDocument
VBA Copy code Copy code
With docActive.Shapes.AddLine(100, 100, 200, 300).Line
 .BeginArrowheadLength = msoArrowheadShort
 .BeginArrowheadStyle = msoArrowheadOval
 .BeginArrowheadWidth = msoArrowheadNarrow
 .EndArrowheadLength = msoArrowheadLong
 .EndArrowheadStyle = msoArrowheadTriangle
 .EndArrowheadWidth = msoArrowheadWide
End With

See also

Concepts

LineFormat Object

Other resources

LineFormat Object Members


LineFormat.BeginArrowheadWidth Property (Word)

 Copy code hover
[image]

LineFormat.BeginArrowheadWidth Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the width of the arrowhead at the beginning of the specified line. Read/write MsoArrowheadWidth.

Syntax

expression .BeginArrowheadWidth

expression Required. A variable that represents a LineFormat object.

Example

This example adds a line to the first document. There is a short, narrow oval on the line's starting point and a long, wide triangle on its endpoint.

VBA Copy code Copy code
Dim docFirst As Document

Set docFirst =
VBA Copy code Copy code
Documents(1)
With docFirst.Shapes.AddLine(100, 100, 200, 300).Line
 .BeginArrowheadLength = msoArrowheadShort
 .BeginArrowheadStyle = msoArrowheadOval
 .BeginArrowheadWidth = msoArrowheadNarrow
 .EndArrowheadLength = msoArrowheadLong
 .EndArrowheadStyle = msoArrowheadTriangle
 .EndArrowheadWidth = msoArrowheadWide
End With

See also

Concepts

LineFormat Object

Other resources

LineFormat Object Members


LineFormat.Creator Property (Word)

 Copy code hover
[image]

LineFormat.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a LineFormat object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

LineFormat Object

Other resources

LineFormat Object Members


LineFormat.DashStyle Property (Word)

 Copy code hover
[image]

LineFormat.DashStyle Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the dash style for the specified line. Read/write MsoLineDashStyle.

Syntax

expression .DashStyle

expression Required. A variable that represents a LineFormat object.

Example

This example adds a blue dashed line to the active document.

VBA Copy code Copy code
Dim docActive As Document

Set docActive = ActiveDocument

With docActive.Shapes.AddLine(10, 10, 250, 250).Line
 .DashStyle = msoLineDashDotDot
 .ForeColor.RGB = RGB(50, 0, 128)
End With

See also

Concepts

LineFormat Object

Other resources

LineFormat Object Members


LineFormat.EndArrowheadLength Property (Word)

 Copy code hover
[image]

LineFormat.EndArrowheadLength Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the length of the arrowhead at the end of the specified line. Read/write MsoArrowheadLength.

Syntax

expression .EndArrowheadLength

expression Required. A variable that represents a LineFormat object.

Example

This example adds a line to the active document. There is a short, narrow oval on the line's starting point and a long, wide triangle on its endpoint.

VBA Copy code Copy code
Dim docActive As Document

Set docActive = ActiveDocument

With docActive.Shapes.AddLine(100, 100, 200, 300).Line
 .BeginArrowheadLength = msoArrowheadShort
 .BeginArrowheadStyle = msoArrowheadOval
 .BeginArrowheadWidth = msoArrowheadNarrow
 .EndArrowheadLength = msoArrowheadLong
 .EndArrowheadStyle = msoArrowheadTriangle
 .EndArrowheadWidth = msoArrowheadWide
End With

See also

Concepts

LineFormat Object

Other resources

LineFormat Object Members


LineFormat.EndArrowheadStyle Property (Word)

 Copy code hover
[image]

LineFormat.EndArrowheadStyle Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the style of the arrowhead at the end of the specified line. Read/write MsoArrowheadStyle.

Syntax

expression .EndArrowheadStyle

expression Required. A variable that represents a LineFormat object.

Example

This example adds a line to the active document. There is a short, narrow oval on the line's starting point and a long, wide triangle on its endpoint.

VBA Copy code Copy code
Dim docActive As Document

Set docActive = ActiveDocument

With docActive.Shapes.AddLine(100, 100, 200, 300).Line
 .BeginArrowheadLength = msoArrowheadShort
 .BeginArrowheadStyle = msoArrowheadOval
 .BeginArrowheadWidth = msoArrowheadNarrow
 .EndArrowheadLength = msoArrowheadLong
 .EndArrowheadStyle = msoArrowheadTriangle
 .EndArrowheadWidth = msoArrowheadWide
End With

See also

Concepts

LineFormat Object

Other resources

LineFormat Object Members


LineFormat.EndArrowheadWidth Property (Word)

 Copy code hover
[image]

LineFormat.EndArrowheadWidth Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the width of the arrowhead at the end of the specified line. Read/write MsoArrowheadWidth.

Syntax

expression .EndArrowheadWidth

expression Required. A variable that represents a LineFormat object.

Example

This example adds a line to the active document. There is a short, narrow oval on the line's starting point and a long, wide triangle on its endpoint.

VBA Copy code Copy code
Dim docActive As Document

Set docActive = ActiveDocument

With docActive.Shapes.AddLine(100, 100, 200, 300).Line
 .BeginArrowheadLength = msoArrowheadShort
 .BeginArrowheadStyle = msoArrowheadOval
 .BeginArrowheadWidth = msoArrowheadNarrow
 .EndArrowheadLength = msoArrowheadLong
 .EndArrowheadStyle = msoArrowheadTriangle
 .EndArrowheadWidth = msoArrowheadWide
End With

See also

Concepts

LineFormat Object

Other resources

LineFormat Object Members


LineFormat.ForeColor Property (Word)

 Copy code hover
[image]

LineFormat.ForeColor Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a ColorFormat object that represents the foreground color for the line. Read/write.

Syntax

expression .ForeColor

expression A variable that represents a LineFormat object.

Example

This example adds a patterned line to the active document.

VBA Copy code Copy code
Dim docActive As Document

Set docActive = ActiveDocument
VBA Copy code Copy code
With docActive.Shapes.AddLine(10, 100, 250, 0).Line
 .Weight = 6
 .ForeColor.RGB = RGB(0, 0, 255)
 .BackColor.RGB = RGB(128, 0, 0)
 .Pattern = msoPatternDarkDownwardDiagonal
End With

See also

Concepts

LineFormat Object

Other resources

LineFormat Object Members


LineFormat.InsetPen Property (Word)

 Copy code hover
[image]

LineFormat.InsetPen Property (Word)
See also Send feedback

Published: July 16, 2012

MsoTrue to draw lines inside a specified shape. Read/write MsoTriState.

Syntax

expression .InsetPen

expression Required. A variable that represents a LineFormat object.

Remarks

Use the InsetPen property to match up the edges of shapes of equal width but whose line widths vary.

Example

This example sets all shapes in the active document to draw lines inside the shapes.

VBA Copy code Copy code
Sub InsetLine()
 Dim shpShape As Shape

 For Each shpShape In ActiveDocument.Shapes
 shpShape.Line.InsetPen = msoTrue
 Next shpShape
End Sub

See also

Concepts

LineFormat Object

Other resources

LineFormat Object Members


LineFormat.Parent Property (Word)

 Copy code hover
[image]

LineFormat.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified LineFormat object.

Syntax

expression .Parent

expression Required. A variable that represents a LineFormat object.

See also

Concepts

LineFormat Object

Other resources

LineFormat Object Members


LineFormat.Pattern Property (Word)

 Copy code hover
[image]

LineFormat.Pattern Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a value that represents the pattern applied to the specified line. Read/write MsoPatternType.

Syntax

expression .Pattern

expression Required. A variable that represents a LineFormat object.

Example

This example adds a patterned line to myDocument.

VBA Copy code Copy code
Set myDocument = ActiveDocument
With myDocument.Shapes.AddLine(10, 100, 250, 0).Line
 .Weight = 6
 .ForeColor.RGB = RGB(0, 0, 255)
 .BackColor.RGB = RGB(128, 0, 0)
 .Pattern = msoPatternDarkDownwardDiagonal
End With

See also

Concepts

LineFormat Object

Other resources

LineFormat Object Members


LineFormat.Style Property (Word)

 Copy code hover
[image]

LineFormat.Style Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the line format style. Read/write MsoLineStyle.

Syntax

expression .Style

expression Required. A variable that represents a LineFormat object.

See also

Concepts

LineFormat Object

Other resources

LineFormat Object Members


LineFormat.Transparency Property (Word)

 Copy code hover
[image]

LineFormat.Transparency Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the degree of transparency of line. Read/write Single.

Syntax

expression .Transparency

expression Required. A variable that represents a LineFormat object.

Remarks

The value of this property can be expressed as a value between 0.0 (opaque) and 1.0 (clear). This property affects the appearance of solid-colored lines only; it has no effect on the appearance of patterned lines.

Example

This example sets the shadow of shape three in the active document to semitransparent red. If the shape doesn't already have a shadow, this example adds one to it.

VBA Copy code Copy code
With ActiveDocument.Shapes(3).Shadow
 .Visible = True
 .ForeColor.RGB = RGB(255, 0, 0)
 .Transparency = 0.5
End With

See also

Concepts

LineFormat Object

Other resources

LineFormat Object Members


LineFormat.Visible Property (Word)

 Copy code hover
[image]

LineFormat.Visible Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified object, or the formatting applied to it, is visible. Read/write MsoTriState.

Syntax

expression .Visible

expression Required. A variable that represents a LineFormat object.

Remarks

Some methods and properties may be unavailable if the Visible property is False.

See also

Concepts

LineFormat Object

Other resources

LineFormat Object Members


LineFormat.Weight Property (Word)

 Copy code hover
[image]

LineFormat.Weight Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the thickness of the specified line in points. Read/write Single.

Syntax

expression .Weight

expression An expression that returns a LineFormat object.

Example

This example adds a green dashed line two points thick to the active document.

VBA Copy code Copy code
With ActiveDocument.Shapes.AddLine(10, 10, 250, 250).Line
 .DashStyle = msoLineDashDotDot
 .ForeColor.RGB = RGB(0, 255, 255)
 .Weight = 2
End With

See also

Concepts

LineFormat Object

Other resources

LineFormat Object Members


LineNumbering Object (Word)

 Copy code hover
[image]

LineNumbering Object (Word)
See also Send feedback

Published: July 16, 2012

Represents line numbers in the left margin or to the left of each newspaper-style column.

Remarks

Use the LineNumbering property to return the LineNumbering object. The following example applies line numbering to the text in the first section of the active document.

VBA Copy code Copy code
With ActiveDocument.Sections(1).PageSetup.LineNumbering
 .Active = True
 .CountBy = 5
 .RestartMode = wdRestartPage
End With

The following example applies line numbering to the pages in the current section.

VBA Copy code Copy code
Selection.PageSetup.LineNumbering.Active = True

See also

Concepts

Word Object Model Reference

Other resources

LineNumbering Object Members


LineNumbering Members (Word)

 Copy code hover
[image]

LineNumbering Members (Word)
Send feedback

Published: July 16, 2012

Represents line numbers in the left margin or to the left of each newspaper-style column.

Properties

Name | Description
Active | True if line numbering is active for the specified document, section, or sections. Read/write Long.
Application | Returns an Application object that represents the Microsoft Word application.
CountBy | Returns or sets the numeric increment for line numbers. Read/write Long.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
DistanceFromText | Returns or sets the distance (in points) between the right edge of line numbers and the left edge of the document text. Read/write Single.
Parent | Returns an Object that represents the parent object of the specified LineNumbering object.
RestartMode | Returns or sets the way line numbering runs — that is, whether it starts over at the beginning of a new page or section or runs continuously. Read/write WdNumberingRule.
StartingNumber | Returns or sets the starting line number. Read/write Long.


LineNumbering Properties (Word)

 Copy code hover
[image]

LineNumbering Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Active | True if line numbering is active for the specified document, section, or sections. Read/write Long.
Application | Returns an Application object that represents the Microsoft Word application.
CountBy | Returns or sets the numeric increment for line numbers. Read/write Long.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
DistanceFromText | Returns or sets the distance (in points) between the right edge of line numbers and the left edge of the document text. Read/write Single.
Parent | Returns an Object that represents the parent object of the specified LineNumbering object.
RestartMode | Returns or sets the way line numbering runs — that is, whether it starts over at the beginning of a new page or section or runs continuously. Read/write WdNumberingRule.
StartingNumber | Returns or sets the starting line number. Read/write Long.


LineNumbering.Active Property (Word)

 Copy code hover
[image]

LineNumbering.Active Property (Word)
See also Send feedback

Published: July 16, 2012

True if line numbering is active for the specified document, section, or sections. Read/write Long.

Syntax

expression .Active

expression An expression that returns a LineNumbering object.

Example

This example activates line numbering for the first section in the selection.

VBA Copy code Copy code
Sub CountByFive()
 With Selection.Sections(1).PageSetup.LineNumbering
 .Active = True
 .CountBy = 5
 .StartingNumber = 1
 End With
End Sub

See also

Concepts

LineNumbering Object

Other resources

LineNumbering Object Members


LineNumbering.Application Property (Word)

 Copy code hover
[image]

LineNumbering.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a LineNumbering object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

LineNumbering Object

Other resources

LineNumbering Object Members


LineNumbering.CountBy Property (Word)

 Copy code hover
[image]

LineNumbering.CountBy Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the numeric increment for line numbers. Read/write Long.

Syntax

expression .CountBy

expression A variable that represents a LineNumbering object.

Remarks

If the CountBy property is set to 5, every fifth line will display the line number. Line numbers are only displayed in print layout view and print preview. This property has no effect unless the Active property of the LineNumbering object is set to True.

Example

This example turns on line numbering for the active document. The line number is displayed on every fifth line and line numbering starts over for each new section.

VBA Copy code Copy code
With ActiveDocument.PageSetup.LineNumbering
 .Active = True
 .CountBy = 5
 .RestartMode = wdRestartSection
End With

See also

Concepts

LineNumbering Object

Other resources

LineNumbering Object Members


LineNumbering.Creator Property (Word)

 Copy code hover
[image]

LineNumbering.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a LineNumbering object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

LineNumbering Object

Other resources

LineNumbering Object Members


LineNumbering.DistanceFromText Property (Word)

 Copy code hover
[image]

LineNumbering.DistanceFromText Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the distance (in points) between the right edge of line numbers and the left edge of the document text. Read/write Single.

Syntax

expression .DistanceFromText

expression A variable that represents a LineNumbering object.

Example

This example adds line numbers to the active document. The distance between the line numbers and the left margin is 36 points (0.5 inch).

VBA Copy code Copy code
With ActiveDocument.PageSetup.LineNumbering
 .Active = True
 .CountBy = 5
 .DistanceFromText = 36
End With

See also

Concepts

LineNumbering Object

Other resources

LineNumbering Object Members


LineNumbering.Parent Property (Word)

 Copy code hover
[image]

LineNumbering.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified LineNumbering object.

Syntax

expression .Parent

expression Required. A variable that represents a LineNumbering object.

See also

Concepts

LineNumbering Object

Other resources

LineNumbering Object Members


LineNumbering.RestartMode Property (Word)

 Copy code hover
[image]

LineNumbering.RestartMode Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the way line numbering runs — that is, whether it starts over at the beginning of a new page or section or runs continuously. Read/write WdNumberingRule.

Syntax

expression .RestartMode

expression Required. A variable that represents a LineNumbering object.

Remarks

You must be in print layout view to see line numbering.

Example

This example enables line numbering for the active document. The starting number is set to 1, every tenth line number is shown, and the numbering starts over at the beginning of each section.

VBA Copy code Copy code
set myDoc = ActiveDocument
With myDoc.PageSetup.LineNumbering
 .Active = True
 .StartingNumber = 1
 .CountBy = 10
 .RestartMode = wdRestartSection
End With

See also

Concepts

LineNumbering Object

Other resources

LineNumbering Object Members


LineNumbering.StartingNumber Property (Word)

 Copy code hover
[image]

LineNumbering.StartingNumber Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the starting line number. Read/write Long.

Syntax

expression .StartingNumber

expression Required. A variable that represents a LineNumbering object.

Remarks

You must be in print layout view to see line numbering.

Example

This example creates a new document, sets the starting number for footnotes to 10, and then adds a footnote at the insertion point.

VBA Copy code Copy code
Set myDoc = Documents.Add
With myDoc.Footnotes
 .StartingNumber = 10
 .Add Range:=Selection.Range, Text:="Text for a footnote"
End With

This example enables line numbering for the active document. The starting number is set to 5, every fifth line number is shown, and the numbering starts over at the beginning of each section in the document.

VBA Copy code Copy code
With ActiveDocument.PageSetup.LineNumbering
 .Active = True
 .StartingNumber = 5
 .CountBy = 5
 .RestartMode = wdRestartSection
End With

This example sets properties for page numbers, and then it adds page numbers to the header of the active document.

VBA Copy code Copy code
With ActiveDocument.Sections(1) _
 .Headers(wdHeaderFooterPrimary).PageNumbers
 .NumberStyle = wdPageNumberStyleArabic
 .IncludeChapterNumber = False
 .RestartNumberingAtSection = True
 .StartingNumber = 5
 .Add PageNumberAlignment:=wdAlignPageNumberCenter, _
 FirstPage:=True
End With

See also

Concepts

LineNumbering Object

Other resources

LineNumbering Object Members


Lines Object (Word)

 Copy code hover
[image]

Lines Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of Line objects that represents the lines in a Rectangle object that is of type wdTextRectangle.

Remarks

Use the Lines property to return a collection of lines for a specified rectangle. The following example accesses the lines in the first rectangle in the first page in the active document.

VBA Copy code Copy code
Dim objLines As Lines

Set objLines = ActiveDocument.ActiveWindow.Panes(1) _
 .Pages(1).Rectangles(1).Lines

Use the RectangleType property of the specified Rectangle object to determine whether the Rectangle object is of type wdTextRectangle. The following example returns the collection of lines in the first rectangle in the first page of the active document if the specified rectangle contains text.

VBA Copy code Copy code
Dim objRectangle As Rectangle
Dim objLines As Lines

Set objRectangle = ActiveDocument.ActiveWindow _
 .Panes(1).Pages(1).Rectangles(1)

If objRectangle.RectangleType = wdTextRectangle Then _
 Set objLines = objRectangle.Lines

See also

Concepts

Word Object Model Reference

Other resources

Lines Object Members


Lines Members (Word)

 Copy code hover
[image]

Lines Members (Word)
Send feedback

Published: July 16, 2012

A collection of Line objects that represents the lines in a Rectangle object that is of type wdTextRectangle.

Methods

Name | Description
Item | Returns an individual Line object in a collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of lines in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified Lines object.


Lines Properties (Word)

 Copy code hover
[image]

Lines Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of lines in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified Lines object.


Lines.Application Property (Word)

 Copy code hover
[image]

Lines.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a Lines collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

Lines Collection

Other resources

Lines Object Members


Lines.Count Property (Word)

 Copy code hover
[image]

Lines.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of lines in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents a Lines collection.

See also

Concepts

Lines Collection

Other resources

Lines Object Members


Lines.Creator Property (Word)

 Copy code hover
[image]

Lines.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a Lines collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Lines Collection

Other resources

Lines Object Members


Lines.Parent Property (Word)

 Copy code hover
[image]

Lines.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Lines object.

Syntax

expression .Parent

expression Required. A variable that represents a Lines collection.

See also

Concepts

Lines Collection

Other resources

Lines Object Members


Lines Methods (Word)

 Copy code hover
[image]

Lines Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Item | Returns an individual Line object in a collection.


Lines.Item Method (Word)

 Copy code hover
[image]

Lines.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual Line object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents a Lines collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The individual object to be returned. Can be a Long indicating the ordinal position of the individual object.

Return Value

Line

See also

Concepts

Lines Collection

Other resources

Lines Object Members


LinkFormat Object (Word)

 Copy code hover
[image]

LinkFormat Object (Word)
See also Send feedback

Published: July 16, 2012

Represents the linking characteristics for an OLE object or picture.

Remarks

Use the LinkFormat property for a shape, inline shape, or field to return the LinkFormat object. The following example breaks the link for the first shape on the active document.

VBA Copy code Copy code
ActiveDocument.Shapes(1).LinkFormat.BreakLink

Not all types of shapes, inline shapes, and fields can be linked to a source. Use the Type property for the Shape and InlineShape objects to determine whether a particular shape can be linked. The Type property for a Field object returns the type of field.

You can use both the Update method and the AutoUpdate property to update links. To return or set the full path for a particular link's source file, use the SourceFullName property.

See also

Concepts

Word Object Model Reference

Other resources

LinkFormat Object Members


LinkFormat Members (Word)

 Copy code hover
[image]

LinkFormat Members (Word)
Send feedback

Published: July 16, 2012

Represents the linking characteristics for an OLE object or picture.

Methods

Name | Description
BreakLink | Breaks the link between the source file and the specified OLE object, picture, or linked field.
Update | Updates the specified link format.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
AutoUpdate | True if the specified link is updated automatically when the container file is opened or when the source file is changed. Read/write Boolean.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Locked | True if a Field, InlineShape, or Shape object is locked to prevent automatic updating. Read/write Boolean.
Parent | Returns an Object that represents the parent object of the specified LinkFormat object.
SavePictureWithDocument | True if the specified picture is saved with the document. Read/write Boolean.
SourceFullName | Returns or sets the path and name of the source file for the specified linked OLE object, picture, or field. Read/write String.
SourceName | Returns the name of the source file for the specified linked OLE object, picture, or field. Read-only String.
SourcePath | Returns the path of the source file for the specified linked OLE object, picture, or field. Read-only String.
Type | Returns the link type. Read-only WdLinkType.


LinkFormat Properties (Word)

 Copy code hover
[image]

LinkFormat Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
AutoUpdate | True if the specified link is updated automatically when the container file is opened or when the source file is changed. Read/write Boolean.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Locked | True if a Field, InlineShape, or Shape object is locked to prevent automatic updating. Read/write Boolean.
Parent | Returns an Object that represents the parent object of the specified LinkFormat object.
SavePictureWithDocument | True if the specified picture is saved with the document. Read/write Boolean.
SourceFullName | Returns or sets the path and name of the source file for the specified linked OLE object, picture, or field. Read/write String.
SourceName | Returns the name of the source file for the specified linked OLE object, picture, or field. Read-only String.
SourcePath | Returns the path of the source file for the specified linked OLE object, picture, or field. Read-only String.
Type | Returns the link type. Read-only WdLinkType.


LinkFormat.Application Property (Word)

 Copy code hover
[image]

LinkFormat.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a LinkFormat object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

LinkFormat Object

Other resources

LinkFormat Object Members


LinkFormat.AutoUpdate Property (Word)

 Copy code hover
[image]

LinkFormat.AutoUpdate Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified link is updated automatically when the container file is opened or when the source file is changed. Read/write Boolean.

Syntax

expression .AutoUpdate

expression A variable that represents a LinkFormat object.

Example

This example updates any shapes in the active document that are linked OLE objects if Word isn't set to update links automatically.

VBA Copy code Copy code
Dim shapeLoop as Shape

For Each shapeLoop In ActiveDocument.Shapes
 With shapeLoop
 If .Type = msoLinkedOLEObject Then
 If .LinkFormat.AutoUpdate = False Then
 .LinkFormat.Update
 End If
 End If
 End With
Next s

This example updates any fields in the active document that aren't updated automatically.

VBA Copy code Copy code
Dim fieldLoop as Field

For Each fieldLoop In ActiveDocument.Fields
 If fieldLoop.LinkFormat.AutoUpdate = False Then _
 fieldLoop.LinkFormat.Update
Next fieldLoop

See also

Concepts

LinkFormat Object

Other resources

LinkFormat Object Members


LinkFormat.Creator Property (Word)

 Copy code hover
[image]

LinkFormat.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a LinkFormat object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

LinkFormat Object

Other resources

LinkFormat Object Members


LinkFormat.Locked Property (Word)

 Copy code hover
[image]

LinkFormat.Locked Property (Word)
See also Send feedback

Published: July 16, 2012

True if a Field, InlineShape, or Shape object is locked to prevent automatic updating. Read/write Boolean.

Syntax

expression .Locked

expression Required. A variable that represents a LinkFormat object.

Remarks

If you use this property with a Shape object that is a floating linked picture (a picture added with the AddPicture method of the Shapes object), an error occurs.

See also

Concepts

LinkFormat Object

Other resources

LinkFormat Object Members


LinkFormat.Parent Property (Word)

 Copy code hover
[image]

LinkFormat.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified LinkFormat object.

Syntax

expression .Parent

expression Required. A variable that represents a LinkFormat object.

See also

Concepts

LinkFormat Object

Other resources

LinkFormat Object Members


LinkFormat.SavePictureWithDocument Property (Word)

 Copy code hover
[image]

LinkFormat.SavePictureWithDocument Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified picture is saved with the document. Read/write Boolean.

Syntax

expression .SavePictureWithDocument

expression An expression that returns a LinkFormat object.

Remarks

This property works only with shapes and inline shapes that are linked pictures.

Example

This example saves the linked picture that's defined as the first inline shape in the active document when the document is saved.

VBA Copy code Copy code
Set myPic = ActiveDocument.InlineShapes(1)
If myPic.Type = wdInlineShapeLinkedPicture Then
 myPic.LinkFormat.SavePictureWithDocument = True
End If

See also

Concepts

LinkFormat Object

Other resources

LinkFormat Object Members


LinkFormat.SourceFullName Property (Word)

 Copy code hover
[image]

LinkFormat.SourceFullName Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the path and name of the source file for the specified linked OLE object, picture, or field. Read/write String.

Syntax

expression .SourceFullName

expression An expression that returns a LinkFormat object.

Remarks

Using this property is equivalent to using in sequence the SourcePath , PathSeparator , and SourceName properties.

Example

This example sets MyExcel.xls as the source file for shape one on the active document and specifies that the OLE object be updated automatically.

VBA Copy code Copy code
With ActiveDocument.Shapes(1)
 If .Type = msoLinkedOLEObject Then
 With .LinkFormat
 .SourceFullName = "c:\my documents\myExcel.xls"
 .AutoUpdate = True
 End With
 End If
End With

See also

Concepts

LinkFormat Object

Other resources

LinkFormat Object Members


LinkFormat.SourceName Property (Word)

 Copy code hover
[image]

LinkFormat.SourceName Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the name of the source file for the specified linked OLE object, picture, or field. Read-only String.

Syntax

expression .SourceName

expression An expression that returns a LinkFormat object.

Remarks

This property doesn't return the path for the source file.

Example

This example returns the path and name of the source file for any shapes on the active document that are linked OLE objects.

VBA Copy code Copy code
For Each s In ActiveDocument.Shapes
 If s.Type = msoLinkedOLEObject Then
 Msgbox s.LinkFormat.SourcePath & "\" _
 & s.LinkFormat.SourceName
 End If
Next s

See also

Concepts

LinkFormat Object

Other resources

LinkFormat Object Members


LinkFormat.SourcePath Property (Word)

 Copy code hover
[image]

LinkFormat.SourcePath Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the path of the source file for the specified linked OLE object, picture, or field. Read-only String.

Syntax

expression .SourcePath

expression An expression that returns a LinkFormat object.

Remarks

The path doesn't include a trailing character (for example, "C:\MSOffice"). Use the PathSeparator property to add the character that separates folders and drive letters. Use the SourceName property to return the file name without the path and use the SourceFullName property to return the path and file name together.

Example

This example returns the path and name of the source file for any shapes on the active document that are linked OLE objects.

VBA Copy code Copy code
For Each s In ActiveDocument.Shapes
 If s.Type = msoLinkedOLEObject Then
 Msgbox s.LinkFormat.SourcePath & "\" _
 & s.LinkFormat.SourceName
 End If
Next s

See also

Concepts

LinkFormat Object

Other resources

LinkFormat Object Members


LinkFormat.Type Property (Word)

 Copy code hover
[image]

LinkFormat.Type Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the link type. Read-only WdLinkType.

Syntax

expression .Type

expression Required. A variable that represents a LinkFormat object.

Remarks

Security note Security Note
Dynamic data exchange (DDE) is an older technology that is not secure. If possible, use a more secure alternative to DDE, such as object linking and embedding (OLE).

See also

Concepts

LinkFormat Object

Other resources

LinkFormat Object Members


LinkFormat Methods (Word)

 Copy code hover
[image]

LinkFormat Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
BreakLink | Breaks the link between the source file and the specified OLE object, picture, or linked field.
Update | Updates the specified link format.


LinkFormat.BreakLink Method (Word)

 Copy code hover
[image]

LinkFormat.BreakLink Method (Word)
See also Send feedback

Published: July 16, 2012

Breaks the link between the source file and the specified OLE object, picture, or linked field.

Syntax

expression .BreakLink

expression Required. A variable that represents a LinkFormat object.

Remarks

After you use this method, the link result won't be automatically updated if the source file is changed.

Example

This example updates and then breaks the links to any shapes that are linked OLE objects in the active document.

VBA Copy code Copy code
Dim shapeLoop As Shape

For Each shapeLoop In ActiveDocument.Shapes
 With shapeLoop
 If .Type = msoLinkedOLEObject Then
 .LinkFormat.Update
 .LinkFormat.BreakLink
 End If
 End With
Next shapeLoop

See also

Concepts

LinkFormat Object

Other resources

LinkFormat Object Members


LinkFormat.Update Method (Word)

 Copy code hover
[image]

LinkFormat.Update Method (Word)
See also Send feedback

Published: July 16, 2012

Updates the specified link format.

Syntax

expression .Update

expression Required. A variable that represents a LinkFormat object.

See also

Concepts

LinkFormat Object

Other resources

LinkFormat Object Members


List Object (Word)

 Copy code hover
[image]

List Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a single list format that's been applied to specified paragraphs in a document. The List object is a member of the Lists collection.

Remarks

Use Lists(Index), where Index is the index number, to return a single List object. The following example returns the number of items in list one in the active document.

VBA Copy code Copy code
mycount = ActiveDocument.Lists(1).CountNumberedItems

To return all the paragraphs that have list formatting, use the ListParagraphs property. To return them as a range, use the Range property.

To apply a different list format to an existing list, use the ApplyListTemplate method with the List object. To add a new list to a document, use the ApplyListTemplate method with the ListFormat object for a specified range.

Use the CanContinuePreviousList method to determine whether you can continue the list formatting from a list that was previously applied to the document.

Use the CountNumberedItems method to return the number of items in a numbered or bulleted list, including LISTNUM fields.

To determine whether a list contains more than one list template, use the SingleListTemplate property.

You can manipulate the individual List objects within a document, but for more precise control you should work with the ListFormat object.

Note Note

Picture-bulleted lists are not included in the Lists collection and cannot be manipulated using the List object.

See also

Concepts

Word Object Model Reference

Other resources

List Object Members


List Members (Word)

 Copy code hover
[image]

List Members (Word)
Send feedback

Published: July 16, 2012

Represents a single list format that's been applied to specified paragraphs in a document. The List object is a member of the Lists collection.

Methods

Name | Description
ApplyListTemplate | Applies a set of list-formatting characteristics to the specified ListFormat object.
ApplyListTemplateWithLevel | Applies a set of list-formatting characteristics, optionally for a specified level.
CanContinuePreviousList | Returns a WdContinue constant (wdContinueDisabled, wdResetList, or wdContinueList) that indicates whether the formatting from the previous list can be continued.
ConvertNumbersToText | Changes the list numbers and LISTNUM fields in the specified List object.
CountNumberedItems | Returns the number of bulleted or numbered items and LISTNUM fields in the specified List object.
RemoveNumbers | Removes numbers or bullets from the specified list.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
ListParagraphs | Returns a ListParagraphs collection that represents all the numbered paragraphs in the list, document, or range. Read-only.
Parent | Returns an Object that represents the parent object of the specified List object.
Range | Returns a Range object that represents the portion of a document that is contained in the specified object.
SingleListTemplate | True if the entire list uses the same list template. Read-only Boolean.
StyleName | Returns the name of the style applied to the specified AutoText entry. Read-only String.


List Properties (Word)

 Copy code hover
[image]

List Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
ListParagraphs | Returns a ListParagraphs collection that represents all the numbered paragraphs in the list, document, or range. Read-only.
Parent | Returns an Object that represents the parent object of the specified List object.
Range | Returns a Range object that represents the portion of a document that is contained in the specified object.
SingleListTemplate | True if the entire list uses the same list template. Read-only Boolean.
StyleName | Returns the name of the style applied to the specified AutoText entry. Read-only String.


List.Application Property (Word)

 Copy code hover
[image]

List.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a List object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

List Object

Other resources

List Object Members


List.Creator Property (Word)

 Copy code hover
[image]

List.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a List object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

List Object

Other resources

List Object Members


List.ListParagraphs Property (Word)

 Copy code hover
[image]

List.ListParagraphs Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a ListParagraphs collection that represents all the numbered paragraphs in the list, document, or range. Read-only.

Syntax

expression .ListParagraphs

expression A variable that represents a List object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example double underlines the paragraphs in the second list in the active document.

VBA Copy code Copy code
For Each mypara In ActiveDocument.Lists(2).ListParagraphs
 mypara.Range.Underline = wdUnderlineDouble
Next mypara

See also

Concepts

List Object

Other resources

List Object Members


List.Parent Property (Word)

 Copy code hover
[image]

List.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified List object.

Syntax

expression .Parent

expression Required. A variable that represents a List object.

See also

Concepts

List Object

Other resources

List Object Members


List.Range Property (Word)

 Copy code hover
[image]

List.Range Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the portion of a document that is contained in the specified object.

Syntax

expression .Range

expression Required. A variable that represents a List object.

See also

Concepts

List Object

Other resources

List Object Members


List.SingleListTemplate Property (Word)

 Copy code hover
[image]

List.SingleListTemplate Property (Word)
See also Send feedback

Published: July 16, 2012

True if the entire list uses the same list template. Read-only Boolean.

Syntax

expression .SingleListTemplate

expression Required. A variable that represents a List object.

See also

Concepts

List Object

Other resources

List Object Members


List.StyleName Property (Word)

 Copy code hover
[image]

List.StyleName Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the name of the style applied to the specified AutoText entry. Read-only String.

Syntax

expression .StyleName

expression Required. A variable that represents a List object.

Example

This example creates an AutoText entry and then displays the style name of the entry.

VBA Copy code Copy code
Set myentry = NormalTemplate.AutoTextEntries.Add(Name:="rsvp", _
 Range:=Selection.Range)
MsgBox myentry.StyleName

See also

Concepts

List Object

Other resources

List Object Members


List Methods (Word)

 Copy code hover
[image]

List Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
ApplyListTemplate | Applies a set of list-formatting characteristics to the specified ListFormat object.
ApplyListTemplateWithLevel | Applies a set of list-formatting characteristics, optionally for a specified level.
CanContinuePreviousList | Returns a WdContinue constant (wdContinueDisabled, wdResetList, or wdContinueList) that indicates whether the formatting from the previous list can be continued.
ConvertNumbersToText | Changes the list numbers and LISTNUM fields in the specified List object.
CountNumberedItems | Returns the number of bulleted or numbered items and LISTNUM fields in the specified List object.
RemoveNumbers | Removes numbers or bullets from the specified list.


List.ApplyListTemplate Method (Word)

 Copy code hover
[image]

List.ApplyListTemplate Method (Word)
See also Send feedback

Published: July 16, 2012

Applies a set of list-formatting characteristics to the specified ListFormat object.

Syntax

expression .ApplyListTemplate(ListTemplate, ContinuePreviousList, ApplyTo, DefaultListBehavior)

expression Required. A variable that represents a List object.

Parameters

Name | Required/Optional | Data Type | Description
ListTemplate | Required | ListTemplate | The list template to be applied.
ContinuePreviousList | Optional | Variant | True to continue the numbering from the previous list; False to start a new list.
ApplyTo | Optional | Variant | The portion of the list that the list template is to be applied to. Can be one of the following WdListApplyTo constants: wdListSelection, wdListWholeList, or wdListThisPointForward.
DefaultListBehavior | Optional | Variant | Sets a value that specifies whether Microsoft Word uses new Web-oriented formatting for better list display. Can be either of the following WdDefaultListBehavior constants: wdWord8ListBehavior (use formatting compatible with Microsoft Word 97) or wdWord9ListBehavior (use Web-oriented formatting). For compatibility reasons, the default constant is wdWord8ListBehavior, but in new procedures you should use wdWord9ListBehavior to take advantage of improved Web-oriented formatting with respect to indenting and multilevel lists.

Example

This example sets the variable myRange to a range in the active document, and then it checks to see whether the range has list formatting. If no list formatting has been applied, the fourth outline-numbered list template is applied to the range.

VBA Copy code Copy code
Set myDoc = ActiveDocument
Set myRange = myDoc.Range( _
 Start:= myDoc.Paragraphs(3).Range.Start, _
 End:=myDoc.Paragraphs(6).Range.End)
If myRange.ListFormat.ListType = wdListNoNumbering Then
 myRange.ListFormat.ApplyListTemplate _
 ListTemplate:=ListGalleries(wdOutlineNumberGallery) _
 .ListTemplates(4)
End If

See also

Concepts

List Object

Other resources

List Object Members


List.ApplyListTemplateWithLevel Method (Word)

 Copy code hover
[image]

List.ApplyListTemplateWithLevel Method (Word)
See also Send feedback

Published: July 16, 2012

Applies a set of list-formatting characteristics, optionally for a specified level.

Version Information

Version Added: Word 2007

Syntax

expression .ApplyListTemplateWithLevel(ListTemplate, ContinuePreviousList, DefaultListBehavior, ApplyLevel)

expression A variable that represents a List object.

Parameters

Name | Required/Optional | Data Type | Description
ListTemplate | Required | ListTemplate | The list template to be applied.
ContinuePreviousList | Optional | Variant | True to continue the numbering from the previous list; False to start a new list.
DefaultListBehavior | Optional | Variant | Sets a value that specifies whether Microsoft Word uses new Web-oriented formatting for better list display. Can be either of the following WdDefaultListBehavior constants: wdWord8ListBehavior (use formatting compatible with Microsoft Word 97) or wdWord9ListBehavior (use Web-oriented formatting). For compatibility reasons, the default constant is wdWord8ListBehavior, but in new procedures you should use wdWord9ListBehavior to take advantage of improved Web-oriented formatting for indenting and multiple-level lists.
ApplyLevel | Optional | Variant | The level to which the list template is to be applied.

Example

The following example sets the variable myRange to a range in the active document, and then it verifies whether the range has list formatting. If no list formatting has been applied, the fourth outline-numbered list template is applied to the range.

VBA Copy code Copy code
Set myDoc = ActiveDocument
Set myRange = myDoc.Range( _
 Start:= myDoc.Paragraphs(3).Range.Start, _
 End:=myDoc.Paragraphs(6).Range.End)
If myRange.ListFormat.ListType = wdListNoNumbering Then
 myRange.ListFormat.ApplyListTemplate _
 ListTemplate:=ListGalleries(wdOutlineNumberGallery) _
 .ListTemplates(4)
End If

See also

Concepts

List Object

Other resources

List Object Members


List.CanContinuePreviousList Method (Word)

 Copy code hover
[image]

List.CanContinuePreviousList Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a WdContinue constant (wdContinueDisabled, wdResetList, or wdContinueList) that indicates whether the formatting from the previous list can be continued.

Syntax

expression .CanContinuePreviousList(ListTemplate)

expression Required. A variable that represents a List object.

Parameters

Name | Required/Optional | Data Type | Description
ListTemplate | Required | ListTemplate | A list template that's been applied to previous paragraphs in the document.

Remarks

This method returns the state of the Continue previous list and Restart numbering options in the Bullets and Numbering dialog box for a specified list format. To change the settings of these options, set the ContinuePreviousList argument of the ApplyListTemplate method.

Example

This example checks to see whether numbering from a previous list is disabled. If it isn't disabled, the current list template is applied with numbering set to continue from the previous list. The selection must be within the second list, or this example creates an error.

VBA Copy code Copy code
Dim lfTemp As ListFormat
Dim intContinue As Integer

Set lfTemp = Selection.Range.ListFormat

intContinue = lfTemp.CanContinuePreviousList( _
 ListTemplate:=lfTemp.ListTemplate)
If intContinue <> wdContinueDisabled Then
 lfTemp.ApplyListTemplate _
 ListTemplate:=lfTemp.ListTemplate, _
 ContinuePreviousList:=True
End If

See also

Concepts

List Object

Other resources

List Object Members


List.ConvertNumbersToText Method (Word)

 Copy code hover
[image]

List.ConvertNumbersToText Method (Word)
See also Send feedback

Published: July 16, 2012

Changes the list numbers and LISTNUM fields in the specified List object.

Syntax

expression .ConvertNumbersToText

expression A variable that represents a List object.

Example

This example converts the numbers in the first list to text.

VBA Copy code Copy code
ActiveDocument.Lists(1).ConvertNumbersToText

See also

Concepts

List Object

Other resources

List Object Members


List.CountNumberedItems Method (Word)

 Copy code hover
[image]

List.CountNumberedItems Method (Word)
See also Send feedback

Published: July 16, 2012

Returns the number of bulleted or numbered items and LISTNUM fields in the specified List object.

Syntax

expression .CountNumberedItems

expression A variable that represents a List object.

Example

This example formats the current selection as a list, using the second numbered list template. The example then counts the numbered and bulleted items and LISTNUM fields in the active document and displays the result in a message box.

VBA Copy code Copy code
Selection.Range.ListFormat.ApplyListTemplate _
    ListTemplate:=ListGalleries(wdNumberGallery).ListTemplates(2)
Msgbox ActiveDocument.CountNumberedItems

This example counts the number of first-level numbered or bulleted items in the active document.

VBA Copy code Copy code
Msgbox ActiveDocument.Content.ListFormat _
    .CountNumberedItems(Level:=1)

This example counts the number of LISTNUM fields in the variable myRange.

The result is displayed in a message box.

VBA Copy code Copy code
Set myDoc = ActiveDocumentSet myRange = _
    myDoc.Range(Start:=myDoc.Paragraphs(12).Range.Start, _
    End:=myDoc.Paragraphs(50).Range.End)
numfields = myRange.ListFormat.CountNumberedItems(wdNumberListNum)
Msgbox numfields

See also

Concepts

List Object

Other resources

List Object Members


List.RemoveNumbers Method (Word)

 Copy code hover
[image]

List.RemoveNumbers Method (Word)
See also Send feedback

Published: July 16, 2012

Removes numbers or bullets from the specified list.

Syntax

expression .RemoveNumbers(NumberType)

expression A variable that represents a List object.

Parameters

Name | Required/Optional | Data Type | Description
NumberType | Optional | WdNumberType | The type of number to be removed.

See also

Concepts

List Object

Other resources

List Object Members


ListEntries Object (Word)

 Copy code hover
[image]

ListEntries Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of ListEntry objects that represent all the items in a drop-down form field.

Remarks

Use the ListEntries property to return the ListEntries collection. The following example displays the items that appear in the form field named "Drop1."

VBA Copy code Copy code
For Each le In _
 ActiveDocument.FormFields("Drop1").DropDown.ListEntries
 MsgBox le.Name
Next le

Use the Add method to add an item to a drop-down form field. The following example inserts a drop-down form field and then adds "red," "blue," and "green" to the form field.

VBA Copy code Copy code
Set myField = _
 ActiveDocument.FormFields.Add(Range:=Selection.Range, _
 Type:=wdFieldFormDropDown)
With myField.DropDown.ListEntries
 .Add Name:="Red"
 .Add Name:="Blue"
 .Add Name:="Green"
End With

Use ListEntries(Index), where Index is the list entry name or the index number, to return a single ListEntry object. The index number represents the position of the entry in the drop-down form field (the first item is index number 1). The following example deletes the "Blue" entry from the drop-down form field named "Color."

VBA Copy code Copy code
ActiveDocument.FormFields("Color").DropDown _
 .ListEntries("Blue").Delete

The following example displays the first item in the drop-down form field named "Color."

VBA Copy code Copy code
MsgBox _
 ActiveDocument.FormFields("Color").DropDown.ListEntries(1).Name

See also

Concepts

Word Object Model Reference

Other resources

ListEntries Object Members


ListEntries Members (Word)

 Copy code hover
[image]

ListEntries Members (Word)
Send feedback

Published: July 16, 2012

A collection of ListEntry objects that represent all the items in a drop-down form field.

Methods

Name | Description
Add | Returns a ListEntry object that represents an item added to a drop-down form field.
Clear | Removes all items from a drop-down form field.
Item | Returns an individual ListEntry object in a collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of list entries in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified ListEntries object.


ListEntries Properties (Word)

 Copy code hover
[image]

ListEntries Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of list entries in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified ListEntries object.


ListEntries.Application Property (Word)

 Copy code hover
[image]

ListEntries.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a ListEntries collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

ListEntries Collection Object

Other resources

ListEntries Object Members


ListEntries.Count Property (Word)

 Copy code hover
[image]

ListEntries.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of list entries in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents a ListEntries collection.

See also

Concepts

ListEntries Collection Object

Other resources

ListEntries Object Members


ListEntries.Creator Property (Word)

 Copy code hover
[image]

ListEntries.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a ListEntries collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

ListEntries Collection Object

Other resources

ListEntries Object Members


ListEntries.Parent Property (Word)

 Copy code hover
[image]

ListEntries.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified ListEntries object.

Syntax

expression .Parent

expression Required. A variable that represents a ListEntries collection.

See also

Concepts

ListEntries Collection Object

Other resources

ListEntries Object Members


ListEntries Methods (Word)

 Copy code hover
[image]

ListEntries Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Returns a ListEntry object that represents an item added to a drop-down form field.
Clear | Removes all items from a drop-down form field.
Item | Returns an individual ListEntry object in a collection.


ListEntries.Add Method (Word)

 Copy code hover
[image]

ListEntries.Add Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a ListEntry object that represents an item added to a drop-down form field.

Syntax

expression .Add(Name, Index)

expression Required. A variable that represents a ListEntries collection.

Parameters

Name | Required/Optional | Data Type | Description
Name | Required | String | The name of the drop-down form field item.
Index | Optional | Variant | A number that represents the position of the item in the list.

Return Value

ListEntry

Example

This example inserts a drop-down form field in the active document and then adds the items Red, Blue, and Green to the form field.

VBA Copy code Copy code
Set myField = ActiveDocument.FormFields.Add(Range:= _
 Selection.Range, Type:= wdFieldFormDropDown)
With myField.DropDown.ListEntries
 .Add Name:="Red"
 .Add Name:="Blue"
 .Add Name:="Green"
End With

See also

Concepts

ListEntries Collection Object

Other resources

ListEntries Object Members


ListEntries.Clear Method (Word)

 Copy code hover
[image]

ListEntries.Clear Method (Word)
See also Send feedback

Published: July 16, 2012

Removes all items from a drop-down form field.

Syntax

expression .Clear

expression A variable that represents a ListEntries object.

Example

This example removes all items from the form field named "Colors" in Sales.doc.

VBA Copy code Copy code
Documents("Sales.doc").FormFields("Colors") _
 .DropDown.ListEntries.Clear

See also

Concepts

ListEntries Collection Object

Other resources

ListEntries Object Members


ListEntries.Item Method (Word)

 Copy code hover
[image]

ListEntries.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual ListEntry object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents a ListEntries collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The individual object to be returned. Can be a Long indicating the ordinal position or a String representing the name of the individual object.

Return Value

ListEntry

Example

This example clears all the items from the drop-down form field named "Colors" and then adds two color names. The Item method is used to display the first color in the drop-down form field.

VBA Copy code Copy code
Sub ListEntryItem()
 Dim d As DropDown
 Set d = ActiveDocument.FormFields.Add _
 (Range:=Selection.Range, _
 Type:=wdFieldFormDropDown).DropDown
 With d.ListEntries
 .Add Name:="Black"
 .Add Name:="Green"
 End With
 MsgBox d.ListEntries.Item(1).Name
End Sub

See also

Concepts

ListEntries Collection Object

Other resources

ListEntries Object Members


ListEntry Object (Word)

 Copy code hover
[image]

ListEntry Object (Word)
See also Send feedback

Published: July 16, 2012

Represents an item in a drop-down form field. The ListEntry object is a member of the ListEntries collection. The ListEntries collection includes all the items in a drop-down form field.

Remarks

Use ListEntries(Index), where Index is the list entry name or the index number, to return a single ListEntry object. The index number represents the position of the entry in the drop-down form field (the first item is index number 1). The following example deletes the "Blue" entry from the drop-down form field named "Color."

VBA Copy code Copy code
ActiveDocument.FormFields("Color").DropDown _
 .ListEntries("Blue").Delete

The following example displays the first item in the drop-down form field named "Color."

VBA Copy code Copy code
MsgBox _
 ActiveDocument.FormFields("Color").DropDown.ListEntries(1).Name

Use the Add method to add an item to a drop-down form field. The following example inserts a drop-down form field and then adds "red," "blue," and "green" to the form field.

VBA Copy code Copy code
Set myField = _
 ActiveDocument.FormFields.Add(Range:=Selection.Range, _
 Type:=wdFieldFormDropDown)
With myField.DropDown.ListEntries
 .Add Name:="Red"
 .Add Name:="Blue"
 .Add Name:="Green"
End With

See also

Concepts

Word Object Model Reference

Other resources

ListEntry Object Members


ListEntry Members (Word)

 Copy code hover
[image]

ListEntry Members (Word)
Send feedback

Published: July 16, 2012

Represents an item in a drop-down form field. The ListEntry object is a member of the ListEntries collection. The ListEntries collection includes all the items in a drop-down form field.

Methods

Name | Description
Delete | Deletes the specified list entry.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Index | Returns a Long that represents the position of an item in a collection. Read-only.
Name | Returns or sets the name of the specified object. Read/write String.
Parent | Returns an Object that represents the parent object of the specified ListEntry object.


ListEntry Properties (Word)

 Copy code hover
[image]

ListEntry Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Index | Returns a Long that represents the position of an item in a collection. Read-only.
Name | Returns or sets the name of the specified object. Read/write String.
Parent | Returns an Object that represents the parent object of the specified ListEntry object.


ListEntry.Application Property (Word)

 Copy code hover
[image]

ListEntry.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a ListEntry object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

ListEntry Object

Other resources

ListEntry Object Members


ListEntry.Creator Property (Word)

 Copy code hover
[image]

ListEntry.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a ListEntry object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

ListEntry Object

Other resources

ListEntry Object Members


ListEntry.Index Property (Word)

 Copy code hover
[image]

ListEntry.Index Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the position of an item in a collection. Read-only.

Syntax

expression .Index

expression Required. A variable that represents a ListEntry object.

See also

Concepts

ListEntry Object

Other resources

ListEntry Object Members


ListEntry.Name Property (Word)

 Copy code hover
[image]

ListEntry.Name Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the name of the specified object. Read/write String.

Syntax

expression .Name

expression Required. A variable that represents a ListEntry object.

See also

Concepts

ListEntry Object

Other resources

ListEntry Object Members


ListEntry.Parent Property (Word)

 Copy code hover
[image]

ListEntry.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified ListEntry object.

Syntax

expression .Parent

expression Required. A variable that represents a ListEntry object.

See also

Concepts

ListEntry Object

Other resources

ListEntry Object Members


ListEntry Methods (Word)

 Copy code hover
[image]

ListEntry Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the specified list entry.


ListEntry.Delete Method (Word)

 Copy code hover
[image]

ListEntry.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the specified list entry.

Syntax

expression .Delete

expression Required. A variable that represents a ListEntry object.

See also

Concepts

ListEntry Object

Other resources

ListEntry Object Members


ListFormat Object (Word)

 Copy code hover
[image]

ListFormat Object (Word)
See also Send feedback

Published: July 16, 2012

Represents the list formatting attributes that can be applied to the paragraphs in a range.

Remarks

Use the ListFormat property to return the ListFormat object for a range. The following example applies the default bulleted list format to the selection.

VBA Copy code Copy code
Selection.Range.ListFormat.ApplyBulletDefault

An easy way to apply list formatting is to use the ApplyBulletDefault, ApplyNumberDefault, and ApplyOutlineNumberDefault methods, which correspond, respectively, to the first list format (excluding None) on each tab in the Bullets and Numbering dialog box.

To apply a format other than the default format, use the ApplyListTemplate method, which allows you to specify the list format (list template) you want to apply.

Use the List or ListTemplate property to return the list or list template from the first paragraph in the specified range.

Use the ListFormat property with a Range object to access the list formatting properties and methods available for the specified range. The following example applies the default bulleted list format to the second paragraph in the active document.

VBA Copy code Copy code
ActiveDocument.Paragraphs(2).Range.ListFormat.ApplyBulletDefault

However, if there is already a list defined in your document, you can access a List object by using the Lists property. The following example changes the format of the list created in the preceding example to the first number format on the Numbered tab in the Bullets and Numbering dialog box.

VBA Copy code Copy code
ActiveDocument.Lists(1).ApplyListTemplate _
 ListTemplate:=ListGalleries(2).ListTemplates(1)

See also

Concepts

Word Object Model Reference

Other resources

ListFormat Object Members


ListFormat Members (Word)

 Copy code hover
[image]

ListFormat Members (Word)
Send feedback

Published: July 16, 2012

Represents the list formatting attributes that can be applied to the paragraphs in a range.

Methods

Name | Description
ApplyBulletDefault | Adds bullets and formatting to the paragraphs in the range for the specified ListFormat object.
ApplyListTemplate | Applies a set of list-formatting characteristics to the specified ListFormat object.
ApplyListTemplateWithLevel | Applies a set of list-formatting characteristics, optionally for a specified level.
ApplyNumberDefault | Adds the default numbering scheme to the paragraphs in the range for the specified ListFormat object.
ApplyOutlineNumberDefault | Adds the default outline-numbering scheme to the paragraphs in the range for the specified ListFormat object.
CanContinuePreviousList | Returns a WdContinue constant (wdContinueDisabled, wdResetList, or wdContinueList) that indicates whether the formatting from the previous list can be continued.
ConvertNumbersToText | Changes the list numbers and LISTNUM fields in the specified ListFormat object to text.
CountNumberedItems | Returns the number of bulleted or numbered items and LISTNUM fields in the specified ListFormat object.
ListIndent | Increases the list level of the paragraphs in the range for the specified ListFormat object, in increments of one level.
ListOutdent | Decreases the list level of the paragraphs in the range for the specified ListFormat object, in increments of one level.
RemoveNumbers | Removes numbers or bullets from the specified list.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
List | Returns a List object that represents the first formatted list contained in the specified ListFormat object.
ListLevelNumber | Returns or sets the list level for the first paragraph in the specified ListFormat object. Read/write Long.
ListPictureBullet | Returns the InlineShape object that represents the picture used as a bullet in a picture bulleted list.
ListString | Returns a String that represents the appearance of the list value of the first paragraph in the range for the specified ListFormat object. For example, the second paragraph in an alphabetical list would return B. Read-only.
ListTemplate | Returns a ListTemplate object that represents the list formatting for the specified ListFormat object.
ListType | Returns the type of lists that are contained in the range for the specified ListFormat object. Read-only WdListType.
ListValue | Returns the numeric value of the first paragraph in the range for the specified ListFormat object. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified ListFormat object.
SingleList | True if the specified ListFormat object contains only one list. Read-only Boolean.
SingleListTemplate | True if the entire ListFormat object uses the same list template. Read-only Boolean.


ListFormat Properties (Word)

 Copy code hover
[image]

ListFormat Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
List | Returns a List object that represents the first formatted list contained in the specified ListFormat object.
ListLevelNumber | Returns or sets the list level for the first paragraph in the specified ListFormat object. Read/write Long.
ListPictureBullet | Returns the InlineShape object that represents the picture used as a bullet in a picture bulleted list.
ListString | Returns a String that represents the appearance of the list value of the first paragraph in the range for the specified ListFormat object. For example, the second paragraph in an alphabetical list would return B. Read-only.
ListTemplate | Returns a ListTemplate object that represents the list formatting for the specified ListFormat object.
ListType | Returns the type of lists that are contained in the range for the specified ListFormat object. Read-only WdListType.
ListValue | Returns the numeric value of the first paragraph in the range for the specified ListFormat object. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified ListFormat object.
SingleList | True if the specified ListFormat object contains only one list. Read-only Boolean.
SingleListTemplate | True if the entire ListFormat object uses the same list template. Read-only Boolean.


ListFormat.Application Property (Word)

 Copy code hover
[image]

ListFormat.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a ListFormat object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

ListFormat Object

Other resources

ListFormat Object Members


ListFormat.Creator Property (Word)

 Copy code hover
[image]

ListFormat.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a ListFormat object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

ListFormat Object

Other resources

ListFormat Object Members


ListFormat.List Property (Word)

 Copy code hover
[image]

ListFormat.List Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a List object that represents the first formatted list contained in the specified ListFormat object.

Syntax

expression .List

expression An expression that returns a ListFormat object.

Remarks

If the first paragraph in the range for the ListFormat object is not formatted as a list, the List property returns nothing.

Example

This example returns the first list in the selection, and then it applies the first list template (excluding None) on the Numbered tab in the Bullets and Numbering dialog box (Format menu). The selection can only contain one list.

VBA Copy code Copy code
Set mylist = Selection.Range.ListFormat.List
mylist.ApplyListTemplate _
 ListTemplate:=ListGalleries(wdNumberGallery) _
 .ListTemplates(1)

See also

Concepts

ListFormat Object

Other resources

ListFormat Object Members


ListFormat.ListLevelNumber Property (Word)

 Copy code hover
[image]

ListFormat.ListLevelNumber Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the list level for the first paragraph in the specified ListFormat object. Read/write Long.

Syntax

expression .ListLevelNumber

expression Required. A variable that represents a ListFormat object.

Example

This example returns the list level for the third paragraph in the active document.

VBA Copy code Copy code
lev = ActiveDocument.Paragraphs(3).Range.ListFormat.ListLevelNumber

See also

Concepts

ListFormat Object

Other resources

ListFormat Object Members


ListFormat.ListPictureBullet Property (Word)

 Copy code hover
[image]

ListFormat.ListPictureBullet Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the InlineShape object that represents the picture used as a bullet in a picture bulleted list.

Syntax

expression .ListPictureBullet

expression An expression that returns a ListFormat object.

Example

This example sets the height and width of the selected picture bullet. This example assumes that the insertion point in the document is located in a paragraph formatted with a picture bullet.

VBA Copy code Copy code
Sub ListPictBullet()
 With Selection.Range.ListFormat.ListPictureBullet
 .Width = InchesToPoints(Inches:=0.5)
 .Height = InchesToPoints(Inches:=0.05)
 End With
End Sub

See also

Concepts

ListFormat Object

Other resources

ListFormat Object Members


ListFormat.ListString Property (Word)

 Copy code hover
[image]

ListFormat.ListString Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a String that represents the appearance of the list value of the first paragraph in the range for the specified ListFormat object. For example, the second paragraph in an alphabetical list would return B. Read-only.

Syntax

expression .ListString

expression An expression that returns a ListFormat object.

Remarks

For a bulleted list, you will need to apply the correct font to see the string. Most bullets use the Symbol or Wingdings font.

Use the ListValue property to return the numeric value of the paragraph.

Example

This example displays both the numeric value of the first paragraph in the selection and the string representation of the list value.

VBA Copy code Copy code
v = Selection.Range.ListFormat.ListValue
lstring = Selection.Range.ListFormat.ListString
MsgBox "List value " & v _
 & " is represented by the string " & lstring

See also

Concepts

ListFormat Object

Other resources

ListFormat Object Members


ListFormat.ListTemplate Property (Word)

 Copy code hover
[image]

ListFormat.ListTemplate Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a ListTemplate object that represents the list formatting for the specified ListFormat object.

Syntax

expression .ListTemplate

expression Required. A variable that represents a ListFormat object.

Remarks

A list template includes all the formatting that defines a particular list. Each of the seven formats (excluding None) found on each of the tabs in the Bullets and Numbering dialog box corresponds to a list template. Documents and templates can also contain collections of list templates.

If the first paragraph in the range for the ListFormat object is not formatted as a list, the ListTemplate property returns Nothing.

Example

This example checks to see which list template is used for the second paragraph in the active document, and then it applies that list template to the selection.

VBA Copy code Copy code
Set myltemp = ActiveDocument.Paragraphs(2).Range. _
 ListFormat.ListTemplate
Selection.Range.ListFormat.ApplyListTemplate ListTemplate:=myltemp

See also

Concepts

ListFormat Object

Other resources

ListFormat Object Members


ListFormat.ListType Property (Word)

 Copy code hover
[image]

ListFormat.ListType Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the type of lists that are contained in the range for the specified ListFormat object. Read-only WdListType.

Syntax

expression .ListType

expression Required. A variable that represents a ListFormat object.

Remarks

The constant wdListListNumOnly refers to LISTNUM fields, which are fields that can be added within the text of a paragraph.

Example

This example checks to see if the first list in the active document is a simple numbered list. If it is, the fourth list template on the Numbered tab of the Bullets and Numbering dialog box (Format menu) is applied.

VBA Copy code Copy code
Set myList = ActiveDocument.Lists(1)
If myList.Range.ListFormat.ListType = wdListSimpleNumbering Then
 myList.ApplyListTemplate _
 ListTemplate:=ListGalleries(wdNumberGallery) _
 .ListTemplates(4)
End If

See also

Concepts

ListFormat Object

Other resources

ListFormat Object Members


ListFormat.ListValue Property (Word)

 Copy code hover
[image]

ListFormat.ListValue Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the numeric value of the first paragraph in the range for the specified ListFormat object. Read-only Long.

Syntax

expression .ListValue

expression An expression that returns a ListFormat object.

Remarks

Use the ListString property to return a string that represents the list value.

If the ListFormat object applies to a bulleted list, the ListValue property returns 1.

If the ListFormat object applies to an outline-numbered list, the ListValue property returns the numeric value of the first paragraph as it occurs in the sequence of paragraphs at the same level. For example, if the first paragraph for a specified ListFormat object were numbered "A.2," the ListValue property would return 2.

This property will not return the value for a LISTNUM field.

Example

This example displays both the numeric value of the first paragraph in the selection and the string representation of that value.

VBA Copy code Copy code
v = Selection.Range.ListFormat.ListValue
lstring = Selection.Range.ListFormat.ListString
MsgBox "List value " & v _
 & " is represented by the string " & lstring

See also

Concepts

ListFormat Object

Other resources

ListFormat Object Members


ListFormat.Parent Property (Word)

 Copy code hover
[image]

ListFormat.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified ListFormat object.

Syntax

expression .Parent

expression Required. A variable that represents a ListFormat object.

See also

Concepts

ListFormat Object

Other resources

ListFormat Object Members


ListFormat.SingleList Property (Word)

 Copy code hover
[image]

ListFormat.SingleList Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified ListFormat object contains only one list. Read-only Boolean.

Syntax

expression .SingleList

expression An expression that returns a ListFormat object.

Example

This example checks the selection to see whether it only contains one list. If it does, the example applies the default numbered list template to the selection.

VBA Copy code Copy code
temp = Selection.Range.ListFormat.SingleList
If temp = True Then
 Selection.Range.ListFormat.ApplyNumberDefault
End If

See also

Concepts

ListFormat Object

Other resources

ListFormat Object Members


ListFormat.SingleListTemplate Property (Word)

 Copy code hover
[image]

ListFormat.SingleListTemplate Property (Word)
See also Send feedback

Published: July 16, 2012

True if the entire ListFormat object uses the same list template. Read-only Boolean.

Syntax

expression .SingleListTemplate

expression Required. A variable that represents a ListFormat object.

Example

This example checks to see whether the selection is formatted with a single list template. If so, the example applies the second numbered list template to the selection.

VBA Copy code Copy code
Set myList = Selection.Range.ListFormat
temp = myList.SingleListTemplate
If temp = True Then
 myList.ApplyListTemplate _
 ListTemplate:=ListGalleries(wdNumberGallery) _
 .ListTemplates(2)
End If

See also

Concepts

ListFormat Object

Other resources

ListFormat Object Members


ListFormat Methods (Word)

 Copy code hover
[image]

ListFormat Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
ApplyBulletDefault | Adds bullets and formatting to the paragraphs in the range for the specified ListFormat object.
ApplyListTemplate | Applies a set of list-formatting characteristics to the specified ListFormat object.
ApplyListTemplateWithLevel | Applies a set of list-formatting characteristics, optionally for a specified level.
ApplyNumberDefault | Adds the default numbering scheme to the paragraphs in the range for the specified ListFormat object.
ApplyOutlineNumberDefault | Adds the default outline-numbering scheme to the paragraphs in the range for the specified ListFormat object.
CanContinuePreviousList | Returns a WdContinue constant (wdContinueDisabled, wdResetList, or wdContinueList) that indicates whether the formatting from the previous list can be continued.
ConvertNumbersToText | Changes the list numbers and LISTNUM fields in the specified ListFormat object to text.
CountNumberedItems | Returns the number of bulleted or numbered items and LISTNUM fields in the specified ListFormat object.
ListIndent | Increases the list level of the paragraphs in the range for the specified ListFormat object, in increments of one level.
ListOutdent | Decreases the list level of the paragraphs in the range for the specified ListFormat object, in increments of one level.
RemoveNumbers | Removes numbers or bullets from the specified list.


ListFormat.ApplyBulletDefault Method (Word)

 Copy code hover
[image]

ListFormat.ApplyBulletDefault Method (Word)
See also Send feedback

Published: July 16, 2012

Adds bullets and formatting to the paragraphs in the range for the specified ListFormat object.

Syntax

expression .ApplyBulletDefault(DefaultListBehavior)

expression Required. A variable that represents a ListFormat object.

Parameters

Name | Required/Optional | Data Type | Description
DefaultListBehavior | Optional | Variant | Sets a value that specifies whether Microsoft Word uses new Web-oriented formatting for better list display. Can be either of the following constants: wdWord8ListBehavior (use formatting compatible with Microsoft Word 97) or wdWord9ListBehavior (use Web-oriented formatting). For compatibility reasons, the default constant is wdWord8ListBehavior, but in new procedures you should use wdWord9ListBehavior to take advantage of improved Web-oriented formatting with respect to indenting and multilevel lists.

Remarks

If the paragraphs are already formatted with bullets, this method removes the bullets and formatting.

Example

This example adds bullets and formatting to the paragraphs in the selection. If there are already bullets in the selection, the example removes the bullets and formatting.

VBA Copy code Copy code
Selection.Range.ListFormat.ApplyBulletDefault

This example adds a bullet and formatting to, or removes them from, the second paragraph in MyDoc.doc.

VBA Copy code Copy code
Documents("MyDoc.doc").Paragraphs(2).Range.ListFormat _
 .ApplyBulletDefault

This example sets the variable myRange to a range that includes paragraphs three through six of the active document, and then it checks to see whether the range contains list formatting. If there is no list formatting, default bullets are added.

VBA Copy code Copy code
Set myDoc = ActiveDocument
Set myRange = myDoc.Range( _
 Start:= myDoc.Paragraphs(3).Range.Start, _
 End:=myDoc.Paragraphs(6).Range.End)
If myRange.ListFormat.ListType = wdListNoNumbering Then
 myRange.ListFormat.ApplyBulletDefault
End If

See also

Concepts

ListFormat Object

Other resources

ListFormat Object Members


ListFormat.ApplyListTemplate Method (Word)

 Copy code hover
[image]

ListFormat.ApplyListTemplate Method (Word)
See also Send feedback

Published: July 16, 2012

Applies a set of list-formatting characteristics to the specified ListFormat object.

Syntax

expression .ApplyListTemplate(ListTemplate, ContinuePreviousList, ApplyTo, DefaultListBehavior)

expression Required. A variable that represents a ListFormat object.

Parameters

Name | Required/Optional | Data Type | Description
ListTemplate | Required | ListTemplate | The list template to be applied.
ContinuePreviousList | Optional | Variant | True to continue the numbering from the previous list; False to start a new list.
ApplyTo | Optional | Variant | The portion of the list that the list template is to be applied to. Can be one of the following WdListApplyTo constants: wdListSelection, wdListWholeList, or wdListThisPointForward.
DefaultListBehavior | Optional | Variant | Sets a value that specifies whether Microsoft Word uses new Web-oriented formatting for better list display. Can be either of the following WdDefaultListBehavior constants: wdWord8ListBehavior (use formatting compatible with Microsoft Word 97) or wdWord9ListBehavior (use Web-oriented formatting). For compatibility reasons, the default constant is wdWord8ListBehavior, but in new procedures you should use wdWord9ListBehavior to take advantage of improved Web-oriented formatting with respect to indenting and multilevel lists.

Example

This example sets the variable myRange to a range in the active document, and then it checks to see whether the range has list formatting. If no list formatting has been applied, the fourth outline-numbered list template is applied to the range.

VBA Copy code Copy code
Set myDoc = ActiveDocument
Set myRange = myDoc.Range( _
 Start:= myDoc.Paragraphs(3).Range.Start, _
 End:=myDoc.Paragraphs(6).Range.End)
If myRange.ListFormat.ListType = wdListNoNumbering Then
 myRange.ListFormat.ApplyListTemplate _
 ListTemplate:=ListGalleries(wdOutlineNumberGallery) _
 .ListTemplates(4)
End If

See also

Concepts

ListFormat Object

Other resources

ListFormat Object Members


ListFormat.ApplyListTemplateWithLevel Method (Word)

 Copy code hover
[image]

ListFormat.ApplyListTemplateWithLevel Method (Word)
See also Send feedback

Published: July 16, 2012

Applies a set of list-formatting characteristics, optionally for a specified level.

Version Information

Version Added: Word 2007

Syntax

expression .ApplyListTemplateWithLevel(ListTemplate, ContinuePreviousList, ApplyTo, DefaultListBehavior, ApplyLevel)

expression A variable that represents a ListFormat object.

Parameters

Name | Required/Optional | Data Type | Description
ListTemplate | Required | ListTemplate | The list template to be applied.
ContinuePreviousList | Optional | Variant | True to continue the numbering from the previous list; False to start a new list.
ApplyTo | Optional | Variant | One of the WdListApplyTo constants that specifies the portion of the list that the list template will be applied to.
DefaultListBehavior | Optional | Variant | Sets a value that specifies whether Microsoft Word uses new Web-oriented formatting for better list display. Can be either of the following WdDefaultListBehavior constants: wdWord8ListBehavior (use formatting compatible with Microsoft Word 97) or wdWord9ListBehavior (use Web-oriented formatting). For compatibility reasons, the default constant is wdWord8ListBehavior, but in new procedures you should use wdWord9ListBehavior to take advantage of improved Web-oriented formatting for indenting and multiple-level lists.
ApplyLevel | Optional | Variant | The level to which the list template is to be applied.

Example

The following example sets the variable myRange to a range in the active document, and then it verifies whether the range has list formatting. If no list formatting has been applied, the fourth outline-numbered list template is applied to the range.

VBA Copy code Copy code
Set myDoc = ActiveDocument
Set myRange = myDoc.Range( _
 Start:= myDoc.Paragraphs(3).Range.Start, _
 End:=myDoc.Paragraphs(6).Range.End)
If myRange.ListFormat.ListType = wdListNoNumbering Then
 myRange.ListFormat.ApplyListTemplate _
 ListTemplate:=ListGalleries(wdOutlineNumberGallery) _
 .ListTemplates(4)
End If

See also

Concepts

ListFormat Object

Other resources

ListFormat Object Members


ListFormat.ApplyNumberDefault Method (Word)

 Copy code hover
[image]

ListFormat.ApplyNumberDefault Method (Word)
See also Send feedback

Published: July 16, 2012

Adds the default numbering scheme to the paragraphs in the range for the specified ListFormat object.

Syntax

expression .ApplyNumberDefault(DefaultListBehavior)

expression Required. A variable that represents a ListFormat object.

Parameters

Name | Required/Optional | Data Type | Description
DefaultListBehavior | Optional | Variant | Sets a value that specifies whether Microsoft Word uses new Web-oriented formatting for better list display. Can be either of the following constants: wdWord8ListBehavior (use formatting compatible with Microsoft Word 97) or wdWord9ListBehavior (use Web-oriented formatting). For compatibility reasons, the default constant is wdWord8ListBehavior, but in new procedures you should use wdWord9ListBehavior to take advantage of improved Web-oriented formatting with respect to indenting and multilevel lists.

Remarks

If the paragraphs are already formatted as a numbered list, this method removes the numbers and formatting.

Example

This example numbers the paragraphs in the selection. If the selection is already a numbered list, the example removes the numbers and formatting.

VBA Copy code Copy code
Selection.Range.ListFormat.ApplyNumberDefault

This example sets the variable myRange to include paragraphs three through six of the active document, and then it checks to see whether the range contains list formatting. If there is no list formatting, default numbers are applied to the range.

VBA Copy code Copy code
Set myDoc = ActiveDocument
Set myRange = myDoc.Range( _
 Start:= myDoc.Paragraphs(3).Range.Start, _
 End:=myDoc.Paragraphs(6).Range.End)
If myRange.ListFormat.ListType = wdListNoNumbering Then
 myRange.ListFormat.ApplyNumberDefault
End If

See also

Concepts

ListFormat Object

Other resources

ListFormat Object Members


ListFormat.ApplyOutlineNumberDefault Method (Word)

 Copy code hover
[image]

ListFormat.ApplyOutlineNumberDefault Method (Word)
See also Send feedback

Published: July 16, 2012

Adds the default outline-numbering scheme to the paragraphs in the range for the specified ListFormat object.

Syntax

expression .ApplyOutlineNumberDefault(DefaultListBehavior)

expression Required. A variable that represents a ListFormat object.

Parameters

Name | Required/Optional | Data Type | Description
DefaultListBehavior | Optional | Variant | Sets a value that specifies whether Microsoft Word uses new Web-oriented formatting for better list display. Can be either of the following constants: wdWord8ListBehavior (use formatting compatible with Microsoft Word 97) or wdWord9ListBehavior (use Web-oriented formatting). For compatibility reasons, the default constant is wdWord8ListBehavior, but in new procedures you should use wdWord9ListBehavior to take advantage of improved Web-oriented formatting with respect to indenting and multilevel lists.

Remarks

If the paragraphs are already formatted as an outline-numbered list, this method removes the numbers and formatting. This method doesn't remove built-in heading styles that have been applied to paragraphs.

Example

This example adds outline numbering to the paragraphs in the selection. If the selection is already an outline-numbered list, the example removes the numbers and formatting.

VBA Copy code Copy code
Selection.Range.ListFormat.ApplyOutlineNumberDefault

This example sets the variable myRange to include paragraphs three through six of the active document, and then it checks to see whether the range contains list formatting. If there is no list formatting, the default outline-numbered list format is applied.

VBA Copy code Copy code
Set myDoc = ActiveDocument
Set myRange = myDoc.Range( _
 Start:= myDoc.Paragraphs(3).Range.Start, _
 End:=myDoc.Paragraphs(6).Range.End)
If myRange.ListFormat.ListType = wdListNoNumbering Then
 myRange.ListFormat.ApplyOutlineNumberDefault
End If

See also

Concepts

ListFormat Object

Other resources

ListFormat Object Members


ListFormat.CanContinuePreviousList Method (Word)

 Copy code hover
[image]

ListFormat.CanContinuePreviousList Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a WdContinue constant (wdContinueDisabled, wdResetList, or wdContinueList) that indicates whether the formatting from the previous list can be continued.

Syntax

expression .CanContinuePreviousList(ListTemplate)

expression Required. A variable that represents a ListFormat object.

Parameters

Name | Required/Optional | Data Type | Description
ListTemplate | Required | ListTemplate | A list template that's been applied to previous paragraphs in the document.

Remarks

This method returns the state of the Continue previous list and Restart numbering options in the Bullets and Numbering dialog box for a specified list format. To change the settings of these options, set the ContinuePreviousList argument of the ApplyListTemplate method.

Example

This example checks to see whether numbering from a previous list is disabled. If it isn't disabled, the current list template is applied with numbering set to continue from the previous list. The selection must be within the second list, or this example creates an error.

VBA Copy code Copy code
Dim lfTemp As ListFormat
Dim intContinue As Integer

Set lfTemp = Selection.Range.ListFormat

intContinue = lfTemp.CanContinuePreviousList( _
 ListTemplate:=lfTemp.ListTemplate)
If intContinue <> wdContinueDisabled Then
 lfTemp.ApplyListTemplate _
 ListTemplate:=lfTemp.ListTemplate, _
 ContinuePreviousList:=True
End If

See also

Concepts

ListFormat Object

Other resources

ListFormat Object Members


ListFormat.ConvertNumbersToText Method (Word)

 Copy code hover
[image]

ListFormat.ConvertNumbersToText Method (Word)
See also Send feedback

Published: July 16, 2012

Changes the list numbers and LISTNUM fields in the specified ListFormat object to text.

Syntax

expression .ConvertNumbersToText

expression A variable that represents a ListFormat object.

Example

This example converts the preset numbers in myRange to text without affecting any LISTNUM fields.

VBA Copy code Copy code
Set myDoc = ActiveDocumentSet myRange = _
    myDoc.Range(Start:=myDoc.Paragraphs(12).Range.Start, _
    End:=myDoc.Paragraphs(20).Range.End)
myRange.ListFormat.ConvertNumbersToText wdNumberParagraph

See also

Concepts

ListFormat Object

Other resources

ListFormat Object Members


ListFormat.CountNumberedItems Method (Word)

 Copy code hover
[image]

ListFormat.CountNumberedItems Method (Word)
See also Send feedback

Published: July 16, 2012

Returns the number of bulleted or numbered items and LISTNUM fields in the specified ListFormat object.

Syntax

expression .CountNumberedItems

expression A variable that represents a ListFormat object.

Example

This example formats the current selection as a list, using the second numbered list template. The example then counts the numbered and bulleted items and LISTNUM fields in the active document and displays the result in a message box.

VBA Copy code Copy code
Selection.Range.ListFormat.ApplyListTemplate _
    ListTemplate:=ListGalleries(wdNumberGallery).ListTemplates(2)
Msgbox ActiveDocument.CountNumberedItems

This example counts the number of first-level numbered or bulleted items in the active document.

VBA Copy code Copy code
Msgbox ActiveDocument.Content.ListFormat _
    .CountNumberedItems(Level:=1)

This example counts the number of LISTNUM fields in the variable myRange. The result is displayed in a message box.

VBA Copy code Copy code
Set myDoc = ActiveDocumentSet myRange = _
    myDoc.Range(Start:=myDoc.Paragraphs(12).Range.Start, _
    End:=myDoc.Paragraphs(50).Range.End)
numfields = myRange.ListFormat.CountNumberedItems(wdNumberListNum)
Msgbox numfields

See also

Concepts

ListFormat Object

Other resources

ListFormat Object Members


ListFormat.ListIndent Method (Word)

 Copy code hover
[image]

ListFormat.ListIndent Method (Word)
See also Send feedback

Published: July 16, 2012

Increases the list level of the paragraphs in the range for the specified ListFormat object, in increments of one level.

Syntax

expression .ListIndent

expression Required. A variable that represents a ListFormat object.

Example

This example indents each paragraph in the first list in document one by one level.

VBA Copy code Copy code
Documents(1).Lists(1).Range.ListFormat.ListIndent

This example formats paragraphs four through eight in the active document as an outline-numbered list, and then it indents the paragraphs one level.

VBA Copy code Copy code
Dim docActive As Document
Dim rngTemp As Range

Set docActive = ActiveDocument
VBA Copy code Copy code
Set rngTemp = _
 docActive.Range( _
 Start:=docActive.Paragraphs(4).Range.Start, _
 End:=docActive.Paragraphs(8).Range.End)

With rngTemp.ListFormat
 .ApplyOutlineNumberDefault
 .ListIndent
End With

See also

Concepts

ListFormat Object

Other resources

ListFormat Object Members


ListFormat.ListOutdent Method (Word)

 Copy code hover
[image]

ListFormat.ListOutdent Method (Word)
See also Send feedback

Published: July 16, 2012

Decreases the list level of the paragraphs in the range for the specified ListFormat object, in increments of one level.

Syntax

expression .ListOutdent

expression Required. A variable that represents a ListFormat object.

Example

This example reduces the indent of each paragraph in first list in the active document by one level.

VBA Copy code Copy code
ActiveDocument.Lists(1).Range.ListFormat.ListOutdent

This example formats paragraphs four through eight in the active document as an outline-numbered list, indents the paragraphs one level, and then removes the indent from the first paragraph in the list.

VBA Copy code Copy code
Dim docActive As Document
Dim rngTemp As Range

Set docActive = ActiveDocument
VBA Copy code Copy code
Set rngTemp = _
 docActive.Range( _
 Start:=docActive.Paragraphs(4).Range.Start, _
 End:=docActive.Paragraphs(8).Range.End)

With rngTemp.ListFormat
 .ApplyOutlineNumberDefault
 .ListIndent
End With

docActive.Paragraphs(4).Range.ListFormat.ListOutdent

See also

Concepts

ListFormat Object

Other resources

ListFormat Object Members


ListFormat.RemoveNumbers Method (Word)

 Copy code hover
[image]

ListFormat.RemoveNumbers Method (Word)
See also Send feedback

Published: July 16, 2012

Removes numbers or bullets from the specified list.

Syntax

expression .RemoveNumbers(NumberType)

expression A variable that represents a ListFormat object.

Parameters

Name | Required/Optional | Data Type | Description
NumberType | Optional | WdNumberType | The type of number to be removed.

Example

This example removes the bullets or numbers from any numbered paragraphs in the selection.

VBA Copy code Copy code
Selection.Range.ListFormat.RemoveNumbers

This example removes the LISTNUM fields from the selection.

VBA Copy code Copy code
Selection.Range.ListFormat.RemoveNumbers wdNumberListNum

See also

Concepts

ListFormat Object

Other resources

ListFormat Object Members


ListGalleries Object (Word)

 Copy code hover
[image]

ListGalleries Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of ListGallery objects that represent the three tabs in the Bullets and Numbering dialog box.

Remarks

Use the ListGalleries property to return the ListGalleries collection. The following code example enumerates the collection of list galleries and sets each of the seven list templates (formats) back to the list template format built into Word.

VBA Copy code Copy code
For Each lg In ListGalleries
 For x = 1 To 7
 lg.Reset(x)
 Next x
Next lg

Use ListGalleries(Index), where Index is wdBulletGallery, wdNumberGallery, or wdOutlineNumberGallery, to return a single ListGallery object.

The following code example returns the third list format (excluding None) on the Bulleted tab in the Bullets and Numbering dialog box and then applies it to the selection.

VBA Copy code Copy code
Set temp3 = ListGalleries(wdBulletGallery).ListTemplates(3)
Selection.Range.ListFormat.ApplyListTemplate ListTemplate:= temp3

To see whether the specified list template contains the formatting built into Word, use the Modified property with the ListGallery object. To reset formatting to the original list format, use the Reset method for the ListGallery object.

See also

Concepts

Word Object Model Reference

Other resources

ListGalleries Object Members


ListGalleries Members (Word)

 Copy code hover
[image]

ListGalleries Members (Word)
Send feedback

Published: July 16, 2012

A collection of ListGallery objects that represent the three tabs in the Bullets and Numbering dialog box.

Methods

Name | Description
Item | Returns an individual ListGalleries object in a collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application. Read-only.
Count | Returns a Long that represents the number of list galleries in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified ListGalleries object.


ListGalleries Properties (Word)

 Copy code hover
[image]

ListGalleries Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application. Read-only.
Count | Returns a Long that represents the number of list galleries in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified ListGalleries object.


ListGalleries.Application Property (Word)

 Copy code hover
[image]

ListGalleries.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .Application

expression An expression that returns a ListGalleries object.

See also

Concepts

ListGalleries Collection Object

Other resources

ListGalleries Object Members


ListGalleries.Count Property (Word)

 Copy code hover
[image]

ListGalleries.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of list galleries in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents a ListGalleries collection.

See also

Concepts

ListGalleries Collection Object

Other resources

ListGalleries Object Members


ListGalleries.Creator Property (Word)

 Copy code hover
[image]

ListGalleries.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version Information

Version Added: Word 2010

Syntax

expression .Creator

expression An expression that returns a ListGalleries object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD". This property was primarily designed to be used on the Apple Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For more information about this property, see the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

ListGalleries Collection Object

Other resources

ListGalleries Object Members


ListGalleries.Parent Property (Word)

 Copy code hover
[image]

ListGalleries.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified ListGalleries object.

Version Information

Version Added: Word 2010

Syntax

expression .Parent

expression An expression that returns a ListGalleries object.

See also

Concepts

ListGalleries Collection Object

Other resources

ListGalleries Object Members


ListGalleries Methods (Word)

 Copy code hover
[image]

ListGalleries Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Item | Returns an individual ListGalleries object in a collection.


ListGalleries.Item Method (Word)

 Copy code hover
[image]

ListGalleries.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual ListGalleries object in a collection.

Version Information

Version Added: Word 2010

Syntax

expression .Item(Index)

expression An expression that returns a ListGalleries object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | WDLISTGALLERYTYPE | The individual object to be returned.

Return Value

ListGallery

See also

Concepts

ListGalleries Collection Object

Other resources

ListGalleries Object Members


ListGallery Object (Word)

 Copy code hover
[image]

ListGallery Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a single gallery of list formats. The ListGallery object is a member of the ListGalleries collection.

Remarks

Each ListGallery object represents one of the three tabs in the Bullets and Numbering dialog box.

Use ListGalleries(Index), where Index is wdBulletGallery, wdNumberGallery, or wdOutlineNumberGallery, to return a single ListGallery object.

The following example returns the third list format (excluding None) on the Bulleted tab in the Bullets and Numbering dialog box and then applies it to the selection.

VBA Copy code Copy code
Set temp3 = ListGalleries(wdBulletGallery).ListTemplates(3)
Selection.Range.ListFormat.ApplyListTemplate ListTemplate:= temp3

To see whether the specified list template contains the formatting built into Word, use the Modified property for the ListGallery object. To reset formatting to the original list format, use the Reset method for the ListGallery object.

See also

Concepts

Word Object Model Reference

Other resources

ListGallery Object Members


ListGallery Members (Word)

 Copy code hover
[image]

ListGallery Members (Word)
Send feedback

Published: July 16, 2012

Represents a single gallery of list formats. The ListGallery object is a member of the ListGalleries collection.

Methods

Name | Description
Reset | Resets the list template specified by Index for the specified list gallery to the built-in list template format.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
ListTemplates | Returns a ListTemplates collection that represents all the list formats for the specified list gallery. Read-only.
Modified | True if the specified list template is not the built-in list template for that position in the list gallery. Read-only Boolean.
Parent | Returns an Object that represents the parent object of the specified ListGallery object.


ListGallery Properties (Word)

 Copy code hover
[image]

ListGallery Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
ListTemplates | Returns a ListTemplates collection that represents all the list formats for the specified list gallery. Read-only.
Modified | True if the specified list template is not the built-in list template for that position in the list gallery. Read-only Boolean.
Parent | Returns an Object that represents the parent object of the specified ListGallery object.


ListGallery.Application Property (Word)

 Copy code hover
[image]

ListGallery.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a ListGallery object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

ListGallery Object

Other resources

ListGallery Object Members


ListGallery.Creator Property (Word)

 Copy code hover
[image]

ListGallery.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a ListGallery object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

ListGallery Object

Other resources

ListGallery Object Members


ListGallery.ListTemplates Property (Word)

 Copy code hover
[image]

ListGallery.ListTemplates Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a ListTemplates collection that represents all the list formats for the specified list gallery. Read-only.

Syntax

expression .ListTemplates

expression A variable that represents a ListGallery object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example sets the variable mytemp to the first list template on the Outline Numbered tab in the Bullets and Numbering dialog box. The template is modified to use lowercase letters for each level, and it is applied to the second list in the active document.

VBA Copy code Copy code
Set mytemp = ListGalleries(wdOutlineNumberGallery).ListTemplates(1)
For each lev in mytemp.ListLevels
 lev.NumberStyle = wdListNumberStyleLowercaseLetter
Next lev
ActiveDocument.Lists(2).ApplyListTemplate ListTemplate:=mytemp

See also

Concepts

ListGallery Object

Other resources

ListGallery Object Members


ListGallery.Modified Property (Word)

 Copy code hover
[image]

ListGallery.Modified Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified list template is not the built-in list template for that position in the list gallery. Read-only Boolean.

Syntax

expression .Modified(Index)

expression An expression that returns a ListGallery object.

Remarks

Use the Reset method to set a list template in a list gallery back to the built-in list template.

Example

This example checks to see whether the first template on the Bulleted tab in the Bullets and Numbering dialog box has been changed. If it has, the list template is reset.

VBA Copy code Copy code
temp = ListGalleries(wdBulletGallery).Modified(1)
If temp = True Then
 ListGalleries(wdBulletGallery).Reset(1)
Else
 Msgbox "This is the built-in list template."
End If

See also

Concepts

ListGallery Object

Other resources

ListGallery Object Members


ListGallery.Parent Property (Word)

 Copy code hover
[image]

ListGallery.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified ListGallery object.

Syntax

expression .Parent

expression Required. A variable that represents a ListGallery object.

See also

Concepts

ListGallery Object

Other resources

ListGallery Object Members


ListGallery Methods (Word)

 Copy code hover
[image]

ListGallery Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Reset | Resets the list template specified by Index for the specified list gallery to the built-in list template format.


ListGallery.Reset Method (Word)

 Copy code hover
[image]

ListGallery.Reset Method (Word)
See also Send feedback

Published: July 16, 2012

Resets the list template specified by Index for the specified list gallery to the built-in list template format.

Syntax

expression .Reset(Index)

expression Required. A variable that represents a ListGallery object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The template to reset.

Example

This example sets the fourth format listed on the Numbered tab in the Bullets and Numbering dialog box back to the built-in numbering format, and then it applies the list template to the selection.

VBA Copy code Copy code
ListGalleries(wdNumberGallery).Reset(4)
Selection.Range.ListFormat.ApplyListTemplate _
 ListTemplate:=ListGalleries(2).ListTemplates(4)

This example resets all the list templates in the Bullets and Numbering dialog box back to the built-in formats.

VBA Copy code Copy code
For Each lg In ListGalleries
 For i = 1 to 7
 lg.Reset Index:=i
 Next i
Next lg

See also

Concepts

ListGallery Object

Other resources

ListGallery Object Members


ListLevel Object (Word)

 Copy code hover
[image]

ListLevel Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a single list level, either the only level for a bulleted or numbered list or one of the nine levels of an outline numbered list. The ListLevel object is a member of the ListLevels collection.

Remarks

Use ListLevels(Index), where Index is a number from 1 through 9, to return a single ListLevel object. The following example sets list level one of list template one in the active document to start at 4.

VBA Copy code Copy code
ActiveDocument.ListTemplates(1).ListLevels(1).StartAt = 4

The ListLevel object gives you access to all the formatting properties for the specified list level, such as the Alignment, Font, NumberFormat, NumberPosition, NumberStyle, and TrailingCharacter properties.

To apply a list level, first identify the range or list, and then use the ApplyListTemplate method. Each tab at the beginning of the paragraph is translated into a list level. For example, a paragraph that begins with three tabs will become a level-three list paragraph after the ApplyListTemplate method is used.

See also

Concepts

Word Object Model Reference

Other resources

ListLevel Object Members


ListLevel Members (Word)

 Copy code hover
[image]

ListLevel Members (Word)
Send feedback

Published: July 16, 2012

Represents a single list level, either the only level for a bulleted or numbered list or one of the nine levels of an outline numbered list. The ListLevel object is a member of the ListLevels collection.

Methods

Name | Description
ApplyPictureBullet | Formats a paragraph or range of paragraphs with a picture bullet.

Properties

Name | Description
Alignment | Returns or sets a WdListLevelAlignment constant that represents the alignment for the list level of the list template. Read/write.
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Font | Returns or sets a Font object that represents the character formatting of the specified object. Read/write Font.
Index | Returns a Long that represents the position of an item in a collection. Read-only.
LinkedStyle | Returns or sets the name of the style that's linked to the specified ListLevel object. Read/write String.
NumberFormat | Returns or sets the number format for the specified list level. Read/write String.
NumberPosition | Returns or sets the position (in points) of the number or bullet for the specified ListLevel object. Read/write Single.
NumberStyle | Returns or sets the number style for the ListLevel object. Read/write WdListNumberStyle.
Parent | Returns an Object that represents the parent object of the specified ListLevel object.
PictureBullet | Returns an InlineShape object that represents a picture bullet.
ResetOnHigher | Sets or returns the list level that must appear before the specified list level restarts numbering at 1. Read/write Long.
StartAt | Returns or sets the starting number for the specified ListLevel object. Read/write Long.
TabPosition | Returns or sets the tab position for the specified ListLevel object. Read/write Single.
TextPosition | Returns or sets the position (in points) for the second line of wrapping text for the specified ListLevel object. Read/write Single.
TrailingCharacter | Returns or sets the character inserted after the number for the specified list level. Read/write WdTrailingCharacter.


ListLevel Properties (Word)

 Copy code hover
[image]

ListLevel Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Alignment | Returns or sets a WdListLevelAlignment constant that represents the alignment for the list level of the list template. Read/write.
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Font | Returns or sets a Font object that represents the character formatting of the specified object. Read/write Font.
Index | Returns a Long that represents the position of an item in a collection. Read-only.
LinkedStyle | Returns or sets the name of the style that's linked to the specified ListLevel object. Read/write String.
NumberFormat | Returns or sets the number format for the specified list level. Read/write String.
NumberPosition | Returns or sets the position (in points) of the number or bullet for the specified ListLevel object. Read/write Single.
NumberStyle | Returns or sets the number style for the ListLevel object. Read/write WdListNumberStyle.
Parent | Returns an Object that represents the parent object of the specified ListLevel object.
PictureBullet | Returns an InlineShape object that represents a picture bullet.
ResetOnHigher | Sets or returns the list level that must appear before the specified list level restarts numbering at 1. Read/write Long.
StartAt | Returns or sets the starting number for the specified ListLevel object. Read/write Long.
TabPosition | Returns or sets the tab position for the specified ListLevel object. Read/write Single.
TextPosition | Returns or sets the position (in points) for the second line of wrapping text for the specified ListLevel object. Read/write Single.
TrailingCharacter | Returns or sets the character inserted after the number for the specified list level. Read/write WdTrailingCharacter.


ListLevel.Alignment Property (Word)

 Copy code hover
[image]

ListLevel.Alignment Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a WdListLevelAlignment constant that represents the alignment for the list level of the list template. Read/write.

Syntax

expression .Alignment

expression Required. A variable that represents a ListLevel object.

See also

Concepts

ListLevel Object

Other resources

ListLevel Object Members


ListLevel.Application Property (Word)

 Copy code hover
[image]

ListLevel.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a ListLevel object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

ListLevel Object

Other resources

ListLevel Object Members


ListLevel.Creator Property (Word)

 Copy code hover
[image]

ListLevel.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a ListLevel object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

ListLevel Object

Other resources

ListLevel Object Members


ListLevel.Font Property (Word)

 Copy code hover
[image]

ListLevel.Font Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Font object that represents the character formatting of the specified object. Read/write Font.

Syntax

expression .Font

expression A variable that represents a ListLevel object.

Remarks

To set this property, specify an expression that returns a Font object.

See also

Concepts

ListLevel Object

Other resources

ListLevel Object Members


ListLevel.Index Property (Word)

 Copy code hover
[image]

ListLevel.Index Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the position of an item in a collection. Read-only.

Syntax

expression .Index

expression Required. A variable that represents a ListLevel object.

See also

Concepts

ListLevel Object

Other resources

ListLevel Object Members


ListLevel.LinkedStyle Property (Word)

 Copy code hover
[image]

ListLevel.LinkedStyle Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the name of the style that's linked to the specified ListLevel object. Read/write String.

Syntax

expression .LinkedStyle

expression An expression that returns a ListLevel object.

Example

This example sets the variable myListTemp to the first list template (excluding None) on the Outline Numbered tab in the Bullets and Numbering dialog box (Format menu). Each level in the list has a matching heading style linked to it.

VBA Copy code Copy code
Set myListTemp = _
 ListGalleries(wdOutlineNumberGallery).ListTemplates(1)
For Each mylevel In myListTemp.ListLevels
 mylevel.LinkedStyle = "Heading " & mylevel.index
Next mylevel

See also

Concepts

ListLevel Object

Other resources

ListLevel Object Members


ListLevel.NumberFormat Property (Word)

 Copy code hover
[image]

ListLevel.NumberFormat Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the number format for the specified list level. Read/write String.

Syntax

expression .NumberFormat

expression An expression that returns a ListLevel object.

Remarks

The percent sign (%) followed by any number from 1 through 9 represents the number style from the respective list level. For example, if you wanted the format for the first level to be "Article I," "Article II," and so on, the string for the NumberFormat property would be "Article %1" and the NumberStyle property would be set to wdListNumberStyleUpperCaseRoman.

If the NumberStyle property is set to wdListNumberStyleBullet, the string for the NumberFormat property can only contain one character.

Example

This example creates a list template that indents each level and formats the level with an Arabic numeral and a period. The new list template is then applied to the selection.

VBA Copy code Copy code
Set LT = ActiveDocument.ListTemplates.Add(OutlineNumbered:=True)
For x = 1 To 9
 With LT.ListLevels(x)
 .NumberStyle = wdListNumberStyleArabic
 .NumberPosition = InchesToPoints(0.25 * (x - 1))
 .TextPosition = InchesToPoints(0.25 * x)
 .NumberFormat = "%" & x & "."
 End With
Next x
Selection.Range.ListFormat.ApplyListTemplate ListTemplate:=LT

See also

Concepts

ListLevel Object

Other resources

ListLevel Object Members


ListLevel.NumberPosition Property (Word)

 Copy code hover
[image]

ListLevel.NumberPosition Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the position (in points) of the number or bullet for the specified ListLevel object. Read/write Single.

Syntax

expression .NumberPosition

expression An expression that returns a ListLevel object.

Remarks

For each list level, you can set the position of the number or bullet, the position of the tab, and the position of the text that wraps.

Example

This example sets the indentation for all the levels of the third outline-numbered list template. Each list level is indented 0.25 inch (18 points) more than the preceding level.

VBA Copy code Copy code
r = 0
For Each lev In ListGalleries(wdOutlineNumberGallery) _
 .ListTemplates(3).ListLevels
 lev.Alignment = wdListLevelAlignLeft
 lev.NumberPosition = r
 r = r + 18
Next lev

This example sets the indent for the first level of the last numbered list template to 0.5 inch.

VBA Copy code Copy code
With ListGalleries(wdNumberGallery).ListTemplates(7).ListLevels(1)
 .Alignment = wdListLevelAlignLeft
 .NumberPosition = InchesToPoints(0.5)
End With

See also

Concepts

ListLevel Object

Other resources

ListLevel Object Members


ListLevel.NumberStyle Property (Word)

 Copy code hover
[image]

ListLevel.NumberStyle Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the number style for the ListLevel object. Read/write WdListNumberStyle.

Syntax

expression .NumberStyle

expression Required. A variable that represents a ListLevel object.

Remarks

Some of the WdListNumberStyle constants may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.

Example

This example creates an alternating number style for the third outline-numbered list template.

VBA Copy code Copy code
Set myTemp = ListGalleries(wdOutlineNumberGallery).ListTemplates(3)
For i = 1 to 9
 If i Mod 2 = 0 Then
 myTemp.ListLevels(i).NumberStyle = _
 wdListNumberStyleUppercaseRoman
 Else
 myTemp.ListLevels(i).NumberStyle = _
 wdListNumberStyleLowercaseRoman
 End If
Next i

This example changes the number style to uppercase letters for every outline-numbered list in the active document.

VBA Copy code Copy code
For Each lt In ActiveDocument.ListTemplates
 For Each ll In lt.listlevels
 ll.NumberStyle = wdListNumberStyleUppercaseLetter
 Next ll
Next lt

See also

Concepts

ListLevel Object

Other resources

ListLevel Object Members


ListLevel.Parent Property (Word)

 Copy code hover
[image]

ListLevel.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified ListLevel object.

Syntax

expression .Parent

expression Required. A variable that represents a ListLevel object.

See also

Concepts

ListLevel Object

Other resources

ListLevel Object Members


ListLevel.PictureBullet Property (Word)

 Copy code hover
[image]

ListLevel.PictureBullet Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an InlineShape object that represents a picture bullet.

Syntax

expression .PictureBullet

expression An expression that returns a ListLevel object.

Example

This example returns the picture bullet for the first list in the active document and sets the picture bullet's width to 0.25 inch. To see this example, first run the code example for the ApplyPictureBullet method.

VBA Copy code Copy code
Sub PicBullet()
 ActiveDocument.ListTemplates(1) _
 .ListLevels(1) _
 .PictureBullet.Width = InchesToPoints(0.25)
End Sub

See also

Concepts

ListLevel Object

Other resources

ListLevel Object Members


ListLevel.ResetOnHigher Property (Word)

 Copy code hover
[image]

ListLevel.ResetOnHigher Property (Word)
See also Send feedback

Published: July 16, 2012

Sets or returns the list level that must appear before the specified list level restarts numbering at 1. Read/write Long.

Syntax

expression .ResetOnHigher

expression An expression that returns a ListLevel object.

Remarks

The ResetOnHigher property returns False if the numbering continues sequentially each time the list level appears.

This feature allows lists to be interleaved, maintaining numeric sequence. You cannot set the ResetOnHigher property of a list level to a value greater than or equal to its index in the ListLevels collection.

Example

This example sets each of the nine list levels in the first outline-numbered list template to continue its sequential numbering whenever that level is used.

VBA Copy code Copy code
For Each li In _
 ListGalleries(wdOutlineNumberGallery) _
 .ListTemplates(1).ListLevels
 li.ResetOnHigher = False
Next li

See also

Concepts

ListLevel Object

Other resources

ListLevel Object Members


ListLevel.StartAt Property (Word)

 Copy code hover
[image]

ListLevel.StartAt Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the starting number for the specified ListLevel object. Read/write Long.

Syntax

expression .StartAt

expression An expression that returns a ListLevel object.

Example

This example sets the number style and starting number for the third outline-numbered list template. Because the style uses uppercase letters and the starting number is 4, the first letter is D.

VBA Copy code Copy code
Set mylev = ListGalleries(wdOutlineNumberGallery) _
 .ListTemplates(3).ListLevels(1)
With mylev
 .NumberStyle = wdListNumberStyleUppercaseLetter
 .StartAt = 4
End With

See also

Concepts

ListLevel Object

Other resources

ListLevel Object Members


ListLevel.TabPosition Property (Word)

 Copy code hover
[image]

ListLevel.TabPosition Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the tab position for the specified ListLevel object. Read/write Single.

Syntax

expression .TabPosition

expression An expression that returns a ListLevel object.

Remarks

Because the ListLevel object does not have a default tab setting, the TabPosition property always returns a value of 999999 or wdUndefined, unless you set the property to a value.

Example

This example sets each list level number so that it is indented 0.5 inch (36 points) from the previous level, and the tab is set at 0.25 inch (18 points) from the number.

VBA Copy code Copy code
r = 0
For Each lev In ListGalleries(wdOutlineNumberGallery) _
 .ListTemplates(1).ListLevels
 lev.Alignment = wdListLevelAlignLeft
 lev.NumberPosition = r
 lev.TrailingCharacter = wdTrailingTab
 lev.TabPosition = r + 18
 r = r + 36
Next lev

This example sets the variable myltemp to the first numbered list template, and then it sets the tab position at one inch. The list template is then applied to the selection.

VBA Copy code Copy code
Set myltemp = ListGalleries(wdNumberGallery).ListTemplates(1)
myltemp.ListLevels(1).TabPosition = InchesToPoints(1)
Selection.Range.ListFormat.ApplyListTemplate ListTemplate:=myltemp

See also

Concepts

ListLevel Object

Other resources

ListLevel Object Members


ListLevel.TextPosition Property (Word)

 Copy code hover
[image]

ListLevel.TextPosition Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the position (in points) for the second line of wrapping text for the specified ListLevel object. Read/write Single.

Syntax

expression .TextPosition

expression An expression that returns a ListLevel object.

Example

This example sets the indentation for all levels of the first outline-numbered list template. Each list level number is indented 0.5 inch (36 points) from the previous level, the tab is set at 0.25 inch (18 points) from the number, and wrapping text is indented 0.25 inch (18 points) from the number.

VBA Copy code Copy code
r = 0
For Each lev In ListGalleries(wdOutlineNumberGallery) _
 .ListTemplates(1).ListLevels
 lev.Alignment = wdListLevelAlignLeft
 lev.NumberPosition = r
 lev.TrailingCharacter = wdTrailingTab
 lev.TabPosition = r + 18
 lev.TextPosition = r + 18
 r = r + 36
Next lev

See also

Concepts

ListLevel Object

Other resources

ListLevel Object Members


ListLevel.TrailingCharacter Property (Word)

 Copy code hover
[image]

ListLevel.TrailingCharacter Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the character inserted after the number for the specified list level. Read/write WdTrailingCharacter.

Syntax

expression .TrailingCharacter

expression Required. A variable that represents a ListLevel object.

Example

This example sets the number and text alignment for each level of the sixth outline-numbered list template. The number for each level is followed by a space.

VBA Copy code Copy code
r = 0
For Each lev In ListGalleries(wdOutlineNumberGallery) _
 .ListTemplates(6).ListLevels
 lev.Alignment = wdListLevelAlignLeft
 lev.NumberPosition = r
 lev.TextPosition = r
 lev.TrailingCharacter = wdTrailingSpace
 r = r + 18
Next lev

See also

Concepts

ListLevel Object

Other resources

ListLevel Object Members


ListLevel Methods (Word)

 Copy code hover
[image]

ListLevel Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
ApplyPictureBullet | Formats a paragraph or range of paragraphs with a picture bullet.


ListLevel.ApplyPictureBullet Method (Word)

 Copy code hover
[image]

ListLevel.ApplyPictureBullet Method (Word)
See also Send feedback

Published: July 16, 2012

Formats a paragraph or range of paragraphs with a picture bullet.

Syntax

expression .ApplyPictureBullet(FileName)

expression Required. A variable that represents a ListLevel object.

Parameters

Name | Required/Optional | Data Type | Description
FileName | Required | String | The path and file name of the picture file.

Example

This example creates a new document with a list and applies a picture bullet format to all paragraphs except the first and last.

VBA Copy code Copy code
Sub ApplyPictureBulletsToParagraphs()
 Dim docNew As Document
 Dim rngRange As Range
 Dim lstTemplate As ListTemplate
 Dim intPara As Integer
 Dim intCount As Integer

 'Set the initial value of object variables
 Set docNew = Documents.Add

 'Add paragraphs to the new document, including eight list items
 With Selection
 .TypeText Text:="This is an introductory paragraph."
 .TypeParagraph
 End With
 Do Until intPara = 8
 With Selection
 .TypeText Text:="This is a list item."
 .TypeParagraph
 End With
 intPara = intPara + 1
 Loop
 Selection.TypeText Text:="This is a concluding paragraph."

 'Count the total number of paragraphs in the document
 intCount = docNew.Paragraphs.Count

 'Set the range to include all paragraphs in the
 'document except the first and the last
 Set rngRange = docNew.Range( _
 Start:=ActiveDocument.Paragraphs(2).Range.Start, _
 End:=ActiveDocument.Paragraphs(intCount - 1).Range.End)

 'Format the list template as a bullet
 Set lstTemplate = ListGalleries(Index:=wdBulletGallery) _
 .ListTemplates(7)

 'Format list with a picture bullet
 lstTemplate.ListLevels(1).ApplyPictureBullet _
 FileName:="c:\pictures\bluebullet.gif"

 'Apply the list format settings to the range
 rngRange.ListFormat.ApplyListTemplate _
 ListTemplate:=lstTemplate
End Sub

See also

Concepts

ListLevel Object

Other resources

ListLevel Object Members


ListLevels Object (Word)

 Copy code hover
[image]

ListLevels Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of ListLevel objects that represents all the list levels of a list template, either the only level for a bulleted or numbered list or one of the nine levels of an outline numbered list.

Remarks

Use the ListLevels property to return the ListLevels collection. The following example sets the variable mytemp to the first list template in the active document and then modifies each level to use lowercase letters for its number style.

VBA Copy code Copy code
Set mytemp = ActiveDocument.ListTemplates(1)
For Each lev In mytemp.ListLevels
 lev.NumberStyle = wdListNumberStyleLowercaseLetter
Next lev

Use ListLevels(Index), where Index is a number from 1 through 9, to return a single ListLevel object. The following example sets list level one of list template one in the active document to start at four.

VBA Copy code Copy code
ActiveDocument.ListTemplates(1).ListLevels(1).StartAt = 4
Note Note

You cannot add new levels to a list template.

To apply a list level, first identify the range or list, and then use the ApplyListTemplate method. Each tab at the beginning of the paragraph is translated into a list level. For example, a paragraph that begins with three tabs will become a level-three list paragraph after the ApplyListTemplate method is used.

See also

Concepts

Word Object Model Reference

Other resources

ListLevels Object Members


ListLevels Members (Word)

 Copy code hover
[image]

ListLevels Members (Word)
Send feedback

Published: July 16, 2012

A collection of ListLevel objects that represents all the list levels of a list template, either the only level for a bulleted or numbered list or one of the nine levels of an outline numbered list.

Methods

Name | Description
Item | Returns an individual ListLevel object in a collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of list levels in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified ListLevels object.


ListLevels Properties (Word)

 Copy code hover
[image]

ListLevels Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of list levels in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified ListLevels object.


ListLevels.Application Property (Word)

 Copy code hover
[image]

ListLevels.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a ListLevels collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

ListLevels Collection Object

Other resources

ListLevels Object Members


ListLevels.Count Property (Word)

 Copy code hover
[image]

ListLevels.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of list levels in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents a ListLevels collection.

See also

Concepts

ListLevels Collection Object

Other resources

ListLevels Object Members


ListLevels.Creator Property (Word)

 Copy code hover
[image]

ListLevels.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a ListLevels collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

ListLevels Collection Object

Other resources

ListLevels Object Members


ListLevels.Parent Property (Word)

 Copy code hover
[image]

ListLevels.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified ListLevels object.

Syntax

expression .Parent

expression Required. A variable that represents a ListLevels collection.

See also

Concepts

ListLevels Collection Object

Other resources

ListLevels Object Members


ListLevels Methods (Word)

 Copy code hover
[image]

ListLevels Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Item | Returns an individual ListLevel object in a collection.


ListLevels.Item Method (Word)

 Copy code hover
[image]

ListLevels.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual ListLevel object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents a ListLevels collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The individual object to be returned. Can be a Long indicating the ordinal position of the individual object.

Return Value

ListLevel

See also

Concepts

ListLevels Collection Object

Other resources

ListLevels Object Members


ListParagraphs Object (Word)

 Copy code hover
[image]

ListParagraphs Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of Paragraph objects that represents the paragraphs of the specified document, list, or range that have list formatting applied.

Remarks

Use the ListParagraphs property to return the ListParagraphs collection. The following example applies highlighting to the collection of paragraphs with list formatting in the active document.

VBA Copy code Copy code
For Each para in ActiveDocument.ListParagraphs
 para.Range.HighlightColorIndex = wdTurquoise
Next para

Use ListParagraphs(Index), where Index is the index number, to return a single Paragraph object with list formatting.

Paragraphs can have two types of list formatting. The first type includes an automatically added number or bullet at the beginning of each paragraph in the list. The second type includes LISTNUM fields, which can be placed anywhere inside a paragraph. There can be more than one LISTNUM field per paragraph.

To add list formatting to paragraphs, you can use the ApplyListTemplate, ApplyBulletDefault, ApplyNumberDefault, or ApplyOutlineNumberDefault method. You access these methods through the ListFormat object for a specified range.

The Count property for this collection in a document returns the number of items in the main story only. To count items in other stories use the collection with the Range object.

See also

Concepts

Word Object Model Reference

Other resources

ListParagraphs Object Members


ListParagraphs Members (Word)

 Copy code hover
[image]

ListParagraphs Members (Word)
Send feedback

Published: July 16, 2012

A collection of Paragraph objects that represents the paragraphs of the specified document, list, or range that have list formatting applied.

Methods

Name | Description
Item | Returns an individual Paragraph object in a collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of list paragraphs in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified ListParagraphs object.


ListParagraphs Properties (Word)

 Copy code hover
[image]

ListParagraphs Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of list paragraphs in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified ListParagraphs object.


ListParagraphs.Application Property (Word)

 Copy code hover
[image]

ListParagraphs.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a ListParagraphs collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

ListParagraphs Collection Object

Other resources

ListParagraphs Object Members


ListParagraphs.Count Property (Word)

 Copy code hover
[image]

ListParagraphs.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of list paragraphs in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents a ListParagraphs collection.

See also

Concepts

ListParagraphs Collection Object

Other resources

ListParagraphs Object Members


ListParagraphs.Creator Property (Word)

 Copy code hover
[image]

ListParagraphs.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a ListParagraphs collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

ListParagraphs Collection Object

Other resources

ListParagraphs Object Members


ListParagraphs.Parent Property (Word)

 Copy code hover
[image]

ListParagraphs.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified ListParagraphs object.

Syntax

expression .Parent

expression Required. A variable that represents a ListParagraphs collection.

See also

Concepts

ListParagraphs Collection Object

Other resources

ListParagraphs Object Members


ListParagraphs Methods (Word)

 Copy code hover
[image]

ListParagraphs Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Item | Returns an individual Paragraph object in a collection.


ListParagraphs.Item Method (Word)

 Copy code hover
[image]

ListParagraphs.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual Paragraph object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents a ListParagraphs collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The individual object to be returned. Can be a Long indicating the ordinal position of the individual object.

Return Value

Paragraph

See also

Concepts

ListParagraphs Collection Object

Other resources

ListParagraphs Object Members


Lists Object (Word)

 Copy code hover
[image]

Lists Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of List objects that represent all the lists in the specified document.

Remarks

Use the Lists property to return the Lists collection. The following example displays the number of items in each list in the active document.

VBA Copy code Copy code
For Each li In ActiveDocument.Lists
 MsgBox li.CountNumberedItems
Next li

Use Lists(Index), where Index is the index number, to return a single List object. The following example applies the first list format (excluding None) on the Numbered tab in the Bullets and Numbering dialog box to the second list in the active document.

VBA Copy code Copy code
Set temp1 = ListGalleries(wdNumberGallery).ListTemplates(1)
ActiveDocument.Lists(2).ApplyListTemplate ListTemplate:=temp1

When you use a For Each loop to enumerate the Lists collection, the lists in a document are returned in reverse order. The following example counts the items for each list in the active document, from the bottom of the document upward.

VBA Copy code Copy code
For Each li In ActiveDocument.Lists
 MsgBox li.CountNumberedItems
Next li

To add a new list to a document, use the ApplyListTemplate method with the ListFormat object for a specified range.

You can manipulate the individual List objects within a document, but for more precise control you should work with the ListFormat object.

Note Note

Picture-bulleted lists are not included in the Lists collection.

See also

Concepts

Word Object Model Reference

Other resources

Lists Object Members


Lists Members (Word)

 Copy code hover
[image]

Lists Members (Word)
Send feedback

Published: July 16, 2012

A collection of List objects that represent all the lists in the specified document.

Methods

Name | Description
Item | Returns an individual List object in a collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of lists in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified Lists object.


Lists Properties (Word)

 Copy code hover
[image]

Lists Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of lists in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified Lists object.


Lists.Application Property (Word)

 Copy code hover
[image]

Lists.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a Lists collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

Lists Collection Object

Other resources

Lists Object Members


Lists.Count Property (Word)

 Copy code hover
[image]

Lists.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of lists in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents a Lists collection.

See also

Concepts

Lists Collection Object

Other resources

Lists Object Members


Lists.Creator Property (Word)

 Copy code hover
[image]

Lists.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a Lists collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Lists Collection Object

Other resources

Lists Object Members


Lists.Parent Property (Word)

 Copy code hover
[image]

Lists.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Lists object.

Syntax

expression .Parent

expression Required. A variable that represents a Lists collection.

See also

Concepts

Lists Collection Object

Other resources

Lists Object Members


Lists Methods (Word)

 Copy code hover
[image]

Lists Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Item | Returns an individual List object in a collection.


Lists.Item Method (Word)

 Copy code hover
[image]

Lists.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual List object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents a Lists collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The individual object to be returned. Can be a Long indicating the ordinal position of the individual object.

Return Value

List

See also

Concepts

Lists Collection Object

Other resources

Lists Object Members


ListTemplate Object (Word)

 Copy code hover
[image]

ListTemplate Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a single list template that includes all the formatting that defines a list. The ListTemplate object is a member of the ListTemplates collection.

Remarks

Each of the seven formats (excluding None) found on each of the three tabs in the Bullets and Numbering dialog box corresponds to a list template object. These predefined list templates can be accessed from the three ListGallery objects in the ListGalleries collection. Documents and templates can also contain collections of list templates.

Use ListTemplates(Index), where Index is a number from 1 through 7, to return a single list template from a list gallery. The following example returns the third list format (excluding None) on the Numbered tab in the Bullets and Numbering dialog box.

VBA Copy code Copy code
Set temp3 = ListGalleries(2).ListTemplates(3)
Note Note

Some properties and methods — Convert and Add, for example — won't work with list templates that are accessed from a list gallery. You can modify these list templates, but you cannot change their list gallery type (wdBulletGallery, wdNumberGallery, or wdOutlineNumberGallery).

The following example sets an object variable equal to the list template used in the third list in the active document, and then it applies that list template to the selection.

VBA Copy code Copy code
Set myLt = ActiveDocument.ListTemplates(3)
Selection.Range.ListFormat.ApplyListTemplate ListTemplate:=myLt

Use the Add method to add a list template to the collection of list templates in a document or template.

To see whether the specified list template contains the formatting built into Word, use the Modified property with the ListGallery object. To reset formatting to the original list format, use the Reset method for the ListGallery object.

After you have returned a ListTemplate object, use ListLevels(Index), where Index is a number from 1 through 9, to return a single ListLevel object. With a ListLevel object, you have access to all the formatting properties for the specified list level, such as Alignment, Font, NumberFormat, NumberPosition, NumberStyle, and TrailingCharacter.

Use the Convert method to convert a multiple-level list template to a single-level template.

See also

Concepts

Word Object Model Reference

Other resources

ListTemplate Object Members


ListTemplate Members (Word)

 Copy code hover
[image]

ListTemplate Members (Word)
Send feedback

Published: July 16, 2012

Represents a single list template that includes all the formatting that defines a list. The ListTemplate object is a member of the ListTemplates collection.

Methods

Name | Description
Convert | Converts a multiple-level list to a single-level list, or vice versa.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
ListLevels | Returns a ListLevels collection that represents all the levels for the specified ListTemplate.
Name | Returns or sets the name of the specified object. Read/write String.
OutlineNumbered | True if the specified ListTemplate object is outline numbered. Read/write Boolean.
Parent | Returns an Object that represents the parent object of the specified ListTemplate object.


ListTemplate Properties (Word)

 Copy code hover
[image]

ListTemplate Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
ListLevels | Returns a ListLevels collection that represents all the levels for the specified ListTemplate.
Name | Returns or sets the name of the specified object. Read/write String.
OutlineNumbered | True if the specified ListTemplate object is outline numbered. Read/write Boolean.
Parent | Returns an Object that represents the parent object of the specified ListTemplate object.


ListTemplate.Application Property (Word)

 Copy code hover
[image]

ListTemplate.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a ListTemplate object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

ListTemplate Object

Other resources

ListTemplate Object Members


ListTemplate.Creator Property (Word)

 Copy code hover
[image]

ListTemplate.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a ListTemplate object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

ListTemplate Object

Other resources

ListTemplate Object Members


ListTemplate.ListLevels Property (Word)

 Copy code hover
[image]

ListTemplate.ListLevels Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a ListLevels collection that represents all the levels for the specified ListTemplate.

Syntax

expression .ListLevels

expression An expression that returns a ListTemplate object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example sets the variable myListTemp to the first list template (excluding None) on the Outline Numbered tab in the Bullets and Numbering dialog box (Format menu). Each level in the list has a matching heading style linked to it.

VBA Copy code Copy code
Set myListTemp = _
 ListGalleries(wdOutlineNumberGallery).ListTemplates(1)
For Each mylevel In myListTemp.ListLevels
 mylevel.LinkedStyle = "Heading " & mylevel.index
Next mylevel

See also

Concepts

ListTemplate Object

Other resources

ListTemplate Object Members


ListTemplate.Name Property (Word)

 Copy code hover
[image]

ListTemplate.Name Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the name of the specified object. Read/write String.

Syntax

expression .Name

expression Required. A variable that represents a ListTemplate object.

See also

Concepts

ListTemplate Object

Other resources

ListTemplate Object Members


ListTemplate.OutlineNumbered Property (Word)

 Copy code hover
[image]

ListTemplate.OutlineNumbered Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified ListTemplate object is outline numbered. Read/write Boolean.

Syntax

expression .OutlineNumbered

expression An expression that returns a ListTemplate object.

Remarks

Setting this property to False converts the list template to a single-level list that uses the formatting of the first level.

You cannot set this property for a ListTemplate object returned from a ListGallery object.

Example

This example changes the selected outline-numbered list to a single-level numbered list.

VBA Copy code Copy code
Selection.Range.ListFormat.ListTemplate.OutlineNumbered = False

This example checks to see whether the third list in MyDoc.doc is an outline-numbered list. If it is, the third outline-numbered list template is applied to it.

VBA Copy code Copy code
Set myltemp = Documents("MyDoc.doc").Lists(3).Range _
 .ListFormat.ListTemplate
num = myltemp.OutlineNumbered
If num = True Then ActiveDocument.Lists(3).ApplyListTemplate _
 ListTemplate:=ListGalleries(wdOutlineNumberGallery) _
 .ListTemplates(3)

See also

Concepts

ListTemplate Object

Other resources

ListTemplate Object Members


ListTemplate.Parent Property (Word)

 Copy code hover
[image]

ListTemplate.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified ListTemplate object.

Syntax

expression .Parent

expression Required. A variable that represents a ListTemplate object.

See also

Concepts

ListTemplate Object

Other resources

ListTemplate Object Members


ListTemplate Methods (Word)

 Copy code hover
[image]

ListTemplate Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Convert | Converts a multiple-level list to a single-level list, or vice versa.


ListTemplate.Convert Method (Word)

 Copy code hover
[image]

ListTemplate.Convert Method (Word)
See also Send feedback

Published: July 16, 2012

Converts a multiple-level list to a single-level list, or vice versa.

Syntax

expression .Convert(Level)

expression Required. A variable that represents a ListTemplate object.

Parameters

Name | Required/Optional | Data Type | Description
Level | Optional | Variant | The level to use for formatting the new list. When converting a multiple-level list to a single-level list, this argument can be a number from 1 through 9. When converting a single-level list to a multiple-level list, 1 is the only valid value. If this argument is omitted, 1 is the default value.

Remarks

You cannot use the Convert method on a list template that is derived from the ListGalleries collection.

Example

This example converts the first list template in the active document. If the list template is multiple-level, it becomes single-level, or vice versa.

VBA Copy code Copy code
ActiveDocument.ListTemplates(1).Convert

See also

Concepts

ListTemplate Object

Other resources

ListTemplate Object Members


ListTemplates Object (Word)

 Copy code hover
[image]

ListTemplates Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of ListTemplate objects that represent the seven predefined list formats on each tab in the Bullets and Numbering dialog box.

Remarks

Use the ListTemplates property to return the ListTemplates collection. The following example displays a message with the level status (single or multiple-level) for each list template in the active document.

VBA Copy code Copy code
For Each lt In ActiveDocument.ListTemplates
 MsgBox "This is a multiple-level list template - " _
 & lt.OutlineNumbered
Next LT

Use the Add method to add a list template to the collection in the specified document or template. The following example adds a new list template to the active document and applies it to the selection.

VBA Copy code Copy code
Set myLT = ActiveDocument.ListTemplates.Add
Selection.Range.ListFormat.ApplyListTemplate ListTemplate:=myLT

Use ListTemplates(Index), where Index is a number 1 through 7, to return a single list template from a list gallery. The following example sets an object variable equal to the list template used in the third list in the active document, and then it applies that list template to the selection.

VBA Copy code Copy code
Set mylt = ActiveDocument.ListTemplates(3)
Selection.Range.ListFormat.ApplyListTemplate ListTemplate:=mylt
Note Note

Some properties and methods — Convert and Add, for example — won't work with list templates that are accessed from a list gallery. You can modify these list templates, but you cannot change their list gallery type (wdBulletGallery, wdNumberGallery, or wdOutlineNumberGallery).

To see whether the specified list template contains the formatting built into Word, use the Modified property with the ListGallery object. To reset formatting to the original list format, use the Reset method for the ListGallery object.

After you have returned a ListTemplate object, use ListLevels(Index), where Index is a number from 1 through 9, to return a single ListLevel object. With a ListLevel object, you have access to all the formatting properties for the specified list level, such as Alignment, Font, NumberFormat, NumberPosition, NumberStyle, and TrailingCharacter.

Use the Convert method to convert a multiple-level list template to a single-level template.

See also

Concepts

Word Object Model Reference

Other resources

ListTemplates Object Members


ListTemplates Members (Word)

 Copy code hover
[image]

ListTemplates Members (Word)
Send feedback

Published: July 16, 2012

A collection of ListTemplate objects that represent the seven predefined list formats on each tab in the Bullets and Numbering dialog box.

Methods

Name | Description
Add | Returns a ListTemplate object that represents a new list template.
Item | Returns an individual ListTemplate object in a collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of list templates in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified ListTemplates object.


ListTemplates Properties (Word)

 Copy code hover
[image]

ListTemplates Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of list templates in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified ListTemplates object.


ListTemplates.Application Property (Word)

 Copy code hover
[image]

ListTemplates.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a ListTemplates collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

ListTemplates Collection Object

Other resources

ListTemplates Object Members


ListTemplates.Count Property (Word)

 Copy code hover
[image]

ListTemplates.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of list templates in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents a ListTemplates collection.

See also

Concepts

ListTemplates Collection Object

Other resources

ListTemplates Object Members


ListTemplates.Creator Property (Word)

 Copy code hover
[image]

ListTemplates.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a ListTemplates collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

ListTemplates Collection Object

Other resources

ListTemplates Object Members


ListTemplates.Parent Property (Word)

 Copy code hover
[image]

ListTemplates.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified ListTemplates object.

Syntax

expression .Parent

expression Required. A variable that represents a ListTemplates collection.

See also

Concepts

ListTemplates Collection Object

Other resources

ListTemplates Object Members


ListTemplates Methods (Word)

 Copy code hover
[image]

ListTemplates Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Returns a ListTemplate object that represents a new list template.
Item | Returns an individual ListTemplate object in a collection.


ListTemplates.Add Method (Word)

 Copy code hover
[image]

ListTemplates.Add Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a ListTemplate object that represents a new list template.

Syntax

expression .Add(OutlineNumbered, Name)

expression Required. A variable that represents a ListTemplates collection.

Parameters

Name | Required/Optional | Data Type | Description
OutlineNumbered | Optional | Variant | True to apply outline numbering to the new list template.
Name | Optional | Variant | An optional name used for linking the list template to a LISTNUM field. You cannot use this name to index the list template in the collection.

Return Value

ListTemplate

Remarks

You cannot use the Add method on ListTemplates objects returned from a ListGallery object. You can, however, modify the existing list templates in the galleries.

Example

This example adds a new, single-level list template to the active document. The example changes the numbering style for the new list template and then applies the list template to the selection.

VBA Copy code Copy code
Set myList = _
 ActiveDocument.ListTemplates.Add(OutlineNumbered:=False)
myList.ListLevels(1).NumberStyle = wdListNumberStyleUpperCaseLetter
Selection.Range.ListFormat.ApplyListTemplate ListTemplate:=myList

See also

Concepts

ListTemplates Collection Object

Other resources

ListTemplates Object Members


ListTemplates.Item Method (Word)

 Copy code hover
[image]

ListTemplates.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual ListTemplate object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents a ListTemplates collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The individual object to be returned. Can be a Long indicating the ordinal position or a String representing the name of the individual object.

Return Value

ListTemplate

See also

Concepts

ListTemplates Collection Object

Other resources

ListTemplates Object Members


MailingLabel Object (Word)

 Copy code hover
[image]

MailingLabel Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a mailing label.

Remarks

Use the MailingLabel property to return the MailingLabel object. The following example sets default mailing label options.

VBA Copy code Copy code
With Application.MailingLabel
 .DefaultLaserTray = wdPrinterLowerBin
 .DefaultPrintBarCode = True
End With

Use the PrintOut method to print a mailing label listed in the Product Number box in the Label Options dialog box. The following example prints a page of Avery 5162 standard address labels using the specified address.

VBA Copy code Copy code
addr = "Katie Jordan" & vbCr & "123 Skye St." _
 & vbCr & "OurTown, WA 98107"
Application.MailingLabel.PrintOut Name:="5162", Address:=addr

Use the CustomLabels property to format or print a custom mailing label. The following example sets the number of labels across and down for the custom label named "MyLabel."

VBA Copy code Copy code
With Application.MailingLabel.CustomLabels("MyLabel")
 .NumberAcross = 2
 .NumberDown = 5
End With

See also

Concepts

Word Object Model Reference

Other resources

MailingLabel Object Members


MailingLabel Members (Word)

 Copy code hover
[image]

MailingLabel Members (Word)
Send feedback

Published: July 16, 2012

Represents a mailing label.

Methods

Name | Description
CreateNewDocument | Creates a new label document using either the default label options or ones that you specify. Returns a Document object that represents the new document.
CreateNewDocumentByID | Creates a new label document using either the default label options or ones that you specify. Returns a Document object that represents the new document.
LabelOptions | Displays the Label Options dialog box.
PrintOut | Prints a label or a page of labels with the same address.
PrintOutByID | Prints a label or a page of labels with the same address.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
CustomLabels | Returns a CustomLabels collection that represents the available custom mailing labels. Read-only.
DefaultLabelName | Returns or sets the name for the default mailing label. Read/write String.
DefaultLaserTray | Returns or sets the default paper tray that contains sheets of mailing labels. Read/write WdPaperTray.
Parent | Returns an Object that represents the parent object of the specified MailingLabel object.
Vertical | True vertically orients text on Asian mailing labels. Read/write Boolean.


MailingLabel Properties (Word)

 Copy code hover
[image]

MailingLabel Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
CustomLabels | Returns a CustomLabels collection that represents the available custom mailing labels. Read-only.
DefaultLabelName | Returns or sets the name for the default mailing label. Read/write String.
DefaultLaserTray | Returns or sets the default paper tray that contains sheets of mailing labels. Read/write WdPaperTray.
Parent | Returns an Object that represents the parent object of the specified MailingLabel object.
Vertical | True vertically orients text on Asian mailing labels. Read/write Boolean.


MailingLabel.Application Property (Word)

 Copy code hover
[image]

MailingLabel.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a MailingLabel object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

MailingLabel Object

Other resources

MailingLabel Object Members


MailingLabel.Creator Property (Word)

 Copy code hover
[image]

MailingLabel.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a MailingLabel object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

MailingLabel Object

Other resources

MailingLabel Object Members


MailingLabel.CustomLabels Property (Word)

 Copy code hover
[image]

MailingLabel.CustomLabels Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a CustomLabels collection that represents the available custom mailing labels. Read-only.

Syntax

expression .CustomLabels

expression A variable that represents a MailingLabel object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example creates a new custom label named "AdminAddress" and then creates a page of mailing labels using a predefined return address.

VBA Copy code Copy code
Dim strAddress As String
Dim labelNew As CustomLabel

strAddress = "Administration" & vbCr & "Mail Stop 22-16"

Set labelNew = Application.MailingLabel _
 .CustomLabels.Add(Name:="AdminAddress", DotMatrix:= False)

With labelNew
 .Height = InchesToPoints(0.5)
 .Width = InchesToPoints(1)
 .HorizontalPitch = InchesToPoints(2.06)
 .VerticalPitch = InchesToPoints(0.5)
 .NumberAcross = 4
 .NumberDown = 20
 .PageSize = wdCustomLabelLetter
 .SideMargin = InchesToPoints(0.28)
 .TopMargin = InchesToPoints(0.5)
End With

Application.MailingLabel.CreateNewDocument _
 Name:="AdminAddress", Address:=strAddress

See also

Concepts

MailingLabel Object

Other resources

MailingLabel Object Members


MailingLabel.DefaultLabelName Property (Word)

 Copy code hover
[image]

MailingLabel.DefaultLabelName Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the name for the default mailing label. Read/write String.

Syntax

expression .DefaultLabelName

expression A variable that represents a MailingLabel object.

Remarks

To find the string for the specified built-in label, select the label in the Label Options dialog box (Tools menu, Envelopes and Labels dialog box, Labels tab, Options button). Then click Details and view the Label name box, which contains the correct string to use for this property. To set a custom label as the default mailing label, use the label name that appears in the Details dialog box, or use the Name property with a CustomLabel object.

Creating a new label document from a CustomLabel object automatically sets the DefaultLabelName property to the name of the CustomLabel object.

Example

This example returns the name of the current default mailing label.

VBA Copy code Copy code
Msgbox Application.MailingLabel.DefaultLabelName

This example sets the Avery Standard, 5160 Address label as the default mailing label.

VBA Copy code Copy code
Application.MailingLabel.DefaultLabelName = "5160"

See also

Concepts

MailingLabel Object

Other resources

MailingLabel Object Members


MailingLabel.DefaultLaserTray Property (Word)

 Copy code hover
[image]

MailingLabel.DefaultLaserTray Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the default paper tray that contains sheets of mailing labels. Read/write WdPaperTray.

Syntax

expression .DefaultLaserTray

expression Required. A variable that represents a MailingLabel object.

Example

This example checks to determine whether the mailing label printer is set for feed labels manually, and then it displays a message on the status bar.

VBA Copy code Copy code
If Application.MailingLabel.DefaultLaserTray = _
 wdPrinterManualEnvelopeFeed Then
 StatusBar = "Printer set for feeding labels manually"
Else
 StatusBar = "Check printer paper tray setting"
End If

This example sets the mailing-label paper tray to the upper bin.

VBA Copy code Copy code
Application.MailingLabel.DefaultLaserTray = wdPrinterUpperBin

See also

Concepts

MailingLabel Object

Other resources

MailingLabel Object Members


MailingLabel.Parent Property (Word)

 Copy code hover
[image]

MailingLabel.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified MailingLabel object.

Syntax

expression .Parent

expression Required. A variable that represents a MailingLabel object.

See also

Concepts

MailingLabel Object

Other resources

MailingLabel Object Members


MailingLabel.Vertical Property (Word)

 Copy code hover
[image]

MailingLabel.Vertical Property (Word)
See also Send feedback

Published: July 16, 2012

True vertically orients text on Asian mailing labels. Read/write Boolean.

Syntax

expression .Vertical

expression Required. A variable that represents a MailingLabel object.

Example

This example determines if the active document is a mail merge mailing label document and if the language setting is Japanese, and if so, sets the mailing label's orientation to vertical.

VBA Copy code Copy code
Sub VerticalLabel()
 If ActiveDocument.MailMerge.MainDocumentType = wdMailingLabels And
 Application.Language = msoLanguageIDJapanese Then
 Application.MailingLabel.Vertical = True
 End If
End Sub

See also

Concepts

MailingLabel Object

Other resources

MailingLabel Object Members


MailingLabel Methods (Word)

 Copy code hover
[image]

MailingLabel Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
CreateNewDocument | Creates a new label document using either the default label options or ones that you specify. Returns a Document object that represents the new document.
CreateNewDocumentByID | Creates a new label document using either the default label options or ones that you specify. Returns a Document object that represents the new document.
LabelOptions | Displays the Label Options dialog box.
PrintOut | Prints a label or a page of labels with the same address.
PrintOutByID | Prints a label or a page of labels with the same address.


MailingLabel.CreateNewDocument Method (Word)

 Copy code hover
[image]

MailingLabel.CreateNewDocument Method (Word)
See also Send feedback

Published: July 16, 2012

Creates a new label document using either the default label options or ones that you specify. Returns a Document object that represents the new document.

Syntax

expression .CreateNewDocument(Name, Address, AutoText, ExtractAddress, LaserTray, PrintEPostageLabel, Vertical)

expression Required. A variable that represents a MailingLabel object.

Parameters

Name | Required/Optional | Data Type | Description
Name | Optional | Variant | The mailing label name.
Address | Optional | Variant | The text for the mailing label.
AutoText | Optional | Variant | The name of the AutoText entry that includes the mailing label text.
ExtractAddress | Optional | Variant | True to use the address text marked by the user-defined bookmark named "EnvelopeAddress" instead of using the Address argument.
LaserTray | Optional | Variant | The laser printer tray. Can be one of the WdPaperTray constants.
PrintEPostageLabel | Optional | Variant | True to print postage using an Internet e-postage vendor.
Vertical | Optional | Variant | True formats text vertically on the label. Used for Asian-language mailing labels.

Return Value

Document

Example

This example creates a new Avery 2160 minilabel document using a predefined address.

VBA Copy code Copy code
addr = "Dave Edson" & vbCr & "123 Skye St." _
 & vbCr & "Our Town, WA 98004"
Application.MailingLabel.CreateNewDocument _
 Name:="2160 mini", Address:=addr, ExtractAddress:=False

This example creates a new Avery 5664 shipping-label document using the selected text as the address.

VBA Copy code Copy code
addr = Selection.Text
Application.MailingLabel.CreateNewDocument _
 Name:="5664", Address:=addr, _
 LaserTray:=wdPrinterUpperBin

This example creates a new self-adhesive-label document using the EnvelopeAddress bookmark text as the address.

VBA Copy code Copy code
If ActiveDocument.Bookmarks.Exists("EnvelopeAddress") = True Then
 Application.MailingLabel.CreateNewDocument _
 Name:="Self Adhesive Tab 1 1/2""", ExtractAddress:=True
End If

See also

Concepts

MailingLabel Object

Other resources

MailingLabel Object Members


MailingLabel.CreateNewDocumentByID Method (Word)

 Copy code hover
[image]

MailingLabel.CreateNewDocumentByID Method (Word)
See also Send feedback

Published: July 16, 2012

Creates a new label document using either the default label options or ones that you specify. Returns a Document object that represents the new document.

Syntax

expression .CreateNewDocumentByID(LabelID, Address, AutoText, ExtractAddress, LaserTray, PrintEPostageLabel, Vertical)

expression An expression that returns a MailingLabel object.

Parameters

Name | Required/Optional | Data Type | Description
LabelID | Optional | Variant | The mailing label identification.
Address | Optional | Variant | The text for the mailing label.
AutoText | Optional | Variant | The name of the AutoText entry that includes the mailing label text.
ExtractAddress | Optional | Variant | True to use the address text marked by the user-defined bookmark named "EnvelopeAddress" instead of using the Address argument.
LaserTray | Optional | Variant | The laser printer tray. Can be one of the WdPaperTray constants.
PrintEPostageLabel | Optional | Variant | True to print postage using an Internet e-postage vendor.
Vertical | Optional | Variant | True formats text vertically on the label. Used for Asian-language mailing labels.

Return Value

Document

See also

Concepts

MailingLabel Object

Other resources

MailingLabel Object Members


MailingLabel.LabelOptions Method (Word)

 Copy code hover
[image]

MailingLabel.LabelOptions Method (Word)
See also Send feedback

Published: July 16, 2012

Displays the Label Options dialog box.

Syntax

expression .LabelOptions

expression Required. A variable that represents a MailingLabel object.

Remarks

The LabelOptions method works only if the document is the main document of a mailing labels mail merge.

Example

This example determines if the current document is a Mailing Label document and, if it is, displays the Label Options dialog box.

VBA Copy code Copy code
Sub LabelOps()
 If ActiveDocument.MailMerge _
 .MainDocumentType = wdMailingLabels Then
 Application.MailingLabel.LabelOptions
 End If
End Sub

See also

Concepts

MailingLabel Object

Other resources

MailingLabel Object Members


MailingLabel.PrintOut Method (Word)

 Copy code hover
[image]

MailingLabel.PrintOut Method (Word)
See also Send feedback

Published: July 16, 2012

Prints a label or a page of labels with the same address.

Syntax

expression .PrintOut(Name, Address, ExtractAddress, LaserTray, SingleLabel, Row, Column, PrintEPostageLabel, Vertical)

expression Required. A variable that represents a MailingLabel object.

Parameters

Name | Required/Optional | Data Type | Description
Name | Optional | Variant | The mailing label name.
Address | Optional | Variant | The text for the label address.
ExtractAddress | Optional | Variant | True to use the text marked by the "EnvelopeAddress" bookmark (a user-defined bookmark) as the label text. If this argument is specified, Address and AutoText are ignored.
LaserTray | Optional | Variant | The laser printer tray to be used. Can be any WdPaperTray constant.
SingleLabel | Optional | Variant | True to print a single label; False to print an entire page of the same label.
Row | Optional | Variant | The label row for a single label. Not valid if SingleLabel is False.
Column | Optional | Variant | The label column for a single label. Not valid if SingleLabel is False.
PrintEPostageLabel | Optional | Variant | True to print postage using an Internet e-postage vendor.
Vertical | Optional | Variant | True prints text vertically on the label. Used for Asian-language mailing labels.

Example

This example prints a page of Avery 5664 mailing labels, using the specified address.

VBA Copy code Copy code
addr = "Jane Doe" & vbCr & "123 Skye St." _
 & vbCr & "OurTown, WA 98107"
Application.MailingLabel.PrintOut Name:="5664", Address:=addr

See also

Concepts

MailingLabel Object

Other resources

MailingLabel Object Members


MailingLabel.PrintOutByID Method (Word)

 Copy code hover
[image]

MailingLabel.PrintOutByID Method (Word)
See also Send feedback

Published: July 16, 2012

Prints a label or a page of labels with the same address.

Syntax

expression .PrintOutByID(LabelID, Address, ExtractAddress, LaserTray, SingleLabel, Row, Column, PrintEPostageLabel, Vertical)

expression An expression that returns a MailingLabel object.

Parameters

Name | Required/Optional | Data Type | Description
LabelID | Optional | Variant | The mailing label identification.
Address | Optional | Variant | The text for the label address.
ExtractAddress | Optional | Variant | True to use the text marked by the "EnvelopeAddress" bookmark (a user-defined bookmark) as the label text. If this argument is specified, Address and AutoText are ignored.
LaserTray | Optional | Variant | The laser printer tray to be used. Can be any WdPaperTray constant.
SingleLabel | Optional | Variant | True to print a single label; False to print an entire page of the same label.
Row | Optional | Variant | The label row for a single label. Not valid if SingleLabel is False.
Column | Optional | Variant | The label column for a single label. Not valid if SingleLabel is False.
PrintEPostageLabel | Optional | Variant | True to print postage using an Internet e-postage vendor.
Vertical | Optional | Variant | True prints text vertically on the label. Used for Asian-language mailing labels.

See also

Concepts

MailingLabel Object

Other resources

MailingLabel Object Members


MailMerge Object (Word)

 Copy code hover
[image]

MailMerge Object (Word)
See also Send feedback

Published: July 16, 2012

Represents the mail merge functionality in Word.

Remarks

Use the MailMerge property to return the MailMerge object. The MailMerge object is always available regardless of whether the mail merge operation has begun. Use the State property to determine the status of the mail merge operation. The following example executes a mail merge if the active document is a main document with an attached data source.

VBA Copy code Copy code
If ActiveDocument.MailMerge.State = wdMainAndDataSource Then
 ActiveDocument.MailMerge.Execute
End If

The following example merges the main document with the first three records in the attached data source and then sends the results to the printer.

VBA Copy code Copy code
Set myMerge = ActiveDocument.MailMerge
If myMerge.State = wdMainAndSourceAndHeader Or _
 myMerge.State = wdMainAndDataSource Then
 With myMerge.DataSource
 .FirstRecord = 1
 .LastRecord = 3
 End With
End If
With myMerge
 .Destination = wdSendToPrinter
 .Execute
End With

See also

Concepts

Word Object Model Reference

Other resources

MailMerge Object Members


MailMerge Members (Word)

 Copy code hover
[image]

MailMerge Members (Word)
Send feedback

Published: July 16, 2012

Represents the mail merge functionality in Word.

Methods

Name | Description
Check | Simulates the mail merge operation, pausing to report each error as it occurs.
CreateDataSource | Creates a Microsoft Word document that uses a table to store data for a mail merge.
CreateHeaderSource | Creates a Microsoft Word document that stores a header record that is used instead of the data source header record in a mail merge.
EditDataSource | Opens or switches to the mail merge data source.
EditHeaderSource | Opens the header source attached to a mail merge main document, or activates the header source if it is already open.
EditMainDocument | Activates the mail merge main document associated with the specified header source or data source document.
Execute | Performs the specified mail merge operation.
OpenDataSource | Attaches a data source to the specified document, which becomes a main document if it is not one already.
OpenHeaderSource | Attaches a mail merge header source to the specified document.
ShowWizard | Displays the Mail Merge Wizard in a document.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
DataSource | Returns a MailMergeDataSource object that refers to the data source attached to a mail merge main document. Read-only.
Destination | Returns or sets the destination of the mail merge results. Read/write WdMailMergeDestination.
Fields | Returns a read-only MailMergeFields collection that represents all the mail merge fields in the specified document.
HighlightMergeFields | True to highlight the merge fields in a document. Read/write Boolean.
MailAddressFieldName | Returns or sets the name of the field that contains e-mail addresses that are used when the mail merge destination is electronic mail. Read/write String.
MailAsAttachment | True if the merge documents are sent as attachments when the mail merge destination is an e-mail message or a fax. Read/write Boolean.
MailFormat | Returns a WdMailMergeMailFormat constant that represents the format to use when the mail merge destination is an e-mail message. Read/write.
MailSubject | Returns or sets the subject line used when the mail merge destination is electronic mail. Read/write String.
MainDocumentType | Returns or sets the mail merge main document type. Read/write WdMailMergeMainDocType.
Parent | Returns an Object that represents the parent object of the specified MailMerge object.
ShowSendToCustom | Returns or sets a String corresponding to the caption on a custom button on the Complete the merge step (step six) of the Mail Merge Wizard. Read/write.
State | Returns the current state of a mail merge operation. Read-only WdMailMergeState.
SuppressBlankLines | True if blank lines are suppressed when mail merge fields in a mail merge main document are empty. Read/write Boolean.
ViewMailMergeFieldCodes | True if merge field names are displayed in a mail merge main document. False if information from the current record is displayed. Read/write Long.
WizardState | Returns or sets a Long indicating the current Mail Merge Wizard step for a document. The WizardState method returns a number that equates to the current Mail Merge Wizard step; a zero (0) means the Mail Merge Wizard is closed. Read/write.


MailMerge Properties (Word)

 Copy code hover
[image]

MailMerge Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
DataSource | Returns a MailMergeDataSource object that refers to the data source attached to a mail merge main document. Read-only.
Destination | Returns or sets the destination of the mail merge results. Read/write WdMailMergeDestination.
Fields | Returns a read-only MailMergeFields collection that represents all the mail merge fields in the specified document.
HighlightMergeFields | True to highlight the merge fields in a document. Read/write Boolean.
MailAddressFieldName | Returns or sets the name of the field that contains e-mail addresses that are used when the mail merge destination is electronic mail. Read/write String.
MailAsAttachment | True if the merge documents are sent as attachments when the mail merge destination is an e-mail message or a fax. Read/write Boolean.
MailFormat | Returns a WdMailMergeMailFormat constant that represents the format to use when the mail merge destination is an e-mail message. Read/write.
MailSubject | Returns or sets the subject line used when the mail merge destination is electronic mail. Read/write String.
MainDocumentType | Returns or sets the mail merge main document type. Read/write WdMailMergeMainDocType.
Parent | Returns an Object that represents the parent object of the specified MailMerge object.
ShowSendToCustom | Returns or sets a String corresponding to the caption on a custom button on the Complete the merge step (step six) of the Mail Merge Wizard. Read/write.
State | Returns the current state of a mail merge operation. Read-only WdMailMergeState.
SuppressBlankLines | True if blank lines are suppressed when mail merge fields in a mail merge main document are empty. Read/write Boolean.
ViewMailMergeFieldCodes | True if merge field names are displayed in a mail merge main document. False if information from the current record is displayed. Read/write Long.
WizardState | Returns or sets a Long indicating the current Mail Merge Wizard step for a document. The WizardState method returns a number that equates to the current Mail Merge Wizard step; a zero (0) means the Mail Merge Wizard is closed. Read/write.


MailMerge.Application Property (Word)

 Copy code hover
[image]

MailMerge.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a MailMerge object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

MailMerge Object

Other resources

MailMerge Object Members


MailMerge.Creator Property (Word)

 Copy code hover
[image]

MailMerge.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a MailMerge object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

MailMerge Object

Other resources

MailMerge Object Members


MailMerge.DataSource Property (Word)

 Copy code hover
[image]

MailMerge.DataSource Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a MailMergeDataSource object that refers to the data source attached to a mail merge main document. Read-only.

Syntax

expression .DataSource

expression A variable that represents a MailMerge object.

Example

This example displays the name of the data source attached to the active document.

VBA Copy code Copy code
If ActiveDocument.MailMerge.DataSource.Name <> "" Then _
 MsgBox ActiveDocument.MailMerge.DataSource.Name

This example displays the next record from the data source attached to Main.doc.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.View.ShowFieldCodes = False
With Documents("Main.doc").MailMerge
 .ViewMailMergeFieldCodes = False
 .DataSource.ActiveRecord = wdNextRecord
End With

See also

Concepts

MailMerge Object

Other resources

MailMerge Object Members


MailMerge.Destination Property (Word)

 Copy code hover
[image]

MailMerge.Destination Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the destination of the mail merge results. Read/write WdMailMergeDestination.

Syntax

expression .Destination

expression Required. A variable that represents a MailMerge object.

Example

This example sends the results of a mail merge operation to a new document.

VBA Copy code Copy code
Dim mmTemp As MailMerge

Set mmTemp = ActiveDocument.MailMerge

If mmTemp.State = wdMainAndDataSource Then
 mmTemp.Destination = wdSendToNewDocument
 mmTemp.Execute
End If

See also

Concepts

MailMerge Object

Other resources

MailMerge Object Members


MailMerge.Fields Property (Word)

 Copy code hover
[image]

MailMerge.Fields Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a read-only MailMergeFields collection that represents all the mail merge fields in the specified document.

Syntax

expression .Fields

expression Required. A variable that represents a MailMerge object.

See also

Concepts

MailMerge Object

Other resources

MailMerge Object Members


MailMerge.HighlightMergeFields Property (Word)

 Copy code hover
[image]

MailMerge.HighlightMergeFields Property (Word)
See also Send feedback

Published: July 16, 2012

True to highlight the merge fields in a document. Read/write Boolean.

Syntax

expression .HighlightMergeFields

expression A variable that represents a MailMerge object.

Example

This example turns off highlighting merge fields in the active document.

VBA Copy code Copy code
Sub HighlightFields()
 ActiveDocument.MailMerge.HighlightMergeFields = False
End Sub

See also

Concepts

MailMerge Object

Other resources

MailMerge Object Members


MailMerge.MailAddressFieldName Property (Word)

 Copy code hover
[image]

MailMerge.MailAddressFieldName Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the name of the field that contains e-mail addresses that are used when the mail merge destination is electronic mail. Read/write String.

Syntax

expression .MailAddressFieldName

expression An expression that returns a MailMerge object.

Example

This example merges the document named "FormLetter.doc" with its attached data document and sends the results to the e-mail addresses stored in the Email merge field.

VBA Copy code Copy code
With Documents("FormLetter.doc").MailMerge
 .MailAddressFieldName = "Email"
 .MailSubject = "Amazing offer"
 .Destination = wdSendToEmail
 .Execute
End With

See also

Concepts

MailMerge Object

Other resources

MailMerge Object Members


MailMerge.MailAsAttachment Property (Word)

 Copy code hover
[image]

MailMerge.MailAsAttachment Property (Word)
See also Send feedback

Published: July 16, 2012

True if the merge documents are sent as attachments when the mail merge destination is an e-mail message or a fax. Read/write Boolean.

Syntax

expression .MailAsAttachment

expression An expression that returns a MailMerge object.

Example

This example performs a mail merge operation and sends the merge results as attachments to e-mail messages. The e-mail addresses are stored in the MailAddress merge field.

VBA Copy code Copy code
With Documents("Main.doc").MailMerge
 .MailAsAttachment = True
 .Destination = wdSendToEmail
 .MailSubject = "Special offer"
 .MailAddressFieldName = "MailAddress"
 .Execute
End With

See also

Concepts

MailMerge Object

Other resources

MailMerge Object Members


MailMerge.MailFormat Property (Word)

 Copy code hover
[image]

MailMerge.MailFormat Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a WdMailMergeMailFormat constant that represents the format to use when the mail merge destination is an e-mail message. Read/write.

Syntax

expression .MailFormat

expression Required. A variable that represents a MailMerge object.

Remarks

The MailFormat property is ignored if the MailAsAttachment property is set to True. Conversely, when MailFormat is set, MailAsAttachment is automatically set to False.

Example

This example merges the active document to an e-mail message and formats it using HTML.

VBA Copy code Copy code
Sub MergeDestination()
    With ActiveDocument.MailMerge
        .Destination = wdSendToEmail
        .MailAsAttachment = False
        .MailFormat = wdMailFormatHTML
        .Execute
    End With
End Sub

See also

Concepts

MailMerge Object

Other resources

MailMerge Object Members


MailMerge.MailSubject Property (Word)

 Copy code hover
[image]

MailMerge.MailSubject Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the subject line used when the mail merge destination is electronic mail. Read/write String.

Syntax

expression .MailSubject

expression An expression that returns a MailMerge object.

Example

This example merges the document named "Offer.doc" with its attached data document. The results are sent to the e-mail addresses stored in the EmailNames merge field, and the subject of the mail message is "Amazing Offer."

VBA Copy code Copy code
With Documents("Offer.doc").MailMerge
 .MailAddressFieldName = "EmailNames"
 .MailSubject = "Amazing Offer"
 .Destination = wdSendToEmail
 .Execute
End With

See also

Concepts

MailMerge Object

Other resources

MailMerge Object Members


MailMerge.MainDocumentType Property (Word)

 Copy code hover
[image]

MailMerge.MainDocumentType Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the mail merge main document type. Read/write WdMailMergeMainDocType.

Syntax

expression .MainDocumentType

expression Required. A variable that represents a MailMerge object.

Example

This example creates a new document and makes it a catalog main document for a mail merge operation.

VBA Copy code Copy code
Set myDoc = Documents.Add
myDoc.MailMerge.MainDocumentType = wdCatalog

This example determines whether the active document is a main document for a mail merge operation, and then it displays a message in the status bar.

VBA Copy code Copy code
Set doc = ActiveDocument
If doc.MailMerge.MainDocumentType = wdNotAMergeDocument Then
 StatusBar = "Not a mail merge main document"
Else
 StatusBar = "Document is a mail merge main document."
End If

See also

Concepts

MailMerge Object

Other resources

MailMerge Object Members


MailMerge.Parent Property (Word)

 Copy code hover
[image]

MailMerge.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified MailMerge object.

Syntax

expression .Parent

expression Required. A variable that represents a MailMerge object.

See also

Concepts

MailMerge Object

Other resources

MailMerge Object Members


MailMerge.ShowSendToCustom Property (Word)

 Copy code hover
[image]

MailMerge.ShowSendToCustom Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a String corresponding to the caption on a custom button on the Complete the merge step (step six) of the Mail Merge Wizard. Read/write.

Syntax

expression .ShowSendToCustom

expression A variable that represents a MailMerge object.

Remarks

When a user clicks the custom button, the MailMergeWizardSendToCustom event executes.

Example

This example displays a custom button on the sixth step of the Mail Merge Wizard only for mailing labels.

VBA Copy code Copy code
Sub ShowCustomButton()
 With ActiveDocument.MailMerge
 If .MainDocumentType = wdMailingLabels Then
 .ShowSendToCustom = "Custom Label Processing"
 End If
 End With
End Sub

See also

Concepts

MailMerge Object

Other resources

MailMerge Object Members


MailMerge.State Property (Word)

 Copy code hover
[image]

MailMerge.State Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the current state of a mail merge operation. Read-only WdMailMergeState.

Syntax

expression .State

expression Required. A variable that represents a MailMerge object.

Example

This example executes a mail merge if the active document is a main document with an attached data source.

VBA Copy code Copy code
Set myMerge = ActiveDocument.MailMerge
If myMerge.State = wdMainAndDataSource Then myMerge.Execute

See also

Concepts

MailMerge Object

Other resources

MailMerge Object Members


MailMerge.SuppressBlankLines Property (Word)

 Copy code hover
[image]

MailMerge.SuppressBlankLines Property (Word)
See also Send feedback

Published: July 16, 2012

True if blank lines are suppressed when mail merge fields in a mail merge main document are empty. Read/write Boolean.

Syntax

expression .SuppressBlankLines

expression An expression that returns a MailMerge object.

Example

This example opens Main.doc and executes the mail merge operation. When merge fields are empty, blank lines are suppressed in the merge document.

VBA Copy code Copy code
Set myDoc = Documents.Open(FileName:="C:\My Documents\Main.doc")
With myDoc.MailMerge
 .SuppressBlankLines = True
 .Destination = wdSendToPrinter
 .Execute
End With

See also

Concepts

MailMerge Object

Other resources

MailMerge Object Members


MailMerge.ViewMailMergeFieldCodes Property (Word)

 Copy code hover
[image]

MailMerge.ViewMailMergeFieldCodes Property (Word)
See also Send feedback

Published: July 16, 2012

True if merge field names are displayed in a mail merge main document. False if information from the current record is displayed. Read/write Long.

Syntax

expression .ViewMailMergeFieldCodes

expression An expression that returns a MailMerge object.

Remarks

If the active document isn't a mail merge main document, this property causes an error. To view merge field names or their results, set the ShowFieldCodes property to False.

Example

This example displays the mail merge fields in Main.doc.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.View.ShowFieldCodes = False
With Documents("Main.doc")
 .Activate
 .MailMerge.ViewMailMergeFieldCodes = True
End With

If the active document is set up for a mail merge operation, this example displays the current record information in the main document.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.View.ShowFieldCodes = False
Set myMerge = ActiveDocument.MailMerge
If myMerge.State = wdMainAndSourceAndHeader Or _
 myMerge.State = wdMainAndDataSource Then
 myMerge.ViewMailMergeFieldCodes = False
End If

See also

Concepts

MailMerge Object

Other resources

MailMerge Object Members


MailMerge.WizardState Property (Word)

 Copy code hover
[image]

MailMerge.WizardState Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Long indicating the current Mail Merge Wizard step for a document. The WizardState method returns a number that equates to the current Mail Merge Wizard step; a zero (0) means the Mail Merge Wizard is closed. Read/write.

Syntax

expression .WizardState

expression A variable that represents a MailMerge object.

Example

This example checks if the Mail Merge Wizard is already displayed in the active document and if it is, moves to the Mail Merge Wizard's sixth step and removes the fifth step from the Wizard.

VBA Copy code Copy code
Sub ShowMergeWizard()
 With ActiveDocument.MailMerge
 If .WizardState > 0 Then
 .ShowWizard InitialState:=6, ShowPreviewStep:=False
 End If
 End With
End Sub

See also

Concepts

MailMerge Object

Other resources

MailMerge Object Members


MailMerge Methods (Word)

 Copy code hover
[image]

MailMerge Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Check | Simulates the mail merge operation, pausing to report each error as it occurs.
CreateDataSource | Creates a Microsoft Word document that uses a table to store data for a mail merge.
CreateHeaderSource | Creates a Microsoft Word document that stores a header record that is used instead of the data source header record in a mail merge.
EditDataSource | Opens or switches to the mail merge data source.
EditHeaderSource | Opens the header source attached to a mail merge main document, or activates the header source if it is already open.
EditMainDocument | Activates the mail merge main document associated with the specified header source or data source document.
Execute | Performs the specified mail merge operation.
OpenDataSource | Attaches a data source to the specified document, which becomes a main document if it is not one already.
OpenHeaderSource | Attaches a mail merge header source to the specified document.
ShowWizard | Displays the Mail Merge Wizard in a document.


MailMerge.Check Method (Word)

 Copy code hover
[image]

MailMerge.Check Method (Word)
See also Send feedback

Published: July 16, 2012

Simulates the mail merge operation, pausing to report each error as it occurs.

Syntax

expression .Check

expression Required. A variable that represents a MailMerge object.

Example

This example checks the active document for mail merge errors.

VBA Copy code Copy code
Dim intState As Integer

intState = ActiveDocument.MailMerge.State
If intState = wdMainAndDataSource Or _
 intState = wdMainAndSourceAndHeader Then
 ActiveDocument.MailMerge.Check
End If

See also

Concepts

MailMerge Object

Other resources

MailMerge Object Members


MailMerge.CreateDataSource Method (Word)

 Copy code hover
[image]

MailMerge.CreateDataSource Method (Word)
See also Send feedback

Published: July 16, 2012

Creates a Microsoft Word document that uses a table to store data for a mail merge.

Syntax

expression .CreateDataSource(Name, PasswordDocument, WritePasswordDocument, HeaderRecord, MSQuery, SQLStatement, SQLStatement1, Connection, LinkToSource)

expression Required. A variable that represents a MailMerge object.

Parameters

Name | Required/Optional | Data Type | Description
Name | Optional | Variant | The path and file name for the new data source.
PasswordDocument | Optional | Variant | The password required to open the new data source.
WritePasswordDocument | Optional | Variant | The password required to save changes to the data source.
HeaderRecord | Optional | Variant | Field names for the header record. If this argument is omitted, the standard header record is used: "Title, FirstName, LastName, JobTitle, Company, Address1, Address2, City, State, PostalCode, Country, HomePhone, WorkPhone." To separate field names, use the list separator specified in Regional Settings in Control Panel.
MSQuery | Optional | Variant | True to launch Microsoft Query, if it is installed. The Name, PasswordDocument, and HeaderRecord arguments are ignored.
SQLStatement | Optional | Variant | Defines query options for retrieving data.
SQLStatement1 | Optional | Variant | If the query string is longer than 255 characters, SQLStatement specifies the first portion of the string, and SQLStatement1 specifies the second portion.
Connection | Optional | Variant | A range within which the query specified by SQLStatement will be performed.
LinkToSource | Optional | Variant | True to perform the query specified by Connection and SQLStatement each time the main document is opened.

Security

Avoid using hard-coded passwords in your applications. If a password is required in a procedure, request the password from the user, store it in a variable, and then use the variable in your code. For recommended best practices on how to do this, see Security Notes for Microsoft Office Solution Developers.

Remarks

When you use the CreateDataSource method, Word attaches the new data source to the specified document, which becomes a main document, if it is not one already.

How you specify the range for the Connection argument depends on how data is retrieved. For example:

  • When retrieving data through ODBC, you specify a connection string.

  • When retrieving data from Microsoft Office Excel using dynamic data exchange (DDE), you specify a named range.

    Security note Security Note
    Dynamic data exchange (DDE) is an older technology that is not secure. If possible, use a more secure alternative to DDE, such as object linking and embedding (OLE).

  • When retrieving data from Microsoft Office Access, you specify the word "Table" or "Query" followed by the name of a table or query.

Example

This example creates a new data source document named "Data.doc" and attaches the data source to the active document. The new data source includes a five-column table that has the field names specified by the HeaderRecord argument.

VBA Copy code Copy code
ActiveDocument.MailMerge.CreateDataSource _
 Name:="C:\Documents\Data.doc", _
 HeaderRecord:="Name, Address, City, State, Zip"

See also

Concepts

MailMerge Object

Other resources

MailMerge Object Members


MailMerge.CreateHeaderSource Method (Word)

 Copy code hover
[image]

MailMerge.CreateHeaderSource Method (Word)
See also Send feedback

Published: July 16, 2012

Creates a Microsoft Word document that stores a header record that is used instead of the data source header record in a mail merge.

Syntax

expression .CreateHeaderSource(Name, PasswordDocument, WritePasswordDocument, HeaderRecord)

expression Required. A variable that represents a MailMerge object.

Parameters

Name | Required/Optional | Data Type | Description
Name | Required | String | The path and file name for the new header source.
PasswordDocument | Optional | Variant | The password required to open the new header source.
WritePasswordDocument | Optional | Variant | The password required to save changes to the new header source.
HeaderRecord | Optional | Variant | A string that specifies the field names for the header record. If this argument is omitted, the standard header record is used: "Title, FirstName, LastName, JobTitle, Company, Address1, Address2, City, State, PostalCode, Country, HomePhone, WorkPhone." To separate field names in Microsoft Windows, use the list separator specified in Regional Settings in Control Panel.

Security

Avoid using hard-coded passwords in your applications. If a password is required in a procedure, request the password from the user, store it in a variable, and then use the variable in your code. For recommended best practices on how to do this, see Security Notes for Microsoft Office Solution Developers.

Remarks

This method attaches the new header source to the specified document, which becomes a main document if it is not one already.The new header source uses a table to arrange mail merge field names.

Example

This example creates a header source with five field names and attaches the new header source named "Header.doc" to the active document.

VBA Copy code Copy code
ActiveDocument.MailMerge.CreateHeaderSource Name:="Header.doc", _
 HeaderRecord:="Name, Address, City, State, Zip"

This example creates a header source for the document named "Main.doc" (with the standard header record) and opens the data source named "Data.doc."

VBA Copy code Copy code
With Documents("Main.doc").MailMerge
 .CreateHeaderSource Name:="Fields.doc"
 .OpenDataSource Name:="C:\Documents\Data.doc"
End With

See also

Concepts

MailMerge Object

Other resources

MailMerge Object Members


MailMerge.EditDataSource Method (Word)

 Copy code hover
[image]

MailMerge.EditDataSource Method (Word)
See also Send feedback

Published: July 16, 2012

Opens or switches to the mail merge data source.

Syntax

expression .EditDataSource

expression Required. A variable that represents a MailMerge object.

Remarks

If the data source is a Microsoft Word document, this method opens the data source (or activates the data source if it is already open).

If Word is accessing the data through dynamic data exchange (DDE)—using an application such as Microsoft Office Excel or Microsoft Office Access—this method displays the data source in that application.

Security note Security Note
Dynamic data exchange (DDE) is an older technology that is not secure. If possible, use a more secure alternative to DDE, such as object linking and embedding (OLE).

If Word is accessing the data through open database connectivity (ODBC), this method displays the data in a Word document. Note that, if Microsoft Query is installed, a message appears providing the option to display Microsoft Query instead of converting data.

Example

This example opens or activates the data source attached to the document named "Sales.doc."

VBA Copy code Copy code
Documents("Sales.doc").MailMerge.EditDataSource

This example opens or activates the attached data source if the data source is a Word document.

VBA Copy code Copy code
Dim dsMain As MailMergeDataSource

Set dsMain = ActiveDocument.MailMerge.DataSource
If dsMain.Type = wdMergeInfoFromWord Then
 ActiveDocument.MailMerge.EditDataSource
End If

See also

Concepts

MailMerge Object

Other resources

MailMerge Object Members


MailMerge.EditHeaderSource Method (Word)

 Copy code hover
[image]

MailMerge.EditHeaderSource Method (Word)
See also Send feedback

Published: July 16, 2012

Opens the header source attached to a mail merge main document, or activates the header source if it is already open.

Syntax

expression .EditHeaderSource

expression Required. A variable that represents a MailMerge object.

Remarks

If the mail merge main document doesn't have a header source, this method causes an error.

Example

This example attaches a header source to the active document and then opens the header source.

VBA Copy code Copy code
With ActiveDocument.MailMerge
 .MainDocumentType = wdFormLetters
 .OpenHeaderSource Name:="C:\Documents\Header.doc"
 .EditHeaderSource
End With

This example opens the header source if the active document has an associated header file attached to it.

VBA Copy code Copy code
Dim mmTemp As MailMerge

Set mmTemp = ActiveDocument.MailMerge
If mmTemp.State = wdMainAndSourceAndHeader Or _
 mmTemp.State = wdMainAndHeader Then
 mmTemp.EditHeaderSource
End If

See also

Concepts

MailMerge Object

Other resources

MailMerge Object Members


MailMerge.EditMainDocument Method (Word)

 Copy code hover
[image]

MailMerge.EditMainDocument Method (Word)
See also Send feedback

Published: July 16, 2012

Activates the mail merge main document associated with the specified header source or data source document.

Syntax

expression .EditMainDocument

expression Required. A variable that represents a MailMerge object.

Remarks

If the main document isn't open, an error occurs. Use the Open method if the main document isn't currently open.

Example

This example attempts to activate the main document associated with the active data source document. If the main document isn't open, the Open dialog box is displayed, with a message in the status bar.

VBA Copy code Copy code
Sub ActivateMain()
 On Error GoTo errorhandler
 Documents("Data.doc").MailMerge.EditMainDocument

 Exit Sub

errorhandler:
 If Err = 4605 Then StatusBar = "Main document is not open"
 Dialogs(wdDialogFileOpen).Show
End Sub

See also

Concepts

MailMerge Object

Other resources

MailMerge Object Members


MailMerge.Execute Method (Word)

 Copy code hover
[image]

MailMerge.Execute Method (Word)
See also Send feedback

Published: July 16, 2012

Performs the specified mail merge operation.

Syntax

expression .Execute(Pause)

expression Required. A variable that represents a MailMerge object.

Parameters

Name | Required/Optional | Data Type | Description
Pause | Optional | Variant | True for Microsoft Word pause and display a troubleshooting dialog box if a mail merge error is found. False to report errors in a new document.

Example

This example executes a mail merge if the active document is a main document with an attached data source.

VBA Copy code Copy code
Set myMerge = ActiveDocument.MailMerge
If myMerge.State = wdMainAndDataSource Then MyMerge.Execute

See also

Concepts

MailMerge Object

Other resources

MailMerge Object Members


MailMerge.OpenDataSource Method (Word)

 Copy code hover
[image]

MailMerge.OpenDataSource Method (Word)
See also Send feedback

Published: July 16, 2012

Attaches a data source to the specified document, which becomes a main document if it is not one already.

Syntax

expression .OpenDataSource(Name, Format, ConfirmConversions, ReadOnly, LinkToSource, AddToRecentFiles, PasswordDocument, PasswordTemplate, Revert, WritePasswordDocument, WritePasswordTemplate, Connection, SQLStatement, SQLStatement1, OpenExclusive, SubType)

expression Required. A variable that represents a MailMerge object.

Parameters

Name | Required/Optional | Data Type | Description
Name | Required | String | The data source file name. You can specify a Microsoft Query (.qry) file instead of specifying a data source, a connection string, and a query string.
Format | Optional | Variant | The file converter used to open the document. Can be one of the WdOpenFormat constants. To specify an external file format, use the OpenFormat property with the FileConverter object to determine the value to use with this argument.
ConfirmConversions | Optional | Variant | True to display the Convert File dialog box if the file is not in Microsoft Word format.
ReadOnly | Optional | Variant | True to open the data source on a read-only basis.
LinkToSource | Optional | Variant | True to perform the query specified by Connection and SQLStatement each time the main document is opened.
AddToRecentFiles | Optional | Variant | True to add the file name to the list of recently used files at the bottom of the File menu.
PasswordDocument | Optional | Variant | The password used to open the data source. (See Remarks below.)
PasswordTemplate | Optional | Variant | The password used to open the template. (See Remarks below.)
Revert | Optional | Variant | Controls what happens if Name is the file name of an open document. True to discard any unsaved changes to the open document and reopen the file; False to activate the open document.
WritePasswordDocument | Optional | Variant | The password used to save changes to the document. (See Remarks below.)
WritePasswordTemplate | Optional | Variant | The password used to save changes to the template. (See Remarks below.)
Connection | Optional | Variant | A range within which the query specified by SQLStatement is to be performed. (See Remarks below.)
SQLStatement | Optional | Variant | Defines query options for retrieving data. (See Remarks below.)
SQLStatement1 | Optional | Variant | If the query string is longer than 255 characters, SQLStatement specifies the first portion of the string, and SQLStatement1 specifies the second portion. (See Remarks below.)
OpenExclusive | Optional | Variant | True to open exclusively.
SubType | Optional | Variant | Can be one of the WdMergeSubType constants.

Remarks

To determine the ODBC connection and query strings, set query options manually and use the QueryString property to return the connection string. The following table includes some commonly used SQL keywords.

Keyword | Description
DSN | The name of the ODBC data source
UID | The user logon ID
PWD | The user-specified password
DBQ | The database file name
FIL | The file type

To instruct Word to use the same connection method as in earlier versions of Word (Dynamic Data Exchange (DDE) for Microsoft Office Access and Microsoft Office Excel data sources) use SubType:=wdMergeSubTypeWord2000.

How you specify the range depends on how data is retrieved. For example:

  • When retrieving data through Open Database Connectivity (ODBC), you specify a connection string.

  • When retrieving data from Excel using dynamic data exchange (DDE), you specify a named range.

    Security note Security Note
    Dynamic data exchange (DDE) is an older technology that is not secure. If possible, use a more secure alternative to DDE, such as object linking and embedding (OLE).

  • When retrieving data from Access, you specify the word "Table" or "Query" followed by the name of a table or query.

Security note Security Note
Avoid using the built-in system administrator ( sa ) logon account. Instead, make system administrators members of the sysadmin fixed server role, and have them use their own accounts to log on. Use sa only when there is no other way to log on. To prevent unauthorized access through the sa logon account, you should assign that account a strong, unique password.

Security note Security Note
When possible, use Windows Authentication (also referred to as a trusted connection), which uses a Windows user account to connect to SQL Server. When a user connects through a Windows user account, SQL Server uses information in the Windows operating system to validate the account name and password. Before you can use Windows Authentication, a server administrator must configure SQL Server to use this mode of authentication. If Windows Authentication is not available, avoid saving users' logon information. It is more secure for users to enter their logon information each time they log on.

Avoid using hard-coded passwords in your applications. If a password is required in a procedure, request the password from the user, store it in a variable, and then use the variable in your code. For recommended best practices on how to do this, see Security Notes for Microsoft Office Solution Developers.

Example

This example creates a new main document and attaches the Orders table from an Access database named "Northwind.mdb."

VBA Copy code Copy code
Dim docNew As Document

Set docNew = Documents.Add

With docNew.MailMerge
 .MainDocumentType = wdFormLetters
 .OpenDataSource _
 Name:="C:\Program Files\Microsoft Office" & _
 "\Office\Samples\Northwind.mdb", _
 LinkToSource:=True, AddToRecentFiles:=False, _
 Connection:="TABLE Orders"
End With

This example creates a new main document and attaches the Excel worksheet named "Names.xls." The Connection argument retrieves data from the range named "Sales."

VBA Copy code Copy code
Dim docNew As Document

Set docNew = Documents.Add

With docNew.MailMerge
 .MainDocumentType = wdCatalog
 .OpenDataSource Name:="C:\Documents\Names.xls", _
 ReadOnly:=True, _
 Connection:="Sales"
End With

This example uses ODBC to attach the Access database named "Northwind.mdb" to the active document. The SQLStatement argument selects the records in the Customers table.

VBA Copy code Copy code
Dim strConnection As String

With ActiveDocument.MailMerge
 .MainDocumentType = wdFormLetters
 strConnection = "DSN=MS Access Databases;" _
 & "DBQ=C:\Northwind.mdb;" _
 & "FIL=RedISAM;"
 .OpenDataSource Name:="C:\NorthWind.mdb", _
 Connection:=strConnection, _
 SQLStatement:="SELECT * FROM Customers"
End With

See also

Concepts

MailMerge Object

Other resources

MailMerge Object Members


MailMerge.OpenHeaderSource Method (Word)

 Copy code hover
[image]

MailMerge.OpenHeaderSource Method (Word)
See also Send feedback

Published: July 16, 2012

Attaches a mail merge header source to the specified document.

Syntax

expression .OpenHeaderSource(Name, Format, ConfirmConversions, ReadOnly, AddToRecentFiles, PasswordDocument, PasswordTemplate, Revert, WritePasswordDocument, WritePasswordTemplate, OpenExclusive)

expression Required. A variable that represents a MailMerge object.

Parameters

Name | Required/Optional | Data Type | Description
Name | Required | String | The file name of the header source.
Format | Optional | Variant | The file converter used to open the document. Can be one of the WdOpenFormat constants. To specify an external file format, use the OpenFormat property with a FileConverter object to determine the value to use with this argument.
ConfirmConversions | Optional | Variant | True to display the Convert File dialog box if the file isn't in Microsoft Word format.
ReadOnly | Optional | Variant | True to open the header source on a read-only basis.
AddToRecentFiles | Optional | Variant | True to add the file name to the list of recently used files at the bottom of the File menu.
PasswordDocument | Optional | Variant | The password required to open the header source document. (See Remarks below.)
PasswordTemplate | Optional | Variant | The password required to open the header source template. (See Remarks below.)
Revert | Optional | Variant | Controls what happens if Name is the file name of an open document. True to discard any unsaved changes to the open document and reopen the file; False to activate the open document.
WritePasswordDocument | Optional | Variant | The password required to save changes to the document data source. (See Remarks below.)
WritePasswordTemplate | Optional | Variant | The password required to save changes to the template data source. (See Remarks below.)
OpenExclusive | Optional | Variant | True to open exclusively.

Security

Avoid using hard-coded passwords in your applications. If a password is required in a procedure, request the password from the user, store it in a variable, and then use the variable in your code. For recommended best practices on how to do this, see Security Notes for Microsoft Office Solution Developers.

Remarks

When a header source is attached, the first record in the header source is used in place of the header record in the data source.

Example

This example sets the active document as a main document for form letters, and then it attaches the header source named "Header.doc" and the data document named "Names.doc."

VBA Copy code Copy code
With ActiveDocument.MailMerge
 .MainDocumentType = wdFormLetters
 .OpenHeaderSource Name:="C:\Documents\Header.doc", _
 Revert:=False, AddToRecentFiles:=False
 .OpenDataSource Name:="C:\Documents\Names.doc"
End With

See also

Concepts

MailMerge Object

Other resources

MailMerge Object Members


MailMerge.ShowWizard Method (Word)

 Copy code hover
[image]

MailMerge.ShowWizard Method (Word)
See also Send feedback

Published: July 16, 2012

Displays the Mail Merge Wizard in a document.

Syntax

expression .ShowWizard(InitialState, ShowDocumentStep, ShowTemplateStep, ShowDataStep, ShowWriteStep, ShowPreviewStep, ShowMergeStep)

expression Required. A variable that represents a MailMerge object.

Parameters

Name | Required/Optional | Data Type | Description
InitialState | Required | Variant | The number of the Mail Merge Wizard step to display.
ShowDocumentStep | Optional | Variant | True keeps the "Select document type" step in the sequence of mail merge steps. False removes step one.
ShowTemplateStep | Optional | Variant | True keeps the "Select starting document" step in the sequence of mail merge steps. False removes step two.
ShowDataStep | Optional | Variant | True keeps the "Select recipients" step in the sequence of mail merge steps. False removes step three.
ShowWriteStep | Optional | Variant | True keeps the "Write your letter" step in the sequence of mail merge steps. False removes step four.
ShowPreviewStep | Optional | Variant | True keeps the "Preview your letters" step in the sequence of mail merge steps. False removes step five.
ShowMergeStep | Optional | Variant | True keeps the "Complete the merge" step in the sequence of mail merge steps. False removes step six.

Example

This example checks if the Mail Merge Wizard is already displayed and, if it is, moves to the Mail Merge Wizard's sixth step and removes the fifth step from the Wizard.

VBA Copy code Copy code
Sub ShowMergeWizard()
 With ActiveDocument.MailMerge
 If .WizardState > 0 Then
 .ShowWizard InitialState:=6, ShowPreviewStep:=False
 End If
 End With
End Sub

See also

Concepts

MailMerge Object

Other resources

MailMerge Object Members


MailMergeDataField Object (Word)

 Copy code hover
[image]

MailMergeDataField Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a single mail merge field in a data source. The MailMergeDataField object is a member of the MailMergeDataFields collection. The MailMergeDataFields collection includes all the data fields in a mail merge data source (for example, Name, Address, and City).

Remarks

Use DataFields(Index), where Index is the data field name or the index number, to return a single MailMergeDataField object. The index number represents the position of the data field in the mail merge data source. The following example retrieves the first value from the FName field in the data source attached to the active document.

VBA Copy code Copy code
first = _
 ActiveDocument.MailMerge.DataSource.DataFields("FName").Value

The following example displays the name of first field in the data source attached to the active document.

VBA Copy code Copy code
MsgBox ActiveDocument.MailMerge.DataSource.DataFields(1).Name

You cannot add fields to the MailMergeDataFields collection. All data fields in a data source are automatically included in the MailMergeDataFields collection.

See also

Concepts

Word Object Model Reference

Other resources

MailMergeDataField Object Members


MailMergeDataField Members (Word)

 Copy code hover
[image]

MailMergeDataField Members (Word)
Send feedback

Published: July 16, 2012

Represents a single mail merge field in a data source. The MailMergeDataField object is a member of the MailMergeDataFields collection. The MailMergeDataFields collection includes all the data fields in a mail merge data source (for example, Name, Address, and City).

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Index | Returns a Long that represents the position of an item in a collection. Read-only.
Name | Returns name of the specified object. Read-only String.
Parent | Returns an Object that represents the parent object of the specified MailMergeDataField object.
Value | Returns the contents of the mail merge data field or mapped data field for the current record. Read-only String.


MailMergeDataField Properties (Word)

 Copy code hover
[image]

MailMergeDataField Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Index | Returns a Long that represents the position of an item in a collection. Read-only.
Name | Returns name of the specified object. Read-only String.
Parent | Returns an Object that represents the parent object of the specified MailMergeDataField object.
Value | Returns the contents of the mail merge data field or mapped data field for the current record. Read-only String.


MailMergeDataField.Application Property (Word)

 Copy code hover
[image]

MailMergeDataField.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a MailMergeDataField object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

MailMergeDataField Object

Other resources

MailMergeDataField Object Members


MailMergeDataField.Creator Property (Word)

 Copy code hover
[image]

MailMergeDataField.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a MailMergeDataField object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

MailMergeDataField Object

Other resources

MailMergeDataField Object Members


MailMergeDataField.Index Property (Word)

 Copy code hover
[image]

MailMergeDataField.Index Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the position of an item in a collection. Read-only.

Syntax

expression .Index

expression Required. A variable that represents a MailMergeDataField object.

See also

Concepts

MailMergeDataField Object

Other resources

MailMergeDataField Object Members


MailMergeDataField.Name Property (Word)

 Copy code hover
[image]

MailMergeDataField.Name Property (Word)
See also Send feedback

Published: July 16, 2012

Returns name of the specified object. Read-only String.

Syntax

expression .Name

expression Required. A variable that represents a MailMergeDataField object.

See also

Concepts

MailMergeDataField Object

Other resources

MailMergeDataField Object Members


MailMergeDataField.Parent Property (Word)

 Copy code hover
[image]

MailMergeDataField.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified MailMergeDataField object.

Syntax

expression .Parent

expression Required. A variable that represents a MailMergeDataField object.

See also

Concepts

MailMergeDataField Object

Other resources

MailMergeDataField Object Members


MailMergeDataField.Value Property (Word)

 Copy code hover
[image]

MailMergeDataField.Value Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the contents of the mail merge data field or mapped data field for the current record. Read-only String.

Syntax

expression .Value

expression Required. A variable that represents a MailMergeDataField object.

Remarks

Use the ActiveRecord property to set the active record in a mail merge data source.

Example

This example displays the contents of the active record in the data source attached to Main.doc.

VBA Copy code Copy code
For Each dataF In _
 Documents("Main.doc").MailMerge.DataSource.DataFields
 If dataF.Value <> "" Then dRecord = dRecord & _
 dataF.Value & vbCr
Next dataF
MsgBox dRecord

See also

Concepts

MailMergeDataField Object

Other resources

MailMergeDataField Object Members


MailMergeDataFields Object (Word)

 Copy code hover
[image]

MailMergeDataFields Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of MailMergeDataField objects that represent the data fields in a mail merge data source.

Remarks

Use the DataFields property to return the MailMergeDataFields collection. The following example displays the names of all the fields in the attached data source.

VBA Copy code Copy code
For Each afield In ActiveDocument.MailMerge.DataSource.DataFields
 MsgBox afield.Name
Next afield

You cannot add fields to the MailMergeDataFields collection. When a data field is added to a data source, the field is automatically included in the MailMergeDataFields collection. Use the EditDataSource method to edit the contents of a data source. The following example adds a data field named "Author" to a table in the attached data source.

VBA Copy code Copy code
If ActiveDocument.MailMerge.DataSource.Type = _
 wdMergeInfoFromWord Then
 ActiveDocument.MailMerge.EditDataSource
 With ActiveDocument.Tables(1)
 .Columns.Add
 .Cell(Row:=1, Column:=.Columns.Count).Range.Text = "Author"
 End With
End If

Use DataFields(Index), where Index is the data field name or the index number, to return a single MailMergeDataField object. The index number represents the position of the data field in the mail merge data source. The following example retrieves the first value from the FName field in the data source attached to the active document.

VBA Copy code Copy code
first = ActiveDocument.MailMerge _
 .DataSource.DataFields("FName").Value

The following example displays the name of first data field in the data source attached to the active document.

VBA Copy code Copy code
MsgBox ActiveDocument.MailMerge.DataSource.DataFields(1).Name

See also

Concepts

Word Object Model Reference

Other resources

MailMergeDataFields Object Members


MailMergeDataFields Members (Word)

 Copy code hover
[image]

MailMergeDataFields Members (Word)
Send feedback

Published: July 16, 2012

A collection of MailMergeDataField objects that represent the data fields in a mail merge data source.

Methods

Name | Description
Item | Returns an individual MailMergeDataField object in a collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of mail merge data fields in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified MailMergeDataFields object.


MailMergeDataFields Properties (Word)

 Copy code hover
[image]

MailMergeDataFields Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of mail merge data fields in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified MailMergeDataFields object.


MailMergeDataFields.Application Property (Word)

 Copy code hover
[image]

MailMergeDataFields.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a MailMergeDataFields collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

MailMergeDataFields Collection Object

Other resources

MailMergeDataFields Object Members


MailMergeDataFields.Count Property (Word)

 Copy code hover
[image]

MailMergeDataFields.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of mail merge data fields in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents a MailMergeDataFields collection.

See also

Concepts

MailMergeDataFields Collection Object

Other resources

MailMergeDataFields Object Members


MailMergeDataFields.Creator Property (Word)

 Copy code hover
[image]

MailMergeDataFields.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a MailMergeDataFields collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

MailMergeDataFields Collection Object

Other resources

MailMergeDataFields Object Members


MailMergeDataFields.Parent Property (Word)

 Copy code hover
[image]

MailMergeDataFields.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified MailMergeDataFields object.

Syntax

expression .Parent

expression Required. A variable that represents a MailMergeDataFields collection.

See also

Concepts

MailMergeDataFields Collection Object

Other resources

MailMergeDataFields Object Members


MailMergeDataFields Methods (Word)

 Copy code hover
[image]

MailMergeDataFields Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Item | Returns an individual MailMergeDataField object in a collection.


MailMergeDataFields.Item Method (Word)

 Copy code hover
[image]

MailMergeDataFields.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual MailMergeDataField object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents a MailMergeDataFields collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The individual object to be returned. Can be a Long indicating the ordinal position or a String representing the name of the individual object.

Return Value

MailMergeDataField

See also

Concepts

MailMergeDataFields Collection Object

Other resources

MailMergeDataFields Object Members


MailMergeDataSource Object (Word)

 Copy code hover
[image]

MailMergeDataSource Object (Word)
See also Send feedback

Published: July 16, 2012

Represents the mail merge data source in a mail merge operation.

Remarks

Use the DataSource property to return the MailMergeDataSource object. The following example displays the name of the data source associated with the active document.

VBA Copy code Copy code
If ActiveDocument.MailMerge.DataSource.Name <> "" Then _
 MsgBox ActiveDocument.MailMerge.DataSource.Name

The following example displays the field names in the data source associated with the active document.

VBA Copy code Copy code
For Each aField In ActiveDocument.MailMerge.DataSource.FieldNames
 MsgBox aField.Name
Next aField

The following example opens the data source associated with Form letter.doc and determines whether the FirstName field includes the name "Kate."

VBA Copy code Copy code
With Documents("Form letter.doc").MailMerge
 .EditDataSource
 If .DataSource.FindRecord(FindText:="Kate", _
 Field:="FirstName") = True Then
 MsgBox "Data was found"
 End If
End With

See also

Concepts

Word Object Model Reference

Other resources

MailMergeDataSource Object Members


MailMergeDataSource Members (Word)

 Copy code hover
[image]

MailMergeDataSource Members (Word)
Send feedback

Published: July 16, 2012

Represents the mail merge data source in a mail merge operation.

Methods

Name | Description
Close | Closes the specified Mail Merge data source.
FindRecord | Searches the contents of the specified mail merge data source for text in a particular field. Returns True if the search text is found. Boolean.
SetAllErrorFlags | Marks all records in a mail merge data source as containing invalid data in an address field.
SetAllIncludedFlags | Includes or excludes flagged records in a data source from a mail merge.

Properties

Name | Description
ActiveRecord | Returns or sets the active mail merge record. Can be either a valid record number in the query result or one of the WdMailMergeActiveRecord constants.
Application | Returns an Application object that represents the Microsoft Word application.
ConnectString | Returns the connection string for the specified mail merge data source. Read-only String.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
DataFields | Returns a MailMergeDataFields collection that represents the fields in the specified mail merge data source. Read-only.
FieldNames | Returns a MailMergeFieldNames collection that represents the names of all the fields in the specified mail merge data source. Read-only.
FirstRecord | Returns or sets the number of the first record to be merged in a mail merge operation. Read/write Long.
HeaderSourceName | Returns the path and file name of the header source attached to the specified mail merge main document. Read-only String.
HeaderSourceType | Returns a value that indicates the way the header source is being supplied for the mail merge operation. Read-only WdMailMergeDataSource.
Included | True if a record is included in a mail merge. Read/write Boolean.
InvalidAddress | True for Microsoft Word to mark a record in a mail merge data source if it contains invalid data in an address field. Read/write Boolean.
InvalidComments | If the InvalidAddress property is True, returns or sets a String that describes an invalid address error. Read/write.
LastRecord | Returns or sets the number of the last record to be merged in a mail merge operation. Read/write Long.
MappedDataFields | Returns a MappedDataFields collection that represents the mapped data fields available in Microsoft Word.
Name | Returns name of the specified object. Read-only String.
Parent | Returns an Object that represents the parent object of the specified MailMergeDataSource object.
QueryString | Returns or sets the query string (SQL statement) used to retrieve a subset of the data in a mail merge data source. Read/write String.
RecordCount | Returns a Long that represents the number of records in the data source. Read-only.
TableName | Returns a String with the SQL query used to retrieve the records from the data source file attached to a mail merge document. Read-only.
Type | Returns the type of mail merge data source. Read-only WdMailMergeDataSource.


MailMergeDataSource Properties (Word)

 Copy code hover
[image]

MailMergeDataSource Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
ActiveRecord | Returns or sets the active mail merge record. Can be either a valid record number in the query result or one of the WdMailMergeActiveRecord constants.
Application | Returns an Application object that represents the Microsoft Word application.
ConnectString | Returns the connection string for the specified mail merge data source. Read-only String.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
DataFields | Returns a MailMergeDataFields collection that represents the fields in the specified mail merge data source. Read-only.
FieldNames | Returns a MailMergeFieldNames collection that represents the names of all the fields in the specified mail merge data source. Read-only.
FirstRecord | Returns or sets the number of the first record to be merged in a mail merge operation. Read/write Long.
HeaderSourceName | Returns the path and file name of the header source attached to the specified mail merge main document. Read-only String.
HeaderSourceType | Returns a value that indicates the way the header source is being supplied for the mail merge operation. Read-only WdMailMergeDataSource.
Included | True if a record is included in a mail merge. Read/write Boolean.
InvalidAddress | True for Microsoft Word to mark a record in a mail merge data source if it contains invalid data in an address field. Read/write Boolean.
InvalidComments | If the InvalidAddress property is True, returns or sets a String that describes an invalid address error. Read/write.
LastRecord | Returns or sets the number of the last record to be merged in a mail merge operation. Read/write Long.
MappedDataFields | Returns a MappedDataFields collection that represents the mapped data fields available in Microsoft Word.
Name | Returns name of the specified object. Read-only String.
Parent | Returns an Object that represents the parent object of the specified MailMergeDataSource object.
QueryString | Returns or sets the query string (SQL statement) used to retrieve a subset of the data in a mail merge data source. Read/write String.
RecordCount | Returns a Long that represents the number of records in the data source. Read-only.
TableName | Returns a String with the SQL query used to retrieve the records from the data source file attached to a mail merge document. Read-only.
Type | Returns the type of mail merge data source. Read-only WdMailMergeDataSource.


MailMergeDataSource.ActiveRecord Property (Word)

 Copy code hover
[image]

MailMergeDataSource.ActiveRecord Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the active mail merge record. Can be either a valid record number in the query result or one of the WdMailMergeActiveRecord constants.

Syntax

expression .ActiveRecord

expression A variable that represents a MailMergeDataSource object.

Remarks

The active record number is the position of the record in the query result produced by the current query options; as such, this number isn't necessarily the position of the record in the data source.

Example

This example hides the mail merge field codes in the active document so that the merge data is visible in the main document. The active record is then advanced to the next record in the data source.

VBA Copy code Copy code
If ActiveDocument.MailMerge.MainDocumentType <> _
 wdNotAMergeDocument Then
 With ActiveDocument.MailMerge
 .ViewMailMergeFieldCodes = False
 .DataSource.ActiveRecord = wdNextRecord
 End With
End If

This example returns the numeric position of the active record from Main2.doc.

VBA Copy code Copy code
Dim intRecordNumber as Integer

If Documents("Main2.doc").MailMerge.State = _
 wdMainAndDataSource Or _
 wdMainAndSourceAndHeader Then
 intRecordNumber = Documents("Main2.doc").MailMerge _
 .DataSource.ActiveRecord
End If

See also

Concepts

MailMergeDataSource Object

Other resources

MailMergeDataSource Object Members


MailMergeDataSource.Application Property (Word)

 Copy code hover
[image]

MailMergeDataSource.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a MailMergeDataSource object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

MailMergeDataSource Object

Other resources

MailMergeDataSource Object Members


MailMergeDataSource.ConnectString Property (Word)

 Copy code hover
[image]

MailMergeDataSource.ConnectString Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the connection string for the specified mail merge data source. Read-only String.

Syntax

expression .ConnectString

expression A variable that represents a MailMergeDataSource object.

Example

This example creates a new main document and attaches the Customers table from a Microsoft Access database named "Northwind.mdb." The connection string is displayed in a message box.

VBA Copy code Copy code
Dim docNew As Document

Set docNew = Documents.Add

With docNew.MailMerge
 .MainDocumentType = wdFormLetters
 .OpenDataSource _
 Name:="C:\Program Files\Microsoft Office\Office" & _
 "\Samples\Northwind.mdb", _
 LinkToSource:=True, AddToRecentFiles:=False, _
 Connection:="TABLE Customers"
 MsgBox .DataSource.ConnectString
End With

See also

Concepts

MailMergeDataSource Object

Other resources

MailMergeDataSource Object Members


MailMergeDataSource.Creator Property (Word)

 Copy code hover
[image]

MailMergeDataSource.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a MailMergeDataSource object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

MailMergeDataSource Object

Other resources

MailMergeDataSource Object Members


MailMergeDataSource.DataFields Property (Word)

 Copy code hover
[image]

MailMergeDataSource.DataFields Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a MailMergeDataFields collection that represents the fields in the specified mail merge data source. Read-only.

Syntax

expression .DataFields

expression A variable that represents a MailMergeDataSource object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example displays the name of each field in the data source attached to the active mail merge main document.

VBA Copy code Copy code
Dim mmdfTemp As MailMergeDataField

For Each mmdfTemp In _
 ActiveDocument.MailMerge.DataSource.DataFields
 MsgBox mmdfTemp.Name
Next mmdfTemp

This example displays the value of the LastName field from the first record in the data source attached to "Main.doc."

VBA Copy code Copy code
With Documents("Main.doc").MailMerge.DataSource
 .ActiveRecord = wdFirstRecord
 MsgBox .DataFields("LastName").Value
End With

See also

Concepts

MailMergeDataSource Object

Other resources

MailMergeDataSource Object Members


MailMergeDataSource.FieldNames Property (Word)

 Copy code hover
[image]

MailMergeDataSource.FieldNames Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a MailMergeFieldNames collection that represents the names of all the fields in the specified mail merge data source. Read-only.

Syntax

expression .FieldNames

expression A variable that represents a MailMergeDataSource object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example displays the name of the first field in the data source attached to the active mail merge main document.

VBA Copy code Copy code
MsgBox ActiveDocument.MailMerge.DataSource.FieldNames(1).Name

This example uses the mNames() array to store the names of each merge field contained in the data source attached to the active document.

VBA Copy code Copy code
Dim mNames As Variant
Dim mmTemp As MailMerge
Dim intCount As Integer
Dim intIncrement As Integer
Dim mmfnLoop As MailMergeFieldName

Set mmTemp = ActiveDocument.MailMerge
intCount = _
 ActiveDocument.MailMerge.DataSource.FieldNames.Count - 1

ReDim mNames(intCount)
intIncrement = 0

For Each mmfnLoop In mmTemp.DataSource.FieldNames
 mNames(intIncrement) = mmfnLoop.Name
 intIncrement = intIncrement + 1
Next mmfnLoop

See also

Concepts

MailMergeDataSource Object

Other resources

MailMergeDataSource Object Members


MailMergeDataSource.FirstRecord Property (Word)

 Copy code hover
[image]

MailMergeDataSource.FirstRecord Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the number of the first record to be merged in a mail merge operation. Read/write Long.

Syntax

expression .FirstRecord

expression A variable that represents a MailMergeDataSource object.

Example

This example merges the main document with records 1 through 3 and sends the merge documents to the printer.

VBA Copy code Copy code
With ActiveDocument.MailMerge
 .DataSource.FirstRecord = 1
 .DataSource.LastRecord = 3
 .Destination = wdSendToPrinter
 .Execute
End With

See also

Concepts

MailMergeDataSource Object

Other resources

MailMergeDataSource Object Members


MailMergeDataSource.HeaderSourceName Property (Word)

 Copy code hover
[image]

MailMergeDataSource.HeaderSourceName Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the path and file name of the header source attached to the specified mail merge main document. Read-only String.

Syntax

expression .HeaderSourceName

expression A variable that represents a MailMergeDataSource object.

Example

If a header source is attached to the active document, this example displays the file name.

VBA Copy code Copy code
Dim strName As String

strName = ActiveDocument.MailMerge.DataSource.HeaderSourceName
If strName <> "" Then MsgBox strName

This example opens the header source attached to the active document if the source is a Word document.

VBA Copy code Copy code
Dim mmdsTemp As MailMergeDataSource

Set mmdsTemp = ActiveDocument.MailMerge.DataSource

If mmdsTemp.HeaderSourceType = wdMergeInfoFromWord Then
 Documents.Open FileName:=mmdsTemp.HeaderSourceName
End If

See also

Concepts

MailMergeDataSource Object

Other resources

MailMergeDataSource Object Members


MailMergeDataSource.HeaderSourceType Property (Word)

 Copy code hover
[image]

MailMergeDataSource.HeaderSourceType Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a value that indicates the way the header source is being supplied for the mail merge operation. Read-only WdMailMergeDataSource.

Syntax

expression .HeaderSourceType

expression Required. A variable that represents a MailMergeDataSource object.

Remarks

Security note Security Note
Dynamic data exchange (DDE) is an older technology that is not secure. If possible, use a more secure alternative to DDE, such as object linking and embedding (OLE).

Example

This example opens the header source attached to the active document if the source is a Word document.

VBA Copy code Copy code
Dim mmdsTemp As MailMergeDataSource

Set mmdsTemp = ActiveDocument.MailMerge.DataSource

If mmdsTemp.HeaderSourceType = wdMergeInfoFromWord Then
 Documents.Open FileName:=mmdsTemp.HeaderSourceName
End If

See also

Concepts

MailMergeDataSource Object

Other resources

MailMergeDataSource Object Members


MailMergeDataSource.Included Property (Word)

 Copy code hover
[image]

MailMergeDataSource.Included Property (Word)
See also Send feedback

Published: July 16, 2012

True if a record is included in a mail merge. Read/write Boolean.

Syntax

expression .Included

expression An expression that returns a MailMergeDataSource object.

Remarks

Use the SetAllIncludedFlags method to include or exclude all records in a mail merge data source.

Example

This example loops through the records in the mail merge data source and checks if the ZIP Code field (in this case field number six) contains fewer than five digits. If a record does contain a ZIP Code of fewer than five digits, the record is excluded from the mail merge and the address is marked as invalid.

VBA Copy code Copy code
Sub CheckRecords()

 Dim intCount As Integer

 On Error Resume Next

 With ActiveDocument.MailMerge.DataSource

 'Set the active record equal to the first included record
 ' in the data source
 .ActiveRecord = wdFirstRecord
 Do
 intCount = intCount + 1

 'Set the condition that field six must be greater than
 'or equal to five
 If Len(.DataFields(6).Value) < 5 Then

 'Exclude the record if field six is less than five
 .Included = False

 'Mark the record as containing an invalid address field
 .InvalidAddress = True

 'Specify the comment attached to the record
 'explaining why the record was excluded
 'from the mail merge
 .InvalidComments = "The ZIP Code for this record " & _
 "has fewer than five digits. It will be removed " _
 & "from the mail merge process."

 End If

 'Move the record to the next record in the data source
 .ActiveRecord = wdNextRecord

 'End the loop when the counter variable equals the
 'number of records in the data source
 Loop Until intCount = .RecordCount
 End With

End Sub

See also

Concepts

MailMergeDataSource Object

Other resources

MailMergeDataSource Object Members


MailMergeDataSource.InvalidAddress Property (Word)

 Copy code hover
[image]

MailMergeDataSource.InvalidAddress Property (Word)
See also Send feedback

Published: July 16, 2012

True for Microsoft Word to mark a record in a mail merge data source if it contains invalid data in an address field. Read/write Boolean.

Syntax

expression .InvalidAddress

expression An expression that returns a MailMergeDataSource object.

Remarks

Use the SetAllErrorFlags method to set both the InvalidAddress and InvalidComments properties for all records in a data source.

Example

This example loops through the records in the mail merge data source and checks whether the ZIP Code field (in this case field number six) contains fewer than five digits. If a record does contain a ZIP Code of fewer than five digits, the record is excluded from the mail merge and the address is marked as invalid.

VBA Copy code Copy code
Sub ExcludeRecords()

 Dim intCount As Integer

 On Error Resume Next

 With ActiveDocument.MailMerge.DataSource
 .ActiveRecord = wdFirstRecord
 Do
 intCount = intCount + 1
 'Counts the number of digits in the postal code field and if
 'it is less than 5, the record is excluded from the mail merge,
 'marked as having an invalid address, and given a comment
 'describing why the postal code was removed
 If Len(.DataFields(6).Value) < 5 Then
 .Included = False
 .InvalidAddress = True
 .InvalidComments = "The ZIP Code for this record" & _
 "has fewer than five digits. It will be" & _
 "removed from the mail merge process."
 End If

 .ActiveRecord = wdNextRecord
 Loop Until intCount >= .ActiveRecord
 End With

End Sub

See also

Concepts

MailMergeDataSource Object

Other resources

MailMergeDataSource Object Members


MailMergeDataSource.InvalidComments Property (Word)

 Copy code hover
[image]

MailMergeDataSource.InvalidComments Property (Word)
See also Send feedback

Published: July 16, 2012

If the InvalidAddress property is True, returns or sets a String that describes an invalid address error. Read/write.

Syntax

expression .InvalidComments

expression A variable that represents a MailMergeDataSource object.

Remarks

Use the SetAllErrorFlags method to set both the InvalidAddress and InvalidComments properties for all records in a data source.

Example

This example loops through the records in the mail merge data source and checks whether the ZIP Code field (in this case field number six) contains fewer than five digits. If a record does contain a ZIP Code of fewer than five digits, the record is excluded from the mail merge, the address is marked as invalid, and a comment about why the record was excluded is added.

VBA Copy code Copy code
Sub ExcludeRecords()

 Dim intCount As Integer

 On Error Resume Next

 With ActiveDocument.MailMerge.DataSource
 .ActiveRecord = wdFirstRecord
 Do
 intCount = intCount + 1
 'Counts the number of digits in the postal code field and if
 'it is fewer than 5, the record is excluded from the mail merge,
 'marked as having an invalid address, and given a comment
 'describing why the postal code was removed
 If Len(.DataFields(6).Value) < 5 Then
 .Included = False
 .InvalidAddress = True
 .InvalidComments = "The ZIP Code for this record" & _
 "has fewer than five digits. It will be" & _
 "removed from the mail merge process."
 End If

 .ActiveRecord = wdNextRecord
 Loop Until intCount >= .ActiveRecord
 End With

End Sub

See also

Concepts

MailMergeDataSource Object

Other resources

MailMergeDataSource Object Members


MailMergeDataSource.LastRecord Property (Word)

 Copy code hover
[image]

MailMergeDataSource.LastRecord Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the number of the last record to be merged in a mail merge operation. Read/write Long.

Syntax

expression .LastRecord

expression An expression that returns a MailMergeDataSource object.

Example

This example merges the main document with records 2 through 4 and sends the merge documents to a new document.

VBA Copy code Copy code
With ActiveDocument.MailMerge
 .DataSource.FirstRecord = 2
 .DataSource.LastRecord = 4
 .Destination = wdSendToNewDocument
 .Execute
End With

See also

Concepts

MailMergeDataSource Object

Other resources

MailMergeDataSource Object Members


MailMergeDataSource.MappedDataFields Property (Word)

 Copy code hover
[image]

MailMergeDataSource.MappedDataFields Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a MappedDataFields collection that represents the mapped data fields available in Microsoft Word.

Syntax

expression .MappedDataFields

expression An expression that returns a MailMergeDataSource object.

Example

This example creates a tabbed list of the mapped data fields available in Word and the fields in the data source to which they are mapped. This example assumes that the current document is a mail merge document.

VBA Copy code Copy code
Sub MappedFields()
 Dim intCount As Integer
 Dim docCurrent As Document
 Dim docNew As Document

 On Error Resume Next

 Set docCurrent = ActiveDocument
 Set docNew = Documents.Add

 'Add leader tab to new document
 docNew.Paragraphs.TabStops.Add _
 Position:=InchesToPoints(3.5), _
 Leader:=wdTabLeaderDots

 With docCurrent.MailMerge.DataSource

 'Insert heading paragraph for tabbed columns
 docNew.Content.InsertAfter "Word Mapped Data Field" _
 & vbTab & "Data Source Field"

 Do
 intCount = intCount + 1

 'Insert Word mapped data field name and the
 'corresponding data source field name
 docNew.Content.InsertAfter .MappedDataFields( _
 Index:=intCount).Name & vbTab & _
 .MappedDataFields(Index:=intCount) _
 .DataFieldName

 'Insert paragraph
 docNew.Content.InsertParagraphAfter
 Loop Until intCount = .MappedDataFields.Count

 End With

End Sub

See also

Concepts

MailMergeDataSource Object

Other resources

MailMergeDataSource Object Members


MailMergeDataSource.Name Property (Word)

 Copy code hover
[image]

MailMergeDataSource.Name Property (Word)
See also Send feedback

Published: July 16, 2012

Returns name of the specified object. Read-only String.

Syntax

expression .Name

expression Required. A variable that represents a MailMergeDataSource object.

See also

Concepts

MailMergeDataSource Object

Other resources

MailMergeDataSource Object Members


MailMergeDataSource.Parent Property (Word)

 Copy code hover
[image]

MailMergeDataSource.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified MailMergeDataSource object.

Syntax

expression .Parent

expression Required. A variable that represents a MailMergeDataSource object.

See also

Concepts

MailMergeDataSource Object

Other resources

MailMergeDataSource Object Members


MailMergeDataSource.QueryString Property (Word)

 Copy code hover
[image]

MailMergeDataSource.QueryString Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the query string (SQL statement) used to retrieve a subset of the data in a mail merge data source. Read/write String.

Syntax

expression .QueryString

expression An expression that returns a MailMergeDataSource object.

Example

This example returns the query string for the data source attached to the active document.

VBA Copy code Copy code
qString = ActiveDocument.MailMerge.DataSource.QueryString

See also

Concepts

MailMergeDataSource Object

Other resources

MailMergeDataSource Object Members


MailMergeDataSource.RecordCount Property (Word)

 Copy code hover
[image]

MailMergeDataSource.RecordCount Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of records in the data source. Read-only.

Syntax

expression .RecordCount

expression An expression that returns a MailMergeDataSource object.

Remarks

If Microsoft Word cannot determine the number of records in a data source, the RecordCount property will return a value of -1.

Example

This example loops through the records in the data source and verifies that the postal code field (field six in this example) is not fewer than five digits. If it is, it removes the record from the mail merge. If you want to make sure that the locator code is added to the postal code, you can change the length value from 5 to 10. Therefore, if a postal code is fewer than ten digits it will be removed from the mail merge.

VBA Copy code Copy code
Sub ExcludeRecords()

 On Error GoTo ErrorHandler

 With ActiveDocument.MailMerge.DataSource
 .ActiveRecord = wdFirstRecord
 Do

 'Counts the number of digits in the postal code field and if
 'it is fewer than 5, the record is excluded from the mail merge,
 'marked as having an invalid address, and given a comment
 'describing why the postal code was removed
 If Len(.DataFields(6).Value) < 5 Then
 .Included = False
 .InvalidAddress = True
 .InvalidComments = "The ZIP Code for this record" & _
 "has fewer than five digits. This record will be" & _
 "removed from the mail merge process."
 End If
 If .ActiveRecord <> .RecordCount Then
 .ActiveRecord = wdNextRecord
 End If
 Loop Until .ActiveRecord = .RecordCount
ErrorHandler:

 End With

End Sub

See also

Concepts

MailMergeDataSource Object

Other resources

MailMergeDataSource Object Members


MailMergeDataSource.TableName Property (Word)

 Copy code hover
[image]

MailMergeDataSource.TableName Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a String with the SQL query used to retrieve the records from the data source file attached to a mail merge document. Read-only.

Syntax

expression .TableName

expression A variable that represents a MailMergeDataSource object.

Remarks

This property may be blank if the table name is unknown or not applicable to the current data source.

Example

This example checks to see if the Customers table is the name of the table in the attached data source. If not, it attaches the Customers table in the Northwind database.

Note Note

This example uses the Visual Basic InStr function, which returns the position of the first character in the second string if it exists in the first string. A value of zero (0) is returned if the first string does not contain the second string. Setting the conditional value to less than one (1) indicates that the attached table is not named Customers.

VBA Copy code Copy code
Sub DataSourceTable()
 With ActiveDocument.MailMerge
 If InStr(1, .DataSource.TableName, "Customers") < 1 Then
 .OpenDataSource Name:="C:\ProgramFiles\Microsoft Office\Office\" & _
 "Samples\Northwind.mdb", LinkToSource:=True, _
 AddToRecentFiles:=False, Connection:="TABLE Customers"
 End If
 End With
End Sub

See also

Concepts

MailMergeDataSource Object

Other resources

MailMergeDataSource Object Members


MailMergeDataSource.Type Property (Word)

 Copy code hover
[image]

MailMergeDataSource.Type Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the type of mail merge data source. Read-only WdMailMergeDataSource.

Syntax

expression .Type

expression Required. A variable that represents a MailMergeDataSource object.

Remarks

Security note Security Note
Dynamic data exchange (DDE) is an older technology that is not secure. If possible, use a more secure alternative to DDE, such as object linking and embedding (OLE).

See also

Concepts

MailMergeDataSource Object

Other resources

MailMergeDataSource Object Members


MailMergeDataSource Methods (Word)

 Copy code hover
[image]

MailMergeDataSource Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Close | Closes the specified Mail Merge data source.
FindRecord | Searches the contents of the specified mail merge data source for text in a particular field. Returns True if the search text is found. Boolean.
SetAllErrorFlags | Marks all records in a mail merge data source as containing invalid data in an address field.
SetAllIncludedFlags | Includes or excludes flagged records in a data source from a mail merge.


MailMergeDataSource.Close Method (Word)

 Copy code hover
[image]

MailMergeDataSource.Close Method (Word)
See also Send feedback

Published: July 16, 2012

Closes the specified Mail Merge data source.

Syntax

expression .Close

expression Required. A variable that represents a MailMergeDataSource object.

See also

Concepts

MailMergeDataSource Object

Other resources

MailMergeDataSource Object Members


MailMergeDataSource.FindRecord Method (Word)

 Copy code hover
[image]

MailMergeDataSource.FindRecord Method (Word)
See also Send feedback

Published: July 16, 2012

Searches the contents of the specified mail merge data source for text in a particular field. Returns True if the search text is found. Boolean.

Syntax

expression .FindRecord(FindText, Field)

expression Required. A variable that represents a MailMergeDataSource object.

Parameters

Name | Required/Optional | Data Type | Description
FindText | Required | String | The text to be looked for.
Field | Required | Variant | The name of the field to be searched.

Return Value

Boolean

Remarks

This method corresponds to the Find Record button on the Mail Merge toolbar.

The FindRecord method does a forward search only. Therefore, if the active record is not the first record in the data source and the record for which you are searching is before the active record, the FindRecord method will return no results. To ensure that the entire data source is searched, set the ActiveRecord property to wdFirstRecord.

Example

This example displays a merge document for the first record in which the FirstName field contains "Joe." If the record is found, the number of the record is stored in the numRecord variable.

VBA Copy code Copy code
Dim dsMain As MailMergeDataSource
Dim numRecord As Integer

ActiveDocument.MailMerge.ViewMailMergeFieldCodes = False
Set dsMain = ActiveDocument.MailMerge.DataSource
If dsMain.FindRecord(FindText:="Joe", _
 Field:="FirstName") = True Then
 numRecord = dsMain.ActiveRecord
End If

See also

Concepts

MailMergeDataSource Object

Other resources

MailMergeDataSource Object Members


MailMergeDataSource.SetAllErrorFlags Method (Word)

 Copy code hover
[image]

MailMergeDataSource.SetAllErrorFlags Method (Word)
See also Send feedback

Published: July 16, 2012

Marks all records in a mail merge data source as containing invalid data in an address field.

Syntax

expression .SetAllErrorFlags(Invalid, InvalidComment)

expression Required. A variable that represents a MailMergeDataSource object.

Parameters

Name | Required/Optional | Data Type | Description
Invalid | Required | Boolean | True marks all records in the data source of a mail merge as invalid.
InvalidComment | Required | String | Text describing the invalid setting.

Remarks

You can individually mark data source records that contain invalid data in an address field by using the InvalidAddress and InvalidComments properties.

Example

This example marks all records in the data source as containing an invalid address field, sets a comment as to why it is invalid, and excludes all records from the mail merge.

VBA Copy code Copy code
Sub FlagAllRecords()
 With ActiveDocument.MailMerge.DataSource
 .SetAllErrorFlags Invalid:=True, InvalidComment:= _
 "All records in the data source have only 5-" _
 & "digit ZIP Codes. Need 5+4 digit ZIP Codes."
 .SetAllIncludedFlags Included:=False
 End With
End Sub

See also

Concepts

MailMergeDataSource Object

Other resources

MailMergeDataSource Object Members


MailMergeDataSource.SetAllIncludedFlags Method (Word)

 Copy code hover
[image]

MailMergeDataSource.SetAllIncludedFlags Method (Word)
See also Send feedback

Published: July 16, 2012

Includes or excludes flagged records in a data source from a mail merge.

Syntax

expression .SetAllIncludedFlags(Included)

expression Required. A variable that represents a MailMergeDataSource object.

Parameters

Name | Required/Optional | Data Type | Description
Included | Required | Boolean | True to include all data source records in a mail merge. False to exclude all data source records from a mail merge.

Remarks

You can set individual records in a data source to be included in or excluded from a mail merge using the Included property.

Example

This example marks all records in the data source as containing an invalid address field, sets a comment as to why it is invalid, and excludes all records from the mail merge.

VBA Copy code Copy code
Sub FlagAllRecords()
 With ActiveDocument.MailMerge.DataSource
 .SetAllErrorFlags Invalid:=True, InvalidComment:= _
 "All records in the data source have only 5-" _
 & "digit ZIP Codes. Need 5+4 digit ZIP Codes."
 .SetAllIncludedFlags Included:=False
 End With
End Sub

See also

Concepts

MailMergeDataSource Object

Other resources

MailMergeDataSource Object Members


MailMergeField Object (Word)

 Copy code hover
[image]

MailMergeField Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a single mail merge field in a document. The MailMergeDataField object is a member of the MailMergeDataFields collection. The MailMergeDataFields collection includes all the mail merge related fields in a document.

Remarks

Use Fields(Index), where Index is the index number, to return a single MailMergeField object. The following example displays the field code of the first mail merge field in the active document.

VBA Copy code Copy code
MsgBox ActiveDocument.MailMerge.Fields(1).Code

Use the Add method to add a merge field to the MailMergeFields collection. The following example replaces the selection with a MiddleInitial merge field.

VBA Copy code Copy code
ActiveDocument.MailMerge.Fields.Add Range:=Selection.Range, _
 Name:="MiddleInitial"

The MailMergeFields collection has additional methods, such as AddAsk and AddFillIn, for adding fields related to a mail merge operation.

See also

Concepts

Word Object Model Reference

Other resources

MailMergeField Object Members


MailMergeField Members (Word)

 Copy code hover
[image]

MailMergeField Members (Word)
Send feedback

Published: July 16, 2012

Represents a single mail merge field in a document. The MailMergeDataField object is a member of the MailMergeDataFields collection. The MailMergeDataFields collection includes all the mail merge related fields in a document.

Methods

Name | Description
Copy | Copies the specified mail merge field to the Clipboard.
Cut | Removes the specified mail merge field from the document and moves it to the Clipboard.
Delete | Deletes the specified mail merge field.
Select | Selects the specified mail merge field.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Code | Returns a Range object that represents a field's code. Read/write.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Locked | True if the specified field is locked. Read/write Boolean.
Next | Returns the next mail merge field in the collection of mail merge fields. Read-only.
Parent | Returns an Object that represents the parent object of the specified MailMergeField object.
Previous | Returns the previous mail merge field in the collection of mail merge fields. Read-only.
Type | Returns the field type. Read-only WdFieldType.


MailMergeField Properties (Word)

 Copy code hover
[image]

MailMergeField Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Code | Returns a Range object that represents a field's code. Read/write.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Locked | True if the specified field is locked. Read/write Boolean.
Next | Returns the next mail merge field in the collection of mail merge fields. Read-only.
Parent | Returns an Object that represents the parent object of the specified MailMergeField object.
Previous | Returns the previous mail merge field in the collection of mail merge fields. Read-only.
Type | Returns the field type. Read-only WdFieldType.


MailMergeField.Application Property (Word)

 Copy code hover
[image]

MailMergeField.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a MailMergeField object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

MailMergeField Object

Other resources

MailMergeField Object Members


MailMergeField.Code Property (Word)

 Copy code hover
[image]

MailMergeField.Code Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents a field's code. Read/write.

Syntax

expression .Code

expression A variable that represents a MailMergeField object.

Remarks

A field's code is everything that's enclosed by the field characters ({ }) including the leading and trailing space characters. You can access a field's code without changing the view from field results.

Example

This example displays the field code for each field in the active document.

VBA Copy code Copy code
Dim fieldLoop As Field

For Each fieldLoop In ActiveDocument.Fields
 MsgBox Chr(34) & fieldLoop.Code.Text & Chr(34)
Next fieldLoop

This example changes the field code for the first field in the active document to CREATEDATE.

VBA Copy code Copy code
Dim rngTemp As Range

Set rngTemp = ActiveDocument.Fields(1).Code
rngTemp.Text = " CREATEDATE "
ActiveDocument.Fields(1).Update

This example determines whether the active document includes a mail merge field named "Title."

VBA Copy code Copy code
Dim fieldLoop As Field

For Each fieldLoop In ActiveDocument.MailMerge.Fields
 If InStr(1, fieldLoop.Code.Text, "Title", 1) Then
 MsgBox "A Title merge field is in this document"
 End If
Next fieldLoop

See also

Concepts

MailMergeField Object

Other resources

MailMergeField Object Members


MailMergeField.Creator Property (Word)

 Copy code hover
[image]

MailMergeField.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a MailMergeField object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

MailMergeField Object

Other resources

MailMergeField Object Members


MailMergeField.Locked Property (Word)

 Copy code hover
[image]

MailMergeField.Locked Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified field is locked. Read/write Boolean.

Syntax

expression .Locked

expression Required. A variable that represents a MailMergeField object.

Remarks

When a field is locked, you cannot update the field results.

See also

Concepts

MailMergeField Object

Other resources

MailMergeField Object Members


MailMergeField.Next Property (Word)

 Copy code hover
[image]

MailMergeField.Next Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the next mail merge field in the collection of mail merge fields. Read-only.

Syntax

expression .Next

expression A variable that represents a MailMergeField object.

See also

Concepts

MailMergeField Object

Other resources

MailMergeField Object Members


MailMergeField.Parent Property (Word)

 Copy code hover
[image]

MailMergeField.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified MailMergeField object.

Syntax

expression .Parent

expression Required. A variable that represents a MailMergeField object.

See also

Concepts

MailMergeField Object

Other resources

MailMergeField Object Members


MailMergeField.Previous Property (Word)

 Copy code hover
[image]

MailMergeField.Previous Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the previous mail merge field in the collection of mail merge fields. Read-only.

Syntax

expression .Previous

expression A variable that represents a MailMergeField object.

See also

Concepts

MailMergeField Object

Other resources

MailMergeField Object Members


MailMergeField.Type Property (Word)

 Copy code hover
[image]

MailMergeField.Type Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the field type. Read-only WdFieldType.

Syntax

expression .Type

expression Required. A variable that represents a MailMergeField object.

Remarks

Security note Security Note
Dynamic data exchange (DDE) is an older technology that is not secure. If possible, use a more secure alternative to DDE, such as object linking and embedding (OLE).

See also

Concepts

MailMergeField Object

Other resources

MailMergeField Object Members


MailMergeField Methods (Word)

 Copy code hover
[image]

MailMergeField Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Copy | Copies the specified mail merge field to the Clipboard.
Cut | Removes the specified mail merge field from the document and moves it to the Clipboard.
Delete | Deletes the specified mail merge field.
Select | Selects the specified mail merge field.


MailMergeField.Copy Method (Word)

 Copy code hover
[image]

MailMergeField.Copy Method (Word)
See also Send feedback

Published: July 16, 2012

Copies the specified mail merge field to the Clipboard.

Syntax

expression .Copy

expression Required. A variable that represents a MailMergeField object.

See also

Concepts

MailMergeField Object

Other resources

MailMergeField Object Members


MailMergeField.Cut Method (Word)

 Copy code hover
[image]

MailMergeField.Cut Method (Word)
See also Send feedback

Published: July 16, 2012

Removes the specified mail merge field from the document and moves it to the Clipboard.

Syntax

expression .Cut

expression Required. A variable that represents a MailMergeField object.

Example

This example deletes the first field in the active document and pastes the field at the insertion point.

VBA Copy code Copy code
If ActiveDocument.Fields.Count >= 1 Then
 ActiveDocument.Fields(1).Cut
 Selection.Collapse Direction:=wdCollapseEnd
 Selection.Paste
End If

See also

Concepts

MailMergeField Object

Other resources

MailMergeField Object Members


MailMergeField.Delete Method (Word)

 Copy code hover
[image]

MailMergeField.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the specified mail merge field.

Syntax

expression .Delete

expression Required. A variable that represents a MailMergeField object.

See also

Concepts

MailMergeField Object

Other resources

MailMergeField Object Members


MailMergeField.Select Method (Word)

 Copy code hover
[image]

MailMergeField.Select Method (Word)
See also Send feedback

Published: July 16, 2012

Selects the specified mail merge field.

Syntax

expression .Select

expression Required. A variable that represents a MailMergeField object.

Remarks

After using this method, use the Selection property to work with the selected items. For more information, see Working with the Selection Object.

See also

Concepts

MailMergeField Object

Other resources

MailMergeField Object Members


MailMergeFieldName Object (Word)

 Copy code hover
[image]

MailMergeFieldName Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a mail merge field name in a data source. The MailMergeFieldName object is a member of the MailMergeFieldNames collection. The MailMergeFieldNames collection includes all the data field names in a mail merge data source.

Remarks

Use FieldNames(Index), where Index is the index number, to return a single MailMergeFieldName object. The index number represents the position of the field in the mail merge data source. The following example retrieves the name of the last field in the data source attached to the active document.

VBA Copy code Copy code
alast = ActiveDocument.MailMerge.DataSource.FieldNames.Count
afirst = ActiveDocument.MailMerge.DataSource.FieldNames(alast).Name
MsgBox afirst

You cannot add fields to the MailMergeFieldNames collection. Field names in a data source are automatically included in the MailMergeFieldNames collection.

See also

Concepts

Word Object Model Reference

Other resources

MailMergeFieldName Object Members


MailMergeFieldName Members (Word)

 Copy code hover
[image]

MailMergeFieldName Members (Word)
Send feedback

Published: July 16, 2012

Represents a mail merge field name in a data source. The MailMergeFieldName object is a member of the MailMergeFieldNames collection. The MailMergeFieldNames collection includes all the data field names in a mail merge data source.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Index | Returns a Long that represents the position of an item in a collection. Read-only.
Name | Returns name of the specified object. Read-only String.
Parent | Returns an Object that represents the parent object of the specified MailMergeFieldName object.


MailMergeFieldName Properties (Word)

 Copy code hover
[image]

MailMergeFieldName Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Index | Returns a Long that represents the position of an item in a collection. Read-only.
Name | Returns name of the specified object. Read-only String.
Parent | Returns an Object that represents the parent object of the specified MailMergeFieldName object.


MailMergeFieldName.Application Property (Word)

 Copy code hover
[image]

MailMergeFieldName.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a MailMergeFieldName object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

MailMergeFieldName Object

Other resources

MailMergeFieldName Object Members


MailMergeFieldName.Creator Property (Word)

 Copy code hover
[image]

MailMergeFieldName.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a MailMergeFieldName object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

MailMergeFieldName Object

Other resources

MailMergeFieldName Object Members


MailMergeFieldName.Index Property (Word)

 Copy code hover
[image]

MailMergeFieldName.Index Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the position of an item in a collection. Read-only.

Syntax

expression .Index

expression Required. A variable that represents a MailMergeFieldName object.

See also

Concepts

MailMergeFieldName Object

Other resources

MailMergeFieldName Object Members


MailMergeFieldName.Name Property (Word)

 Copy code hover
[image]

MailMergeFieldName.Name Property (Word)
See also Send feedback

Published: July 16, 2012

Returns name of the specified object. Read-only String.

Syntax

expression .Name

expression Required. A variable that represents a MailMergeFieldName object.

See also

Concepts

MailMergeFieldName Object

Other resources

MailMergeFieldName Object Members


MailMergeFieldName.Parent Property (Word)

 Copy code hover
[image]

MailMergeFieldName.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified MailMergeFieldName object.

Syntax

expression .Parent

expression Required. A variable that represents a MailMergeFieldName object.

See also

Concepts

MailMergeFieldName Object

Other resources

MailMergeFieldName Object Members


MailMergeFieldNames Object (Word)

 Copy code hover
[image]

MailMergeFieldNames Object (Word)
See also Send feedback

Published: July 16, 2012

See also

Concepts

Word Object Model Reference

Other resources

MailMergeFieldNames Object Members


MailMergeFieldNames Members (Word)

 Copy code hover
[image]

MailMergeFieldNames Members (Word)
Send feedback

Published: July 16, 2012

Methods

Name | Description
Item | Returns an individual MailMergeFieldNames object in a collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application. Read-only.
Count | Returns a Long that represents the number of mail merge field names in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified MailMergeFieldNames object.


MailMergeFieldNames Properties (Word)

 Copy code hover
[image]

MailMergeFieldNames Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application. Read-only.
Count | Returns a Long that represents the number of mail merge field names in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified MailMergeFieldNames object.


MailMergeFieldNames.Application Property (Word)

 Copy code hover
[image]

MailMergeFieldNames.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .Application

expression An expression that returns a MailMergeFieldNames object.

See also

Concepts

MailMergeFieldNames Object

Other resources

MailMergeFieldNames Object Members


MailMergeFieldNames.Count Property (Word)

 Copy code hover
[image]

MailMergeFieldNames.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of mail merge field names in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents a MailMergeFieldNames collection.

See also

Concepts

MailMergeFieldNames Object

Other resources

MailMergeFieldNames Object Members


MailMergeFieldNames.Creator Property (Word)

 Copy code hover
[image]

MailMergeFieldNames.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version Information

Version Added: Word 2010

Syntax

expression .Creator

expression An expression that returns a MailMergeFieldNames object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD". This property was primarily designed to be used on the Apple Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For more information about this property, see the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

MailMergeFieldNames Object

Other resources

MailMergeFieldNames Object Members


MailMergeFieldNames.Parent Property (Word)

 Copy code hover
[image]

MailMergeFieldNames.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified MailMergeFieldNames object.

Version Information

Version Added: Word 2010

Syntax

expression .Parent

expression An expression that returns a MailMergeFieldNames object.

See also

Concepts

MailMergeFieldNames Object

Other resources

MailMergeFieldNames Object Members


MailMergeFieldNames Methods (Word)

 Copy code hover
[image]

MailMergeFieldNames Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Item | Returns an individual MailMergeFieldNames object in a collection.


MailMergeFieldNames.Item Method (Word)

 Copy code hover
[image]

MailMergeFieldNames.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual MailMergeFieldNames object in a collection.

Version Information

Version Added: Word 2010

Syntax

expression .Item(Index)

expression An expression that returns a MailMergeFieldNames object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The individual object to be returned.

Return Value

MailMergeFieldName

See also

Concepts

MailMergeFieldNames Object

Other resources

MailMergeFieldNames Object Members


MailMergeFields Object (Word)

 Copy code hover
[image]

MailMergeFields Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of MailMergeField objects that represent the mail merge related fields in a document.

Remarks

Use the Fields property to return the MailMergeFields collection. The following example adds an ASK field after the last mail merge field in the active document.

VBA Copy code Copy code
Set myMMFields = ActiveDocument.MailMerge.Fields
myMMFields(myMMFields.Count).Select
Selection.MoveRight Unit:=wdWord, Count:=1, Extend:=wdMove
ActiveDocument.MailMerge.Fields.AddAsk Range:=Selection.Range, _
 Name:="Name", Prompt:="Type your name", AskOnce:=True

Use the Add method to add a merge field to the MailMergeFields collection. The following example replaces the selection with a MiddleInitial merge field.

VBA Copy code Copy code
ActiveDocument.MailMerge.Fields.Add Range:=Selection.Range, _
 Name:="MiddleInitial"

Use Fields(Index), where Index is the index number, to return a single MailMergeField object. The following example displays the field code of the first mail merge field in the active document.

VBA Copy code Copy code
MsgBox ActiveDocument.MailMerge.Fields(1).Code

The MailMergeFields collection has additional methods, such as AddAsk and AddFillIn, for adding fields related to a mail merge operation.

See also

Concepts

Word Object Model Reference

Other resources

MailMergeFields Object Members


MailMergeFields Members (Word)

 Copy code hover
[image]

MailMergeFields Members (Word)
Send feedback

Published: July 16, 2012

A collection of MailMergeField objects that represent the mail merge related fields in a document.

Methods

Name | Description
Add | Returns a MailMergeField object that represents a mail merge field added to the data source document.
AddAsk | Adds an ASK field to a mail merge main document. Returns a MailMergeField object.
AddFillIn | Adds a FILLIN field to a mail merge main document. Returns a MailMergeField object.
AddIf | Adds an IF field to a mail merge main document. Returns a MailMergeField object.
AddMergeRec | Adds a MERGEREC field to a mail merge main document. Returns a MailMergeField object.
AddMergeSeq | Adds a MERGESEQ field to a mail merge main document. Returns a MailMergeField object.
AddNext | Adds a NEXT field to a mail merge main document. Returns a MailMergeField object.
AddNextIf | Adds a NEXTIF field to a mail merge main document. Returns a MailMergeField object.
AddSet | Adds a SET field to a mail merge main document. Returns a MailMergeField object.
AddSkipIf | Adds a SKIPIF field to a mail merge main document. Returns a MailMergeField object. .
Item | Returns an individual MailMergeField object in a collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of mail merge fields in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified MailMergeFields object.


MailMergeFields Properties (Word)

 Copy code hover
[image]

MailMergeFields Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of mail merge fields in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified MailMergeFields object.


MailMergeFields.Application Property (Word)

 Copy code hover
[image]

MailMergeFields.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a MailMergeFields collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

MailMergeFields Collection Object

Other resources

MailMergeFields Object Members


MailMergeFields.Count Property (Word)

 Copy code hover
[image]

MailMergeFields.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of mail merge fields in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents a MailMergeFields collection.

See also

Concepts

MailMergeFields Collection Object

Other resources

MailMergeFields Object Members


MailMergeFields.Creator Property (Word)

 Copy code hover
[image]

MailMergeFields.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a MailMergeFields collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

MailMergeFields Collection Object

Other resources

MailMergeFields Object Members


MailMergeFields.Parent Property (Word)

 Copy code hover
[image]

MailMergeFields.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified MailMergeFields object.

Syntax

expression .Parent

expression Required. A variable that represents a MailMergeFields collection.

See also

Concepts

MailMergeFields Collection Object

Other resources

MailMergeFields Object Members


MailMergeFields Methods (Word)

 Copy code hover
[image]

MailMergeFields Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Returns a MailMergeField object that represents a mail merge field added to the data source document.
AddAsk | Adds an ASK field to a mail merge main document. Returns a MailMergeField object.
AddFillIn | Adds a FILLIN field to a mail merge main document. Returns a MailMergeField object.
AddIf | Adds an IF field to a mail merge main document. Returns a MailMergeField object.
AddMergeRec | Adds a MERGEREC field to a mail merge main document. Returns a MailMergeField object.
AddMergeSeq | Adds a MERGESEQ field to a mail merge main document. Returns a MailMergeField object.
AddNext | Adds a NEXT field to a mail merge main document. Returns a MailMergeField object.
AddNextIf | Adds a NEXTIF field to a mail merge main document. Returns a MailMergeField object.
AddSet | Adds a SET field to a mail merge main document. Returns a MailMergeField object.
AddSkipIf | Adds a SKIPIF field to a mail merge main document. Returns a MailMergeField object. .
Item | Returns an individual MailMergeField object in a collection.


MailMergeFields.Add Method (Word)

 Copy code hover
[image]

MailMergeFields.Add Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a MailMergeField object that represents a mail merge field added to the data source document.

Syntax

expression .Add(Range, Name)

expression Required. A variable that represents a MailMergeFields collection.

Parameters

Name | Required/Optional | Data Type | Description
Range | Required | Range | The range where you want the field to appear. This field replaces the range, if the range isn't collapsed.
Name | Required | String | The name of the field.

Return Value

MailMergeField

Example

This example replaces the selection with a mail merge field named MiddleInitial.

VBA Copy code Copy code
ActiveDocument.MailMerge.Fields.Add Range:=Selection.Range, _
 Name:="MiddleInitial"

See also

Concepts

MailMergeFields Collection Object

Other resources

MailMergeFields Object Members


MailMergeFields.AddAsk Method (Word)

 Copy code hover
[image]

MailMergeFields.AddAsk Method (Word)
See also Send feedback

Published: July 16, 2012

Adds an ASK field to a mail merge main document. Returns a MailMergeField object.

Syntax

expression .AddAsk(Range, Name, Prompt, DefaultAskText, AskOnce)

expression Required. A variable that represents a MailMergeFields collection.

Parameters

Name | Required/Optional | Data Type | Description
Range | Required | Range object | The location for the ASK field.
Name | Required | String | The bookmark name that the response or default text is assigned to. Use a REF field with the bookmark name to display the result in a document.
Prompt | Optional | Variant | The text that's displayed in the dialog box.
DefaultAskText | Optional | Variant | The default response, which appears in the text box when the dialog box is displayed. Corresponds to the \d switch for an ASK field.
AskOnce | Optional | Variant | True to display the dialog box only once instead of each time a new record is merged. Corresponds to the \o switch for an ASK field.

Return Value

MailMergeField

Remarks

When updated, an ASK field displays a dialog box that prompts you for text to assign to the specified bookmark.

Example

This example adds an ASK field at the end of the active mail merge main document.

VBA Copy code Copy code
Dim rngTemp As Range

Set rngTemp = ActiveDocument.Content

rngTemp.Collapse Direction:=wdCollapseEnd
ActiveDocument.MailMerge.Fields.AddAsk _
 Range:=rngTemp, _
 Prompt:="Type your company name", _
 Name:="company", AskOnce:=True

This example adds an ASK field after the last mail merge field in Main.doc.

VBA Copy code Copy code
Dim colMailMergeFields As Object
Dim rngTemp As Range

Set colMailMergeFields = Documents("Main.doc").MailMerge.Fields

colMailMergeFields(colMailMergeFields.Count).Select

Set rngTemp = Selection.Range

rngTemp.Collapse wdCollapseEnd
colMailMergeFields.AddAsk Range:=rngTemp, Name:="name", _
 Prompt:="What is your name"

See also

Concepts

MailMergeFields Collection Object

Other resources

MailMergeFields Object Members


MailMergeFields.AddFillIn Method (Word)

 Copy code hover
[image]

MailMergeFields.AddFillIn Method (Word)
See also Send feedback

Published: July 16, 2012

Adds a FILLIN field to a mail merge main document. Returns a MailMergeField object.

Syntax

expression .AddFillIn(Range, Prompt, DefaultFillInText, AskOnce)

expression Required. A variable that represents a MailMergeFields collection.

Parameters

Name | Required/Optional | Data Type | Description
Range | Required | Range object | The location for the FILLIN field.
Prompt | Optional | Variant | The text that's displayed in the dialog box.
DefaultFillinText | Optional | Variant | The default response, which appears in the text box when the dialog box is displayed. Corresponds to the \d switch for an FILLIN field.
AskOnce | Optional | Variant | True to display the prompt only once instead of each time a new record is merged. Corresponds to the \o switch for a FILLIN field. The default value is False.

Return Value

MailMergeField

Remarks

When updated, a FILLIN field displays a dialog box that prompts you for text to insert into the document at the location of the FILLIN field. Use the Add method with the Fields collection object to add a FILLIN field to a document other than a mail merge main document.

Example

This example adds a FILLIN field that prompts you for a name to insert after "Name:".

VBA Copy code Copy code
With Selection
 .Collapse Direction:=wdCollapseStart
 .InsertAfter "Name: "
 .Collapse Direction:=wdCollapseEnd
End With
ActiveDocument.MailMerge.Fields.AddFillin Range:=Selection.Range, _
 Prompt:="Your name?", DefaultFillInText:="Joe", AskOnce:=True

See also

Concepts

MailMergeFields Collection Object

Other resources

MailMergeFields Object Members


MailMergeFields.AddIf Method (Word)

 Copy code hover
[image]

MailMergeFields.AddIf Method (Word)
See also Send feedback

Published: July 16, 2012

Adds an IF field to a mail merge main document. Returns a MailMergeField object.

Syntax

expression .AddIf(Range, MergeField, Comparison, CompareTo, TrueAutoText, TrueText, FalseAutoText, FalseText)

expression Required. A variable that represents a MailMergeFields collection.

Parameters

Name | Required/Optional | Data Type | Description
Range | Required | Range object | The location for the IF field.
MergeField | Required | String | The merge field name.
Comparison | Required | WdMailMergeComparison | The operator used in the comparison.
CompareTo | Optional | Variant | The text to compare with the contents of MergeField.
TrueAutoText | Optional | Variant | The AutoText entry that's inserted if the comparison is true. If this argument is specified, TrueText is ignored.
TrueText | Optional | Variant | The text that's inserted if the comparison is true.
FalseAutoText | Optional | Variant | The AutoText entry that's inserted if the comparison is false. If this argument is specified, FalseText is ignored.
FalseText | Optional | Variant | The text that's inserted if the comparison is false.

Return Value

MailMergeField

Remarks

When updated, an IF field compares a field in a record with a specified value, and then it inserts the appropriate text according to the result of the comparison.

Example

This example inserts "for your personal use" if the Company merge field is blank and "for your business" if the Company merge field is not blank.

VBA Copy code Copy code
ActiveDocument.MailMerge.Fields.AddIf Range:=Selection.Range, _
 MergeField:="Company", Comparison:=wdMergeIfIsBlank, _
 TrueText:="for your personal use", _
 FalseText:="for your business"

See also

Concepts

MailMergeFields Collection Object

Other resources

MailMergeFields Object Members


MailMergeFields.AddMergeRec Method (Word)

 Copy code hover
[image]

MailMergeFields.AddMergeRec Method (Word)
See also Send feedback

Published: July 16, 2012

Adds a MERGEREC field to a mail merge main document. Returns a MailMergeField object.

Syntax

expression .AddMergeRec(Range)

expression Required. A variable that represents a MailMergeFields collection.

Parameters

Name | Required/Optional | Data Type | Description
Range | Required | Range object | The location for the MERGEREC field.

Return Value

MailMergeField

Remarks

A MERGEREC field inserts the number of the current record (the position of the record in the current query result) during a mail merge.

Example

This example inserts text and a MERGEREC field at the beginning of the active document.

VBA Copy code Copy code
Dim rngTemp As Range

Set rngTemp = ActiveDocument.Range(Start:=0, End:=0)

ActiveDocument.MailMerge.Fields.AddMergeRec Range:=rngTemp
rngTemp.InsertAfter "Record Number: "

See also

Concepts

MailMergeFields Collection Object

Other resources

MailMergeFields Object Members


MailMergeFields.AddMergeSeq Method (Word)

 Copy code hover
[image]

MailMergeFields.AddMergeSeq Method (Word)
See also Send feedback

Published: July 16, 2012

Adds a MERGESEQ field to a mail merge main document. Returns a MailMergeField object.

Syntax

expression .AddMergeSeq(Range)

expression Required. A variable that represents a MailMergeFields collection.

Parameters

Name | Required/Optional | Data Type | Description
Range | Required | Range object | The location for the MERGESEQ field.

Return Value

MailMergeField

Remarks

A MERGESEQ field inserts a number based on the sequence in which records are merged (for example, when record 50 of records 50 to 100 is merged, MERGESEQ inserts the number 1).

Example

This example inserts text and a MERGESEQ field at the end of the active document.

VBA Copy code Copy code
Dim rngTemp As Range

Set rngTemp = ActiveDocument.Content

rngTemp.Collapse Direction:=wdCollapseEnd
ActiveDocument.MailMerge.Fields.AddMergeSeq Range:=rngTemp
rngTemp.InsertAfter "Sequence Number: "

See also

Concepts

MailMergeFields Collection Object

Other resources

MailMergeFields Object Members


MailMergeFields.AddNext Method (Word)

 Copy code hover
[image]

MailMergeFields.AddNext Method (Word)
See also Send feedback

Published: July 16, 2012

Adds a NEXT field to a mail merge main document. Returns a MailMergeField object.

Syntax

expression .AddNext(Range)

expression Required. A variable that represents a MailMergeFields collection.

Parameters

Name | Required/Optional | Data Type | Description
Range | Required | Range object | The location for the NEXT field.

Return Value

MailMergeField

Remarks

A NEXT field advances to the next record so that data from more than one record can be merged into the same merge document (for example, a sheet of mailing labels).

Example

This example adds a NEXT field after the third MERGEFIELD field in Main.doc.

VBA Copy code Copy code
Documents("Main.doc").MailMerge.Fields(3).Select
Selection.Collapse Direction:=wdCollapseEnd
Documents("Main.doc").MailMerge.Fields.AddNext _
 Range:=Selection.Range

See also

Concepts

MailMergeFields Collection Object

Other resources

MailMergeFields Object Members


MailMergeFields.AddNextIf Method (Word)

 Copy code hover
[image]

MailMergeFields.AddNextIf Method (Word)
See also Send feedback

Published: July 16, 2012

Adds a NEXTIF field to a mail merge main document. Returns a MailMergeField object.

Syntax

expression .AddNextIf(Range, MergeField, Comparison, CompareTo)

expression Required. A variable that represents a MailMergeFields collection.

Parameters

Name | Required/Optional | Data Type | Description
Range | Required | Range object | The location for the NEXTIF field.
MergeField | Required | String | The merge field name.
Comparison | Required | WdMailMergeComparison | The operator used in the comparison.
CompareTo | Required | String | The text to compare with the contents of MergeField.

Return Value

MailMergeField

Remarks

A NEXTIF field compares two expressions, and if the comparison is true, the next record is merged into the current merge document.

Example

This example adds a NEXTIF field before the first MERGEFIELD field in Main.doc. If the next postal code equals 98004, the next record is merged into the current merge document.

VBA Copy code Copy code
Documents("Main.doc").MailMerge.Fields(1).Select
Selection.Collapse Direction:=wdCollapseStart
Documents("Main.doc").MailMerge.Fields.AddNextIf _
 Range:=Selection.Range, MergeField:="PostalCode", _
 Comparison:=wdMergeIfEqual, CompareTo:="98004"

See also

Concepts

MailMergeFields Collection Object

Other resources

MailMergeFields Object Members


MailMergeFields.AddSet Method (Word)

 Copy code hover
[image]

MailMergeFields.AddSet Method (Word)
See also Send feedback

Published: July 16, 2012

Adds a SET field to a mail merge main document. Returns a MailMergeField object.

Syntax

expression .AddSet(Range, Name, ValueText, ValueAutoText)

expression Required. A variable that represents a MailMergeFields collection.

Parameters

Name | Required/Optional | Data Type | Description
Range | Required | Range object | The location for the SET field.
Name | Required | String | The bookmark name that ValueText is assigned to.
ValueText | Optional | Variant | The text associated with the bookmark specified by the Name argument.
ValueAutoText | Optional | Variant | The AutoText entry that includes text associated with the bookmark specified by the Name argument. If this argument is specified, ValueText is ignored.

Return Value

MailMergeField

Remarks

A SET field defines the text of the specified bookmark.

Example

This example adds a SET field at the beginning of the active document and then adds a REF field to display the text after the selection.

VBA Copy code Copy code
Dim rngTemp as Range

Set rngTemp = ActiveDocument.Range(Start:=0, End:=0)

ActiveDocument.MailMerge.Fields.AddSet Range:=rngTemp, _
 Name:="Name", ValueText:="Joe Smith"
Selection.Collapse Direction:=wdCollapseEnd
ActiveDocument.Fields.Add Range:=Selection.Range, _
 Type:=wdFieldRef, Text:="Name"

See also

Concepts

MailMergeFields Collection Object

Other resources

MailMergeFields Object Members


MailMergeFields.AddSkipIf Method (Word)

 Copy code hover
[image]

MailMergeFields.AddSkipIf Method (Word)
See also Send feedback

Published: July 16, 2012

Adds a SKIPIF field to a mail merge main document. Returns a MailMergeField object. .

Syntax

expression .AddSkipIf(Range, MergeField, Comparison, CompareTo)

expression Required. A variable that represents a MailMergeFields collection.

Parameters

Name | Required/Optional | Data Type | Description
Range | Required | Range object | The location for the SKIPIF field.
MergeField | Required | String | The merge field name.
Comparison | Required | WdMailMergeComparison | The operator used in the comparison.
CompareTo | Optional | Variant | The text to compare with the contents of MergeField.

Return Value

MailMergeField

Remarks

A SKIPIF field compares two expressions, and if the comparison is true, SKIPIF moves to the next record in the data source and starts a new merge document.

Example

This example adds a SKIPIF field before the first MERGEFIELD field in Main.doc. If the next postal code equals 98040, the next record is skipped.

VBA Copy code Copy code
Documents("Main.doc").MailMerge.Fields(1).Select
Selection.Collapse Direction:=wdCollapseStart
Documents("Main.doc").MailMerge.Fields.AddSkipIf _
 Range:=Selection.Range, MergeField:="PostalCode", _
 Comparison:=wdMergeIfEqual, CompareTo:="98040"

See also

Concepts

MailMergeFields Collection Object

Other resources

MailMergeFields Object Members


MailMergeFields.Item Method (Word)

 Copy code hover
[image]

MailMergeFields.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual MailMergeField object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents a MailMergeFields collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The individual object to be returned. Can be a Long indicating the ordinal position of the individual object.

Return Value

MailMergeField

See also

Concepts

MailMergeFields Collection Object

Other resources

MailMergeFields Object Members


MailMessage Object (Word)

 Copy code hover
[image]

MailMessage Object (Word)
See also Send feedback

Published: July 16, 2012

Represents the active e-mail message if you are using Microsoft Word as your e-mail editor.

Remarks

Use the MailMessage property to return the MailMessage object. The following example validates the e-mail addresses that appear in the active e-mail message.

VBA Copy code Copy code
Application.MailMessage.CheckName

The methods of the MailMessage object require that you are using Word as your e-mail editor and that an e-mail message is active. If either of these conditions is not true, an error occurs.

See also

Concepts

Word Object Model Reference

Other resources

MailMessage Object Members


MailMessage Members (Word)

 Copy code hover
[image]

MailMessage Members (Word)
Send feedback

Published: July 16, 2012

Represents the active e-mail message if you are using Microsoft Word as your e-mail editor.

Methods

Name | Description
CheckName | Validates the e-mail addresses that appear in the To, Cc, and Bcc lines in the active e-mail message.
Delete | Deletes the specified mail message.
DisplayMoveDialog | Displays the Move dialog box, in which the user can specify a new location for the active e-mail message in an available message store.
DisplayProperties | Displays the Properties dialog box for the active e-mail message.
DisplaySelectNamesDialog | Displays the Select Names dialog box, in which the user can add addresses to the To, Cc, and Bcc lines in the active, unsent e-mail message.
Forward | Opens a new e-mail message with an empty To line for forwarding the active message.
GoToNext | Displays the next mail message if you are using Word as your e-mail editor.
GoToPrevious | Displays the previous mail message if you are using Word as your e-mail editor.
Reply | Opens a new e-mail message — with the sender's address on the To line — for replying to the active message.
ReplyAll | Opens a new e-mail message — with the sender's and all other recipients' addresses on the To and Cc lines, as appropriate — for replying to the active message.
ToggleHeader | Toggles the display of the header in the active e-mail message.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified MailMessage object.


MailMessage Properties (Word)

 Copy code hover
[image]

MailMessage Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified MailMessage object.


MailMessage.Application Property (Word)

 Copy code hover
[image]

MailMessage.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a MailMessage object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

MailMessage Object

Other resources

MailMessage Object Members


MailMessage.Creator Property (Word)

 Copy code hover
[image]

MailMessage.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a MailMessage object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

MailMessage Object

Other resources

MailMessage Object Members


MailMessage.Parent Property (Word)

 Copy code hover
[image]

MailMessage.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified MailMessage object.

Syntax

expression .Parent

expression Required. A variable that represents a MailMessage object.

See also

Concepts

MailMessage Object

Other resources

MailMessage Object Members


MailMessage Methods (Word)

 Copy code hover
[image]

MailMessage Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
CheckName | Validates the e-mail addresses that appear in the To, Cc, and Bcc lines in the active e-mail message.
Delete | Deletes the specified mail message.
DisplayMoveDialog | Displays the Move dialog box, in which the user can specify a new location for the active e-mail message in an available message store.
DisplayProperties | Displays the Properties dialog box for the active e-mail message.
DisplaySelectNamesDialog | Displays the Select Names dialog box, in which the user can add addresses to the To, Cc, and Bcc lines in the active, unsent e-mail message.
Forward | Opens a new e-mail message with an empty To line for forwarding the active message.
GoToNext | Displays the next mail message if you are using Word as your e-mail editor.
GoToPrevious | Displays the previous mail message if you are using Word as your e-mail editor.
Reply | Opens a new e-mail message — with the sender's address on the To line — for replying to the active message.
ReplyAll | Opens a new e-mail message — with the sender's and all other recipients' addresses on the To and Cc lines, as appropriate — for replying to the active message.
ToggleHeader | Toggles the display of the header in the active e-mail message.


MailMessage.CheckName Method (Word)

 Copy code hover
[image]

MailMessage.CheckName Method (Word)
See also Send feedback

Published: July 16, 2012

Validates the e-mail addresses that appear in the To, Cc, and Bcc lines in the active e-mail message.

Syntax

expression .CheckName

expression Required. A variable that represents a MailMessage object.

Remarks

This method is available only if you are using Word as your e-mail editor. If the names cannot be validated, the Check Names dialog box is displayed.

Example

This example validates the e-mail addresses that appear in the active e-mail message.

VBA Copy code Copy code
Application.MailMessage.CheckName

See also

Concepts

MailMessage Object

Other resources

MailMessage Object Members


MailMessage.Delete Method (Word)

 Copy code hover
[image]

MailMessage.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the specified mail message.

Syntax

expression .Delete

expression Required. A variable that represents a MailMessage object.

See also

Concepts

MailMessage Object

Other resources

MailMessage Object Members


MailMessage.DisplayMoveDialog Method (Word)

 Copy code hover
[image]

MailMessage.DisplayMoveDialog Method (Word)
See also Send feedback

Published: July 16, 2012

Displays the Move dialog box, in which the user can specify a new location for the active e-mail message in an available message store.

Syntax

expression .DisplayMoveDialog

expression Required. A variable that represents a MailMessage object.

Remarks

This method is available only if you are using Word as your e-mail editor.

Example

This example displays the Move dialog box for the active e-mail message.

VBA Copy code Copy code
Application.MailMessage.DisplayMoveDialog

See also

Concepts

MailMessage Object

Other resources

MailMessage Object Members


MailMessage.DisplayProperties Method (Word)

 Copy code hover
[image]

MailMessage.DisplayProperties Method (Word)
See also Send feedback

Published: July 16, 2012

Displays the Properties dialog box for the active e-mail message.

Syntax

expression .DisplayProperties

expression Required. A variable that represents a MailMessage object.

Remarks

This method is available only if you are using Word as your e-mail editor.

Example

This example displays the Properties dialog box for the active e-mail message.

VBA Copy code Copy code
Application.MailMessage.DisplayProperties

See also

Concepts

MailMessage Object

Other resources

MailMessage Object Members


MailMessage.DisplaySelectNamesDialog Method (Word)

 Copy code hover
[image]

MailMessage.DisplaySelectNamesDialog Method (Word)
See also Send feedback

Published: July 16, 2012

Displays the Select Names dialog box, in which the user can add addresses to the To, Cc, and Bcc lines in the active, unsent e-mail message.

Syntax

expression .DisplaySelectNamesDialog

expression Required. A variable that represents a MailMessage object.

Remarks

This method is available only if you are using Word as your e-mail editor.

Example

This example displays the Select Names dialog box for the active e-mail message.

VBA Copy code Copy code
Application.MailMessage.DisplaySelectNamesDialog

See also

Concepts

MailMessage Object

Other resources

MailMessage Object Members


MailMessage.Forward Method (Word)

 Copy code hover
[image]

MailMessage.Forward Method (Word)
See also Send feedback

Published: July 16, 2012

Opens a new e-mail message with an empty To line for forwarding the active message.

Syntax

expression .Forward

expression Required. A variable that represents a MailMessage object.

Remarks

This method is available only if you are using Word as your e-mail editor.

Example

This example opens a new e-mail message for forwarding the active message.

VBA Copy code Copy code
Application.MailMessage.Forward

See also

Concepts

MailMessage Object

Other resources

MailMessage Object Members


MailMessage.GoToNext Method (Word)

 Copy code hover
[image]

MailMessage.GoToNext Method (Word)
See also Send feedback

Published: July 16, 2012

Displays the next mail message if you are using Word as your e-mail editor.

Syntax

expression .GoToNext

expression Required. A variable that represents a MailMessage object.

See also

Concepts

MailMessage Object

Other resources

MailMessage Object Members


MailMessage.GoToPrevious Method (Word)

 Copy code hover
[image]

MailMessage.GoToPrevious Method (Word)
See also Send feedback

Published: July 16, 2012

Displays the previous mail message if you are using Word as your e-mail editor.

Syntax

expression .GoToPrevious

expression Required. A variable that represents a MailMessage object.

See also

Concepts

MailMessage Object

Other resources

MailMessage Object Members


MailMessage.Reply Method (Word)

 Copy code hover
[image]

MailMessage.Reply Method (Word)
See also Send feedback

Published: July 16, 2012

Opens a new e-mail message — with the sender's address on the To line — for replying to the active message.

Syntax

expression .Reply

expression A variable that represents a MailMessage object.

Example

This example opens a new e-mail message for replying to the active message.

VBA Copy code Copy code
Application.MailMessage.Reply

See also

Concepts

MailMessage Object

Other resources

MailMessage Object Members


MailMessage.ReplyAll Method (Word)

 Copy code hover
[image]

MailMessage.ReplyAll Method (Word)
See also Send feedback

Published: July 16, 2012

Opens a new e-mail message — with the sender's and all other recipients' addresses on the To and Cc lines, as appropriate — for replying to the active message.

Syntax

expression .ReplyAll

expression Required. A variable that represents a MailMessage object.

Example

This example opens a new e-mail message for replying to the active message.

VBA Copy code Copy code
Application.MailMessage.ReplyAll

See also

Concepts

MailMessage Object

Other resources

MailMessage Object Members


MailMessage.ToggleHeader Method (Word)

 Copy code hover
[image]

MailMessage.ToggleHeader Method (Word)
See also Send feedback

Published: July 16, 2012

Toggles the display of the header in the active e-mail message.

Syntax

expression .ToggleHeader

expression Required. A variable that represents a MailMessage object.

Example

This example switches the display of the header in the active e-mail message on or off.

VBA Copy code Copy code
Application.MailMessage.ToggleHeader

See also

Concepts

MailMessage Object

Other resources

MailMessage Object Members


MappedDataField Object (Word)

 Copy code hover
[image]

MappedDataField Object (Word)
See also Send feedback

Published: July 16, 2012

A mapped data field is a field contained within Microsoft Word that represents commonly used name or address information, such as "First Name." If a data source contains a "First Name" field or a variation (such as "First_Name," "FirstName," "First," or "FName"), the field in the data source will automatically map to the corresponding mapped data field in Word. If a document or template is to be merged with more than one data source, mapped data fields make it unnecessary to reenter the fields into the document to agree with the field names in the database.

Remarks

Use the MappedDataFields property to return a MappedDataField object. This example returns the data source field name for the wdFirstName mapped data field. This example assumes the current document is a mail merge document. A blank string value returned for the DataFieldName property indicates that the mapped data field is not mapped to a field in the data source.

VBA Copy code Copy code
Sub MappedFieldName()

 With ActiveDocument.MailMerge.DataSource
 If .MappedDataFields.Item(wdFirstName).DataFieldName <> "" Then
 MsgBox "The mapped data field 'FirstName' is mapped to " _
 & .MappedDataFields(Index:=wdFirstName) _
 .DataFieldName & "."
 Else
 MsgBox "The mapped data field 'FirstName' is not " & _
 "mapped to any of the data fields in your " & _
 "data source."
 End If

 End With

End Sub

See also

Concepts

Word Object Model Reference

Other resources

MappedDataField Object Members


MappedDataField Members (Word)

 Copy code hover
[image]

MappedDataField Members (Word)
Send feedback

Published: July 16, 2012

A mapped data field is a field contained within Microsoft Word that represents commonly used name or address information, such as "First Name." If a data source contains a "First Name" field or a variation (such as "First_Name," "FirstName," "First," or "FName"), the field in the data source will automatically map to the corresponding mapped data field in Word. If a document or template is to be merged with more than one data source, mapped data fields make it unnecessary to reenter the fields into the document to agree with the field names in the database.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
DataFieldIndex | Returns or sets a Long that represents the corresponding field number in the mail merge data source to which a mapped data field maps. Read/write.
DataFieldName | Sets or returns a String that represents the name of the field in the mail merge data source to which a mapped data field maps. Read/write.
Index | Returns a Long that represents the position of an item in a collection. Read-only.
Name | Returns name of the specified object. Read-only String.
Parent | Returns an Object that represents the parent object of the specified MappedDataField object.
Value | Returns the contents of the mail merge data field or mapped data field for the current record. Read-only String.


MappedDataField Properties (Word)

 Copy code hover
[image]

MappedDataField Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
DataFieldIndex | Returns or sets a Long that represents the corresponding field number in the mail merge data source to which a mapped data field maps. Read/write.
DataFieldName | Sets or returns a String that represents the name of the field in the mail merge data source to which a mapped data field maps. Read/write.
Index | Returns a Long that represents the position of an item in a collection. Read-only.
Name | Returns name of the specified object. Read-only String.
Parent | Returns an Object that represents the parent object of the specified MappedDataField object.
Value | Returns the contents of the mail merge data field or mapped data field for the current record. Read-only String.


MappedDataField.Application Property (Word)

 Copy code hover
[image]

MappedDataField.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a MappedDataField object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

MappedDataField Object

Other resources

MappedDataField Object Members


MappedDataField.Creator Property (Word)

 Copy code hover
[image]

MappedDataField.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a MappedDataField object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

MappedDataField Object

Other resources

MappedDataField Object Members


MappedDataField.DataFieldIndex Property (Word)

 Copy code hover
[image]

MappedDataField.DataFieldIndex Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Long that represents the corresponding field number in the mail merge data source to which a mapped data field maps. Read/write.

Syntax

expression .DataFieldIndex

expression A variable that represents a MappedDataField object.

Remarks

This property returns zero if the specified data field is not mapped to a mapped data field.

Example

This example maps the PostalAddress1 field in the data source to the wdAddress1 mapped data field. This example assumes that the current document is a mail merge document.

VBA Copy code Copy code
Sub MapField()
 With ActiveDocument.MailMerge.DataSource
 .MappedDataFields(wdAddress1).DataFieldIndex = _
 .FieldNames("PostalAddress1").Index
 End With
End Sub

See also

Concepts

MappedDataField Object

Other resources

MappedDataField Object Members


MappedDataField.DataFieldName Property (Word)

 Copy code hover
[image]

MappedDataField.DataFieldName Property (Word)
See also Send feedback

Published: July 16, 2012

Sets or returns a String that represents the name of the field in the mail merge data source to which a mapped data field maps. Read/write.

Syntax

expression .DataFieldName

expression An expression that returns a MappedDataField object.

Remarks

A blank string is returned if the specified data field is not mapped to a mapped data field.

Example

This example creates a tabbed list of the mapped data fields available in Word and the fields in the data source to which they are mapped. This example assumes that the current document is a mail merge document and that the data source fields have corresponding mapped data fields.

VBA Copy code Copy code
Sub MappedFields()
 Dim intCount As Integer
 Dim docCurrent As Document
 Dim docNew As Document

 On Error Resume Next

 Set docCurrent = ActiveDocument
 Set docNew = Documents.Add

 'Add leader tab to new document
 docNew.Paragraphs.TabStops.Add _
 Position:=InchesToPoints(3.5), _
 Leader:=wdTabLeaderDots

 With docCurrent.MailMerge.DataSource

 'Insert heading paragraph for tabbed columns
 docNew.Content.InsertAfter "Word Mapped Data Field" _
 & vbTab & "Data Source Field"

 Do
 intCount = intCount + 1

 'Insert Word mapped data field name and the
 'corresponding data source field name
 docNew.Content.InsertAfter .MappedDataFields( _
 Index:=intCount).Name & vbTab & _
 .MappedDataFields(Index:=intCount) _
 .DataFieldName

 'Insert paragraph
 docNew.Content.InsertParagraphAfter
 Loop Until intCount = .MappedDataFields.Count

 End With

End Sub

See also

Concepts

MappedDataField Object

Other resources

MappedDataField Object Members


MappedDataField.Index Property (Word)

 Copy code hover
[image]

MappedDataField.Index Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the position of an item in a collection. Read-only.

Syntax

expression .Index

expression Required. A variable that represents a MappedDataField object.

See also

Concepts

MappedDataField Object

Other resources

MappedDataField Object Members


MappedDataField.Name Property (Word)

 Copy code hover
[image]

MappedDataField.Name Property (Word)
See also Send feedback

Published: July 16, 2012

Returns name of the specified object. Read-only String.

Syntax

expression .Name

expression Required. A variable that represents a MappedDataField object.

See also

Concepts

MappedDataField Object

Other resources

MappedDataField Object Members


MappedDataField.Parent Property (Word)

 Copy code hover
[image]

MappedDataField.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified MappedDataField object.

Syntax

expression .Parent

expression Required. A variable that represents a MappedDataField object.

See also

Concepts

MappedDataField Object

Other resources

MappedDataField Object Members


MappedDataField.Value Property (Word)

 Copy code hover
[image]

MappedDataField.Value Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the contents of the mail merge data field or mapped data field for the current record. Read-only String.

Syntax

expression .Value

expression Required. A variable that represents a MappedDataField object.

Remarks

Use the ActiveRecord property to set the active record in a mail merge data source.

Example

This example displays the contents of the active record in the data source attached to Main.doc.

VBA Copy code Copy code
For Each dataF In _
 Documents("Main.doc").MailMerge.DataSource.DataFields
 If dataF.Value <> "" Then dRecord = dRecord & _
 dataF.Value & vbCr
Next dataF
MsgBox dRecord

See also

Concepts

MappedDataField Object

Other resources

MappedDataField Object Members


MappedDataFields Object (Word)

 Copy code hover
[image]

MappedDataFields Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of MappedDataField objects that represents all the mapped data fields available in Microsoft Word.

Remarks

Use the MappedDataFields property of the MailMergeDataSource object to return the MappedDataFields collection. This example creates a tabbed list of the mapped data fields available in Word and the fields in the data source to which they are mapped. This example assumes that the current document is a mail merge document and that the data source fields have corresponding mapped data fields.

VBA Copy code Copy code
Sub MappedFields()
 Dim intCount As Integer
 Dim docCurrent As Document
 Dim docNew As Document

 On Error Resume Next

 Set docCurrent = ActiveDocument
 Set docNew = Documents.Add

 'Add leader tab to new document
 docNew.Paragraphs.TabStops.Add _
 Position:=InchesToPoints(3.5), _
 Leader:=wdTabLeaderDots

 With docCurrent.MailMerge.DataSource

 'Insert heading paragraph for tabbed columns
 docNew.Content.InsertAfter "Word Mapped Data Field" _
 & vbTab & "Data Source Field"

 Do
 intCount = intCount + 1

 'Insert Word mapped data field name and the
 'corresponding data source field name
 docNew.Content.InsertAfter .MappedDataFields( _
 Index:=intCount).Name & vbTab & _
 .MappedDataFields(Index:=intCount) _
 .DataFieldName

 'Insert paragraph
 docNew.Content.InsertParagraphAfter
 Loop Until intCount = .MappedDataFields.Count

 End With

End Sub

See also

Concepts

Word Object Model Reference

Other resources

MappedDataFields Object Members


MappedDataFields Members (Word)

 Copy code hover
[image]

MappedDataFields Members (Word)
Send feedback

Published: July 16, 2012

A collection of MappedDataField objects that represents all the mapped data fields available in Microsoft Word.

Methods

Name | Description
Item | Returns an individual MappedDataField object.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of mapped data fields in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified MappedDataFields object.


MappedDataFields Properties (Word)

 Copy code hover
[image]

MappedDataFields Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of mapped data fields in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified MappedDataFields object.


MappedDataFields.Application Property (Word)

 Copy code hover
[image]

MappedDataFields.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a MappedDataFields collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

MappedDataFields Collection

Other resources

MappedDataFields Object Members


MappedDataFields.Count Property (Word)

 Copy code hover
[image]

MappedDataFields.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of mapped data fields in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents a MappedDataFields collection.

See also

Concepts

MappedDataFields Collection

Other resources

MappedDataFields Object Members


MappedDataFields.Creator Property (Word)

 Copy code hover
[image]

MappedDataFields.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a MappedDataFields collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

MappedDataFields Collection

Other resources

MappedDataFields Object Members


MappedDataFields.Parent Property (Word)

 Copy code hover
[image]

MappedDataFields.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified MappedDataFields object.

Syntax

expression .Parent

expression Required. A variable that represents a MappedDataFields collection.

See also

Concepts

MappedDataFields Collection

Other resources

MappedDataFields Object Members


MappedDataFields Methods (Word)

 Copy code hover
[image]

MappedDataFields Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Item | Returns an individual MappedDataField object.


MappedDataFields.Item Method (Word)

 Copy code hover
[image]

MappedDataFields.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual MappedDataField object.

Syntax

expression .Item(Index)

expression Required. A variable that represents a MappedDataFields collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | WdMappedDataFields | The specified mapped data field.

Return Value

MappedDataField

See also

Concepts

MappedDataFields Collection

Other resources

MappedDataFields Object Members


OLEFormat Object (Word)

 Copy code hover
[image]

OLEFormat Object (Word)
See also Send feedback

Published: July 16, 2012

Represents the OLE characteristics (other than linking) for an OLE object, ActiveX control, or field.

Remarks

Use the OLEFormat property for a shape, inline shape, or field to return the OLEFormat object. The following example displays the class type for the first shape on the active document.

VBA Copy code Copy code
MsgBox ActiveDocument.Shapes(1).OLEFormat.ClassType

Not all types of shapes, inline shapes, and fields have OLE capabilities. Use the Type property for the Shape and InlineShape objects to determine what category the specified shape or inline shape falls into. The Type property for a Field object returns the type of field.

You can use the Activate, Edit, Open, and DoVerb methods to automate an OLE object.

Use the Object property to return an object that represents an ActiveX control or OLE object. With this object, you can use the properties and methods of the container application or the ActiveX control.

See also

Concepts

Word Object Model Reference

Other resources

OLEFormat Object Members


OLEFormat Members (Word)

 Copy code hover
[image]

OLEFormat Members (Word)
Send feedback

Published: July 16, 2012

Represents the OLE characteristics (other than linking) for an OLE object, ActiveX control, or field.

Methods

Name | Description
Activate | Activates the specified OLEFormat object.
ActivateAs | Sets the Windows registry value that determines the default application used to activate the specified OLE object.
ConvertTo | Converts the specified OLE object from one class to another, making it possible for you to edit the object in a different server application, or changing how the object is displayed in the document.
DoVerb | Requests that an OLE object perform one of its available verbs — the actions an OLE object takes to activate its contents.
Edit | Opens the specified OLE object for editing in the application it was created in.
Open | Opens the specified OLEFormat object.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
ClassType | Returns or sets the class type for the specified OLE object, picture, or field. Read/write String.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
DisplayAsIcon | True if the specified object is displayed as an icon. Read/write Boolean.
IconIndex | Returns or sets the icon that is used when the DisplayAsIcon property is True. Read/write Long.
IconLabel | Returns or sets the text displayed below the icon for an OLE object. Read/write String.
IconName | Returns or sets the program file in which the icon for an OLE object is stored. Read/write String.
IconPath | Returns the path of the file in which the icon for an OLE object is stored. Read-only String.
Label | Returns a string that's used to identify the portion of the source file that's being linked. Read-only String.
Object | Returns an Object that represents the specified OLE object's top-level interface. .
Parent | Returns an Object that represents the parent object of the specified OLEFormat object.
PreserveFormattingOnUpdate | True preserves formatting done in Microsoft Word to a linked OLE object, such as a table linked to a Microsoft Excel spreadsheet. Read/write Boolean.
ProgID | Returns the programmatic identifier (ProgID) for the specified OLE object. Read-only String.


OLEFormat Properties (Word)

 Copy code hover
[image]

OLEFormat Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
ClassType | Returns or sets the class type for the specified OLE object, picture, or field. Read/write String.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
DisplayAsIcon | True if the specified object is displayed as an icon. Read/write Boolean.
IconIndex | Returns or sets the icon that is used when the DisplayAsIcon property is True. Read/write Long.
IconLabel | Returns or sets the text displayed below the icon for an OLE object. Read/write String.
IconName | Returns or sets the program file in which the icon for an OLE object is stored. Read/write String.
IconPath | Returns the path of the file in which the icon for an OLE object is stored. Read-only String.
Label | Returns a string that's used to identify the portion of the source file that's being linked. Read-only String.
Object | Returns an Object that represents the specified OLE object's top-level interface. .
Parent | Returns an Object that represents the parent object of the specified OLEFormat object.
PreserveFormattingOnUpdate | True preserves formatting done in Microsoft Word to a linked OLE object, such as a table linked to a Microsoft Excel spreadsheet. Read/write Boolean.
ProgID | Returns the programmatic identifier (ProgID) for the specified OLE object. Read-only String.


OLEFormat.Application Property (Word)

 Copy code hover
[image]

OLEFormat.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents an OLEFormat object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

OLEFormat Object

Other resources

OLEFormat Object Members


OLEFormat.ClassType Property (Word)

 Copy code hover
[image]

OLEFormat.ClassType Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the class type for the specified OLE object, picture, or field. Read/write String.

Syntax

expression .ClassType

expression A variable that represents a OLEFormat object.

Remarks

This property is read-only for linked objects other than DDE links.

You can see a list of the available applications in the Object type box on the Create New tab in the Object dialog box (Insert menu). You can find the ClassType string by inserting an object as an inline shape and then viewing the field codes. The class type of the object follows either the word "EMBED" or the word "LINK."

Example

This example loops through all the floating shapes on the active document and sets all linked Microsoft Excel worksheets to be updated automatically.

VBA Copy code Copy code
Dim shapeLoop As Shape

For Each shapeLoop In ActiveDocument.Shapes
 With shapeLoop
 If .Type = msoLinkedOLEObject Then
 If .OLEFormat.ClassType = "Excel.Sheet" Then
 .LinkFormat.AutoUpdate = True
 End If
 End If
 End With
Next

See also

Concepts

OLEFormat Object

Other resources

OLEFormat Object Members


OLEFormat.Creator Property (Word)

 Copy code hover
[image]

OLEFormat.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents an OLEFormat object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

OLEFormat Object

Other resources

OLEFormat Object Members


OLEFormat.DisplayAsIcon Property (Word)

 Copy code hover
[image]

OLEFormat.DisplayAsIcon Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified object is displayed as an icon. Read/write Boolean.

Syntax

expression .DisplayAsIcon

expression A variable that represents a OLEFormat object.

Example

This example displays a message box containing the name of each floating shape that's displayed as an icon on the active document.

VBA Copy code Copy code
Dim shapeLoop As Shape

For Each shapeLoop In ActiveDocument.Shapes
 If shapeLoop.OLEFormat.DisplayAsIcon Then
 MsgBox shapeLoop.Name & " is displayed as an icon."
 End If
Next shapeLoop

This example inserts a Microsoft Excel worksheet as a linked OLE object on the active document and then changes the display of the object to an icon.

VBA Copy code Copy code
Dim objNew As Object

Set objNew = ActiveDocument.Shapes.AddOLEObject _
 (FileName:="C:\Program Files\Microsoft Office" _
 & "\Office\Samples\samples.xls", LinkToFile:=True)

objNew.OLEFormat.DisplayAsIcon = True

See also

Concepts

OLEFormat Object

Other resources

OLEFormat Object Members


OLEFormat.IconIndex Property (Word)

 Copy code hover
[image]

OLEFormat.IconIndex Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the icon that is used when the DisplayAsIcon property is True. Read/write Long.

Syntax

expression .IconIndex

expression An expression that returns an OLEFormat object.

Remarks

Zero (0) corresponds to the first icon, 1 corresponds to the second icon, and so on. If this argument is omitted, the first (default) icon is used.

Example

This example returns the icon index number in a message box for the first selected shape that's displayed as an icon.

VBA Copy code Copy code
Dim olefTemp As OLEFormat

If Selection.ShapeRange.Count >= 1 Then
 Set olefTemp = Selection.ShapeRange(1).OLEFormat
 With olefTemp
 If .DisplayAsIcon = True Then Msgbox .IconIndex
 End With
End If

See also

Concepts

OLEFormat Object

Other resources

OLEFormat Object Members


OLEFormat.IconLabel Property (Word)

 Copy code hover
[image]

OLEFormat.IconLabel Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the text displayed below the icon for an OLE object. Read/write String.

Syntax

expression .IconLabel

expression An expression that returns an OLEFormat object.

Example

This example changes the text below the icon for the first shape in the selection.

VBA Copy code Copy code
Dim olefTemp As OLEFormat

If Selection.ShapeRange.Count >= 1 Then
 Set olefTemp = Selection.ShapeRange(1).OLEFormat
 With olefTemp
 .DisplayAsIcon = True
 .IconLabel = "My Icon"
 End With
End If

See also

Concepts

OLEFormat Object

Other resources

OLEFormat Object Members


OLEFormat.IconName Property (Word)

 Copy code hover
[image]

OLEFormat.IconName Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the program file in which the icon for an OLE object is stored. Read/write String.

Syntax

expression .IconName

expression An expression that returns an OLEFormat object.

Example

This example changes the first shape in the selection to be displayed as an icon and sets the text below the icon to the icon's file name.

VBA Copy code Copy code
Dim olefTemp As OLEFormat

If Selection.ShapeRange.Count >= 1 Then
 Set olefTemp = Selection.ShapeRange(1).OLEFormat
 With olefTemp
 .DisplayAsIcon = True
 .IconLabel = .IconName
 End With
End If

See also

Concepts

OLEFormat Object

Other resources

OLEFormat Object Members


OLEFormat.IconPath Property (Word)

 Copy code hover
[image]

OLEFormat.IconPath Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the path of the file in which the icon for an OLE object is stored. Read-only String.

Syntax

expression .IconPath

expression An expression that returns an OLEFormat object.

Example

This example displays the path for each embedded OLE object that's displayed as an icon on the active document.

VBA Copy code Copy code
Dim shapeLoop As Shape

For Each shapeLoop In ActiveDocument.Shapes
 If shapeLoop.Type = msoEmbeddedOLEObject Then
 If shapeLoop.OLEFormat.DisplayAsIcon = True Then _
 Msgbox shapeLoop.OLEFormat.IconPath
 End If
Next shapeLoop

See also

Concepts

OLEFormat Object

Other resources

OLEFormat Object Members


OLEFormat.Label Property (Word)

 Copy code hover
[image]

OLEFormat.Label Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a string that's used to identify the portion of the source file that's being linked. Read-only String.

Syntax

expression .Label

expression An expression that returns an OLEFormat object.

Remarks

If the source file is a Microsoft Excel workbook, the Label property might return "Workbook1!R3C1:R4C2" if the OLE object contains only a few cells from the worksheet.

This property works only for shapes, inline shapes, or fields that are linked OLE objects.

Example

This example returns the label for the first field in the active document.

VBA Copy code Copy code
MsgBox ActiveDocument.Fields(1).OLEFormat.Label

See also

Concepts

OLEFormat Object

Other resources

OLEFormat Object Members


OLEFormat.Object Property (Word)

 Copy code hover
[image]

OLEFormat.Object Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the specified OLE object's top-level interface. .

Syntax

expression .Object

expression An expression that returns an OLEFormat object.

Remarks

This property allows you to access the properties and methods of an ActiveX control or the application in which an OLE object was created. The OLE object must support OLE Automation for this property to work.

Example

This example sets the value of the first shape on the active document. For the example to work, this first shape must be an ActiveX control (for example, a check box or an option button).

VBA Copy code Copy code
With ActiveDocument.Shapes(1).OLEFormat
 .Activate
 Set myObj = .Object
End With
myObj.Value = True

This example adds a new ActiveX control to the active document. The example then activates the new option button and sets some of its properties.

VBA Copy code Copy code
Set myOB = ActiveDocument.Shapes _
 .AddOLEControl(ClassType:="Forms.OptionButton.1")
With myOB.OLEFormat
 .Activate
 Set myObj = .Object
End With
With myObj
 .Value = False
 .Caption = "My Caption"
 .AutoSize = True
End With

See also

Concepts

OLEFormat Object

Other resources

OLEFormat Object Members


OLEFormat.Parent Property (Word)

 Copy code hover
[image]

OLEFormat.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified OLEFormat object.

Syntax

expression .Parent

expression Required. A variable that represents an OLEFormat object.

See also

Concepts

OLEFormat Object

Other resources

OLEFormat Object Members


OLEFormat.PreserveFormattingOnUpdate Property (Word)

 Copy code hover
[image]

OLEFormat.PreserveFormattingOnUpdate Property (Word)
See also Send feedback

Published: July 16, 2012

True preserves formatting done in Microsoft Word to a linked OLE object, such as a table linked to a Microsoft Excel spreadsheet. Read/write Boolean.

Syntax

expression .PreserveFormattingOnUpdate

expression A variable that represents a OLEFormat object.

Remarks

When PreserveFormattingOnUpdate is set to True, formatting changes made to the object in Word is preserved when the object is updated. Word updates only the content in the linked object.

Example

This example preserves the formatting of the first shape in the current document, assuming the first shape in the document is a linked OLE object.

VBA Copy code Copy code
Sub PreserveFmtg()
 ActiveDocument.Shapes(1).OLEFormat _
 .PreserveFormattingOnUpdate = True
End Sub

See also

Concepts

OLEFormat Object

Other resources

OLEFormat Object Members


OLEFormat.ProgID Property (Word)

 Copy code hover
[image]

OLEFormat.ProgID Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the programmatic identifier (ProgID) for the specified OLE object. Read-only String.

Syntax

expression .ProgID

expression Required. A variable that represents an OLEFormat object.

Remarks

The ProgID and ClassType properties will (by default) return the same string. However, you can change the ClassType property for DDE links.

Security note Security Note
Dynamic data exchange (DDE) is an older technology that is not secure. If possible, use a more secure alternative to DDE, such as object linking and embedding (OLE).

For information about programmatic identifiers, see OLE Programmatic Identifiers.

Example

This example loops through all the floating shapes in the active document and sets all linked Microsoft Excel worksheets to be updated automatically.

VBA Copy code Copy code
For Each s In ActiveDocument.Shapes
 If s.Type = msoLinkedOLEObject Then
 If s.OLEFormat.ProgID = "Excel.Sheet" Then
 s.LinkFormat.AutoUpdate = True
 End If
 End If
Next

See also

Concepts

OLEFormat Object

Other resources

OLEFormat Object Members


OLEFormat Methods (Word)

 Copy code hover
[image]

OLEFormat Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Activate | Activates the specified OLEFormat object.
ActivateAs | Sets the Windows registry value that determines the default application used to activate the specified OLE object.
ConvertTo | Converts the specified OLE object from one class to another, making it possible for you to edit the object in a different server application, or changing how the object is displayed in the document.
DoVerb | Requests that an OLE object perform one of its available verbs — the actions an OLE object takes to activate its contents.
Edit | Opens the specified OLE object for editing in the application it was created in.
Open | Opens the specified OLEFormat object.


OLEFormat.Activate Method (Word)

 Copy code hover
[image]

OLEFormat.Activate Method (Word)
See also Send feedback

Published: July 16, 2012

Activates the specified OLEFormat object.

Syntax

expression .Activate

expression Required. A variable that represents an OLEFormat object.

See also

Concepts

OLEFormat Object

Other resources

OLEFormat Object Members


OLEFormat.ActivateAs Method (Word)

 Copy code hover
[image]

OLEFormat.ActivateAs Method (Word)
See also Send feedback

Published: July 16, 2012

Sets the Windows registry value that determines the default application used to activate the specified OLE object.

Syntax

expression .ActivateAs(ClassType)

expression Required. A variable that represents an OLEFormat object.

Parameters

Name | Required/Optional | Data Type | Description
ClassType | Required | String | The name of the application in which an OLE object is opened. To see a list of object types that the OLE object can be activated as, click the object and then open the Convert dialog box. You can find the ClassType string by inserting an object as an inline shape and then viewing the field codes. The class type of the object follows either the word "EMBED" or the word "LINK."

Example

This example sets the first floating shape on the active document to open in Microsoft Excel, and then it activates the shape. For the example to work, this shape must be an OLE object that can be opened in Microsoft Excel.

VBA Copy code Copy code
With ActiveDocument.Shapes(1).OLEFormat
 .ActivateAs ClassType:="Excel.Sheet"
 .Activate
End With

See also

Concepts

OLEFormat Object

Other resources

OLEFormat Object Members


OLEFormat.ConvertTo Method (Word)

 Copy code hover
[image]

OLEFormat.ConvertTo Method (Word)
See also Send feedback

Published: July 16, 2012

Converts the specified OLE object from one class to another, making it possible for you to edit the object in a different server application, or changing how the object is displayed in the document.

Syntax

expression .ConvertTo(ClassType, DisplayAsIcon, IconFileName, IconIndex, IconLabel)

expression Required. A variable that represents an OLEFormat object.

Parameters

Name | Required/Optional | Data Type | Description
ClassType | Optional | Variant | The name of the application used to activate the OLE object. You can see a list of the available applications in the Object type box on the Create New tab in the Object dialog box. You can find the ClassType string by inserting an object as an inline shape and then viewing the field codes. The class type of the object follows either the word "EMBED" or the word "LINK."
DisplayAsIcon | Optional | Variant | True to display the OLE object as an icon. The default value is False.
IconFileName | Optional | Variant | The file that contains the icon to be displayed.
IconIndex | Optional | Variant | The index number of the icon within IconFileName. The order of icons in the specified file corresponds to the order in which the icons appear in the Change Icon dialog box (Insert Object dialog box) when the Display as icon check box is selected. The first icon in the file has the index number 0 (zero). If an icon with the given index number doesn't exist in IconFileName, the icon with the index number 1 (the second icon in the file) is used. The default value is 0 (zero).
IconLabel | Optional | Variant | A label (caption) to be displayed beneath the icon.

Example

This example creates a new document, then inserts an embedded Word document with some text. Then, the embedded document is converted to a Word Picture.

VBA Copy code Copy code
Dim objEmbedded As Object

Documents.Add

Set objEmbedded = ActiveDocument.Shapes _
 .AddOLEObject(ClassType:= "Word.Document")
objEmbedded.Activate
Selection.TypeText "Test"
objEmbedded.OLEFormat.OLEFormat.ConvertTo _
 ClassType:="Word.Picture"

See also

Concepts

OLEFormat Object

Other resources

OLEFormat Object Members


OLEFormat.DoVerb Method (Word)

 Copy code hover
[image]

OLEFormat.DoVerb Method (Word)
See also Send feedback

Published: July 16, 2012

Requests that an OLE object perform one of its available verbs — the actions an OLE object takes to activate its contents.

Syntax

expression .DoVerb(VerbIndex)

expression Required. A variable that represents an OLEFormat object.

Parameters

Name | Required/Optional | Data Type | Description
VerbIndex | Optional | Variant | The verb that the OLE object should perform. If this argument is omitted, the default verb is sent. If the OLE object does not support the requested verb, an error will occur. Can be any WdOLEVerb constant.

Remarks

Each OLE object supports a set of verbs that pertain to that object.

Example

This example sends the default verb to the server for the first floating OLE object on the active document.

VBA Copy code Copy code
ActiveDocument.Shapes(1).OLEFormat.DoVerb

See also

Concepts

OLEFormat Object

Other resources

OLEFormat Object Members


OLEFormat.Edit Method (Word)

 Copy code hover
[image]

OLEFormat.Edit Method (Word)
See also Send feedback

Published: July 16, 2012

Opens the specified OLE object for editing in the application it was created in.

Syntax

expression .Edit

expression Required. A variable that represents an OLEFormat object.

Example

This example opens (for editing) the first embedded OLE object (defined as a shape) on the active document.

VBA Copy code Copy code
Dim shapesAll As Shapes

Set shapesAll = ActiveDocument.Shapes
If shapesAll.Count >= 1 Then
 If shapesAll(1).Type = msoEmbeddedOLEObject Then
 shapesAll(1).OLEFormat.Edit
 End If
End If

This example opens (for editing) the first linked OLE object (defined as an inline shape) in the active document.

VBA Copy code Copy code
Dim colIS As InlineShapes

Set colIS = ActiveDocument.InlineShapes
If colIS.Count >= 1 Then
 If colIS(1).Type = wdInlineShapeLinkedOLEObject Then
 colIS(1).OLEFormat.Edit
 End If
End If

See also

Concepts

OLEFormat Object

Other resources

OLEFormat Object Members


OLEFormat.Open Method (Word)

 Copy code hover
[image]

OLEFormat.Open Method (Word)
See also Send feedback

Published: July 16, 2012

Opens the specified OLEFormat object.

Syntax

expression .Open

expression Required. A variable that represents an OLEFormat object.

See also

Concepts

OLEFormat Object

Other resources

OLEFormat Object Members


OMath Object (Word)

 Copy code hover
[image]

OMath Object (Word)
See also Send feedback

Published: July 16, 2012

Represents an equation. OMath objects are members of the OMaths collection.

Remarks

Use the Add method of the OMaths collection to create an equation and add it to a document, selection, or range. The following example creates an equation and uses the BuildUp method to convert the equation to professional format.

VBA Copy code Copy code
Dim objRange As Range
Dim objEq As OMath

Set objRange = Selection.Range
objRange.Text = "Celsius = (5/9)(Fahrenheit - 32)"
Set objRange = Selection.OMaths.Add(objRange)
Set objEq = objRange.OMaths(1)
objEq.BuildUp

See also

Concepts

Word Object Model Reference

Other resources

OMath Object Members


OMath Members (Word)

 Copy code hover
[image]

OMath Members (Word)
Send feedback

Published: July 16, 2012

Represents an equation. OMath objects are members of the OMaths collection.

Methods

Name | Description
BuildUp | Converts an equation to professional format.
ConvertToLiteralText | Converts an equation to literal text.
ConvertToMathText | Converts an equation to math text.
ConvertToNormalText | Converts an equation to normal text.
Linearize | Converts an equation to linear format.
Remove | Removes an equation from the collection of equations in a document, range, or selection.

Properties

Name | Description
AlignPoint | Returns or sets a Long that represents the character position of the alignment point in the equation. Read/write.
Application | Returns an Application object that represents the Microsoft Word application.
ArgIndex | Returns a Long that represents the argument index of this component relative to the containing math object. Read-only.
ArgSize | Returns or sets a Long that represents the script size of an argument, for example, text, script, or script-script. Read/write.
Breaks | Returns an OMathBreaks collection that represents the line breaks in an equation. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
Functions | Returns an OMathFunctions collection that represents the functions contained within an equation. Read-only.
Justification | Returns or sets a WdOMathJc that represents the justification for an equation. Read/write.
NestingLevel | Returns a Long that represents the nesting level for an OMath object. Read-only.
Parent | Returns an Object that represents the parent object of the specified OMath object.
ParentArg | Returns an OMath object that represents the parent, or containing, argument. Read-only.
ParentCol | Returns an OMathMatCol object that represents the parent column in a matrix. Read-only.
ParentFunction | Returns an OMathFunction object that represents the parent, or containing, function. Read-only.
ParentOMath | Returns an OMath object that represents the parent element. Read-only.
ParentRow | Returns an OMathMatRow object that represents the parent row in a matrix. Read-only.
Range | Returns a Range object that represents the portion of a document that is contained in the specified object. Read-only.
Type | Returns or sets a WdOMathType constant that represents whether an equation is displayed inline with the text around it or displayed on its own line. Read/write.


OMath Properties (Word)

 Copy code hover
[image]

OMath Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
AlignPoint | Returns or sets a Long that represents the character position of the alignment point in the equation. Read/write.
Application | Returns an Application object that represents the Microsoft Word application.
ArgIndex | Returns a Long that represents the argument index of this component relative to the containing math object. Read-only.
ArgSize | Returns or sets a Long that represents the script size of an argument, for example, text, script, or script-script. Read/write.
Breaks | Returns an OMathBreaks collection that represents the line breaks in an equation. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
Functions | Returns an OMathFunctions collection that represents the functions contained within an equation. Read-only.
Justification | Returns or sets a WdOMathJc that represents the justification for an equation. Read/write.
NestingLevel | Returns a Long that represents the nesting level for an OMath object. Read-only.
Parent | Returns an Object that represents the parent object of the specified OMath object.
ParentArg | Returns an OMath object that represents the parent, or containing, argument. Read-only.
ParentCol | Returns an OMathMatCol object that represents the parent column in a matrix. Read-only.
ParentFunction | Returns an OMathFunction object that represents the parent, or containing, function. Read-only.
ParentOMath | Returns an OMath object that represents the parent element. Read-only.
ParentRow | Returns an OMathMatRow object that represents the parent row in a matrix. Read-only.
Range | Returns a Range object that represents the portion of a document that is contained in the specified object. Read-only.
Type | Returns or sets a WdOMathType constant that represents whether an equation is displayed inline with the text around it or displayed on its own line. Read/write.


OMath.AlignPoint Property (Word)

 Copy code hover
[image]

OMath.AlignPoint Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Long that represents the character position of the alignment point in the equation. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .AlignPoint

expression An expression that returns an OMath object.

See also

Concepts

OMath Object

Other resources

OMath Object Members


OMath.Application Property (Word)

 Copy code hover
[image]

OMath.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents an OMath object.

See also

Concepts

OMath Object

Other resources

OMath Object Members


OMath.ArgIndex Property (Word)

 Copy code hover
[image]

OMath.ArgIndex Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the argument index of this component relative to the containing math object. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .ArgIndex

expression An expression that returns an OMath object.

See also

Concepts

OMath Object

Other resources

OMath Object Members


OMath.ArgSize Property (Word)

 Copy code hover
[image]

OMath.ArgSize Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Long that represents the script size of an argument, for example, text, script, or script-script. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .ArgSize

expression An expression that returns an OMath object.

See also

Concepts

OMath Object

Other resources

OMath Object Members


OMath.Breaks Property (Word)

 Copy code hover
[image]

OMath.Breaks Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMathBreaks collection that represents the line breaks in an equation. Read-only.

Syntax

expression .Breaks

expression An expression that returns an OMath object.

See also

Concepts

OMath Object

Other resources

OMath Object Members


OMath.Creator Property (Word)

 Copy code hover
[image]

OMath.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.

Syntax

expression .Creator

expression An expression that returns an OMath object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

OMath Object

Other resources

OMath Object Members


OMath.Functions Property (Word)

 Copy code hover
[image]

OMath.Functions Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMathFunctions collection that represents the functions contained within an equation. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Functions

expression An expression that returns an OMath object.

See also

Concepts

OMath Object

Other resources

OMath Object Members


OMath.Justification Property (Word)

 Copy code hover
[image]

OMath.Justification Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a WdOMathJc that represents the justification for an equation. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .Justification

expression An expression that returns an OMath object.

See also

Concepts

OMath Object

Other resources

OMath Object Members


OMath.NestingLevel Property (Word)

 Copy code hover
[image]

OMath.NestingLevel Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the nesting level for an OMath object. Read-only.

Syntax

expression .NestingLevel

expression An expression that returns an OMath object.

See also

Concepts

OMath Object

Other resources

OMath Object Members


OMath.Parent Property (Word)

 Copy code hover
[image]

OMath.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified OMath object.

Syntax

expression .Parent

expression A variable that represents a OMath object.

See also

Concepts

OMath Object

Other resources

OMath Object Members


OMath.ParentArg Property (Word)

 Copy code hover
[image]

OMath.ParentArg Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMath object that represents the parent, or containing, argument. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .ParentArg

expression An expression that returns an OMath object.

See also

Concepts

OMath Object

Other resources

OMath Object Members


OMath.ParentCol Property (Word)

 Copy code hover
[image]

OMath.ParentCol Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMathMatCol object that represents the parent column in a matrix. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .ParentCol

expression An expression that returns an OMath object.

See also

Concepts

OMath Object

Other resources

OMath Object Members


OMath.ParentFunction Property (Word)

 Copy code hover
[image]

OMath.ParentFunction Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMathFunction object that represents the parent, or containing, function. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .ParentFunction

expression An expression that returns an OMath object.

See also

Concepts

OMath Object

Other resources

OMath Object Members


OMath.ParentOMath Property (Word)

 Copy code hover
[image]

OMath.ParentOMath Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMath object that represents the parent element. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .ParentOMath

expression An expression that returns an OMath object.

See also

Concepts

OMath Object

Other resources

OMath Object Members


OMath.ParentRow Property (Word)

 Copy code hover
[image]

OMath.ParentRow Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMathMatRow object that represents the parent row in a matrix. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .ParentRow

expression An expression that returns an OMath object.

See also

Concepts

OMath Object

Other resources

OMath Object Members


OMath.Range Property (Word)

 Copy code hover
[image]

OMath.Range Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the portion of a document that is contained in the specified object. Read-only.

Syntax

expression .Range

expression An expression that returns an OMath object.

See also

Concepts

OMath Object

Other resources

OMath Object Members


OMath.Type Property (Word)

 Copy code hover
[image]

OMath.Type Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a WdOMathType constant that represents whether an equation is displayed inline with the text around it or displayed on its own line. Read/write.

Syntax

expression .Type

expression An expression that returns an OMath object.

Example

The following example creates a new equation and sets it to display inline with the text.

VBA Copy code Copy code
Dim objRange As Range
Dim objEq As OMath

Set objRange = Selection.Range
objRange.Text = "Celsius = (5/9)(Fahrenheit - 32)"
Set objRange = Selection.OMaths.Add(objRange)
Set objEq = objRange.OMaths(1)
objEq.Type = wdOMathInline

See also

Concepts

OMath Object

Other resources

OMath Object Members


OMath Methods (Word)

 Copy code hover
[image]

OMath Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
BuildUp | Converts an equation to professional format.
ConvertToLiteralText | Converts an equation to literal text.
ConvertToMathText | Converts an equation to math text.
ConvertToNormalText | Converts an equation to normal text.
Linearize | Converts an equation to linear format.
Remove | Removes an equation from the collection of equations in a document, range, or selection.


OMath.BuildUp Method (Word)

 Copy code hover
[image]

OMath.BuildUp Method (Word)
See also Send feedback

Published: July 16, 2012

Converts an equation to professional format.

Syntax

expression .BuildUp

expression An expression that returns an OMath object.

Return Value

Nothing

Remarks

To change an equation to linear format, use the Linearize method.

See also

Concepts

OMath Object

Other resources

OMath Object Members


OMath.ConvertToLiteralText Method (Word)

 Copy code hover
[image]

OMath.ConvertToLiteralText Method (Word)
See also Send feedback

Published: July 16, 2012

Converts an equation to literal text.

Version Information

Version Added: Word 2007

Syntax

expression .ConvertToLiteralText

expression An expression that returns an OMath object.

See also

Concepts

OMath Object

Other resources

OMath Object Members


OMath.ConvertToMathText Method (Word)

 Copy code hover
[image]

OMath.ConvertToMathText Method (Word)
See also Send feedback

Published: July 16, 2012

Converts an equation to math text.

Version Information

Version Added: Word 2007

Syntax

expression .ConvertToMathText

expression An expression that returns an OMath object.

See also

Concepts

OMath Object

Other resources

OMath Object Members


OMath.ConvertToNormalText Method (Word)

 Copy code hover
[image]

OMath.ConvertToNormalText Method (Word)
See also Send feedback

Published: July 16, 2012

Converts an equation to normal text.

Version Information

Version Added: Word 2007

Syntax

expression .ConvertToNormalText

expression An expression that returns an OMath object.

See also

Concepts

OMath Object

Other resources

OMath Object Members


OMath.Linearize Method (Word)

 Copy code hover
[image]

OMath.Linearize Method (Word)
See also Send feedback

Published: July 16, 2012

Converts an equation to linear format.

Syntax

expression .Linearize

expression An expression that returns an OMath object.

Return Value

Nothing

Remarks

To change an equation to professional format, use the BuildUp method.

See also

Concepts

OMath Object

Other resources

OMath Object Members


OMath.Remove Method (Word)

 Copy code hover
[image]

OMath.Remove Method (Word)
See also Send feedback

Published: July 16, 2012

Removes an equation from the collection of equations in a document, range, or selection.

Version Information

Version Added: Word 2007

Syntax

expression .Remove

expression An expression that returns a OMath object.

See also

Concepts

OMath Object

Other resources

OMath Object Members


OMathAcc Object (Word)

 Copy code hover
[image]

OMathAcc Object (Word)
See also Send feedback

Published: July 16, 2012

Represents an equation that has an accent mark above the base.

See also

Concepts

Word Object Model Reference

Other resources

OMathAcc Object Members


OMathAcc Members (Word)

 Copy code hover
[image]

OMathAcc Members (Word)
Send feedback

Published: July 16, 2012

Represents an equation that has an accent mark above the base.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Char | Returns or sets an Integer that represents the accent character for the accent object. Read/write.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
E | Returns an OMath object that represents the base of the specified equation object. Read-only.
Parent | Returns an Object that represents the parent object of the specified OMathAcc object.


OMathAcc Properties (Word)

 Copy code hover
[image]

OMathAcc Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Char | Returns or sets an Integer that represents the accent character for the accent object. Read/write.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
E | Returns an OMath object that represents the base of the specified equation object. Read-only.
Parent | Returns an Object that represents the parent object of the specified OMathAcc object.


OMathAcc.Application Property (Word)

 Copy code hover
[image]

OMathAcc.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents an OMathAcc object.

See also

Concepts

OMathAcc Object

Other resources

OMathAcc Object Members


OMathAcc.Char Property (Word)

 Copy code hover
[image]

OMathAcc.Char Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets an Integer that represents the accent character for the accent object. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .Char

expression An expression that returns an OMathAcc object.

See also

Concepts

OMathAcc Object

Other resources

OMathAcc Object Members


OMathAcc.Creator Property (Word)

 Copy code hover
[image]

OMathAcc.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.

Syntax

expression .Creator

expression An expression that returns an OMathAcc object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

OMathAcc Object

Other resources

OMathAcc Object Members


OMathAcc.E Property (Word)

 Copy code hover
[image]

OMathAcc.E Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMath object that represents the base of the specified equation object. Read-only.

Syntax

expression .E

expression An expression that returns an OMathAcc object.

See also

Concepts

OMathAcc Object

Other resources

OMathAcc Object Members


OMathAcc.Parent Property (Word)

 Copy code hover
[image]

OMathAcc.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified OMathAcc object.

Syntax

expression .Parent

expression A variable that represents a OMathAcc object.

See also

Concepts

OMathAcc Object

Other resources

OMathAcc Object Members


OMathArgs Object (Word)

 Copy code hover
[image]

OMathArgs Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a collection of arguments.

Version Information

Version Added: Word 2007

See also

Concepts

Word Object Model Reference

Other resources

OMathArgs Object Members


OMathArgs Members (Word)

 Copy code hover
[image]

OMathArgs Members (Word)
Send feedback

Published: July 16, 2012

Represents a collection of arguments.

Methods

Name | Description
Add | Inserts an argument into an equation with variable number of arguments (OMathDelim and OMathEqArray objects) and returns an OMath object.
Item | Returns an OMath object that represents the specified item in the collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns the number of items in the OMathArgs collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified OMathArgs object.


OMathArgs Properties (Word)

 Copy code hover
[image]

OMathArgs Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns the number of items in the OMathArgs collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified OMathArgs object.


OMathArgs.Application Property (Word)

 Copy code hover
[image]

OMathArgs.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents an OMathArgs collection.

See also

Concepts

OMathArgs Collection

Other resources

OMathArgs Object Members


OMathArgs.Count Property (Word)

 Copy code hover
[image]

OMathArgs.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the number of items in the OMathArgs collection. Read-only Long.

Syntax

expression .Count

expression A variable that represents a OMathArgs object.

See also

Concepts

OMathArgs Collection

Other resources

OMathArgs Object Members


OMathArgs.Creator Property (Word)

 Copy code hover
[image]

OMathArgs.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.

Syntax

expression .Creator

expression An expression that returns an OMathArgs object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

OMathArgs Collection

Other resources

OMathArgs Object Members


OMathArgs.Parent Property (Word)

 Copy code hover
[image]

OMathArgs.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified OMathArgs object.

Syntax

expression .Parent

expression A variable that represents a OMathArgs object.

See also

Concepts

OMathArgs Collection

Other resources

OMathArgs Object Members


OMathArgs Methods (Word)

 Copy code hover
[image]

OMathArgs Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Inserts an argument into an equation with variable number of arguments (OMathDelim and OMathEqArray objects) and returns an OMath object.
Item | Returns an OMath object that represents the specified item in the collection.


OMathArgs.Add Method (Word)

 Copy code hover
[image]

OMathArgs.Add Method (Word)
See also Send feedback

Published: July 16, 2012

Inserts an argument into an equation with variable number of arguments (OMathDelim and OMathEqArray objects) and returns an OMath object.

Version Information

Version Added: Word 2007

Syntax

expression .Add(BeforeArg)

expression An expression that returns a OMathArgs object.

Parameters

Name | Required/Optional | Data Type | Description
BeforeArg | Optional | Variant | An existing argument before which to add the new argument.

Return Value

OMath

See also

Concepts

OMathArgs Collection

Other resources

OMathArgs Object Members


OMathArgs.Item Method (Word)

 Copy code hover
[image]

OMathArgs.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMath object that represents the specified item in the collection.

Syntax

expression .Item(Index)

expression An expression that returns an OMathArgs object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | Specifies the ordinal position of the object within the collection.

Return Value

OMath

See also

Concepts

OMathArgs Collection

Other resources

OMathArgs Object Members


OMathAutoCorrect Object (Word)

 Copy code hover
[image]

OMathAutoCorrect Object (Word)
See also Send feedback

Published: July 16, 2012

Represents the math AutoCorrect feature in Microsoft Word. To access the math AutoCorrect entries, use the OMathAutoCorrectEntries collection.

Version Information

Version Added: Word 2007

See also

Concepts

Word Object Model Reference

Other resources

OMathAutoCorrect Object Members


OMathAutoCorrect Members (Word)

 Copy code hover
[image]

OMathAutoCorrect Members (Word)
Send feedback

Published: July 16, 2012

Represents the math AutoCorrect feature in Microsoft Word. To access the math AutoCorrect entries, use the OMathAutoCorrectEntries collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
Entries | Returns an OMathAutoCorrectEntries collection that represents the collection of equation autocorrect entries within the equation autocorrect feature. Read-only.
Functions | Returns an OMathRecognizedFunctions collection that represents the recognized functions that are automatically corrected using the equation autocorrect feature. Read-only.
Parent | Returns an Object that represents the parent object of the specified OMathAutoCorrect object.
ReplaceText | Returns or sets a Boolean that represents whether Microsoft Word automatically replaces strings in equations with the corresponding math AutoCorrect definitions. Read/write.
UseOutsideOMath | Returns or sets a Boolean that represents whether Microsoft Word uses math autocorrect rules outside equations in a document. Read/write.


OMathAutoCorrect Properties (Word)

 Copy code hover
[image]

OMathAutoCorrect Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
Entries | Returns an OMathAutoCorrectEntries collection that represents the collection of equation autocorrect entries within the equation autocorrect feature. Read-only.
Functions | Returns an OMathRecognizedFunctions collection that represents the recognized functions that are automatically corrected using the equation autocorrect feature. Read-only.
Parent | Returns an Object that represents the parent object of the specified OMathAutoCorrect object.
ReplaceText | Returns or sets a Boolean that represents whether Microsoft Word automatically replaces strings in equations with the corresponding math AutoCorrect definitions. Read/write.
UseOutsideOMath | Returns or sets a Boolean that represents whether Microsoft Word uses math autocorrect rules outside equations in a document. Read/write.


OMathAutoCorrect.Application Property (Word)

 Copy code hover
[image]

OMathAutoCorrect.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents an OMathAutoCorrect object.

See also

Concepts

OMathAutoCorrect Object

Other resources

OMathAutoCorrect Object Members


OMathAutoCorrect.Creator Property (Word)

 Copy code hover
[image]

OMathAutoCorrect.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.

Syntax

expression .Creator

expression An expression that returns an OMathAutoCorrect object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

OMathAutoCorrect Object

Other resources

OMathAutoCorrect Object Members


OMathAutoCorrect.Entries Property (Word)

 Copy code hover
[image]

OMathAutoCorrect.Entries Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMathAutoCorrectEntries collection that represents the collection of equation autocorrect entries within the equation autocorrect feature. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Entries

expression An expression that returns an OMathAutoCorrect object.

See also

Concepts

OMathAutoCorrect Object

Other resources

OMathAutoCorrect Object Members


OMathAutoCorrect.Functions Property (Word)

 Copy code hover
[image]

OMathAutoCorrect.Functions Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMathRecognizedFunctions collection that represents the recognized functions that are automatically corrected using the equation autocorrect feature. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Functions

expression An expression that returns an OMathAutoCorrect object.

See also

Concepts

OMathAutoCorrect Object

Other resources

OMathAutoCorrect Object Members


OMathAutoCorrect.Parent Property (Word)

 Copy code hover
[image]

OMathAutoCorrect.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified OMathAutoCorrect object.

Syntax

expression .Parent

expression A variable that represents a OMathAutoCorrect object.

See also

Concepts

OMathAutoCorrect Object

Other resources

OMathAutoCorrect Object Members


OMathAutoCorrect.ReplaceText Property (Word)

 Copy code hover
[image]

OMathAutoCorrect.ReplaceText Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents whether Microsoft Word automatically replaces strings in equations with the corresponding math AutoCorrect definitions. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .ReplaceText

expression An expression that returns an OMathAutoCorrect object.

See also

Concepts

OMathAutoCorrect Object

Other resources

OMathAutoCorrect Object Members


OMathAutoCorrect.UseOutsideOMath Property (Word)

 Copy code hover
[image]

OMathAutoCorrect.UseOutsideOMath Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents whether Microsoft Word uses math autocorrect rules outside equations in a document. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .UseOutsideOMath

expression An expression that returns an OMathAutoCorrect object.

See also

Concepts

OMathAutoCorrect Object

Other resources

OMathAutoCorrect Object Members


OMathAutoCorrectEntries Object (Word)

 Copy code hover
[image]

OMathAutoCorrectEntries Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a collection of math AutoCorrect entries. Use the OMathAutoCorrectEntry object to access individual AutoCorrect entries.

Version Information

Version Added: Word 2007

See also

Concepts

Word Object Model Reference

Other resources

OMathAutoCorrectEntries Object Members


OMathAutoCorrectEntries Members (Word)

 Copy code hover
[image]

OMathAutoCorrectEntries Members (Word)
Send feedback

Published: July 16, 2012

Represents a collection of math AutoCorrect entries. Use the OMathAutoCorrectEntry object to access individual AutoCorrect entries.

Methods

Name | Description
Add | Creates an equation auto correct entry and returns an OMathAutoCorrectEntry object.
Item | Returns an OMathAutoCorrectEntry object that represents the specified item in the collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns the number of items in the OMathAutoCorrectEntries collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified OMathAutoCorrectEntries object.


OMathAutoCorrectEntries Properties (Word)

 Copy code hover
[image]

OMathAutoCorrectEntries Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns the number of items in the OMathAutoCorrectEntries collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified OMathAutoCorrectEntries object.


OMathAutoCorrectEntries.Application Property (Word)

 Copy code hover
[image]

OMathAutoCorrectEntries.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents an OMathAutoCorrectEntries collection.

See also

Concepts

OMathAutoCorrectEntries Collection

Other resources

OMathAutoCorrectEntries Object Members


OMathAutoCorrectEntries.Count Property (Word)

 Copy code hover
[image]

OMathAutoCorrectEntries.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the number of items in the OMathAutoCorrectEntries collection. Read-only Long.

Syntax

expression .Count

expression A variable that represents a OMathAutoCorrectEntries object.

See also

Concepts

OMathAutoCorrectEntries Collection

Other resources

OMathAutoCorrectEntries Object Members


OMathAutoCorrectEntries.Creator Property (Word)

 Copy code hover
[image]

OMathAutoCorrectEntries.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.

Syntax

expression .Creator

expression An expression that returns an OMathAutoCorrectEntries object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

OMathAutoCorrectEntries Collection

Other resources

OMathAutoCorrectEntries Object Members


OMathAutoCorrectEntries.Parent Property (Word)

 Copy code hover
[image]

OMathAutoCorrectEntries.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified OMathAutoCorrectEntries object.

Syntax

expression .Parent

expression A variable that represents a OMathAutoCorrectEntries object.

See also

Concepts

OMathAutoCorrectEntries Collection

Other resources

OMathAutoCorrectEntries Object Members


OMathAutoCorrectEntries Methods (Word)

 Copy code hover
[image]

OMathAutoCorrectEntries Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Creates an equation auto correct entry and returns an OMathAutoCorrectEntry object.
Item | Returns an OMathAutoCorrectEntry object that represents the specified item in the collection.


OMathAutoCorrectEntries.Add Method (Word)

 Copy code hover
[image]

OMathAutoCorrectEntries.Add Method (Word)
See also Send feedback

Published: July 16, 2012

Creates an equation auto correct entry and returns an OMathAutoCorrectEntry object.

Syntax

expression .Add(Name, Value)

expression An expression that returns an OMathAutoCorrectEntries object.

Parameters

Name | Required/Optional | Data Type | Description
Name | Required | String | The name of the autocorrect entry. Corresponds to the Name property of the OMathAutoCorrectEntry object.
Value | Required | String | The value of the autocorrect entry. Corresponds to the Value property of the OMathAutoCorrectEntry object.

Return Value

OMathAutoCorrectEntry

See also

Concepts

OMathAutoCorrectEntries Collection

Other resources

OMathAutoCorrectEntries Object Members


OMathAutoCorrectEntries.Item Method (Word)

 Copy code hover
[image]

OMathAutoCorrectEntries.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMathAutoCorrectEntry object that represents the specified item in the collection.

Syntax

expression .Item(Index)

expression An expression that returns an OMathAutoCorrectEntries object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | Specifies a String or Integer that represents the name or ordinal position of the object in the collection.

Return Value

OMathAutoCorrectEntry

See also

Concepts

OMathAutoCorrectEntries Collection

Other resources

OMathAutoCorrectEntries Object Members


OMathAutoCorrectEntry Object (Word)

 Copy code hover
[image]

OMathAutoCorrectEntry Object (Word)
See also Send feedback

Published: July 16, 2012

Represents an individual entry in the OMathAutoCorrectEntry collection.

Version Information

Version Added: Word 2007

See also

Concepts

Word Object Model Reference

Other resources

OMathAutoCorrectEntry Object Members


OMathAutoCorrectEntry Members (Word)

 Copy code hover
[image]

OMathAutoCorrectEntry Members (Word)
Send feedback

Published: July 16, 2012

Represents an individual entry in the OMathAutoCorrectEntry collection.

Methods

Name | Description
Delete | Deletes the specified equation auto correct entry.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
Index | Returns a Long that represents the position of an item in a collection. Read-only.
Name | Returns or sets a String that represents the name of an equation auto correct entry. Read/write.
Parent | Returns an Object that represents the parent object of the specified OMathAutoCorrectEntry object.
Value | Returns or sets a String that represents the contents of an equation auto correct entry. Read/write.


OMathAutoCorrectEntry Properties (Word)

 Copy code hover
[image]

OMathAutoCorrectEntry Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
Index | Returns a Long that represents the position of an item in a collection. Read-only.
Name | Returns or sets a String that represents the name of an equation auto correct entry. Read/write.
Parent | Returns an Object that represents the parent object of the specified OMathAutoCorrectEntry object.
Value | Returns or sets a String that represents the contents of an equation auto correct entry. Read/write.


OMathAutoCorrectEntry.Application Property (Word)

 Copy code hover
[image]

OMathAutoCorrectEntry.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents an OMathAutoCorrectEntry object.

See also

Concepts

OMathAutoCorrectEntry Object

Other resources

OMathAutoCorrectEntry Object Members


OMathAutoCorrectEntry.Creator Property (Word)

 Copy code hover
[image]

OMathAutoCorrectEntry.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.

Syntax

expression .Creator

expression An expression that returns an OMathAutoCorrectEntry object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

OMathAutoCorrectEntry Object

Other resources

OMathAutoCorrectEntry Object Members


OMathAutoCorrectEntry.Index Property (Word)

 Copy code hover
[image]

OMathAutoCorrectEntry.Index Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the position of an item in a collection. Read-only.

Syntax

expression .Index

expression An expression that returns an OMathAutoCorrectEntry object.

See also

Concepts

OMathAutoCorrectEntry Object

Other resources

OMathAutoCorrectEntry Object Members


OMathAutoCorrectEntry.Name Property (Word)

 Copy code hover
[image]

OMathAutoCorrectEntry.Name Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a String that represents the name of an equation auto correct entry. Read/write.

Syntax

expression .Name

expression An expression that returns an OMathAutoCorrectEntry object.

See also

Concepts

OMathAutoCorrectEntry Object

Other resources

OMathAutoCorrectEntry Object Members


OMathAutoCorrectEntry.Parent Property (Word)

 Copy code hover
[image]

OMathAutoCorrectEntry.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified OMathAutoCorrectEntry object.

Syntax

expression .Parent

expression A variable that represents a OMathAutoCorrectEntry object.

See also

Concepts

OMathAutoCorrectEntry Object

Other resources

OMathAutoCorrectEntry Object Members


OMathAutoCorrectEntry.Value Property (Word)

 Copy code hover
[image]

OMathAutoCorrectEntry.Value Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a String that represents the contents of an equation auto correct entry. Read/write.

Syntax

expression .Value

expression An expression that returns an OMathAutoCorrectEntry object.

See also

Concepts

OMathAutoCorrectEntry Object

Other resources

OMathAutoCorrectEntry Object Members


OMathAutoCorrectEntry Methods (Word)

 Copy code hover
[image]

OMathAutoCorrectEntry Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the specified equation auto correct entry.


OMathAutoCorrectEntry.Delete Method (Word)

 Copy code hover
[image]

OMathAutoCorrectEntry.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the specified equation auto correct entry.

Syntax

expression .Delete

expression An expression that returns an OMathAutoCorrectEntry object.

See also

Concepts

OMathAutoCorrectEntry Object

Other resources

OMathAutoCorrectEntry Object Members


OMathBar Object (Word)

 Copy code hover
[image]

OMathBar Object (Word)
See also Send feedback

Published: July 16, 2012

Represents an equation with a bar above or below the base.

See also

Concepts

Word Object Model Reference

Other resources

OMathBar Object Members


OMathBar Members (Word)

 Copy code hover
[image]

OMathBar Members (Word)
Send feedback

Published: July 16, 2012

Represents an equation with a bar above or below the base.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
BarTop | Returns or sets a Boolean that represents the position of a bar in a bar object. True specifies a mathematical overbar. False specifies a mathematical underbar. Read/write.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
E | Returns an OMath object that represents the base of the specified equation object. Read-only.
Parent | Returns an Object that represents the parent object of the specified OMathBar object.


OMathBar Properties (Word)

 Copy code hover
[image]

OMathBar Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
BarTop | Returns or sets a Boolean that represents the position of a bar in a bar object. True specifies a mathematical overbar. False specifies a mathematical underbar. Read/write.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
E | Returns an OMath object that represents the base of the specified equation object. Read-only.
Parent | Returns an Object that represents the parent object of the specified OMathBar object.


OMathBar.Application Property (Word)

 Copy code hover
[image]

OMathBar.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents an OMathBar object.

See also

Concepts

OMathBar Object

Other resources

OMathBar Object Members


OMathBar.BarTop Property (Word)

 Copy code hover
[image]

OMathBar.BarTop Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents the position of a bar in a bar object. True specifies a mathematical overbar. False specifies a mathematical underbar. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .BarTop

expression An expression that returns an OMathBar object.

See also

Concepts

OMathBar Object

Other resources

OMathBar Object Members


OMathBar.Creator Property (Word)

 Copy code hover
[image]

OMathBar.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.

Syntax

expression .Creator

expression An expression that returns an OMathBar object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

OMathBar Object

Other resources

OMathBar Object Members


OMathBar.E Property (Word)

 Copy code hover
[image]

OMathBar.E Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMath object that represents the base of the specified equation object. Read-only.

Syntax

expression .E

expression An expression that returns an OMathBar object.

See also

Concepts

OMathBar Object

Other resources

OMathBar Object Members


OMathBar.Parent Property (Word)

 Copy code hover
[image]

OMathBar.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified OMathBar object.

Syntax

expression .Parent

expression A variable that represents a OMathBar object.

See also

Concepts

OMathBar Object

Other resources

OMathBar Object Members


OMathBorderBox Object (Word)

 Copy code hover
[image]

OMathBorderBox Object (Word)
See also Send feedback

Published: July 16, 2012

Represents an invisible box around an equation or part of an equation to which you can assign properties that affect the layout or mathematical formatting of the entire box. For example, a box can serve as an operator emulator with or without an alignment point, serve as a like breakpoint, have an associated argument size (argSz), or be grouped so as not to allow line breaks.

Version Information

Version Added: Word 2007

See also

Concepts

Word Object Model Reference

Other resources

OMathBorderBox Object Members


OMathBorderBox Members (Word)

 Copy code hover
[image]

OMathBorderBox Members (Word)
Send feedback

Published: July 16, 2012

Represents an invisible box around an equation or part of an equation to which you can assign properties that affect the layout or mathematical formatting of the entire box. For example, a box can serve as an operator emulator with or without an alignment point, serve as a like breakpoint, have an associated argument size (argSz), or be grouped so as not to allow line breaks.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
E | Returns an OMath object that represents the base of the specified equation object. Read-only.
HideBot | Returns or sets a Boolean that represents whether to hide the bottom border of an equation's bounding box. Read/write.
HideLeft | Returns or sets a Boolean that represents whether to hide the left border of an equation's bounding box. Read/write.
HideRight | Returns or sets a Boolean that represents whether to hide the right border of an equation's bounding box. Read/write.
HideTop | Returns or sets a Boolean that represents whether to hide the top border of an equation's bounding box. Read/write.
Parent | Returns an Object that represents the parent object of the specified OMathBorderBox object.
StrikeBLTR | Returns or sets a Boolean that represents a diagonal strikethrough from lower left to upper right. Read/write.
StrikeH | Returns or sets a Boolean that represents a horizontal strikethrough. Read/write.
StrikeTLBR | Returns or sets a Boolean that represents a diagonal strikethrough from upper left to lower right. Read/write.
StrikeV | Returns or sets a Boolean that represents a vertical strikethrough. Read/write.


OMathBorderBox Properties (Word)

 Copy code hover
[image]

OMathBorderBox Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
E | Returns an OMath object that represents the base of the specified equation object. Read-only.
HideBot | Returns or sets a Boolean that represents whether to hide the bottom border of an equation's bounding box. Read/write.
HideLeft | Returns or sets a Boolean that represents whether to hide the left border of an equation's bounding box. Read/write.
HideRight | Returns or sets a Boolean that represents whether to hide the right border of an equation's bounding box. Read/write.
HideTop | Returns or sets a Boolean that represents whether to hide the top border of an equation's bounding box. Read/write.
Parent | Returns an Object that represents the parent object of the specified OMathBorderBox object.
StrikeBLTR | Returns or sets a Boolean that represents a diagonal strikethrough from lower left to upper right. Read/write.
StrikeH | Returns or sets a Boolean that represents a horizontal strikethrough. Read/write.
StrikeTLBR | Returns or sets a Boolean that represents a diagonal strikethrough from upper left to lower right. Read/write.
StrikeV | Returns or sets a Boolean that represents a vertical strikethrough. Read/write.


OMathBorderBox.Application Property (Word)

 Copy code hover
[image]

OMathBorderBox.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents an OMathBorderBox object.

See also

Concepts

OMathBorderBox Object

Other resources

OMathBorderBox Object Members


OMathBorderBox.Creator Property (Word)

 Copy code hover
[image]

OMathBorderBox.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.

Syntax

expression .Creator

expression An expression that returns an OMathBorderBox object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

OMathBorderBox Object

Other resources

OMathBorderBox Object Members


OMathBorderBox.E Property (Word)

 Copy code hover
[image]

OMathBorderBox.E Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMath object that represents the base of the specified equation object. Read-only.

Syntax

expression .E

expression An expression that returns an OMathBorderBox object.

See also

Concepts

OMathBorderBox Object

Other resources

OMathBorderBox Object Members


OMathBorderBox.HideBot Property (Word)

 Copy code hover
[image]

OMathBorderBox.HideBot Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents whether to hide the bottom border of an equation's bounding box. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .HideBot

expression An expression that returns an OMathBorderBox object.

See also

Concepts

OMathBorderBox Object

Other resources

OMathBorderBox Object Members


OMathBorderBox.HideLeft Property (Word)

 Copy code hover
[image]

OMathBorderBox.HideLeft Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents whether to hide the left border of an equation's bounding box. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .HideLeft

expression An expression that returns an OMathBorderBox object.

See also

Concepts

OMathBorderBox Object

Other resources

OMathBorderBox Object Members


OMathBorderBox.HideRight Property (Word)

 Copy code hover
[image]

OMathBorderBox.HideRight Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents whether to hide the right border of an equation's bounding box. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .HideRight

expression An expression that returns an OMathBorderBox object.

See also

Concepts

OMathBorderBox Object

Other resources

OMathBorderBox Object Members


OMathBorderBox.HideTop Property (Word)

 Copy code hover
[image]

OMathBorderBox.HideTop Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents whether to hide the top border of an equation's bounding box. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .HideTop

expression An expression that returns an OMathBorderBox object.

See also

Concepts

OMathBorderBox Object

Other resources

OMathBorderBox Object Members


OMathBorderBox.Parent Property (Word)

 Copy code hover
[image]

OMathBorderBox.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified OMathBorderBox object.

Syntax

expression .Parent

expression A variable that represents a OMathBorderBox object.

See also

Concepts

OMathBorderBox Object

Other resources

OMathBorderBox Object Members


OMathBorderBox.StrikeBLTR Property (Word)

 Copy code hover
[image]

OMathBorderBox.StrikeBLTR Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents a diagonal strikethrough from lower left to upper right. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .StrikeBLTR

expression An expression that returns an OMathBorderBox object.

See also

Concepts

OMathBorderBox Object

Other resources

OMathBorderBox Object Members


OMathBorderBox.StrikeH Property (Word)

 Copy code hover
[image]

OMathBorderBox.StrikeH Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents a horizontal strikethrough. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .StrikeH

expression An expression that returns an OMathBorderBox object.

See also

Concepts

OMathBorderBox Object

Other resources

OMathBorderBox Object Members


OMathBorderBox.StrikeTLBR Property (Word)

 Copy code hover
[image]

OMathBorderBox.StrikeTLBR Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents a diagonal strikethrough from upper left to lower right. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .StrikeTLBR

expression An expression that returns an OMathBorderBox object.

See also

Concepts

OMathBorderBox Object

Other resources

OMathBorderBox Object Members


OMathBorderBox.StrikeV Property (Word)

 Copy code hover
[image]

OMathBorderBox.StrikeV Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents a vertical strikethrough. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .StrikeV

expression An expression that returns an OMathBorderBox object.

See also

Concepts

OMathBorderBox Object

Other resources

OMathBorderBox Object Members


OMathBox Object (Word)

 Copy code hover
[image]

OMathBox Object (Word)
See also Send feedback

Published: July 16, 2012

Represents an invisible box around an equation or part of an equation to which you can apply properties that affect the mathematical or formatting properties, such as line breaks.

Version Information

Version Added: Word 2007

See also

Concepts

Word Object Model Reference

Other resources

OMathBox Object Members


OMathBox Members (Word)

 Copy code hover
[image]

OMathBox Members (Word)
Send feedback

Published: July 16, 2012

Represents an invisible box around an equation or part of an equation to which you can apply properties that affect the mathematical or formatting properties, such as line breaks.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
Diff | Returns or sets a Boolean that represents whether the box acts as the mathematical differential, in which case the box receives the appropriate horizontal spacing for a differential. Read/write.
E | Returns an OMath object that represents the base of the specified equation object. Read-only.
NoBreak | Returns or sets a Boolean that represents whether breaks are allowed inside the box object. Read/write.
OpEmu | Returns or sets a Boolean that represents that the box and its contents behave as a single operator and inherit the properties of an operator. Read/write.
Parent | Returns an Object that represents the parent object of the specified OMathBox object.


OMathBox Properties (Word)

 Copy code hover
[image]

OMathBox Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
Diff | Returns or sets a Boolean that represents whether the box acts as the mathematical differential, in which case the box receives the appropriate horizontal spacing for a differential. Read/write.
E | Returns an OMath object that represents the base of the specified equation object. Read-only.
NoBreak | Returns or sets a Boolean that represents whether breaks are allowed inside the box object. Read/write.
OpEmu | Returns or sets a Boolean that represents that the box and its contents behave as a single operator and inherit the properties of an operator. Read/write.
Parent | Returns an Object that represents the parent object of the specified OMathBox object.


OMathBox.Application Property (Word)

 Copy code hover
[image]

OMathBox.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents an OMathBox object.

See also

Concepts

OMathBox Object

Other resources

OMathBox Object Members


OMathBox.Creator Property (Word)

 Copy code hover
[image]

OMathBox.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.

Syntax

expression .Creator

expression An expression that returns an OMathBox object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

OMathBox Object

Other resources

OMathBox Object Members


OMathBox.Diff Property (Word)

 Copy code hover
[image]

OMathBox.Diff Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents whether the box acts as the mathematical differential, in which case the box receives the appropriate horizontal spacing for a differential. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .Diff

expression An expression that returns an OMathBox object.

See also

Concepts

OMathBox Object

Other resources

OMathBox Object Members


OMathBox.E Property (Word)

 Copy code hover
[image]

OMathBox.E Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMath object that represents the base of the specified equation object. Read-only.

Syntax

expression .E

expression An expression that returns an OMathBox object.

See also

Concepts

OMathBox Object

Other resources

OMathBox Object Members


OMathBox.NoBreak Property (Word)

 Copy code hover
[image]

OMathBox.NoBreak Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents whether breaks are allowed inside the box object. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .NoBreak

expression An expression that returns an OMathBox object.

See also

Concepts

OMathBox Object

Other resources

OMathBox Object Members


OMathBox.OpEmu Property (Word)

 Copy code hover
[image]

OMathBox.OpEmu Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents that the box and its contents behave as a single operator and inherit the properties of an operator. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .OpEmu

expression An expression that returns an OMathBox object.

Remarks

When the OpEmu property is True, the character can serve as a point for a line break and can be aligned to other operators. Operator emulators are often used when one or more glyphs combine to form an operator, such as ==.

See also

Concepts

OMathBox Object

Other resources

OMathBox Object Members


OMathBox.Parent Property (Word)

 Copy code hover
[image]

OMathBox.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified OMathBox object.

Syntax

expression .Parent

expression A variable that represents a OMathBox object.

See also

Concepts

OMathBox Object

Other resources

OMathBox Object Members


OMathBreak Object (Word)

 Copy code hover
[image]

OMathBreak Object (Word)
See also Send feedback

Published: July 16, 2012

Represents individual line breaks in an equation. Each OMathBreak object is a member of the OMathBreaks collection.

Version Information

Version Added: Word 2007

See also

Concepts

Word Object Model Reference

Other resources

OMathBreak Object Members


OMathBreak Members (Word)

 Copy code hover
[image]

OMathBreak Members (Word)
Send feedback

Published: July 16, 2012

Represents individual line breaks in an equation. Each OMathBreak object is a member of the OMathBreaks collection.

Methods

Name | Description
Delete | Deletes the specified equation break.

Properties

Name | Description
AlignAt | Returns or sets a Long that represents the operator in one line, to which Microsoft Word aligns consecutive lines in an equation. Read/write.
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified OMathBreak object.
Range | Returns a Range object that represents the portion of a document that is contained in the specified object. Read-only.


OMathBreak Properties (Word)

 Copy code hover
[image]

OMathBreak Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
AlignAt | Returns or sets a Long that represents the operator in one line, to which Microsoft Word aligns consecutive lines in an equation. Read/write.
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified OMathBreak object.
Range | Returns a Range object that represents the portion of a document that is contained in the specified object. Read-only.


OMathBreak.AlignAt Property (Word)

 Copy code hover
[image]

OMathBreak.AlignAt Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Long that represents the operator in one line, to which Microsoft Word aligns consecutive lines in an equation. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .AlignAt

expression An expression that returns an OMathBreak object.

See also

Concepts

OMathBreak Object

Other resources

OMathBreak Object Members


OMathBreak.Application Property (Word)

 Copy code hover
[image]

OMathBreak.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents an OMathBreak object.

See also

Concepts

OMathBreak Object

Other resources

OMathBreak Object Members


OMathBreak.Creator Property (Word)

 Copy code hover
[image]

OMathBreak.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.

Syntax

expression .Creator

expression An expression that returns an OMathBreak object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

OMathBreak Object

Other resources

OMathBreak Object Members


OMathBreak.Parent Property (Word)

 Copy code hover
[image]

OMathBreak.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified OMathBreak object.

Syntax

expression .Parent

expression A variable that represents a OMathBreak object.

See also

Concepts

OMathBreak Object

Other resources

OMathBreak Object Members


OMathBreak.Range Property (Word)

 Copy code hover
[image]

OMathBreak.Range Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the portion of a document that is contained in the specified object. Read-only.

Syntax

expression .Range

expression An expression that returns an OMathBreak object.

See also

Concepts

OMathBreak Object

Other resources

OMathBreak Object Members


OMathBreak Methods (Word)

 Copy code hover
[image]

OMathBreak Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the specified equation break.


OMathBreak.Delete Method (Word)

 Copy code hover
[image]

OMathBreak.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the specified equation break.

Syntax

expression .Delete

expression An expression that returns an OMathBreak object.

See also

Concepts

OMathBreak Object

Other resources

OMathBreak Object Members


OMathBreaks Object (Word)

 Copy code hover
[image]

OMathBreaks Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a collection of OMathBreak objects that represent all the line breaks in an equation.

Version Information

Version Added: Word 2007

See also

Concepts

Word Object Model Reference

Other resources

OMathBreaks Object Members


OMathBreaks Members (Word)

 Copy code hover
[image]

OMathBreaks Members (Word)
Send feedback

Published: July 16, 2012

Represents a collection of OMathBreak objects that represent all the line breaks in an equation.

Methods

Name | Description
Add | Inserts a break into an equation and returns an OMathBreak object that represents the break.
Item | Returns an OMathBreak object that represents the specified item in the collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns the number of items in the OMathBreaks collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified OMathBreaks object.


OMathBreaks Properties (Word)

 Copy code hover
[image]

OMathBreaks Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns the number of items in the OMathBreaks collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified OMathBreaks object.


OMathBreaks.Application Property (Word)

 Copy code hover
[image]

OMathBreaks.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents an OMathBreaks collection.

See also

Concepts

OMathBreaks Collection

Other resources

OMathBreaks Object Members


OMathBreaks.Count Property (Word)

 Copy code hover
[image]

OMathBreaks.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the number of items in the OMathBreaks collection. Read-only Long.

Syntax

expression .Count

expression A variable that represents a OMathBreaks object.

See also

Concepts

OMathBreaks Collection

Other resources

OMathBreaks Object Members


OMathBreaks.Creator Property (Word)

 Copy code hover
[image]

OMathBreaks.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.

Syntax

expression .Creator

expression An expression that returns an OMathBreaks object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

OMathBreaks Collection

Other resources

OMathBreaks Object Members


OMathBreaks.Parent Property (Word)

 Copy code hover
[image]

OMathBreaks.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified OMathBreaks object.

Syntax

expression .Parent

expression A variable that represents a OMathBreaks object.

See also

Concepts

OMathBreaks Collection

Other resources

OMathBreaks Object Members


OMathBreaks Methods (Word)

 Copy code hover
[image]

OMathBreaks Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Inserts a break into an equation and returns an OMathBreak object that represents the break.
Item | Returns an OMathBreak object that represents the specified item in the collection.


OMathBreaks.Add Method (Word)

 Copy code hover
[image]

OMathBreaks.Add Method (Word)
See also Send feedback

Published: July 16, 2012

Inserts a break into an equation and returns an OMathBreak object that represents the break.

Version Information

Version Added: Word 2007

Syntax

expression .Add(Range)

expression An expression that returns a OMathBreaks object.

Parameters

Name | Required/Optional | Data Type | Description
Range | Required | Range | The position at which to insert the break in the equation.

Return Value

OMathBreak

See also

Concepts

OMathBreaks Collection

Other resources

OMathBreaks Object Members


OMathBreaks.Item Method (Word)

 Copy code hover
[image]

OMathBreaks.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMathBreak object that represents the specified item in the collection.

Syntax

expression .Item(Index)

expression An expression that returns an OMathBreaks object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | Specifies the ordinal position of the object within the collection.

Return Value

OMathBreak

See also

Concepts

OMathBreaks Collection

Other resources

OMathBreaks Object Members


OMathDelim Object (Word)

 Copy code hover
[image]

OMathDelim Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a delimiter object, consisting of opening and closing delimiters (such as parentheses, braces, brackets, or vertical bars), and one or more elements contained inside the delimiters.

Version Information

Version Added: Word 2007

See also

Concepts

Word Object Model Reference

Other resources

OMathDelim Object Members


OMathDelim Members (Word)

 Copy code hover
[image]

OMathDelim Members (Word)
Send feedback

Published: July 16, 2012

Represents a delimiter object, consisting of opening and closing delimiters (such as parentheses, braces, brackets, or vertical bars), and one or more elements contained inside the delimiters.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
BegChar | Returns or sets an Integer that represents the beginning delimiter character in a delimiter object. Read/write.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
E | Returns an OMathArgs object that represents the list of arguments for the specified equation object. Read-only.
EndChar | Returns or sets an Integer that represents the ending delimiter character in a delimiter object. Read/write.
Grow | Returns or sets a Boolean that represents whether delimiter characters grow to the full height of the arguments that they contain. Read/write.
NoLeftChar | Returns or sets a Boolean that represents whether to hide the opening delimiter in a delimiter object. Read/write.
NoRightChar | Returns or sets a Boolean that represents whether to hide the closing delimiter in a delimiter object. Read/write.
Parent | Returns an Object that represents the parent object of the specified OMathDelim object.
SepChar | Returns or sets an Integer that represents the separator character in a delimiter object when the delimiter object contains two or more arguments. Read/write.
Shape | Returns or sets a WdOMathShapeType constant that represents the appearance of delimiters (for example, parentheses, braces, and brackets) in relationship to the content that they surround. Read/write.


OMathDelim Properties (Word)

 Copy code hover
[image]

OMathDelim Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
BegChar | Returns or sets an Integer that represents the beginning delimiter character in a delimiter object. Read/write.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
E | Returns an OMathArgs object that represents the list of arguments for the specified equation object. Read-only.
EndChar | Returns or sets an Integer that represents the ending delimiter character in a delimiter object. Read/write.
Grow | Returns or sets a Boolean that represents whether delimiter characters grow to the full height of the arguments that they contain. Read/write.
NoLeftChar | Returns or sets a Boolean that represents whether to hide the opening delimiter in a delimiter object. Read/write.
NoRightChar | Returns or sets a Boolean that represents whether to hide the closing delimiter in a delimiter object. Read/write.
Parent | Returns an Object that represents the parent object of the specified OMathDelim object.
SepChar | Returns or sets an Integer that represents the separator character in a delimiter object when the delimiter object contains two or more arguments. Read/write.
Shape | Returns or sets a WdOMathShapeType constant that represents the appearance of delimiters (for example, parentheses, braces, and brackets) in relationship to the content that they surround. Read/write.


OMathDelim.Application Property (Word)

 Copy code hover
[image]

OMathDelim.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents an OMathDelim object.

See also

Concepts

OMathDelim Object

Other resources

OMathDelim Object Members


OMathDelim.BegChar Property (Word)

 Copy code hover
[image]

OMathDelim.BegChar Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets an Integer that represents the beginning delimiter character in a delimiter object. Read/write.

Syntax

expression .BegChar

expression An expression that returns an OMathDelim object.

See also

Concepts

OMathDelim Object

Other resources

OMathDelim Object Members


OMathDelim.Creator Property (Word)

 Copy code hover
[image]

OMathDelim.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.

Syntax

expression .Creator

expression An expression that returns an OMathDelim object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

OMathDelim Object

Other resources

OMathDelim Object Members


OMathDelim.E Property (Word)

 Copy code hover
[image]

OMathDelim.E Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMathArgs object that represents the list of arguments for the specified equation object. Read-only.

Syntax

expression .E

expression An expression that returns an OMathDelim object.

See also

Concepts

OMathDelim Object

Other resources

OMathDelim Object Members


OMathDelim.EndChar Property (Word)

 Copy code hover
[image]

OMathDelim.EndChar Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets an Integer that represents the ending delimiter character in a delimiter object. Read/write.

Syntax

expression .EndChar

expression An expression that returns an OMathDelim object.

See also

Concepts

OMathDelim Object

Other resources

OMathDelim Object Members


OMathDelim.Grow Property (Word)

 Copy code hover
[image]

OMathDelim.Grow Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents whether delimiter characters grow to the full height of the arguments that they contain. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .Grow

expression An expression that returns an OMathDelim object.

See also

Concepts

OMathDelim Object

Other resources

OMathDelim Object Members


OMathDelim.NoLeftChar Property (Word)

 Copy code hover
[image]

OMathDelim.NoLeftChar Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents whether to hide the opening delimiter in a delimiter object. Read/write.

Syntax

expression .NoLeftChar

expression An expression that returns an OMathDelim object.

See also

Concepts

OMathDelim Object

Other resources

OMathDelim Object Members


OMathDelim.NoRightChar Property (Word)

 Copy code hover
[image]

OMathDelim.NoRightChar Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents whether to hide the closing delimiter in a delimiter object. Read/write.

Syntax

expression .NoRightChar

expression An expression that returns an OMathDelim object.

See also

Concepts

OMathDelim Object

Other resources

OMathDelim Object Members


OMathDelim.Parent Property (Word)

 Copy code hover
[image]

OMathDelim.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified OMathDelim object.

Syntax

expression .Parent

expression A variable that represents a OMathDelim object.

See also

Concepts

OMathDelim Object

Other resources

OMathDelim Object Members


OMathDelim.SepChar Property (Word)

 Copy code hover
[image]

OMathDelim.SepChar Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets an Integer that represents the separator character in a delimiter object when the delimiter object contains two or more arguments. Read/write.

Syntax

expression .SepChar

expression An expression that returns an OMathDelim object.

See also

Concepts

OMathDelim Object

Other resources

OMathDelim Object Members


OMathDelim.Shape Property (Word)

 Copy code hover
[image]

OMathDelim.Shape Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a WdOMathShapeType constant that represents the appearance of delimiters (for example, parentheses, braces, and brackets) in relationship to the content that they surround. Read/write.

Syntax

expression .Shape

expression An expression that returns an OMathDelim object.

See also

Concepts

OMathDelim Object

Other resources

OMathDelim Object Members


OMathEqArray Object (Word)

 Copy code hover
[image]

OMathEqArray Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a mathematical equation array object, consisting of one or more equations that can be vertically justified as a unit respect to surrounding text on the line.

Version Information

Version Added: Word 2007

See also

Concepts

Word Object Model Reference

Other resources

OMathEqArray Object Members


OMathEqArray Members (Word)

 Copy code hover
[image]

OMathEqArray Members (Word)
Send feedback

Published: July 16, 2012

Represents a mathematical equation array object, consisting of one or more equations that can be vertically justified as a unit respect to surrounding text on the line.

Properties

Name | Description
Align | Returns or sets a WdOMathVertAlignType that represents the type of vertical alignment for an equation array with respect to the text that surrounds the array. Read/write.
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
E | Returns an OMathArgs object that represents the list of arguments for the specified equation object. Read-only.
MaxDist | Returns or sets a Boolean that represents that the equations in an equation array are distributed equally within the margins of its container, such as a column, cell, or page width. Read/write.
ObjDist | Returns or sets a Boolean that represents whether the equations in an equation array are spaced to the maximum width of the equation array. Read/write.
Parent | Returns an Object that represents the parent object of the specified OMathEqArray object.
RowSpacing | Returns or sets a Long that represents the spacing between the rows in an equation array. Read/write.
RowSpacingRule | Returns or sets a WdOMathSpacingRule that represents the rule that defines spacing in an equation array. Read/write.


OMathEqArray Properties (Word)

 Copy code hover
[image]

OMathEqArray Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Align | Returns or sets a WdOMathVertAlignType that represents the type of vertical alignment for an equation array with respect to the text that surrounds the array. Read/write.
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
E | Returns an OMathArgs object that represents the list of arguments for the specified equation object. Read-only.
MaxDist | Returns or sets a Boolean that represents that the equations in an equation array are distributed equally within the margins of its container, such as a column, cell, or page width. Read/write.
ObjDist | Returns or sets a Boolean that represents whether the equations in an equation array are spaced to the maximum width of the equation array. Read/write.
Parent | Returns an Object that represents the parent object of the specified OMathEqArray object.
RowSpacing | Returns or sets a Long that represents the spacing between the rows in an equation array. Read/write.
RowSpacingRule | Returns or sets a WdOMathSpacingRule that represents the rule that defines spacing in an equation array. Read/write.


OMathEqArray.Align Property (Word)

 Copy code hover
[image]

OMathEqArray.Align Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a WdOMathVertAlignType that represents the type of vertical alignment for an equation array with respect to the text that surrounds the array. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .Align

expression An expression that returns an OMathEqArray object.

See also

Concepts

OMathEqArray Object

Other resources

OMathEqArray Object Members


OMathEqArray.Application Property (Word)

 Copy code hover
[image]

OMathEqArray.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents an OMathEqArray object.

See also

Concepts

OMathEqArray Object

Other resources

OMathEqArray Object Members


OMathEqArray.Creator Property (Word)

 Copy code hover
[image]

OMathEqArray.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.

Syntax

expression .Creator

expression An expression that returns an OMathEqArray object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

OMathEqArray Object

Other resources

OMathEqArray Object Members


OMathEqArray.E Property (Word)

 Copy code hover
[image]

OMathEqArray.E Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMathArgs object that represents the list of arguments for the specified equation object. Read-only.

Syntax

expression .E

expression An expression that returns an OMathEqArray object.

See also

Concepts

OMathEqArray Object

Other resources

OMathEqArray Object Members


OMathEqArray.MaxDist Property (Word)

 Copy code hover
[image]

OMathEqArray.MaxDist Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents that the equations in an equation array are distributed equally within the margins of its container, such as a column, cell, or page width. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .MaxDist

expression An expression that returns an OMathEqArray object.

Remarks

The container for an equation array may be the margins of a page, the margins of a table cell, or another container in which the equation may exist.

See also

Concepts

OMathEqArray Object

Other resources

OMathEqArray Object Members


OMathEqArray.ObjDist Property (Word)

 Copy code hover
[image]

OMathEqArray.ObjDist Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents whether the equations in an equation array are spaced to the maximum width of the equation array. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .ObjDist

expression An expression that returns an OMathEqArray object.

See also

Concepts

OMathEqArray Object

Other resources

OMathEqArray Object Members


OMathEqArray.Parent Property (Word)

 Copy code hover
[image]

OMathEqArray.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified OMathEqArray object.

Syntax

expression .Parent

expression A variable that represents a OMathEqArray object.

See also

Concepts

OMathEqArray Object

Other resources

OMathEqArray Object Members


OMathEqArray.RowSpacing Property (Word)

 Copy code hover
[image]

OMathEqArray.RowSpacing Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Long that represents the spacing between the rows in an equation array. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .RowSpacing

expression An expression that returns an OMathEqArray object.

See also

Concepts

OMathEqArray Object

Other resources

OMathEqArray Object Members


OMathEqArray.RowSpacingRule Property (Word)

 Copy code hover
[image]

OMathEqArray.RowSpacingRule Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a WdOMathSpacingRule that represents the rule that defines spacing in an equation array. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .RowSpacingRule

expression An expression that returns an OMathEqArray object.

See also

Concepts

OMathEqArray Object

Other resources

OMathEqArray Object Members


OMathFrac Object (Word)

 Copy code hover
[image]

OMathFrac Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a fraction, consisting of a numerator and denominator separated by a fraction bar. The fraction bar can be horizontal or diagonal, depending on the fraction properties.

Version Information

Version Added: Word 2007

See also

Concepts

Word Object Model Reference

Other resources

OMathFrac Object Members


OMathFrac Members (Word)

 Copy code hover
[image]

OMathFrac Members (Word)
Send feedback

Published: July 16, 2012

Represents a fraction, consisting of a numerator and denominator separated by a fraction bar. The fraction bar can be horizontal or diagonal, depending on the fraction properties.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
Den | Returns an OMath object that represents the denominator for an equation that contains a fraction. Read-only.
Num | Returns an OMath object that represents the numerator for a fraction. Read-only.
Parent | Returns an Object that represents the parent object of the specified OMathFrac object.
Type | Returns or sets a WdOMathFracType constant that represents the layout of a fraction, whether it is stacked, skewed, linear, or without a fraction bar. Read/write.


OMathFrac Properties (Word)

 Copy code hover
[image]

OMathFrac Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
Den | Returns an OMath object that represents the denominator for an equation that contains a fraction. Read-only.
Num | Returns an OMath object that represents the numerator for a fraction. Read-only.
Parent | Returns an Object that represents the parent object of the specified OMathFrac object.
Type | Returns or sets a WdOMathFracType constant that represents the layout of a fraction, whether it is stacked, skewed, linear, or without a fraction bar. Read/write.


OMathFrac.Application Property (Word)

 Copy code hover
[image]

OMathFrac.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents an OMathFrac object.

See also

Concepts

OMathFrac Object

Other resources

OMathFrac Object Members


OMathFrac.Creator Property (Word)

 Copy code hover
[image]

OMathFrac.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.

Syntax

expression .Creator

expression An expression that returns an OMathFrac object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

OMathFrac Object

Other resources

OMathFrac Object Members


OMathFrac.Den Property (Word)

 Copy code hover
[image]

OMathFrac.Den Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMath object that represents the denominator for an equation that contains a fraction. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Den

expression An expression that returns an OMathFrac object.

See also

Concepts

OMathFrac Object

Other resources

OMathFrac Object Members


OMathFrac.Num Property (Word)

 Copy code hover
[image]

OMathFrac.Num Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMath object that represents the numerator for a fraction. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Num

expression An expression that returns an OMathFrac object.

See also

Concepts

OMathFrac Object

Other resources

OMathFrac Object Members


OMathFrac.Parent Property (Word)

 Copy code hover
[image]

OMathFrac.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified OMathFrac object.

Syntax

expression .Parent

expression A variable that represents a OMathFrac object.

See also

Concepts

OMathFrac Object

Other resources

OMathFrac Object Members


OMathFrac.Type Property (Word)

 Copy code hover
[image]

OMathFrac.Type Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a WdOMathFracType constant that represents the layout of a fraction, whether it is stacked, skewed, linear, or without a fraction bar. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .Type

expression An expression that returns an OMathFrac object.

See also

Concepts

OMathFrac Object

Other resources

OMathFrac Object Members


OMathFunc Object (Word)

 Copy code hover
[image]

OMathFunc Object (Word)
See also Send feedback

Published: July 16, 2012

Represents the application of a function or an argument in an equation that consists of a function name, such as sin or cos, and an argument.

See also

Concepts

Word Object Model Reference

Other resources

OMathFunc Object Members


OMathFunc Members (Word)

 Copy code hover
[image]

OMathFunc Members (Word)
Send feedback

Published: July 16, 2012

Represents the application of a function or an argument in an equation that consists of a function name, such as sin or cos, and an argument.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
E | Returns an OMath object that represents the base of the specified equation object. Read-only.
FName | Returns an OMath object that represents the name of a mathematical function, such as sin or cos. Read-only.
Parent | Returns an Object that represents the parent object of the specified OMathFunc object.


OMathFunc Properties (Word)

 Copy code hover
[image]

OMathFunc Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
E | Returns an OMath object that represents the base of the specified equation object. Read-only.
FName | Returns an OMath object that represents the name of a mathematical function, such as sin or cos. Read-only.
Parent | Returns an Object that represents the parent object of the specified OMathFunc object.


OMathFunc.Application Property (Word)

 Copy code hover
[image]

OMathFunc.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents an OMathFunc object.

See also

Concepts

OMathFunc Object

Other resources

OMathFunc Object Members


OMathFunc.Creator Property (Word)

 Copy code hover
[image]

OMathFunc.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.

Syntax

expression .Creator

expression An expression that returns an OMathFunc object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

OMathFunc Object

Other resources

OMathFunc Object Members


OMathFunc.E Property (Word)

 Copy code hover
[image]

OMathFunc.E Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMath object that represents the base of the specified equation object. Read-only.

Syntax

expression .E

expression An expression that returns an OMathFunc object.

See also

Concepts

OMathFunc Object

Other resources

OMathFunc Object Members


OMathFunc.FName Property (Word)

 Copy code hover
[image]

OMathFunc.FName Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMath object that represents the name of a mathematical function, such as sin or cos. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .FName

expression An expression that returns an OMathFunc object.

See also

Concepts

OMathFunc Object

Other resources

OMathFunc Object Members


OMathFunc.Parent Property (Word)

 Copy code hover
[image]

OMathFunc.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified OMathFunc object.

Syntax

expression .Parent

expression A variable that represents a OMathFunc object.

See also

Concepts

OMathFunc Object

Other resources

OMathFunc Object Members


OMathFunction Object (Word)

 Copy code hover
[image]

OMathFunction Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a mathematical function or structure that Microsoft Word supports, such as fractions, integrals, sums, and radicals. The OMathFunction object is a member of the OMathFunctions collection.

See also

Concepts

Word Object Model Reference

Other resources

OMathFunction Object Members


OMathFunction Members (Word)

 Copy code hover
[image]

OMathFunction Members (Word)
Send feedback

Published: July 16, 2012

Represents a mathematical function or structure that Microsoft Word supports, such as fractions, integrals, sums, and radicals. The OMathFunction object is a member of the OMathFunctions collection.

Methods

Name | Description
Remove | Removes a function from the collection of functions contained within an equation and returns an OMathFunction object.

Properties

Name | Description
Acc | Returns an OMathAcc object that represents a base character with a combining accent mark. Read-only.
Application | Returns an Application object that represents the Microsoft Word application.
Args | Returns an OMathArgs object that represents the arguments for an equation. Read-only.
Bar | Returns an OMathBar object that represents the mathematical overbar for an object. Read-only.
BorderBox | Returns an OMathBorderBox object that represents a border drawn around an equation or part of an equation. The BorderBox object can also be used to draw horizontal, vertical, and diagonal strikethrough lines through the BorerBox arguments. Read-only.
Box | Returns an OMathBox object that represents an invisible box around an equation or part of an equation to which you can apply properties that affect the mathematical or formatting properties, such as line breaks. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
Delim | Returns an OMathDelim object that represents the delimiter function. Read-only.
EqArray | Returns an OMathEqArray object that represents an equation array function. Read-only.
Frac | Returns an OMathFrac object that represents a fraction. Read-only.
Func | Returns an OMathFunc object that represents a type of mathematical function that consists of a function name, such as sin or cos, and an argument. Read-only.
GroupChar | Returns an OMathGroupChar object that represents a horizontal character placed above or below text in an equation, often with the purpose of grouping the text visually. Read-only.
LimLow | Returns an OMathLimLow object that represents the lower limit for a function. Read-only.
LimUpp | Returns an OMathLimUpp object that represents upper limit function. Read-only.
Mat | Returns an OMathMat object that represents a mathematical matrix. Read-only.
Nary | Returns an OMathNary object that represents the n-ary operation. Read-only.
OMath | Returns an OMath object that represents the equation. Read-only.
Parent | Returns an Object that represents the parent object of the specified OMathFunction object.
Phantom | Returns an OMathPhantom object that represents an object used for advanced layout of an equation. Read-only.
Rad | Returns an OMathRad object that represents the mathematical radical function. Read-only.
Range | Returns a Range object that represents the portion of a document that is contained in the specified object. Read-only.
ScrPre | Returns an OMathScrPre object that represents a superscript and subscript to the left of the base. Read-only.
ScrSub | Represents an OMathScrSub object that represents the mathematical subscript function. Read-only.
ScrSubSup | Returns an OMathScrSubSup object that represents a mathematical subscript-superscript object that consists of a base, a subscript, and a superscript. Read-only.
ScrSup | Returns an OMathScrSup object that represents the mathematical superscript function. Read-only.
Type | Returns a WdOMathFunctionType constant that represents the type of function. Read-only.


OMathFunction Properties (Word)

 Copy code hover
[image]

OMathFunction Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Acc | Returns an OMathAcc object that represents a base character with a combining accent mark. Read-only.
Application | Returns an Application object that represents the Microsoft Word application.
Args | Returns an OMathArgs object that represents the arguments for an equation. Read-only.
Bar | Returns an OMathBar object that represents the mathematical overbar for an object. Read-only.
BorderBox | Returns an OMathBorderBox object that represents a border drawn around an equation or part of an equation. The BorderBox object can also be used to draw horizontal, vertical, and diagonal strikethrough lines through the BorerBox arguments. Read-only.
Box | Returns an OMathBox object that represents an invisible box around an equation or part of an equation to which you can apply properties that affect the mathematical or formatting properties, such as line breaks. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
Delim | Returns an OMathDelim object that represents the delimiter function. Read-only.
EqArray | Returns an OMathEqArray object that represents an equation array function. Read-only.
Frac | Returns an OMathFrac object that represents a fraction. Read-only.
Func | Returns an OMathFunc object that represents a type of mathematical function that consists of a function name, such as sin or cos, and an argument. Read-only.
GroupChar | Returns an OMathGroupChar object that represents a horizontal character placed above or below text in an equation, often with the purpose of grouping the text visually. Read-only.
LimLow | Returns an OMathLimLow object that represents the lower limit for a function. Read-only.
LimUpp | Returns an OMathLimUpp object that represents upper limit function. Read-only.
Mat | Returns an OMathMat object that represents a mathematical matrix. Read-only.
Nary | Returns an OMathNary object that represents the n-ary operation. Read-only.
OMath | Returns an OMath object that represents the equation. Read-only.
Parent | Returns an Object that represents the parent object of the specified OMathFunction object.
Phantom | Returns an OMathPhantom object that represents an object used for advanced layout of an equation. Read-only.
Rad | Returns an OMathRad object that represents the mathematical radical function. Read-only.
Range | Returns a Range object that represents the portion of a document that is contained in the specified object. Read-only.
ScrPre | Returns an OMathScrPre object that represents a superscript and subscript to the left of the base. Read-only.
ScrSub | Represents an OMathScrSub object that represents the mathematical subscript function. Read-only.
ScrSubSup | Returns an OMathScrSubSup object that represents a mathematical subscript-superscript object that consists of a base, a subscript, and a superscript. Read-only.
ScrSup | Returns an OMathScrSup object that represents the mathematical superscript function. Read-only.
Type | Returns a WdOMathFunctionType constant that represents the type of function. Read-only.


OMathFunction.Acc Property (Word)

 Copy code hover
[image]

OMathFunction.Acc Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMathAcc object that represents a base character with a combining accent mark. Read-only.

Syntax

expression .Acc

expression An expression that returns an OMathFunction object.

See also

Concepts

OMathFunction Object

Other resources

OMathFunction Object Members


OMathFunction.Application Property (Word)

 Copy code hover
[image]

OMathFunction.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents an OMathFunction object.

See also

Concepts

OMathFunction Object

Other resources

OMathFunction Object Members


OMathFunction.Args Property (Word)

 Copy code hover
[image]

OMathFunction.Args Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMathArgs object that represents the arguments for an equation. Read-only.

Syntax

expression .Args

expression An expression that returns an OMathFunction object.

See also

Concepts

OMathFunction Object

Other resources

OMathFunction Object Members


OMathFunction.Bar Property (Word)

 Copy code hover
[image]

OMathFunction.Bar Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMathBar object that represents the mathematical overbar for an object. Read-only.

Syntax

expression .Bar

expression An expression that returns an OMathFunction object.

See also

Concepts

OMathFunction Object

Other resources

OMathFunction Object Members


OMathFunction.BorderBox Property (Word)

 Copy code hover
[image]

OMathFunction.BorderBox Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMathBorderBox object that represents a border drawn around an equation or part of an equation. The BorderBox object can also be used to draw horizontal, vertical, and diagonal strikethrough lines through the BorerBox arguments. Read-only.

Syntax

expression .BorderBox

expression An expression that returns an OMathFunction object.

See also

Concepts

OMathFunction Object

Other resources

OMathFunction Object Members


OMathFunction.Box Property (Word)

 Copy code hover
[image]

OMathFunction.Box Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMathBox object that represents an invisible box around an equation or part of an equation to which you can apply properties that affect the mathematical or formatting properties, such as line breaks. Read-only.

Syntax

expression .Box

expression An expression that returns an OMathFunction object.

See also

Concepts

OMathFunction Object

Other resources

OMathFunction Object Members


OMathFunction.Creator Property (Word)

 Copy code hover
[image]

OMathFunction.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.

Syntax

expression .Creator

expression An expression that returns an OMathFunction object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

OMathFunction Object

Other resources

OMathFunction Object Members


OMathFunction.Delim Property (Word)

 Copy code hover
[image]

OMathFunction.Delim Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMathDelim object that represents the delimiter function. Read-only.

Syntax

expression .Delim

expression An expression that returns an OMathFunction object.

See also

Concepts

OMathFunction Object

Other resources

OMathFunction Object Members


OMathFunction.EqArray Property (Word)

 Copy code hover
[image]

OMathFunction.EqArray Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMathEqArray object that represents an equation array function. Read-only.

Syntax

expression .EqArray

expression An expression that returns an OMathFunction object.

See also

Concepts

OMathFunction Object

Other resources

OMathFunction Object Members


OMathFunction.Frac Property (Word)

 Copy code hover
[image]

OMathFunction.Frac Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMathFrac object that represents a fraction. Read-only.

Syntax

expression .Frac

expression An expression that returns an OMathFunction object.

See also

Concepts

OMathFunction Object

Other resources

OMathFunction Object Members


OMathFunction.Func Property (Word)

 Copy code hover
[image]

OMathFunction.Func Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMathFunc object that represents a type of mathematical function that consists of a function name, such as sin or cos, and an argument. Read-only.

Syntax

expression .Func

expression An expression that returns an OMathFunction object.

See also

Concepts

OMathFunction Object

Other resources

OMathFunction Object Members


OMathFunction.GroupChar Property (Word)

 Copy code hover
[image]

OMathFunction.GroupChar Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMathGroupChar object that represents a horizontal character placed above or below text in an equation, often with the purpose of grouping the text visually. Read-only.

Syntax

expression .GroupChar

expression An expression that returns an OMathFunction object.

See also

Concepts

OMathFunction Object

Other resources

OMathFunction Object Members


OMathFunction.LimLow Property (Word)

 Copy code hover
[image]

OMathFunction.LimLow Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMathLimLow object that represents the lower limit for a function. Read-only.

Syntax

expression .LimLow

expression An expression that returns an OMathFunction object.

See also

Concepts

OMathFunction Object

Other resources

OMathFunction Object Members


OMathFunction.LimUpp Property (Word)

 Copy code hover
[image]

OMathFunction.LimUpp Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMathLimUpp object that represents upper limit function. Read-only.

Syntax

expression .LimUpp

expression An expression that returns an OMathFunction object.

See also

Concepts

OMathFunction Object

Other resources

OMathFunction Object Members


OMathFunction.Mat Property (Word)

 Copy code hover
[image]

OMathFunction.Mat Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMathMat object that represents a mathematical matrix. Read-only.

Syntax

expression .Mat

expression An expression that returns an OMathFunction object.

See also

Concepts

OMathFunction Object

Other resources

OMathFunction Object Members


OMathFunction.Nary Property (Word)

 Copy code hover
[image]

OMathFunction.Nary Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMathNary object that represents the n-ary operation. Read-only.

Syntax

expression .Nary

expression An expression that returns an OMathFunction object.

See also

Concepts

OMathFunction Object

Other resources

OMathFunction Object Members


OMathFunction.OMath Property (Word)

 Copy code hover
[image]

OMathFunction.OMath Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMath object that represents the equation. Read-only.

Syntax

expression .OMath

expression An expression that returns an OMathFunction object.

See also

Concepts

OMathFunction Object

Other resources

OMathFunction Object Members


OMathFunction.Parent Property (Word)

 Copy code hover
[image]

OMathFunction.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified OMathFunction object.

Syntax

expression .Parent

expression A variable that represents a OMathFunction object.

See also

Concepts

OMathFunction Object

Other resources

OMathFunction Object Members


OMathFunction.Phantom Property (Word)

 Copy code hover
[image]

OMathFunction.Phantom Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMathPhantom object that represents an object used for advanced layout of an equation. Read-only.

Syntax

expression .Phantom

expression An expression that returns an OMathFunction object.

Remarks

The phantom can be used to add horizontal spacing or vertical spacing, or to suppress part of an equation from being taken into consideration when laying out the equation.

See also

Concepts

OMathFunction Object

Other resources

OMathFunction Object Members


OMathFunction.Rad Property (Word)

 Copy code hover
[image]

OMathFunction.Rad Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMathRad object that represents the mathematical radical function. Read-only.

Syntax

expression .Rad

expression An expression that returns an OMathFunction object.

See also

Concepts

OMathFunction Object

Other resources

OMathFunction Object Members


OMathFunction.Range Property (Word)

 Copy code hover
[image]

OMathFunction.Range Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the portion of a document that is contained in the specified object. Read-only.

Syntax

expression .Range

expression An expression that returns an OMathFunction object.

See also

Concepts

OMathFunction Object

Other resources

OMathFunction Object Members


OMathFunction.ScrPre Property (Word)

 Copy code hover
[image]

OMathFunction.ScrPre Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMathScrPre object that represents a superscript and subscript to the left of the base. Read-only.

Syntax

expression .ScrPre

expression An expression that returns an OMathFunction object.

See also

Concepts

OMathFunction Object

Other resources

OMathFunction Object Members


OMathFunction.ScrSub Property (Word)

 Copy code hover
[image]

OMathFunction.ScrSub Property (Word)
See also Send feedback

Published: July 16, 2012

Represents an OMathScrSub object that represents the mathematical subscript function. Read-only.

Syntax

expression .ScrSub

expression An expression that returns an OMathFunction object.

See also

Concepts

OMathFunction Object

Other resources

OMathFunction Object Members


OMathFunction.ScrSubSup Property (Word)

 Copy code hover
[image]

OMathFunction.ScrSubSup Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMathScrSubSup object that represents a mathematical subscript-superscript object that consists of a base, a subscript, and a superscript. Read-only.

Syntax

expression .ScrSubSup

expression An expression that returns an OMathFunction object.

See also

Concepts

OMathFunction Object

Other resources

OMathFunction Object Members


OMathFunction.ScrSup Property (Word)

 Copy code hover
[image]

OMathFunction.ScrSup Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMathScrSup object that represents the mathematical superscript function. Read-only.

Syntax

expression .ScrSup

expression An expression that returns an OMathFunction object.

See also

Concepts

OMathFunction Object

Other resources

OMathFunction Object Members


OMathFunction.Type Property (Word)

 Copy code hover
[image]

OMathFunction.Type Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a WdOMathFunctionType constant that represents the type of function. Read-only.

Syntax

expression .Type

expression An expression that returns an OMathFunction object.

See also

Concepts

OMathFunction Object

Other resources

OMathFunction Object Members


OMathFunction Methods (Word)

 Copy code hover
[image]

OMathFunction Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Remove | Removes a function from the collection of functions contained within an equation and returns an OMathFunction object.


OMathFunction.Remove Method (Word)

 Copy code hover
[image]

OMathFunction.Remove Method (Word)
See also Send feedback

Published: July 16, 2012

Removes a function from the collection of functions contained within an equation and returns an OMathFunction object.

Version Information

Version Added: Word 2007

Syntax

expression .Remove

expression An expression that returns a OMathFunction object.

Return Value

OMathFunction

See also

Concepts

OMathFunction Object

Other resources

OMathFunction Object Members


OMathFunctions Object (Word)

 Copy code hover
[image]

OMathFunctions Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a collection of functions or structures that Microsoft Word supports, such as fractions, integrals, sums, and radicals.

See also

Concepts

Word Object Model Reference

Other resources

OMathFunctions Object Members


OMathFunctions Members (Word)

 Copy code hover
[image]

OMathFunctions Members (Word)
Send feedback

Published: July 16, 2012

Represents a collection of functions or structures that Microsoft Word supports, such as fractions, integrals, sums, and radicals.

Methods

Name | Description
Add | Inserts a new structure, such as a fraction, into an equation at the specified position and returns an OMathFunction object that represents the structure.
Item | Returns an OMathFunction object that represents the specified item in the collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns the number of items in the OMathFunctions collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified OMathFunctions object.


OMathFunctions Properties (Word)

 Copy code hover
[image]

OMathFunctions Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns the number of items in the OMathFunctions collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified OMathFunctions object.


OMathFunctions.Application Property (Word)

 Copy code hover
[image]

OMathFunctions.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents an OMathFunctions collection.

See also

Concepts

OMathFunctions Collection

Other resources

OMathFunctions Object Members


OMathFunctions.Count Property (Word)

 Copy code hover
[image]

OMathFunctions.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the number of items in the OMathFunctions collection. Read-only Long.

Syntax

expression .Count

expression A variable that represents a OMathFunctions object.

See also

Concepts

OMathFunctions Collection

Other resources

OMathFunctions Object Members


OMathFunctions.Creator Property (Word)

 Copy code hover
[image]

OMathFunctions.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.

Syntax

expression .Creator

expression An expression that returns an OMathFunctions object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

OMathFunctions Collection

Other resources

OMathFunctions Object Members


OMathFunctions.Parent Property (Word)

 Copy code hover
[image]

OMathFunctions.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified OMathFunctions object.

Syntax

expression .Parent

expression A variable that represents a OMathFunctions object.

See also

Concepts

OMathFunctions Collection

Other resources

OMathFunctions Object Members


OMathFunctions Methods (Word)

 Copy code hover
[image]

OMathFunctions Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Inserts a new structure, such as a fraction, into an equation at the specified position and returns an OMathFunction object that represents the structure.
Item | Returns an OMathFunction object that represents the specified item in the collection.


OMathFunctions.Add Method (Word)

 Copy code hover
[image]

OMathFunctions.Add Method (Word)
See also Send feedback

Published: July 16, 2012

Inserts a new structure, such as a fraction, into an equation at the specified position and returns an OMathFunction object that represents the structure.

Version Information

Version Added: Word 2007

Syntax

expression .Add(Range, Type, NumArgs, NumCols)

expression An expression that returns a OMathFunctions object.

Parameters

Name | Required/Optional | Data Type | Description
Range | Required | Range | The place at which to insrt an equation.
Type | Required | WdOMathFunctionType | The type of equation to insert.
NumArgs | Optional | Variant | The number of arguments in the equation.
NumCols | Optional | Variant | The number of columns in the equation.

Return Value

OMathFunction

See also

Concepts

OMathFunctions Collection

Other resources

OMathFunctions Object Members


OMathFunctions.Item Method (Word)

 Copy code hover
[image]

OMathFunctions.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMathFunction object that represents the specified item in the collection.

Syntax

expression .Item(Index)

expression An expression that returns an OMathFunctions object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | Specifies the ordinal position of the object within the collection.

Return Value

OMathFunction

See also

Concepts

OMathFunctions Collection

Other resources

OMathFunctions Object Members


OMathGroupChar Object (Word)

 Copy code hover
[image]

OMathGroupChar Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a group character object, consisting of a character drawn above or below text, often with the purpose of visually grouping items.

Version Information

Version Added: Word 2007

Remarks

Generally, this character is a curly brace, bracket, or arrow but it can be any character.

See also

Concepts

Word Object Model Reference

Other resources

OMathGroupChar Object Members


OMathGroupChar Members (Word)

 Copy code hover
[image]

OMathGroupChar Members (Word)
Send feedback

Published: July 16, 2012

Represents a group character object, consisting of a character drawn above or below text, often with the purpose of visually grouping items.

Properties

Name | Description
AlignTop | Returns or sets a Boolean that represents whether the grouping character is aligned vertically with the surrounding text or whether the base text that is either above or below the grouping character is aligned vertically with the surrounding text. Read/write.
Application | Returns an Application object that represents the Microsoft Word application.
Char | Returns or sets an Integer that represents the character placed above or below text in a group character object. Read/write.
CharTop | Returns or sets a Boolean that represents whether the grouping character is placed above the base text of the group character object. False displays the group character under the base text. Read/write.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
E | Returns an OMath object that represents the base of the specified equation object. Read-only.
Parent | Returns an Object that represents the parent object of the specified OMathGroupChar object.


OMathGroupChar Properties (Word)

 Copy code hover
[image]

OMathGroupChar Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
AlignTop | Returns or sets a Boolean that represents whether the grouping character is aligned vertically with the surrounding text or whether the base text that is either above or below the grouping character is aligned vertically with the surrounding text. Read/write.
Application | Returns an Application object that represents the Microsoft Word application.
Char | Returns or sets an Integer that represents the character placed above or below text in a group character object. Read/write.
CharTop | Returns or sets a Boolean that represents whether the grouping character is placed above the base text of the group character object. False displays the group character under the base text. Read/write.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
E | Returns an OMath object that represents the base of the specified equation object. Read-only.
Parent | Returns an Object that represents the parent object of the specified OMathGroupChar object.


OMathGroupChar.AlignTop Property (Word)

 Copy code hover
[image]

OMathGroupChar.AlignTop Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents whether the grouping character is aligned vertically with the surrounding text or whether the base text that is either above or below the grouping character is aligned vertically with the surrounding text. Read/write.

Syntax

expression .AlignTop

expression An expression that returns an OMathGroupChar object.

Remarks

True indicates that the grouping character is aligned vertically with the surrounding text. False indicates that the base text that is either above or below the grouping character is aligned vertically with the surrounding text.

See also

Concepts

OMathGroupChar Object

Other resources

OMathGroupChar Object Members


OMathGroupChar.Application Property (Word)

 Copy code hover
[image]

OMathGroupChar.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents an OMathGroupChar object.

See also

Concepts

OMathGroupChar Object

Other resources

OMathGroupChar Object Members


OMathGroupChar.Char Property (Word)

 Copy code hover
[image]

OMathGroupChar.Char Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets an Integer that represents the character placed above or below text in a group character object. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .Char

expression An expression that returns an OMathGroupChar object.

See also

Concepts

OMathGroupChar Object

Other resources

OMathGroupChar Object Members


OMathGroupChar.CharTop Property (Word)

 Copy code hover
[image]

OMathGroupChar.CharTop Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents whether the grouping character is placed above the base text of the group character object. False displays the group character under the base text. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .CharTop

expression An expression that returns an OMathGroupChar object.

See also

Concepts

OMathGroupChar Object

Other resources

OMathGroupChar Object Members


OMathGroupChar.Creator Property (Word)

 Copy code hover
[image]

OMathGroupChar.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.

Syntax

expression .Creator

expression An expression that returns an OMathGroupChar object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

OMathGroupChar Object

Other resources

OMathGroupChar Object Members


OMathGroupChar.E Property (Word)

 Copy code hover
[image]

OMathGroupChar.E Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMath object that represents the base of the specified equation object. Read-only.

Syntax

expression .E

expression An expression that returns an OMathGroupChar object.

See also

Concepts

OMathGroupChar Object

Other resources

OMathGroupChar Object Members


OMathGroupChar.Parent Property (Word)

 Copy code hover
[image]

OMathGroupChar.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified OMathGroupChar object.

Syntax

expression .Parent

expression A variable that represents a OMathGroupChar object.

See also

Concepts

OMathGroupChar Object

Other resources

OMathGroupChar Object Members


OMathLimLow Object (Word)

 Copy code hover
[image]

OMathLimLow Object (Word)
See also Send feedback

Published: July 16, 2012

Represents the lower limit mathematical construct, consisting of text on the baseline and reduced-size text immediately below it.

See also

Concepts

Word Object Model Reference

Other resources

OMathLimLow Object Members


OMathLimLow Members (Word)

 Copy code hover
[image]

OMathLimLow Members (Word)
Send feedback

Published: July 16, 2012

Represents the lower limit mathematical construct, consisting of text on the baseline and reduced-size text immediately below it.

Methods

Name | Description
ToLimUpp | Converts an equation from the lower limit to the upper limit. .

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
E | Returns an OMath object that represents the base of the specified equation object. Read-only.
Lim | Returns an OMath object that represents the limit of the lower limit object. Read-only.
Parent | Returns an Object that represents the parent object of the specified OMathLimLow object.


OMathLimLow Properties (Word)

 Copy code hover
[image]

OMathLimLow Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
E | Returns an OMath object that represents the base of the specified equation object. Read-only.
Lim | Returns an OMath object that represents the limit of the lower limit object. Read-only.
Parent | Returns an Object that represents the parent object of the specified OMathLimLow object.


OMathLimLow.Application Property (Word)

 Copy code hover
[image]

OMathLimLow.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents an OMathLimLow object.

See also

Concepts

OMathLimLow Object

Other resources

OMathLimLow Object Members


OMathLimLow.Creator Property (Word)

 Copy code hover
[image]

OMathLimLow.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.

Syntax

expression .Creator

expression An expression that returns an OMathLimLow object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

OMathLimLow Object

Other resources

OMathLimLow Object Members


OMathLimLow.E Property (Word)

 Copy code hover
[image]

OMathLimLow.E Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMath object that represents the base of the specified equation object. Read-only.

Syntax

expression .E

expression An expression that returns an OMathLimLow object.

See also

Concepts

OMathLimLow Object

Other resources

OMathLimLow Object Members


OMathLimLow.Lim Property (Word)

 Copy code hover
[image]

OMathLimLow.Lim Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMath object that represents the limit of the lower limit object. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Lim

expression An expression that returns an OMathLimLow object.

See also

Concepts

OMathLimLow Object

Other resources

OMathLimLow Object Members


OMathLimLow.Parent Property (Word)

 Copy code hover
[image]

OMathLimLow.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified OMathLimLow object.

Syntax

expression .Parent

expression A variable that represents a OMathLimLow object.

See also

Concepts

OMathLimLow Object

Other resources

OMathLimLow Object Members


OMathLimLow Methods (Word)

 Copy code hover
[image]

OMathLimLow Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
ToLimUpp | Converts an equation from the lower limit to the upper limit. .


OMathLimLow.ToLimUpp Method (Word)

 Copy code hover
[image]

OMathLimLow.ToLimUpp Method (Word)
See also Send feedback

Published: July 16, 2012

Converts an equation from the lower limit to the upper limit. .

Version Information

Version Added: Word 2007

Syntax

expression .ToLimUpp

expression An expression that returns a OMathLimLow object.

Return Value

OMathFunction

See also

Concepts

OMathLimLow Object

Other resources

OMathLimLow Object Members


OMathLimUpp Object (Word)

 Copy code hover
[image]

OMathLimUpp Object (Word)
See also Send feedback

Published: July 16, 2012

Represents the upper limit mathematical construct, consisting of text on the baseline and reduced-size text immediately above it.

See also

Concepts

Word Object Model Reference

Other resources

OMathLimUpp Object Members


OMathLimUpp Members (Word)

 Copy code hover
[image]

OMathLimUpp Members (Word)
Send feedback

Published: July 16, 2012

Represents the upper limit mathematical construct, consisting of text on the baseline and reduced-size text immediately above it.

Methods

Name | Description
ToLimLow | Converts an equation from the upper limit to the lower limit.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
E | Returns an OMath object that represents the base of the specified equation object. Read-only.
Lim | Returns an OMath object that represents the limit of the upper limit object. Read-only.
Parent | Returns an Object that represents the parent object of the specified OMathLimUpp object.


OMathLimUpp Properties (Word)

 Copy code hover
[image]

OMathLimUpp Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
E | Returns an OMath object that represents the base of the specified equation object. Read-only.
Lim | Returns an OMath object that represents the limit of the upper limit object. Read-only.
Parent | Returns an Object that represents the parent object of the specified OMathLimUpp object.


OMathLimUpp.Application Property (Word)

 Copy code hover
[image]

OMathLimUpp.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents an OMathLimUpp object.

See also

Concepts

OMathLimUpp Object

Other resources

OMathLimUpp Object Members


OMathLimUpp.Creator Property (Word)

 Copy code hover
[image]

OMathLimUpp.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.

Syntax

expression .Creator

expression An expression that returns an OMathLimUpp object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

OMathLimUpp Object

Other resources

OMathLimUpp Object Members


OMathLimUpp.E Property (Word)

 Copy code hover
[image]

OMathLimUpp.E Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMath object that represents the base of the specified equation object. Read-only.

Syntax

expression .E

expression An expression that returns an OMathLimUpp object.

See also

Concepts

OMathLimUpp Object

Other resources

OMathLimUpp Object Members


OMathLimUpp.Lim Property (Word)

 Copy code hover
[image]

OMathLimUpp.Lim Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMath object that represents the limit of the upper limit object. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Lim

expression An expression that returns an OMathLimUpp object.

See also

Concepts

OMathLimUpp Object

Other resources

OMathLimUpp Object Members


OMathLimUpp.Parent Property (Word)

 Copy code hover
[image]

OMathLimUpp.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified OMathLimUpp object.

Syntax

expression .Parent

expression A variable that represents a OMathLimUpp object.

See also

Concepts

OMathLimUpp Object

Other resources

OMathLimUpp Object Members


OMathLimUpp Methods (Word)

 Copy code hover
[image]

OMathLimUpp Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
ToLimLow | Converts an equation from the upper limit to the lower limit.


OMathLimUpp.ToLimLow Method (Word)

 Copy code hover
[image]

OMathLimUpp.ToLimLow Method (Word)
See also Send feedback

Published: July 16, 2012

Converts an equation from the upper limit to the lower limit.

Version Information

Version Added: Word 2007

Syntax

expression .ToLimLow

expression An expression that returns a OMathLimUpp object.

Return Value

OMathFunction

See also

Concepts

OMathLimUpp Object

Other resources

OMathLimUpp Object Members


OMathMat Object (Word)

 Copy code hover
[image]

OMathMat Object (Word)
See also Send feedback

Published: July 16, 2012

Represents an equation matrix.

See also

Concepts

Word Object Model Reference

Other resources

OMathMat Object Members


OMathMat Members (Word)

 Copy code hover
[image]

OMathMat Members (Word)
Send feedback

Published: July 16, 2012

Represents an equation matrix.

Properties

Name | Description
Align | Returns or sets a WdOMathVertAlignType constant that represents the vertical alignment for a matrix. Read/write.
Application | Returns an Application object that represents the Microsoft Word application.
Cell | Returns an OMath object that represents a cell in a matrix. Read-only.
ColGap | Returns or sets a Long that represents the spacing between columns in a matrix. Read/write.
ColGapRule | Returns or sets a WdOMathSpacingRule constant that represents the spacing rule for the space that appears between columns in a matrix. Read/write.
Cols | Returns an OMathMatCols collection that represents the columns in a matrix. Read-only.
ColSpacing | Returns or sets a Long that represents the spacing for columns in a matrix. Read/write.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified OMathMat object.
PlcHoldHidden | Returns or sets a Boolean that represents whether placeholders in a matrix are hidden from display. True hides placeholder text. Read/write.
Rows | Returns an OMathMatRows object that represents the rows in a matrix. Read-only.
RowSpacing | Returns or sets a Long that represents the spacing for rows in a matrix. Read/write.
RowSpacingRule | Returns or sets a WdOMathSpacingRule constant that represents the spacing rule for rows in a matrix. Read/write.


OMathMat Properties (Word)

 Copy code hover
[image]

OMathMat Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Align | Returns or sets a WdOMathVertAlignType constant that represents the vertical alignment for a matrix. Read/write.
Application | Returns an Application object that represents the Microsoft Word application.
Cell | Returns an OMath object that represents a cell in a matrix. Read-only.
ColGap | Returns or sets a Long that represents the spacing between columns in a matrix. Read/write.
ColGapRule | Returns or sets a WdOMathSpacingRule constant that represents the spacing rule for the space that appears between columns in a matrix. Read/write.
Cols | Returns an OMathMatCols collection that represents the columns in a matrix. Read-only.
ColSpacing | Returns or sets a Long that represents the spacing for columns in a matrix. Read/write.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified OMathMat object.
PlcHoldHidden | Returns or sets a Boolean that represents whether placeholders in a matrix are hidden from display. True hides placeholder text. Read/write.
Rows | Returns an OMathMatRows object that represents the rows in a matrix. Read-only.
RowSpacing | Returns or sets a Long that represents the spacing for rows in a matrix. Read/write.
RowSpacingRule | Returns or sets a WdOMathSpacingRule constant that represents the spacing rule for rows in a matrix. Read/write.


OMathMat.Align Property (Word)

 Copy code hover
[image]

OMathMat.Align Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a WdOMathVertAlignType constant that represents the vertical alignment for a matrix. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .Align

expression An expression that returns an OMathMat object.

See also

Concepts

OMathMat Object

Other resources

OMathMat Object Members


OMathMat.Application Property (Word)

 Copy code hover
[image]

OMathMat.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents an OMathMat object.

See also

Concepts

OMathMat Object

Other resources

OMathMat Object Members


OMathMat.Cell Property (Word)

 Copy code hover
[image]

OMathMat.Cell Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMath object that represents a cell in a matrix. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Cell(Row, Col)

expression An expression that returns an OMathMat object.

Parameters

Name | Required/Optional | Data Type | Description
Row | Required | Long | The matrix row in which the cell is located.
Col | Required | Long | The matrix column in which the cell is located.

See also

Concepts

OMathMat Object

Other resources

OMathMat Object Members


OMathMat.ColGap Property (Word)

 Copy code hover
[image]

OMathMat.ColGap Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Long that represents the spacing between columns in a matrix. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .ColGap

expression An expression that returns an OMathMat object.

See also

Concepts

OMathMat Object

Other resources

OMathMat Object Members


OMathMat.ColGapRule Property (Word)

 Copy code hover
[image]

OMathMat.ColGapRule Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a WdOMathSpacingRule constant that represents the spacing rule for the space that appears between columns in a matrix. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .ColGapRule

expression An expression that returns an OMathMat object.

See also

Concepts

OMathMat Object

Other resources

OMathMat Object Members


OMathMat.Cols Property (Word)

 Copy code hover
[image]

OMathMat.Cols Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMathMatCols collection that represents the columns in a matrix. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Cols

expression An expression that returns an OMathMat object.

See also

Concepts

OMathMat Object

Other resources

OMathMat Object Members


OMathMat.ColSpacing Property (Word)

 Copy code hover
[image]

OMathMat.ColSpacing Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Long that represents the spacing for columns in a matrix. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .ColSpacing

expression An expression that returns an OMathMat object.

See also

Concepts

OMathMat Object

Other resources

OMathMat Object Members


OMathMat.Creator Property (Word)

 Copy code hover
[image]

OMathMat.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.

Syntax

expression .Creator

expression An expression that returns an OMathMat object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

OMathMat Object

Other resources

OMathMat Object Members


OMathMat.Parent Property (Word)

 Copy code hover
[image]

OMathMat.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified OMathMat object.

Syntax

expression .Parent

expression A variable that represents a OMathMat object.

See also

Concepts

OMathMat Object

Other resources

OMathMat Object Members


OMathMat.PlcHoldHidden Property (Word)

 Copy code hover
[image]

OMathMat.PlcHoldHidden Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents whether placeholders in a matrix are hidden from display. True hides placeholder text. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .PlcHoldHidden

expression An expression that returns an OMathMat object.

See also

Concepts

OMathMat Object

Other resources

OMathMat Object Members


OMathMat.Rows Property (Word)

 Copy code hover
[image]

OMathMat.Rows Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMathMatRows object that represents the rows in a matrix. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Rows

expression An expression that returns an OMathMat object.

See also

Concepts

OMathMat Object

Other resources

OMathMat Object Members


OMathMat.RowSpacing Property (Word)

 Copy code hover
[image]

OMathMat.RowSpacing Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Long that represents the spacing for rows in a matrix. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .RowSpacing

expression An expression that returns an OMathMat object.

See also

Concepts

OMathMat Object

Other resources

OMathMat Object Members


OMathMat.RowSpacingRule Property (Word)

 Copy code hover
[image]

OMathMat.RowSpacingRule Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a WdOMathSpacingRule constant that represents the spacing rule for rows in a matrix. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .RowSpacingRule

expression An expression that returns an OMathMat object.

See also

Concepts

OMathMat Object

Other resources

OMathMat Object Members


OMathMatCol Object (Word)

 Copy code hover
[image]

OMathMatCol Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a matrix column. The OMathMatCol is a member of the OMathMatCols collection.

See also

Concepts

Word Object Model Reference

Other resources

OMathMatCol Object Members


OMathMatCol Members (Word)

 Copy code hover
[image]

OMathMatCol Members (Word)
Send feedback

Published: July 16, 2012

Represents a matrix column. The OMathMatCol is a member of the OMathMatCols collection.

Methods

Name | Description
Delete | Deletes the specified matrix column.

Properties

Name | Description
Align | Returns or sets a WdOMathHorizAlignType constant that represents the horizontal alignment for arguments in a matrix column. Read/write.
Application | Returns an Application object that represents the Microsoft Word application.
Args | Returns an OMathArgs object that represents the arguments in a matrix column. Read-only.
ColIndex | Returns a Long that represents the ordinal position of a column within the collection of columns in a matrix. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified OMathMatCol object.


OMathMatCol Properties (Word)

 Copy code hover
[image]

OMathMatCol Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Align | Returns or sets a WdOMathHorizAlignType constant that represents the horizontal alignment for arguments in a matrix column. Read/write.
Application | Returns an Application object that represents the Microsoft Word application.
Args | Returns an OMathArgs object that represents the arguments in a matrix column. Read-only.
ColIndex | Returns a Long that represents the ordinal position of a column within the collection of columns in a matrix. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified OMathMatCol object.


OMathMatCol.Align Property (Word)

 Copy code hover
[image]

OMathMatCol.Align Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a WdOMathHorizAlignType constant that represents the horizontal alignment for arguments in a matrix column. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .Align

expression An expression that returns an OMathMatCol object.

See also

Concepts

OMathMatCol Object

Other resources

OMathMatCol Object Members


OMathMatCol.Application Property (Word)

 Copy code hover
[image]

OMathMatCol.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents an OMathMatCol object.

See also

Concepts

OMathMatCol Object

Other resources

OMathMatCol Object Members


OMathMatCol.Args Property (Word)

 Copy code hover
[image]

OMathMatCol.Args Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMathArgs object that represents the arguments in a matrix column. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Args

expression An expression that returns an OMathMatCol object.

See also

Concepts

OMathMatCol Object

Other resources

OMathMatCol Object Members


OMathMatCol.ColIndex Property (Word)

 Copy code hover
[image]

OMathMatCol.ColIndex Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the ordinal position of a column within the collection of columns in a matrix. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .ColIndex

expression An expression that returns an OMathMatCol object.

See also

Concepts

OMathMatCol Object

Other resources

OMathMatCol Object Members


OMathMatCol.Creator Property (Word)

 Copy code hover
[image]

OMathMatCol.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.

Syntax

expression .Creator

expression An expression that returns an OMathMatCol object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

OMathMatCol Object

Other resources

OMathMatCol Object Members


OMathMatCol.Parent Property (Word)

 Copy code hover
[image]

OMathMatCol.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified OMathMatCol object.

Syntax

expression .Parent

expression A variable that represents a OMathMatCol object.

See also

Concepts

OMathMatCol Object

Other resources

OMathMatCol Object Members


OMathMatCol Methods (Word)

 Copy code hover
[image]

OMathMatCol Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the specified matrix column.


OMathMatCol.Delete Method (Word)

 Copy code hover
[image]

OMathMatCol.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the specified matrix column.

Syntax

expression .Delete

expression An expression that returns an OMathMatCol object.

See also

Concepts

OMathMatCol Object

Other resources

OMathMatCol Object Members


OMathMatCols Object (Word)

 Copy code hover
[image]

OMathMatCols Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a collection of matrix columns. Use the OMathMatCol object to access individual members of the collection.

See also

Concepts

Word Object Model Reference

Other resources

OMathMatCols Object Members


OMathMatCols Members (Word)

 Copy code hover
[image]

OMathMatCols Members (Word)
Send feedback

Published: July 16, 2012

Represents a collection of matrix columns. Use the OMathMatCol object to access individual members of the collection.

Methods

Name | Description
Add | Creates an equation column and adds it to a matrix and returns an OMathMatCol object.
Item | Returns an OMathMatCol object that represents the specified item in the collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns the number of items in the OMathMatCols collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified OMathMatCols object.


OMathMatCols Properties (Word)

 Copy code hover
[image]

OMathMatCols Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns the number of items in the OMathMatCols collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified OMathMatCols object.


OMathMatCols.Application Property (Word)

 Copy code hover
[image]

OMathMatCols.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents an OMathMatCols collection.

See also

Concepts

OMathMatCols Collection

Other resources

OMathMatCols Object Members


OMathMatCols.Count Property (Word)

 Copy code hover
[image]

OMathMatCols.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the number of items in the OMathMatCols collection. Read-only Long.

Syntax

expression .Count

expression A variable that represents a OMathMatCols object.

See also

Concepts

OMathMatCols Collection

Other resources

OMathMatCols Object Members


OMathMatCols.Creator Property (Word)

 Copy code hover
[image]

OMathMatCols.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.

Syntax

expression .Creator

expression An expression that returns an OMathMatCols object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

OMathMatCols Collection

Other resources

OMathMatCols Object Members


OMathMatCols.Parent Property (Word)

 Copy code hover
[image]

OMathMatCols.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified OMathMatCols object.

Syntax

expression .Parent

expression A variable that represents a OMathMatCols object.

See also

Concepts

OMathMatCols Collection

Other resources

OMathMatCols Object Members


OMathMatCols Methods (Word)

 Copy code hover
[image]

OMathMatCols Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Creates an equation column and adds it to a matrix and returns an OMathMatCol object.
Item | Returns an OMathMatCol object that represents the specified item in the collection.


OMathMatCols.Add Method (Word)

 Copy code hover
[image]

OMathMatCols.Add Method (Word)
See also Send feedback

Published: July 16, 2012

Creates an equation column and adds it to a matrix and returns an OMathMatCol object.

Version Information

Version Added: Word 2007

Syntax

expression .Add(BeforeCol)

expression An expression that returns a OMathMatCols object.

Parameters

Name | Required/Optional | Data Type | Description
BeforeCol | Optional | Variant | An existing column in the matrix before which to place the new column.

Return Value

OMathMatCol

See also

Concepts

OMathMatCols Collection

Other resources

OMathMatCols Object Members


OMathMatCols.Item Method (Word)

 Copy code hover
[image]

OMathMatCols.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMathMatCol object that represents the specified item in the collection.

Syntax

expression .Item(Index)

expression An expression that returns an OMathMatCols object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | Specifies the ordinal position of the object within the collection.

Return Value

OMathMatCol

See also

Concepts

OMathMatCols Collection

Other resources

OMathMatCols Object Members


OMathMatRow Object (Word)

 Copy code hover
[image]

OMathMatRow Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a matrix row. The OMathMatRow is a member of the OMathMatRows collection.

See also

Concepts

Word Object Model Reference

Other resources

OMathMatRow Object Members


OMathMatRow Members (Word)

 Copy code hover
[image]

OMathMatRow Members (Word)
Send feedback

Published: July 16, 2012

Represents a matrix row. The OMathMatRow is a member of the OMathMatRows collection.

Methods

Name | Description
Delete | Deletes the specified matrix row.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Args | Returns an OMathArgs object that represents the arguments in a matrix row. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified OMathMatRow object.
RowIndex | Returns or sets a Long that represents the ordinal position of a matrix row within the collection of matrix rows. Read/write.


OMathMatRow Properties (Word)

 Copy code hover
[image]

OMathMatRow Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Args | Returns an OMathArgs object that represents the arguments in a matrix row. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified OMathMatRow object.
RowIndex | Returns or sets a Long that represents the ordinal position of a matrix row within the collection of matrix rows. Read/write.


OMathMatRow.Application Property (Word)

 Copy code hover
[image]

OMathMatRow.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents an OMathMatRow object.

See also

Concepts

OMathMatRow Object

Other resources

OMathMatRow Object Members


OMathMatRow.Args Property (Word)

 Copy code hover
[image]

OMathMatRow.Args Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMathArgs object that represents the arguments in a matrix row. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Args

expression An expression that returns an OMathMatRow object.

See also

Concepts

OMathMatRow Object

Other resources

OMathMatRow Object Members


OMathMatRow.Creator Property (Word)

 Copy code hover
[image]

OMathMatRow.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.

Syntax

expression .Creator

expression An expression that returns an OMathMatRow object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

OMathMatRow Object

Other resources

OMathMatRow Object Members


OMathMatRow.Parent Property (Word)

 Copy code hover
[image]

OMathMatRow.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified OMathMatRow object.

Syntax

expression .Parent

expression A variable that represents a OMathMatRow object.

See also

Concepts

OMathMatRow Object

Other resources

OMathMatRow Object Members


OMathMatRow.RowIndex Property (Word)

 Copy code hover
[image]

OMathMatRow.RowIndex Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Long that represents the ordinal position of a matrix row within the collection of matrix rows. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .RowIndex

expression An expression that returns an OMathMatRow object.

See also

Concepts

OMathMatRow Object

Other resources

OMathMatRow Object Members


OMathMatRow Methods (Word)

 Copy code hover
[image]

OMathMatRow Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the specified matrix row.


OMathMatRow.Delete Method (Word)

 Copy code hover
[image]

OMathMatRow.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the specified matrix row.

Syntax

expression .Delete

expression An expression that returns an OMathMatRow object.

See also

Concepts

OMathMatRow Object

Other resources

OMathMatRow Object Members


OMathMatRows Object (Word)

 Copy code hover
[image]

OMathMatRows Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a collection of matrix rows. Use the OMathMatRow object to access individual membes of the collection.

See also

Concepts

Word Object Model Reference

Other resources

OMathMatRows Object Members


OMathMatRows Members (Word)

 Copy code hover
[image]

OMathMatRows Members (Word)
Send feedback

Published: July 16, 2012

Represents a collection of matrix rows. Use the OMathMatRow object to access individual membes of the collection.

Methods

Name | Description
Add | Creates an equation row and adds it to a matrix and returns an OMathMatRow object.
Item | Returns an OMathMatRow object that represents the specified item in the collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns the number of items in the OMathMatRows collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified OMathMatRows object.


OMathMatRows Properties (Word)

 Copy code hover
[image]

OMathMatRows Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns the number of items in the OMathMatRows collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified OMathMatRows object.


OMathMatRows.Application Property (Word)

 Copy code hover
[image]

OMathMatRows.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents an OMathMatRows collection.

See also

Concepts

OMathMatRows Collection

Other resources

OMathMatRows Object Members


OMathMatRows.Count Property (Word)

 Copy code hover
[image]

OMathMatRows.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the number of items in the OMathMatRows collection. Read-only Long.

Syntax

expression .Count

expression A variable that represents a OMathMatRows object.

See also

Concepts

OMathMatRows Collection

Other resources

OMathMatRows Object Members


OMathMatRows.Creator Property (Word)

 Copy code hover
[image]

OMathMatRows.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.

Syntax

expression .Creator

expression An expression that returns an OMathMatRows object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

OMathMatRows Collection

Other resources

OMathMatRows Object Members


OMathMatRows.Parent Property (Word)

 Copy code hover
[image]

OMathMatRows.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified OMathMatRows object.

Syntax

expression .Parent

expression A variable that represents a OMathMatRows object.

See also

Concepts

OMathMatRows Collection

Other resources

OMathMatRows Object Members


OMathMatRows Methods (Word)

 Copy code hover
[image]

OMathMatRows Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Creates an equation row and adds it to a matrix and returns an OMathMatRow object.
Item | Returns an OMathMatRow object that represents the specified item in the collection.


OMathMatRows.Add Method (Word)

 Copy code hover
[image]

OMathMatRows.Add Method (Word)
See also Send feedback

Published: July 16, 2012

Creates an equation row and adds it to a matrix and returns an OMathMatRow object.

Version Information

Version Added: Word 2007

Syntax

expression .Add(BeforeRow)

expression An expression that returns a OMathMatRows object.

Parameters

Name | Required/Optional | Data Type | Description
BeforeRow | Optional | Variant | An existing row in the matrix before which to place the new row.

Return Value

OMathMatRow

See also

Concepts

OMathMatRows Collection

Other resources

OMathMatRows Object Members


OMathMatRows.Item Method (Word)

 Copy code hover
[image]

OMathMatRows.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMathMatRow object that represents the specified item in the collection.

Syntax

expression .Item(Index)

expression An expression that returns an OMathMatRows object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | Specifies the ordinal position of the object within the collection.

Return Value

OMathMatRow

See also

Concepts

OMathMatRows Collection

Other resources

OMathMatRows Object Members


OMathNary Object (Word)

 Copy code hover
[image]

OMathNary Object (Word)
See also Send feedback

Published: July 16, 2012

Represents the mathematical n-ary object, consisting of an n-ary object, a base (or operand), and optional upper limits and lower limits.

Version Information

Version Added: Word 2007

See also

Concepts

Word Object Model Reference

Other resources

OMathNary Object Members


OMathNary Members (Word)

 Copy code hover
[image]

OMathNary Members (Word)
Send feedback

Published: July 16, 2012

Represents the mathematical n-ary object, consisting of an n-ary object, a base (or operand), and optional upper limits and lower limits.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Char | Returns or sets an Integer that represents a character used as the n-ary operator. Read/write.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
E | Returns an OMath object that represents the base of the specified equation object. Read-only.
Grow | Returns or sets a Boolean that represents whether n-ary operators grow to the full height of the arguments that they contain. Read/write.
HideSub | Returns or sets a Boolean that represents whether to hide the lower limit of an n-ary operator. Read/write.
HideSup | Returns or sets a Boolean that represents whether to hide the upper limit of an n-ary operator. Read/write.
Parent | Returns an Object that represents the parent object of the specified OMathNary object.
Sub | Returns an OMath object that represents the lower limit of an n-ary operator. Read-only.
SubSupLim | Returns or sets a Boolean that represents the positioning of n-ary limits in the subscript-superscript or upper limit-lower limit position. Read/write.
Sup | Returns an OMath object that represents the upper limit of an n-ary operator. Read-only.


OMathNary Properties (Word)

 Copy code hover
[image]

OMathNary Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Char | Returns or sets an Integer that represents a character used as the n-ary operator. Read/write.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
E | Returns an OMath object that represents the base of the specified equation object. Read-only.
Grow | Returns or sets a Boolean that represents whether n-ary operators grow to the full height of the arguments that they contain. Read/write.
HideSub | Returns or sets a Boolean that represents whether to hide the lower limit of an n-ary operator. Read/write.
HideSup | Returns or sets a Boolean that represents whether to hide the upper limit of an n-ary operator. Read/write.
Parent | Returns an Object that represents the parent object of the specified OMathNary object.
Sub | Returns an OMath object that represents the lower limit of an n-ary operator. Read-only.
SubSupLim | Returns or sets a Boolean that represents the positioning of n-ary limits in the subscript-superscript or upper limit-lower limit position. Read/write.
Sup | Returns an OMath object that represents the upper limit of an n-ary operator. Read-only.


OMathNary.Application Property (Word)

 Copy code hover
[image]

OMathNary.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents an OMathNary object.

See also

Concepts

OMathNary Object

Other resources

OMathNary Object Members


OMathNary.Char Property (Word)

 Copy code hover
[image]

OMathNary.Char Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets an Integer that represents a character used as the n-ary operator. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .Char

expression An expression that returns an OMathNary object.

See also

Concepts

OMathNary Object

Other resources

OMathNary Object Members


OMathNary.Creator Property (Word)

 Copy code hover
[image]

OMathNary.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.

Syntax

expression .Creator

expression An expression that returns an OMathNary object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

OMathNary Object

Other resources

OMathNary Object Members


OMathNary.E Property (Word)

 Copy code hover
[image]

OMathNary.E Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMath object that represents the base of the specified equation object. Read-only.

Syntax

expression .E

expression An expression that returns an OMathNary object.

See also

Concepts

OMathNary Object

Other resources

OMathNary Object Members


OMathNary.Grow Property (Word)

 Copy code hover
[image]

OMathNary.Grow Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents whether n-ary operators grow to the full height of the arguments that they contain. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .Grow

expression An expression that returns an OMathNary object.

See also

Concepts

OMathNary Object

Other resources

OMathNary Object Members


OMathNary.HideSub Property (Word)

 Copy code hover
[image]

OMathNary.HideSub Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents whether to hide the lower limit of an n-ary operator. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .HideSub

expression An expression that returns an OMathNary object.

See also

Concepts

OMathNary Object

Other resources

OMathNary Object Members


OMathNary.HideSup Property (Word)

 Copy code hover
[image]

OMathNary.HideSup Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents whether to hide the upper limit of an n-ary operator. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .HideSup

expression An expression that returns an OMathNary object.

See also

Concepts

OMathNary Object

Other resources

OMathNary Object Members


OMathNary.Parent Property (Word)

 Copy code hover
[image]

OMathNary.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified OMathNary object.

Syntax

expression .Parent

expression A variable that represents a OMathNary object.

See also

Concepts

OMathNary Object

Other resources

OMathNary Object Members


OMathNary.Sub Property (Word)

 Copy code hover
[image]

OMathNary.Sub Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMath object that represents the lower limit of an n-ary operator. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Sub

expression An expression that returns an OMathNary object.

See also

Concepts

OMathNary Object

Other resources

OMathNary Object Members


OMathNary.SubSupLim Property (Word)

 Copy code hover
[image]

OMathNary.SubSupLim Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents the positioning of n-ary limits in the subscript-superscript or upper limit-lower limit position. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .SubSupLim

expression An expression that returns an OMathNary object.

See also

Concepts

OMathNary Object

Other resources

OMathNary Object Members


OMathNary.Sup Property (Word)

 Copy code hover
[image]

OMathNary.Sup Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMath object that represents the upper limit of an n-ary operator. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Sup

expression An expression that returns an OMathNary object.

See also

Concepts

OMathNary Object

Other resources

OMathNary Object Members


OMathPhantom Object (Word)

 Copy code hover
[image]

OMathPhantom Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a phantom object, which has two primary uses: (1) adding the spacing of the phantom base without displaying that base or (2) suppressing part of the glyph from spacing considerations.

Version Information

Version Added: Word 2007

Remarks

Use the OMathPhantom object to display the spacing of part of an equation without displaying it, or to remove the spacing for part of a glyph from spacing considerations.

See also

Concepts

Word Object Model Reference

Other resources

OMathPhantom Object Members


OMathPhantom Members (Word)

 Copy code hover
[image]

OMathPhantom Members (Word)
Send feedback

Published: July 16, 2012

Represents a phantom object, which has two primary uses: (1) adding the spacing of the phantom base without displaying that base or (2) suppressing part of the glyph from spacing considerations.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
E | Returns an OMath object that represents the base of the specified equation object. Read-only.
Parent | Returns an Object that represents the parent object of the specified OMathPhantom object.
Show | Returns or sets a Boolean that represents whether the contents of a phantom object are visible. Read/write.
Smash | Returns or sets a Boolean that represents that the contents of the phantom are visible but that the height is not taken into account in the spacing of the layout. Read/write.
Transp | Returns or sets a Boolean that represents whether a phantom object is transparent. Read/write.
ZeroAsc | Returns or sets a Boolean that represents whether the ascent of the phantom contents is ignored in the spacing of the layout. Read/write.
ZeroDesc | Returns or sets a Boolean that represents whether the descent of the phantom contents is ignored in the spacing of the layout. Read/write.
ZeroWid | Returns or sets a Boolean that represents whether the width of a phantom object is ignored in the spacing of the layout. Read/write.


OMathPhantom Properties (Word)

 Copy code hover
[image]

OMathPhantom Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
E | Returns an OMath object that represents the base of the specified equation object. Read-only.
Parent | Returns an Object that represents the parent object of the specified OMathPhantom object.
Show | Returns or sets a Boolean that represents whether the contents of a phantom object are visible. Read/write.
Smash | Returns or sets a Boolean that represents that the contents of the phantom are visible but that the height is not taken into account in the spacing of the layout. Read/write.
Transp | Returns or sets a Boolean that represents whether a phantom object is transparent. Read/write.
ZeroAsc | Returns or sets a Boolean that represents whether the ascent of the phantom contents is ignored in the spacing of the layout. Read/write.
ZeroDesc | Returns or sets a Boolean that represents whether the descent of the phantom contents is ignored in the spacing of the layout. Read/write.
ZeroWid | Returns or sets a Boolean that represents whether the width of a phantom object is ignored in the spacing of the layout. Read/write.


OMathPhantom.Application Property (Word)

 Copy code hover
[image]

OMathPhantom.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents an OMathPhantom object.

See also

Concepts

OMathPhantom Object

Other resources

OMathPhantom Object Members


OMathPhantom.Creator Property (Word)

 Copy code hover
[image]

OMathPhantom.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.

Syntax

expression .Creator

expression An expression that returns an OMathPhantom object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

OMathPhantom Object

Other resources

OMathPhantom Object Members


OMathPhantom.E Property (Word)

 Copy code hover
[image]

OMathPhantom.E Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMath object that represents the base of the specified equation object. Read-only.

Syntax

expression .E

expression An expression that returns an OMathPhantom object.

See also

Concepts

OMathPhantom Object

Other resources

OMathPhantom Object Members


OMathPhantom.Parent Property (Word)

 Copy code hover
[image]

OMathPhantom.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified OMathPhantom object.

Syntax

expression .Parent

expression A variable that represents a OMathPhantom object.

See also

Concepts

OMathPhantom Object

Other resources

OMathPhantom Object Members


OMathPhantom.Show Property (Word)

 Copy code hover
[image]

OMathPhantom.Show Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents whether the contents of a phantom object are visible. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .Show

expression An expression that returns an OMathPhantom object.

See also

Concepts

OMathPhantom Object

Other resources

OMathPhantom Object Members


OMathPhantom.Smash Property (Word)

 Copy code hover
[image]

OMathPhantom.Smash Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents that the contents of the phantom are visible but that the height is not taken into account in the spacing of the layout. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .Smash

expression An expression that returns an OMathPhantom object.

Remarks

If this property is True, the ZeroAsc, ZeroDesc, and Show properties are all set to True.

See also

Concepts

OMathPhantom Object

Other resources

OMathPhantom Object Members


OMathPhantom.Transp Property (Word)

 Copy code hover
[image]

OMathPhantom.Transp Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents whether a phantom object is transparent. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .Transp

expression An expression that returns an OMathPhantom object.

See also

Concepts

OMathPhantom Object

Other resources

OMathPhantom Object Members


OMathPhantom.ZeroAsc Property (Word)

 Copy code hover
[image]

OMathPhantom.ZeroAsc Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents whether the ascent of the phantom contents is ignored in the spacing of the layout. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .ZeroAsc

expression An expression that returns an OMathPhantom object.

See also

Concepts

OMathPhantom Object

Other resources

OMathPhantom Object Members


OMathPhantom.ZeroDesc Property (Word)

 Copy code hover
[image]

OMathPhantom.ZeroDesc Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents whether the descent of the phantom contents is ignored in the spacing of the layout. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .ZeroDesc

expression An expression that returns an OMathPhantom object.

See also

Concepts

OMathPhantom Object

Other resources

OMathPhantom Object Members


OMathPhantom.ZeroWid Property (Word)

 Copy code hover
[image]

OMathPhantom.ZeroWid Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents whether the width of a phantom object is ignored in the spacing of the layout. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .ZeroWid

expression An expression that returns an OMathPhantom object.

See also

Concepts

OMathPhantom Object

Other resources

OMathPhantom Object Members


OMathRad Object (Word)

 Copy code hover
[image]

OMathRad Object (Word)
See also Send feedback

Published: July 16, 2012

Represents the mathematical radical object, consisting of a radical, a base, and an optional degree.

See also

Concepts

Word Object Model Reference

Other resources

OMathRad Object Members


OMathRad Members (Word)

 Copy code hover
[image]

OMathRad Members (Word)
Send feedback

Published: July 16, 2012

Represents the mathematical radical object, consisting of a radical, a base, and an optional degree.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
Deg | Returns an OMath object that represents the degree for a radical. Read-only.
E | Returns an OMath object that represents the base of the specified equation object. Read-only.
HideDeg | Returns or sets a Boolean that represents whether to hide the degree for a radical. Read/write.
Parent | Returns an Object that represents the parent object of the specified OMathRad object.


OMathRad Properties (Word)

 Copy code hover
[image]

OMathRad Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
Deg | Returns an OMath object that represents the degree for a radical. Read-only.
E | Returns an OMath object that represents the base of the specified equation object. Read-only.
HideDeg | Returns or sets a Boolean that represents whether to hide the degree for a radical. Read/write.
Parent | Returns an Object that represents the parent object of the specified OMathRad object.


OMathRad.Application Property (Word)

 Copy code hover
[image]

OMathRad.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents an OMathRad object.

See also

Concepts

OMathRad Object

Other resources

OMathRad Object Members


OMathRad.Creator Property (Word)

 Copy code hover
[image]

OMathRad.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.

Syntax

expression .Creator

expression An expression that returns an OMathRad object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

OMathRad Object

Other resources

OMathRad Object Members


OMathRad.Deg Property (Word)

 Copy code hover
[image]

OMathRad.Deg Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMath object that represents the degree for a radical. Read-only.

Syntax

expression .Deg

expression An expression that returns an OMathRad object.

See also

Concepts

OMathRad Object

Other resources

OMathRad Object Members


OMathRad.E Property (Word)

 Copy code hover
[image]

OMathRad.E Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMath object that represents the base of the specified equation object. Read-only.

Syntax

expression .E

expression An expression that returns an OMathRad object.

See also

Concepts

OMathRad Object

Other resources

OMathRad Object Members


OMathRad.HideDeg Property (Word)

 Copy code hover
[image]

OMathRad.HideDeg Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents whether to hide the degree for a radical. Read/write.

Syntax

expression .HideDeg

expression An expression that returns an OMathRad object.

See also

Concepts

OMathRad Object

Other resources

OMathRad Object Members


OMathRad.Parent Property (Word)

 Copy code hover
[image]

OMathRad.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified OMathRad object.

Syntax

expression .Parent

expression A variable that represents a OMathRad object.

See also

Concepts

OMathRad Object

Other resources

OMathRad Object Members


OMathRecognizedFunction Object (Word)

 Copy code hover
[image]

OMathRecognizedFunction Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a recognized function. The OMathRecognizedFunction object is a member of the OMathRecognizedFunctions collection.

See also

Concepts

Word Object Model Reference

Other resources

OMathRecognizedFunction Object Members


OMathRecognizedFunction Members (Word)

 Copy code hover
[image]

OMathRecognizedFunction Members (Word)
Send feedback

Published: July 16, 2012

Represents a recognized function. The OMathRecognizedFunction object is a member of the OMathRecognizedFunctions collection.

Methods

Name | Description
Delete | Deletes the specified recognized function from the list of the recognized functions.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
Index | Returns a Long that represents the position of an item in a collection. Read-only.
Name | Returns a String that represents the name of an equation recognized function. Read-only.
Parent | Returns an Object that represents the parent object of the specified OMathRecognizedFunction object.


OMathRecognizedFunction Properties (Word)

 Copy code hover
[image]

OMathRecognizedFunction Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
Index | Returns a Long that represents the position of an item in a collection. Read-only.
Name | Returns a String that represents the name of an equation recognized function. Read-only.
Parent | Returns an Object that represents the parent object of the specified OMathRecognizedFunction object.


OMathRecognizedFunction.Application Property (Word)

 Copy code hover
[image]

OMathRecognizedFunction.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents an OMathRecognizedFunction object.

See also

Concepts

OMathRecognizedFunction Object

Other resources

OMathRecognizedFunction Object Members


OMathRecognizedFunction.Creator Property (Word)

 Copy code hover
[image]

OMathRecognizedFunction.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.

Syntax

expression .Creator

expression An expression that returns an OMathRecognizedFunction object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

OMathRecognizedFunction Object

Other resources

OMathRecognizedFunction Object Members


OMathRecognizedFunction.Index Property (Word)

 Copy code hover
[image]

OMathRecognizedFunction.Index Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the position of an item in a collection. Read-only.

Syntax

expression .Index

expression An expression that returns a OMathRecognizedFunction object.

See also

Concepts

OMathRecognizedFunction Object

Other resources

OMathRecognizedFunction Object Members


OMathRecognizedFunction.Name Property (Word)

 Copy code hover
[image]

OMathRecognizedFunction.Name Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a String that represents the name of an equation recognized function. Read-only.

Syntax

expression .Name

expression An expression that returns an OMathRecognizedFunction object.

See also

Concepts

OMathRecognizedFunction Object

Other resources

OMathRecognizedFunction Object Members


OMathRecognizedFunction.Parent Property (Word)

 Copy code hover
[image]

OMathRecognizedFunction.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified OMathRecognizedFunction object.

Syntax

expression .Parent

expression A variable that represents a OMathRecognizedFunction object.

See also

Concepts

OMathRecognizedFunction Object

Other resources

OMathRecognizedFunction Object Members


OMathRecognizedFunction Methods (Word)

 Copy code hover
[image]

OMathRecognizedFunction Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the specified recognized function from the list of the recognized functions.


OMathRecognizedFunction.Delete Method (Word)

 Copy code hover
[image]

OMathRecognizedFunction.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the specified recognized function from the list of the recognized functions.

Syntax

expression .Delete

expression An expression that returns an OMathRecognizedFunction object.

See also

Concepts

OMathRecognizedFunction Object

Other resources

OMathRecognizedFunction Object Members


OMathRecognizedFunctions Object (Word)

 Copy code hover
[image]

OMathRecognizedFunctions Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a collection of recognized functions. Use the OMathRecognizedFunction object to access individual members of the collection.

Remarks

The OMathRecognizedFunctions collection is a collection of the names that are contained in the Recognized Functions dialog box.

See also

Concepts

Word Object Model Reference

Other resources

OMathRecognizedFunctions Object Members


OMathRecognizedFunctions Members (Word)

 Copy code hover
[image]

OMathRecognizedFunctions Members (Word)
Send feedback

Published: July 16, 2012

Represents a collection of recognized functions. Use the OMathRecognizedFunction object to access individual members of the collection.

Methods

Name | Description
Add | Creates a new recognized function and returns an OMathRecognizedFunction object.
Item | Returns an OMathRecognizedFunction object that represents the specified item in the collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns the number of items in the OMathRecognizedFunctions collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified OMathRecognizedFunctions object.


OMathRecognizedFunctions Properties (Word)

 Copy code hover
[image]

OMathRecognizedFunctions Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns the number of items in the OMathRecognizedFunctions collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified OMathRecognizedFunctions object.


OMathRecognizedFunctions.Application Property (Word)

 Copy code hover
[image]

OMathRecognizedFunctions.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents an OMathRecognizedFunctions collection.

See also

Concepts

OMathRecognizedFunctions Collection

Other resources

OMathRecognizedFunctions Object Members


OMathRecognizedFunctions.Count Property (Word)

 Copy code hover
[image]

OMathRecognizedFunctions.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the number of items in the OMathRecognizedFunctions collection. Read-only Long.

Syntax

expression .Count

expression A variable that represents a OMathRecognizedFunctions object.

See also

Concepts

OMathRecognizedFunctions Collection

Other resources

OMathRecognizedFunctions Object Members


OMathRecognizedFunctions.Creator Property (Word)

 Copy code hover
[image]

OMathRecognizedFunctions.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.

Syntax

expression .Creator

expression An expression that returns an OMathRecognizedFunctions object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

OMathRecognizedFunctions Collection

Other resources

OMathRecognizedFunctions Object Members


OMathRecognizedFunctions.Parent Property (Word)

 Copy code hover
[image]

OMathRecognizedFunctions.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified OMathRecognizedFunctions object.

Syntax

expression .Parent

expression A variable that represents a OMathRecognizedFunctions object.

See also

Concepts

OMathRecognizedFunctions Collection

Other resources

OMathRecognizedFunctions Object Members


OMathRecognizedFunctions Methods (Word)

 Copy code hover
[image]

OMathRecognizedFunctions Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Creates a new recognized function and returns an OMathRecognizedFunction object.
Item | Returns an OMathRecognizedFunction object that represents the specified item in the collection.


OMathRecognizedFunctions.Add Method (Word)

 Copy code hover
[image]

OMathRecognizedFunctions.Add Method (Word)
See also Send feedback

Published: July 16, 2012

Creates a new recognized function and returns an OMathRecognizedFunction object.

Version Information

Version Added: Word 2007

Syntax

expression .Add(Name)

expression An expression that returns a OMathRecognizedFunctions object.

Parameters

Name | Required/Optional | Data Type | Description
Name | Required | String | The name of the recognized function.

Return Value

OMathRecognizedFunction

See also

Concepts

OMathRecognizedFunctions Collection

Other resources

OMathRecognizedFunctions Object Members


OMathRecognizedFunctions.Item Method (Word)

 Copy code hover
[image]

OMathRecognizedFunctions.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMathRecognizedFunction object that represents the specified item in the collection.

Syntax

expression .Item(Index)

expression An expression that returns an OMathRecognizedFunctions object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | Specifies a String or Integer that represents the name or ordinal position of the object in the collection.

Return Value

OMathRecognizedFunction

See also

Concepts

OMathRecognizedFunctions Collection

Other resources

OMathRecognizedFunctions Object Members


OMaths Object (Word)

 Copy code hover
[image]

OMaths Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of equations. Use the OMath object to access individual members of the collection.

Remarks

Use the Add method to create an equation and add it to a document, selection, or range. The following example creates an equation and uses the BuildUp method of the OMath collection to convert the equation to professional format.

VBA Copy code Copy code
Dim objRange As Range
Dim objEq As OMath

Set objRange = Selection.Range
objRange.Text = "Celsius = (5/9)(Fahrenheit - 32)"
Set objRange = Selection.OMaths.Add(objRange)
Set objEq = objRange.OMaths(1)
objEq.BuildUp

See also

Concepts

Word Object Model Reference

Other resources

OMaths Object Members


OMaths Members (Word)

 Copy code hover
[image]

OMaths Members (Word)
Send feedback

Published: July 16, 2012

A collection of equations. Use the OMath object to access individual members of the collection.

Methods

Name | Description
Add | Creates an equation, from the text equation contained within the specified range, and returns a Range object that contains the new equation.
BuildUp | Converts all equations in the collection to professional format.
Item | Returns an OMath object that represents the specified item in the collection.
Linearize | Converts all equations in the collection to linear format. .

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns the number of items in the OMaths collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified OMaths object.


OMaths Properties (Word)

 Copy code hover
[image]

OMaths Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns the number of items in the OMaths collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified OMaths object.


OMaths.Application Property (Word)

 Copy code hover
[image]

OMaths.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents an OMaths collection.

See also

Concepts

OMaths Object

Other resources

OMaths Object Members


OMaths.Count Property (Word)

 Copy code hover
[image]

OMaths.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the number of items in the OMaths collection. Read-only Long.

Syntax

expression .Count

expression A variable that represents a OMaths object.

See also

Concepts

OMaths Object

Other resources

OMaths Object Members


OMaths.Creator Property (Word)

 Copy code hover
[image]

OMaths.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.

Syntax

expression .Creator

expression An expression that returns an OMaths object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

OMaths Object

Other resources

OMaths Object Members


OMaths.Parent Property (Word)

 Copy code hover
[image]

OMaths.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified OMaths object.

Syntax

expression .Parent

expression A variable that represents a OMaths object.

See also

Concepts

OMaths Object

Other resources

OMaths Object Members


OMaths Methods (Word)

 Copy code hover
[image]

OMaths Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Creates an equation, from the text equation contained within the specified range, and returns a Range object that contains the new equation.
BuildUp | Converts all equations in the collection to professional format.
Item | Returns an OMath object that represents the specified item in the collection.
Linearize | Converts all equations in the collection to linear format. .


OMaths.Add Method (Word)

 Copy code hover
[image]

OMaths.Add Method (Word)
See also Send feedback

Published: July 16, 2012

Creates an equation, from the text equation contained within the specified range, and returns a Range object that contains the new equation.

Syntax

expression .Add(Range)

expression An expression that returns an OMaths object.

Parameters

Name | Required/Optional | Data Type | Description
Range | Required | Range | Specifies a range that contains a text equation.

Return Value

Range

Example

The following example inserts an equation into the document at the cursor or replacing the selected text.

VBA Copy code Copy code
Dim objRange As Range
Dim objEq As OMath

Set objRange = Selection.Range
objRange.Text = "Celsius = (5/9)(Fahrenheit - 32)"
Set objRange = Selection.OMaths.Add(objRange)
Set objEq = objRange.OMaths(1)
objEq.BuildUp

See also

Concepts

OMaths Object

Other resources

OMaths Object Members


OMaths.BuildUp Method (Word)

 Copy code hover
[image]

OMaths.BuildUp Method (Word)
See also Send feedback

Published: July 16, 2012

Converts all equations in the collection to professional format.

Syntax

expression .BuildUp

expression An expression that returns an OMaths object.

Return Value

Nothing

Remarks

To change equations to linear format, use the Linearize method.

See also

Concepts

OMaths Object

Other resources

OMaths Object Members


OMaths.Item Method (Word)

 Copy code hover
[image]

OMaths.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMath object that represents the specified item in the collection.

Syntax

expression .Item(Index)

expression An expression that returns an OMaths object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | Specifies the ordinal position of the object within the collection.

Return Value

OMath

See also

Concepts

OMaths Object

Other resources

OMaths Object Members


OMaths.Linearize Method (Word)

 Copy code hover
[image]

OMaths.Linearize Method (Word)
See also Send feedback

Published: July 16, 2012

Converts all equations in the collection to linear format. .

Syntax

expression .Linearize

expression An expression that returns an OMaths object.

Return Value

Nothing

Remarks

To change equations to professional format, use the BuildUp method.

See also

Concepts

OMaths Object

Other resources

OMaths Object Members


OMathScrPre Object (Word)

 Copy code hover
[image]

OMathScrPre Object (Word)
See also Send feedback

Published: July 16, 2012

Represents an equation that contains a superscript or subscript to the left of the base.

See also

Concepts

Word Object Model Reference

Other resources

OMathScrPre Object Members


OMathScrPre Members (Word)

 Copy code hover
[image]

OMathScrPre Members (Word)
Send feedback

Published: July 16, 2012

Represents an equation that contains a superscript or subscript to the left of the base.

Methods

Name | Description
ToScrSubSup | Converts an equation with a superscript or subscript to the left of the base of the equation to an equation with a base of a superscript or subscript.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
E | Returns an OMath object that represents the base of the specified equation object. Read-only.
Parent | Returns an Object that represents the parent object of the specified OMathScrPre object.
Sub | Returns an OMath object that represents the subscript for a pre-sub-superscript object. Read-only.
Sup | Returns an OMath object that represents the superscript for a pre-sub-superscript object. Read-only.


OMathScrPre Properties (Word)

 Copy code hover
[image]

OMathScrPre Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
E | Returns an OMath object that represents the base of the specified equation object. Read-only.
Parent | Returns an Object that represents the parent object of the specified OMathScrPre object.
Sub | Returns an OMath object that represents the subscript for a pre-sub-superscript object. Read-only.
Sup | Returns an OMath object that represents the superscript for a pre-sub-superscript object. Read-only.


OMathScrPre.Application Property (Word)

 Copy code hover
[image]

OMathScrPre.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents an OMathScrPre object.

See also

Concepts

OMathScrPre Object

Other resources

OMathScrPre Object Members


OMathScrPre.Creator Property (Word)

 Copy code hover
[image]

OMathScrPre.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.

Syntax

expression .Creator

expression An expression that returns an OMathScrPre object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

OMathScrPre Object

Other resources

OMathScrPre Object Members


OMathScrPre.E Property (Word)

 Copy code hover
[image]

OMathScrPre.E Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMath object that represents the base of the specified equation object. Read-only.

Syntax

expression .E

expression An expression that returns an OMathScrPre object.

See also

Concepts

OMathScrPre Object

Other resources

OMathScrPre Object Members


OMathScrPre.Parent Property (Word)

 Copy code hover
[image]

OMathScrPre.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified OMathScrPre object.

Syntax

expression .Parent

expression A variable that represents a OMathScrPre object.

See also

Concepts

OMathScrPre Object

Other resources

OMathScrPre Object Members


OMathScrPre.Sub Property (Word)

 Copy code hover
[image]

OMathScrPre.Sub Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMath object that represents the subscript for a pre-sub-superscript object. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Sub

expression An expression that returns an OMathScrPre object.

See also

Concepts

OMathScrPre Object

Other resources

OMathScrPre Object Members


OMathScrPre.Sup Property (Word)

 Copy code hover
[image]

OMathScrPre.Sup Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMath object that represents the superscript for a pre-sub-superscript object. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Sup

expression An expression that returns an OMathScrPre object.

See also

Concepts

OMathScrPre Object

Other resources

OMathScrPre Object Members


OMathScrPre Methods (Word)

 Copy code hover
[image]

OMathScrPre Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
ToScrSubSup | Converts an equation with a superscript or subscript to the left of the base of the equation to an equation with a base of a superscript or subscript.


OMathScrPre.ToScrSubSup Method (Word)

 Copy code hover
[image]

OMathScrPre.ToScrSubSup Method (Word)
See also Send feedback

Published: July 16, 2012

Converts an equation with a superscript or subscript to the left of the base of the equation to an equation with a base of a superscript or subscript.

Version Information

Version Added: Word 2007

Syntax

expression .ToScrSubSup

expression An expression that returns a OMathScrPre object.

Return Value

OMathFunction

See also

Concepts

OMathScrPre Object

Other resources

OMathScrPre Object Members


OMathScrSub Object (Word)

 Copy code hover
[image]

OMathScrSub Object (Word)
See also Send feedback

Published: July 16, 2012

Represents an equation with a base that contains a subscript.

See also

Concepts

Word Object Model Reference

Other resources

OMathScrSub Object Members


OMathScrSub Members (Word)

 Copy code hover
[image]

OMathScrSub Members (Word)
Send feedback

Published: July 16, 2012

Represents an equation with a base that contains a subscript.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
E | Returns an OMath object that represents the base of the specified equation object. Read-only.
Parent | Returns an Object that represents the parent object of the specified OMathScrSub object.
Sub | Returns an OMath object that represents the subscript for a subscript object. Read-only.


OMathScrSub Properties (Word)

 Copy code hover
[image]

OMathScrSub Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
E | Returns an OMath object that represents the base of the specified equation object. Read-only.
Parent | Returns an Object that represents the parent object of the specified OMathScrSub object.
Sub | Returns an OMath object that represents the subscript for a subscript object. Read-only.


OMathScrSub.Application Property (Word)

 Copy code hover
[image]

OMathScrSub.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents an OMathScrSub object.

See also

Concepts

OMathScrSub Object

Other resources

OMathScrSub Object Members


OMathScrSub.Creator Property (Word)

 Copy code hover
[image]

OMathScrSub.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.

Syntax

expression .Creator

expression An expression that returns an OMathScrSub object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

OMathScrSub Object

Other resources

OMathScrSub Object Members


OMathScrSub.E Property (Word)

 Copy code hover
[image]

OMathScrSub.E Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMath object that represents the base of the specified equation object. Read-only.

Syntax

expression .E

expression An expression that returns an OMathScrSub object.

See also

Concepts

OMathScrSub Object

Other resources

OMathScrSub Object Members


OMathScrSub.Parent Property (Word)

 Copy code hover
[image]

OMathScrSub.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified OMathScrSub object.

Syntax

expression .Parent

expression A variable that represents a OMathScrSub object.

See also

Concepts

OMathScrSub Object

Other resources

OMathScrSub Object Members


OMathScrSub.Sub Property (Word)

 Copy code hover
[image]

OMathScrSub.Sub Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMath object that represents the subscript for a subscript object. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Sub

expression An expression that returns an OMathScrSub object.

See also

Concepts

OMathScrSub Object

Other resources

OMathScrSub Object Members


OMathScrSubSup Object (Word)

 Copy code hover
[image]

OMathScrSubSup Object (Word)
See also Send feedback

Published: July 16, 2012

Represents an equation with a base that contains a superscript or subscript.

See also

Concepts

Word Object Model Reference

Other resources

OMathScrSubSup Object Members


OMathScrSubSup Members (Word)

 Copy code hover
[image]

OMathScrSubSup Members (Word)
Send feedback

Published: July 16, 2012

Represents an equation with a base that contains a superscript or subscript.

Methods

Name | Description
RemoveSub | Removes the subscript for an equation and returns an OMathFunction object that represents the updated equation without the subscript.
RemoveSup | Removes the superscript for an equation and returns an OMathFunction object that represents the updated equation without the superscript.
ToScrPre | Converts an equation with a base superscript or subscript to an equation with a superscript or subscript to the left of the base.

Properties

Name | Description
AlignScripts | Returns or sets a Boolean that represents whether to horizontally align subscripts and superscripts in the sub-superscript object. Read/write.
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
E | Returns an OMath object that represents the base of the specified equation object. Read-only.
Parent | Returns an Object that represents the parent object of the specified OMathScrSubSup object.
Sub | Returns an OMath object that represents the subscript for a subscript-superscript object. Read-only.
Sup | Returns an OMath object that represents the superscript for a subscript-superscript object. Read-only.


OMathScrSubSup Properties (Word)

 Copy code hover
[image]

OMathScrSubSup Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
AlignScripts | Returns or sets a Boolean that represents whether to horizontally align subscripts and superscripts in the sub-superscript object. Read/write.
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
E | Returns an OMath object that represents the base of the specified equation object. Read-only.
Parent | Returns an Object that represents the parent object of the specified OMathScrSubSup object.
Sub | Returns an OMath object that represents the subscript for a subscript-superscript object. Read-only.
Sup | Returns an OMath object that represents the superscript for a subscript-superscript object. Read-only.


OMathScrSubSup.AlignScripts Property (Word)

 Copy code hover
[image]

OMathScrSubSup.AlignScripts Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents whether to horizontally align subscripts and superscripts in the sub-superscript object. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .AlignScripts

expression An expression that returns an OMathScrSubSup object.

See also

Concepts

OMathScrSubSup Object

Other resources

OMathScrSubSup Object Members


OMathScrSubSup.Application Property (Word)

 Copy code hover
[image]

OMathScrSubSup.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents an OMathScrSubSup object.

See also

Concepts

OMathScrSubSup Object

Other resources

OMathScrSubSup Object Members


OMathScrSubSup.Creator Property (Word)

 Copy code hover
[image]

OMathScrSubSup.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.

Syntax

expression .Creator

expression An expression that returns an OMathScrSubSup object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

OMathScrSubSup Object

Other resources

OMathScrSubSup Object Members


OMathScrSubSup.E Property (Word)

 Copy code hover
[image]

OMathScrSubSup.E Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMath object that represents the base of the specified equation object. Read-only.

Syntax

expression .E

expression An expression that returns an OMathScrSubSup object.

See also

Concepts

OMathScrSubSup Object

Other resources

OMathScrSubSup Object Members


OMathScrSubSup.Parent Property (Word)

 Copy code hover
[image]

OMathScrSubSup.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified OMathScrSubSup object.

Syntax

expression .Parent

expression A variable that represents a OMathScrSubSup object.

See also

Concepts

OMathScrSubSup Object

Other resources

OMathScrSubSup Object Members


OMathScrSubSup.Sub Property (Word)

 Copy code hover
[image]

OMathScrSubSup.Sub Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMath object that represents the subscript for a subscript-superscript object. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Sub

expression An expression that returns an OMathScrSubSup object.

See also

Concepts

OMathScrSubSup Object

Other resources

OMathScrSubSup Object Members


OMathScrSubSup.Sup Property (Word)

 Copy code hover
[image]

OMathScrSubSup.Sup Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMath object that represents the superscript for a subscript-superscript object. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Sup

expression An expression that returns an OMathScrSubSup object.

See also

Concepts

OMathScrSubSup Object

Other resources

OMathScrSubSup Object Members


OMathScrSubSup Methods (Word)

 Copy code hover
[image]

OMathScrSubSup Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:


OMathScrSubSup.RemoveSub Method (Word)

 Copy code hover
[image]

OMathScrSubSup.RemoveSub Method (Word)
See also Send feedback

Published: July 16, 2012

Removes the subscript for an equation and returns an OMathFunction object that represents the updated equation without the subscript.

Version Information

Version Added: Word 2007

Syntax

expression .RemoveSub

expression An expression that returns a OMathScrSubSup object.

Return Value

OMathFunction

See also

Concepts

OMathScrSubSup Object

Other resources

OMathScrSubSup Object Members


OMathScrSubSup.RemoveSup Method (Word)

 Copy code hover
[image]

OMathScrSubSup.RemoveSup Method (Word)
See also Send feedback

Published: July 16, 2012

Removes the superscript for an equation and returns an OMathFunction object that represents the updated equation without the superscript.

Version Information

Version Added: Word 2007

Syntax

expression .RemoveSup

expression An expression that returns a OMathScrSubSup object.

Return Value

OMathFunction

See also

Concepts

OMathScrSubSup Object

Other resources

OMathScrSubSup Object Members


OMathScrSubSup.ToScrPre Method (Word)

 Copy code hover
[image]

OMathScrSubSup.ToScrPre Method (Word)
See also Send feedback

Published: July 16, 2012

Converts an equation with a base superscript or subscript to an equation with a superscript or subscript to the left of the base.

Version Information

Version Added: Word 2007

Syntax

expression .ToScrPre

expression An expression that returns a OMathScrSubSup object.

Return Value

OMathFunction

See also

Concepts

OMathScrSubSup Object

Other resources

OMathScrSubSup Object Members


OMathScrSup Object (Word)

 Copy code hover
[image]

OMathScrSup Object (Word)
See also Send feedback

Published: July 16, 2012

Represents an equation with a base that contains a superscript.

See also

Concepts

Word Object Model Reference

Other resources

OMathScrSup Object Members


OMathScrSup Members (Word)

 Copy code hover
[image]

OMathScrSup Members (Word)
Send feedback

Published: July 16, 2012

Represents an equation with a base that contains a superscript.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
E | Returns an OMath object that represents the base of the specified equation object. Read-only.
Parent | Returns an Object that represents the parent object of the specified OMathScrSup object.
Sup | Returns an OMath object that represents the superscript for a superscript object. Read-only.


OMathScrSup Properties (Word)

 Copy code hover
[image]

OMathScrSup Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
E | Returns an OMath object that represents the base of the specified equation object. Read-only.
Parent | Returns an Object that represents the parent object of the specified OMathScrSup object.
Sup | Returns an OMath object that represents the superscript for a superscript object. Read-only.


OMathScrSup.Application Property (Word)

 Copy code hover
[image]

OMathScrSup.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents an OMathScrSup object.

See also

Concepts

OMathScrSup Object

Other resources

OMathScrSup Object Members


OMathScrSup.Creator Property (Word)

 Copy code hover
[image]

OMathScrSup.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.

Syntax

expression .Creator

expression An expression that returns an OMathScrSup object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

OMathScrSup Object

Other resources

OMathScrSup Object Members


OMathScrSup.E Property (Word)

 Copy code hover
[image]

OMathScrSup.E Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMath object that represents the base of the specified equation object. Read-only.

Syntax

expression .E

expression An expression that returns an OMathScrSup object.

See also

Concepts

OMathScrSup Object

Other resources

OMathScrSup Object Members


OMathScrSup.Parent Property (Word)

 Copy code hover
[image]

OMathScrSup.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified OMathScrSup object.

Syntax

expression .Parent

expression A variable that represents a OMathScrSup object.

See also

Concepts

OMathScrSup Object

Other resources

OMathScrSup Object Members


OMathScrSup.Sup Property (Word)

 Copy code hover
[image]

OMathScrSup.Sup Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMath object that represents the superscript for a superscript object. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Sup

expression An expression that returns an OMathScrSup object.

See also

Concepts

OMathScrSup Object

Other resources

OMathScrSup Object Members


Options Object (Word)

 Copy code hover
[image]

Options Object (Word)
See also Send feedback

Published: July 16, 2012

Represents application and document options in Word. Many of the properties for the Options object correspond to items in the Options dialog box.

Remarks

Use the Options property to return the Options object. The following example sets three application options for Word.

VBA Copy code Copy code
With Options
 .AllowDragAndDrop = True
 .ConfirmConversions = False
 .MeasurementUnit = wdPoints
End With

See also

Concepts

Word Object Model Reference

Other resources

Options Object Members


Options Members (Word)

 Copy code hover
[image]

Options Members (Word)
Send feedback

Published: July 16, 2012

Represents application and document options in Word. Many of the properties for the Options object correspond to items in the Options dialog box.

Properties

Name | Description
AddBiDirectionalMarksWhenSavingTextFile | True if Microsoft Word adds bidirectional control characters when saving a document as a text file. Read/write Boolean.
AddControlCharacters | True if Microsoft Word adds bidirectional control characters when cutting and copying text. Read/write Boolean.
AddHebDoubleQuote | True if Microsoft Word encloses number formats in double quotation marks ("). Read/write Boolean.
AlertIfNotDefault | Returns or sets a Boolean that is True if users are notified if Microsoft Word 2013 is not the default program for viewing and editing documents. Read-write.
AllowAccentedUppercase | True if accents are retained when a French language character is changed to uppercase. Read/write Boolean.
AllowClickAndTypeMouse | True if Click and Type functionality is enabled. Read/write Boolean.
AllowCombinedAuxiliaryForms | True if Microsoft Word ignores auxiliary verb forms when checking spelling in a Korean language document. Read/write Boolean.
AllowCompoundNounProcessing | True if Microsoft Word ignores compound nouns when checking spelling in a Korean language document. Read/write Boolean.
AllowDragAndDrop | True if dragging can be used to move or copy a selection. Read/write Boolean.
AllowOpenInDraftView | Returns or sets a Boolean that represents whether to allow users to open documents in draft view. Read/write.
AllowPixelUnits | True if Microsoft Word uses pixels as the default unit of measurement for HTML features that support measurements. Read/write Boolean.
AllowReadingMode | True indicates that Microsoft Word opens documents in Reading Layout view. Read/write Boolean.
AnimateScreenMovements | True if Word animates mouse movements, uses animated cursors, and animates actions such as background saving and find and replace operations. Read/write Boolean.
Application | Returns an Application object that represents the Microsoft Word application.
ApplyFarEastFontsToAscii | True if Microsoft Word applies East Asian fonts to Latin text. Read/write Boolean.
ArabicMode | Returns or sets the mode for the Arabic spelling checker. Read/write WdAraSpeller.
ArabicNumeral | Returns or sets the numeral style for an Arabic language document. Read/write WdArabicNumeral.
AutoCreateNewDrawings | True for Microsoft Word to draw newly created shapes in a drawing canvas. Read/write Boolean.
AutoFormatApplyBulletedLists | True if characters (such as asterisks, hyphens, and greater-than signs) at the beginning of list paragraphs are replaced with bullets from the Bullets and Numbering dialog box (Format menu) when Word formats a document or range automatically. Read/write Boolean.
AutoFormatApplyFirstIndents | True if Microsoft Word replaces a space entered at the beginning of a paragraph with a first-line indent when Word formats a document or range automatically. Read/write Boolean.
AutoFormatApplyHeadings | True if styles are automatically applied to headings when Word formats a document or range automatically. Read/write Boolean.
AutoFormatApplyLists | True if styles are automatically applied to lists when Word formats a document or range automatically. Read/write Boolean.
AutoFormatApplyOtherParas | True if styles are automatically applied to paragraphs that aren't headings or list items when Word formats a document or range automatically. Read/write Boolean.
AutoFormatAsYouTypeApplyBorders | True if a series of three or more hyphens (-), equal signs (=), or underscore characters (_) are automatically replaced by a specific border line when the ENTER key is pressed. Read/write Boolean.
AutoFormatAsYouTypeApplyBulletedLists | True if bullet characters (such as asterisks, hyphens, and greater-than signs) are replaced with bullets from the Bullets And Numbering dialog box (Format menu) as you type. Read/write Boolean.
AutoFormatAsYouTypeApplyClosings | True for Microsoft Word to automatically apply the Closing style to letter closings as you type. Read/write Boolean.
AutoFormatAsYouTypeApplyDates | True for Microsoft Word to automatically apply the Date style to dates as you type. Read/write.
AutoFormatAsYouTypeApplyFirstIndents | True for Microsoft Word to automatically replace a space entered at the beginning of a paragraph with a first-line indent. Read/write.
AutoFormatAsYouTypeApplyHeadings | True if styles are automatically applied to headings as you type. Read/write Boolean.
AutoFormatAsYouTypeApplyNumberedLists | True if paragraphs are automatically formatted as numbered lists with a numbering scheme from the Bullets and Numbering dialog box (Format menu), according to what's typed. For example, if a paragraph starts with "1.1" and a tab character, Word automatically inserts "1.2" and a tab character after the ENTER key is pressed. Read/write Boolean.
AutoFormatAsYouTypeApplyTables | True if Word automatically creates a table when you type a plus sign, a series of hyphens, another plus sign, and so on, and then press ENTER. The plus signs become the column borders, and the hyphens become the column widths. Read/write Boolean.
AutoFormatAsYouTypeAutoLetterWizard | True for Microsoft Word to automatically start the Letter Wizard when the user enters a letter salutation or closing. Read/write.
AutoFormatAsYouTypeDefineStyles | True if Word automatically creates new styles based on manual formatting. Read/write Boolean.
AutoFormatAsYouTypeDeleteAutoSpaces | True for Microsoft Word to automatically delete spaces inserted between Japanese and Latin text as you type. Read/write.
AutoFormatAsYouTypeFormatListItemBeginning | True if Word repeats character formatting applied to the beginning of a list item to the next list item. Read/write Boolean.
AutoFormatAsYouTypeInsertClosings | True for Microsoft Word to automatically insert the corresponding memo closing when the user enters a memo heading. Read/write.
AutoFormatAsYouTypeInsertOvers | True for Microsoft Word to automatically insert "以上" when the user enters "記" or "案". Read/write Boolean.
AutoFormatAsYouTypeMatchParentheses | True for Microsoft Word to automatically correct improperly paired parentheses. Read/write.
AutoFormatAsYouTypeReplaceFarEastDashes | True for Microsoft Word to automatically correct long vowel sounds and dashes. Read/write.
AutoFormatAsYouTypeReplaceFractions | True if typed fractions are replaced with fractions from the current character set as you type. For example, "1/2" is replaced with "½." Read/write Boolean.
AutoFormatAsYouTypeReplaceHyperlinks | True if e-mail addresses, server and share names (also known as UNC paths), and Internet addresses (also known as URLs) are automatically changed to hyperlinks as you type. Read/write Boolean.
AutoFormatAsYouTypeReplaceOrdinals | True if the ordinal number suffixes "st", "nd", "rd", and "th" are replaced with the same letters in superscript as you type. For example, "1st" is replaced with "1" followed by "st" formatted as superscript. Read/write Boolean.
AutoFormatAsYouTypeReplacePlainTextEmphasis | True if manual emphasis characters are automatically replaced with character formatting as you type. For example, "*bold*" is changed to "bold" and "_underline_" is changed to "underline." Read/write Boolean.
AutoFormatAsYouTypeReplaceQuotes | True if straight quotation marks are automatically changed to smart (curly) quotation marks as you type. Read/write Boolean.
AutoFormatAsYouTypeReplaceSymbols | True if two consecutive hyphens (--) are replaced with an en dash (-) or an em dash (—) as you type. Read/write Boolean.If the hyphens are typed with leading and trailing spaces, Word replaces the hyphens with an en dash; if there are no trailing spaces, the hyphens are replaced with an em dash.
AutoFormatDeleteAutoSpaces | True if spaces inserted between Japanese and Latin text will be deleted when Microsoft Word formats a document or range automatically. Read/write Boolean.
AutoFormatMatchParentheses | True if improperly paired parentheses are corrected when Microsoft Word formats a document or range automatically. Read/write Boolean.
AutoFormatPlainTextWordMail | True if Word automatically formats plain-text e-mail messages when you open them in Word. Read/write Boolean.
AutoFormatPreserveStyles | True if previously applied styles are preserved when Word formats a document or range automatically. Read/write Boolean.
AutoFormatReplaceFarEastDashes | True if long vowel sound and dash use is corrected when Microsoft Word formats a document or range automatically. Read/write Boolean.
AutoFormatReplaceFractions | True if typed fractions are replaced with fractions from the current character set when Word formats a document or range automatically. For example, "1/2" is replaced with "½." Read/write Boolean.
AutoFormatReplaceHyperlinks | True if e-mail addresses, server and share names (also known as UNC paths), and Internet addresses (also known as URLs) are automatically formatted whenever Word AutoFormats a document or range. Read/write Boolean.
AutoFormatReplaceOrdinals | True if the ordinal number suffixes "st", "nd", "rd", and "th" are replaced with the same letters in superscript when Word formats a document or range automatically. For example, "1st" is replaced with "1" followed by "st" formatted as superscript. Read/write Boolean.
AutoFormatReplacePlainTextEmphasis | True if manual emphasis characters are replaced with character formatting when Word formats a document or range automatically. For example, "*bold*" is changed to "bold" and "_underline_" is changed to "underline." Read/write Boolean.
AutoFormatReplaceQuotes | True if straight quotation marks are automatically changed to smart (curly) quotation marks when Word formats a document or range automatically. Read/write Boolean.
AutoFormatReplaceSymbols | True if two consecutive hyphens (--) are replaced by an en dash (-) or an em dash (—) when Word formats a document or range automatically. Read/write Boolean.
AutoKeyboardSwitching | True if Microsoft Word automatically switches the keyboard language to match what you're typing at any given time. Read/write Boolean.
AutoWordSelection | True if dragging selects one word at a time instead of one character at a time. Read/write Boolean.
BackgroundSave | True if Word saves documents in the background. When Word is saving in the background, users can continue to type and to choose commands. Read/write Boolean.
BibliographySort | Returns or sets a String that represents the order in which to display sources in the Source Manager dialog box. Read/write.
BibliographyStyle | Returns or sets a String that represents the name of the style to use for formatting bibliographies. Read/write.
BrazilReform | Returns or sets the mode for the Brazilian Portuguese speller. Read/write WdPortugueseReform.
ButtonFieldClicks | Returns or sets the number of clicks (either one or two) required to run a GOTOBUTTON or MACROBUTTON field. Read/write Long.
CheckGrammarAsYouType | True if Word checks grammar and marks errors automatically as you type. Read/write Boolean.
CheckGrammarWithSpelling | True if Word checks grammar while checking spelling. Read/write Boolean.
CheckHangulEndings | True if Microsoft Word automatically detects Hangul endings and ignores them during conversion from Hangul to Hanja. Read/write Boolean.
CheckSpellingAsYouType | True if Microsoft Word checks spelling and marks errors automatically as you type. Read/write Boolean.
CommentsColor | Returns or sets a WdColorIndex constant that represents the color of comments in a document. Read/write.
ConfirmConversions | True if Word displays the Convert File dialog box before it opens or inserts a file that isn't a Word document or template. In the Convert File dialog box, the user chooses the format to convert the file from. Read/write Boolean.
ContextualSpeller | Returns or sets a Boolean that represents whether to use the contextual speller to check spelling based on the context of a word and the words around it. Read/write.
ConvertHighAnsiToFarEast | True if Microsoft Word converts text that is associated with an East Asian font to the appropriate font when it opens a document. Read/write Boolean.
CreateBackup | True if Word creates a backup copy each time a document is saved. Read/write Boolean.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
CtrlClickHyperlinkToOpen | True if Microsoft Word requires holding down the CTRL key while clicking to open a hyperlink. Read/write Boolean.
CursorMovement | Returns or sets how the insertion point progresses within bidirectional text. Read/write WdCursorMovement.
DefaultBorderColor | Returns or sets the default 24-bit color to use for new Border objects. Read/write.
DefaultBorderColorIndex | Returns or sets the default line color for borders. Read/write WdColorIndex.
DefaultBorderLineStyle | Returns or sets the default border line style. Read/write WdLineStyle.
DefaultBorderLineWidth | Returns or sets the default line width of borders. Read/write WdLineWidth.
DefaultEPostageApp | Sets or returns a String that represents the path and file name of the default electronic postage application. Read/write.
DefaultFilePath | Returns or sets default folders for items such as documents, templates, and graphics. Read/write String.
DefaultHighlightColorIndex | Returns or sets the color used to highlight text formatted with the Highlight button (Formatting toolbar). Read/write WdColorIndex.
DefaultOpenFormat | Returns or sets the default file converter used to open documents. Can be a number returned by the OpenFormat property, or one of the following WdOpenFormat constants.
DefaultTextEncoding | Returns or sets an MsoEncoding constant representing the code page, or character set, that Microsoft Word uses for all documents saved as encoded text files. Read/write.
DefaultTray | Returns or sets the default tray your printer uses to print documents. Read/write String.
DefaultTrayID | Returns or sets the default tray your printer uses to print documents. Read/write WdPaperTray.
DeletedCellColor | Returns or sets a WdCellColor constant that represents the color for a deleted cell. Read/write.
DeletedTextColor | Returns or sets the color of text that is deleted while change tracking is enabled. Read/write WdColorIndex.
DeletedTextMark | Returns or sets the format of text that is deleted while change tracking is enabled. Read/write WdDeletedTextMark.
DiacriticColorVal | Returns or sets the 24-bit color to be used for diacritics in a right-to-left language document. Read/write.
DisableFeaturesbyDefault | True for Microsoft Word to disable in all documents all features introduced after the version of Word specified in the DisableFeaturesIntroducedAfterbyDefault. The default value is False. Read/write Boolean.
DisableFeaturesIntroducedAfterbyDefault | Disables all features introduced after a the specified version for all documents. Read/write WdDisableFeaturesIntroducedAfter.
DisplayAlignmentGuides | Returns or sets a Boolean that specifies whether alignment guides are enabled in the user interface. Read-write.
DisplayGridLines | True if Microsoft Word displays the document grid. This property is the equivalent of the Gridlines command on the View menu. Read/write Boolean.
DisplayPasteOptions | True for Microsoft Word to display the Paste Options button, which displays directly under newly pasted text. Read/write Boolean.
DocumentViewDirection | Returns or sets the alignment and reading order for the entire document. Read/write WdDocumentViewDirection.
DoNotPromptForConvert | Sets or returns a Boolean that represents whether to prompt a warning dialog when the Convert command is invoked for documents that are in compatibility mode. Read/write.
EnableHangulHanjaRecentOrdering | True if Microsoft Word displays the most recently used words at the top of the suggestions list during conversion between Hangul and Hanja. Read/write Boolean.
EnableLegacyIMEMode | Returns or sets aBoolean that represents whether to enable legacy IME mode. Read/write.
EnableLiveDrag | Returns or sets a Boolean that is True if live drag is enabled. Read-write.
EnableLivePreview | Sets or returns a Boolean that represents whether to show or hide gallery previews that appear when using galleries that support previewing. True shows a preview in your document before applying the command. Read/write.
EnableMisusedWordsDictionary | True if Microsoft Word checks for misused words when checking the spelling and grammar in a document. Read/write Boolean.
EnableProofingToolsAdvertisement | Returns or sets a Boolean value that, when True, specifies that users be notified when additional proofing tools are available for download. Read-write.
EnableSound | True if Word makes the computer respond with a sound whenever an error occurs. Read/write Boolean.
EnvelopeFeederInstalled | True if the current printer has a special feeder for envelopes. Read-only Boolean.
ExpandHeadingsOnOpen | True to expand all headings in the document when the document opens. Read/write Boolean.
FormatScanning | True for Microsoft Word to keep track of all formatting in a document. Read/write Boolean.
FrenchReform | Returns or sets a WdFrenchSpellerconstant that represents which spelling dictionary to use for regions of text with language formatting set to French. Read/write.
GridDistanceHorizontal | Returns or sets the amount of horizontal space between the invisible gridlines that Word uses when you draw, move, and resize AutoShapes or East Asian characters in new documents. Read/write Single.
GridDistanceVertical | Returns or sets the amount of vertical space between the invisible gridlines that Word uses when you draw, move, and resize AutoShapes or East Asian characters in new documents. Read/write Single.
GridOriginHorizontal | Returns or sets the point, relative to the left edge of the page, where you want the invisible grid for drawing, moving, and resizing AutoShapes or East Asian characters to begin in new documents. Read/write Single.
GridOriginVertical | Returns or sets the point, relative to the top of the page, where you want the invisible grid for drawing, moving, and resizing AutoShapes or East Asian characters to begin in new documents. Read/write Single.
HangulHanjaFastConversion | True if Microsoft Word automatically converts a word with only one suggestion during conversion between Hangul and Hanja. Read/write Boolean.
HebrewMode | Returns or sets the mode for the Hebrew spelling checker. Read/write WdHebSpellStart.
IgnoreInternetAndFileAddresses | True if file name extensions, MS-DOS paths, e-mail addresses, server and share names (also known as UNC paths), and Internet addresses (also known as URLs) are ignored while checking spelling. Read/write Boolean.
IgnoreMixedDigits | True if words that contain numbers are ignored while checking spelling. Read/write Boolean.
IgnoreUppercase | True if words in all uppercase letters are ignored while checking spelling. Read/write Boolean.
IMEAutomaticControl | True if Microsoft Word is set to automatically open and close the Japanese Input Method Editor (IME). Read/write Boolean.
InlineConversion | True if Microsoft Word displays an unconfirmed character string in the Japanese Input Method Editor (IME) as an insertion between existing (confirmed) character strings. Read/write Boolean.
InsertedCellColor | Returns or sets a WdCellColorconstant that represents the color for an inserted table cell. Read/write.
InsertedTextColor | Returns or sets the color of text that is inserted while change tracking is enabled. Read/write WdColorIndex.
InsertedTextMark | Returns or sets how Microsoft Word formats inserted text while change tracking is enabled (the TrackRevisions property is True). Read/write WdInsertedTextMark.
INSKeyForOvertype | True if the INS key can be used for switching Overtype on and off. Read/write Boolean.
INSKeyForPaste | True if the INS key can be used for pasting the Clipboard contents. Read/write Boolean.
InterpretHighAnsi | Returns or sets the high-ANSI text interpretation behavior. Read/write WdHighAnsiText.
LocalNetworkFile | True if Microsoft Word creates a local copy of a file on the user's computer when editing a file stored on a network server. Read/write Boolean.
MapPaperSize | True if documents formatted for another country's/region's standard paper size (for example, A4) are automatically adjusted so that they're printed correctly on your country's/region's standard paper size (for example, Letter). Read/write Boolean.
MarginAlignmentGuides | Returns or sets a Boolean that specifies whether margin alignment guides are displayed in the user interface. Read-write.
MatchFuzzyAY | True if Microsoft Word ignores the distinction between " [image] " and " [image] " following [image] -row and [image] -row characters during a search. Read/write Boolean.
MatchFuzzyBV | True if Microsoft Word ignores the distinction between " [image] " and " [image] [image] " and between " [image] " and " [image] [image] " during a search. Read/write Boolean.
MatchFuzzyByte | True if Microsoft Word ignores the distinction between full-width and half-width characters (Latin or Japanese) during a search. Read/write Boolean.
MatchFuzzyCase | True if Microsoft Word ignores the distinction between uppercase and lowercase letters during a search. Read/write Boolean.
MatchFuzzyDash | True if Microsoft Word ignores the distinction between minus signs, long vowel sounds, and dashes during a search. Read/write Boolean.
MatchFuzzyDZ | True if Microsoft Word ignores the distinction between " [image] " and " [image] " and between " [image] " and " [image] " during a search. Read/write Boolean.
MatchFuzzyHF | True if Microsoft Word ignores the distinction between " [image] [image] " and " [image] [image] " and between " [image] [image] " and " [image] [image] " during a search. Read/write Boolean.
MatchFuzzyHiragana | True if Microsoft Word ignores the distinction between hiragana and katakana during a search. Read/write Boolean.
MatchFuzzyIterationMark | True if Microsoft Word ignores the distinction between types of repetition marks during a search. Read/write Boolean.
MatchFuzzyKanji | True if Microsoft Word ignores the distinction between standard and nonstandard kanji ideography during a search. Read/write Boolean.
MatchFuzzyKiKu | True if Microsoft Word ignores the distinction between " [image] " and " [image] " before [image] -row characters during a search. Read/write Boolean.
MatchFuzzyOldKana | True if Microsoft Word ignores the distinction between new kana and old kana characters during a search. Read/write Boolean.
MatchFuzzyProlongedSoundMark | True if Microsoft Word ignores the distinction between short and long vowel sounds during a search. Read/write Boolean.
MatchFuzzyPunctuation | True if Microsoft Word ignores the distinction between types of punctuation marks during a search. Read/write Boolean.
MatchFuzzySmallKana | True if Microsoft Word ignores the distinction between diphthongs and double consonants during a search. Read/write Boolean.
MatchFuzzySpace | True if Microsoft Word ignores the distinction between space markers used during a search. Read/write Boolean.
MatchFuzzyTC | True if Microsoft Word ignores the distinction between " [image] [image] ", " [image] [image] ", and " [image] ", and between " [image] [image] " and " [image] " during a search. Read/write Boolean.
MatchFuzzyZJ | True if Microsoft Word ignores the distinction between " [image] " and " [image] [image] " and between " [image] " and " [image] [image] " during a search. Read/write Boolean.
MeasurementUnit | Returns or sets the standard measurement unit for Microsoft Word. Read/write WdMeasurementUnits.
MergedCellColor | Returns or sets a WdCellColor constant that represents the color for merged table cells. Read/write.
MonthNames | Returns or sets the direction for conversion between Hangul and Hanja. Read/write WdMonthNames.
MoveFromTextColor | Returns or sets a WdColorIndex constant that represents the color of moved text. Read/write.
MoveFromTextMark | Returns or sets a WdMoveFromTextMark constant that represents the type of revision mark to use for moved text. Read/write.
MoveToTextColor | Returns or sets a WdColorIndex constant that represents the color of moved text. Read/write.
MoveToTextMark | Returns or sets a WdMoveToTextMark constant that represents the type of revision mark to use for moved text. Read/write.
MultipleWordConversionsMode | Returns or sets the direction for conversion between Hangul and Hanja. Read/write WdMultipleWordConversionsMode.
OMathAutoBuildUp | Returns or sets a Boolean that represents whether Microsoft Word automatically converts equations to professional format. True indicates that Word automatically converts equations to professional format. Read/write.
OMathCopyLF | Returns or sets a Boolean that represents how equations are represented in plain text. True indicates equations are represented in Linear Format. False indicates equations are represented in MathML. Read/write.
OptimizeForWord97byDefault | True if Microsoft Word optimizes all new documents for viewing in Word 97 by disabling any incompatible formatting. Read/write Boolean.
Overtype | True if Overtype mode is active. Read/write Boolean.
PageAlignmentGuides | Returns or sets a Boolean that specifies whether page alignment guides are displayed in the user interface. Read-write.
Pagination | True if Microsoft Word repaginates documents in the background. Read/write Boolean.
ParagraphAlignmentGuides | Returns or sets a Boolean that specifies whether paragraph alignment guides are displayed in the user interface. Read-write.
Parent | Returns an Object that represents the parent object of the specified Options object.
PasteAdjustParagraphSpacing | True if Microsoft Word automatically adjusts the spacing of paragraphs when cutting and pasting selections. Read/write Boolean.
PasteAdjustTableFormatting | True if Microsoft Word automatically adjusts the formatting of tables when cutting and pasting selections. Read/write Boolean.
PasteAdjustWordSpacing | True if Microsoft Word automatically adjusts the spacing of words when cutting and pasting selections. Read/write Boolean.
PasteFormatBetweenDocuments | Returns or sets a WdPasteOptions constant that represents how text is pasted when text is copied from another Microsoft Office Word document. Read/write.
PasteFormatBetweenStyledDocuments | Returns or sets a WdPasteOptions constant that represents how text is pasted when text is copied from a document that uses styles. Read/write.
PasteFormatFromExternalSource | Returns or sets a WdPasteOptions constant that represents how text is pasted when text is copied from an external source, such as a Web page. Read/write.
PasteFormatWithinDocument | Returns or sets a WdPasteOptions constant that represents how text is pasted when text is copied or cut and then pasted in the same document. Read/write.
PasteMergeFromPPT | True to merge text formatting when pasting from Microsoft PowerPoint. Read/write Boolean.
PasteMergeFromXL | True to merge table formatting when pasting from Microsoft Excel. Read/write Boolean.
PasteMergeLists | True to merge the formatting of pasted lists with surrounding lists. Read/write Boolean.
PasteOptionKeepBulletsAndNumbers | Returns or sets a Boolean that represents whether to keep bullets and numbering when selecting Keep text only from the Paste Options context menu. Read/write.
PasteSmartCutPaste | True if Microsoft Word intelligently pastes selections into a document. Read/write Boolean.
PasteSmartStyleBehavior | True if Microsoft Word intelligently merges styles when pasting a selection from a different document. Read/write Boolean.
PictureEditor | Returns or sets the name of the application to use to edit pictures. Read/write String.
PictureWrapType | Sets or returns a WdWrapTypeMerged that indicates how Microsoft Word wraps text around pictures. Read/write.
PortugalReform | Returns or sets the mode for the European Portuguese speller. Read/write WdPortugueseReform.
PrecisePositioning | Returns or sets a Boolean that represents whether Word optimizes character positioning for print layout rather than on-screen readability. True disables the default setting that compresses character spacing to facilitate on-screen readability and enables character spacing for print media. Read/write.
PreferCloudSaveLocations | True to save new documents in web locations by default. Read/write Boolean.
PrintBackground | True if Microsoft Word prints in the background. Read/write Boolean.
PrintBackgrounds | Returns a Boolean that represents whether background colors and images are printed when a document is printed.
PrintComments | True if Microsoft Word prints comments, starting on a new page at the end of the document. Read/write Boolean.
PrintDraft | True if Microsoft Word prints using minimal formatting. Read/write Boolean.
PrintDrawingObjects | True if Microsoft Word prints drawing objects. Read/write Boolean.
PrintEvenPagesInAscendingOrder | True if Microsoft Word prints even pages in ascending order during manual duplex printing. Read/write Boolean.
PrintFieldCodes | True if Microsoft Word prints field codes instead of field results. Read/write Boolean.
PrintHiddenText | True if hidden text is printed. Read/write Boolean.
PrintOddPagesInAscendingOrder | True if Microsoft Word prints odd pages in ascending order during manual duplex printing. Read/write Boolean.
PrintProperties | True if Microsoft Word prints document summary information on a separate page at the end of the document. Read/write Boolean.
PrintReverse | True if Microsoft Word prints pages in reverse order. Read/write Boolean.
PrintXMLTag | Returns a Boolean that represents whether to print the XML tags when printing a document. Corresponds to the XML tags check box on the Print tab in the Options dialog box. .
PromptUpdateStyle | True displays a message asking the user to verify whether they want to reformat a style or reapply the original style formatting when changing the formatting of styles. Read/write Boolean.
RepeatWord | Returns or sets a Boolean that represents whether to mark words that are repeated when spelling is checked. True flags repeated words. Read/write.
ReplaceSelection | True if the result of typing or pasting replaces the selection. Read/write Boolean.
RevisedLinesColor | Returns or sets the color of changed lines in a document with tracked changes. Read/write WdColorIndex.
RevisedLinesMark | Returns or sets the placement of changed lines in a document with tracked changes. Read/write WdRevisedLinesMark.
RevisedPropertiesColor | Returns or sets the color used to mark formatting changes while change tracking is enabled. Read/write WdColorIndex.
RevisedPropertiesMark | Returns or sets the mark used to show formatting changes while change tracking is enabled. Read/write WdRevisedPropertiesMark.
RevisionsBalloonPrintOrientation | Returns or sets a WdRevisionsBalloonPrintOrientation constant that represents the direction of revision and comment balloons when they are printed. Read/write.
RTFInClipboard | You have requested Help for a Visual Basic keyword used only on the Macintosh. For information about the RTFInClipboard property for the Options object, consult the language reference Help included with Microsoft Office Macintosh Edition.
SaveInterval | Returns or sets the time interval in minutes for saving AutoRecover information. Read/write Long.
SaveNormalPrompt | True if Microsoft Word prompts the user for confirmation to save changes to the Normal template before it closes. Read/write Boolean.
SavePropertiesPrompt | True if Microsoft Word prompts for document property information when saving a new document. Read/write Boolean.
SendMailAttach | True if the Send To command on the File menu inserts the active document as an attachment to a mail message. Read/write Boolean.
SequenceCheck | True to check the sequence of independent characters for South Asian text. Read/write Boolean.
ShortMenuNames | You have requested Help for a Visual Basic keyword used only on the Macintosh. For information about the ShortMenuNames property for the Options object, consult the language reference Help included with Microsoft Office Macintosh Edition.
ShowControlCharacters | True if bidirectional control characters are visible in the current document. Read/write Boolean.
ShowDevTools | Returns or sets a Boolean that represents whether the Developer tab is displayed in the ribbon. Read/write.
ShowDiacritics | True if diacritics are visible in a right-to-left language document. Read/write Boolean.
ShowFormatError | True for Microsoft Word to mark inconsistencies in formatting by placing a squiggly underline beneath text formatted similarly to other formatting that is used more frequently in a document. Read/write Boolean.
ShowMarkupOpenSave | Returns or sets a Boolean that represents whether Microsoft Word displays hidden markup when opening or saving a file.
ShowMenuFloaties | Returns or sets a Boolean that represents whether to display mini toolbars when the user right-clicks in the document window. Read/write.
ShowReadabilityStatistics | True if Microsoft Word displays a list of summary statistics, including measures of readability, when it has finished checking grammar. Read/write Boolean.
ShowSelectionFloaties | Returns or sets a Boolean that represents whether mini toolbars display when a user selects text. Read/write.
SkyDriveSignInOption | True to give users the option to sign in to SkyDrive and other cloud locations. Read/write Boolean.
SmartCursoring | Returns or sets a Boolean that represents whether smart cursoring is enabled. True enables smart cursoring.
SmartCutPaste | True if Microsoft Word automatically adjusts the spacing between words and punctuation when cutting and pasting occurs. Read/write Boolean.
SmartParaSelection | True for Microsoft Word to include the paragraph mark in a selection when selecting most or all of a paragraph. Read/write Boolean.
SnapToGrid | True if AutoShapes or East Asian characters are automatically aligned with an invisible grid when they are drawn, moved, or resized. Read/write Boolean.
SnapToShapes | True if Word automatically aligns AutoShapes or East Asian characters with invisible gridlines that go through the vertical and horizontal edges of other AutoShapes or East Asian characters. Read/write Boolean.
SpanishMode | Returns or sets the mode for the Spanish speller. Read/write WdSpanishSpeller.
SplitCellColor | Returns or sets a WdCellColor that represents the color for split table cells. Read/write.
StoreRSIDOnSave | True for Microsoft Word to assign a random number to changes in a document, each time a document is saved, to facilitate comparing and merging documents. Read/write Boolean.
StrictFinalYaa | True if the spelling checker uses spelling rules regarding Arabic words ending with the letter yaa. Read/write Boolean.
StrictInitialAlefHamza | True if the spelling checker uses spelling rules regarding Arabic words beginning with an alef hamza. Read/write Boolean.
StrictRussianE | True if the spelling checker uses spelling rules regarding Russian words that use the strict ë character. Read/write.
StrictTaaMarboota | True if the spelling checker uses spelling rules to flag Arabic words ending with haa instead of taa marboota. Read/write.
SuggestFromMainDictionaryOnly | True if Microsoft Word draws spelling suggestions from the main dictionary only. Read/write Boolean.
SuggestSpellingCorrections | True if Microsoft Word always suggests alternative spellings for each misspelled word when checking spelling. Read/write Boolean.
TabIndentKey | True if the TAB and BACKSPACE keys can be used to increase and decrease, respectively, the left indent of paragraphs and if the BACKSPACE key can be used to change right-aligned paragraphs to centered paragraphs and centered paragraphs to left-aligned paragraphs. Read/write Boolean.
TypeNReplace | True for Microsoft Word to replace illegal South Asian characters. Read/write Boolean.
UpdateFieldsAtPrint | True if Microsoft Word updates fields automatically before printing a document. Read/write Boolean.
UpdateFieldsWithTrackedChangesAtPrint | True if Word 2010 allows fields containing tracked changes to update before printing. Read/write.
UpdateLinksAtOpen | True if Microsoft Word automatically updates all embedded OLE links in a document when it is opened. Read/write Boolean.
UpdateLinksAtPrint | True if Microsoft Word updates embedded links to other files before printing a document. Read/write Boolean.
UpdateStyleListBehavior | Returns or sets a WdUpdateStyleListBehavior constant that specifies the behavior Word 2010 should take when updating a style to match a selection that contains numbering or bullets. Read/write.
UseCharacterUnit | True if Microsoft Word uses characters as the default measurement unit for the current document. Read/write Boolean.
UseDiffDiacColor | True if you can set the color of diacritics in the current document. Read/write Boolean.
UseGermanSpellingReform | True if Microsoft Word uses the German post-reform spelling rules when checking spelling. Read/write Boolean.
UseNormalStyleForList | Returns or sets a Boolean that represents whether Microsoft Word uses the Normal style for bullets and numbering. Read/write.
UseSubPixelPositioning | Returns or sets a Boolean that specifies whether sub-pixel positioning is enabled. Read-write.
VisualSelection | Returns or sets the selection behavior based on visual cursor movement in a right-to-left language document. Read/write WdVisualSelection.
WarnBeforeSavingPrintingSendingMarkup | True for Microsoft Word to display a warning when saving, printing, or sending as e-mail a document containing comments or tracked changes. Read/write Boolean.


Options Properties (Word)

 Copy code hover
[image]

Options Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
AddBiDirectionalMarksWhenSavingTextFile | True if Microsoft Word adds bidirectional control characters when saving a document as a text file. Read/write Boolean.
AddControlCharacters | True if Microsoft Word adds bidirectional control characters when cutting and copying text. Read/write Boolean.
AddHebDoubleQuote | True if Microsoft Word encloses number formats in double quotation marks ("). Read/write Boolean.
AlertIfNotDefault | Returns or sets a Boolean that is True if users are notified if Microsoft Word 2013 is not the default program for viewing and editing documents. Read-write.
AllowAccentedUppercase | True if accents are retained when a French language character is changed to uppercase. Read/write Boolean.
AllowClickAndTypeMouse | True if Click and Type functionality is enabled. Read/write Boolean.
AllowCombinedAuxiliaryForms | True if Microsoft Word ignores auxiliary verb forms when checking spelling in a Korean language document. Read/write Boolean.
AllowCompoundNounProcessing | True if Microsoft Word ignores compound nouns when checking spelling in a Korean language document. Read/write Boolean.
AllowDragAndDrop | True if dragging can be used to move or copy a selection. Read/write Boolean.
AllowOpenInDraftView | Returns or sets a Boolean that represents whether to allow users to open documents in draft view. Read/write.
AllowPixelUnits | True if Microsoft Word uses pixels as the default unit of measurement for HTML features that support measurements. Read/write Boolean.
AllowReadingMode | True indicates that Microsoft Word opens documents in Reading Layout view. Read/write Boolean.
AnimateScreenMovements | True if Word animates mouse movements, uses animated cursors, and animates actions such as background saving and find and replace operations. Read/write Boolean.
Application | Returns an Application object that represents the Microsoft Word application.
ApplyFarEastFontsToAscii | True if Microsoft Word applies East Asian fonts to Latin text. Read/write Boolean.
ArabicMode | Returns or sets the mode for the Arabic spelling checker. Read/write WdAraSpeller.
ArabicNumeral | Returns or sets the numeral style for an Arabic language document. Read/write WdArabicNumeral.
AutoCreateNewDrawings | True for Microsoft Word to draw newly created shapes in a drawing canvas. Read/write Boolean.
AutoFormatApplyBulletedLists | True if characters (such as asterisks, hyphens, and greater-than signs) at the beginning of list paragraphs are replaced with bullets from the Bullets and Numbering dialog box (Format menu) when Word formats a document or range automatically. Read/write Boolean.
AutoFormatApplyFirstIndents | True if Microsoft Word replaces a space entered at the beginning of a paragraph with a first-line indent when Word formats a document or range automatically. Read/write Boolean.
AutoFormatApplyHeadings | True if styles are automatically applied to headings when Word formats a document or range automatically. Read/write Boolean.
AutoFormatApplyLists | True if styles are automatically applied to lists when Word formats a document or range automatically. Read/write Boolean.
AutoFormatApplyOtherParas | True if styles are automatically applied to paragraphs that aren't headings or list items when Word formats a document or range automatically. Read/write Boolean.
AutoFormatAsYouTypeApplyBorders | True if a series of three or more hyphens (-), equal signs (=), or underscore characters (_) are automatically replaced by a specific border line when the ENTER key is pressed. Read/write Boolean.
AutoFormatAsYouTypeApplyBulletedLists | True if bullet characters (such as asterisks, hyphens, and greater-than signs) are replaced with bullets from the Bullets And Numbering dialog box (Format menu) as you type. Read/write Boolean.
AutoFormatAsYouTypeApplyClosings | True for Microsoft Word to automatically apply the Closing style to letter closings as you type. Read/write Boolean.
AutoFormatAsYouTypeApplyDates | True for Microsoft Word to automatically apply the Date style to dates as you type. Read/write.
AutoFormatAsYouTypeApplyFirstIndents | True for Microsoft Word to automatically replace a space entered at the beginning of a paragraph with a first-line indent. Read/write.
AutoFormatAsYouTypeApplyHeadings | True if styles are automatically applied to headings as you type. Read/write Boolean.
AutoFormatAsYouTypeApplyNumberedLists | True if paragraphs are automatically formatted as numbered lists with a numbering scheme from the Bullets and Numbering dialog box (Format menu), according to what's typed. For example, if a paragraph starts with "1.1" and a tab character, Word automatically inserts "1.2" and a tab character after the ENTER key is pressed. Read/write Boolean.
AutoFormatAsYouTypeApplyTables | True if Word automatically creates a table when you type a plus sign, a series of hyphens, another plus sign, and so on, and then press ENTER. The plus signs become the column borders, and the hyphens become the column widths. Read/write Boolean.
AutoFormatAsYouTypeAutoLetterWizard | True for Microsoft Word to automatically start the Letter Wizard when the user enters a letter salutation or closing. Read/write.
AutoFormatAsYouTypeDefineStyles | True if Word automatically creates new styles based on manual formatting. Read/write Boolean.
AutoFormatAsYouTypeDeleteAutoSpaces | True for Microsoft Word to automatically delete spaces inserted between Japanese and Latin text as you type. Read/write.
AutoFormatAsYouTypeFormatListItemBeginning | True if Word repeats character formatting applied to the beginning of a list item to the next list item. Read/write Boolean.
AutoFormatAsYouTypeInsertClosings | True for Microsoft Word to automatically insert the corresponding memo closing when the user enters a memo heading. Read/write.
AutoFormatAsYouTypeInsertOvers | True for Microsoft Word to automatically insert "以上" when the user enters "記" or "案". Read/write Boolean.
AutoFormatAsYouTypeMatchParentheses | True for Microsoft Word to automatically correct improperly paired parentheses. Read/write.
AutoFormatAsYouTypeReplaceFarEastDashes | True for Microsoft Word to automatically correct long vowel sounds and dashes. Read/write.
AutoFormatAsYouTypeReplaceFractions | True if typed fractions are replaced with fractions from the current character set as you type. For example, "1/2" is replaced with "½." Read/write Boolean.
AutoFormatAsYouTypeReplaceHyperlinks | True if e-mail addresses, server and share names (also known as UNC paths), and Internet addresses (also known as URLs) are automatically changed to hyperlinks as you type. Read/write Boolean.
AutoFormatAsYouTypeReplaceOrdinals | True if the ordinal number suffixes "st", "nd", "rd", and "th" are replaced with the same letters in superscript as you type. For example, "1st" is replaced with "1" followed by "st" formatted as superscript. Read/write Boolean.
AutoFormatAsYouTypeReplacePlainTextEmphasis | True if manual emphasis characters are automatically replaced with character formatting as you type. For example, "*bold*" is changed to "bold" and "_underline_" is changed to "underline." Read/write Boolean.
AutoFormatAsYouTypeReplaceQuotes | True if straight quotation marks are automatically changed to smart (curly) quotation marks as you type. Read/write Boolean.
AutoFormatAsYouTypeReplaceSymbols | True if two consecutive hyphens (--) are replaced with an en dash (-) or an em dash (—) as you type. Read/write Boolean.If the hyphens are typed with leading and trailing spaces, Word replaces the hyphens with an en dash; if there are no trailing spaces, the hyphens are replaced with an em dash.
AutoFormatDeleteAutoSpaces | True if spaces inserted between Japanese and Latin text will be deleted when Microsoft Word formats a document or range automatically. Read/write Boolean.
AutoFormatMatchParentheses | True if improperly paired parentheses are corrected when Microsoft Word formats a document or range automatically. Read/write Boolean.
AutoFormatPlainTextWordMail | True if Word automatically formats plain-text e-mail messages when you open them in Word. Read/write Boolean.
AutoFormatPreserveStyles | True if previously applied styles are preserved when Word formats a document or range automatically. Read/write Boolean.
AutoFormatReplaceFarEastDashes | True if long vowel sound and dash use is corrected when Microsoft Word formats a document or range automatically. Read/write Boolean.
AutoFormatReplaceFractions | True if typed fractions are replaced with fractions from the current character set when Word formats a document or range automatically. For example, "1/2" is replaced with "½." Read/write Boolean.
AutoFormatReplaceHyperlinks | True if e-mail addresses, server and share names (also known as UNC paths), and Internet addresses (also known as URLs) are automatically formatted whenever Word AutoFormats a document or range. Read/write Boolean.
AutoFormatReplaceOrdinals | True if the ordinal number suffixes "st", "nd", "rd", and "th" are replaced with the same letters in superscript when Word formats a document or range automatically. For example, "1st" is replaced with "1" followed by "st" formatted as superscript. Read/write Boolean.
AutoFormatReplacePlainTextEmphasis | True if manual emphasis characters are replaced with character formatting when Word formats a document or range automatically. For example, "*bold*" is changed to "bold" and "_underline_" is changed to "underline." Read/write Boolean.
AutoFormatReplaceQuotes | True if straight quotation marks are automatically changed to smart (curly) quotation marks when Word formats a document or range automatically. Read/write Boolean.
AutoFormatReplaceSymbols | True if two consecutive hyphens (--) are replaced by an en dash (-) or an em dash (—) when Word formats a document or range automatically. Read/write Boolean.
AutoKeyboardSwitching | True if Microsoft Word automatically switches the keyboard language to match what you're typing at any given time. Read/write Boolean.
AutoWordSelection | True if dragging selects one word at a time instead of one character at a time. Read/write Boolean.
BackgroundSave | True if Word saves documents in the background. When Word is saving in the background, users can continue to type and to choose commands. Read/write Boolean.
BibliographySort | Returns or sets a String that represents the order in which to display sources in the Source Manager dialog box. Read/write.
BibliographyStyle | Returns or sets a String that represents the name of the style to use for formatting bibliographies. Read/write.
BrazilReform | Returns or sets the mode for the Brazilian Portuguese speller. Read/write WdPortugueseReform.
ButtonFieldClicks | Returns or sets the number of clicks (either one or two) required to run a GOTOBUTTON or MACROBUTTON field. Read/write Long.
CheckGrammarAsYouType | True if Word checks grammar and marks errors automatically as you type. Read/write Boolean.
CheckGrammarWithSpelling | True if Word checks grammar while checking spelling. Read/write Boolean.
CheckHangulEndings | True if Microsoft Word automatically detects Hangul endings and ignores them during conversion from Hangul to Hanja. Read/write Boolean.
CheckSpellingAsYouType | True if Microsoft Word checks spelling and marks errors automatically as you type. Read/write Boolean.
CommentsColor | Returns or sets a WdColorIndex constant that represents the color of comments in a document. Read/write.
ConfirmConversions | True if Word displays the Convert File dialog box before it opens or inserts a file that isn't a Word document or template. In the Convert File dialog box, the user chooses the format to convert the file from. Read/write Boolean.
ContextualSpeller | Returns or sets a Boolean that represents whether to use the contextual speller to check spelling based on the context of a word and the words around it. Read/write.
ConvertHighAnsiToFarEast | True if Microsoft Word converts text that is associated with an East Asian font to the appropriate font when it opens a document. Read/write Boolean.
CreateBackup | True if Word creates a backup copy each time a document is saved. Read/write Boolean.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
CtrlClickHyperlinkToOpen | True if Microsoft Word requires holding down the CTRL key while clicking to open a hyperlink. Read/write Boolean.
CursorMovement | Returns or sets how the insertion point progresses within bidirectional text. Read/write WdCursorMovement.
DefaultBorderColor | Returns or sets the default 24-bit color to use for new Border objects. Read/write.
DefaultBorderColorIndex | Returns or sets the default line color for borders. Read/write WdColorIndex.
DefaultBorderLineStyle | Returns or sets the default border line style. Read/write WdLineStyle.
DefaultBorderLineWidth | Returns or sets the default line width of borders. Read/write WdLineWidth.
DefaultEPostageApp | Sets or returns a String that represents the path and file name of the default electronic postage application. Read/write.
DefaultFilePath | Returns or sets default folders for items such as documents, templates, and graphics. Read/write String.
DefaultHighlightColorIndex | Returns or sets the color used to highlight text formatted with the Highlight button (Formatting toolbar). Read/write WdColorIndex.
DefaultOpenFormat | Returns or sets the default file converter used to open documents. Can be a number returned by the OpenFormat property, or one of the following WdOpenFormat constants.
DefaultTextEncoding | Returns or sets an MsoEncoding constant representing the code page, or character set, that Microsoft Word uses for all documents saved as encoded text files. Read/write.
DefaultTray | Returns or sets the default tray your printer uses to print documents. Read/write String.
DefaultTrayID | Returns or sets the default tray your printer uses to print documents. Read/write WdPaperTray.
DeletedCellColor | Returns or sets a WdCellColor constant that represents the color for a deleted cell. Read/write.
DeletedTextColor | Returns or sets the color of text that is deleted while change tracking is enabled. Read/write WdColorIndex.
DeletedTextMark | Returns or sets the format of text that is deleted while change tracking is enabled. Read/write WdDeletedTextMark.
DiacriticColorVal | Returns or sets the 24-bit color to be used for diacritics in a right-to-left language document. Read/write.
DisableFeaturesbyDefault | True for Microsoft Word to disable in all documents all features introduced after the version of Word specified in the DisableFeaturesIntroducedAfterbyDefault. The default value is False. Read/write Boolean.
DisableFeaturesIntroducedAfterbyDefault | Disables all features introduced after a the specified version for all documents. Read/write WdDisableFeaturesIntroducedAfter.
DisplayAlignmentGuides | Returns or sets a Boolean that specifies whether alignment guides are enabled in the user interface. Read-write.
DisplayGridLines | True if Microsoft Word displays the document grid. This property is the equivalent of the Gridlines command on the View menu. Read/write Boolean.
DisplayPasteOptions | True for Microsoft Word to display the Paste Options button, which displays directly under newly pasted text. Read/write Boolean.
DocumentViewDirection | Returns or sets the alignment and reading order for the entire document. Read/write WdDocumentViewDirection.
DoNotPromptForConvert | Sets or returns a Boolean that represents whether to prompt a warning dialog when the Convert command is invoked for documents that are in compatibility mode. Read/write.
EnableHangulHanjaRecentOrdering | True if Microsoft Word displays the most recently used words at the top of the suggestions list during conversion between Hangul and Hanja. Read/write Boolean.
EnableLegacyIMEMode | Returns or sets aBoolean that represents whether to enable legacy IME mode. Read/write.
EnableLiveDrag | Returns or sets a Boolean that is True if live drag is enabled. Read-write.
EnableLivePreview | Sets or returns a Boolean that represents whether to show or hide gallery previews that appear when using galleries that support previewing. True shows a preview in your document before applying the command. Read/write.
EnableMisusedWordsDictionary | True if Microsoft Word checks for misused words when checking the spelling and grammar in a document. Read/write Boolean.
EnableProofingToolsAdvertisement | Returns or sets a Boolean value that, when True, specifies that users be notified when additional proofing tools are available for download. Read-write.
EnableSound | True if Word makes the computer respond with a sound whenever an error occurs. Read/write Boolean.
EnvelopeFeederInstalled | True if the current printer has a special feeder for envelopes. Read-only Boolean.
ExpandHeadingsOnOpen | True to expand all headings in the document when the document opens. Read/write Boolean.
FormatScanning | True for Microsoft Word to keep track of all formatting in a document. Read/write Boolean.
FrenchReform | Returns or sets a WdFrenchSpellerconstant that represents which spelling dictionary to use for regions of text with language formatting set to French. Read/write.
GridDistanceHorizontal | Returns or sets the amount of horizontal space between the invisible gridlines that Word uses when you draw, move, and resize AutoShapes or East Asian characters in new documents. Read/write Single.
GridDistanceVertical | Returns or sets the amount of vertical space between the invisible gridlines that Word uses when you draw, move, and resize AutoShapes or East Asian characters in new documents. Read/write Single.
GridOriginHorizontal | Returns or sets the point, relative to the left edge of the page, where you want the invisible grid for drawing, moving, and resizing AutoShapes or East Asian characters to begin in new documents. Read/write Single.
GridOriginVertical | Returns or sets the point, relative to the top of the page, where you want the invisible grid for drawing, moving, and resizing AutoShapes or East Asian characters to begin in new documents. Read/write Single.
HangulHanjaFastConversion | True if Microsoft Word automatically converts a word with only one suggestion during conversion between Hangul and Hanja. Read/write Boolean.
HebrewMode | Returns or sets the mode for the Hebrew spelling checker. Read/write WdHebSpellStart.
IgnoreInternetAndFileAddresses | True if file name extensions, MS-DOS paths, e-mail addresses, server and share names (also known as UNC paths), and Internet addresses (also known as URLs) are ignored while checking spelling. Read/write Boolean.
IgnoreMixedDigits | True if words that contain numbers are ignored while checking spelling. Read/write Boolean.
IgnoreUppercase | True if words in all uppercase letters are ignored while checking spelling. Read/write Boolean.
IMEAutomaticControl | True if Microsoft Word is set to automatically open and close the Japanese Input Method Editor (IME). Read/write Boolean.
InlineConversion | True if Microsoft Word displays an unconfirmed character string in the Japanese Input Method Editor (IME) as an insertion between existing (confirmed) character strings. Read/write Boolean.
InsertedCellColor | Returns or sets a WdCellColorconstant that represents the color for an inserted table cell. Read/write.
InsertedTextColor | Returns or sets the color of text that is inserted while change tracking is enabled. Read/write WdColorIndex.
InsertedTextMark | Returns or sets how Microsoft Word formats inserted text while change tracking is enabled (the TrackRevisions property is True). Read/write WdInsertedTextMark.
INSKeyForOvertype | True if the INS key can be used for switching Overtype on and off. Read/write Boolean.
INSKeyForPaste | True if the INS key can be used for pasting the Clipboard contents. Read/write Boolean.
InterpretHighAnsi | Returns or sets the high-ANSI text interpretation behavior. Read/write WdHighAnsiText.
LocalNetworkFile | True if Microsoft Word creates a local copy of a file on the user's computer when editing a file stored on a network server. Read/write Boolean.
MapPaperSize | True if documents formatted for another country's/region's standard paper size (for example, A4) are automatically adjusted so that they're printed correctly on your country's/region's standard paper size (for example, Letter). Read/write Boolean.
MarginAlignmentGuides | Returns or sets a Boolean that specifies whether margin alignment guides are displayed in the user interface. Read-write.
MatchFuzzyAY | True if Microsoft Word ignores the distinction between " [image] " and " [image] " following [image] -row and [image] -row characters during a search. Read/write Boolean.
MatchFuzzyBV | True if Microsoft Word ignores the distinction between " [image] " and " [image] [image] " and between " [image] " and " [image] [image] " during a search. Read/write Boolean.
MatchFuzzyByte | True if Microsoft Word ignores the distinction between full-width and half-width characters (Latin or Japanese) during a search. Read/write Boolean.
MatchFuzzyCase | True if Microsoft Word ignores the distinction between uppercase and lowercase letters during a search. Read/write Boolean.
MatchFuzzyDash | True if Microsoft Word ignores the distinction between minus signs, long vowel sounds, and dashes during a search. Read/write Boolean.
MatchFuzzyDZ | True if Microsoft Word ignores the distinction between " [image] " and " [image] " and between " [image] " and " [image] " during a search. Read/write Boolean.
MatchFuzzyHF | True if Microsoft Word ignores the distinction between " [image] [image] " and " [image] [image] " and between " [image] [image] " and " [image] [image] " during a search. Read/write Boolean.
MatchFuzzyHiragana | True if Microsoft Word ignores the distinction between hiragana and katakana during a search. Read/write Boolean.
MatchFuzzyIterationMark | True if Microsoft Word ignores the distinction between types of repetition marks during a search. Read/write Boolean.
MatchFuzzyKanji | True if Microsoft Word ignores the distinction between standard and nonstandard kanji ideography during a search. Read/write Boolean.
MatchFuzzyKiKu | True if Microsoft Word ignores the distinction between " [image] " and " [image] " before [image] -row characters during a search. Read/write Boolean.
MatchFuzzyOldKana | True if Microsoft Word ignores the distinction between new kana and old kana characters during a search. Read/write Boolean.
MatchFuzzyProlongedSoundMark | True if Microsoft Word ignores the distinction between short and long vowel sounds during a search. Read/write Boolean.
MatchFuzzyPunctuation | True if Microsoft Word ignores the distinction between types of punctuation marks during a search. Read/write Boolean.
MatchFuzzySmallKana | True if Microsoft Word ignores the distinction between diphthongs and double consonants during a search. Read/write Boolean.
MatchFuzzySpace | True if Microsoft Word ignores the distinction between space markers used during a search. Read/write Boolean.
MatchFuzzyTC | True if Microsoft Word ignores the distinction between " [image] [image] ", " [image] [image] ", and " [image] ", and between " [image] [image] " and " [image] " during a search. Read/write Boolean.
MatchFuzzyZJ | True if Microsoft Word ignores the distinction between " [image] " and " [image] [image] " and between " [image] " and " [image] [image] " during a search. Read/write Boolean.
MeasurementUnit | Returns or sets the standard measurement unit for Microsoft Word. Read/write WdMeasurementUnits.
MergedCellColor | Returns or sets a WdCellColor constant that represents the color for merged table cells. Read/write.
MonthNames | Returns or sets the direction for conversion between Hangul and Hanja. Read/write WdMonthNames.
MoveFromTextColor | Returns or sets a WdColorIndex constant that represents the color of moved text. Read/write.
MoveFromTextMark | Returns or sets a WdMoveFromTextMark constant that represents the type of revision mark to use for moved text. Read/write.
MoveToTextColor | Returns or sets a WdColorIndex constant that represents the color of moved text. Read/write.
MoveToTextMark | Returns or sets a WdMoveToTextMark constant that represents the type of revision mark to use for moved text. Read/write.
MultipleWordConversionsMode | Returns or sets the direction for conversion between Hangul and Hanja. Read/write WdMultipleWordConversionsMode.
OMathAutoBuildUp | Returns or sets a Boolean that represents whether Microsoft Word automatically converts equations to professional format. True indicates that Word automatically converts equations to professional format. Read/write.
OMathCopyLF | Returns or sets a Boolean that represents how equations are represented in plain text. True indicates equations are represented in Linear Format. False indicates equations are represented in MathML. Read/write.
OptimizeForWord97byDefault | True if Microsoft Word optimizes all new documents for viewing in Word 97 by disabling any incompatible formatting. Read/write Boolean.
Overtype | True if Overtype mode is active. Read/write Boolean.
PageAlignmentGuides | Returns or sets a Boolean that specifies whether page alignment guides are displayed in the user interface. Read-write.
Pagination | True if Microsoft Word repaginates documents in the background. Read/write Boolean.
ParagraphAlignmentGuides | Returns or sets a Boolean that specifies whether paragraph alignment guides are displayed in the user interface. Read-write.
Parent | Returns an Object that represents the parent object of the specified Options object.
PasteAdjustParagraphSpacing | True if Microsoft Word automatically adjusts the spacing of paragraphs when cutting and pasting selections. Read/write Boolean.
PasteAdjustTableFormatting | True if Microsoft Word automatically adjusts the formatting of tables when cutting and pasting selections. Read/write Boolean.
PasteAdjustWordSpacing | True if Microsoft Word automatically adjusts the spacing of words when cutting and pasting selections. Read/write Boolean.
PasteFormatBetweenDocuments | Returns or sets a WdPasteOptions constant that represents how text is pasted when text is copied from another Microsoft Office Word document. Read/write.
PasteFormatBetweenStyledDocuments | Returns or sets a WdPasteOptions constant that represents how text is pasted when text is copied from a document that uses styles. Read/write.
PasteFormatFromExternalSource | Returns or sets a WdPasteOptions constant that represents how text is pasted when text is copied from an external source, such as a Web page. Read/write.
PasteFormatWithinDocument | Returns or sets a WdPasteOptions constant that represents how text is pasted when text is copied or cut and then pasted in the same document. Read/write.
PasteMergeFromPPT | True to merge text formatting when pasting from Microsoft PowerPoint. Read/write Boolean.
PasteMergeFromXL | True to merge table formatting when pasting from Microsoft Excel. Read/write Boolean.
PasteMergeLists | True to merge the formatting of pasted lists with surrounding lists. Read/write Boolean.
PasteOptionKeepBulletsAndNumbers | Returns or sets a Boolean that represents whether to keep bullets and numbering when selecting Keep text only from the Paste Options context menu. Read/write.
PasteSmartCutPaste | True if Microsoft Word intelligently pastes selections into a document. Read/write Boolean.
PasteSmartStyleBehavior | True if Microsoft Word intelligently merges styles when pasting a selection from a different document. Read/write Boolean.
PictureEditor | Returns or sets the name of the application to use to edit pictures. Read/write String.
PictureWrapType | Sets or returns a WdWrapTypeMerged that indicates how Microsoft Word wraps text around pictures. Read/write.
PortugalReform | Returns or sets the mode for the European Portuguese speller. Read/write WdPortugueseReform.
PrecisePositioning | Returns or sets a Boolean that represents whether Word optimizes character positioning for print layout rather than on-screen readability. True disables the default setting that compresses character spacing to facilitate on-screen readability and enables character spacing for print media. Read/write.
PreferCloudSaveLocations | True to save new documents in web locations by default. Read/write Boolean.
PrintBackground | True if Microsoft Word prints in the background. Read/write Boolean.
PrintBackgrounds | Returns a Boolean that represents whether background colors and images are printed when a document is printed.
PrintComments | True if Microsoft Word prints comments, starting on a new page at the end of the document. Read/write Boolean.
PrintDraft | True if Microsoft Word prints using minimal formatting. Read/write Boolean.
PrintDrawingObjects | True if Microsoft Word prints drawing objects. Read/write Boolean.
PrintEvenPagesInAscendingOrder | True if Microsoft Word prints even pages in ascending order during manual duplex printing. Read/write Boolean.
PrintFieldCodes | True if Microsoft Word prints field codes instead of field results. Read/write Boolean.
PrintHiddenText | True if hidden text is printed. Read/write Boolean.
PrintOddPagesInAscendingOrder | True if Microsoft Word prints odd pages in ascending order during manual duplex printing. Read/write Boolean.
PrintProperties | True if Microsoft Word prints document summary information on a separate page at the end of the document. Read/write Boolean.
PrintReverse | True if Microsoft Word prints pages in reverse order. Read/write Boolean.
PrintXMLTag | Returns a Boolean that represents whether to print the XML tags when printing a document. Corresponds to the XML tags check box on the Print tab in the Options dialog box. .
PromptUpdateStyle | True displays a message asking the user to verify whether they want to reformat a style or reapply the original style formatting when changing the formatting of styles. Read/write Boolean.
RepeatWord | Returns or sets a Boolean that represents whether to mark words that are repeated when spelling is checked. True flags repeated words. Read/write.
ReplaceSelection | True if the result of typing or pasting replaces the selection. Read/write Boolean.
RevisedLinesColor | Returns or sets the color of changed lines in a document with tracked changes. Read/write WdColorIndex.
RevisedLinesMark | Returns or sets the placement of changed lines in a document with tracked changes. Read/write WdRevisedLinesMark.
RevisedPropertiesColor | Returns or sets the color used to mark formatting changes while change tracking is enabled. Read/write WdColorIndex.
RevisedPropertiesMark | Returns or sets the mark used to show formatting changes while change tracking is enabled. Read/write WdRevisedPropertiesMark.
RevisionsBalloonPrintOrientation | Returns or sets a WdRevisionsBalloonPrintOrientation constant that represents the direction of revision and comment balloons when they are printed. Read/write.
RTFInClipboard | You have requested Help for a Visual Basic keyword used only on the Macintosh. For information about the RTFInClipboard property for the Options object, consult the language reference Help included with Microsoft Office Macintosh Edition.
SaveInterval | Returns or sets the time interval in minutes for saving AutoRecover information. Read/write Long.
SaveNormalPrompt | True if Microsoft Word prompts the user for confirmation to save changes to the Normal template before it closes. Read/write Boolean.
SavePropertiesPrompt | True if Microsoft Word prompts for document property information when saving a new document. Read/write Boolean.
SendMailAttach | True if the Send To command on the File menu inserts the active document as an attachment to a mail message. Read/write Boolean.
SequenceCheck | True to check the sequence of independent characters for South Asian text. Read/write Boolean.
ShortMenuNames | You have requested Help for a Visual Basic keyword used only on the Macintosh. For information about the ShortMenuNames property for the Options object, consult the language reference Help included with Microsoft Office Macintosh Edition.
ShowControlCharacters | True if bidirectional control characters are visible in the current document. Read/write Boolean.
ShowDevTools | Returns or sets a Boolean that represents whether the Developer tab is displayed in the ribbon. Read/write.
ShowDiacritics | True if diacritics are visible in a right-to-left language document. Read/write Boolean.
ShowFormatError | True for Microsoft Word to mark inconsistencies in formatting by placing a squiggly underline beneath text formatted similarly to other formatting that is used more frequently in a document. Read/write Boolean.
ShowMarkupOpenSave | Returns or sets a Boolean that represents whether Microsoft Word displays hidden markup when opening or saving a file.
ShowMenuFloaties | Returns or sets a Boolean that represents whether to display mini toolbars when the user right-clicks in the document window. Read/write.
ShowReadabilityStatistics | True if Microsoft Word displays a list of summary statistics, including measures of readability, when it has finished checking grammar. Read/write Boolean.
ShowSelectionFloaties | Returns or sets a Boolean that represents whether mini toolbars display when a user selects text. Read/write.
SkyDriveSignInOption | True to give users the option to sign in to SkyDrive and other cloud locations. Read/write Boolean.
SmartCursoring | Returns or sets a Boolean that represents whether smart cursoring is enabled. True enables smart cursoring.
SmartCutPaste | True if Microsoft Word automatically adjusts the spacing between words and punctuation when cutting and pasting occurs. Read/write Boolean.
SmartParaSelection | True for Microsoft Word to include the paragraph mark in a selection when selecting most or all of a paragraph. Read/write Boolean.
SnapToGrid | True if AutoShapes or East Asian characters are automatically aligned with an invisible grid when they are drawn, moved, or resized. Read/write Boolean.
SnapToShapes | True if Word automatically aligns AutoShapes or East Asian characters with invisible gridlines that go through the vertical and horizontal edges of other AutoShapes or East Asian characters. Read/write Boolean.
SpanishMode | Returns or sets the mode for the Spanish speller. Read/write WdSpanishSpeller.
SplitCellColor | Returns or sets a WdCellColor that represents the color for split table cells. Read/write.
StoreRSIDOnSave | True for Microsoft Word to assign a random number to changes in a document, each time a document is saved, to facilitate comparing and merging documents. Read/write Boolean.
StrictFinalYaa | True if the spelling checker uses spelling rules regarding Arabic words ending with the letter yaa. Read/write Boolean.
StrictInitialAlefHamza | True if the spelling checker uses spelling rules regarding Arabic words beginning with an alef hamza. Read/write Boolean.
StrictRussianE | True if the spelling checker uses spelling rules regarding Russian words that use the strict ë character. Read/write.
StrictTaaMarboota | True if the spelling checker uses spelling rules to flag Arabic words ending with haa instead of taa marboota. Read/write.
SuggestFromMainDictionaryOnly | True if Microsoft Word draws spelling suggestions from the main dictionary only. Read/write Boolean.
SuggestSpellingCorrections | True if Microsoft Word always suggests alternative spellings for each misspelled word when checking spelling. Read/write Boolean.
TabIndentKey | True if the TAB and BACKSPACE keys can be used to increase and decrease, respectively, the left indent of paragraphs and if the BACKSPACE key can be used to change right-aligned paragraphs to centered paragraphs and centered paragraphs to left-aligned paragraphs. Read/write Boolean.
TypeNReplace | True for Microsoft Word to replace illegal South Asian characters. Read/write Boolean.
UpdateFieldsAtPrint | True if Microsoft Word updates fields automatically before printing a document. Read/write Boolean.
UpdateFieldsWithTrackedChangesAtPrint | True if Word 2010 allows fields containing tracked changes to update before printing. Read/write.
UpdateLinksAtOpen | True if Microsoft Word automatically updates all embedded OLE links in a document when it is opened. Read/write Boolean.
UpdateLinksAtPrint | True if Microsoft Word updates embedded links to other files before printing a document. Read/write Boolean.
UpdateStyleListBehavior | Returns or sets a WdUpdateStyleListBehavior constant that specifies the behavior Word 2010 should take when updating a style to match a selection that contains numbering or bullets. Read/write.
UseCharacterUnit | True if Microsoft Word uses characters as the default measurement unit for the current document. Read/write Boolean.
UseDiffDiacColor | True if you can set the color of diacritics in the current document. Read/write Boolean.
UseGermanSpellingReform | True if Microsoft Word uses the German post-reform spelling rules when checking spelling. Read/write Boolean.
UseNormalStyleForList | Returns or sets a Boolean that represents whether Microsoft Word uses the Normal style for bullets and numbering. Read/write.
UseSubPixelPositioning | Returns or sets a Boolean that specifies whether sub-pixel positioning is enabled. Read-write.
VisualSelection | Returns or sets the selection behavior based on visual cursor movement in a right-to-left language document. Read/write WdVisualSelection.
WarnBeforeSavingPrintingSendingMarkup | True for Microsoft Word to display a warning when saving, printing, or sending as e-mail a document containing comments or tracked changes. Read/write Boolean.


Options.AddBiDirectionalMarksWhenSavingTextFile Property (Word)

 Copy code hover
[image]

Options.AddBiDirectionalMarksWhenSavingTextFile Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word adds bidirectional control characters when saving a document as a text file. Read/write Boolean.

Syntax

expression .AddBiDirectionalMarksWhenSavingTextFile

expression A variable that represents a Options object.

Remarks

Saving text files with bidirectional control characters preserves right-to-left and left-to-right properties and the order of neutral characters.

Example

This example sets Word to add bidirectional control characters when saving a document as a text file.

VBA Copy code Copy code
Options.AddBiDirectionalMarksWhenSavingTextFile = True

See also

Concepts

Options Object

Other resources

Options Object Members


Options.AddControlCharacters Property (Word)

 Copy code hover
[image]

Options.AddControlCharacters Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word adds bidirectional control characters when cutting and copying text. Read/write Boolean.

Syntax

expression .AddControlCharacters

expression An expression that returns an Options object.

Example

This example sets Word to add bidirectional control characters when cutting and copying text.

VBA Copy code Copy code
Options.AddControlCharacters = True

See also

Concepts

Options Object

Other resources

Options Object Members


Options.AddHebDoubleQuote Property (Word)

 Copy code hover
[image]

Options.AddHebDoubleQuote Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word encloses number formats in double quotation marks ("). Read/write Boolean.

Syntax

expression .AddHebDoubleQuote

expression An expression that returns an Options object.

Example

This example sets Word to enclose number formats in double quotation marks (").

VBA Copy code Copy code
Options.AddHebDoubleQuote = True

See also

Concepts

Options Object

Other resources

Options Object Members


Options.AlertIfNotDefault Property (Word)

 Copy code hover
[image]

Options.AlertIfNotDefault Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that is True if users are notified if Microsoft Word 2013 is not the default program for viewing and editing documents. Read-write.

Version information

Version Added: Word 2013

Syntax

expression .AlertIfNotDefault

expression A variable that represents a Options object.

Remarks

The setting of AlertIfNotDefault corresponds to the setting of Tell me if Microsoft Word isn't the default program for viewing and editing documents on the General tab of the Word Options dialog box. (Choose Options on the File tab.)

Property value

BOOL

See also

Concepts

Options Object

Other resources

Options Members


Options.AllowAccentedUppercase Property (Word)

 Copy code hover
[image]

Options.AllowAccentedUppercase Property (Word)
See also Send feedback

Published: July 16, 2012

True if accents are retained when a French language character is changed to uppercase. Read/write Boolean.

Syntax

expression .AllowAccentedUppercase

expression A variable that represents a Options object.

Remarks

This property affects only text that's been marked as standard French. For all other languages, accents are always retained even if the AllowAccentedUppercase property is set to False.

If you change a character back to lowercase after an accent mark has been stripped from it, the accent won't reappear.

Example

This example sets Word to remove accent marks when characters in French text are changed to uppercase.

VBA Copy code Copy code
Options.AllowAccentedUppercase = False

This example returns the status of the Allow accented uppercase in French option on the Edit tab in the Options dialog box.

VBA Copy code Copy code
Dim blnUppercaseAccents as Boolean

blnUppercaseAccents = Options.AllowAccentedUppercase

See also

Concepts

Options Object

Other resources

Options Object Members


Options.AllowClickAndTypeMouse Property (Word)

 Copy code hover
[image]

Options.AllowClickAndTypeMouse Property (Word)
See also Send feedback

Published: July 16, 2012

True if Click and Type functionality is enabled. Read/write Boolean.

Syntax

expression .AllowClickAndTypeMouse

expression An expression that returns an Options object.

Remarks

For more information on Click and Type, see About Click and Type .

Example

This example checks to determine whether Click and Type functionality is enabled. If it isn't enabled, the example sets this functionality based on the user's choice.

VBA Copy code Copy code
If Options.AllowClickAndTypeMouse = False Then
 x = MsgBox("Do you want to use Click and Type?", _
 vbYesNo)
 If x = vbYes Then
 Options.AllowClickAndTypeMouse = True
 MsgBox "Click and Type enabled!"
 End If
End If

See also

Concepts

Options Object

Other resources

Options Object Members


Options.AllowCombinedAuxiliaryForms Property (Word)

 Copy code hover
[image]

Options.AllowCombinedAuxiliaryForms Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word ignores auxiliary verb forms when checking spelling in a Korean language document. Read/write Boolean.

Syntax

expression .AllowCombinedAuxiliaryForms

expression An expression that returns an Options object.

Remarks

For more information on using Word with Asian languages, see Word features for Asian languages .

Example

This example asks the user whether Microsoft Word should ignore auxiliary verb forms when checking spelling in a Korean language document.

VBA Copy code Copy code
If Options.AllowCombinedAuxiliaryForms = False Then
 x = MsgBox("Do you want to ignore auxiliary " _
 & "verb forms when checking spelling?", _
 vbYesNo)
 If x = vbYes Then
 Options.AllowCombinedAuxiliaryForms = True
 MsgBox "Auxiliary verb forms will be ignored!"
 End If
End If

See also

Concepts

Options Object

Other resources

Options Object Members


Options.AllowCompoundNounProcessing Property (Word)

 Copy code hover
[image]

Options.AllowCompoundNounProcessing Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word ignores compound nouns when checking spelling in a Korean language document. Read/write Boolean.

Syntax

expression .AllowCompoundNounProcessing

expression An expression that returns an Options object.

Remarks

For more information on using Word with Asian languages, see Word features for Asian languages .

Example

This example asks the user whether Microsoft Word should ignore compound nouns when checking spelling in a Korean language document.

VBA Copy code Copy code
If Options.AllowCompoundNounProcessing = False Then
 x = MsgBox("Do you want to ignore compound " _
 & "nouns when checking spelling?", _
 vbYesNo)
 If x = vbYes Then
 Options.AllowCompoundNounProcessing = True
 MsgBox "Compound nouns will be ignored!"
 End If
End If

See also

Concepts

Options Object

Other resources

Options Object Members


Options.AllowDragAndDrop Property (Word)

 Copy code hover
[image]

Options.AllowDragAndDrop Property (Word)
See also Send feedback

Published: July 16, 2012

True if dragging can be used to move or copy a selection. Read/write Boolean.

Syntax

expression .AllowDragAndDrop

expression A variable that represents an Options object.

Example

This example turns on the drag-and-drop editing feature.

VBA Copy code Copy code
Options.AllowDragAndDrop = True

This example returns the status of the Drag-and-Drop text-editing option on the Edit tab in the Options dialog box.

VBA Copy code Copy code
Dim blnDragAndDrop as Boolean

blnDragAndDrop = Options.AllowDragAndDrop

See also

Concepts

Options Object

Other resources

Options Object Members


Options.AllowOpenInDraftView Property (Word)

 Copy code hover
[image]

Options.AllowOpenInDraftView Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents whether to allow users to open documents in draft view. Read/write.

Syntax

expression .AllowOpenInDraftView

expression An expression that returns an Options object.

Remarks

This property corresponds to the Allow opening a document in draft view check box in the Word Options dialog box.

See also

Concepts

Options Object

Other resources

Options Object Members


Options.AllowPixelUnits Property (Word)

 Copy code hover
[image]

Options.AllowPixelUnits Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word uses pixels as the default unit of measurement for HTML features that support measurements. Read/write Boolean.

Syntax

expression .AllowPixelUnits

expression A variable that represents a Options object.

Example

This example sets Word to allow pixels as the default unit of measurement for HTML features.

VBA Copy code Copy code
Options.AllowPixelUnits = True

See also

Concepts

Options Object

Other resources

Options Object Members


Options.AllowReadingMode Property (Word)

 Copy code hover
[image]

Options.AllowReadingMode Property (Word)
See also Send feedback

Published: July 16, 2012

True indicates that Microsoft Word opens documents in Reading Layout view. Read/write Boolean.

Syntax

expression .AllowReadingMode

expression An expression that returns an Options object.

Remarks

Corresponds to the Allow starting in Reading Layout check box on the General tab of the Options dialog box.

Example

The following example toggles the Allow starting in Reading Layout check box.

VBA Copy code Copy code
Sub ToggleReadingMode()
 If Options.AllowReadingMode = True Then
 Options.AllowReadingMode = False
 Else
 Options. = True
 End If
End Sub

See also

Concepts

Options Object

Other resources

Options Object Members


Options.AnimateScreenMovements Property (Word)

 Copy code hover
[image]

Options.AnimateScreenMovements Property (Word)
See also Send feedback

Published: July 16, 2012

True if Word animates mouse movements, uses animated cursors, and animates actions such as background saving and find and replace operations. Read/write Boolean.

Syntax

expression .AnimateScreenMovements

expression A variable that represents a Options object.

Example

This example sets Word to animate movements on the screen.

VBA Copy code Copy code
Options.AnimateScreenMovements = True

This example returns the current status of the Provide feedback with animation option on the General tab in the Options dialog box (Tools menu).

VBA Copy code Copy code
Dim blnAnimation as Boolean blnAnimation = Options.AnimateScreenMovements

See also

Concepts

Options Object

Other resources

Options Object Members


Options.Application Property (Word)

 Copy code hover
[image]

Options.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents an Options collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

Options Object

Other resources

Options Object Members


Options.ApplyFarEastFontsToAscii Property (Word)

 Copy code hover
[image]

Options.ApplyFarEastFontsToAscii Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word applies East Asian fonts to Latin text. Read/write Boolean.

Syntax

expression .ApplyFarEastFontsToAscii

expression An expression that returns an Options object.

Remarks

This property applies only when you have selected an East Asian language for editing. If this property is False and you apply an East Asian font to a specified range, Word will not apply the font to any Latin text in the range.

Example

This example sets Microsoft Word to apply East Asian fonts to Latin text.

VBA Copy code Copy code
Options.ApplyFarEastFontsToAscii = True

See also

Concepts

Options Object

Other resources

Options Object Members


Options.ArabicMode Property (Word)

 Copy code hover
[image]

Options.ArabicMode Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the mode for the Arabic spelling checker. Read/write WdAraSpeller.

Syntax

expression .ArabicMode

expression Required. A variable that represents an Options collection.

Example

This example sets the spelling checker to ignore spelling rules regarding Arabic words beginning with an alef hamza.

VBA Copy code Copy code
Options.ArabicMode = wdInitialAlef

See also

Concepts

Options Object

Other resources

Options Object Members


Options.ArabicNumeral Property (Word)

 Copy code hover
[image]

Options.ArabicNumeral Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the numeral style for an Arabic language document. Read/write WdArabicNumeral.

Syntax

expression .ArabicNumeral

expression Required. A variable that represents an Options collection.

Example

This example sets the numeral style to Hindi.

VBA Copy code Copy code
Options.ArabicNumeral = wdNumeralHindi

See also

Concepts

Options Object

Other resources

Options Object Members


Options.AutoCreateNewDrawings Property (Word)

 Copy code hover
[image]

Options.AutoCreateNewDrawings Property (Word)
See also Send feedback

Published: July 16, 2012

True for Microsoft Word to draw newly created shapes in a drawing canvas. Read/write Boolean.

Syntax

expression .AutoCreateNewDrawings

expression An expression that returns an Options object.

Remarks

The AutoCreateNewDrawings property only affects shapes as they are added from within Word. If shapes are added through Visual Basic for Applications code, they are added as specified in the code regardless of whether this option is set to True or False.

Example

This example sets Word to add newly created shapes directly to the document and not within a drawing canvas.

VBA Copy code Copy code
Sub NewDrawings()
 Application.Options.AutoCreateNewDrawings = False
End Sub

See also

Concepts

Options Object

Other resources

Options Object Members


Options.AutoFormatApplyBulletedLists Property (Word)

 Copy code hover
[image]

Options.AutoFormatApplyBulletedLists Property (Word)
See also Send feedback

Published: July 16, 2012

True if characters (such as asterisks, hyphens, and greater-than signs) at the beginning of list paragraphs are replaced with bullets from the Bullets and Numbering dialog box (Format menu) when Word formats a document or range automatically. Read/write Boolean.

Syntax

expression .AutoFormatApplyBulletedLists

expression A variable that represents an Options object.

Example

This example replaces any characters used at the beginning of list paragraphs in the current selection with bullets.

VBA Copy code Copy code
Options.AutoFormatApplyBulletedLists = True
Selection.Range.AutoFormat

This example returns the status of the Automatic bulleted lists option on the AutoFormat tab in the AutoCorrect dialog box (Tools menu).

VBA Copy code Copy code
Dim blnAutoFormat as Boolean

blnAutoFormat = Options.AutoFormatApplyBulletedLists

See also

Concepts

Options Object

Other resources

Options Object Members


Options.AutoFormatApplyFirstIndents Property (Word)

 Copy code hover
[image]

Options.AutoFormatApplyFirstIndents Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word replaces a space entered at the beginning of a paragraph with a first-line indent when Word formats a document or range automatically. Read/write Boolean.

Syntax

expression .AutoFormatApplyFirstIndents

expression An expression that returns an Options object.

Example

This example sets Microsoft Word to replace a space entered at the beginning of a paragraph with a first-line indent and automatically formats the selected range.

VBA Copy code Copy code
Options.AutoFormatApplyFirstIndents = True
Selection.Range.AutoFormat

See also

Concepts

Options Object

Other resources

Options Object Members


Options.AutoFormatApplyHeadings Property (Word)

 Copy code hover
[image]

Options.AutoFormatApplyHeadings Property (Word)
See also Send feedback

Published: July 16, 2012

True if styles are automatically applied to headings when Word formats a document or range automatically. Read/write Boolean.

Syntax

expression .AutoFormatApplyHeadings

expression A variable that represents an Options object.

Example

This example applies the Heading 1 through Heading 9 styles to headings in the current selection.

VBA Copy code Copy code
Options.AutoFormatApplyHeadings = True
Selection.Range.AutoFormat

This example returns the status of the Headings option on the AutoFormat tab in the AutoCorrect dialog box (Tools menu).

VBA Copy code Copy code
Dim blnAutoFormat as Boolean

blnAutoFormat = Options.AutoFormatApplyHeadings

See also

Concepts

Options Object

Other resources

Options Object Members


Options.AutoFormatApplyLists Property (Word)

 Copy code hover
[image]

Options.AutoFormatApplyLists Property (Word)
See also Send feedback

Published: July 16, 2012

True if styles are automatically applied to lists when Word formats a document or range automatically. Read/write Boolean.

Syntax

expression .AutoFormatApplyLists

expression A variable that represents an Options object.

Example

This example applies styles to any lists in the current selection.

VBA Copy code Copy code
Options.AutoFormatApplyLists = True
Selection.Range.AutoFormat

This example returns the status of the Lists option on the AutoFormat tab in the AutoCorrect dialog box (Tools menu).

VBA Copy code Copy code
Dim blnAutoFormat as Boolean

blnAutoFormat = Options.AutoFormatApplyLists

See also

Concepts

Options Object

Other resources

Options Object Members


Options.AutoFormatApplyOtherParas Property (Word)

 Copy code hover
[image]

Options.AutoFormatApplyOtherParas Property (Word)
See also Send feedback

Published: July 16, 2012

True if styles are automatically applied to paragraphs that aren't headings or list items when Word formats a document or range automatically. Read/write Boolean.

Syntax

expression .AutoFormatApplyOtherParas

expression A variable that represents an Options object.

Example

This example automatically applies styles to paragraphs in the current selection.

VBA Copy code Copy code
Options.AutoFormatApplyOtherParas = True
Selection.Range.AutoFormat

This example returns the status of the Other paragraphs option on the AutoFormat tab in the AutoCorrect dialog box (Tools menu).

VBA Copy code Copy code
Dim blnAutoFormat as Boolean

blnAutoFormat = Options.AutoFormatApplyOtherParas

See also

Concepts

Options Object

Other resources

Options Object Members


Options.AutoFormatAsYouTypeApplyBorders Property (Word)

 Copy code hover
[image]

Options.AutoFormatAsYouTypeApplyBorders Property (Word)
See also Send feedback

Published: July 16, 2012

True if a series of three or more hyphens (-), equal signs (=), or underscore characters (_) are automatically replaced by a specific border line when the ENTER key is pressed. Read/write Boolean.

Syntax

expression .AutoFormatAsYouTypeApplyBorders

expression A variable that represents an Options collection.

Remarks

Hyphens (-) are replaced by a 0.75-point line, equal signs (=) are replaced by a 0.75-point double line, and underscore characters (_) are replaced by a 1.5-point line.

Example

This example causes sequences of three or more hyphens (-), equal signs (=), or underscore characters (_) to be transformed into borders.

VBA Copy code Copy code
Options.AutoFormatAsYouTypeApplyBorders = True

This example returns the current setting for the Borders option on the AutoFormat As You Type tab in the AutoCorrect dialog box (Tools menu).

VBA Copy code Copy code
MsgBox Options.AutoFormatAsYouTypeApplyBorders

See also

Concepts

Options Object

Other resources

Options Object Members


Options.AutoFormatAsYouTypeApplyBulletedLists Property (Word)

 Copy code hover
[image]

Options.AutoFormatAsYouTypeApplyBulletedLists Property (Word)
See also Send feedback

Published: July 16, 2012

True if bullet characters (such as asterisks, hyphens, and greater-than signs) are replaced with bullets from the Bullets And Numbering dialog box (Format menu) as you type. Read/write Boolean.

Syntax

expression .AutoFormatAsYouTypeApplyBulletedLists

expression A variable that represents an Options collection.

Example

This example causes characters to be replaced with bullets when typed in a list.

VBA Copy code Copy code
Options.AutoFormatAsYouTypeApplyBulletedLists = True

This example returns the status of the Automatic bulleted lists option on the AutoFormat As You Type tab in the AutoCorrect dialog box (Tools menu).

VBA Copy code Copy code
Dim blnAutoFormat as Boolean

blnAutoFormat = Options.AutoFormatAsYouTypeApplyBulletedLists

See also

Concepts

Options Object

Other resources

Options Object Members


Options.AutoFormatAsYouTypeApplyClosings Property (Word)

 Copy code hover
[image]

Options.AutoFormatAsYouTypeApplyClosings Property (Word)
See also Send feedback

Published: July 16, 2012

True for Microsoft Word to automatically apply the Closing style to letter closings as you type. Read/write Boolean.

Syntax

expression .AutoFormatAsYouTypeApplyClosings

expression Required. A variable that represents an Options collection.

Example

This example sets Microsoft Word to automatically apply the Closing style to letter closings as you type.

VBA Copy code Copy code
Sub AutoClosings()
 Options.AutoFormatAsYouTypeApplyClosings = True
End Sub

See also

Concepts

Options Object

Other resources

Options Object Members


Options.AutoFormatAsYouTypeApplyDates Property (Word)

 Copy code hover
[image]

Options.AutoFormatAsYouTypeApplyDates Property (Word)
See also Send feedback

Published: July 16, 2012

True for Microsoft Word to automatically apply the Date style to dates as you type. Read/write.

Syntax

expression .AutoFormatAsYouTypeApplyDates

expression Required. A variable that represents an Options collection.

Example

This example sets Microsoft Word to automatically apply the Date style to dates as you type.

VBA Copy code Copy code
Sub AutoApplyDates()
 Options.AutoFormatAsYouTypeApplyDates = True
End Sub

See also

Concepts

Options Object

Other resources

Options Object Members


Options.AutoFormatAsYouTypeApplyFirstIndents Property (Word)

 Copy code hover
[image]

Options.AutoFormatAsYouTypeApplyFirstIndents Property (Word)
See also Send feedback

Published: July 16, 2012

True for Microsoft Word to automatically replace a space entered at the beginning of a paragraph with a first-line indent. Read/write.

Syntax

expression .AutoFormatAsYouTypeApplyFirstIndents

expression Required. A variable that represents an Options collection.

Example

This example sets Microsoft Word to automatically replace a space entered at the beginning of a paragraph with a first-line indent as you type.

VBA Copy code Copy code
Sub ApplyFirstIndents()
 Options.AutoFormatAsYouTypeApplyFirstIndents = True
End Sub

See also

Concepts

Options Object

Other resources

Options Object Members


Options.AutoFormatAsYouTypeApplyHeadings Property (Word)

 Copy code hover
[image]

Options.AutoFormatAsYouTypeApplyHeadings Property (Word)
See also Send feedback

Published: July 16, 2012

True if styles are automatically applied to headings as you type. Read/write Boolean.

Syntax

expression .AutoFormatAsYouTypeApplyHeadings

expression A variable that represents an Options collection.

Example

This example sets Word to automatically apply the Heading1 through Heading 9 styles to headings as you type.

VBA Copy code Copy code
Options.AutoFormatAsYouTypeApplyHeadings = True

This example returns the status of the Headings option on the AutoFormat As You Type tab in the AutoCorrect dialog box (Tools menu).

VBA Copy code Copy code
Dim blnAutoFormat as Boolean

blnAutoFormat = Options.AutoFormatAsYouTypeApplyHeadings

See also

Concepts

Options Object

Other resources

Options Object Members


Options.AutoFormatAsYouTypeApplyNumberedLists Property (Word)

 Copy code hover
[image]

Options.AutoFormatAsYouTypeApplyNumberedLists Property (Word)
See also Send feedback

Published: July 16, 2012

True if paragraphs are automatically formatted as numbered lists with a numbering scheme from the Bullets and Numbering dialog box (Format menu), according to what's typed. For example, if a paragraph starts with "1.1" and a tab character, Word automatically inserts "1.2" and a tab character after the ENTER key is pressed. Read/write Boolean.

Syntax

expression .AutoFormatAsYouTypeApplyNumberedLists

expression A variable that represents an Options collection.

Example

This example causes lists to be automatically numbered as you type.

VBA Copy code Copy code
Options.AutoFormatAsYouTypeApplyNumberedLists = True

This example returns the status of the Automatic numbered lists option on the AutoFormat As You Type tab in the AutoCorrect dialog box (Tools menu).

VBA Copy code Copy code
Dim blnAutoFormat as Boolean

blnAutoFormat = Options.AutoFormatAsYouTypeApplyNumberedLists

See also

Concepts

Options Object

Other resources

Options Object Members


Options.AutoFormatAsYouTypeApplyTables Property (Word)

 Copy code hover
[image]

Options.AutoFormatAsYouTypeApplyTables Property (Word)
See also Send feedback

Published: July 16, 2012

True if Word automatically creates a table when you type a plus sign, a series of hyphens, another plus sign, and so on, and then press ENTER. The plus signs become the column borders, and the hyphens become the column widths. Read/write Boolean.

Syntax

expression .AutoFormatAsYouTypeApplyTables

expression A variable that represents an Options collection.

Example

This example sets Word to automatically create tables as you type.

VBA Copy code Copy code
Options.AutoFormatAsYouTypeApplyTables = True

This example returns the status of the Tables option on the AutoFormat As You Type tab in the AutoCorrect dialog box (Tools menu).

VBA Copy code Copy code
Dim blnAutoFormat as Boolean

blnAutoFormat = Options.AutoFormatAsYouTypeApplyTables

See also

Concepts

Options Object

Other resources

Options Object Members


Options.AutoFormatAsYouTypeAutoLetterWizard Property (Word)

 Copy code hover
[image]

Options.AutoFormatAsYouTypeAutoLetterWizard Property (Word)
See also Send feedback

Published: July 16, 2012

True for Microsoft Word to automatically start the Letter Wizard when the user enters a letter salutation or closing. Read/write.

Syntax

expression .AutoFormatAsYouTypeAutoLetterWizard

expression Required. A variable that represents an Options collection.

Example

This example sets Microsoft Word to automatically start the Letter Wizard when the user enters a letter salutation or closing.

VBA Copy code Copy code
Sub AutoLeterWizard()
 Options.AutoFormatAsYouTypeAutoLetterWizard = True
End Sub

See also

Concepts

Options Object

Other resources

Options Object Members


Options.AutoFormatAsYouTypeDefineStyles Property (Word)

 Copy code hover
[image]

Options.AutoFormatAsYouTypeDefineStyles Property (Word)
See also Send feedback

Published: July 16, 2012

True if Word automatically creates new styles based on manual formatting. Read/write Boolean.

Syntax

expression .AutoFormatAsYouTypeDefineStyles

expression A variable that represents an Options collection.

Example

This example sets Word to automatically create styles as you type.

VBA Copy code Copy code
Options.AutoFormatAsYouTypeDefineStyles = True

This example returns the status of the Define styles based on your formatting option on the AutoFormat As You Type tab in the AutoCorrect dialog box (Tools menu).

VBA Copy code Copy code
Dim blnAutoFormat as Boolean

blnAutoFormat = Options.AutoFormatAsYouTypeDefineStyles

See also

Concepts

Options Object

Other resources

Options Object Members


Options.AutoFormatAsYouTypeDeleteAutoSpaces Property (Word)

 Copy code hover
[image]

Options.AutoFormatAsYouTypeDeleteAutoSpaces Property (Word)
See also Send feedback

Published: July 16, 2012

True for Microsoft Word to automatically delete spaces inserted between Japanese and Latin text as you type. Read/write.

Syntax

expression .AutoFormatAsYouTypeDeleteAutoSpaces

expression Required. A variable that represents an Options collection.

Example

This example sets Microsoft Word to automatically delete spaces inserted between Japanese and Latin text as you type.

VBA Copy code Copy code
Sub AutoDeleteSpaces()
 Options.AutoFormatAsYouTypeDeleteAutoSpaces = True
End Sub

See also

Concepts

Options Object

Other resources

Options Object Members


Options.AutoFormatAsYouTypeFormatListItemBeginning Property (Word)

 Copy code hover
[image]

Options.AutoFormatAsYouTypeFormatListItemBeginning Property (Word)
See also Send feedback

Published: July 16, 2012

True if Word repeats character formatting applied to the beginning of a list item to the next list item. Read/write Boolean.

Syntax

expression .AutoFormatAsYouTypeFormatListItemBeginning

expression A variable that represents an Options collection.

Example

This example sets Word to automatically repeat character formatting at the beginning of list items.

VBA Copy code Copy code
Options.AutoFormatAsYouTypeFormatListItemBeginning = True

This example returns the status of the Format beginning of list item like the one before it option in the AutoFormat As You Type tab in the AutoCorrect dialog box (Options menu).

VBA Copy code Copy code
Dim blnAutoFormat as Boolean

blnAutoFormat = _
 Options.AutoFormatAsYouTypeFormatListItemBeginning

See also

Concepts

Options Object

Other resources

Options Object Members


Options.AutoFormatAsYouTypeInsertClosings Property (Word)

 Copy code hover
[image]

Options.AutoFormatAsYouTypeInsertClosings Property (Word)
See also Send feedback

Published: July 16, 2012

True for Microsoft Word to automatically insert the corresponding memo closing when the user enters a memo heading. Read/write.

Syntax

expression .AutoFormatAsYouTypeInsertClosings

expression Required. A variable that represents an Options collection.

Example

This example sets Microsoft Word to automatically insert the corresponding memo closing when the user enters a memo heading.

VBA Copy code Copy code
Sub AutoInsertClosings()
 Options.AutoFormatAsYouTypeInsertClosings = True
End Sub

See also

Concepts

Options Object

Other resources

Options Object Members


Options.AutoFormatAsYouTypeInsertOvers Property (Word)

 Copy code hover
[image]

Options.AutoFormatAsYouTypeInsertOvers Property (Word)
See also Send feedback

Published: July 16, 2012

True for Microsoft Word to automatically insert "以上" when the user enters "記" or "案". Read/write Boolean.

Syntax

expression .AutoFormatAsYouTypeInsertOvers

expression Required. A variable that represents an Options collection.

Example

This example sets Microsoft Word to automatically insert "以上" when the user enters "記" or "案".

VBA Copy code Copy code
Options.AutoFormatAsYouTypeInsertOvers = True

See also

Concepts

Options Object

Other resources

Options Object Members


Options.AutoFormatAsYouTypeMatchParentheses Property (Word)

 Copy code hover
[image]

Options.AutoFormatAsYouTypeMatchParentheses Property (Word)
See also Send feedback

Published: July 16, 2012

True for Microsoft Word to automatically correct improperly paired parentheses. Read/write.

Syntax

expression .AutoFormatAsYouTypeMatchParentheses

expression Required. A variable that represents an Options collection.

Example

This example sets Microsoft Word to automatically correct improperly paired parentheses as you type.

VBA Copy code Copy code
Sub AutoMatchParentheses()
 Options.AutoFormatAsYouTypeMatchParentheses = True
End Sub

See also

Concepts

Options Object

Other resources

Options Object Members


Options.AutoFormatAsYouTypeReplaceFarEastDashes Property (Word)

 Copy code hover
[image]

Options.AutoFormatAsYouTypeReplaceFarEastDashes Property (Word)
See also Send feedback

Published: July 16, 2012

True for Microsoft Word to automatically correct long vowel sounds and dashes. Read/write.

Syntax

expression .AutoFormatAsYouTypeReplaceFarEastDashes

expression Required. A variable that represents an Options collection.

Example

This example sets Microsoft Word to automatically correct long vowel sounds and dashes as you type.

VBA Copy code Copy code
Sub AutoFarEastDashes()
 Options.AutoFormatAsYouTypeReplaceFarEastDashes = True
End Sub

See also

Concepts

Options Object

Other resources

Options Object Members


Options.AutoFormatAsYouTypeReplaceFractions Property (Word)

 Copy code hover
[image]

Options.AutoFormatAsYouTypeReplaceFractions Property (Word)
See also Send feedback

Published: July 16, 2012

True if typed fractions are replaced with fractions from the current character set as you type. For example, "1/2" is replaced with "½." Read/write Boolean.

Syntax

expression .AutoFormatAsYouTypeReplaceFractions

expression A variable that represents an Options collection.

Example

This example turns off the automatic replacement of typed fractions.

VBA Copy code Copy code
Options.AutoFormatAsYouTypeReplaceFractions = False

This example returns the status of the Fractions (1/2) with fraction character (½) option on the AutoFormat As You Type tab in the AutoCorrect dialog box (Tools menu).

VBA Copy code Copy code
Dim blnAutoFormat as Boolean

blnAutoFormat = Options.AutoFormatAsYouTypeReplaceFractions

See also

Concepts

Options Object

Other resources

Options Object Members


Options.AutoFormatAsYouTypeReplaceHyperlinks Property (Word)

 Copy code hover
[image]

Options.AutoFormatAsYouTypeReplaceHyperlinks Property (Word)
See also Send feedback

Published: July 16, 2012

True if e-mail addresses, server and share names (also known as UNC paths), and Internet addresses (also known as URLs) are automatically changed to hyperlinks as you type. Read/write Boolean.

Syntax

expression .AutoFormatAsYouTypeReplaceHyperlinks

expression A variable that represents an Options collection.

Remarks

Word changes any text that looks like an e-mail address, UNC, or URL to a hyperlink. Word doesn't check the validity of the hyperlink.

Example

This example enables Word to automatically replace any Internet or network paths with hyperlinks when the paths are typed.

VBA Copy code Copy code
Options.AutoFormatAsYouTypeReplaceHyperlinks = True

This example returns the status of the Internet and network paths with hyperlinks option on the AutoFormat As You Type tab in the AutoCorrect dialog box (Tools menu).

VBA Copy code Copy code
Dim blnAutoFormat as Boolean

blnAutoFormat = Options.AutoFormatAsYouTypeReplaceHyperlinks

See also

Concepts

Options Object

Other resources

Options Object Members


Options.AutoFormatAsYouTypeReplaceOrdinals Property (Word)

 Copy code hover
[image]

Options.AutoFormatAsYouTypeReplaceOrdinals Property (Word)
See also Send feedback

Published: July 16, 2012

True if the ordinal number suffixes "st", "nd", "rd", and "th" are replaced with the same letters in superscript as you type. For example, "1st" is replaced with "1" followed by "st" formatted as superscript. Read/write Boolean.

Syntax

expression .AutoFormatAsYouTypeReplaceOrdinals

expression A variable that represents an Options collection.

Example

This example turns on the automatic replacement of ordinals with superscript letters.

VBA Copy code Copy code
Options.AutoFormatAsYouTypeReplaceOrdinals = True

This example returns the status of the Ordinals (1st) with superscript option on the AutoFormat As You Type tab in the AutoCorrect dialog box (Tools menu).

VBA Copy code Copy code
Dim blnAutoFormat as Boolean

blnAutoFormat = Options.AutoFormatAsYouTypeReplaceOrdinals

See also

Concepts

Options Object

Other resources

Options Object Members


Options.AutoFormatAsYouTypeReplacePlainTextEmphasis Property (Word)

 Copy code hover
[image]

Options.AutoFormatAsYouTypeReplacePlainTextEmphasis Property (Word)
See also Send feedback

Published: July 16, 2012

True if manual emphasis characters are automatically replaced with character formatting as you type. For example, "*bold*" is changed to "bold" and "_underline_" is changed to "underline." Read/write Boolean.

Syntax

expression .AutoFormatAsYouTypeReplacePlainTextEmphasis

expression A variable that represents an Options collection.

Example

This example turns on the replacement of manual emphasis characters with character formatting.

VBA Copy code Copy code
Options.AutoFormatAsYouTypeReplacePlainTextEmphasis = True

This example returns the status of the *Bold* and _underline_ with real formatting option on the AutoFormat As You Type tab in the AutoCorrect dialog box (Tools menu).

VBA Copy code Copy code
Dim blnAutoFormat as Boolean

blnAutoFormat = _
 Options.AutoFormatAsYouTypeReplacePlainTextEmphasis

See also

Concepts

Options Object

Other resources

Options Object Members


Options.AutoFormatAsYouTypeReplaceQuotes Property (Word)

 Copy code hover
[image]

Options.AutoFormatAsYouTypeReplaceQuotes Property (Word)
See also Send feedback

Published: July 16, 2012

True if straight quotation marks are automatically changed to smart (curly) quotation marks as you type. Read/write Boolean.

Syntax

expression .AutoFormatAsYouTypeReplaceQuotes

expression A variable that represents an Options collection.

Example

This example turns on the automatic replacement of straight quotation marks with smart (curly) quotation marks as you type.

VBA Copy code Copy code
Options.AutoFormatAsYouTypeReplaceQuotes = True

This example returns the status of the Straight quotes with smart quotes option on the AutoFormat As You Type tab in the AutoCorrect dialog box (Tools menu).

VBA Copy code Copy code
Dim blnAutoFormat as Boolean

blnAutoFormat = Options.AutoFormatReplaceQuotes

See also

Concepts

Options Object

Other resources

Options Object Members


Options.AutoFormatAsYouTypeReplaceSymbols Property (Word)

 Copy code hover
[image]

Options.AutoFormatAsYouTypeReplaceSymbols Property (Word)
See also Send feedback

Published: July 16, 2012

True if two consecutive hyphens (--) are replaced with an en dash (-) or an em dash (—) as you type. Read/write Boolean.If the hyphens are typed with leading and trailing spaces, Word replaces the hyphens with an en dash; if there are no trailing spaces, the hyphens are replaced with an em dash.

Syntax

expression .AutoFormatAsYouTypeReplaceSymbols

expression A variable that represents an Options collection.

Example

This example turns on the replacement of hyphens with symbols as you type.

VBA Copy code Copy code
Options.AutoFormatAsYouTypeReplaceSymbols = True

This example returns the status of the Symbol characters (--) with symbols (—) option on the AutoFormat As You Type tab in the AutoCorrect dialog box (Tools menu).

VBA Copy code Copy code
Dim blnAutoFormat as Boolean

blnAutoFormat = Options.AutoFormatAsYouTypeReplaceSymbols

See also

Concepts

Options Object

Other resources

Options Object Members


Options.AutoFormatDeleteAutoSpaces Property (Word)

 Copy code hover
[image]

Options.AutoFormatDeleteAutoSpaces Property (Word)
See also Send feedback

Published: July 16, 2012

True if spaces inserted between Japanese and Latin text will be deleted when Microsoft Word formats a document or range automatically. Read/write Boolean.

Syntax

expression .AutoFormatDeleteAutoSpaces

expression An expression that returns an Options object.

Example

This example sets Microsoft Word to automatically delete spaces between Japanese and Latin text, and then it formats the current selection.

VBA Copy code Copy code
Options.AutoFormatDeleteAutoSpaces = True
Selection.Range.AutoFormat

See also

Concepts

Options Object

Other resources

Options Object Members


Options.AutoFormatMatchParentheses Property (Word)

 Copy code hover
[image]

Options.AutoFormatMatchParentheses Property (Word)
See also Send feedback

Published: July 16, 2012

True if improperly paired parentheses are corrected when Microsoft Word formats a document or range automatically. Read/write Boolean.

Syntax

expression .AutoFormatMatchParentheses

expression An expression that returns an Options object.

Example

This example sets Microsoft Word to automatically correct pairs of parentheses, and then it formats the current selection.

VBA Copy code Copy code
Options.AutoFormatMatchParentheses = True
Selection.Range.AutoFormat

See also

Concepts

Options Object

Other resources

Options Object Members


Options.AutoFormatPlainTextWordMail Property (Word)

 Copy code hover
[image]

Options.AutoFormatPlainTextWordMail Property (Word)
See also Send feedback

Published: July 16, 2012

True if Word automatically formats plain-text e-mail messages when you open them in Word. Read/write Boolean.

Syntax

expression .AutoFormatPlainTextWordMail

expression A variable that represents an Options object.

Example

This example sets Word to automatically format any plain-text e-mail messages that are opened.

VBA Copy code Copy code
Options.AutoFormatPlainTextWordMail = True

This example returns the status of the Plain text WordMail documents option on the AutoFormat tab in the AutoCorrect dialog box (Tools menu).

VBA Copy code Copy code
Dim blnAutoFormat as Boolean

blnAutoFormat = Options.AutoFormatPlainTextWordMail

See also

Concepts

Options Object

Other resources

Options Object Members


Options.AutoFormatPreserveStyles Property (Word)

 Copy code hover
[image]

Options.AutoFormatPreserveStyles Property (Word)
See also Send feedback

Published: July 16, 2012

True if previously applied styles are preserved when Word formats a document or range automatically. Read/write Boolean.

Syntax

expression .AutoFormatPreserveStyles

expression A variable that represents an Options object.

Example

This example sets Word to preserve existing styles and to format headings, lists, and other paragraphs with styles when formatting automatically. Word then formats the current selection automatically.

VBA Copy code Copy code
With Options
 .AutoFormatPreserveStyles = True
 .AutoFormatApplyHeadings = True
 .AutoFormatApplyLists = True
 .AutoFormatApplyOtherParas = True
End With
Selection.Range.AutoFormat

This example returns the status of the Styles option on the AutoFormat tab in the AutoCorrect dialog box (Tools menu).

VBA Copy code Copy code
Dim blnAutoFormat as Boolean

blnAutoFormat = Options.AutoFormatPreserveStyles

See also

Concepts

Options Object

Other resources

Options Object Members


Options.AutoFormatReplaceFarEastDashes Property (Word)

 Copy code hover
[image]

Options.AutoFormatReplaceFarEastDashes Property (Word)
See also Send feedback

Published: July 16, 2012

True if long vowel sound and dash use is corrected when Microsoft Word formats a document or range automatically. Read/write Boolean.

Syntax

expression .AutoFormatReplaceFarEastDashes

expression An expression that returns an Options object.

Example

This example sets Microsoft Word to automatically correct the use of long vowel sounds and dashes, and then it formats the current selection.

VBA Copy code Copy code
Options.AutoFormatReplaceFarEastDashes = True
Selection.Range.AutoFormat

See also

Concepts

Options Object

Other resources

Options Object Members


Options.AutoFormatReplaceFractions Property (Word)

 Copy code hover
[image]

Options.AutoFormatReplaceFractions Property (Word)
See also Send feedback

Published: July 16, 2012

True if typed fractions are replaced with fractions from the current character set when Word formats a document or range automatically. For example, "1/2" is replaced with "½." Read/write Boolean.

Syntax

expression .AutoFormatReplaceFractions

expression A variable that represents an Options object.

Example

This example turns on the replacement of typed fractions, and thenit formats the current selection automatically.

VBA Copy code Copy code
Options.AutoFormatReplaceFractions = True
Selection.Range.AutoFormat

This example returns the status of the Fractions (1/2) with fraction character (½) option on the AutoFormat tab in the AutoCorrect dialog box (Tools menu).

VBA Copy code Copy code
Dim blnAutoFormat as Boolean

blnAutoFormat = Options.AutoFormatReplaceFractions

See also

Concepts

Options Object

Other resources

Options Object Members


Options.AutoFormatReplaceHyperlinks Property (Word)

 Copy code hover
[image]

Options.AutoFormatReplaceHyperlinks Property (Word)
See also Send feedback

Published: July 16, 2012

True if e-mail addresses, server and share names (also known as UNC paths), and Internet addresses (also known as URLs) are automatically formatted whenever Word AutoFormats a document or range. Read/write Boolean.

Syntax

expression .AutoFormatReplaceHyperlinks

expression A variable that represents an Options object.

Remarks

Word changes any text that looks like an e-mail address, UNC, or URL to a hyperlink. Word doesn't check the validity of the hyperlink.

Example

This example enables replacement of any Internet or network paths with hyperlinks, and then it formats the selection automatically.

VBA Copy code Copy code
Options.AutoFormatReplaceHyperlinks = True
Selection.Range.AutoFormat

This example returns the status of the Internet and network paths with hyperlinks option on the AutoFormat tab in the AutoCorrect dialog box (Tools menu).

VBA Copy code Copy code
Dim blnAutoFormat as Boolean

blnAutoFormat = Options.AutoFormatReplaceHyperlinks

See also

Concepts

Options Object

Other resources

Options Object Members


Options.AutoFormatReplaceOrdinals Property (Word)

 Copy code hover
[image]

Options.AutoFormatReplaceOrdinals Property (Word)
See also Send feedback

Published: July 16, 2012

True if the ordinal number suffixes "st", "nd", "rd", and "th" are replaced with the same letters in superscript when Word formats a document or range automatically. For example, "1st" is replaced with "1" followed by "st" formatted as superscript. Read/write Boolean.

Syntax

expression .AutoFormatReplaceOrdinals

expression A variable that represents an Options object.

Example

This example turns on the automatic replacement of ordinals with superscript, and then it formats the current selection automatically.

VBA Copy code Copy code
Options.AutoFormatReplaceOrdinals = True
Selection.Range.AutoFormat

This example returns the status of the Ordinals (1st) with superscript option on the AutoFormat tab in the AutoCorrect dialog box (Tools menu).

VBA Copy code Copy code
Dim blnAutoFormat as Boolean

blnAutoFormat = Options.AutoFormatReplaceOrdinals

See also

Concepts

Options Object

Other resources

Options Object Members


Options.AutoFormatReplacePlainTextEmphasis Property (Word)

 Copy code hover
[image]

Options.AutoFormatReplacePlainTextEmphasis Property (Word)
See also Send feedback

Published: July 16, 2012

True if manual emphasis characters are replaced with character formatting when Word formats a document or range automatically. For example, "*bold*" is changed to "bold" and "_underline_" is changed to "underline." Read/write Boolean.

Syntax

expression .AutoFormatReplacePlainTextEmphasis

expression A variable that represents an Options object.

Example

This example turns on the replacement of manual emphasis characters with character formatting

VBA Copy code Copy code
Options.AutoFormatReplacePlainTextEmphasis = True
Selection.Range.AutoFormat

This example returns the status of the *Bold* and _underline_ with real formatting option on the AutoFormat tab in the AutoCorrect dialog box (Tools menu).

VBA Copy code Copy code
Dim blnAutoFormat as Boolean

blnAutoFormat = Options.AutoFormatReplacePlainTextEmphasis

See also

Concepts

Options Object

Other resources

Options Object Members


Options.AutoFormatReplaceQuotes Property (Word)

 Copy code hover
[image]

Options.AutoFormatReplaceQuotes Property (Word)
See also Send feedback

Published: July 16, 2012

True if straight quotation marks are automatically changed to smart (curly) quotation marks when Word formats a document or range automatically. Read/write Boolean.

Syntax

expression .AutoFormatReplaceQuotes

expression A variable that represents an Options object.

Example

This example turns on the automatic replacement of straight quotation marks with smart (curly) quotation marks, and then it formats the current selection automatically.

VBA Copy code Copy code
Options.AutoFormatReplaceQuotes = True
Selection.Range.AutoFormat

This example returns the status of the Straight quotes with smart quotes option on the AutoFormat tab in the AutoCorrect dialog box (Tools menu).

VBA Copy code Copy code
Dim blnAutoFormat as Boolean

blnAutoFormat = Options.AutoFormatReplaceQuotes

See also

Concepts

Options Object

Other resources

Options Object Members


Options.AutoFormatReplaceSymbols Property (Word)

 Copy code hover
[image]

Options.AutoFormatReplaceSymbols Property (Word)
See also Send feedback

Published: July 16, 2012

True if two consecutive hyphens (--) are replaced by an en dash (-) or an em dash (—) when Word formats a document or range automatically. Read/write Boolean.

Syntax

expression .AutoFormatReplaceSymbols

expression A variable that represents an Options object.

Example

This example turns on the replacement of hyphens with symbols, and then it formats the current selection automatically.

VBA Copy code Copy code
Options.AutoFormatReplaceSymbols = True
Selection.Range.AutoFormat

This example returns the status of the Symbol characters (--) with symbols (—) option on the AutoFormat tab in the AutoCorrect dialog box (Tools menu).

VBA Copy code Copy code
Dim blnAutoFormat as Boolean

blnAutoFormat = Options.AutoFormatReplaceSymbols

See also

Concepts

Options Object

Other resources

Options Object Members


Options.AutoKeyboardSwitching Property (Word)

 Copy code hover
[image]

Options.AutoKeyboardSwitching Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word automatically switches the keyboard language to match what you're typing at any given time. Read/write Boolean.

Syntax

expression .AutoKeyboardSwitching

expression A variable that represents an Options object.

Remarks

To use this property, you must have the CheckLanguage property set to True.

Example

This example asks the user to choose whether or not to enable automatic keyboard switching for multilingual documents.

VBA Copy code Copy code
x = MsgBox("Enable automatic keyboard switching?", vbYesNo)
If x = vbYes Then
 Application.CheckLanguage = True
 Options.AutoKeyboardSwitching = True
 MsgBox "Automatic keyboard switching enabled!"
End If

See also

Concepts

Options Object

Other resources

Options Object Members


Options.AutoWordSelection Property (Word)

 Copy code hover
[image]

Options.AutoWordSelection Property (Word)
See also Send feedback

Published: July 16, 2012

True if dragging selects one word at a time instead of one character at a time. Read/write Boolean.

Syntax

expression .AutoWordSelection

expression A variable that represents an Options object.

Example

This example sets Word to select individual characters instead of entire words when you select by dragging.

VBA Copy code Copy code
Options.AutoWordSelection = False

This example returns the status of the When selecting, automatically select entire word option on the Edit tab in the Options dialog box.

VBA Copy code Copy code
Dim blnAutoSelect as Boolean

blnAutoSelect = Options.AutoWordSelection

See also

Concepts

Options Object

Other resources

Options Object Members


Options.BackgroundSave Property (Word)

 Copy code hover
[image]

Options.BackgroundSave Property (Word)
See also Send feedback

Published: July 16, 2012

True if Word saves documents in the background. When Word is saving in the background, users can continue to type and to choose commands. Read/write Boolean.

Syntax

expression .BackgroundSave

expression A variable that represents a Options object.

Example

This example allows users to continue working in a document while Word is saving it.

VBA Copy code Copy code
Options.BackgroundSave = True

This example returns the current status of the Allow background saves option on the Save tab in the Options dialog box.

VBA Copy code Copy code
Dim blnAutoSave As Boolean

blnAutoSave = Options.BackgroundSave

See also

Concepts

Options Object

Other resources

Options Object Members


Options.BibliographySort Property (Word)

 Copy code hover
[image]

Options.BibliographySort Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a String that represents the order in which to display sources in the Source Manager dialog box. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .BibliographySort

expression An expression that returns an Options object.

Remarks

Possible values for the BibliographySort property are Author, Title, Tag, or Year.

See also

Concepts

Options Object

Other resources

Options Object Members


Options.BibliographyStyle Property (Word)

 Copy code hover
[image]

Options.BibliographyStyle Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a String that represents the name of the style to use for formatting bibliographies. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .BibliographyStyle

expression An expression that returns an Options object.

See also

Concepts

Options Object

Other resources

Options Object Members


Options.BrazilReform Property (Word)

 Copy code hover
[image]

Options.BrazilReform Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the mode for the Brazilian Portuguese speller. Read/write WdPortugueseReform.

Version Information

Version Added: Word 2010

Syntax

expression .BrazilReform

expression An expression that returns an Options object.

Remarks

Setting this property has the same effect as selecting an item in the dropdown box next to Brazilian Portuguese modes: in the Word Options dialog (Proofing, When correcting spelling in Microsoft Office programs).

Note Note

This property does not set the mode for the European Portuguese speller. To set European Portuguese speller modes, use the Options.PortugalReform property.

See also

Concepts

Options Object

Other resources

Options Object Members


Options.ButtonFieldClicks Property (Word)

 Copy code hover
[image]

Options.ButtonFieldClicks Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the number of clicks (either one or two) required to run a GOTOBUTTON or MACROBUTTON field. Read/write Long.

Syntax

expression .ButtonFieldClicks

expression A variable that represents a Options object.

Example

This example sets the number of clicks required to run a MACROBUTTON or GOTOBUTTON field to one.

VBA Copy code Copy code
Options.ButtonFieldClicks = 1

See also

Concepts

Options Object

Other resources

Options Object Members


Options.CheckGrammarAsYouType Property (Word)

 Copy code hover
[image]

Options.CheckGrammarAsYouType Property (Word)
See also Send feedback

Published: July 16, 2012

True if Word checks grammar and marks errors automatically as you type. Read/write Boolean.

Syntax

expression .CheckGrammarAsYouType

expression A variable that represents a Options object.

Remarks

This property marks grammatical errors, but to see them on screen, you must set the ShowGrammaticalErrors property to True.

Example

This example sets Word to check for grammatical errors as you type and to display any errors found in the active document.

VBA Copy code Copy code
Options.CheckGrammarAsYouType = True
ActiveDocument.ShowGrammaticalErrors = True

This example returns the status of the Check grammar as you type option on the Spelling & Grammar tab in the Options dialog box (Tools menu).

VBA Copy code Copy code
Dim blnCheck As Boolean

blnCheck = Options.CheckGrammarAsYouType

See also

Concepts

Options Object

Other resources

Options Object Members


Options.CheckGrammarWithSpelling Property (Word)

 Copy code hover
[image]

Options.CheckGrammarWithSpelling Property (Word)
See also Send feedback

Published: July 16, 2012

True if Word checks grammar while checking spelling. Read/write Boolean.

Syntax

expression .CheckGrammarWithSpelling

expression A variable that represents a Options object.

Remarks

This property controls whether Word checks grammar when you check spelling by using the Spelling command (Tools menu).

To check spelling or grammar from a Visual Basic procedure, use the CheckSpelling method to check only spelling and use the CheckGrammar method to check both grammar and spelling.

Example

This example returns the status of the Check grammar with spelling option on the Spelling & Grammar tab in the Options dialog box. If the option is selected, the procedure checks both spelling and grammar for the active document; otherwise, only spelling is checked.

VBA Copy code Copy code
If Options.CheckGrammarWithSpelling = True Then
 ActiveDocument.CheckGrammar
Else
 ActiveDocument.CheckSpelling
End If

See also

Concepts

Options Object

Other resources

Options Object Members


Options.CheckHangulEndings Property (Word)

 Copy code hover
[image]

Options.CheckHangulEndings Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word automatically detects Hangul endings and ignores them during conversion from Hangul to Hanja. Read/write Boolean.

Syntax

expression .CheckHangulEndings

expression An expression that returns an Options object.

Remarks

If converting from Hanja to Hangul, this property is ignored.

Example

This example asks the user whether to set Microsoft Word to automatically detect Hangul endings and ignore them during conversion from Hangul to hanja.

VBA Copy code Copy code
x = MsgBox("Check Hangul endings during " _
 & "conversion from Hangul to Hanja?", vbYesNo)
If x = vbYes Then
 Options.CheckHangulEndings = True
Else
 Options.CheckHangulEndings = False
End If

See also

Concepts

Options Object

Other resources

Options Object Members


Options.CheckSpellingAsYouType Property (Word)

 Copy code hover
[image]

Options.CheckSpellingAsYouType Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word checks spelling and marks errors automatically as you type. Read/write Boolean.

Syntax

expression .CheckSpellingAsYouType

expression A variable that represents a Options object.

Remarks

This property marks spelling errors, but to see them on the screen, you must set the ShowSpellingErrors property to True.

Example

This example turns off automatic checking of spelling in Word.

VBA Copy code Copy code
Options.CheckSpellingAsYouType = False

This example sets Word to check for spelling errors as you type and to display any errors found in the active document.

VBA Copy code Copy code
Options.CheckSpellingAsYouType = True
ActiveDocument.ShowSpellingErrors = True

This example returns the status of the Check spelling as you type option on the Spelling & Grammar tab in the Options dialog box (Tools menu).

VBA Copy code Copy code
Dim blnCheck As Boolean

blnCheck = Options.CheckSpellingAsYouType

See also

Concepts

Options Object

Other resources

Options Object Members


Options.CommentsColor Property (Word)

 Copy code hover
[image]

Options.CommentsColor Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a WdColorIndex constant that represents the color of comments in a document. Read/write.

Syntax

expression .CommentsColor

expression Required. A variable that represents an Options collection.

Example

This example sets the global option for Microsoft Word to color comments made in documents according to the author of the comment.

VBA Copy code Copy code
Sub ColorCodeComments()
 Options.CommentsColor = wdByAuthor
End Sub

See also

Concepts

Options Object

Other resources

Options Object Members


Options.ConfirmConversions Property (Word)

 Copy code hover
[image]

Options.ConfirmConversions Property (Word)
See also Send feedback

Published: July 16, 2012

True if Word displays the Convert File dialog box before it opens or inserts a file that isn't a Word document or template. In the Convert File dialog box, the user chooses the format to convert the file from. Read/write Boolean.

Syntax

expression .ConfirmConversions

expression A variable that represents a Options object.

Example

This example sets Word to display the Convert File dialog box whenever a file that isn't a Word document or template is opened.

VBA Copy code Copy code
Options.ConfirmConversions = True

This example returns the current status of the Confirm conversion at Open option on the General tab in the Options dialog box.

VBA Copy code Copy code
Dim blnConfirm As Boolean

blnConfirm= Options.ConfirmConversions

See also

Concepts

Options Object

Other resources

Options Object Members


Options.ContextualSpeller Property (Word)

 Copy code hover
[image]

Options.ContextualSpeller Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents whether to use the contextual speller to check spelling based on the context of a word and the words around it. Read/write.

Syntax

expression .ContextualSpeller

expression An expression that returns an Options object.

Remarks

The contextual speller indentifies the structure of words and their location within a sentence to determine if spelling is correct. It can find errors that the standard spelling checker cannot find. For example, a user might type "superb owl" instead of "super bowl". Because both "superb" and "owl" are correctly spelled words, the standard spelling checker would not find an error. Based on the words in context of the sentence and the words around them, the contextual speller determines that the correct words are "super" and "bowl" and makes the change automatically.

This property corresponds to the Use contextual spelling check box in the Proofing tab of the Word Options dialog box.

See also

Concepts

Options Object

Other resources

Options Object Members


Options.ConvertHighAnsiToFarEast Property (Word)

 Copy code hover
[image]

Options.ConvertHighAnsiToFarEast Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word converts text that is associated with an East Asian font to the appropriate font when it opens a document. Read/write Boolean.

Syntax

expression .ConvertHighAnsiToFarEast

expression An expression that returns an Options object.

Example

This example sets Microsoft Word to convert text that is associated with an East Asian font to the appropriate font when it opens a document.

VBA Copy code Copy code
Options.ConvertHighAnsiToFarEast = True

See also

Concepts

Options Object

Other resources

Options Object Members


Options.CreateBackup Property (Word)

 Copy code hover
[image]

Options.CreateBackup Property (Word)
See also Send feedback

Published: July 16, 2012

True if Word creates a backup copy each time a document is saved. Read/write Boolean.

Syntax

expression .CreateBackup

expression A variable that represents a Options object.

Remarks

The CreateBackup and AllowFastSave properties cannot be set to True concurrently.

Example

This example sets Word to automatically create a backup copy, and then it saves the active document.

VBA Copy code Copy code
Options.CreateBackup = True
ActiveDocument.Save

This example returns the current status of the Always create backup copy option on the Save tab in the Options dialog box.

VBA Copy code Copy code
Dim blnBackup As Boolean

blnBackup = Options.CreateBackup

See also

Concepts

Options Object

Other resources

Options Object Members


Options.Creator Property (Word)

 Copy code hover
[image]

Options.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents an Options collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Options Object

Other resources

Options Object Members


Options.CtrlClickHyperlinkToOpen Property (Word)

 Copy code hover
[image]

Options.CtrlClickHyperlinkToOpen Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word requires holding down the CTRL key while clicking to open a hyperlink. Read/write Boolean.

Syntax

expression .CtrlClickHyperlinkToOpen

expression An expression that returns an Options object.

Example

This example disables the option that requires holding down the CTRL key while clicking hyperlinks to open them.

VBA Copy code Copy code
Sub ToggleHyperlinkOption()
 Options.CtrlClickHyperlinkToOpen = False
End Sub

See also

Concepts

Options Object

Other resources

Options Object Members


Options.CursorMovement Property (Word)

 Copy code hover
[image]

Options.CursorMovement Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets how the insertion point progresses within bidirectional text. Read/write WdCursorMovement.

Syntax

expression .CursorMovement

expression Required. A variable that represents an Options collection.

Example

This example sets the insertion point to progress to the next visually adjacent character as it moves through bidirectional text.

VBA Copy code Copy code
Options.CursorMovement = wdCursorMovementVisual

See also

Concepts

Options Object

Other resources

Options Object Members


Options.DefaultBorderColor Property (Word)

 Copy code hover
[image]

Options.DefaultBorderColor Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the default 24-bit color to use for new Border objects. Read/write.

Syntax

expression .DefaultBorderColor

expression Required. A variable that represents an Options collection.

Remarks

This property can be any valid WdColor constant or a value returned by Visual Basic's RGB function.

Example

This example sets the default color for new borders to teal.

VBA Copy code Copy code
Options.DefaultBorderColor = wdColorTeal

See also

Concepts

Options Object

Other resources

Options Object Members


Options.DefaultBorderColorIndex Property (Word)

 Copy code hover
[image]

Options.DefaultBorderColorIndex Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the default line color for borders. Read/write WdColorIndex.

Syntax

expression .DefaultBorderColorIndex

expression Required. A variable that represents an Options collection.

Example

This example changes the default line color and style for borders and then applies a border around the first paragraph in the active document.

VBA Copy code Copy code
ActiveDocument.Paragraphs(1).Borders.Enable = True
With Options
 .DefaultBorderColorIndex = wdRed
 .DefaultBorderLineStyle = wdLineStyleDouble
End With

See also

Concepts

Options Object

Other resources

Options Object Members


Options.DefaultBorderLineStyle Property (Word)

 Copy code hover
[image]

Options.DefaultBorderLineStyle Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the default border line style. Read/write WdLineStyle.

Syntax

expression .DefaultBorderLineStyle

expression Required. A variable that represents an Options collection.

Example

This example sets the default line style to double.

VBA Copy code Copy code
Options.DefaultBorderLineStyle = wdLineStyleDouble

This example returns the current default line style.

VBA Copy code Copy code
Dim lngTemp As Long

lngTemp= Options.DefaultBorderLineStyle

See also

Concepts

Options Object

Other resources

Options Object Members


Options.DefaultBorderLineWidth Property (Word)

 Copy code hover
[image]

Options.DefaultBorderLineWidth Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the default line width of borders. Read/write WdLineWidth.

Syntax

expression .DefaultBorderLineWidth

expression Required. A variable that represents an Options collection.

Example

This example changes the default line width of borders and then adds a border around each paragraph in the selection.

VBA Copy code Copy code
Options.DefaultBorderLineWidth = wdLineWidth050pt
Selection.Borders.Enable = True

See also

Concepts

Options Object

Other resources

Options Object Members


Options.DefaultEPostageApp Property (Word)

 Copy code hover
[image]

Options.DefaultEPostageApp Property (Word)
See also Send feedback

Published: July 16, 2012

Sets or returns a String that represents the path and file name of the default electronic postage application. Read/write.

Syntax

expression .DefaultEPostageApp

expression A variable that represents a Options object.

Example

This example specifies the path and file name for the default electronic postage application.

VBA Copy code Copy code
Sub DefaultEPostage()
 Application.Options.DefaultEPostageApp = "C:\MyApp\EPostage.exe"
End Sub

See also

Concepts

Options Object

Other resources

Options Object Members


Options.DefaultFilePath Property (Word)

 Copy code hover
[image]

Options.DefaultFilePath Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets default folders for items such as documents, templates, and graphics. Read/write String.

Syntax

expression .DefaultFilePath(Path)

expression Required. A variable that represents an Options collection.

Parameters

Name | Required/Optional | Data Type | Description
Path | Required | WdDefaultFilePath | The default folder to set.

Remarks

You can use an empty string ("") to remove the setting from the Windows registry. The new setting takes effect immediately.

Example

This example sets the default folder for Word documents.

VBA Copy code Copy code
Options.DefaultFilePath(wdDocumentsPath) = "C:\Documents"

This example returns the current default path for user templates (corresponds to the default path setting on the File Locations tab in the Options dialog box).

VBA Copy code Copy code
Dim strPath As String

strPath = Options.DefaultFilePath(wdUserTemplatesPath)

See also

Concepts

Options Object

Other resources

Options Object Members


Options.DefaultHighlightColorIndex Property (Word)

 Copy code hover
[image]

Options.DefaultHighlightColorIndex Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the color used to highlight text formatted with the Highlight button (Formatting toolbar). Read/write WdColorIndex.

Syntax

expression .DefaultHighlightColorIndex

expression Required. A variable that represents an Options collection.

Example

This example sets the default highlight color to bright green. The new color doesn't apply to any previously highlighted text.

VBA Copy code Copy code
Options.DefaultHighlightColorIndex = wdBrightGreen

This example returns the current default highlight color index.

VBA Copy code Copy code
Dim lngTemp As Long

lngTemp = Options.DefaultHighlightColorIndex

See also

Concepts

Options Object

Other resources

Options Object Members


Options.DefaultOpenFormat Property (Word)

 Copy code hover
[image]

Options.DefaultOpenFormat Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the default file converter used to open documents. Can be a number returned by the OpenFormat property, or one of the following WdOpenFormat constants.

Syntax

expression .DefaultOpenFormat

expression Required. A variable that represents an Options collection.

Example

This example sets the default converter for opening documents to the Word document format and then opens Forecast.doc.

VBA Copy code Copy code
Options.DefaultOpenFormat = wdOpenFormatDocument
Documents.Open FileName:="C:\Sales\Forecast.doc"

This example sets the default converter for opening documents to automatically determine the appropriate file converter to use when opening documents.

VBA Copy code Copy code
Options.DefaultOpenFormat = wdOpenFormatAuto

This example sets the default converter for opening documents to the WordPerfect 6.x format.

VBA Copy code Copy code
Options.DefaultOpenFormat = _
 FileConverters("WordPerfect6x").OpenFormat

See also

Concepts

Options Object

Other resources

Options Object Members


Options.DefaultTextEncoding Property (Word)

 Copy code hover
[image]

Options.DefaultTextEncoding Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets an MsoEncoding constant representing the code page, or character set, that Microsoft Word uses for all documents saved as encoded text files. Read/write.

Syntax

expression .DefaultTextEncoding

expression Required. A variable that represents an Options collection.

Remarks

Use the TextEncoding property to set the encoding for an individual document. To set encoding for HTML documents, use the Encoding property.

Example

This example sets the global text encoding to the Western code page. This means that Word will save all encoded text files using the Western code page.

VBA Copy code Copy code
Sub DefaultEncode()
 Application.Options.DefaultTextEncoding = msoEncodingWestern
End Sub

See also

Concepts

Options Object

Other resources

Options Object Members


Options.DefaultTray Property (Word)

 Copy code hover
[image]

Options.DefaultTray Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the default tray your printer uses to print documents. Read/write String.

Syntax

expression .DefaultTray

expression A variable that represents a Options object.

Remarks

When setting this property, you must specify a string found in the Default tray box on the Print tab in the Options dialog box. You can use the DefaultTrayID property and specify a WdPaperTray constant to set this same option.

Example

This example sets Word up to use the lower print tray.

VBA Copy code Copy code
Options.DefaultTray = "Lower tray"

This example returns the string found in the Default tray box on the Print tab in the Options dialog box.

VBA Copy code Copy code
Msgbox Options.DefaultTray

See also

Concepts

Options Object

Other resources

Options Object Members


Options.DefaultTrayID Property (Word)

 Copy code hover
[image]

Options.DefaultTrayID Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the default tray your printer uses to print documents. Read/write WdPaperTray.

Syntax

expression .DefaultTrayID

expression A variable that represents an Options collection.

Remarks

You can use the DefaultTray property with a string from the Default tray box on the Print tab in the Options dialog box to set this same option.

Example

This example sets Word to use the upper print tray, and then it prints the active document.

VBA Copy code Copy code
Options.DefaultTrayID = wdPrinterUpperBin
ActiveDocument.PrintOut

This example returns the current setting of the Default tray option on the Print tab in the Options dialog box.

VBA Copy code Copy code
Dim lngTray As Long

lngTray = Options.DefaultTrayID

See also

Concepts

Options Object

Other resources

Options Object Members


Options.DeletedCellColor Property (Word)

 Copy code hover
[image]

Options.DeletedCellColor Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a WdCellColor constant that represents the color for a deleted cell. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .DeletedCellColor

expression An expression that returns a Options object.

See also

Concepts

Options Object

Other resources

Options Object Members


Options.DeletedTextColor Property (Word)

 Copy code hover
[image]

Options.DeletedTextColor Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the color of text that is deleted while change tracking is enabled. Read/write WdColorIndex.

Syntax

expression .DeletedTextColor

expression Required. A variable that represents an Options collection.

Remarks

If the DeletedTextColor property is set to wdByAuthor, Word automatically assigns a unique color to each of the first eight authors who revise a document.

Example

This example sets the color of deleted text to bright green.

VBA Copy code Copy code
Options.DeletedTextColor = wdBrightGreen

This example returns the current status of the Color option under Deleted Text on the Track Changes tab in the Options dialog box.

VBA Copy code Copy code
Dim lngTemp As Long

lngTemp = Options.DeletedTextColor

See also

Concepts

Options Object

Other resources

Options Object Members


Options.DeletedTextMark Property (Word)

 Copy code hover
[image]

Options.DeletedTextMark Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the format of text that is deleted while change tracking is enabled. Read/write WdDeletedTextMark.

Syntax

expression .DeletedTextMark

expression Required. A variable that represents an Options collection.

Example

This example applies strikethrough formatting to deleted text.

VBA Copy code Copy code
Options.DeletedTextMark = wdDeletedTextMarkStrikeThrough

This example returns the current status of the Mark option under Deleted Text on the Track Changes tab in the Options dialog box.

VBA Copy code Copy code
Dim lngTemp As Long

lngTemp = Options.DeletedTextMark

See also

Concepts

Options Object

Other resources

Options Object Members


Options.DiacriticColorVal Property (Word)

 Copy code hover
[image]

Options.DiacriticColorVal Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the 24-bit color to be used for diacritics in a right-to-left language document. Read/write.

Syntax

expression .DiacriticColorVal

expression Required. A variable that represents an Options collection.

Remarks

This property can be any valid WdColor constant or a value returned by the Microsoft Visual Basic RGB function. The value of the UseDiffDiacColor property must be True to use this property.

Example

This example sets the color for diacritics to bright green.

VBA Copy code Copy code
If Options.UseDiffDiacColor = True Then _
 Options.DiacriticColorVal = wdColorBrightGreen

See also

Concepts

Options Object

Other resources

Options Object Members


Options.DisableFeaturesbyDefault Property (Word)

 Copy code hover
[image]

Options.DisableFeaturesbyDefault Property (Word)
See also Send feedback

Published: July 16, 2012

True for Microsoft Word to disable in all documents all features introduced after the version of Word specified in the DisableFeaturesIntroducedAfterbyDefault. The default value is False. Read/write Boolean.

Syntax

expression .DisableFeaturesbyDefault

expression A variable that represents a Options object.

Remarks

The DisableFeaturesByDefault property sets a global option for the application. If you want to disable features introduced after Word 97 for Windows for the document only, use the DisableFeatures property.

Example

This example disables all features introduced after Word for Windows 95, versions 7.0 and 7.0a, for all documents.

VBA Copy code Copy code
Sub FeaturesDisableByDefault()
 With Application.Options

 'Checks whether features are disabled
 If .DisableFeaturesbyDefault = True Then

 'If they are, disables all features after Word for Windows 95
 .DisableFeaturesIntroducedAfterbyDefault = wd70
 Else

 'If not, turns on the disable features option and disables
 'all features introduced after Word for Windows 95
 .DisableFeaturesbyDefault = True
 .DisableFeaturesIntroducedAfterbyDefault = wd70
 End If
 End With
End Sub

See also

Concepts

Options Object

Other resources

Options Object Members


Options.DisableFeaturesIntroducedAfterbyDefault Property (Word)

 Copy code hover
[image]

Options.DisableFeaturesIntroducedAfterbyDefault Property (Word)
See also Send feedback

Published: July 16, 2012

Disables all features introduced after a the specified version for all documents. Read/write WdDisableFeaturesIntroducedAfter.

Syntax

expression .DisableFeaturesIntroducedAfterbyDefault

expression Required. A variable that represents an Options collection.

Remarks

The DisableFeaturesByDefault property must be set to True prior to setting the DisableFeaturesIntroducedAfterByDefault property. Otherwise, the setting will not take effect and will remain at its default setting of Word 97 for Windows.

The DisableFeaturesIntroducedAfterByDefault property sets a global option for the application and affects all documents. If you want to disable features introduced after a specified version for a document only, use the DisableFeaturesIntroducedAfter property.

Example

This example disables all features introduced after Word for Windows 95, versions 7.0 and 7.0a, for all documents.

VBA Copy code Copy code
Sub FeaturesDisableByDefault()
 With Application.Options

 'Checks whether features are disabled
 If .DisableFeaturesbyDefault = True Then

 'If they are, disables all features after Word for Windows 95
 .DisableFeaturesIntroducedAfterbyDefault = wd70
 Else

 'If not, turns on the disable features option and disables
 'all features introduced after Word for Windows 95
 .DisableFeaturesbyDefault = True
 .DisableFeaturesIntroducedAfterbyDefault = wd70
 End If
 End With
End Sub

See also

Concepts

Options Object

Other resources

Options Object Members


Options.DisplayAlignmentGuides Property (Word)

 Copy code hover
[image]

Options.DisplayAlignmentGuides Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that specifies whether alignment guides are enabled in the user interface. Read-write.

Version information

Version Added: Word 2013

Syntax

expression .DisplayAlignmentGuides

expression A variable that represents an Options object.

Remarks

If DisplayAlignmentGuides is True, alignment guides are enabled. Setting DisplayAlignmentGuides to True corresponds to selecting Use Alignment Guides on the Align drop-down menu in the Arrange group on the Format contextual ribbon tab in the user interface.

Property value

BOOL

See also

Concepts

Options Object

Other resources

Options Members


Options.DisplayGridLines Property (Word)

 Copy code hover
[image]

Options.DisplayGridLines Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word displays the document grid. This property is the equivalent of the Gridlines command on the View menu. Read/write Boolean.

Syntax

expression .DisplayGridLines

expression A variable that represents a Options object.

Remarks

This property affects only the document grid. For table gridlines, use the TableGridlines property.

Example

This example switches between displaying and hiding the document grid in the active window.

VBA Copy code Copy code
Options.DisplayGridLines = Not Options.DisplayGridLines

See also

Concepts

Options Object

Other resources

Options Object Members


Options.DisplayPasteOptions Property (Word)

 Copy code hover
[image]

Options.DisplayPasteOptions Property (Word)
See also Send feedback

Published: July 16, 2012

True for Microsoft Word to display the Paste Options button, which displays directly under newly pasted text. Read/write Boolean.

Syntax

expression .DisplayPasteOptions

expression An expression that returns an Options object.

Example

This example enables the Paste Options button if the option has been disabled.

VBA Copy code Copy code
Sub ShowPasteOptionsButton()
 With Options
 If .DisplayPasteOptions = False Then
 .DisplayPasteOptions = True
 End If
 End With
End Sub

See also

Concepts

Options Object

Other resources

Options Object Members


Options.DocumentViewDirection Property (Word)

 Copy code hover
[image]

Options.DocumentViewDirection Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the alignment and reading order for the entire document. Read/write WdDocumentViewDirection.

Syntax

expression .DocumentViewDirection

expression Required. A variable that represents an Options collection.

Example

This example sets the alignment to right and the reading order to right-to-left for the entire document.

VBA Copy code Copy code
Options.DocumentViewDirection = wdDocumentViewRtl

See also

Concepts

Options Object

Other resources

Options Object Members


Options.DoNotPromptForConvert Property (Word)

 Copy code hover
[image]

Options.DoNotPromptForConvert Property (Word)
See also Send feedback

Published: July 16, 2012

Sets or returns a Boolean that represents whether to prompt a warning dialog when the Convert command is invoked for documents that are in compatibility mode. Read/write.

Syntax

expression .DoNotPromptForConvert

expression An expression that returns an Options object.

See also

Concepts

Options Object

Other resources

Options Object Members


Options.EnableHangulHanjaRecentOrdering Property (Word)

 Copy code hover
[image]

Options.EnableHangulHanjaRecentOrdering Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word displays the most recently used words at the top of the suggestions list during conversion between Hangul and Hanja. Read/write Boolean.

Syntax

expression .EnableHangulHanjaRecentOrdering

expression An expression that returns an Options object.

Example

This example asks the user whether to set Microsoft Word to display the most recently used words at the top of the suggestions list during conversion between Hangul and Hanja.

VBA Copy code Copy code
x = MsgBox("Display most recently used words " _
 & "at the top of the suggestions list?", vbYesNo)
If x = vbYes Then
 Options.EnableHangulHanjaRecentOrdering = True
Else
 Options.EnableHangulHanjaRecentOrdering = False
End If

See also

Concepts

Options Object

Other resources

Options Object Members


Options.EnableLegacyIMEMode Property (Word)

 Copy code hover
[image]

Options.EnableLegacyIMEMode Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets aBoolean that represents whether to enable legacy IME mode. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .EnableLegacyIMEMode

expression An expression that returns a Options object.

See also

Concepts

Options Object

Other resources

Options Object Members


Options.EnableLiveDrag Property (Word)

 Copy code hover
[image]

Options.EnableLiveDrag Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that is True if live drag is enabled. Read-write.

Version information

Version Added: Word 2013

Syntax

expression .EnableLiveDrag

expression A variable that represents a Options object.

Remarks

Setting EnableLiveDrag to True is the equivalent of selecting Update document content while dragging under User Interface options on the General tab of the Word Options dialog box. (Choose Options on the File tab.)

Property value

BOOL

See also

Concepts

Options Object

Other resources

Options Members


Options.EnableLivePreview Property (Word)

 Copy code hover
[image]

Options.EnableLivePreview Property (Word)
See also Send feedback

Published: July 16, 2012

Sets or returns a Boolean that represents whether to show or hide gallery previews that appear when using galleries that support previewing. True shows a preview in your document before applying the command. Read/write.

Syntax

expression .EnableLivePreview

expression An expression that returns an Options object.

Remarks

This property corresponds to the Enable Live Preview check box in the Word Options dialog box.

See also

Concepts

Options Object

Other resources

Options Object Members


Options.EnableMisusedWordsDictionary Property (Word)

 Copy code hover
[image]

Options.EnableMisusedWordsDictionary Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word checks for misused words when checking the spelling and grammar in a document. Read/write Boolean.

Syntax

expression .EnableMisusedWordsDictionary

expression A variable that represents a Options object.

Remarks

Word looks for the following when checking for misused words: incorrect usage of adjectives and adverbs, comparatives and superlatives, "like" as a conjunction, "nor" versus "or," "what" versus "which," "who" versus "whom," units of measurement, conjunctions, prepositions, and pronouns.

Example

This example sets Word to ignore misused words when checking spelling and grammar.

VBA Copy code Copy code
Options.EnableMisusedWordsDictionary = False

See also

Concepts

Options Object

Other resources

Options Object Members


Options.EnableProofingToolsAdvertisement Property (Word)

 Copy code hover
[image]

Options.EnableProofingToolsAdvertisement Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean value that, when True, specifies that users be notified when additional proofing tools are available for download. Read-write.

Version information

Version Added: Word 2013

Syntax

expression .EnableProofingToolsAdvertisement

expression A variable that represents a Options object.

Remarks

Setting EnableProofingToolsAdvertisement to True is the equivalent of selecting the Let me know when I should download additional proofing tools checkbox on the Language tab of the Word Options dialog box. (Choose Options on the File tab.)

Property value

BOOL

See also

Concepts

Options Object

Other resources

Options Members


Options.EnableSound Property (Word)

 Copy code hover
[image]

Options.EnableSound Property (Word)
See also Send feedback

Published: July 16, 2012

True if Word makes the computer respond with a sound whenever an error occurs. Read/write Boolean.

Syntax

expression .EnableSound

expression A variable that represents a Options object.

Example

This example sets the Provide feedback with sound option on the General tab in the Options dialog box, based on user input.

VBA Copy code Copy code
If MsgBox("Do you want Word to beep on errors?", 36) = vbYes Then
 Options.EnableSound = True
Else
 Options.EnableSound = False
End If

See also

Concepts

Options Object

Other resources

Options Object Members


Options.EnvelopeFeederInstalled Property (Word)

 Copy code hover
[image]

Options.EnvelopeFeederInstalled Property (Word)
See also Send feedback

Published: July 16, 2012

True if the current printer has a special feeder for envelopes. Read-only Boolean.

Syntax

expression .EnvelopeFeederInstalled

expression A variable that represents a Options object.

Example

This example prints the active document as an envelope, provided that there is an envelope feeder installed.

VBA Copy code Copy code
If Options.EnvelopeFeederInstalled = True Then
 ActiveDocument.Envelope.PrintOut _
 AddressFromLeft:=InchesToPoints(3), _
 AddressFromTop:=InchesToPoints(1.5)
Else
 Msgbox "No envelope feeder available."
End If

See also

Concepts

Options Object

Other resources

Options Object Members


Options.ExpandHeadingsOnOpen Property (Word)

 Copy code hover
[image]

Options.ExpandHeadingsOnOpen Property (Word)
See also Send feedback

Published: July 16, 2012

True to expand all headings in the document when the document opens. Read/write Boolean.

Version information

Version Added: Word 2013

Syntax

expression .ExpandHeadingsOnOpen

expression A variable that represents a Options object.

Property value

BOOL

See also

Concepts

Options Object

Other resources

Options Object Members


Options.FormatScanning Property (Word)

 Copy code hover
[image]

Options.FormatScanning Property (Word)
See also Send feedback

Published: July 16, 2012

True for Microsoft Word to keep track of all formatting in a document. Read/write Boolean.

Syntax

expression .FormatScanning

expression An expression that returns an Options object.

Remarks

Enabling the FormatScanning property allows you to identify all unique formatting in your document, so you can easily apply the same formatting to new text and quickly replace or modify all instances of a given formatting within a document.

Example

This example enables Word to keep track of formatting in documents but disables displaying a squiggly underline beneath text formatted similarly to other formatting that is used more frequently in a document.

VBA Copy code Copy code
Sub ShowFormatErrors()
 With Options
 .FormatScanning = True
 .ShowFormatError = False 'Disables displaying squiggly underline
 End With
End Sub

See also

Concepts

Options Object

Other resources

Options Object Members


Options.FrenchReform Property (Word)

 Copy code hover
[image]

Options.FrenchReform Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a WdFrenchSpellerconstant that represents which spelling dictionary to use for regions of text with language formatting set to French. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .FrenchReform

expression An expression that returns a Options object.

See also

Concepts

Options Object

Other resources

Options Object Members


Options.GridDistanceHorizontal Property (Word)

 Copy code hover
[image]

Options.GridDistanceHorizontal Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the amount of horizontal space between the invisible gridlines that Word uses when you draw, move, and resize AutoShapes or East Asian characters in new documents. Read/write Single.

Syntax

expression .GridDistanceHorizontal

expression A variable that represents an Options collection.

Example

This example sets the horizontal and vertical distance between gridlines and then enables the Snap objects to grid feature for a new document.

VBA Copy code Copy code
With Options
 .GridDistanceHorizontal = InchesToPoints(0.2)
 .GridDistanceVertical = InchesToPoints(0.2)
 .SnapToGrid = True
End With
Documents.Add

See also

Concepts

Options Object

Other resources

Options Object Members


Options.GridDistanceVertical Property (Word)

 Copy code hover
[image]

Options.GridDistanceVertical Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the amount of vertical space between the invisible gridlines that Word uses when you draw, move, and resize AutoShapes or East Asian characters in new documents. Read/write Single.

Syntax

expression .GridDistanceVertical

expression A variable that represents an Options collection.

Example

This example sets the horizontal and vertical distance between gridlines and then enables the Snap objects to grid feature for a new document.

VBA Copy code Copy code
With Options
 .GridDistanceHorizontal = InchesToPoints(0.2)
 .GridDistanceVertical = InchesToPoints(0.2)
 .SnapToGrid = True
End With
Documents.Add

See also

Concepts

Options Object

Other resources

Options Object Members


Options.GridOriginHorizontal Property (Word)

 Copy code hover
[image]

Options.GridOriginHorizontal Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the point, relative to the left edge of the page, where you want the invisible grid for drawing, moving, and resizing AutoShapes or East Asian characters to begin in new documents. Read/write Single.

Syntax

expression .GridOriginHorizontal

expression A variable that represents an Options collection.

Example

This example sets the horizontal and vertical point of origin for the grid, sets the horizontal and vertical distance between gridlines, and then enables the Snap objects to grid feature for a new document.

VBA Copy code Copy code
With Options
 .GridOriginHorizontal = InchesToPoints(1)
 .GridOriginVertical = InchesToPoints(2)
 .GridDistanceHorizontal = InchesToPoints(0.1)
 .GridDistanceVertical = InchesToPoints(0.1)
 .SnapToGrid = True
End With
Documents.Add

See also

Concepts

Options Object

Other resources

Options Object Members


Options.GridOriginVertical Property (Word)

 Copy code hover
[image]

Options.GridOriginVertical Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the point, relative to the top of the page, where you want the invisible grid for drawing, moving, and resizing AutoShapes or East Asian characters to begin in new documents. Read/write Single.

Syntax

expression .GridOriginVertical

expression A variable that represents an Options collection.

Example

This example sets the horizontal and vertical point of origin for the grid, sets the horizontal and vertical distance between gridlines, and then enables the Snap objects to grid feature for a new document.

VBA Copy code Copy code
With Options
 .GridOriginHorizontal = InchesToPoints(1)
 .GridOriginVertical = InchesToPoints(2)
 .GridDistanceHorizontal = InchesToPoints(0.2)
 .GridDistanceVertical = InchesToPoints(0.2)
 .SnapToGrid = True
End With
Documents.Add

See also

Concepts

Options Object

Other resources

Options Object Members


Options.HangulHanjaFastConversion Property (Word)

 Copy code hover
[image]

Options.HangulHanjaFastConversion Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word automatically converts a word with only one suggestion during conversion between Hangul and Hanja. Read/write Boolean.

Syntax

expression .HangulHanjaFastConversion

expression An expression that returns an Options object.

Example

This example asks the user whether to set Microsoft Word to use fast conversion during conversion between Hangul and Hanja.

VBA Copy code Copy code
x = MsgBox("Use fast conversion?", vbYesNo)
If x = vbYes Then
 Options.HangulHanjaFastConversion = True
Else
 Options.HangulHanjaFastConversion = False
End If

See also

Concepts

Options Object

Other resources

Options Object Members


Options.HebrewMode Property (Word)

 Copy code hover
[image]

Options.HebrewMode Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the mode for the Hebrew spelling checker. Read/write WdHebSpellStart.

Syntax

expression .HebrewMode

expression Required. A variable that represents an Options collection.

Example

This example sets the spelling checker to check spelling based on the conventional script required by the Hebrew Language Academy for writing text with diacritics.

VBA Copy code Copy code
Options.HebrewMode = wdFullScript

See also

Concepts

Options Object

Other resources

Options Object Members


Options.IgnoreInternetAndFileAddresses Property (Word)

 Copy code hover
[image]

Options.IgnoreInternetAndFileAddresses Property (Word)
See also Send feedback

Published: July 16, 2012

True if file name extensions, MS-DOS paths, e-mail addresses, server and share names (also known as UNC paths), and Internet addresses (also known as URLs) are ignored while checking spelling. Read/write Boolean.

Syntax

expression .IgnoreInternetAndFileAddresses

expression An expression that returns an Options object.

Example

This example sets Microsoft Word to ignore file names and Internet addresses, and then it checks spelling in the active document.

VBA Copy code Copy code
Options.IgnoreInternetAndFileAddresses = True
ActiveDocument.CheckSpelling

This example returns the current status of the Ignore Internet and file addresses option on the Spelling & Grammar tab in the Options dialog box.

VBA Copy code Copy code
Dim blnTemp As Boolean

blnTemp = Options.IgnoreInternetAndFileAddresses

See also

Concepts

Options Object

Other resources

Options Object Members


Options.IgnoreMixedDigits Property (Word)

 Copy code hover
[image]

Options.IgnoreMixedDigits Property (Word)
See also Send feedback

Published: July 16, 2012

True if words that contain numbers are ignored while checking spelling. Read/write Boolean.

Syntax

expression .IgnoreMixedDigits

expression An expression that returns an Options object.

Example

This example sets Microsoft Word to ignore words that contain numbers, and then it checks spelling in the active document.

VBA Copy code Copy code
Options.IgnoreMixedDigits = True
ActiveDocument.CheckSpelling

This example returns the current status of the Ignore words with numbers option on the Spelling & Grammar tab in the Options dialog box.

VBA Copy code Copy code
Dim blnTemp As Boolean

blnTemp = Options.IgnoreMixedDigits

See also

Concepts

Options Object

Other resources

Options Object Members


Options.IgnoreUppercase Property (Word)

 Copy code hover
[image]

Options.IgnoreUppercase Property (Word)
See also Send feedback

Published: July 16, 2012

True if words in all uppercase letters are ignored while checking spelling. Read/write Boolean.

Syntax

expression .IgnoreUppercase

expression An expression that returns an Options object.

Example

This example sets Word to ignore words in all uppercase letters, and then it checks spelling in the active document.

VBA Copy code Copy code
Options.IgnoreUppercase = True
ActiveDocument.CheckSpelling

This example returns the current status of the Ignore words in UPPERCASE option on the Spelling & Grammar tab in the Options dialog box.

VBA Copy code Copy code
Dim blnTemp As Boolean

blnTemp = Options.IgnoreUppercase

See also

Concepts

Options Object

Other resources

Options Object Members


Options.IMEAutomaticControl Property (Word)

 Copy code hover
[image]

Options.IMEAutomaticControl Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word is set to automatically open and close the Japanese Input Method Editor (IME). Read/write Boolean.

Syntax

expression .IMEAutomaticControl

expression An expression that returns an Options object.

Example

This example sets Microsoft Word to automatically open and close the Japanese Input Method Editor (IME).

VBA Copy code Copy code
Options.IMEAutomaticControl = True

See also

Concepts

Options Object

Other resources

Options Object Members


Options.InlineConversion Property (Word)

 Copy code hover
[image]

Options.InlineConversion Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word displays an unconfirmed character string in the Japanese Input Method Editor (IME) as an insertion between existing (confirmed) character strings. Read/write Boolean.

Syntax

expression .InlineConversion

expression An expression that returns an Options object.

Example

This example sets Microsoft Word to display an unconfirmed character string in the Japanese Input Method Editor (IME) as an insertion between existing (confirmed) character strings.

VBA Copy code Copy code
Options.InlineConversion = True

See also

Concepts

Options Object

Other resources

Options Object Members


Options.InsertedCellColor Property (Word)

 Copy code hover
[image]

Options.InsertedCellColor Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a WdCellColorconstant that represents the color for an inserted table cell. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .InsertedCellColor

expression An expression that returns a Options object.

See also

Concepts

Options Object

Other resources

Options Object Members


Options.InsertedTextColor Property (Word)

 Copy code hover
[image]

Options.InsertedTextColor Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the color of text that is inserted while change tracking is enabled. Read/write WdColorIndex.

Syntax

expression .InsertedTextColor

expression Required. A variable that represents an Options collection.

Remarks

If the InsertedTextColor property is set to wdByAuthor, Microsoft Word automatically assigns a unique color to each of the first eight authors who revise a document.

Example

This example sets the color of inserted text to dark red.

VBA Copy code Copy code
Options.InsertedTextColor = wdDarkRed

This example returns the current status of the Color option under Track Changes options on the Track Changes tab in the Options dialog box.

VBA Copy code Copy code
Dim lngColor As Long

lngColor = Options.InsertedTextColor

See also

Concepts

Options Object

Other resources

Options Object Members


Options.InsertedTextMark Property (Word)

 Copy code hover
[image]

Options.InsertedTextMark Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets how Microsoft Word formats inserted text while change tracking is enabled (the TrackRevisions property is True). Read/write WdInsertedTextMark.

Syntax

expression .InsertedTextMark

expression Required. A variable that represents an Options collection.

Remarks

If change tracking is not enabled, this property is ignored. Use this property with the InsertedTextColor property to control the appearance of inserted text in a document.

The ShowRevisions property must be True to see the formatting for inserted text during editing. The PrintRevisions property must be True in order for Word to use the formatting for inserted text when printing a document.

Example

This example sets Word to italicize inserted text.

VBA Copy code Copy code
Options.InsertedTextMark = wdInsertedTextMarkItalic

This example sets Word to format inserted text as bold if it isn't already.

VBA Copy code Copy code
If Options.InsertedTextMark <> wdInsertedTextMarkBold Then
 Options.InsertedTextMark = wdInsertedTextMarkBold
Else
 MsgBox Prompt:="Inserted text is already bold!"
End If

See also

Concepts

Options Object

Other resources

Options Object Members


Options.INSKeyForOvertype Property (Word)

 Copy code hover
[image]

Options.INSKeyForOvertype Property (Word)
See also Send feedback

Published: July 16, 2012

True if the INS key can be used for switching Overtype on and off. Read/write Boolean.

Syntax

expression .INSKeyForOvertype

expression An expression that returns a Options object.

See also

Concepts

Options Object

Other resources

Options Object Members


Options.INSKeyForPaste Property (Word)

 Copy code hover
[image]

Options.INSKeyForPaste Property (Word)
See also Send feedback

Published: July 16, 2012

True if the INS key can be used for pasting the Clipboard contents. Read/write Boolean.

Syntax

expression .INSKeyForPaste

expression An expression that returns an Options object.

Example

This example enables the INS key to be used for pasting the contents of the Clipboard.

VBA Copy code Copy code
Options.INSKeyForPaste = True

This example returns the status of the Use the INS key for paste option on the Edit tab in the Options dialog box.

VBA Copy code Copy code
Dim blnTemp As Boolean

blnTemp = Options.INSKeyForPaste

See also

Concepts

Options Object

Other resources

Options Object Members


Options.InterpretHighAnsi Property (Word)

 Copy code hover
[image]

Options.InterpretHighAnsi Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the high-ANSI text interpretation behavior. Read/write WdHighAnsiText.

Syntax

expression .InterpretHighAnsi

expression Required. A variable that represents an Options collection.

Example

This example sets Word to interpret all high-ANSI text as East Asian characters.

VBA Copy code Copy code
Options.InterpretHighAnsi = wdHighAnsiIsFarEast

See also

Concepts

Options Object

Other resources

Options Object Members


Options.LocalNetworkFile Property (Word)

 Copy code hover
[image]

Options.LocalNetworkFile Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word creates a local copy of a file on the user's computer when editing a file stored on a network server. Read/write Boolean.

Syntax

expression .LocalNetworkFile

expression An expression that returns an Options object.

Example

This example instructs Word to not make a local copy of files stored on a server.

VBA Copy code Copy code
Sub LocalFile()
 Application.Options.LocalNetworkFile = False
End Sub

See also

Concepts

Options Object

Other resources

Options Object Members


Options.MapPaperSize Property (Word)

 Copy code hover
[image]

Options.MapPaperSize Property (Word)
See also Send feedback

Published: July 16, 2012

True if documents formatted for another country's/region's standard paper size (for example, A4) are automatically adjusted so that they're printed correctly on your country's/region's standard paper size (for example, Letter). Read/write Boolean.

Syntax

expression .MapPaperSize

expression An expression that returns an Options object.

Remarks

This property affects only the printout of your document; its formatting is left unchanged.

Example

This example allows Microsoft Word to adjust paper size according to the country/region setting.

VBA Copy code Copy code
Options.MapPaperSize = True

This example returns the status of the Allow A4/Letter paper resizing option on the Print tab in the Options dialog box (Tools menu).

VBA Copy code Copy code
temp = Options.MapPaperSize

See also

Concepts

Options Object

Other resources

Options Object Members


Options.MarginAlignmentGuides Property (Word)

 Copy code hover
[image]

Options.MarginAlignmentGuides Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that specifies whether margin alignment guides are displayed in the user interface. Read-write.

Version information

Version Added: Word 2013

Syntax

expression .MarginAlignmentGuides

expression A variable that represents an Options object.

Remarks

If MarginAlignmentGuides is set to True, margin alignment guides are displayed. Setting MarginAlignmentGuides to True corresponds to selecting Margin guides under Alignment Guides in the Grid and Guides dialog box. (Click Grid Settings on the Align drop-down menu in the Arrange group on the Format contextual ribbon tab in the user interface.) For the MarginAlignmentGuides setting to have any effect, DisplayAlignmentGuides must be set to True.

Property value

BOOL

See also

Concepts

Options Object

Other resources

Options Members


Options.MatchFuzzyAY Property (Word)

 Copy code hover
[image]

Options.MatchFuzzyAY Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word ignores the distinction between " [image] " and " [image] " following [image] -row and [image] -row characters during a search. Read/write Boolean.

Syntax

expression .MatchFuzzyAY

expression An expression that returns an Options object.

Example

This example sets Microsoft Word to ignore the distinction between " [image] " and " [image] " following [image] -row and [image] -row characters during a search.

VBA Copy code Copy code
Options.MatchFuzzyAY = True

See also

Concepts

Options Object

Other resources

Options Object Members


Options.MatchFuzzyBV Property (Word)

 Copy code hover
[image]

Options.MatchFuzzyBV Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word ignores the distinction between " [image] " and " [image] [image] " and between " [image] " and " [image] [image] " during a search. Read/write Boolean.

Syntax

expression .MatchFuzzyBV

expression An expression that returns an Options object.

Example

This example sets Microsoft Word to ignore the distinction between " [image] " and " [image] [image] " and between " [image] " and " [image] [image] " during a search.

VBA Copy code Copy code
Options.MatchFuzzyBV = True

See also

Concepts

Options Object

Other resources

Options Object Members


Options.MatchFuzzyByte Property (Word)

 Copy code hover
[image]

Options.MatchFuzzyByte Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word ignores the distinction between full-width and half-width characters (Latin or Japanese) during a search. Read/write Boolean.

Syntax

expression .MatchFuzzyByte

expression An expression that returns an Options object.

Example

This example sets Microsoft Word to ignore the distinction between full-width and half-width characters (Latin or Japanese) during a search.

VBA Copy code Copy code
Options.MatchFuzzyByte = True

See also

Concepts

Options Object

Other resources

Options Object Members


Options.MatchFuzzyCase Property (Word)

 Copy code hover
[image]

Options.MatchFuzzyCase Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word ignores the distinction between uppercase and lowercase letters during a search. Read/write Boolean.

Syntax

expression .MatchFuzzyCase

expression An expression that returns an Options object.

Example

This example sets Microsoft Word to ignore the distinction between uppercase and lowercase letters during a search.

VBA Copy code Copy code
Options.MatchFuzzyCase = True

See also

Concepts

Options Object

Other resources

Options Object Members


Options.MatchFuzzyDash Property (Word)

 Copy code hover
[image]

Options.MatchFuzzyDash Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word ignores the distinction between minus signs, long vowel sounds, and dashes during a search. Read/write Boolean.

Syntax

expression .MatchFuzzyDash

expression An expression that returns an Options object.

Example

This example sets Microsoft Word to ignore the distinction between minus signs, long vowel sounds, and dashes during a search.

VBA Copy code Copy code
Options.MatchFuzzyDash = True

See also

Concepts

Options Object

Other resources

Options Object Members


Options.MatchFuzzyDZ Property (Word)

 Copy code hover
[image]

Options.MatchFuzzyDZ Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word ignores the distinction between " [image] " and " [image] " and between " [image] " and " [image] " during a search. Read/write Boolean.

Syntax

expression .MatchFuzzyDZ

expression An expression that returns an Options object.

Example

This example sets Microsoft Word to ignore the distinction between " [image] " and " [image] " and between " [image] " and " [image] " during a search.

VBA Copy code Copy code
Options.MatchFuzzyDZ = True

See also

Concepts

Options Object

Other resources

Options Object Members


Options.MatchFuzzyHF Property (Word)

 Copy code hover
[image]

Options.MatchFuzzyHF Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word ignores the distinction between " [image] [image] " and " [image] [image] " and between " [image] [image] " and " [image] [image] " during a search. Read/write Boolean.

Syntax

expression .MatchFuzzyHF

expression An expression that returns an Options object.

Example

This example sets Microsoft Word to ignore the distinction between " [image] [image] " and " [image] [image] " and between " [image] [image] " and " [image] [image] " during a search.

VBA Copy code Copy code
Options.MatchFuzzyHF = True

See also

Concepts

Options Object

Other resources

Options Object Members


Options.MatchFuzzyHiragana Property (Word)

 Copy code hover
[image]

Options.MatchFuzzyHiragana Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word ignores the distinction between hiragana and katakana during a search. Read/write Boolean.

Syntax

expression .MatchFuzzyHiragana

expression An expression that returns an Options object.

Example

This example sets Microsoft Word to ignore the distinction between hiragana and katakana during a search.

VBA Copy code Copy code
Options.MatchFuzzyHiragana = True

See also

Concepts

Options Object

Other resources

Options Object Members


Options.MatchFuzzyIterationMark Property (Word)

 Copy code hover
[image]

Options.MatchFuzzyIterationMark Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word ignores the distinction between types of repetition marks during a search. Read/write Boolean.

Syntax

expression .MatchFuzzyIterationMark

expression An expression that returns an Options object.

Example

This example sets Microsoft Word to ignore the distinction between types of repetition marks during a search.

VBA Copy code Copy code
Options.MatchFuzzyIterationMark = True

See also

Concepts

Options Object

Other resources

Options Object Members


Options.MatchFuzzyKanji Property (Word)

 Copy code hover
[image]

Options.MatchFuzzyKanji Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word ignores the distinction between standard and nonstandard kanji ideography during a search. Read/write Boolean.

Syntax

expression .MatchFuzzyKanji

expression An expression that returns an Options object.

Example

This example sets Microsoft Word to ignore the distinction between standard and nonstandard Kanji ideography during a search.

VBA Copy code Copy code
Options.MatchFuzzyKanji = True

See also

Concepts

Options Object

Other resources

Options Object Members


Options.MatchFuzzyKiKu Property (Word)

 Copy code hover
[image]

Options.MatchFuzzyKiKu Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word ignores the distinction between " [image] " and " [image] " before [image] -row characters during a search. Read/write Boolean.

Syntax

expression .MatchFuzzyKiKu

expression An expression that returns an Options object.

Example

This example sets Microsoft Word to ignore the distinction between " [image] " and " [image] " before [image] -row characters during a search.

VBA Copy code Copy code
Options.MatchFuzzyKiKu = True

See also

Concepts

Options Object

Other resources

Options Object Members


Options.MatchFuzzyOldKana Property (Word)

 Copy code hover
[image]

Options.MatchFuzzyOldKana Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word ignores the distinction between new kana and old kana characters during a search. Read/write Boolean.

Syntax

expression .MatchFuzzyOldKana

expression An expression that returns an Options object.

Example

This example sets Microsoft Word to ignore the distinction between new kana and old kana characters during a search.

VBA Copy code Copy code
Options.MatchFuzzyOldKana = True

See also

Concepts

Options Object

Other resources

Options Object Members


Options.MatchFuzzyProlongedSoundMark Property (Word)

 Copy code hover
[image]

Options.MatchFuzzyProlongedSoundMark Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word ignores the distinction between short and long vowel sounds during a search. Read/write Boolean.

Syntax

expression .MatchFuzzyProlongedSoundMark

expression An expression that returns an Options object.

Example

This example sets Microsoft Word to ignore the distinction between short and long vowel sounds during a search.

VBA Copy code Copy code
Options.MatchFuzzyProlongedSoundMark = True

See also

Concepts

Options Object

Other resources

Options Object Members


Options.MatchFuzzyPunctuation Property (Word)

 Copy code hover
[image]

Options.MatchFuzzyPunctuation Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word ignores the distinction between types of punctuation marks during a search. Read/write Boolean.

Syntax

expression .MatchFuzzyPunctuation

expression An expression that returns an Options object.

Example

This example sets Microsoft Word to ignore the distinction between types of punctuation marks during a search

VBA Copy code Copy code
Options.MatchFuzzyPunctuation = True

See also

Concepts

Options Object

Other resources

Options Object Members


Options.MatchFuzzySmallKana Property (Word)

 Copy code hover
[image]

Options.MatchFuzzySmallKana Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word ignores the distinction between diphthongs and double consonants during a search. Read/write Boolean.

Syntax

expression .MatchFuzzySmallKana

expression An expression that returns an Options object.

Example

This example sets Microsoft Word to ignore the distinction between diphthongs and double consonants during a search.

VBA Copy code Copy code
Options.MatchFuzzySmallKana = True

See also

Concepts

Options Object

Other resources

Options Object Members


Options.MatchFuzzySpace Property (Word)

 Copy code hover
[image]

Options.MatchFuzzySpace Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word ignores the distinction between space markers used during a search. Read/write Boolean.

Syntax

expression .MatchFuzzySpace

expression An expression that returns an Options object.

Example

This example sets Microsoft Word to ignore the distinction between space markers used during a search.

VBA Copy code Copy code
Options.MatchFuzzySpace = True

See also

Concepts

Options Object

Other resources

Options Object Members


Options.MatchFuzzyTC Property (Word)

 Copy code hover
[image]

Options.MatchFuzzyTC Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word ignores the distinction between " [image] [image] ", " [image] [image] ", and " [image] ", and between " [image] [image] " and " [image] " during a search. Read/write Boolean.

Syntax

expression .MatchFuzzyTC

expression An expression that returns an Options object.

Example

This example sets Microsoft Word to ignore the distinction between " [image] [image] ", " [image] [image] ", and " [image] ", and between " [image] [image] " and " [image] " during a search.

VBA Copy code Copy code
Options.MatchFuzzyTC = True

See also

Concepts

Options Object

Other resources

Options Object Members


Options.MatchFuzzyZJ Property (Word)

 Copy code hover
[image]

Options.MatchFuzzyZJ Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word ignores the distinction between " [image] " and " [image] [image] " and between " [image] " and " [image] [image] " during a search. Read/write Boolean.

Syntax

expression .MatchFuzzyZJ

expression An expression that returns an Options object.

Example

This example sets Microsoft Word to ignore the distinction between " [image] " and " [image] [image] " and between " [image] " and " [image] [image] " during a search.

VBA Copy code Copy code
Options.MatchFuzzyZJ = True

See also

Concepts

Options Object

Other resources

Options Object Members


Options.MeasurementUnit Property (Word)

 Copy code hover
[image]

Options.MeasurementUnit Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the standard measurement unit for Microsoft Word. Read/write WdMeasurementUnits.

Syntax

expression .MeasurementUnit

expression Required. A variable that represents an Options collection.

Example

This example sets the standard measurement unit for Word to points.

VBA Copy code Copy code
Options.MeasurementUnit = wdPoints

This example returns the current measurement unit selected on the General tab in the Options dialog box (Tools menu).

VBA Copy code Copy code
CurrUnit = Options.MeasurementUnit

See also

Concepts

Options Object

Other resources

Options Object Members


Options.MergedCellColor Property (Word)

 Copy code hover
[image]

Options.MergedCellColor Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a WdCellColor constant that represents the color for merged table cells. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .MergedCellColor

expression An expression that returns a Options object.

Remarks

This property applies only to documents upon which you have run the CompareDocuments, Compare, or Merge method.

See also

Concepts

Options Object

Other resources

Options Object Members


Options.MonthNames Property (Word)

 Copy code hover
[image]

Options.MonthNames Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the direction for conversion between Hangul and Hanja. Read/write WdMonthNames.

Syntax

expression .MonthNames

expression Required. A variable that represents an Options collection.

Example

This example sets Microsoft Word to convert from Hangul to Hanja by default.

VBA Copy code Copy code
Options.MultipleWordConversionsMode = wdHangulToHanja

See also

Concepts

Options Object

Other resources

Options Object Members


Options.MoveFromTextColor Property (Word)

 Copy code hover
[image]

Options.MoveFromTextColor Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a WdColorIndex constant that represents the color of moved text. Read/write.

Syntax

expression .MoveFromTextColor

expression An expression that returns an Options object.

See also

Concepts

Options Object

Other resources

Options Object Members


Options.MoveFromTextMark Property (Word)

 Copy code hover
[image]

Options.MoveFromTextMark Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a WdMoveFromTextMark constant that represents the type of revision mark to use for moved text. Read/write.

Syntax

expression .MoveFromTextMark

expression An expression that returns an Options object.

See also

Concepts

Options Object

Other resources

Options Object Members


Options.MoveToTextColor Property (Word)

 Copy code hover
[image]

Options.MoveToTextColor Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a WdColorIndex constant that represents the color of moved text. Read/write.

Syntax

expression .MoveToTextColor

expression An expression that returns an Options object.

See also

Concepts

Options Object

Other resources

Options Object Members


Options.MoveToTextMark Property (Word)

 Copy code hover
[image]

Options.MoveToTextMark Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a WdMoveToTextMark constant that represents the type of revision mark to use for moved text. Read/write.

Syntax

expression .MoveToTextMark

expression An expression that returns an Options object.

See also

Concepts

Options Object

Other resources

Options Object Members


Options.MultipleWordConversionsMode Property (Word)

 Copy code hover
[image]

Options.MultipleWordConversionsMode Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the direction for conversion between Hangul and Hanja. Read/write WdMultipleWordConversionsMode.

Syntax

expression .MultipleWordConversionsMode

expression Required. A variable that represents an Options collection.

Example

This example sets Microsoft Word to convert from Hangul to Hanja by default.

VBA Copy code Copy code
Options.MultipleWordConversionsMode = wdHangulToHanja

See also

Concepts

Options Object

Other resources

Options Object Members


Options.OMathAutoBuildUp Property (Word)

 Copy code hover
[image]

Options.OMathAutoBuildUp Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents whether Microsoft Word automatically converts equations to professional format. True indicates that Word automatically converts equations to professional format. Read/write.

Syntax

expression .OMathAutoBuildUp

expression An expression that returns an Options object.

See also

Concepts

Options Object

Other resources

Options Object Members


Options.OMathCopyLF Property (Word)

 Copy code hover
[image]

Options.OMathCopyLF Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents how equations are represented in plain text. True indicates equations are represented in Linear Format. False indicates equations are represented in MathML. Read/write.

Syntax

expression .OMathCopyLF

expression An expression that returns an Options object.

See also

Concepts

Options Object

Other resources

Options Object Members


Options.OptimizeForWord97byDefault Property (Word)

 Copy code hover
[image]

Options.OptimizeForWord97byDefault Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word optimizes all new documents for viewing in Word 97 by disabling any incompatible formatting. Read/write Boolean.

Syntax

expression .OptimizeForWord97byDefault

expression A variable that represents a Options object.

Remarks

To optimize a single document for Word 97, use the OptimizeForWord97 property.

Example

This example sets Word to disable all formatting in new documents that's incompatible with Word 97, and then it creates a new document whose OptimizeForWord97 property is automatically set to True.

VBA Copy code Copy code
Options.OptimizeForWord97byDefault = True
MsgBox Documents.Add(DocumentType:=wdNewBlankDocument) _
 .OptimizeForWord97

See also

Concepts

Options Object

Other resources

Options Object Members


Options.Overtype Property (Word)

 Copy code hover
[image]

Options.Overtype Property (Word)
See also Send feedback

Published: July 16, 2012

True if Overtype mode is active. Read/write Boolean.

Syntax

expression .Overtype

expression An expression that returns an Options object.

Remarks

In Overtype mode, the characters you type replace existing characters one by one. When Overtype isn't active, the characters you type move existing text to the right.

Example

If Overtype mode is active, this example displays a message box asking whether Overtype should be deactivated. If the user clicks the Yes button, Overtype mode is made inactive.

VBA Copy code Copy code
If Options.Overtype = True Then
 aButton = MsgBox("Overtype is on. Turn off?", 4)
 If aButton = vbYes Then Options.Overtype = False
End If

See also

Concepts

Options Object

Other resources

Options Object Members


Options.PageAlignmentGuides Property (Word)

 Copy code hover
[image]

Options.PageAlignmentGuides Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that specifies whether page alignment guides are displayed in the user interface. Read-write.

Version information

Version Added: Word 2013

Syntax

expression .PageAlignmentGuides

expression A variable that represents an Options object.

Remarks

If PageAlignmentGuides is set to True, page alignment guides are displayed at the edges of the page. Setting PageAlignmentGuides to True corresponds to selecting Page guides under Alignment Guides in the Grid and Guides dialog box. (Click Grid Settings on the Align drop-down menu in the Arrange group on the Format contextual ribbon tab in the user interface.) For the PageAlignmentGuides setting to have any effect, DisplayAlignmentGuides must be set to True.

Property value

BOOL

See also

Concepts

Options Object

Other resources

Options Members


Options.Pagination Property (Word)

 Copy code hover
[image]

Options.Pagination Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word repaginates documents in the background. Read/write Boolean.

Syntax

expression .Pagination

expression An expression that returns a Options object.

Example

This example sets Word to perform background repagination.

VBA Copy code Copy code
Options.Pagination = True

This example returns the current status of the Background repagination option on the General tab in the Options dialog box (Tools menu).

VBA Copy code Copy code
temp = Options.Pagination

See also

Concepts

Options Object

Other resources

Options Object Members


Options.ParagraphAlignmentGuides Property (Word)

 Copy code hover
[image]

Options.ParagraphAlignmentGuides Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that specifies whether paragraph alignment guides are displayed in the user interface. Read-write.

Version information

Version Added: Word 2013

Syntax

expression .ParagraphAlignmentGuides

expression A variable that represents an Options object.

Remarks

If ParagraphAlignmentGuides is set to True, paragraph alignment guides are displayed. Setting ParagraphAlignmentGuides to True corresponds to selecting Paragraph guides under Alignment Guides in the Grid and Guides dialog box. (Click Grid Settings on the Align drop-down menu in the Arrange group on the Format contextual ribbon tab in the user interface.) For the ParagraphAlignmentGuides setting to have any effect, DisplayAlignmentGuides must be set to True.

Property value

BOOL

See also

Concepts

Options Object

Other resources

Options Members


Options.Parent Property (Word)

 Copy code hover
[image]

Options.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Options object.

Syntax

expression .Parent

expression Required. A variable that represents an Options collection.

See also

Concepts

Options Object

Other resources

Options Object Members


Options.PasteAdjustParagraphSpacing Property (Word)

 Copy code hover
[image]

Options.PasteAdjustParagraphSpacing Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word automatically adjusts the spacing of paragraphs when cutting and pasting selections. Read/write Boolean.

Syntax

expression .PasteAdjustParagraphSpacing

expression A variable that represents a Options object.

Example

This example sets Word to automatically adjust the spacing of paragraphs when cutting and pasting selections if the option has been disabled.

VBA Copy code Copy code
Sub AdjustParaSpace()
 With Options
 If .PasteAdjustParagraphSpacing = False Then
 .PasteAdjustParagraphSpacing = True
 End If
 End With
End Sub

See also

Concepts

Options Object

Other resources

Options Object Members


Options.PasteAdjustTableFormatting Property (Word)

 Copy code hover
[image]

Options.PasteAdjustTableFormatting Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word automatically adjusts the formatting of tables when cutting and pasting selections. Read/write Boolean.

Syntax

expression .PasteAdjustTableFormatting

expression A variable that represents a Options object.

Example

This example sets Word to automatically adjust the formatting of tables when cutting and pasting if the option has been disabled.

VBA Copy code Copy code
Sub AdjustTableFormatting()
 With Options
 If .PasteAdjustTableFormatting = False Then
 .PasteAdjustTableFormatting = True
 End If
 End With
End Sub

See also

Concepts

Options Object

Other resources

Options Object Members


Options.PasteAdjustWordSpacing Property (Word)

 Copy code hover
[image]

Options.PasteAdjustWordSpacing Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word automatically adjusts the spacing of words when cutting and pasting selections. Read/write Boolean.

Syntax

expression .PasteAdjustWordSpacing

expression A variable that represents a Options object.

Example

This example sets Word to automatically adjust the spacing of words when cutting and pasting selections if the option has been disabled.

VBA Copy code Copy code
Sub AdjustWordSpace()
 With Options
 If .PasteAdjustWordSpacing = False Then
 .PasteAdjustWordSpacing = True
 End If
 End With
End Sub

See also

Concepts

Options Object

Other resources

Options Object Members


Options.PasteFormatBetweenDocuments Property (Word)

 Copy code hover
[image]

Options.PasteFormatBetweenDocuments Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a WdPasteOptions constant that represents how text is pasted when text is copied from another Microsoft Office Word document. Read/write.

Syntax

expression .PasteFormatBetweenDocuments

expression An expression that returns an Options object.

Remarks

Corresponds to the Pasting between two documents (without styles) option in the Advanced tab of the Word Options dialog box.

See also

Concepts

Options Object

Other resources

Options Object Members


Options.PasteFormatBetweenStyledDocuments Property (Word)

 Copy code hover
[image]

Options.PasteFormatBetweenStyledDocuments Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a WdPasteOptions constant that represents how text is pasted when text is copied from a document that uses styles. Read/write.

Syntax

expression .PasteFormatBetweenStyledDocuments

expression An expression that returns an Options object.

Remarks

Corresponds to the Pasting between two documents (with styles) option in the Advanced tab of the Word Options dialog box.

See also

Concepts

Options Object

Other resources

Options Object Members


Options.PasteFormatFromExternalSource Property (Word)

 Copy code hover
[image]

Options.PasteFormatFromExternalSource Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a WdPasteOptions constant that represents how text is pasted when text is copied from an external source, such as a Web page. Read/write.

Syntax

expression .PasteFormatFromExternalSource

expression An expression that returns an Options object.

Remarks

Corresponds to the Pasting from other programs option in the Advanced tab of the Word Options dialog box.

See also

Concepts

Options Object

Other resources

Options Object Members


Options.PasteFormatWithinDocument Property (Word)

 Copy code hover
[image]

Options.PasteFormatWithinDocument Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a WdPasteOptions constant that represents how text is pasted when text is copied or cut and then pasted in the same document. Read/write.

Syntax

expression .PasteFormatWithinDocument

expression An expression that returns an Options object.

Remarks

Corresponds to the Pasting within the same document option in the Advanced tab of the Word Options dialog box.

See also

Concepts

Options Object

Other resources

Options Object Members


Options.PasteMergeFromPPT Property (Word)

 Copy code hover
[image]

Options.PasteMergeFromPPT Property (Word)
See also Send feedback

Published: July 16, 2012

True to merge text formatting when pasting from Microsoft PowerPoint. Read/write Boolean.

Syntax

expression .PasteMergeFromPPT

expression A variable that represents a Options object.

Example

This example sets Microsoft Word to automatically merge text formatting when pasting content from PowerPoint if the option has been disabled.

VBA Copy code Copy code
Sub AdjustPPTFormatting()
 With Options
 If .PasteMergeFromPPT = False Then
 .PasteMergeFromPPT = True
 End If
 End With
End Sub

See also

Concepts

Options Object

Other resources

Options Object Members


Options.PasteMergeFromXL Property (Word)

 Copy code hover
[image]

Options.PasteMergeFromXL Property (Word)
See also Send feedback

Published: July 16, 2012

True to merge table formatting when pasting from Microsoft Excel. Read/write Boolean.

Syntax

expression .PasteMergeFromXL

expression A variable that represents a Options object.

Example

This example sets Microsoft Word to automatically merge table formatting when pasting Excel tables if the option has been disabled.

VBA Copy code Copy code
Sub AdjustExcelFormatting()
 With Options
 If .PasteMergeFromXL = False Then
 .PasteMergeFromXL = True
 End If
 End With
End Sub

See also

Concepts

Options Object

Other resources

Options Object Members


Options.PasteMergeLists Property (Word)

 Copy code hover
[image]

Options.PasteMergeLists Property (Word)
See also Send feedback

Published: July 16, 2012

True to merge the formatting of pasted lists with surrounding lists. Read/write Boolean.

Syntax

expression .PasteMergeLists

expression A variable that represents a Options object.

Example

This example sets Microsoft Word to automatically merge list formatting with surrounding lists if the option has been disabled.

VBA Copy code Copy code
Sub UseSmartStyle()
 With Options
 If .PasteMergeLists = False Then
 .PasteMergeLists = True
 End If
 End With
End Sub

See also

Concepts

Options Object

Other resources

Options Object Members


Options.PasteOptionKeepBulletsAndNumbers Property (Word)

 Copy code hover
[image]

Options.PasteOptionKeepBulletsAndNumbers Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents whether to keep bullets and numbering when selecting Keep text only from the Paste Options context menu. Read/write.

Syntax

expression .PasteOptionKeepBulletsAndNumbers

expression An expression that returns an Options object.

Remarks

This property corresponds to the Keep bullets and numbers when pasting text with the Keep Text Only option check box in the Advanced tab of the Word Options dialog box.

See also

Concepts

Options Object

Other resources

Options Object Members


Options.PasteSmartCutPaste Property (Word)

 Copy code hover
[image]

Options.PasteSmartCutPaste Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word intelligently pastes selections into a document. Read/write Boolean.

Syntax

expression .PasteSmartCutPaste

expression A variable that represents a Options object.

Example

This example sets Word to enable intelligent selection pasting if the option has been disabled.

VBA Copy code Copy code
Sub EnableSmartCutPaste()
 If Options.PasteSmartCutPaste = False Then
 Options.PasteSmartCutPaste = True
 End If
End Sub

See also

Concepts

Options Object

Other resources

Options Object Members


Options.PasteSmartStyleBehavior Property (Word)

 Copy code hover
[image]

Options.PasteSmartStyleBehavior Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word intelligently merges styles when pasting a selection from a different document. Read/write Boolean.

Syntax

expression .PasteSmartStyleBehavior

expression A variable that represents a Options object.

Example

This example sets Word to intelligently paste styles in text selected from a different document if the option has been disabled.

VBA Copy code Copy code
Sub UseSmartStyle()
 With Options
 If .PasteSmartStyleBehavior = False Then
 .PasteSmartStyleBehavior = True
 End If
 End With
End Sub

See also

Concepts

Options Object

Other resources

Options Object Members


Options.PictureEditor Property (Word)

 Copy code hover
[image]

Options.PictureEditor Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the name of the application to use to edit pictures. Read/write String.

Syntax

expression .PictureEditor

expression An expression that returns an Options object.

Remarks

You must use the exact wording displayed in the Picture editor box on the Edit tab of the Options dialog box (Tools menu). Otherwise, the default setting "Microsoft Word" is used.

If the name of your graphics application doesn't appear in the list, contact the manufacturer of the graphics application for instructions.

Example

This example sets the application used to edit pictures.

VBA Copy code Copy code
Options.PictureEditor = "Microsoft Word"

This example returns the name of the application to use to edit pictures.

VBA Copy code Copy code
MsgBox Options.PictureEditor

See also

Concepts

Options Object

Other resources

Options Object Members


Options.PictureWrapType Property (Word)

 Copy code hover
[image]

Options.PictureWrapType Property (Word)
See also Send feedback

Published: July 16, 2012

Sets or returns a WdWrapTypeMerged that indicates how Microsoft Word wraps text around pictures. Read/write.

Syntax

expression .PictureWrapType

expression Required. A variable that represents an Options collection.

Remarks

This is a default option setting and affects all pictures inserted unless picture wrapping is individually defined for a picture.

Example

This example sets Word to insert and paste all pictures inline with the text if inline is not already specified.

VBA Copy code Copy code
Sub PicWrap()
 With Application.Options
 If .PictureWrapType <> wdWrapMergeInline Then
 .PictureWrapType = wdWrapMergeInline
 End If
 End With
End Sub

See also

Concepts

Options Object

Other resources

Options Object Members


Options.PortugalReform Property (Word)

 Copy code hover
[image]

Options.PortugalReform Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the mode for the European Portuguese speller. Read/write WdPortugueseReform.

Version Information

Version Added: Word 2010

Syntax

expression .PortugalReform

expression An expression that returns an Options object.

Remarks

Setting this property has the same effect as selecting an item in the dropdown box next to European Portuguese modes: in the Word Options dialog (Proofing, When correcting spelling in Microsoft Office programs).

Note Note

This property does not set the mode for the Brazilian Portuguese speller. To set Brazilian Portuguese speller modes, use the Options.BrazilReform property.

See also

Concepts

Options Object

Other resources

Options Object Members


Options.PrecisePositioning Property (Word)

 Copy code hover
[image]

Options.PrecisePositioning Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents whether Word optimizes character positioning for print layout rather than on-screen readability. True disables the default setting that compresses character spacing to facilitate on-screen readability and enables character spacing for print media. Read/write.

Syntax

expression .PrecisePositioning

expression An expression that returns a Options object.

See also

Concepts

Options Object

Other resources

Options Object Members


Options.PreferCloudSaveLocations Property (Word)

 Copy code hover
[image]

Options.PreferCloudSaveLocations Property (Word)
See also Send feedback

Published: July 16, 2012

True to save new documents in web locations by default. Read/write Boolean.

Version information

Version Added: Word 2013

Syntax

expression .PreferCloudSaveLocations

expression A variable that represents an Options object.

Remarks

The setting of the PreferCloudSaveLocations property is the reverse of that of the Save to Computer by default option on the Save tab of the Word Options dialog box (Choose Options on the File tab.)

Property value

BOOL

See also

Concepts

Options Object

Other resources

Options Object Members


Options.PrintBackground Property (Word)

 Copy code hover
[image]

Options.PrintBackground Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word prints in the background. Read/write Boolean.

Syntax

expression .PrintBackground

expression An expression that returns an Options object.

Example

This example sets Word to print documents in the background and then prints the active document.

VBA Copy code Copy code
Options.PrintBackground = True
ActiveDocument.PrintOut

This example returns the current status of the Background printing option on the Print tab in the Options dialog box (Tools menu).

VBA Copy code Copy code
temp = Options.PrintBackground

See also

Concepts

Options Object

Other resources

Options Object Members


Options.PrintBackgrounds Property (Word)

 Copy code hover
[image]

Options.PrintBackgrounds Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Boolean that represents whether background colors and images are printed when a document is printed.

Syntax

expression .PrintBackgrounds

expression An expression that returns an Options object.

Remarks

True indicates that background colors and images are printed. False indicates that background colors and images are not printed.

Example

The following example specifies that when documents are printed background colors and images will also be printed.

VBA Copy code Copy code
Options.PrintBackgrounds = True

See also

Concepts

Options Object

Other resources

Options Object Members


Options.PrintComments Property (Word)

 Copy code hover
[image]

Options.PrintComments Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word prints comments, starting on a new page at the end of the document. Read/write Boolean.

Syntax

expression .PrintComments

expression An expression that returns an Options object.

Remarks

Setting the PrintComments property to True automatically sets the PrintHiddenText property to True. However, setting the PrintComments property to False has no effect on the setting of the PrintHiddenText property.

Example

This example sets Word to print comments and then prints the active document.

VBA Copy code Copy code
Options.PrintComments = True
ActiveDocument.PrintOut

See also

Concepts

Options Object

Other resources

Options Object Members


Options.PrintDraft Property (Word)

 Copy code hover
[image]

Options.PrintDraft Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word prints using minimal formatting. Read/write Boolean.

Syntax

expression .PrintDraft

expression An expression that returns an Options object.

Remarks

Not all printers support draft printing.

Example

This example sets Word to use draft printing and then prints the active document.

VBA Copy code Copy code
Options.PrintDraft = True
ActiveDocument.PrintOut

This example returns the current status of the Draft output option on the Print tab in the Options dialog box (Tools menu).

VBA Copy code Copy code
temp = Options.PrintDraft

See also

Concepts

Options Object

Other resources

Options Object Members


Options.PrintDrawingObjects Property (Word)

 Copy code hover
[image]

Options.PrintDrawingObjects Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word prints drawing objects. Read/write Boolean.

Syntax

expression .PrintDrawingObjects

expression An expression that returns an Options object.

Example

This example sets Word to print drawing objects, and then it prints the active document.

VBA Copy code Copy code
Options.PrintDrawingObjects = True
ActiveDocument.PrintOut

This example returns the current status of the Drawing objects option on the Print tab in the Options dialog box (Tools menu).

VBA Copy code Copy code
temp = Options.PrintDrawingObjects

See also

Concepts

Options Object

Other resources

Options Object Members


Options.PrintEvenPagesInAscendingOrder Property (Word)

 Copy code hover
[image]

Options.PrintEvenPagesInAscendingOrder Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word prints even pages in ascending order during manual duplex printing. Read/write Boolean.

Syntax

expression .PrintEvenPagesInAscendingOrder

expression An expression that returns an Options object.

Remarks

If the ManualDuplexPrint argument of the PrintOut method is False, this property is ignored.

Example

This example sets Word to print odd pages in ascending order and even pages in descending order during manual duplex printing, and then it prints the active document.

VBA Copy code Copy code
Options.PrintOddPagesInAscendingOrder = True
Options.PrintEvenPagesInAscendingOrder = False
ActiveDocument.PrintOut ManualDuplexPrint:=True

See also

Concepts

Options Object

Other resources

Options Object Members


Options.PrintFieldCodes Property (Word)

 Copy code hover
[image]

Options.PrintFieldCodes Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word prints field codes instead of field results. Read/write Boolean.

Syntax

expression .PrintFieldCodes

expression An expression that returns an Options object.

Example

This example sets Word to print field codes, and then it prints the active document.

VBA Copy code Copy code
Options.PrintFieldCodes = True
ActiveDocument.PrintOut

This example returns the current status of the Field codes option on the Print tab in the Options dialog box (Tools menu).

VBA Copy code Copy code
temp = Options.PrintFieldCodes

See also

Concepts

Options Object

Other resources

Options Object Members


Options.PrintHiddenText Property (Word)

 Copy code hover
[image]

Options.PrintHiddenText Property (Word)
See also Send feedback

Published: July 16, 2012

True if hidden text is printed. Read/write Boolean.

Syntax

expression .PrintHiddenText

expression An expression that returns an Options object.

Remarks

Setting the PrintHiddenText property to False automatically sets the PrintComments property to False. However, setting the PrintHiddenText property to True has no effect on the setting of the PrintComments property.

Example

This example sets Word to print hidden text, and then it prints the active document.

VBA Copy code Copy code
Options.PrintHiddenText = True
ActiveDocument.PrintOut

This example returns the current status of the Hidden text option on the Print tab in the Options dialog box.

VBA Copy code Copy code
temp = Options.PrintHiddenText

See also

Concepts

Options Object

Other resources

Options Object Members


Options.PrintOddPagesInAscendingOrder Property (Word)

 Copy code hover
[image]

Options.PrintOddPagesInAscendingOrder Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word prints odd pages in ascending order during manual duplex printing. Read/write Boolean.

Syntax

expression .PrintOddPagesInAscendingOrder

expression An expression that returns an Options object.

Remarks

If the ManualDuplexPrint argument of the PrintOut method is False, this property is ignored.

Example

This example sets Microsoft Word to print odd pages in ascending order and even pages in descending order during manual duplex printing, and then it prints the active document.

VBA Copy code Copy code
Options.PrintOddPagesInAscendingOrder = True
Options.PrintEvenPagesInAscendingOrder = False
ActiveDocument.PrintOut ManualDuplexPrint:=True

See also

Concepts

Options Object

Other resources

Options Object Members


Options.PrintProperties Property (Word)

 Copy code hover
[image]

Options.PrintProperties Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word prints document summary information on a separate page at the end of the document. Read/write Boolean.

Syntax

expression .PrintProperties

expression An expression that returns an Options object.

Remarks

False if document summary information is not printed. Summary information is found in the Properties dialog box (File menu).

Example

This example sets Word to print document summary information on a separate page at the end of the document, and then it prints the active document.

VBA Copy code Copy code
Options.PrintProperties = True
ActiveDocument.PrintOut

This example returns the current status of the Document properties option on the Print tab in the Options dialog box (Tools menu).

VBA Copy code Copy code
temp = Options.PrintProperties

See also

Concepts

Options Object

Other resources

Options Object Members


Options.PrintReverse Property (Word)

 Copy code hover
[image]

Options.PrintReverse Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word prints pages in reverse order. Read/write Boolean.

Syntax

expression .PrintReverse

expression An expression that returns an Options object.

Example

This example sets Word to print pages in reverse order, and then it prints the active document.

VBA Copy code Copy code
Options.PrintReverse = True
ActiveDocument.PrintOut

This example returns the current status of the Reverse print order option on the Print tab in the Options dialog box (Tools menu).

VBA Copy code Copy code
temp = Options.PrintReverse

See also

Concepts

Options Object

Other resources

Options Object Members


Options.PrintXMLTag Property (Word)

 Copy code hover
[image]

Options.PrintXMLTag Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Boolean that represents whether to print the XML tags when printing a document. Corresponds to the XML tags check box on the Print tab in the Options dialog box. .

Syntax

expression .PrintXMLTag

expression An expression that returns an Options object.

Remarks

True indicates that tags are printed. False indicates tags are not printed.

Example

The following example specifies that when documents are printed tags will also be printed.

VBA Copy code Copy code
Options.PrintXMLTag = True

See also

Concepts

Options Object

Other resources

Options Object Members


Options.PromptUpdateStyle Property (Word)

 Copy code hover
[image]

Options.PromptUpdateStyle Property (Word)
See also Send feedback

Published: July 16, 2012

True displays a message asking the user to verify whether they want to reformat a style or reapply the original style formatting when changing the formatting of styles. Read/write Boolean.

Syntax

expression .PromptUpdateStyle

expression A variable that represents a Options object.

Remarks

False reapplies the style formatting to the selection without verifying whether the user wants to change the style.

Example

This example checks to see if a user receives a message when updating styles, and if not, enables it.

VBA Copy code Copy code
Sub UpdateStylePrompt()
 With Application.Options
 If .PromptUpdateStyle = False Then
 .PromptUpdateStyle = True
 End If
 End With
End Sub

See also

Concepts

Options Object

Other resources

Options Object Members


Options.RepeatWord Property (Word)

 Copy code hover
[image]

Options.RepeatWord Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents whether to mark words that are repeated when spelling is checked. True flags repeated words. Read/write.

Syntax

expression .RepeatWord

expression An expression that returns an Options object.

Remarks

This property corresponds to the Flag repeated words check box on the Proofing tab of the Word Options dialog box.

See also

Concepts

Options Object

Other resources

Options Object Members


Options.ReplaceSelection Property (Word)

 Copy code hover
[image]

Options.ReplaceSelection Property (Word)
See also Send feedback

Published: July 16, 2012

True if the result of typing or pasting replaces the selection. Read/write Boolean.

Syntax

expression .ReplaceSelection

expression An expression that returns an Options object.

Remarks

False if the result of typing or pasting is added before the selection, leaving the selection intact.

Example

This example sets Microsoft Word to add the result of typing or pasting before the selection, leaving the selection intact.

VBA Copy code Copy code
Options.ReplaceSelection = False

This example returns the status of the Typing replaces selection option on the Edit tab in the Options dialog box (Tools menu).

VBA Copy code Copy code
temp = Options.ReplaceSelection

See also

Concepts

Options Object

Other resources

Options Object Members


Options.RevisedLinesColor Property (Word)

 Copy code hover
[image]

Options.RevisedLinesColor Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the color of changed lines in a document with tracked changes. Read/write WdColorIndex.

Syntax

expression .RevisedLinesColor

expression Required. A variable that represents an Options collection.

Example

This example sets the color of changed lines to pink.

VBA Copy code Copy code
Options.RevisedLinesColor = wdPink

This example returns the current status of the Color option under Changed lines on the Track Changes tab in the Options dialog box (Tools menu).

VBA Copy code Copy code
temp = Options.RevisedLinesColor

See also

Concepts

Options Object

Other resources

Options Object Members


Options.RevisedLinesMark Property (Word)

 Copy code hover
[image]

Options.RevisedLinesMark Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the placement of changed lines in a document with tracked changes. Read/write WdRevisedLinesMark.

Syntax

expression .RevisedLinesMark

expression Required. A variable that represents an Options collection.

Example

This example sets changed lines to appear in the left margin of every page.

VBA Copy code Copy code
Options.RevisedLinesMark = wdRevisedLinesMarkLeftBorder

This example returns the current status of the Mark option under Changed lines on the Track Changes tab in the Options dialog box (Tools menu).

VBA Copy code Copy code
temp = Options.RevisedLinesMark

See also

Concepts

Options Object

Other resources

Options Object Members


Options.RevisedPropertiesColor Property (Word)

 Copy code hover
[image]

Options.RevisedPropertiesColor Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the color used to mark formatting changes while change tracking is enabled. Read/write WdColorIndex.

Syntax

expression .RevisedPropertiesColor

expression Required. A variable that represents an Options collection.

Remarks

If deleted or inserted text has formatting changes, the RevisedPropertiesColor property is overridden by the DeletedTextColor or InsertedTextColor property.

Example

This example tracks changes in the active document, sets the color of text with changed formatting to teal, and applies bold formatting to the selection.

VBA Copy code Copy code
ActiveDocument.TrackRevisions = True
Options.RevisedPropertiesColor = wdTeal
Selection.Font.Bold = True

This example returns the option selected in the Color box under Track Changes options on the Track Changes tab in the Options dialog box (Tools menu).

VBA Copy code Copy code
temp = Options.RevisedPropertiesColor

See also

Concepts

Options Object

Other resources

Options Object Members


Options.RevisedPropertiesMark Property (Word)

 Copy code hover
[image]

Options.RevisedPropertiesMark Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the mark used to show formatting changes while change tracking is enabled. Read/write WdRevisedPropertiesMark.

Syntax

expression .RevisedPropertiesMark

expression Required. A variable that represents an Options collection.

Example

This example causes text with changed formatting to be double-underlined when change tracking is enabled.

VBA Copy code Copy code
Options.RevisedPropertiesMark = _
 wdRevisedPropertiesMarkDoubleUnderline

This example returns the option selected in the Formatting box under Track Changes options on the Track Changes tab in the Options dialog box (Tools menu).

VBA Copy code Copy code
temp = Options.RevisedPropertiesMark

See also

Concepts

Options Object

Other resources

Options Object Members


Options.RevisionsBalloonPrintOrientation Property (Word)

 Copy code hover
[image]

Options.RevisionsBalloonPrintOrientation Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a WdRevisionsBalloonPrintOrientation constant that represents the direction of revision and comment balloons when they are printed. Read/write.

Syntax

expression .RevisionsBalloonPrintOrientation

expression Required. A variable that represents an Options collection.

Example

This example prints documents with comments in Landscape format with the revision and comment balloons on one side of the page and the document text on the other.

VBA Copy code Copy code
Sub PrintLandscapeCommentBalloons()
 Options.RevisionsBalloonPrintOrientation = _
 wdBalloonPrintOrientationForceLandscape
End Sub

See also

Concepts

Options Object

Other resources

Options Object Members


Options.RTFInClipboard Property (Word)

 Copy code hover
[image]

Options.RTFInClipboard Property (Word)
See also Send feedback

Published: July 16, 2012

You have requested Help for a Visual Basic keyword used only on the Macintosh. For information about the RTFInClipboard property for the Options object, consult the language reference Help included with Microsoft Office Macintosh Edition.

Property value

BOOL

See also

Concepts

Options Object

Other resources

Options Object Members


Options.SaveInterval Property (Word)

 Copy code hover
[image]

Options.SaveInterval Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the time interval in minutes for saving AutoRecover information. Read/write Long.

Syntax

expression .SaveInterval

expression An expression that returns an Options object.

Remarks

Set the SaveInterval property to 0 (zero) to turn off saving AutoRecover information.

Example

This example sets Word to save AutoRecover information for all open documents every five minutes.

VBA Copy code Copy code
Options.SaveInterval = 5

This example prevents Word from saving AutoRecover information.

VBA Copy code Copy code
Options.SaveInterval = 0

This example returns the current status of the Save AutoRecover info every option on the Save tab in the Options dialog box (Tools menu).

VBA Copy code Copy code
temp = Options.SaveInterval

See also

Concepts

Options Object

Other resources

Options Object Members


Options.SaveNormalPrompt Property (Word)

 Copy code hover
[image]

Options.SaveNormalPrompt Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word prompts the user for confirmation to save changes to the Normal template before it closes. Read/write Boolean.

Syntax

expression .SaveNormalPrompt

expression An expression that returns an Options object.

Remarks

False if Word automatically saves changes to the Normal template before it closes.

Example

This example sets Word to save the Normal template automatically before closing, and then it quits.

VBA Copy code Copy code
Options.SaveNormalPrompt = False
Application.Quit

This example returns the current status of the Prompt to save Normal template option on the Save tab in the Options dialog box (Tools menu).

VBA Copy code Copy code
temp = Options.SaveNormalPrompt

See also

Concepts

Options Object

Other resources

Options Object Members


Options.SavePropertiesPrompt Property (Word)

 Copy code hover
[image]

Options.SavePropertiesPrompt Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word prompts for document property information when saving a new document. Read/write Boolean.

Syntax

expression .SavePropertiesPrompt

expression An expression that returns an Options object.

Example

This example causes Word to prompt for document property information when saving a new document.

VBA Copy code Copy code
Options.SavePropertiesPrompt = True

This example returns the current status of the Prompt for document properties option on the Save tab in the Options dialog box (Tools menu).

VBA Copy code Copy code
temp = Options.SavePropertiesPrompt

See also

Concepts

Options Object

Other resources

Options Object Members


Options.SendMailAttach Property (Word)

 Copy code hover
[image]

Options.SendMailAttach Property (Word)
See also Send feedback

Published: July 16, 2012

True if the Send To command on the File menu inserts the active document as an attachment to a mail message. Read/write Boolean.

Syntax

expression .SendMailAttach

expression An expression that returns an Options object.

Remarks

False if the Send To command inserts the contents of the active document as text in a mail message.

Example

This example opens a new mail message that has the active document attached to it.

VBA Copy code Copy code
Options.SendMailAttach = True
ActiveDocument.SendMail

This example returns the state of the Mail as attachment option on the General tab of the Options dialog box.

VBA Copy code Copy code
Msgbox Options.SendMailAttach

See also

Concepts

Options Object

Other resources

Options Object Members


Options.SequenceCheck Property (Word)

 Copy code hover
[image]

Options.SequenceCheck Property (Word)
See also Send feedback

Published: July 16, 2012

True to check the sequence of independent characters for South Asian text. Read/write Boolean.

Syntax

expression .SequenceCheck

expression An expression that returns an Options object.

Example

This example enables sequence checking, allowing the user to type a valid sequence of independent characters to form valid character cells in South Asian text.

VBA Copy code Copy code
Sub CheckSequence()
 Options.SequenceCheck = True
End Sub

See also

Concepts

Options Object

Other resources

Options Object Members


Options.ShortMenuNames Property (Word)

 Copy code hover
[image]

Options.ShortMenuNames Property (Word)
See also Send feedback

Published: July 16, 2012

You have requested Help for a Visual Basic keyword used only on the Macintosh. For information about the ShortMenuNames property for the Options object, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Options Object

Other resources

Options Object Members


Options.ShowControlCharacters Property (Word)

 Copy code hover
[image]

Options.ShowControlCharacters Property (Word)
See also Send feedback

Published: July 16, 2012

True if bidirectional control characters are visible in the current document. Read/write Boolean.

Syntax

expression .ShowControlCharacters

expression An expression that returns an Options object.

Example

This example hides bidirectional control characters in the current document.

VBA Copy code Copy code
Options.ShowControlCharacters = False

See also

Concepts

Options Object

Other resources

Options Object Members


Options.ShowDevTools Property (Word)

 Copy code hover
[image]

Options.ShowDevTools Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents whether the Developer tab is displayed in the ribbon. Read/write.

Syntax

expression .ShowDevTools

expression An expression that returns an Options object.

Remarks

This property corresponds to the Show Developer tab in the Ribbon check box in the Word Options dialog box.

See also

Concepts

Options Object

Other resources

Options Object Members


Options.ShowDiacritics Property (Word)

 Copy code hover
[image]

Options.ShowDiacritics Property (Word)
See also Send feedback

Published: July 16, 2012

True if diacritics are visible in a right-to-left language document. Read/write Boolean.

Syntax

expression .ShowDiacritics

expression An expression that returns an Options object.

Example

This example hides diacritics in the current document.

VBA Copy code Copy code
Options.ShowDiacritics = False

See also

Concepts

Options Object

Other resources

Options Object Members


Options.ShowFormatError Property (Word)

 Copy code hover
[image]

Options.ShowFormatError Property (Word)
See also Send feedback

Published: July 16, 2012

True for Microsoft Word to mark inconsistencies in formatting by placing a squiggly underline beneath text formatted similarly to other formatting that is used more frequently in a document. Read/write Boolean.

Syntax

expression .ShowFormatError

expression An expression that returns an Options object.

Example

This example enables Word to keep track of formatting in documents but does not display a squiggly underline beneath text.

VBA Copy code Copy code
Sub ShowFormatErrors()

 With Options
 .FormatScanning = True 'Enables keeping track of formatting
 .ShowFormatError = False
 End With

End Sub

See also

Concepts

Options Object

Other resources

Options Object Members


Options.ShowMarkupOpenSave Property (Word)

 Copy code hover
[image]

Options.ShowMarkupOpenSave Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents whether Microsoft Word displays hidden markup when opening or saving a file.

Syntax

expression .ShowMarkupOpenSave

expression An expression that returns an Options object.

Remarks

The ShowMarkupOpenSave property corresponds to the Make hidden markup visible when opening or saving option in the Security tab of the Options dialog box.

Example

The following example enables the Make hidden markup visible when opening or saving option.

VBA Copy code Copy code
Options.ShowMarkupOpenSave = True

See also

Concepts

Options Object

Other resources

Options Object Members


Options.ShowMenuFloaties Property (Word)

 Copy code hover
[image]

Options.ShowMenuFloaties Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents whether to display mini toolbars when the user right-clicks in the document window. Read/write.

Syntax

expression .ShowMenuFloaties

expression An expression that returns an Options object.

See also

Concepts

Options Object

Other resources

Options Object Members


Options.ShowReadabilityStatistics Property (Word)

 Copy code hover
[image]

Options.ShowReadabilityStatistics Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word displays a list of summary statistics, including measures of readability, when it has finished checking grammar. Read/write Boolean.

Syntax

expression .ShowReadabilityStatistics

expression An expression that returns an Options object.

Example

This example sets Word to show readability statistics, and then it checks the spelling and grammar in the active document.

VBA Copy code Copy code
Options.ShowReadabilityStatistics = True
ActiveDocument.CheckGrammar

This example returns the current status of the Show readability statistics option on the Spelling & Grammar tab in the Options dialog box (Tools menu).

VBA Copy code Copy code
temp = Options.ShowReadabilityStatistics

See also

Concepts

Options Object

Other resources

Options Object Members


Options.ShowSelectionFloaties Property (Word)

 Copy code hover
[image]

Options.ShowSelectionFloaties Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents whether mini toolbars display when a user selects text. Read/write.

Syntax

expression .ShowSelectionFloaties

expression An expression that returns an Options object.

Remarks

Corresponds with the Show MiniBar on selection check box in the Word Options dialog box.

See also

Concepts

Options Object

Other resources

Options Object Members


Options.SkyDriveSignInOption Property (Word)

 Copy code hover
[image]

Options.SkyDriveSignInOption Property (Word)
See also Send feedback

Published: July 16, 2012

True to give users the option to sign in to SkyDrive and other cloud locations. Read/write Boolean.

Version information

Version Added: Word 2013

Syntax

expression .SkyDriveSignInOption

expression A variable that represents a Options object.

Remarks

The setting of SkyDriveSignInOption corresponds to that of the Show additional places for saving, even if sign-in may be required option on the Save tab of the Word Options dialog box. (Choose Options on the File tab.)

Property value

BOOL

See also

Concepts

Options Object

Other resources

Options Object Members


Options.SmartCursoring Property (Word)

 Copy code hover
[image]

Options.SmartCursoring Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents whether smart cursoring is enabled. True enables smart cursoring.

Syntax

expression .SmartCursoring

expression An expression that returns an Options object.

Remarks

The SmartCursoring property corresponds to the Use Smart Cursoring option in the Edit tab of the Options dialog box, which is selected by default.

When the SmartCursoring property is True, scrolling in a document by using the PAGE DOWN key will move the cursor to the current page. If the SmartCursoring property is False, the cursor remains in the last edited position.

Example

The following example disables smart cursoring.

VBA Copy code Copy code
Options.SmartCursoring = False

See also

Concepts

Options Object

Other resources

Options Object Members


Options.SmartCutPaste Property (Word)

 Copy code hover
[image]

Options.SmartCutPaste Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word automatically adjusts the spacing between words and punctuation when cutting and pasting occurs. Read/write Boolean.

Syntax

expression .SmartCutPaste

expression An expression that returns an Options object.

Example

This example sets Word to automatically adjust the spacing between words and punctuation when cutting and pasting occurs, and then it deletes and pastes some text in a newly created document. If the SmartCutPaste property were set to False, the second and third words would run together.

VBA Copy code Copy code
Options.SmartCutPaste = True
Set myDoc = Documents.Add
With myDoc
 .Content.InsertAfter("The brown quick fox")
 .Words(2).Cut
 .Characters(10).Paste
End With

This example returns the status of the Smart cut and paste option on the Edit tab in the Options dialog box (Tools menu).

VBA Copy code Copy code
temp = Options.SmartCutPaste

See also

Concepts

Options Object

Other resources

Options Object Members


Options.SmartParaSelection Property (Word)

 Copy code hover
[image]

Options.SmartParaSelection Property (Word)
See also Send feedback

Published: July 16, 2012

True for Microsoft Word to include the paragraph mark in a selection when selecting most or all of a paragraph. Read/write Boolean.

Syntax

expression .SmartParaSelection

expression A variable that represents a Options object.

Example

This example disables smart paragraph selection.

VBA Copy code Copy code
Sub SetSmartParagraphSelection()
 Options.SmartParaSelection = False
End Sub

See also

Concepts

Options Object

Other resources

Options Object Members


Options.SnapToGrid Property (Word)

 Copy code hover
[image]

Options.SnapToGrid Property (Word)
See also Send feedback

Published: July 16, 2012

True if AutoShapes or East Asian characters are automatically aligned with an invisible grid when they are drawn, moved, or resized. Read/write Boolean.

Syntax

expression .SnapToGrid

expression A variable that represents an Options collection.

Remarks

You can temporarily override this setting by pressing ALT while drawing, moving, or resizing an AutoShape.

Example

This example sets Word so that AutoShapes are automatically aligned with the invisible grid in a new document.

VBA Copy code Copy code
Options.SnapToGrid = True
Documents.Add

This example returns the status of the Snap to grid option in the Snap to Grid dialog box.

VBA Copy code Copy code
Temp = Options.SnapToGrid

See also

Concepts

Options Object

Other resources

Options Object Members


Options.SnapToShapes Property (Word)

 Copy code hover
[image]

Options.SnapToShapes Property (Word)
See also Send feedback

Published: July 16, 2012

True if Word automatically aligns AutoShapes or East Asian characters with invisible gridlines that go through the vertical and horizontal edges of other AutoShapes or East Asian characters. Read/write Boolean.

Syntax

expression .SnapToShapes

expression A variable that represents an Options collection.

Remarks

This property creates additional invisible gridlines for each AutoShape. SnapToShapes works independently of the SnapToGrid property.

Example

This example sets Word to automatically align AutoShapes with invisible gridlines that go through the vertical and horizontal edges of other AutoShapes in a new document.

VBA Copy code Copy code
Options.SnapToShapes = True
Documents.Add

See also

Concepts

Options Object

Other resources

Options Object Members


Options.SpanishMode Property (Word)

 Copy code hover
[image]

Options.SpanishMode Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the mode for the Spanish speller. Read/write WdSpanishSpeller.

Version Information

Version Added: Word 2010

Syntax

expression .SpanishMode

expression An expression that returns an Options object.

Remarks

Setting this property has the same effect as selecting an option under Spanish modes: in the Word Options dialog (Proofing, When correcting spelling in Microsoft Office programs).

See also

Concepts

Options Object

Other resources

Options Object Members


Options.SplitCellColor Property (Word)

 Copy code hover
[image]

Options.SplitCellColor Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a WdCellColor that represents the color for split table cells. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .SplitCellColor

expression An expression that returns a Options object.

Remarks

This property applies only to documents upon which you have run the CompareDocuments, Compare, or Merge method.

See also

Concepts

Options Object

Other resources

Options Object Members


Options.StoreRSIDOnSave Property (Word)

 Copy code hover
[image]

Options.StoreRSIDOnSave Property (Word)
See also Send feedback

Published: July 16, 2012

True for Microsoft Word to assign a random number to changes in a document, each time a document is saved, to facilitate comparing and merging documents. Read/write Boolean.

Syntax

expression .StoreRSIDOnSave

expression A variable that represents a Options object.

Remarks

Word stores the random numbers in a table and updates the table after each save. The default for the StoreRSIDOnSave property is True. However, RSID information is not saved for HTML documents.

Use the RemovePersonalInformation property if you want to remove information related to authors and reviewers of a document.

Example

This example turns off storing a random number when saving documents.

VBA Copy code Copy code
Sub SaveRandomNumber()
 Application.Options.StoreRSIDOnSave = False
End Sub

See also

Concepts

Options Object

Other resources

Options Object Members


Options.StrictFinalYaa Property (Word)

 Copy code hover
[image]

Options.StrictFinalYaa Property (Word)
See also Send feedback

Published: July 16, 2012

True if the spelling checker uses spelling rules regarding Arabic words ending with the letter yaa. Read/write Boolean.

Syntax

expression .StrictFinalYaa

expression An expression that returns an Options object.

Example

This example sets the spelling checker to use spelling rules regarding Arabic words ending with the letter yaa.

VBA Copy code Copy code
Options.StrictFinalYaa = True

See also

Concepts

Options Object

Other resources

Options Object Members


Options.StrictInitialAlefHamza Property (Word)

 Copy code hover
[image]

Options.StrictInitialAlefHamza Property (Word)
See also Send feedback

Published: July 16, 2012

True if the spelling checker uses spelling rules regarding Arabic words beginning with an alef hamza. Read/write Boolean.

Syntax

expression .StrictInitialAlefHamza

expression An expression that returns an Options object.

Example

This example sets the spelling checker to use spelling rules regarding Arabic words beginning with an alef hamza.

VBA Copy code Copy code
Options.StrictInitialAlefHamza = True

See also

Concepts

Options Object

Other resources

Options Object Members


Options.StrictRussianE Property (Word)

 Copy code hover
[image]

Options.StrictRussianE Property (Word)
See also Send feedback

Published: July 16, 2012

True if the spelling checker uses spelling rules regarding Russian words that use the strict ë character. Read/write.

Version Information

Version Added: Word 2010

Syntax

expression .StrictRussianE

expression An expression that returns an Options object.

Remarks

Setting this property has the same effect as checking or unchecking the Russian: Enforce strict ë checkbox in the Word Options dialog (Proofing, When correcting spelling in Microsoft Office programs).

See also

Concepts

Options Object

Other resources

Options Object Members


Options.StrictTaaMarboota Property (Word)

 Copy code hover
[image]

Options.StrictTaaMarboota Property (Word)
See also Send feedback

Published: July 16, 2012

True if the spelling checker uses spelling rules to flag Arabic words ending with haa instead of taa marboota. Read/write.

Version Information

Version Added: Word 2010

Syntax

expression .StrictTaaMarboota

expression An expression that returns an Options object.

Remarks

Setting this property has the same effect as selecting or clearing the Enforce strict Taa Marboota check box in the Word Options dialog (Proofing, When correcting spelling in Microsoft Office programs).

See also

Concepts

Options Object

Other resources

Options Object Members


Options.SuggestFromMainDictionaryOnly Property (Word)

 Copy code hover
[image]

Options.SuggestFromMainDictionaryOnly Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word draws spelling suggestions from the main dictionary only. Read/write Boolean.

Syntax

expression .SuggestFromMainDictionaryOnly

expression An expression that returns an Options object.

Remarks

This property returns False if it draws spelling suggestions from the main dictionary and any custom dictionaries that have been added.

Example

This example sets Word to suggest words from the main dictionary only, and then it checks spelling in the active document.

VBA Copy code Copy code
Options.SuggestFromMainDictionaryOnly = True
ActiveDocument.CheckSpelling

This example returns the current status of the Suggest from main dictionary only option on the Spelling & Grammar tab in the Options dialog box (Tools menu).

VBA Copy code Copy code
temp = Options.SuggestFromMainDictionaryOnly

See also

Concepts

Options Object

Other resources

Options Object Members


Options.SuggestSpellingCorrections Property (Word)

 Copy code hover
[image]

Options.SuggestSpellingCorrections Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word always suggests alternative spellings for each misspelled word when checking spelling. Read/write Boolean.

Syntax

expression .SuggestSpellingCorrections

expression An expression that returns an Options object.

Example

This example sets Word to always suggest alternative spellings for misspelled words, and then it checks spelling in the active document.

VBA Copy code Copy code
Options.SuggestSpellingCorrections = True
ActiveDocument.CheckSpelling

This example returns the current status of the Always suggest corrections option on the Spelling & Grammar tab in the Options dialog box (Tools menu).

VBA Copy code Copy code
temp = Options.SuggestSpellingCorrections

See also

Concepts

Options Object

Other resources

Options Object Members


Options.TabIndentKey Property (Word)

 Copy code hover
[image]

Options.TabIndentKey Property (Word)
See also Send feedback

Published: July 16, 2012

True if the TAB and BACKSPACE keys can be used to increase and decrease, respectively, the left indent of paragraphs and if the BACKSPACE key can be used to change right-aligned paragraphs to centered paragraphs and centered paragraphs to left-aligned paragraphs. Read/write Boolean.

Syntax

expression .TabIndentKey

expression Required. A variable that represents an Options collection.

Example

This example sets Word so that the TAB and BACKSPACE keys set the left indent instead of inserting and deleting tabs.

VBA Copy code Copy code
Options.TabIndentKey = True

See also

Concepts

Options Object

Other resources

Options Object Members


Options.TypeNReplace Property (Word)

 Copy code hover
[image]

Options.TypeNReplace Property (Word)
See also Send feedback

Published: July 16, 2012

True for Microsoft Word to replace illegal South Asian characters. Read/write Boolean.

Syntax

expression .TypeNReplace

expression An expression that returns an Options object.

Example

This example instructs Word to replace illegal South Asian characters.

VBA Copy code Copy code
Sub TypeReplace()
 Application.Options.TypeNReplace = True
End Sub

See also

Concepts

Options Object

Other resources

Options Object Members


Options.UpdateFieldsAtPrint Property (Word)

 Copy code hover
[image]

Options.UpdateFieldsAtPrint Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word updates fields automatically before printing a document. Read/write Boolean.

Syntax

expression .UpdateFieldsAtPrint

expression An expression that returns an Options object.

Example

This example sets Word to update fields automatically before printing, and then it prints the active document.

VBA Copy code Copy code
Options.UpdateFieldsAtPrint = True
ActiveDocument.PrintOut

This example returns the current status of the Update fields option on the Print tab in the Options dialog box (Tools menu).

VBA Copy code Copy code
temp = Options.UpdateFieldsAtPrint

See also

Concepts

Options Object

Other resources

Options Object Members


Options.UpdateFieldsWithTrackedChangesAtPrint Property (Word)

 Copy code hover
[image]

Options.UpdateFieldsWithTrackedChangesAtPrint Property (Word)
See also Send feedback

Published: July 16, 2012

True if Word 2010 allows fields containing tracked changes to update before printing. Read/write.

Version Information

Version Added: Word 2010

Syntax

expression .UpdateFieldsWithTrackedChangesAtPrint

expression A variable that represents an Options object.

Remarks

Setting this property has the same effect as selecting or unselecting the check box next to Allow fields containing tracked changes to update before printing in the Word Options dialog (Advanced tab, Print) in Word 2010.

See also

Concepts

Options Object

Other resources

Options Object Members


Options.UpdateLinksAtOpen Property (Word)

 Copy code hover
[image]

Options.UpdateLinksAtOpen Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word automatically updates all embedded OLE links in a document when it is opened. Read/write Boolean.

Syntax

expression .UpdateLinksAtOpen

expression An expression that returns an Options object.

Example

This example sets Word to update embedded OLE links when it opens files.

VBA Copy code Copy code
Options.UpdateLinksAtOpen = True

This example returns the current status of the Update automatic links at Open option on the General tab in the Options dialog box.

VBA Copy code Copy code
temp = Options.UpdateLinksAtOpen

See also

Concepts

Options Object

Other resources

Options Object Members


Options.UpdateLinksAtPrint Property (Word)

 Copy code hover
[image]

Options.UpdateLinksAtPrint Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word updates embedded links to other files before printing a document. Read/write Boolean.

Syntax

expression .UpdateLinksAtPrint

expression An expression that returns an Options object.

Example

This example sets Word to update embedded links automatically before printing, and then it prints the active document.

VBA Copy code Copy code
Options.UpdateLinksAtPrint = True
ActiveDocument.PrintOut

This example returns the current status of the Update links option on the Print tab in the Options dialog box (Tools menu).

VBA Copy code Copy code
temp = Options.UpdateLinksAtPrint

See also

Concepts

Options Object

Other resources

Options Object Members


Options.UpdateStyleListBehavior Property (Word)

 Copy code hover
[image]

Options.UpdateStyleListBehavior Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a WdUpdateStyleListBehavior constant that specifies the behavior Word 2010 should take when updating a style to match a selection that contains numbering or bullets. Read/write.

Version Information

Version Added: Word 2010

Syntax

expression .UpdateStyleListBehavior

expression An expression that returns a Options object.

Remarks

Setting this property has the same effect as selecting an item in the dropdown list in the Word 2010Options dialog (Advanced tab, Editing options, Updating style to match selection:.

See also

Concepts

Options Object

Other resources

Options Object Members


Options.UseCharacterUnit Property (Word)

 Copy code hover
[image]

Options.UseCharacterUnit Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word uses characters as the default measurement unit for the current document. Read/write Boolean.

Syntax

expression .UseCharacterUnit

expression An expression that returns an Options object.

Example

This example sets Word to use characters as the default measurement unit.

VBA Copy code Copy code
Options.UseCharacterUnit = True

See also

Concepts

Options Object

Other resources

Options Object Members


Options.UseDiffDiacColor Property (Word)

 Copy code hover
[image]

Options.UseDiffDiacColor Property (Word)
See also Send feedback

Published: July 16, 2012

True if you can set the color of diacritics in the current document. Read/write Boolean.

Syntax

expression .UseDiffDiacColor

expression An expression that returns an Options object.

Example

This example checks the UseDiffDiacColor property before setting the color of diacritics in the current selection.

VBA Copy code Copy code
If Options.UseDiffDiacColor = True Then _
 Selection.Font.DiacriticColor = wdColorBlue

See also

Concepts

Options Object

Other resources

Options Object Members


Options.UseGermanSpellingReform Property (Word)

 Copy code hover
[image]

Options.UseGermanSpellingReform Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word uses the German post-reform spelling rules when checking spelling. Read/write Boolean.

Syntax

expression .UseGermanSpellingReform

expression An expression that returns an Options object.

Remarks

This property may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.

Example

This example sets Word to use the post-reform rules for checking spelling in German.

VBA Copy code Copy code
Options.UseGermanSpellingReform = True

See also

Concepts

Options Object

Other resources

Options Object Members


Options.UseLocalUserInfo Property

 Copy code hover
[image]

Options.UseLocalUserInfo Property
See also Send feedback

Returns or sets a Boolean; True if Microsoft Word identifies the document author based upon the User name and Initials settings on the General tab of the Options dialog box, and False if Word identifies the author based on the account information with which the user signed in to Office. Read/write.

Version information

Version Added: Word 2013

Syntax

expression .UseLocalUserInfo

expression An expression that returns an Options object.

Remarks

Corresponds to setting of the Always use these values regardless of sign in to Office check box on the General tab of the Word Options dialog box.

See also

Concepts

Options Object

Other resources

Options Object Members


Options.UseNormalStyleForList Property (Word)

 Copy code hover
[image]

Options.UseNormalStyleForList Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents whether Microsoft Word uses the Normal style for bullets and numbering. Read/write.

Syntax

expression .UseNormalStyleForList

expression An expression that returns an Options object.

Remarks

Corresponds to the Use Normal style for bulleted and numbered lists check box in the Advanced tab of the Word Options dialog box.

See also

Concepts

Options Object

Other resources

Options Object Members


Options.UseSubPixelPositioning Property (Word)

 Copy code hover
[image]

Options.UseSubPixelPositioning Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that specifies whether sub-pixel positioning is enabled. Read-write.

Version information

Version Added: Word 2013

Syntax

expression .UseSubPixelPositioning

expression A variable that represents an Options object.

Remarks

The UseSubPixelPositioning value is True if sub-pixel positioning is enabled. This property setting corresponds to the setting of the Use subpixel positioning to smooth fonts on screen option on the Advanced tab of the Options dialog box (File tab) in the Microsoft Word 2013 user interface.

Property value

BOOL

See also

Concepts

Options Object

Other resources

Options Members


Options.VisualSelection Property (Word)

 Copy code hover
[image]

Options.VisualSelection Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the selection behavior based on visual cursor movement in a right-to-left language document. Read/write WdVisualSelection.

Syntax

expression .VisualSelection

expression Required. A variable that represents an Options collection.

Remarks

The CursorMovement property must be set to wdCursorMovementVisual to use this property.

Example

This example sets the selection behavior so that the selection wraps from line to line.

VBA Copy code Copy code
If Options.CursorMovement = wdCursorMovementVisual Then _
 Options.VisualSelection = wdVisualSelectionContinuous

See also

Concepts

Options Object

Other resources

Options Object Members


Options.WarnBeforeSavingPrintingSendingMarkup Property (Word)

 Copy code hover
[image]

Options.WarnBeforeSavingPrintingSendingMarkup Property (Word)
See also Send feedback

Published: July 16, 2012

True for Microsoft Word to display a warning when saving, printing, or sending as e-mail a document containing comments or tracked changes. Read/write Boolean.

Syntax

expression .WarnBeforeSavingPrintingSendingMarkup

expression An expression that returns a Options object.

Example

This example prints the active document but allows the user to stop the print if the document contains tracked changes or comments.

VBA Copy code Copy code
Sub SaferPrint
 Dim blnOldState as Boolean

 'Save old state in variable
 blnOldState = Application.Options.WarnBeforeSavingPrintingSendingMarkup

 'Turn on warning
 Application.Options.WarnBeforeSavingPrintingSendingMarkup = True

 'Print document
 ActiveDocument.PrintOut

 'Restore original warning state
 Application.Options.WarnBeforeSavingPrintingSendingMarkup = blnOldState

EndSub

See also

Concepts

Options Object

Other resources

Options Object Members


OtherCorrectionsException Object (Word)

 Copy code hover
[image]

OtherCorrectionsException Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a single AutoCorrect exception. The OtherCorrectionsException object is a member of the OtherCorrectionsExceptions collection.

Remarks

The OtherCorrectionsExceptions collection includes all words that Microsoft Word won't correct automatically. This list corresponds to the list of AutoCorrect exceptions on the Other Corrections tab in the AutoCorrect Exceptions dialog box.

Use OtherCorrectionsExceptions(Index), where Index is the AutoCorrect exception name or the index number, to return a single OtherCorrectionsException object. The following example deletes "WTop" from the list of AutoCorrect exceptions.

VBA Copy code Copy code
AutoCorrect.OtherCorrectionsExceptions("WTop").Delete

The index number represents the position of the AutoCorrect exception in the OtherCorrectionsExceptions collection. The following example displays the name of the first item in the OtherCorrectionsExceptions collection.

VBA Copy code Copy code
MsgBox AutoCorrect.OtherCorrectionsExceptions(1).Name

If the value of the OtherCorrectionsAutoAdd property is True, words are automatically added to the list of AutoCorrect exceptions. Use the Add method to add an item to the OtherCorrectionsExceptions collection. The following example adds "TipTop" to the list of AutoCorrect exceptions.

VBA Copy code Copy code
AutoCorrect.OtherCorrectionsExceptions.Add Name:="TipTop"

See also

Concepts

Word Object Model Reference

Other resources

OtherCorrectionsException Object Members


OtherCorrectionsException Members (Word)

 Copy code hover
[image]

OtherCorrectionsException Members (Word)
Send feedback

Published: July 16, 2012

Represents a single AutoCorrect exception. The OtherCorrectionsException object is a member of the OtherCorrectionsExceptions collection.

Methods

Name | Description
Delete | Deletes the specified exception.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Index | Returns a Long that represents the position of an item in a collection. Read-only.
Name | Returns the name of the specified object. Read-only String.
Parent | Returns an Object that represents the parent object of the specified OtherCorrectionsException object.


OtherCorrectionsException Properties (Word)

 Copy code hover
[image]

OtherCorrectionsException Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Index | Returns a Long that represents the position of an item in a collection. Read-only.
Name | Returns the name of the specified object. Read-only String.
Parent | Returns an Object that represents the parent object of the specified OtherCorrectionsException object.


OtherCorrectionsException.Application Property (Word)

 Copy code hover
[image]

OtherCorrectionsException.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents an OtherCorrectionsException object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

OtherCorrectionsException Object

Other resources

OtherCorrectionsException Object Members


OtherCorrectionsException.Creator Property (Word)

 Copy code hover
[image]

OtherCorrectionsException.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents an OtherCorrectionsException object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

OtherCorrectionsException Object

Other resources

OtherCorrectionsException Object Members


OtherCorrectionsException.Index Property (Word)

 Copy code hover
[image]

OtherCorrectionsException.Index Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the position of an item in a collection. Read-only.

Syntax

expression .Index

expression Required. A variable that represents an OtherCorrectionsException object.

See also

Concepts

OtherCorrectionsException Object

Other resources

OtherCorrectionsException Object Members


OtherCorrectionsException.Name Property (Word)

 Copy code hover
[image]

OtherCorrectionsException.Name Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the name of the specified object. Read-only String.

Syntax

expression .Name

expression Required. A variable that represents an OtherCorrectionsException object.

See also

Concepts

OtherCorrectionsException Object

Other resources

OtherCorrectionsException Object Members


OtherCorrectionsException.Parent Property (Word)

 Copy code hover
[image]

OtherCorrectionsException.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified OtherCorrectionsException object.

Syntax

expression .Parent

expression Required. A variable that represents an OtherCorrectionsException object.

See also

Concepts

OtherCorrectionsException Object

Other resources

OtherCorrectionsException Object Members


OtherCorrectionsException Methods (Word)

 Copy code hover
[image]

OtherCorrectionsException Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the specified exception.


OtherCorrectionsException.Delete Method (Word)

 Copy code hover
[image]

OtherCorrectionsException.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the specified exception.

Syntax

expression .Delete

expression Required. A variable that represents an OtherCorrectionsException object.

See also

Concepts

OtherCorrectionsException Object

Other resources

OtherCorrectionsException Object Members


OtherCorrectionsExceptions Object (Word)

 Copy code hover
[image]

OtherCorrectionsExceptions Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of OtherCorrectionsException objects that represents the list of words that Microsoft Word won't correct automatically.

Remarks

This list corresponds to the list of AutoCorrect exceptions on the Other Corrections tab in the AutoCorrect Exceptions dialog box.

Use the OtherCorrectionsExceptions property to return the OtherCorrectionsExceptions collection. The following example displays the items in this collection.

VBA Copy code Copy code
For Each aCap In AutoCorrect.OtherCorrectionsExceptions
 MsgBox aCap.Name
Next aCap

If the value of the OtherCorrectionsAutoAdd property is True, words are automatically added to the list of AutoCorrect exceptions. Use the Add method to add an item to the OtherCorrectionsExceptions collection. The following example adds "TipTop" to the list of AutoCorrect exceptions.

VBA Copy code Copy code
AutoCorrect.OtherCorrectionsExceptions.Add Name:="TipTop"

Use OtherCorrectionsExceptions(Index), where Index is the name or the index number, to return a single OtherCorrectionsException object. The following example deletes "WTop" from the list of AutoCorrect exceptions.

VBA Copy code Copy code
AutoCorrect.OtherCorrectionsExceptions("WTop").Delete

The index number represents the position of the AutoCorrect exception in the OtherCorrectionsExceptions collection. The following example displays the name of the first item in the OtherCorrectionsExceptions collection.

VBA Copy code Copy code
MsgBox AutoCorrect.OtherCorrectionsExceptions(1).Name

See also

Concepts

Word Object Model Reference

Other resources

OtherCorrectionsExceptions Object Members


OtherCorrectionsExceptions Members (Word)

 Copy code hover
[image]

OtherCorrectionsExceptions Members (Word)
Send feedback

Published: July 16, 2012

A collection of OtherCorrectionsException objects that represents the list of words that Microsoft Word won't correct automatically.

Methods

Name | Description
Add | Returns an OtherCorrectionsException object that represents a new exception added to the list of AutoCorrect exceptions.
Item | Returns an individual OtherCorrectionsException object in a collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of exceptions in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified OtherCorrectionsExceptions object.


OtherCorrectionsExceptions Properties (Word)

 Copy code hover
[image]

OtherCorrectionsExceptions Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of exceptions in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified OtherCorrectionsExceptions object.


OtherCorrectionsExceptions.Application Property (Word)

 Copy code hover
[image]

OtherCorrectionsExceptions.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents an OtherCorrectionsExceptions collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

OtherCorrectionsExceptions Collection Object

Other resources

OtherCorrectionsExceptions Object Members


OtherCorrectionsExceptions.Count Property (Word)

 Copy code hover
[image]

OtherCorrectionsExceptions.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of exceptions in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents an OtherCorrectionsExceptions collection.

See also

Concepts

OtherCorrectionsExceptions Collection Object

Other resources

OtherCorrectionsExceptions Object Members


OtherCorrectionsExceptions.Creator Property (Word)

 Copy code hover
[image]

OtherCorrectionsExceptions.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents an OtherCorrectionsExceptions collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

OtherCorrectionsExceptions Collection Object

Other resources

OtherCorrectionsExceptions Object Members


OtherCorrectionsExceptions.Parent Property (Word)

 Copy code hover
[image]

OtherCorrectionsExceptions.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified OtherCorrectionsExceptions object.

Syntax

expression .Parent

expression Required. A variable that represents an OtherCorrectionsExceptions collection.

See also

Concepts

OtherCorrectionsExceptions Collection Object

Other resources

OtherCorrectionsExceptions Object Members


OtherCorrectionsExceptions Methods (Word)

 Copy code hover
[image]

OtherCorrectionsExceptions Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Returns an OtherCorrectionsException object that represents a new exception added to the list of AutoCorrect exceptions.
Item | Returns an individual OtherCorrectionsException object in a collection.


OtherCorrectionsExceptions.Add Method (Word)

 Copy code hover
[image]

OtherCorrectionsExceptions.Add Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an OtherCorrectionsException object that represents a new exception added to the list of AutoCorrect exceptions.

Syntax

expression .Add(Name)

expression Required. A variable that represents an OtherCorrectionsExceptions collection.

Parameters

Name | Required/Optional | Data Type | Description
Name | Required | String | The word that you want Word to overlook.

Return Value

OtherCorrectionsException

Remarks

If the OtherCorrectionsAutoAdd property is True, words are automatically added to the list of other corrections exceptions.

Example

This example adds myCompany to the list of other corrections exceptions.

VBA Copy code Copy code
AutoCorrect.OtherCorrectionsExceptions.Add Name:="myCompany"

See also

Concepts

OtherCorrectionsExceptions Collection Object

Other resources

OtherCorrectionsExceptions Object Members


OtherCorrectionsExceptions.Item Method (Word)

 Copy code hover
[image]

OtherCorrectionsExceptions.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual OtherCorrectionsException object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents an OtherCorrectionsExceptions collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The individual object to be returned. Can be a Long indicating the ordinal position or a String representing the name of the individual object.

Return Value

OtherCorrectionsException

See also

Concepts

OtherCorrectionsExceptions Collection Object

Other resources

OtherCorrectionsExceptions Object Members


Page Object (Word)

 Copy code hover
[image]

Page Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a page in a document. Use the Page object and the related methods and properties for programmatically defining page layout in a document.

Remarks

Use the Item method to access a specific page in a document. The following example accesses the first page in the active document.

VBA Copy code Copy code
Dim objPage As Page

Set objPage = ActiveDocument.ActiveWindow _
 .Panes(1).Pages.Item(1)

To access the page number, use the Information property of a Range or Selection object, or the PageIndex property of a Break object that belongs to the Breaks collection of the specified Page object.

The Top and Left properties of the Page object always return 0 (zero) indicating the upper left corner of the page. The Height and Width properties return the height and width in points (72 points = 1 inch) of the paper size specified in the Page Setup dialog or through the PageSetup object. For example, for an 8-1/2 by 11 inch page in portrait mode, the Height property returns 792 and the Width property returns 612. All four of these properties are read-only.

See also

Concepts

Word Object Model Reference

Other resources

Page Object Members


Page Members (Word)

 Copy code hover
[image]

Page Members (Word)
Send feedback

Published: July 16, 2012

Represents a page in a document. Use the Page object and the related methods and properties for programmatically defining page layout in a document.

Methods

Name | Description
SaveAsPNG |

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Breaks | Returns a Breaks collection that represents the breaks on a page. .
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
EnhMetaFileBits | Returns a Variant that represents a picture representation of how a page of text appears. Read-only.
Height | Returns a Long that represents the height of a page, in pixels.
Left | Returns a Long that represents the left edge of the page. Read-only.
Parent | Returns an Object that represents the parent object of the specified Page object.
Rectangles | Returns a Rectangles collection that represents a portion of text or graphics in a page in a document.
Top | Returns a Long that represents the top edge of the page. Read-only.
Width | Returns a Long that represents the width, in points, of the paper defined in the Page Setup dialog box. Read-only Long.


Page Properties (Word)

 Copy code hover
[image]

Page Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Breaks | Returns a Breaks collection that represents the breaks on a page. .
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
EnhMetaFileBits | Returns a Variant that represents a picture representation of how a page of text appears. Read-only.
Height | Returns a Long that represents the height of a page, in pixels.
Left | Returns a Long that represents the left edge of the page. Read-only.
Parent | Returns an Object that represents the parent object of the specified Page object.
Rectangles | Returns a Rectangles collection that represents a portion of text or graphics in a page in a document.
Top | Returns a Long that represents the top edge of the page. Read-only.
Width | Returns a Long that represents the width, in points, of the paper defined in the Page Setup dialog box. Read-only Long.


Page.Application Property (Word)

 Copy code hover
[image]

Page.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a Page object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

Page Object

Other resources

Page Object Members


Page.Breaks Property (Word)

 Copy code hover
[image]

Page.Breaks Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Breaks collection that represents the breaks on a page. .

Syntax

expression .Breaks

expression Required. A variable that represents a Page object.

Remarks

The Breaks collection includes page, column, and section breaks. Use the Breaks collection and the related objects and properties to programmatically define page layout in a document.

Example

The following example returns the breaks on the first page in the active document.

VBA Copy code Copy code
Dim objBreaks As Breaks

Set objBreaks = ActiveDocument.ActiveWindow _
 .Panes(1).Pages(1).Breaks

See also

Concepts

Page Object

Other resources

Page Object Members


Page.Creator Property (Word)

 Copy code hover
[image]

Page.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a Page object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Page Object

Other resources

Page Object Members


Page.EnhMetaFileBits Property (Word)

 Copy code hover
[image]

Page.EnhMetaFileBits Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Variant that represents a picture representation of how a page of text appears. Read-only.

Syntax

expression .EnhMetaFileBits

expression An expression that returns a Page object.

Remarks

The EnhMetaFileBits property returns an array of bytes, which can be used with the Microsoft Windows 32 Application Programming Interface from within the Microsoft Visual Basic or Microsoft C++ development environment.

See also

Concepts

Page Object

Other resources

Page Object Members


Page.Height Property (Word)

 Copy code hover
[image]

Page.Height Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the height of a page, in pixels.

Syntax

expression .Top

expression An expression that represents a Page object.

Remarks

The Top and Left properties of the Page object always return 0 (zero) indicating the upper left corner of the page. The Height and Width properties return the height and width in points (72 points = 1 inch) of the paper size specified in the Page Setup dialog box or through the PageSetup object. For example, for an 8-1/2 by 11 inch page in portrait mode, the Height property returns 792 and the Width property returns 612. All four of these properties are read-only.

See also

Concepts

Page Object

Other resources

Page Object Members


Page.Left Property (Word)

 Copy code hover
[image]

Page.Left Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the left edge of the page. Read-only.

Syntax

expression .Left

expression A variable that represents a Page object.

Remarks

The Top and Left properties of the Page object always return 0 (zero) indicating the upper left corner of the page. The Height and Width properties return the height and width in points (72 points = 1 inch) of the paper size specified in the Page Setup dialog or through the PageSetup object. For example, for an 8-1/2 by 11 inch page in portrait mode, the Height property returns 792 and the Width property returns 612. All four of these properties are read-only.

See also

Concepts

Page Object

Other resources

Page Object Members


Page.Parent Property (Word)

 Copy code hover
[image]

Page.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Page object.

Syntax

expression .Parent

expression Required. A variable that represents a Page object.

See also

Concepts

Page Object

Other resources

Page Object Members


Page.Rectangles Property (Word)

 Copy code hover
[image]

Page.Rectangles Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Rectangles collection that represents a portion of text or graphics in a page in a document.

Syntax

expression .Rectangles

expression Required. A variable that represents a Page object.

Remarks

Use the Rectangles collection and related objects and properties for programmatically defining page layout in a document. Rectangles correspond to portions of text or graphics on a page in a document.

Example

The following example returns the Rectangles collection for the first page in the active document.

VBA Copy code Copy code
Dim objRectangles As Rectangles

Set objRectangles = ActiveDocument.ActiveWindow _
 .Panes(1).Pages(1).Rectangles

See also

Concepts

Page Object

Other resources

Page Object Members


Page.Top Property (Word)

 Copy code hover
[image]

Page.Top Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the top edge of the page. Read-only.

Syntax

expression .Top

expression A variable that represents a Page object.

Remarks

The Top and Left properties of the Page object always return 0 (zero) indicating the upper left corner of the page. The Height and Width properties return the height and width in points (72 points = 1 inch) of the paper size specified in the Page Setup dialog or through the PageSetup object. For example, for an 8-1/2 by 11 inch page in portrait mode, the Height property returns 792 and the Width property returns 612. All four of these properties are read-only.

See also

Concepts

Page Object

Other resources

Page Object Members


Page.Width Property (Word)

 Copy code hover
[image]

Page.Width Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the width, in points, of the paper defined in the Page Setup dialog box. Read-only Long.

Syntax

expression .Width

expression A variable that represents a Page object.

Remarks

The Top and Left properties of the Page object always return 0 (zero) indicating the upper left corner of the page. The Height and Width properties return the height and width in points (72 points = 1 inch) of the paper size specified in the Page Setup dialog or through the PageSetup object. For example, for an 8-1/2 by 11 inch page in portrait mode, the Height property returns 792 and the Width property returns 612. All four of these properties are read-only.

See also

Concepts

Page Object

Other resources

Page Object Members


PageNumber Object (Word)

 Copy code hover
[image]

PageNumber Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a page number in a header or footer. The PageNumber object is a member of the PageNumbers collection. The PageNumbers collection includes all the page numbers in a single header or footer.

Remarks

Use PageNumbers(Index), where Index is the index number, to return a single PageNumber object. In most cases, a header or footer will contain only one page number, which is index number 1. The following example centers the first page number in the primary header in section one in the active document.

VBA Copy code Copy code
ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary) _
 .PageNumbers(1).Alignment = wdAlignPageNumberCenter

Use the Add method to add a page number (a PAGE field) to a header or footer. The following example adds a page number to the primary footer in the first section and in any subsequent sections. The page number doesn't appear on the first page.

VBA Copy code Copy code
With ActiveDocument.Sections(1)
 .Footers(wdHeaderFooterPrimary).PageNumbers.Add _
 PageNumberAlignment:=wdAlignPageNumberLeft, _
 FirstPage:=False
End With

See also

Concepts

Word Object Model Reference

Other resources

PageNumber Object Members


PageNumber Members (Word)

 Copy code hover
[image]

PageNumber Members (Word)
Send feedback

Published: July 16, 2012

Represents a page number in a header or footer. The PageNumber object is a member of the PageNumbers collection. The PageNumbers collection includes all the page numbers in a single header or footer.

Methods

Name | Description
Copy | Copies the specified page number to the Clipboard.
Cut | Removes the specified object from the document and places it on the Clipboard.
Delete | Deletes the specified page number.
Select | Selects the specified page number.

Properties

Name | Description
Alignment | Returns or sets a WdPageNumberAlignment constant that represents the alignment for the page number. Read/write.
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Index | Returns a Long that represents the position of an item in a collection. Read-only.
Parent | Returns an Object that represents the parent object of the specified PageNumber object.


PageNumber Properties (Word)

 Copy code hover
[image]

PageNumber Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Alignment | Returns or sets a WdPageNumberAlignment constant that represents the alignment for the page number. Read/write.
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Index | Returns a Long that represents the position of an item in a collection. Read-only.
Parent | Returns an Object that represents the parent object of the specified PageNumber object.


PageNumber.Alignment Property (Word)

 Copy code hover
[image]

PageNumber.Alignment Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a WdPageNumberAlignment constant that represents the alignment for the page number. Read/write.

Syntax

expression .Alignment

expression Required. A variable that represents a PageNumber object.

See also

Concepts

PageNumber Object

Other resources

PageNumber Object Members


PageNumber.Application Property (Word)

 Copy code hover
[image]

PageNumber.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a PageNumber object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

PageNumber Object

Other resources

PageNumber Object Members


PageNumber.Creator Property (Word)

 Copy code hover
[image]

PageNumber.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a PageNumber object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

PageNumber Object

Other resources

PageNumber Object Members


PageNumber.Index Property (Word)

 Copy code hover
[image]

PageNumber.Index Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the position of an item in a collection. Read-only.

Syntax

expression .Index

expression Required. A variable that represents a PageNumber object.

See also

Concepts

PageNumber Object

Other resources

PageNumber Object Members


PageNumber.Parent Property (Word)

 Copy code hover
[image]

PageNumber.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified PageNumber object.

Syntax

expression .Parent

expression Required. A variable that represents a PageNumber object.

See also

Concepts

PageNumber Object

Other resources

PageNumber Object Members


PageNumber Methods (Word)

 Copy code hover
[image]

PageNumber Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Copy | Copies the specified page number to the Clipboard.
Cut | Removes the specified object from the document and places it on the Clipboard.
Delete | Deletes the specified page number.
Select | Selects the specified page number.


PageNumber.Copy Method (Word)

 Copy code hover
[image]

PageNumber.Copy Method (Word)
See also Send feedback

Published: July 16, 2012

Copies the specified page number to the Clipboard.

Syntax

expression .Copy

expression Required. A variable that represents a PageNumber object.

See also

Concepts

PageNumber Object

Other resources

PageNumber Object Members


PageNumber.Cut Method (Word)

 Copy code hover
[image]

PageNumber.Cut Method (Word)
See also Send feedback

Published: July 16, 2012

Removes the specified object from the document and places it on the Clipboard.

Syntax

expression .Cut

expression Required. A variable that represents a PageNumber object.

Remarks

If expression returns a Range or Selection object, the contents of the object are moved to the Clipboard but the collapsed object remains in the document.

Example

This example deletes the first field in the active document and pastes the field at the insertion point.

VBA Copy code Copy code
If ActiveDocument.Fields.Count >= 1 Then
 ActiveDocument.Fields(1).Cut
 Selection.Collapse Direction:=wdCollapseEnd
 Selection.Paste
End If

This example deletes the first word in the first paragraph and pastes the word at the end of the paragraph.

VBA Copy code Copy code
With ActiveDocument.Paragraphs(1).Range
 .Words(1).Cut
 .Collapse Direction:=wdCollapseEnd
 .Move Unit:=wdCharacter, Count:=-1
 .Paste
End With

This example deletes the contents of the selection and pastes them into a new document.

VBA Copy code Copy code
If Selection.Type = wdSelectionNormal Then
 Selection.Cut
 Documents.Add.Content.Paste
End If

See also

Concepts

PageNumber Object

Other resources

PageNumber Object Members


PageNumber.Delete Method (Word)

 Copy code hover
[image]

PageNumber.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the specified page number.

Syntax

expression .Delete

expression Required. A variable that represents a PageNumber object.

See also

Concepts

PageNumber Object

Other resources

PageNumber Object Members


PageNumber.Select Method (Word)

 Copy code hover
[image]

PageNumber.Select Method (Word)
See also Send feedback

Published: July 16, 2012

Selects the specified page number.

Syntax

expression .Select

expression Required. A variable that represents a PageNumber object.

Remarks

After using this method, use the Selection property to work with the selected items. For more information, see Working with the Selection Object.

See also

Concepts

PageNumber Object

Other resources

PageNumber Object Members


PageNumbers Object (Word)

 Copy code hover
[image]

PageNumbers Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of PageNumber objects that represent the page numbers in a single header or footer.

Remarks

Use the PageNumbers property to return the PageNumbers collection. The following example starts page numbering at 3 for the first section in the active document.

VBA Copy code Copy code
ActiveDocument.Sections(1).Footers(wdHeaderFooterPrimary) _
 .PageNumbers.StartingNumber = 3

Use the Add method to add page numbers to a header or footer. The following example adds a page number to the primary footer in the first section.

VBA Copy code Copy code
With ActiveDocument.Sections(1)
 .Footers(wdHeaderFooterPrimary).PageNumbers.Add _
 PageNumberAlignment:=wdAlignPageNumberLeft, _
 FirstPage:=False
End With

To add or change page numbers in a document with multiple sections, modify the page numbers in each section or set the LinkToPrevious property to True.

Use PageNumbers(index), where index is the index number, to return a single PageNumber object. In most cases, a header or footer contains only one page number, which is index number 1. The following example centers the first page number in the primary header in the first section.

VBA Copy code Copy code
ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary) _
 .PageNumbers(1).Alignment = wdAlignPageNumberCenter

See also

Concepts

Word Object Model Reference

Other resources

PageNumbers Object Members


PageNumbers Members (Word)

 Copy code hover
[image]

PageNumbers Members (Word)
Send feedback

Published: July 16, 2012

A collection of PageNumber objects that represent the page numbers in a single header or footer.

Methods

Name | Description
Add | Returns a PageNumber object that represents page numbers added to a header or footer in a section.
Item | Returns an individual PageNumber object in a collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
ChapterPageSeparator | Returns or sets the separator character used between the chapter number and the page number. Read/write WdSeparatorType.
Count | Returns a Long that represents the number of page numbers in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
DoubleQuote | True if Microsoft Word encloses the specified PageNumbers object in double quotation marks ("). Read/write Boolean.
HeadingLevelForChapter | Returns or sets the heading level style that's applied to the chapter titles in the document. Read/write Long.
IncludeChapterNumber | True if a chapter number is included with page numbers or a caption label. Read/write Boolean.
NumberStyle | Returns or sets a WdPageNumberStyle constant that represents the number style. Read/write.
Parent | Returns an Object that represents the parent object of the specified PageNumbers object.
RestartNumberingAtSection | True if page numbering starts at 1 again at the beginning of the specified section. Read/write Boolean.
ShowFirstPageNumber | True if the page number appears on the first page in the section. Read/write Boolean.
StartingNumber | Returns or sets the starting note number, line number, or page number. Read/write Long.


PageNumbers Properties (Word)

 Copy code hover
[image]

PageNumbers Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
ChapterPageSeparator | Returns or sets the separator character used between the chapter number and the page number. Read/write WdSeparatorType.
Count | Returns a Long that represents the number of page numbers in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
DoubleQuote | True if Microsoft Word encloses the specified PageNumbers object in double quotation marks ("). Read/write Boolean.
HeadingLevelForChapter | Returns or sets the heading level style that's applied to the chapter titles in the document. Read/write Long.
IncludeChapterNumber | True if a chapter number is included with page numbers or a caption label. Read/write Boolean.
NumberStyle | Returns or sets a WdPageNumberStyle constant that represents the number style. Read/write.
Parent | Returns an Object that represents the parent object of the specified PageNumbers object.
RestartNumberingAtSection | True if page numbering starts at 1 again at the beginning of the specified section. Read/write Boolean.
ShowFirstPageNumber | True if the page number appears on the first page in the section. Read/write Boolean.
StartingNumber | Returns or sets the starting note number, line number, or page number. Read/write Long.


PageNumbers.Application Property (Word)

 Copy code hover
[image]

PageNumbers.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a PageNumbers collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

PageNumbers Collection Object

Other resources

PageNumbers Object Members


PageNumbers.ChapterPageSeparator Property (Word)

 Copy code hover
[image]

PageNumbers.ChapterPageSeparator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the separator character used between the chapter number and the page number. Read/write WdSeparatorType.

Syntax

expression .ChapterPageSeparator

expression An expression that represents a PageNumbers object.

Remarks

Before you can create page numbers that include chapter numbers, the document headings must have a numbered outline format applied that uses styles from the Bullets and Numbering dialog box. To do this in Visual Basic, use the ApplyListTemplate method.

Example

The first part of this example creates a new document, adds chapter titles and page breaks, and then formats the document by using the last numbered outline format listed in the Bullets and Numbering dialog box. The second part of the example adds centered page numbers — including the chapter number — to the header; an en dash separates the chapter number and the page number.

VBA Copy code Copy code
Dim intLoop As Integer
Dim hfTemp As HeaderFooter

Documents.Add
For intLoop = 1 To 5
 With Selection
 .TypeParagraph
 .InsertBreak
 End With
Next intLoop
ActiveDocument.Content.Style = wdStyleHeading1
ActiveDocument.Content.ListFormat.ApplyListTemplate _
 ListTemplate:=ListGalleries(wdOutlineNumberGallery) _
 .ListTemplates(7)

Set hfTemp = ActiveDocument.Sections(1) _
 .Headers(wdHeaderFooterPrimary)
With hfTemp.PageNumbers
 .Add PageNumberAlignment:=wdAlignPageNumberCenter
 .NumberStyle = wdPageNumberStyleArabic
 .IncludeChapterNumber = True
 .HeadingLevelForChapter = 0
 .ChapterPageSeparator = wdSeparatorEnDash
End With

See also

Concepts

PageNumbers Collection Object

Other resources

PageNumbers Object Members


PageNumbers.Count Property (Word)

 Copy code hover
[image]

PageNumbers.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of page numbers in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents a PageNumbers collection.

See also

Concepts

PageNumbers Collection Object

Other resources

PageNumbers Object Members


PageNumbers.Creator Property (Word)

 Copy code hover
[image]

PageNumbers.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a PageNumbers collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

PageNumbers Collection Object

Other resources

PageNumbers Object Members


PageNumbers.DoubleQuote Property (Word)

 Copy code hover
[image]

PageNumbers.DoubleQuote Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word encloses the specified PageNumbers object in double quotation marks ("). Read/write Boolean.

Syntax

expression .DoubleQuote

expression An expression that returns a PageNumbers object.

Remarks

To set Word to enclose page numbers in double quotation marks by default, use the AddHebDoubleQuote property.

Example

This example encloses the page numbers in the first footer of the active document in double quotation marks (").

VBA Copy code Copy code
ActiveDocument.Sections(1).Footers(1) _
 .PageNumbers.DoubleQuote = True

See also

Concepts

PageNumbers Collection Object

Other resources

PageNumbers Object Members


PageNumbers.HeadingLevelForChapter Property (Word)

 Copy code hover
[image]

PageNumbers.HeadingLevelForChapter Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the heading level style that's applied to the chapter titles in the document. Read/write Long.

Syntax

expression .HeadingLevelForChapter

expression A variable that represents a PageNumbers object.

Remarks

The HeadingLevelForChapter property can be a number from 0 (zero) through 8, corresponding to heading levels 1 through 9.

Before you can create page numbers that include chapter numbers, the document headings must have a numbered outline format applied that uses styles from the Bullets and Numbering dialog box. To do this in Visual Basic, use the ApplyListTemplate method.

Example

The first part of this example creates a new document, adds chapter titles and page breaks, and then formats the document by using the last numbered outline format listed in the Bullets and Numbering dialog box. The second part of the example adds centered page numbers - including the chapter number - to the header; an en dash separates the chapter number and the page number. The first heading level is used for the chapter number, and lowercase roman numerals are used for the page number.

VBA Copy code Copy code
Dim intLoop As Integer
Dim hdrTemp As HeaderFooter

Documents.Add
For intLoop = 1 To 5
 With Selection
 .TypeParagraph
 .InsertBreak
 End With
Next intLoop
ActiveDocument.Content.Style = wdStyleHeading1
ActiveDocument.Content.ListFormat.ApplyListTemplate _
 ListTemplate:=ListGalleries(wdOutlineNumberGallery) _
 .ListTemplates(7)

Set hdrTemp = ActiveDocument.Sections(1) _
 .Headers(wdHeaderFooterPrimary)

With hdrTemp.PageNumbers
 .Add PageNumberAlignment:=wdAlignPageNumberCenter
 .NumberStyle = wdPageNumberStyleArabic
 .IncludeChapterNumber = True
 .HeadingLevelForChapter = 0
 .ChapterPageSeparator = wdSeparatorEnDash
End With

See also

Concepts

PageNumbers Collection Object

Other resources

PageNumbers Object Members


PageNumbers.IncludeChapterNumber Property (Word)

 Copy code hover
[image]

PageNumbers.IncludeChapterNumber Property (Word)
See also Send feedback

Published: July 16, 2012

True if a chapter number is included with page numbers or a caption label. Read/write Boolean.

Syntax

expression .IncludeChapterNumber

expression A variable that represents a PageNumbers object.

Example

This example adds page numbers in the footer for section one in the active document. The page numbers include the chapter number.

VBA Copy code Copy code
With ActiveDocument.Sections(1).Footers _
 (wdHeaderFooterPrimary).PageNumbers
 .Add
 .IncludeChapterNumber = True
 .HeadingLevelForChapter = 1
End With

This example adds the chapter number from the Heading 2 style to figure captions, sets the caption numbering style, and then inserts a new figure caption. The document should already contain a Heading 2 style with numbering.

VBA Copy code Copy code
With CaptionLabels(wdCaptionFigure)
 .IncludeChapterNumber = True
 .ChapterStyleLevel = 2
 .NumberStyle = wdCaptionNumberStyleUppercaseLetter
End With
Selection.InsertCaption Label:="Figure", Title:=": History"

See also

Concepts

PageNumbers Collection Object

Other resources

PageNumbers Object Members


PageNumbers.NumberStyle Property (Word)

 Copy code hover
[image]

PageNumbers.NumberStyle Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a WdPageNumberStyle constant that represents the number style. Read/write.

Syntax

expression .NumberStyle

expression Required. An expression that returns a PageNumbers object.

Example

This example formats the page numbers in the active document's footer as lowercase roman numerals.

VBA Copy code Copy code
For Each sec In ActiveDocument.Sections
 sec.Footers(wdHeaderFooterPrimary).PageNumbers _
 .NumberStyle = wdPageNumberStyleLowercaseRoman
Next sec

See also

Concepts

PageNumbers Collection Object

Other resources

PageNumbers Object Members


PageNumbers.Parent Property (Word)

 Copy code hover
[image]

PageNumbers.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified PageNumbers object.

Syntax

expression .Parent

expression Required. A variable that represents a PageNumbers collection.

See also

Concepts

PageNumbers Collection Object

Other resources

PageNumbers Object Members


PageNumbers.RestartNumberingAtSection Property (Word)

 Copy code hover
[image]

PageNumbers.RestartNumberingAtSection Property (Word)
See also Send feedback

Published: July 16, 2012

True if page numbering starts at 1 again at the beginning of the specified section. Read/write Boolean.

Syntax

expression .RestartNumberingAtSection

expression An expression that returns a PageNumbers collection object.

Remarks

If set to False, the RestartNumberingAtSection property will override the StartingNumber property so that page numbering can continue from the previous section.

Example

This example adds page numbers to the headers in the active document, and then it sets page numbering to start at 1 again at the beginning of each section.

VBA Copy code Copy code
ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary) _
 .PageNumbers.Add Pagenumberalignment:=wdAlignPageNumberCenter
For Each s In ActiveDocument.Sections
 With s.Headers(wdHeaderFooterPrimary).PageNumbers
 .RestartNumberingAtSection = True
 .StartingNumber = 1
 End With
Next s

See also

Concepts

PageNumbers Collection Object

Other resources

PageNumbers Object Members


PageNumbers.ShowFirstPageNumber Property (Word)

 Copy code hover
[image]

PageNumbers.ShowFirstPageNumber Property (Word)
See also Send feedback

Published: July 16, 2012

True if the page number appears on the first page in the section. Read/write Boolean.

Syntax

expression .ShowFirstPageNumber

expression An expression that returns a PageNumbers collection object.

Remarks

Setting this property to True automatically adds page numbers to a section.

Example

This example checks to see whether the page number appears on the first page in the active document.

VBA Copy code Copy code
Set myDoc = ActiveDocument
first = myDoc.Sections(1).Headers(wdHeaderFooterPrimary). _
 PageNumbers.ShowFirstPageNumber
Msgbox "This document shows numbers on the first page - " & first

This example adds page numbers to the active document.

VBA Copy code Copy code
ActiveDocument.Sections(1) _
 .Headers(wdHeaderFooterPrimary).PageNumbers _
 .ShowFirstPageNumber = True

See also

Concepts

PageNumbers Collection Object

Other resources

PageNumbers Object Members


PageNumbers.StartingNumber Property (Word)

 Copy code hover
[image]

PageNumbers.StartingNumber Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the starting note number, line number, or page number. Read/write Long.

Syntax

expression .StartingNumber

expression Required. An expression that returns a PageNumbers object.

Remarks

You must be in print layout view to see line numbering.

When applied to page numbers, this property returns or sets the beginning page number for the specified HeaderFooter object. This number may or may not be visible on the first page, depending on the setting of the ShowFirstPageNumber property. The RestartNumberingAtSection property, if set to False, will override the StartingNumber property so that page numbering can continue from the previous section.

Example

This example creates a new document, sets the starting number for footnotes to 10, and then adds a footnote at the insertion point.

VBA Copy code Copy code
Set myDoc = Documents.Add
With myDoc.Footnotes
 .StartingNumber = 10
 .Add Range:=Selection.Range, Text:="Text for a footnote"
End With

This example enables line numbering for the active document. The starting number is set to 5, every fifth line number is shown, and the numbering starts over at the beginning of each section in the document.

VBA Copy code Copy code
With ActiveDocument.PageSetup.LineNumbering
 .Active = True
 .StartingNumber = 5
 .CountBy = 5
 .RestartMode = wdRestartSection
End With

This example sets properties for page numbers, and then it adds page numbers to the header of the active document.

VBA Copy code Copy code
With ActiveDocument.Sections(1) _
 .Headers(wdHeaderFooterPrimary).PageNumbers
 .NumberStyle = wdPageNumberStyleArabic
 .IncludeChapterNumber = False
 .RestartNumberingAtSection = True
 .StartingNumber = 5
 .Add PageNumberAlignment:=wdAlignPageNumberCenter, _
 FirstPage:=True
End With

See also

Concepts

PageNumbers Collection Object

Other resources

PageNumbers Object Members


PageNumbers Methods (Word)

 Copy code hover
[image]

PageNumbers Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Returns a PageNumber object that represents page numbers added to a header or footer in a section.
Item | Returns an individual PageNumber object in a collection.


PageNumbers.Add Method (Word)

 Copy code hover
[image]

PageNumbers.Add Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a PageNumber object that represents page numbers added to a header or footer in a section.

Syntax

expression .Add(PageNumberAlignment, FirstPage)

expression Required. A variable that represents a PageNumbers collection.

Parameters

Name | Required/Optional | Data Type | Description
PageNumberAlignment | Optional | Variant | Can be any WdPageNumberAlignment constant.
FirstPage | Optional | Variant | False to make the first-page header and the first-page footer different from the headers and footers on all subsequent pages in the document. If FirstPage is set to False, a page number isn't added to the first page. If this argument is omitted, the setting is controlled by the DifferentFirstPageHeaderFooter property.

Remarks

If the LinkToPrevious property for the HeaderFooter object is set to True, the page numbers will continue sequentially from one section to next throughout the document.

Example

This example adds a page number to the primary footer in the first section of the active document.

VBA Copy code Copy code
With ActiveDocument.Sections(1)
 .Footers(wdHeaderFooterPrimary).PageNumbers.Add _
 PageNumberAlignment:=wdAlignPageNumberLeft, _
 FirstPage:=True
End With

This example creates and formats page numbers in the header for the active document.

VBA Copy code Copy code
Set myPgNum = ActiveDocument.Sections(1) _
 .Headers(wdHeaderFooterPrimary) _
 .PageNumbers.Add(PageNumberAlignment:= _
 wdAlignPageNumberCenter, FirstPage:= True)
myPgNum.Select
With Selection.Range
 .Italic = True
 .Bold = True
End With

See also

Concepts

PageNumbers Collection Object

Other resources

PageNumbers Object Members


PageNumbers.Item Method (Word)

 Copy code hover
[image]

PageNumbers.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual PageNumber object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents a PageNumbers collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The individual object to be returned. Can be a Long indicating the ordinal position of the individual object.

Return Value

PageNumber

See also

Concepts

PageNumbers Collection Object

Other resources

PageNumbers Object Members


Pages Object (Word)

 Copy code hover
[image]

Pages Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of pages in a document. Use the Pages collection and the related objects and properties for programmatically defining page layout in a document.

Remarks

Use the Pages property to return a Pages collection. The following example accesses all pages in the active document.

VBA Copy code Copy code
Dim objPages As Pages

Set objPage = ActiveDocument. _
 ActiveWindow.Panes(1).Pages

Use the Item method to access an individual Page object that represents an individual page in a document. The following example accesses the first page in the active document.

VBA Copy code Copy code
Dim objPage As Page

Set objPage = ActiveDocument.ActiveWindow _
 .Panes(1).Pages.Item(1)

See also

Concepts

Word Object Model Reference

Other resources

Pages Object Members


Pages Members (Word)

 Copy code hover
[image]

Pages Members (Word)
Send feedback

Published: July 16, 2012

A collection of pages in a document. Use the Pages collection and the related objects and properties for programmatically defining page layout in a document.

Methods

Name | Description
Item | Returns an individual Page object in a collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of pages in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified Pages object.


Pages Properties (Word)

 Copy code hover
[image]

Pages Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of pages in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified Pages object.


Pages.Application Property (Word)

 Copy code hover
[image]

Pages.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a Pages collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

Pages Collection

Other resources

Pages Object Members


Pages.Count Property (Word)

 Copy code hover
[image]

Pages.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of pages in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents a Pages collection.

See also

Concepts

Pages Collection

Other resources

Pages Object Members


Pages.Creator Property (Word)

 Copy code hover
[image]

Pages.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a Pages collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Pages Collection

Other resources

Pages Object Members


Pages.Parent Property (Word)

 Copy code hover
[image]

Pages.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Pages object.

Syntax

expression .Parent

expression Required. A variable that represents a Pages collection.

See also

Concepts

Pages Collection

Other resources

Pages Object Members


Pages Methods (Word)

 Copy code hover
[image]

Pages Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Item | Returns an individual Page object in a collection.


Pages.Item Method (Word)

 Copy code hover
[image]

Pages.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual Page object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents a Pages collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The individual object to be returned. Can be a Long indicating the ordinal position of the individual object.

Return Value

Page

See also

Concepts

Pages Collection

Other resources

Pages Object Members


PageSetup Object (Word)

 Copy code hover
[image]

PageSetup Object (Word)
See also Send feedback

Published: July 16, 2012

Represents the page setup description. The PageSetup object contains all the page setup attributes of a document (such as left margin, bottom margin, and paper size) as properties.

Remarks

Use the PageSetup property to return the PageSetup object. The following example sets the first section in the active document to landscape orientation and then prints the document.

VBA Copy code Copy code
ActiveDocument.Sections(1).PageSetup.Orientation = _
 wdOrientLandscape
ActiveDocument.PrintOut

The following example sets all the margins for the document named "Sales.doc."

VBA Copy code Copy code
With Documents("Sales.doc").PageSetup
 .LeftMargin = InchesToPoints(0.75)
 .RightMargin = InchesToPoints(0.75)
 .TopMargin = InchesToPoints(1.5)
 .BottomMargin = InchesToPoints(1)
End With

See also

Concepts

Word Object Model Reference

Other resources

PageSetup Object Members


PageSetup Members (Word)

 Copy code hover
[image]

PageSetup Members (Word)
Send feedback

Published: July 16, 2012

Represents the page setup description. The PageSetup object contains all the page setup attributes of a document (such as left margin, bottom margin, and paper size) as properties.

Methods

Name | Description
SetAsTemplateDefault | Sets the specified page setup formatting as the default for the active document and all new documents based on the active template.
TogglePortrait | Switches between portrait and landscape page orientations for a document or section.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
BookFoldPrinting | True for Microsoft Word to print a document in a series of booklets so the printed pages can be folded and read as a book. Read/write Boolean.
BookFoldPrintingSheets | Returns or sets a Long which represents the number of pages for each booklet. Read/write Boolean.
BookFoldRevPrinting | True for Microsoft Word to reverse the printing order for book fold printing of bidirectional or Asian language documents. Read/write Boolean.
BottomMargin | Returns or sets the distance (in points) between the bottom edge of the page and the bottom boundary of the body text. Read/write Single.
CharsLine | Returns or sets the number of characters per line in the document grid. Read/write Single.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
DifferentFirstPageHeaderFooter | True if a different header or footer is used on the first page. Can be True, False, or wdUndefined. Read/write Long.
FirstPageTray | Returns or sets the paper tray to use for the first page of a document or section. Read/write WdPaperTray.
FooterDistance | Returns or sets the distance (in points) between the footer and the bottom of the page. Read/write Single.
Gutter | Returns or sets the amount (in points) of extra margin space added to each page in a document or section for binding. Read/write Single.
GutterPos | Returns or sets on which side the gutter appears in a document. Read/write WdGutterStyle.
GutterStyle | Returns or sets whether Microsoft Word uses gutters for the current document based on a right-to-left language or a left-to-right language. Read/write WdGutterStyleOld.
HeaderDistance | Returns or sets the distance (in points) between the header and the top of the page. Read/write Single.
LayoutMode | Returns or sets the layout mode for the current document. Read/write WdLayoutMode.
LeftMargin | Returns or sets the distance (in points) between the left edge of the page and the left boundary of the body text. Read/write Single.
LineNumbering | Returns or sets a LineNumbering object that represents the line numbers for the specified PageSetup object.
LinesPage | Returns or sets the number of lines per page in the document grid. Read/write Single.
MirrorMargins | True if the inside and outside margins of facing pages are the same width. Read/write Long.
OddAndEvenPagesHeaderFooter | True if the specified PageSetup object has different headers and footers for odd-numbered and even-numbered pages. Read/write Long.
Orientation | Returns or sets the orientation of the page. Read/write WdOrientation.
OtherPagesTray | Returns or sets the paper tray to be used for all but the first page of a document or section. Read/write WdPaperTray.
PageHeight | Returns or sets the height of the page in points. Read/write Single.
PageWidth | Returns or sets the width of the page in points. Read/write Single.
PaperSize | Returns or sets the paper size. Read/write WdPaperSize.
Parent | Returns an Object that represents the parent object of the specified PageSetup object.
RightMargin | Returns or sets the distance (in points) between the right edge of the page and the right boundary of the body text. Read/write Single.
SectionDirection | Returns or sets the reading order and alignment for the specified sections. Read/write WdSectionDirection.
SectionStart | Returns or sets the type of section break for the specified object. Read/write WdSectionStart.
ShowGrid | True to display the page grid. False to hide it. Read/write Boolean.
SuppressEndnotes | True if endnotes are printed at the end of the next section that doesn't suppress endnotes. Read/write Long.
TextColumns | Returns a TextColumns collection that represents the set of text columns for the specified PageSetup object.
TopMargin | Returns or sets the distance (in points) between the top edge of the page and the top boundary of the body text. Read/write Single.
TwoPagesOnOne | True if Microsoft Word prints the specified document two pages per sheet. Read/write Boolean.
VerticalAlignment | Returns or sets the vertical alignment of text on each page in a document or section. Read/write WdVerticalAlignment.


PageSetup Properties (Word)

 Copy code hover
[image]

PageSetup Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
BookFoldPrinting | True for Microsoft Word to print a document in a series of booklets so the printed pages can be folded and read as a book. Read/write Boolean.
BookFoldPrintingSheets | Returns or sets a Long which represents the number of pages for each booklet. Read/write Boolean.
BookFoldRevPrinting | True for Microsoft Word to reverse the printing order for book fold printing of bidirectional or Asian language documents. Read/write Boolean.
BottomMargin | Returns or sets the distance (in points) between the bottom edge of the page and the bottom boundary of the body text. Read/write Single.
CharsLine | Returns or sets the number of characters per line in the document grid. Read/write Single.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
DifferentFirstPageHeaderFooter | True if a different header or footer is used on the first page. Can be True, False, or wdUndefined. Read/write Long.
FirstPageTray | Returns or sets the paper tray to use for the first page of a document or section. Read/write WdPaperTray.
FooterDistance | Returns or sets the distance (in points) between the footer and the bottom of the page. Read/write Single.
Gutter | Returns or sets the amount (in points) of extra margin space added to each page in a document or section for binding. Read/write Single.
GutterPos | Returns or sets on which side the gutter appears in a document. Read/write WdGutterStyle.
GutterStyle | Returns or sets whether Microsoft Word uses gutters for the current document based on a right-to-left language or a left-to-right language. Read/write WdGutterStyleOld.
HeaderDistance | Returns or sets the distance (in points) between the header and the top of the page. Read/write Single.
LayoutMode | Returns or sets the layout mode for the current document. Read/write WdLayoutMode.
LeftMargin | Returns or sets the distance (in points) between the left edge of the page and the left boundary of the body text. Read/write Single.
LineNumbering | Returns or sets a LineNumbering object that represents the line numbers for the specified PageSetup object.
LinesPage | Returns or sets the number of lines per page in the document grid. Read/write Single.
MirrorMargins | True if the inside and outside margins of facing pages are the same width. Read/write Long.
OddAndEvenPagesHeaderFooter | True if the specified PageSetup object has different headers and footers for odd-numbered and even-numbered pages. Read/write Long.
Orientation | Returns or sets the orientation of the page. Read/write WdOrientation.
OtherPagesTray | Returns or sets the paper tray to be used for all but the first page of a document or section. Read/write WdPaperTray.
PageHeight | Returns or sets the height of the page in points. Read/write Single.
PageWidth | Returns or sets the width of the page in points. Read/write Single.
PaperSize | Returns or sets the paper size. Read/write WdPaperSize.
Parent | Returns an Object that represents the parent object of the specified PageSetup object.
RightMargin | Returns or sets the distance (in points) between the right edge of the page and the right boundary of the body text. Read/write Single.
SectionDirection | Returns or sets the reading order and alignment for the specified sections. Read/write WdSectionDirection.
SectionStart | Returns or sets the type of section break for the specified object. Read/write WdSectionStart.
ShowGrid | True to display the page grid. False to hide it. Read/write Boolean.
SuppressEndnotes | True if endnotes are printed at the end of the next section that doesn't suppress endnotes. Read/write Long.
TextColumns | Returns a TextColumns collection that represents the set of text columns for the specified PageSetup object.
TopMargin | Returns or sets the distance (in points) between the top edge of the page and the top boundary of the body text. Read/write Single.
TwoPagesOnOne | True if Microsoft Word prints the specified document two pages per sheet. Read/write Boolean.
VerticalAlignment | Returns or sets the vertical alignment of text on each page in a document or section. Read/write WdVerticalAlignment.


PageSetup.Application Property (Word)

 Copy code hover
[image]

PageSetup.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a PageSetup object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.BookFoldPrinting Property (Word)

 Copy code hover
[image]

PageSetup.BookFoldPrinting Property (Word)
See also Send feedback

Published: July 16, 2012

True for Microsoft Word to print a document in a series of booklets so the printed pages can be folded and read as a book. Read/write Boolean.

Syntax

expression .BookFoldPrinting

expression An expression that returns a PageSetup object.

Example

This example turns the active document into a booklet that prints in four-page increments.

VBA Copy code Copy code
Sub Booklet()
 With PageSetup
 .BookFoldPrinting = True
 .BookFoldPrintingSheets = 4
 End With
End Sub

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.BookFoldPrintingSheets Property (Word)

 Copy code hover
[image]

PageSetup.BookFoldPrintingSheets Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Long which represents the number of pages for each booklet. Read/write Boolean.

Syntax

expression .BookFoldPrintingSheets

expression An expression that returns a PageSetup object.

Example

This example turns the active document into a booklet that will print in sixteen-page booklets.

VBA Copy code Copy code
Sub Booklet()
 With PageSetup
 .BookFoldPrinting = True
 .BookFoldPrintingSheets = 16
 End With
End Sub

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.BookFoldRevPrinting Property (Word)

 Copy code hover
[image]

PageSetup.BookFoldRevPrinting Property (Word)
See also Send feedback

Published: July 16, 2012

True for Microsoft Word to reverse the printing order for book fold printing of bidirectional or Asian language documents. Read/write Boolean.

Syntax

expression .BookFoldRevPrinting

expression An expression that returns a PageSetup object.

Example

This example switches from left-to-right book printing to right-to-left book printing for a bidirectional or Asian language document that will print in sixteen-page increments.

VBA Copy code Copy code
Sub BookletRev()
 With PageSetup
 .BookFoldRevPrinting = True
 .BookFoldPrintingSheets = 16
 End With
End Sub

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.BottomMargin Property (Word)

 Copy code hover
[image]

PageSetup.BottomMargin Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the distance (in points) between the bottom edge of the page and the bottom boundary of the body text. Read/write Single.

Syntax

expression .BottomMargin

expression A variable that represents a PageSetup object.

Example

This example sets the bottom margin to 72 points (1 inch) and the top margin to 2 inches for the active document. The InchesToPoints method is used to convert inches to points.

VBA Copy code Copy code
With ActiveDocument.PageSetup
 .BottomMargin = 72
 .TopMargin = InchesToPoints(2)
End With

This example sets the bottom margin to 2.5 inches for all the sections in the current selection.

VBA Copy code Copy code
Selection.PageSetup.BottomMargin = InchesToPoints(2.5)

This example returns the bottom margin for section 1 in the selection. The PointsToInches method is used to convert the result to inches.

VBA Copy code Copy code
Dim sngMargin As Single

sngMargin = Selection.Sections(1).PageSetup.BottomMargin
MsgBox PointsToInches(sngMargin) & " inches"

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.CharsLine Property (Word)

 Copy code hover
[image]

PageSetup.CharsLine Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the number of characters per line in the document grid. Read/write Single.

Syntax

expression .CharsLine

expression A variable that represents a PageSetup object.

Example

This example sets the number of characters per line to 42 for the active document.

VBA Copy code Copy code
ActiveDocument.PageSetup.CharsLine = 42

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.Creator Property (Word)

 Copy code hover
[image]

PageSetup.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a PageSetup object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.DifferentFirstPageHeaderFooter Property (Word)

 Copy code hover
[image]

PageSetup.DifferentFirstPageHeaderFooter Property (Word)
See also Send feedback

Published: July 16, 2012

True if a different header or footer is used on the first page. Can be True, False, or wdUndefined. Read/write Long.

Syntax

expression .DifferentFirstPageHeaderFooter

expression An expression that returns a PageSetup object.

Example

This example checks each section in the active document for headers and footers that are different on the first page and displays a message if any are found.

VBA Copy code Copy code
Dim secLoop As Section

For Each secLoop In ActiveDocument.Sections
 If secLoop.PageSetup _
 .DifferentFirstPageHeaderFooter = True Then
 Msgbox "Section " & secLoop.Index _
 & " has different first page headers & footers."
 End If
Next secLoop

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.FirstPageTray Property (Word)

 Copy code hover
[image]

PageSetup.FirstPageTray Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the paper tray to use for the first page of a document or section. Read/write WdPaperTray.

Syntax

expression .FirstPageTray

expression Required. A variable that represents a PageSetup object.

Example

This example sets the tray to use for printing the first page of each section in the active document.

VBA Copy code Copy code
ActiveDocument.PageSetup.FirstPageTray = wdPrinterLowerBin

This example sets the tray to use for printing the first page of each section in the selection.

VBA Copy code Copy code
Selection.PageSetup.FirstPageTray = wdPrinterUpperBin

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.FooterDistance Property (Word)

 Copy code hover
[image]

PageSetup.FooterDistance Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the distance (in points) between the footer and the bottom of the page. Read/write Single.

Syntax

expression .FooterDistance

expression A variable that represents a PageSetup object.

Example

This example sets the distance between the footer and the bottom of the page to 0.5 inch. The InchesToPoints method is used to convert inches to points.

VBA Copy code Copy code
ActiveDocument.PageSetup.FooterDistance = InchesToPoints(0.5)

This example sets the distance between the footer and the bottom of the page for all the sections in the selection to 1 inch.

VBA Copy code Copy code
Selection.Range.PageSetup.FooterDistance = 72

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.Gutter Property (Word)

 Copy code hover
[image]

PageSetup.Gutter Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the amount (in points) of extra margin space added to each page in a document or section for binding. Read/write Single.

Syntax

expression .Gutter

expression A variable that represents a PageSetup object.

Remarks

If the MirrorMargins property is set to True, the Gutter property adds the extra space to the inside margins. Otherwise, the extra space is added to the left margin.

Example

This example adds 1 inch (72 points) to the inside margins of the active document.

VBA Copy code Copy code
With ActiveDocument.PageSetup
 .MirrorMargins = True
 .Gutter = 72
End With

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.GutterPos Property (Word)

 Copy code hover
[image]

PageSetup.GutterPos Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets on which side the gutter appears in a document. Read/write WdGutterStyle.

Syntax

expression .GutterPos

expression Required. A variable that represents a PageSetup object.

Example

This example sets the gutter to appear on the right side of the document.

VBA Copy code Copy code
ActiveDocument.PageSetup.GutterPos = wdGutterPosRight

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.GutterStyle Property (Word)

 Copy code hover
[image]

PageSetup.GutterStyle Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets whether Microsoft Word uses gutters for the current document based on a right-to-left language or a left-to-right language. Read/write WdGutterStyleOld.

Syntax

expression .GutterStyle

expression Required. A variable that represents a PageSetup object.

Example

This example sets the current document to follow a gutter style for a right-to-left language document.

VBA Copy code Copy code
ActiveDocument.PageSetup.GutterStyle = wdGutterStyleBidi

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.HeaderDistance Property (Word)

 Copy code hover
[image]

PageSetup.HeaderDistance Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the distance (in points) between the header and the top of the page. Read/write Single.

Syntax

expression .HeaderDistance

expression A variable that represents a PageSetup object.

Example

This example displays the distance between the header and the top of the page. The PointsToInches method is used to convert points to inches.

VBA Copy code Copy code
Dim sngDistance As Single

sngDistance = ActiveDocument.PageSetup.HeaderDistance
Msgbox PointsToInches(sngDistance) & " inches"

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.LayoutMode Property (Word)

 Copy code hover
[image]

PageSetup.LayoutMode Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the layout mode for the current document. Read/write WdLayoutMode.

Syntax

expression .LayoutMode

expression Required. A variable that represents a PageSetup object.

Example

This example sets the layout mode for the active document so that Microsoft Word automatically aligns typed text to a grid.

VBA Copy code Copy code
ActiveDocument.PageSetup.LayoutMode = wdLayoutModeGenko

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.LeftMargin Property (Word)

 Copy code hover
[image]

PageSetup.LeftMargin Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the distance (in points) between the left edge of the page and the left boundary of the body text. Read/write Single.

Syntax

expression .LeftMargin

expression An expression that returns a PageSetup object.

Remarks

If the MirrorMargins property is set to True, the LeftMargin property controls the setting for inside margins and the RightMargin property controls the setting for outside margins.

Example

This example sets the left margin to 1 inch (72 points) for the second section in the active document.

VBA Copy code Copy code
ActiveDocument.Sections(2).PageSetup.LeftMargin = 72

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.LineNumbering Property (Word)

 Copy code hover
[image]

PageSetup.LineNumbering Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a LineNumbering object that represents the line numbers for the specified PageSetup object.

Syntax

expression .LineNumbering

expression An expression that returns a PageSetup object.

Remarks

You must be in print layout view to see line numbering.

Example

This example enables line numbering for the active document.

VBA Copy code Copy code
ActiveDocument.PageSetup.LineNumbering.Active = True

This example enables line numbering for a document named "MyDocument.doc" The starting number is set to one, every fifth line number is shown, and the numbering is continuous throughout all sections in the document.

VBA Copy code Copy code
set myDoc = Documents("MyDocument.doc")
With myDoc.PageSetup.LineNumbering
 .Active = True
 .StartingNumber = 1
 .CountBy = 5
 .RestartMode = wdRestartContinuous
End With

This example sets the line numbering in the active document equal to the line numbering in MyDocument.doc.

VBA Copy code Copy code
ActiveDocument.PageSetup.LineNumbering = Documents("MyDocument.doc") _
 .PageSetup.LineNumbering

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.LinesPage Property (Word)

 Copy code hover
[image]

PageSetup.LinesPage Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the number of lines per page in the document grid. Read/write Single.

Syntax

expression .LinesPage

expression An expression that returns a PageSetup object.

Example

This example sets the number of lines per page to 35 for the active document.

VBA Copy code Copy code
ActiveDocument.PageSetup.LinesPage = 35

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.MirrorMargins Property (Word)

 Copy code hover
[image]

PageSetup.MirrorMargins Property (Word)
See also Send feedback

Published: July 16, 2012

True if the inside and outside margins of facing pages are the same width. Read/write Long.

Syntax

expression .MirrorMargins

expression An expression that returns a PageSetup object.

Remarks

The MirrorMargins property can be True, False, or wdUndefined. If the MirrorMargins property is set to True, the LeftMargin property controls the setting for inside margins and the RightMargin property controls the setting for outside margins.

Example

This example sets the inside margins of the active document to 1 inch (72 points) and the outside margins to 0.5 inch. The InchesToPoints method is used to convert inches to points.

VBA Copy code Copy code
With ActiveDocument.PageSetup
 .MirrorMargins = True
 .LeftMargin = 72
 .RightMargin = InchesToPoints(0.5)
End With

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.OddAndEvenPagesHeaderFooter Property (Word)

 Copy code hover
[image]

PageSetup.OddAndEvenPagesHeaderFooter Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified PageSetup object has different headers and footers for odd-numbered and even-numbered pages. Read/write Long.

Syntax

expression .OddAndEvenPagesHeaderFooter

expression An expression that returns a PageSetup object.

Remarks

The OddAndEvenPagesHeaderFooter property can be True, False, or wdUndefined.

Example

This example creates different headers and footers for odd-numbered and even-numbered pages in Document1.

VBA Copy code Copy code
Set myDoc = Documents("Document1")
myDoc.PageSetup.OddAndEvenPagesHeaderFooter = True
With myDoc.Sections(1)
 .Headers(wdHeaderFooterPrimary).Range _
 .InsertAfter "Odd Header"
 .Headers(wdHeaderFooterEvenPages).Range _
 .InsertAfter "Even Header"
End With

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.Orientation Property (Word)

 Copy code hover
[image]

PageSetup.Orientation Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the orientation of the page. Read/write WdOrientation.

Syntax

expression .Orientation

expression Required. A variable that represents a PageSetup object.

Remarks

Some of the WdOrientation constants may not be available to you, depending on the language support (U.S. English, for example) that you have selected or installed.

Example

This example changes the orientation of the document named "MyDocument.doc" and then prints the document. The example then changes the orientation of the document back to portrait.

VBA Copy code Copy code
Set myDoc = Documents("MyDocument.doc")
With myDoc
 .PageSetup.Orientation = wdOrientLandscape
 .PrintOut
 .PageSetup.Orientation = wdOrientPortrait
End With

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.OtherPagesTray Property (Word)

 Copy code hover
[image]

PageSetup.OtherPagesTray Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the paper tray to be used for all but the first page of a document or section. Read/write WdPaperTray.

Syntax

expression .OtherPagesTray

expression Required. A variable that represents a PageSetup object.

Example

This example sets the tray to be used for printing all but the first page of each section in the active document.

VBA Copy code Copy code
ActiveDocument.PageSetup.OtherPagesTray = wdPrinterUpperBin

This example sets the tray to be used for printing all but the first page of each section in the selection.

VBA Copy code Copy code
Selection.PageSetup.OtherPagesTray = wdPrinterLowerBin

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.PageHeight Property (Word)

 Copy code hover
[image]

PageSetup.PageHeight Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the height of the page in points. Read/write Single.

Syntax

expression .PageHeight

expression An expression that returns a PageSetup object.

Remarks

Setting the PageHeight property changes the PaperSize property to wdPaperCustom. Use the PaperSize property to set the page height and width to those of a predefined paper size, such as Letter or A4.

Example

This example sets the page height for the active document to 9 inches.

VBA Copy code Copy code
With ActiveDocument.PageSetup
 .PageHeight = InchesToPoints(9)
 .PageWidth = InchesToPoints(7)
End With

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.PageWidth Property (Word)

 Copy code hover
[image]

PageSetup.PageWidth Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the width of the page in points. Read/write Single.

Syntax

expression .PageWidth

expression An expression that returns a PageSetup object.

Remarks

Setting the PageWidth property changes the PaperSize property to wdPaperCustom. Use the PaperSize property to set the page height and width to those of a predefined paper size, such as Letter or A4.

Example

This example returns the page width for Document1. The PointsToInches method is used to convert points to inches.

VBA Copy code Copy code
Set doc1set = Documents("Document1").PageSetup
Msgbox "The page width is " _
 & PointsToInches(doc1set.PageWidth) & " inches."

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.PaperSize Property (Word)

 Copy code hover
[image]

PageSetup.PaperSize Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the paper size. Read/write WdPaperSize.

Syntax

expression .PaperSize

expression Required. A variable that represents a PageSetup object.

Remarks

Setting the PageHeight or PageWidth property changes the PaperSize property to wdPaperCustom.

Example

This example sets the paper size to legal for the first document.

VBA Copy code Copy code
Documents(1).PageSetup.PaperSize = wdPaperLegal

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.Parent Property (Word)

 Copy code hover
[image]

PageSetup.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified PageSetup object.

Syntax

expression .Parent

expression Required. A variable that represents a PageSetup object.

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.RightMargin Property (Word)

 Copy code hover
[image]

PageSetup.RightMargin Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the distance (in points) between the right edge of the page and the right boundary of the body text. Read/write Single.

Syntax

expression .RightMargin

expression A variable that represents a PageSetup object.

Remarks

If the MirrorMargins property is set to True, the RightMargin property controls the setting for outside margins and the LeftMargin property controls the setting for inside margins.

Example

This example displays the right margin setting for the active document. The PointsToInches method is used to convert the result to inches.

VBA Copy code Copy code
With ActiveDocument.PageSetup
 Msgbox "The right margin is set to " _
 & PointsToInches(.RightMargin) & " inches."
End With

This example sets the right margin for section two in the selection. The InchesToPoints method is used to convert inches to points.

VBA Copy code Copy code
Selection.Sections(2).PageSetup.RightMargin = InchesToPoints(1)

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.SectionDirection Property (Word)

 Copy code hover
[image]

PageSetup.SectionDirection Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the reading order and alignment for the specified sections. Read/write WdSectionDirection.

Syntax

expression .SectionDirection

expression Required. A variable that represents a PageSetup object.

Example

This example sets the direction of the first section in the active document to right-to-left.

VBA Copy code Copy code
ActiveDocument.Sections(1).PageSetup.SectionDirection = _
 wdSectionDirectionRtl

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.SectionStart Property (Word)

 Copy code hover
[image]

PageSetup.SectionStart Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the type of section break for the specified object. Read/write WdSectionStart.

Syntax

expression .SectionStart

expression Required. A variable that represents a PageSetup object.

Example

This example changes the type of section break to continuous for all sections in the active document.

VBA Copy code Copy code
ActiveDocument.PageSetup.SectionStart = wdSectionContinuous

This example returns the type of section break used at the beginning of the second section in MyDoc.doc and applies it to all the sections in the active document.

VBA Copy code Copy code
mytype = Documents("MyDoc.doc").Sections(2).PageSetup.SectionStart
ActiveDocument.PageSetup.SectionStart = mytype

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.ShowGrid Property (Word)

 Copy code hover
[image]

PageSetup.ShowGrid Property (Word)
See also Send feedback

Published: July 16, 2012

True to display the page grid. False to hide it. Read/write Boolean.

Version information

Version Added: Word 2010

Syntax

expression .ShowGrid

expression A variable that represents a PageSetup object.

Property value

BOOL

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.SuppressEndnotes Property (Word)

 Copy code hover
[image]

PageSetup.SuppressEndnotes Property (Word)
See also Send feedback

Published: July 16, 2012

True if endnotes are printed at the end of the next section that doesn't suppress endnotes. Read/write Long.

Syntax

expression .SuppressEndnotes

expression An expression that returns a PageSetup object.

Remarks

Suppressed endnotes are printed before the endnotes in that section. This property takes effect only if the Location property is set to wdEndOfSection.

Example

This example suppresses endnotes in the first section of the active document.

VBA Copy code Copy code
If ActiveDocument.Endnotes.Location = wdEndOfSection Then
 ActiveDocument.Sections(1).PageSetup.SuppressEndnotes = True
End If

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.TextColumns Property (Word)

 Copy code hover
[image]

PageSetup.TextColumns Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a TextColumns collection that represents the set of text columns for the specified PageSetup object.

Syntax

expression .TextColumns

expression An expression that returns a PageSetup object.

Remarks

There will always be at least one text column in the collection. When you create new text columns, you are adding to a collection of one column.

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example creates four evenly-spaced text columns that are applied to section two in the active document.

VBA Copy code Copy code
With ActiveDocument.Sections(2).PageSetup.TextColumns
 .SetCount NumColumns:=3
 .Add EvenlySpaced:=True
End With

This example creates a document with two text columns. The first column is 1.5 inches wide and the second is 3 inches wide.

VBA Copy code Copy code
Set myDoc = Documents.Add
With myDoc.PageSetup.TextColumns
 .SetCount NumColumns:=1
 .Add Width:=InchesToPoints(3)
End With
With myDoc.PageSetup.TextColumns(1)
 .Width = InchesToPoints(1.5)
 .SpaceAfter = InchesToPoints(0.5)
End With

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.TopMargin Property (Word)

 Copy code hover
[image]

PageSetup.TopMargin Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the distance (in points) between the top edge of the page and the top boundary of the body text. Read/write Single.

Syntax

expression .TopMargin

expression Required. A variable that represents a PageSetup object.

Example

This example sets the top margin to 72 points (1 inch) for the first section in the active document.

VBA Copy code Copy code
ActiveDocument.Sections(1).PageSetup.TopMargin = 72

This example creates a new custom label and sets several properties, including the top margin, and then it creates a new document using the custom labels.

VBA Copy code Copy code
Set newlbl = Application.MailingLabel. _
 CustomLabels.Add(Name:="My Label")
With newlbl
 .Height = InchesToPoints(1.25)
 .NumberAcross = 2
 .NumberDown = 7
 .PageSize = wdCustomLabelLetter
 .SideMargin = InchesToPoints(0)
 .TopMargin = InchesToPoints(1)
 .Width = InchesToPoints(4.25)
End With
Application.MailingLabel.CreateNewDocument Name:="My Label"

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.TwoPagesOnOne Property (Word)

 Copy code hover
[image]

PageSetup.TwoPagesOnOne Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word prints the specified document two pages per sheet. Read/write Boolean.

Syntax

expression .TwoPagesOnOne

expression An expression that returns a PageSetup object.

Example

This example sets Microsoft Word to print the active document two pages per sheet.

VBA Copy code Copy code
ActiveDocument.PageSetup.TwoPagesOnOne = True

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.VerticalAlignment Property (Word)

 Copy code hover
[image]

PageSetup.VerticalAlignment Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the vertical alignment of text on each page in a document or section. Read/write WdVerticalAlignment.

Syntax

expression .VerticalAlignment

expression Required. A variable that represents a PageSetup object.

Example

This example changes the vertical alignment of the first document so that the text is centered between the top and bottom margins.

VBA Copy code Copy code
Documents(1).PageSetup.VerticalAlignment = wdAlignVerticalCenter

This example creates a new document and then inserts the same paragraph 10 times. The vertical alignment of the new document is then set so that the 10 paragraphs are equally spaced (justified) between the top and bottom margins.

VBA Copy code Copy code
Set myDoc = Documents.Add
With myDoc.Content
 For i = 1 to 9
 .InsertAfter "This is a sentence."
 .InsertParagraphAfter
 Next i
 .InsertAfter "This is a sentence."
End With
myDoc.PageSetup.VerticalAlignment = wdAlignVerticalJustify

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup Methods (Word)

 Copy code hover
[image]

PageSetup Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
SetAsTemplateDefault | Sets the specified page setup formatting as the default for the active document and all new documents based on the active template.
TogglePortrait | Switches between portrait and landscape page orientations for a document or section.


PageSetup.SetAsTemplateDefault Method (Word)

 Copy code hover
[image]

PageSetup.SetAsTemplateDefault Method (Word)
See also Send feedback

Published: July 16, 2012

Sets the specified page setup formatting as the default for the active document and all new documents based on the active template.

Syntax

expression .SetAsTemplateDefault

expression Required. A variable that represents a PageSetup object.

Example

This example changes the left and right margin settings for the active document and then sets the page setup formatting as the default.

VBA Copy code Copy code
With ActiveDocument.PageSetup
 .LeftMargin = InchesToPoints(1)
 .RightMargin = InchesToPoints(1)
 .SetAsTemplateDefault
End With

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


PageSetup.TogglePortrait Method (Word)

 Copy code hover
[image]

PageSetup.TogglePortrait Method (Word)
See also Send feedback

Published: July 16, 2012

Switches between portrait and landscape page orientations for a document or section.

Syntax

expression .TogglePortrait

expression Required. A variable that represents a PageSetup object.

Remarks

If the specified sections have different page orientations, an error occurs.

Example

This example changes the page orientation for the active document.

VBA Copy code Copy code
ActiveDocument.PageSetup.TogglePortrait

This example changes the page orientation for all the sections in the selection. If the initial orientation of each section is not the same as the orientation of the other sections, an error occurs.

VBA Copy code Copy code
Selection.PageSetup.TogglePortrait

See also

Concepts

PageSetup Object

Other resources

PageSetup Object Members


Pane Object (Word)

 Copy code hover
[image]

Pane Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a window pane. The Pane object is a member of the Panes collection. The Panes collection includes all the window panes for a single window.

Remarks

Use Panes(Index), where Index is the index number, to return a single Pane object. The following example closes the active pane.

VBA Copy code Copy code
If ActiveDocument.ActiveWindow.Panes.Count >= 2 Then _
 ActiveDocument.ActiveWindow.ActivePane.Close

Use the Add method or the Split property to add a window pane. The following example splits the active window at 20 percent of the current window size.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.Panes.Add SplitVertical:=20

The following example splits the active window in half.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.Split = True

You can use the SplitSpecial property to show comments, footnotes, or endnotes in a separate pane.

A window has more than one pane if the window is split or the view is not print layout view and information such as footnotes or comments are displayed. The following example displays the comments pane in normal view and then prompts to close the pane.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.View.Type = wdNormalView
If ActiveDocument.Comments.Count >= 1 Then
 ActiveDocument.ActiveWindow.View.SplitSpecial = wdPaneComments
 response = _
 MsgBox("Do you want to close the comments pane?", vbYesNo)
 If response = vbYes Then _
 ActiveDocument.ActiveWindow.ActivePane.Close
End If

See also

Concepts

Word Object Model Reference

Other resources

Pane Object Members


Pane Members (Word)

 Copy code hover
[image]

Pane Members (Word)
Send feedback

Published: July 16, 2012

Represents a window pane. The Pane object is a member of the Panes collection. The Panes collection includes all the window panes for a single window.

Methods

Name | Description
Activate | Activates the specified pane.
AutoScroll | Scrolls automatically through the specified pane.
Close | Closes the specified Mail Merge data source, pane, or task.
LargeScroll | Scrolls a window or pane by the specified number of screens.
NewFrameset | Creates a new frames page based on the specified pane.
PageScroll | Scrolls through the specified window page by page.
SmallScroll | Scrolls a window by the specified number of lines.
TOCInFrameset | Creates a table of contents based on the specified document and puts it in a new frame on the left side of the frames page.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
BrowseWidth | Returns the width (in points) of the area in which text wraps in the specified pane. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
DisplayRulers | True if rulers are displayed for the specified pane. Read/write Boolean.
DisplayVerticalRuler | True if a vertical ruler is displayed for the specified pane. Read/write Boolean.
Document | Returns a Document object associated with the specified pane. Read-only.
Frameset | Returns a Frameset object that represents an entire frames page or a single frame on a frames page. Read-only.
HorizontalPercentScrolled | Returns or sets the horizontal scroll position as a percentage of the document width. Read/write Long.
Index | Returns a Long that represents the position of an item in a collection. Read-only.
MinimumFontSize | Returns or sets the minimum font size (in points) displayed for the specified pane. Read/write Long.
Next | Returns a Pane object that represents the next document pane in the collection. Read-only.
Pages | Returns a Pages collection that represents the pages in a document.
Parent | Returns an Object that represents the parent object of the specified Pane object.
Previous | Returns a Pane object that represents the previous document pane in the collection. Read-only.
Selection | Returns the Selection object that represents a selection or the insertion point within a document pane. Read-only.
VerticalPercentScrolled | Returns or sets the vertical scroll position as a percentage of the document length. Read/write Long.
View | Returns a View object that represents the view for the specified pane.
Zooms | Returns a Zooms collection that represents the magnification options for each view (such as normal view, outline view or print layout view).


Pane Properties (Word)

 Copy code hover
[image]

Pane Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
BrowseWidth | Returns the width (in points) of the area in which text wraps in the specified pane. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
DisplayRulers | True if rulers are displayed for the specified pane. Read/write Boolean.
DisplayVerticalRuler | True if a vertical ruler is displayed for the specified pane. Read/write Boolean.
Document | Returns a Document object associated with the specified pane. Read-only.
Frameset | Returns a Frameset object that represents an entire frames page or a single frame on a frames page. Read-only.
HorizontalPercentScrolled | Returns or sets the horizontal scroll position as a percentage of the document width. Read/write Long.
Index | Returns a Long that represents the position of an item in a collection. Read-only.
MinimumFontSize | Returns or sets the minimum font size (in points) displayed for the specified pane. Read/write Long.
Next | Returns a Pane object that represents the next document pane in the collection. Read-only.
Pages | Returns a Pages collection that represents the pages in a document.
Parent | Returns an Object that represents the parent object of the specified Pane object.
Previous | Returns a Pane object that represents the previous document pane in the collection. Read-only.
Selection | Returns the Selection object that represents a selection or the insertion point within a document pane. Read-only.
VerticalPercentScrolled | Returns or sets the vertical scroll position as a percentage of the document length. Read/write Long.
View | Returns a View object that represents the view for the specified pane.
Zooms | Returns a Zooms collection that represents the magnification options for each view (such as normal view, outline view or print layout view).


Pane.Application Property (Word)

 Copy code hover
[image]

Pane.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a Pane object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

Pane Object

Other resources

Pane Object Members


Pane.BrowseWidth Property (Word)

 Copy code hover
[image]

Pane.BrowseWidth Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the width (in points) of the area in which text wraps in the specified pane. Read-only Long.

Syntax

expression .BrowseWidth

expression A variable that represents a Pane object.

Remarks

This property works only when you are in Web layout view.

See also

Concepts

Pane Object

Other resources

Pane Object Members


Pane.Creator Property (Word)

 Copy code hover
[image]

Pane.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a Pane object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Pane Object

Other resources

Pane Object Members


Pane.DisplayRulers Property (Word)

 Copy code hover
[image]

Pane.DisplayRulers Property (Word)
See also Send feedback

Published: July 16, 2012

True if rulers are displayed for the specified pane. Read/write Boolean.

Syntax

expression .DisplayRulers

expression A variable that represents a Pane object.

Remarks

The DisplayRulers property is equivalent to the Ruler command on the View menu. If DisplayRulers is False, the horizontal and vertical rulers won't be displayed, regardless of the state of the DisplayVerticalRuler property.

Example

This example switches the active pane to print layout view and displays the horizontal and vertical rulers.

VBA Copy code Copy code
With ActiveDocument.ActiveWindow.ActivePane
 .View.Type = wdPrintView
 .DisplayRulers = True
 .DisplayVerticalRuler = True
End With

See also

Concepts

Pane Object

Other resources

Pane Object Members


Pane.DisplayVerticalRuler Property (Word)

 Copy code hover
[image]

Pane.DisplayVerticalRuler Property (Word)
See also Send feedback

Published: July 16, 2012

True if a vertical ruler is displayed for the specified pane. Read/write Boolean.

Syntax

expression .DisplayVerticalRuler

expression A variable that represents a Pane object.

Remarks

A vertical ruler appears only in print layout view, and only if the DisplayRulers property is set to True.

Example

This example switches the active pane to print layout view and displays the horizontal and vertical rulers.

VBA Copy code Copy code
With ActiveDocument.ActiveWindow.ActivePane
 .View.Type = wdPrintView
 .DisplayRulers = True
 .DisplayVerticalRuler = True
End With

See also

Concepts

Pane Object

Other resources

Pane Object Members


Pane.Document Property (Word)

 Copy code hover
[image]

Pane.Document Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Document object associated with the specified pane. Read-only.

Syntax

expression .Document

expression A variable that represents a Pane object.

See also

Concepts

Pane Object

Other resources

Pane Object Members


Pane.Frameset Property (Word)

 Copy code hover
[image]

Pane.Frameset Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Frameset object that represents an entire frames page or a single frame on a frames page. Read-only.

Syntax

expression .Frameset

expression A variable that represents a Pane object.

Remarks

For more information on creating frames pages, see Creating frames pages.

Example

This example adds a new frame to the immediate right of the specified frame.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.ActivePane.Frameset _
 .AddNewFrame wdFramesetNewRight

See also

Concepts

Pane Object

Other resources

Pane Object Members


Pane.HorizontalPercentScrolled Property (Word)

 Copy code hover
[image]

Pane.HorizontalPercentScrolled Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the horizontal scroll position as a percentage of the document width. Read/write Long.

Syntax

expression .HorizontalPercentScrolled

expression A variable that represents a Pane object.

Example

This example horizontally scrolls the active pane of the window for Document1 all the way to the left.

VBA Copy code Copy code
With Windows("Document1")
 .Activate
 .ActivePane.HorizontalPercentScrolled = 0
End With

See also

Concepts

Pane Object

Other resources

Pane Object Members


Pane.Index Property (Word)

 Copy code hover
[image]

Pane.Index Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the position of an item in a collection. Read-only.

Syntax

expression .Index

expression Required. A variable that represents a Pane object.

See also

Concepts

Pane Object

Other resources

Pane Object Members


Pane.MinimumFontSize Property (Word)

 Copy code hover
[image]

Pane.MinimumFontSize Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the minimum font size (in points) displayed for the specified pane. Read/write Long.

Syntax

expression .MinimumFontSize

expression An expression that returns a Pane object.

Remarks

This property only affects the text as shown in Web layout view. The point sizes that are displayed on the Formatting toolbar and used for printing aren't changed.

Example

This example sets the active window to online view and then sets the minimum font size for the active pane to 12 points.

VBA Copy code Copy code
With ActiveDocument.ActiveWindow
 .View.Type = wdWebView
 .ActivePane.MinimumFontSize = 12
End With

This example returns the minimum font size for the active pane.

VBA Copy code Copy code
Msgbox _
 ActiveDocument.ActiveWindow.ActivePane.MinimumFontSize

See also

Concepts

Pane Object

Other resources

Pane Object Members


Pane.Next Property (Word)

 Copy code hover
[image]

Pane.Next Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Pane object that represents the next document pane in the collection. Read-only.

Syntax

expression .Next

expression A variable that represents a Pane object.

See also

Concepts

Pane Object

Other resources

Pane Object Members


Pane.Pages Property (Word)

 Copy code hover
[image]

Pane.Pages Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Pages collection that represents the pages in a document.

Syntax

expression .Pages

expression An expression that returns a Pane object.

Example

The following example creates a line 0.5 inch from the upper-left corner of the active document across the page to the lower-right corner of the page, 0.5 inch from the right and bottom edges of the page.

VBA Copy code Copy code
Dim objPage As Page

Set objPage = ActiveDocument.ActiveWindow.Panes(1).Pages(1)

'Add new line to document
ActiveDocument.Shapes.AddLine _
 InchesToPoints(0.5), _
 InchesToPoints(0.5), _
 objPage.Width - InchesToPoints(0.5), _
 objPage.Height - InchesToPoints(0.5)

See also

Concepts

Pane Object

Other resources

Pane Object Members


Pane.Parent Property (Word)

 Copy code hover
[image]

Pane.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Pane object.

Syntax

expression .Parent

expression Required. A variable that represents a Pane object.

See also

Concepts

Pane Object

Other resources

Pane Object Members


Pane.Previous Property (Word)

 Copy code hover
[image]

Pane.Previous Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Pane object that represents the previous document pane in the collection. Read-only.

Syntax

expression .Previous

expression A variable that represents a Pane object.

See also

Concepts

Pane Object

Other resources

Pane Object Members


Pane.Selection Property (Word)

 Copy code hover
[image]

Pane.Selection Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the Selection object that represents a selection or the insertion point within a document pane. Read-only.

Syntax

expression .Selection

expression A variable that represents a Pane object.

See also

Concepts

Pane Object

Other resources

Pane Object Members


Pane.VerticalPercentScrolled Property (Word)

 Copy code hover
[image]

Pane.VerticalPercentScrolled Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the vertical scroll position as a percentage of the document length. Read/write Long.

Syntax

expression .VerticalPercentScrolled

expression Required. A variable that represents a Pane object.

Example

This example vertically scrolls the active pane of the window for Document1 to the end.

VBA Copy code Copy code
With Windows("Document1")
 .Activate
 .ActivePane.VerticalPercentScrolled = 100
End With

See also

Concepts

Pane Object

Other resources

Pane Object Members


Pane.View Property (Word)

 Copy code hover
[image]

Pane.View Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a View object that represents the view for the specified pane.

Syntax

expression .View

expression Required. A variable that represents a Pane object.

Example

This example shows all nonprinting characters for panes associated with the first window in the Windows collection.

VBA Copy code Copy code
For Each myPane In Windows(1).Panes
 myPane.View.ShowAll = True
Next myPane

See also

Concepts

Pane Object

Other resources

Pane Object Members


Pane.Zooms Property (Word)

 Copy code hover
[image]

Pane.Zooms Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Zooms collection that represents the magnification options for each view (such as normal view, outline view or print layout view).

Syntax

expression .Zooms

expression An expression that returns a Pane object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example sets the magnification in normal view to 100 percent for each open window.

VBA Copy code Copy code
Dim wndLoop as Window

For Each wndLoop In Windows
 wndLoop.ActivePane.Zooms(wdNormalView).Percentage = 100
Next wndLoop

This example sets the magnification in print layout view so that an entire page is visible.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.Panes(1).Zooms(wdPrintView).PageFit = _
 wdPageFitFullPage

See also

Concepts

Pane Object

Other resources

Pane Object Members


Pane Methods (Word)

 Copy code hover
[image]

Pane Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Activate | Activates the specified pane.
AutoScroll | Scrolls automatically through the specified pane.
Close | Closes the specified Mail Merge data source, pane, or task.
LargeScroll | Scrolls a window or pane by the specified number of screens.
NewFrameset | Creates a new frames page based on the specified pane.
PageScroll | Scrolls through the specified window page by page.
SmallScroll | Scrolls a window by the specified number of lines.
TOCInFrameset | Creates a table of contents based on the specified document and puts it in a new frame on the left side of the frames page.


Pane.Activate Method (Word)

 Copy code hover
[image]

Pane.Activate Method (Word)
See also Send feedback

Published: July 16, 2012

Activates the specified pane.

Syntax

expression .Activate

expression Required. A variable that represents a Pane object.

Example

This example splits the active window and then activates the first pane.

VBA Copy code Copy code
Sub SplitWindow()
 With ActiveDocument.ActiveWindow
 .SplitVertical = 50
 .Panes(1).Activate
 End With
End Sub

See also

Concepts

Pane Object

Other resources

Pane Object Members


Pane.AutoScroll Method (Word)

 Copy code hover
[image]

Pane.AutoScroll Method (Word)
See also Send feedback

Published: July 16, 2012

Scrolls automatically through the specified pane.

Syntax

expression .AutoScroll(Velocity)

expression Required. A variable that represents a Pane object.

Parameters

Name | Required/Optional | Data Type | Description
Velocity | Required | Long | The speed for scrolling. Can be a number from - 100 through 100. Use - 100 for full-speed backward scrolling, and use 100 for full-speed forward scrolling.

Remarks

This method continues to run until you stop it manually by pressing a key or clicking the mouse.

Example

This example scrolls backward through the active window pane slowly.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.ActivePane.AutoScroll _
 Velocity:=-20

This example scrolls forward through the active window pane at full speed.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.ActivePane.AutoScroll _
 Velocity:=100

See also

Concepts

Pane Object

Other resources

Pane Object Members


Pane.Close Method (Word)

 Copy code hover
[image]

Pane.Close Method (Word)
See also Send feedback

Published: July 16, 2012

Closes the specified Mail Merge data source, pane, or task.

Syntax

expression .Close

expression Required. A variable that represents a Pane object.

Example

This example closes the active pane if the active window is split.

VBA Copy code Copy code
If ActiveDocument.ActiveWindow.Panes.Count >= 2 Then _
 ActiveDocument.ActiveWindow.ActivePane.Close

See also

Concepts

Pane Object

Other resources

Pane Object Members


Pane.LargeScroll Method (Word)

 Copy code hover
[image]

Pane.LargeScroll Method (Word)
See also Send feedback

Published: July 16, 2012

Scrolls a window or pane by the specified number of screens.

Syntax

expression .LargeScroll(Down, Up, ToRight, ToLeft)

expression Required. A variable that represents a Pane object.

Parameters

Name | Required/Optional | Data Type | Description
Down | Optional | Variant | The number of screens to scroll the window down.
Up | Optional | Variant | The number of screens to scroll the window up.
ToRight | Optional | Variant | The number of screens to scroll the window to the right.
ToLeft | Optional | Variant | The number of screens to scroll the window to the left.

Remarks

This method is equivalent to clicking just before or just after the scroll boxes on the horizontal and vertical scroll bars.

If Down and Up are both specified, the window is scrolled by the difference of the arguments. For example, if Down is 2 and Up is 4, the window is scrolled up two screens. Similarly, if ToLeft and ToRight are both specified, the window is scrolled by the difference of the arguments.

Any of these arguments can be a negative number. If no arguments are specified, the window is scrolled down one screen.

See also

Concepts

Pane Object

Other resources

Pane Object Members


Pane.NewFrameset Method (Word)

 Copy code hover
[image]

Pane.NewFrameset Method (Word)
See also Send feedback

Published: July 16, 2012

Creates a new frames page based on the specified pane.

Syntax

expression .NewFrameset

expression Required. A variable that represents a Pane object.

Remarks

For more information on creating frames pages, see Creating frames pages.

Example

This example opens a document named "Temp.doc" and then creates a new frames page whose only frame contains "Temp.doc".

VBA Copy code Copy code
Documents.Open "C:\Documents\Temp.doc"
ActiveDocument.ActiveWindow.ActivePane.NewFrameset

See also

Concepts

Pane Object

Other resources

Pane Object Members


Pane.PageScroll Method (Word)

 Copy code hover
[image]

Pane.PageScroll Method (Word)
See also Send feedback

Published: July 16, 2012

Scrolls through the specified window page by page.

Syntax

expression .PageScroll(Down, Up)

expression Required. A variable that represents a Pane object.

Parameters

Name | Required/Optional | Data Type | Description
Down | Optional | Variant | The number of pages to be scrolled down. If this argument is omitted, this value is assumed to be 1.
Up | Optional | Variant | The number of pages to be scrolled up.

Remarks

The PageScroll method is available only if you are in print layout view or Web layout view. This method does not affect the position of the insertion point.

If Down and Up are both specified, the window is scrolled by the difference of the arguments. For example, if Down is 2 and Up is 4, the window is scrolled up two pages.

Example

This example scrolls up one page in the active pane.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.View.Type = wdPrintView
ActiveDocument.ActiveWindow.ActivePane.PageScroll Up:=1

See also

Concepts

Pane Object

Other resources

Pane Object Members


Pane.SmallScroll Method (Word)

 Copy code hover
[image]

Pane.SmallScroll Method (Word)
See also Send feedback

Published: July 16, 2012

Scrolls a window by the specified number of lines.

Syntax

expression .SmallScroll(Down, Up, ToRight, ToLeft)

expression Required. A variable that represents a Pane object.

Parameters

Name | Required/Optional | Data Type | Description
Down | Optional | Variant | The number of lines to scroll the window down. A "line" corresponds to the distance scrolled by clicking the down scroll arrow on the vertical scroll bar once.
Up | Optional | Variant | The number of lines to scroll the window up. A "line" corresponds to the distance scrolled by clicking the up scroll arrow on the vertical scroll bar once.
ToRight | Optional | Variant | The number of lines to scroll the window to the right. A "line" corresponds to the distance scrolled by clicking the right scroll arrow on the horizontal scroll bar once.
ToLeft | Optional | Variant | The number of lines to scroll the window to the left. A "line" corresponds to the distance scrolled by clicking the left scroll arrow on the horizontal scroll bar once.

Remarks

This method is equivalent to clicking the scroll arrows on the horizontal and vertical scroll bars.

If Down and Up are both specified, the window is scrolled by the difference of the arguments. For example, if Down is 3 and Up is 6, the window is scrolled up three lines. Similarly, if ToLeft and ToRight are both specified, the window is scrolled by the difference of the arguments.

Any of these arguments can be a negative number. If no arguments are specified, the window is scrolled down by one line.

See also

Concepts

Pane Object

Other resources

Pane Object Members


Pane.TOCInFrameset Method (Word)

 Copy code hover
[image]

Pane.TOCInFrameset Method (Word)
See also Send feedback

Published: July 16, 2012

Creates a table of contents based on the specified document and puts it in a new frame on the left side of the frames page.

Syntax

expression .TOCInFrameset

expression Required. A variable that represents a Pane object.

Remarks

For more information on creating frames pages, see Creating frames pages.

Example

This example opens a file named "Proposal.doc", creates a frames page based on the file, and adds a frame (on the left side of the page) containing a table of contents for the file.

VBA Copy code Copy code
Documents.Open "C:\Documents\Proposal.doc"
ActiveDocument.ActiveWindow.ActivePane.NewFrameset
ActiveDocument.ActiveWindow.ActivePane.TOCInFrameset

See also

Concepts

Pane Object

Other resources

Pane Object Members


Panes Object (Word)

 Copy code hover
[image]

Panes Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of Pane objects that represent the window panes for a single window.

Remarks

Use the Panes property to return the Panes collection. The following example splits the active window and hides the ruler for each pane.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.Split = True
For Each aPane In ActiveDocument.ActiveWindow.Panes
 aPane.DisplayRulers = False
Next aPane

Use the Add method or the Split property to add a window pane. The following example splits the active window at 20 percent of the current window size.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.Panes.Add SplitVertical:=20

The following example splits the active window in half.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.Split = True

You can use the SplitSpecial property to show comments, footnotes, or endnotes in a separate pane.

A window has more than one pane if it is split, or if the active view isn't print layout view and information such as footnotes or comments is displayed. The following example displays the footnote pane in normal view and then prompts the user to close the pane.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.View.Type = wdNormalView
If ActiveDocument.Footnotes.Count >= 1 Then
 ActiveDocument.ActiveWindow.View.SplitSpecial = wdPaneFootnotes
 response = _
 MsgBox("Do you want to close the footnotes pane?", vbYesNo)
 If response = vbYes Then _
 ActiveDocument.ActiveWindow.ActivePane.Close
End If

See also

Concepts

Word Object Model Reference

Other resources

Panes Object Members


Panes Members (Word)

 Copy code hover
[image]

Panes Members (Word)
Send feedback

Published: July 16, 2012

A collection of Pane objects that represent the window panes for a single window.

Methods

Name | Description
Add | Returns a Pane object that represents a new pane to a window.
Item | Returns the specified pane as a Pane object.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of panes in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified Panes object.


Panes Properties (Word)

 Copy code hover
[image]

Panes Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of panes in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified Panes object.


Panes.Application Property (Word)

 Copy code hover
[image]

Panes.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a Panes collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

Panes Collection Object

Other resources

Panes Object Members


Panes.Count Property (Word)

 Copy code hover
[image]

Panes.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of panes in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents a Panes collection.

See also

Concepts

Panes Collection Object

Other resources

Panes Object Members


Panes.Creator Property (Word)

 Copy code hover
[image]

Panes.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a Panes collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Panes Collection Object

Other resources

Panes Object Members


Panes.Parent Property (Word)

 Copy code hover
[image]

Panes.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Panes object.

Syntax

expression .Parent

expression Required. A variable that represents a Panes collection.

See also

Concepts

Panes Collection Object

Other resources

Panes Object Members


Panes Methods (Word)

 Copy code hover
[image]

Panes Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Returns a Pane object that represents a new pane to a window.
Item | Returns the specified pane as a Pane object.


Panes.Add Method (Word)

 Copy code hover
[image]

Panes.Add Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a Pane object that represents a new pane to a window.

Syntax

expression .Add(SplitVertical)

expression Required. A variable that represents a Panes collection.

Parameters

Name | Required/Optional | Data Type | Description
SplitVertical | Optional | Variant | A number that represents the percentage of the window, from top to bottom, you want to appear above the split.

Return Value

Pane

Remarks

This method will fail if it is applied to a window that has already been split.

Example

The following example splits the active window such that the top pane is 30 percent of the total window size.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.Panes.Add SplitVertical:=30

See also

Concepts

Panes Collection Object

Other resources

Panes Object Members


Panes.Item Method (Word)

 Copy code hover
[image]

Panes.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns the specified pane as a Pane object.

Syntax

expression .Item(Index)

expression Required. A variable that represents a Panes collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The individual object to be returned. Can be a Long indicating the ordinal position of the individual object.

Return Value

Pane

See also

Concepts

Panes Collection Object

Other resources

Panes Object Members


Paragraph Object (Word)

 Copy code hover
[image]

Paragraph Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a single paragraph in a selection, range, or document. The Paragraph object is a member of the Paragraphs collection. The Paragraphs collection includes all the paragraphs in a selection, range, or document.

Remarks

Use Paragraphs(Index), where Index is the index number, to return a single Paragraph object. The following example right aligns the first paragraph in the active document.

VBA Copy code Copy code
ActiveDocument.Paragraphs(1).Alignment = wdAlignParagraphRight

Use the Add, InsertParagraph, InsertParagraphAfter, or InsertParagraphBefore method to add a new, blank paragraph to a document. The following example adds a paragraph mark before the first paragraph in the selection.

VBA Copy code Copy code
Selection.Paragraphs.Add Range:=Selection.Paragraphs(1).Range

The following example also adds a paragraph mark before the first paragraph in the selection.

VBA Copy code Copy code
Selection.Paragraphs(1).Range.InsertParagraphBefore

See also

Concepts

Word Object Model Reference

Other resources

Paragraph Object Members


Paragraph Members (Word)

 Copy code hover
[image]

Paragraph Members (Word)
Send feedback

Published: July 16, 2012

Represents a single paragraph in a selection, range, or document. The Paragraph object is a member of the Paragraphs collection. The Paragraphs collection includes all the paragraphs in a selection, range, or document.

Methods

Name | Description
CloseUp | Removes any spacing before the specified paragraph.
Indent | Indents one or more paragraphs by one level.
IndentCharWidth | Indents a paragraphs by a specified number of characters.
IndentFirstLineCharWidth | Indents the first line of one or more paragraphs by a specified number of characters.
JoinList | Joins a list paragraph with the closest list above or below the specified paragraph.
ListAdvanceTo | Sets the list levels for a paragraph in a list.
Next | Returns a Paragraph object that represents the next paragraph.
OpenOrCloseUp | Toggles the spacing before a paragraph.
OpenUp | Sets spacing before the specified paragraphs to 12 points.
Outdent | Removes one level of indent for one or more paragraphs.
OutlineDemote | Applies the next heading level style (Heading 1 through Heading 8) to the specified paragraph or paragraphs.
OutlineDemoteToBody | Demotes the specified paragraph to body text by applying the Normal style.
OutlinePromote | Applies the previous heading level style (Heading 1 through Heading 8) to the specified paragraph or paragraphs.
Previous | Returns the previous paragraph as a Paragraph object.
Reset | Removes manual paragraph formatting (formatting not applied using a style).
ResetAdvanceTo | Resets a paragraph that uses custom list levels to the original level settings.
SelectNumber | Selects the number or bullet in a list.
SeparateList | Separates a list into two separate lists. For numbered lists, the new list restarts numbering at the starting number, usually 1.
Space1 | Single-spaces the specified paragraphs.
Space15 | Formats the specified paragraphs with 1.5-line spacing.
Space2 | Double-spaces the specified paragraphs.
TabHangingIndent | Sets a hanging indent to a specified number of tab stops. .
TabIndent | Sets the left indent for the specified paragraphs to a specified number of tab stops. .

Properties

Name | Description
AddSpaceBetweenFarEastAndAlpha | True if Microsoft Word is set to automatically add spaces between Japanese and Latin text for the specified paragraphs. This property returns wdUndefined if it's set to True for only some of the specified paragraphs. Read/write Long.
AddSpaceBetweenFarEastAndDigit | True if Microsoft Word is set to automatically add spaces between Japanese text and numbers for the specified paragraphs. This property returns wdUndefined if it's set to True for only some of the specified paragraphs. Read/write Long.
Alignment | Returns or sets a WdParagraphAlignment constant that represents the alignment for the specified paragraphs. Read/write.
Application | Returns an Application object that represents the Microsoft Word application.
AutoAdjustRightIndent | True if Microsoft Word is set to automatically adjust the right indent for the specified paragraphs if you've specified a set number of characters per line. Returns wdUndefined if the AutoAdjustRightIndent property is set to True for only some of the specified paragraphs. Read/write Long.
BaseLineAlignment | Returns or sets a WdBaselineAlignment constant that represents the vertical position of fonts on a line. Read/write.
Borders | Returns a Borders collection that represents all the borders for the specified paragraph.
CharacterUnitFirstLineIndent | Returns or sets the value (in characters) for a first-line or hanging indent. Use a positive value to set a first-line indent, and use a negative value to set a hanging indent. Read/write Single.
CharacterUnitLeftIndent | Returns or sets the left indent value (in characters) for the specified paragraphs. Read/write Single.
CharacterUnitRightIndent | Returns or sets the right indent value (in characters) for the specified paragraphs. Read/write Single.
CollapsedState | Returns or sets whether the specified paragraph is currently in a collapsed state. Read-write Boolean.
CollapseHeadingByDefault | Returns or sets whether the specified paragraph is collapsed by default when the document loads. Read-write Boolean.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
DisableLineHeightGrid | True if Microsoft Word aligns characters in the specified paragraphs to the line grid when a set number of lines per page is specified. Returns wdUndefined if the DisableLineHeightGrid property is set to True for only some of the specified paragraphs. Read/write Long.
DropCap | Returns a DropCap object that represents a dropped capital letter for the specified paragraph. Read-only.
FarEastLineBreakControl | True if Microsoft Word applies East Asian line-breaking rules to the specified paragraphs. Returns wdUndefined if the FarEastLineBreakControl property is set to True for only some of the specified paragraphs. Read/write Long.
FirstLineIndent | Returns or sets the value (in points) for a first line or hanging indent. Use a positive value to set a first-line indent, and use a negative value to set a hanging indent. Read/write Single.
Format | Returns or sets a ParagraphFormat object that represents the formatting of the specified paragraph or paragraphs.
HalfWidthPunctuationOnTopOfLine | True if Microsoft Word changes punctuation symbols at the beginning of a line to half-width characters for the specified paragraphs. This property returns wdUndefined if it's set to True for only some of the specified paragraphs. Read/write Long.
HangingPunctuation | True if hanging punctuation is enabled for the specified paragraphs. This property returns wdUndefined if it's set to True for only some of the specified paragraphs. Read/write Long.
Hyphenation | True if the specified paragraphs are included in automatic hyphenation. False if the specified paragraphs are to be excluded from automatic hyphenation. Read/write Long.
ID | Returns or sets the identifying label for the specified object when the current document is saved as a Web page. Read/write String.
IsStyleSeparator | True if a paragraph contains a special hidden paragraph mark that allows Microsoft Word to appear to join paragraphs of different paragraph styles. Read-only Boolean.
KeepTogether | True if all lines in the specified paragraph remain on the same page when Microsoft Word repaginates the document. Read/write Long.
KeepWithNext | True if the specified paragraph remains on the same page as the paragraph that follows it when Microsoft Word repaginates the document. Read/write Long.
LeftIndent | Returns or sets a Single that represents the left indent value (in points) for the specified paragraph. Read/write.
LineSpacing | Returns or sets the line spacing (in points) for the specified paragraphs. Read/write Single.
LineSpacingRule | Returns or sets the line spacing for the specified paragraph. Read/write WdLineSpacing.
LineUnitAfter | Returns or sets the amount of spacing (in gridlines) after the specified paragraph. Read/write Single.
LineUnitBefore | Returns or sets the amount of spacing (in gridlines) before the specified paragraph. Read/write Single.
ListNumberOriginal | Returns an Integer that represents the original list level for a paragraph. Read-only.
MirrorIndents | Returns or sets a Long that represents whether left and right indents are the same width. Can be True, False, or wdUndefined. Read/write.
NoLineNumber | True if line numbers are repressed for the specified paragraph. Read/write Long.
OutlineLevel | Returns or sets the outline level for the specified paragraph. Read/write WdOutlineLevel.
PageBreakBefore | True if a page break is forced before the specified paragraphs. Read/write Long.
Parent | Returns an Object that represents the parent object of the specified Paragraph object.
Range | Returns a Range object that represents the portion of a document that is contained within the specified paragraph.
ReadingOrder | Returns or sets the reading order of the specified paragraph without changing the alignment. Read/write WdReadingOrder.
RightIndent | Returns or sets the right indent (in points) for the specified paragraph. Read/write Single.
Shading | Returns a Shading object that refers to the shading formatting for the specified paragraph.
SpaceAfter | Returns or sets the amount of spacing (in points) after the specified paragraph or text column. Read/write Single.
SpaceAfterAuto | True if Microsoft Word automatically sets the amount of spacing after the specified paragraphs. Read/write Long.
SpaceBefore | Returns or sets the spacing (in points) before the specified paragraphs. Read/write Single.
SpaceBeforeAuto | True if Microsoft Word automatically sets the amount of spacing before the specified paragraphs. Read/write Long.
Style | Returns or sets the style for the specified object. Read/write Variant.
TabStops | Returns or sets a TabStops collection that represents all the custom tab stops for the specified paragraph. Read/write.
TextboxTightWrap | Returns or sets a WdTextboxTightWrap constant that represents how tightly text wraps around shapes or text boxes. Read/write.
WidowControl | True if the first and last lines in the specified paragraph remain on the same page as the rest of the paragraph when Word repaginates the document. Read/write Long.
WordWrap | True if Microsoft Word wraps Latin text in the middle of a word in the specified paragraphs or text frames. Read/write Long.


Paragraph Properties (Word)

 Copy code hover
[image]

Paragraph Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
AddSpaceBetweenFarEastAndAlpha | True if Microsoft Word is set to automatically add spaces between Japanese and Latin text for the specified paragraphs. This property returns wdUndefined if it's set to True for only some of the specified paragraphs. Read/write Long.
AddSpaceBetweenFarEastAndDigit | True if Microsoft Word is set to automatically add spaces between Japanese text and numbers for the specified paragraphs. This property returns wdUndefined if it's set to True for only some of the specified paragraphs. Read/write Long.
Alignment | Returns or sets a WdParagraphAlignment constant that represents the alignment for the specified paragraphs. Read/write.
Application | Returns an Application object that represents the Microsoft Word application.
AutoAdjustRightIndent | True if Microsoft Word is set to automatically adjust the right indent for the specified paragraphs if you've specified a set number of characters per line. Returns wdUndefined if the AutoAdjustRightIndent property is set to True for only some of the specified paragraphs. Read/write Long.
BaseLineAlignment | Returns or sets a WdBaselineAlignment constant that represents the vertical position of fonts on a line. Read/write.
Borders | Returns a Borders collection that represents all the borders for the specified paragraph.
CharacterUnitFirstLineIndent | Returns or sets the value (in characters) for a first-line or hanging indent. Use a positive value to set a first-line indent, and use a negative value to set a hanging indent. Read/write Single.
CharacterUnitLeftIndent | Returns or sets the left indent value (in characters) for the specified paragraphs. Read/write Single.
CharacterUnitRightIndent | Returns or sets the right indent value (in characters) for the specified paragraphs. Read/write Single.
CollapsedState | Returns or sets whether the specified paragraph is currently in a collapsed state. Read-write Boolean.
CollapseHeadingByDefault | Returns or sets whether the specified paragraph is collapsed by default when the document loads. Read-write Boolean.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
DisableLineHeightGrid | True if Microsoft Word aligns characters in the specified paragraphs to the line grid when a set number of lines per page is specified. Returns wdUndefined if the DisableLineHeightGrid property is set to True for only some of the specified paragraphs. Read/write Long.
DropCap | Returns a DropCap object that represents a dropped capital letter for the specified paragraph. Read-only.
FarEastLineBreakControl | True if Microsoft Word applies East Asian line-breaking rules to the specified paragraphs. Returns wdUndefined if the FarEastLineBreakControl property is set to True for only some of the specified paragraphs. Read/write Long.
FirstLineIndent | Returns or sets the value (in points) for a first line or hanging indent. Use a positive value to set a first-line indent, and use a negative value to set a hanging indent. Read/write Single.
Format | Returns or sets a ParagraphFormat object that represents the formatting of the specified paragraph or paragraphs.
HalfWidthPunctuationOnTopOfLine | True if Microsoft Word changes punctuation symbols at the beginning of a line to half-width characters for the specified paragraphs. This property returns wdUndefined if it's set to True for only some of the specified paragraphs. Read/write Long.
HangingPunctuation | True if hanging punctuation is enabled for the specified paragraphs. This property returns wdUndefined if it's set to True for only some of the specified paragraphs. Read/write Long.
Hyphenation | True if the specified paragraphs are included in automatic hyphenation. False if the specified paragraphs are to be excluded from automatic hyphenation. Read/write Long.
ID | Returns or sets the identifying label for the specified object when the current document is saved as a Web page. Read/write String.
IsStyleSeparator | True if a paragraph contains a special hidden paragraph mark that allows Microsoft Word to appear to join paragraphs of different paragraph styles. Read-only Boolean.
KeepTogether | True if all lines in the specified paragraph remain on the same page when Microsoft Word repaginates the document. Read/write Long.
KeepWithNext | True if the specified paragraph remains on the same page as the paragraph that follows it when Microsoft Word repaginates the document. Read/write Long.
LeftIndent | Returns or sets a Single that represents the left indent value (in points) for the specified paragraph. Read/write.
LineSpacing | Returns or sets the line spacing (in points) for the specified paragraphs. Read/write Single.
LineSpacingRule | Returns or sets the line spacing for the specified paragraph. Read/write WdLineSpacing.
LineUnitAfter | Returns or sets the amount of spacing (in gridlines) after the specified paragraph. Read/write Single.
LineUnitBefore | Returns or sets the amount of spacing (in gridlines) before the specified paragraph. Read/write Single.
ListNumberOriginal | Returns an Integer that represents the original list level for a paragraph. Read-only.
MirrorIndents | Returns or sets a Long that represents whether left and right indents are the same width. Can be True, False, or wdUndefined. Read/write.
NoLineNumber | True if line numbers are repressed for the specified paragraph. Read/write Long.
OutlineLevel | Returns or sets the outline level for the specified paragraph. Read/write WdOutlineLevel.
PageBreakBefore | True if a page break is forced before the specified paragraphs. Read/write Long.
Parent | Returns an Object that represents the parent object of the specified Paragraph object.
Range | Returns a Range object that represents the portion of a document that is contained within the specified paragraph.
ReadingOrder | Returns or sets the reading order of the specified paragraph without changing the alignment. Read/write WdReadingOrder.
RightIndent | Returns or sets the right indent (in points) for the specified paragraph. Read/write Single.
Shading | Returns a Shading object that refers to the shading formatting for the specified paragraph.
SpaceAfter | Returns or sets the amount of spacing (in points) after the specified paragraph or text column. Read/write Single.
SpaceAfterAuto | True if Microsoft Word automatically sets the amount of spacing after the specified paragraphs. Read/write Long.
SpaceBefore | Returns or sets the spacing (in points) before the specified paragraphs. Read/write Single.
SpaceBeforeAuto | True if Microsoft Word automatically sets the amount of spacing before the specified paragraphs. Read/write Long.
Style | Returns or sets the style for the specified object. Read/write Variant.
TabStops | Returns or sets a TabStops collection that represents all the custom tab stops for the specified paragraph. Read/write.
TextboxTightWrap | Returns or sets a WdTextboxTightWrap constant that represents how tightly text wraps around shapes or text boxes. Read/write.
WidowControl | True if the first and last lines in the specified paragraph remain on the same page as the rest of the paragraph when Word repaginates the document. Read/write Long.
WordWrap | True if Microsoft Word wraps Latin text in the middle of a word in the specified paragraphs or text frames. Read/write Long.


Paragraph.AddSpaceBetweenFarEastAndAlpha Property (Word)

 Copy code hover
[image]

Paragraph.AddSpaceBetweenFarEastAndAlpha Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word is set to automatically add spaces between Japanese and Latin text for the specified paragraphs. This property returns wdUndefined if it's set to True for only some of the specified paragraphs. Read/write Long.

Syntax

expression .AddSpaceBetweenFarEastAndAlpha

expression A variable that represents a Paragraph object.

Example

This example sets Microsoft Word to automatically add spaces between Japanese and Latin text for the first paragraph in the active document.

VBA Copy code Copy code
ActiveDocument.Paragraphs(1).AddSpaceBetweenFarEastAndAlpha = True

See also

Concepts

Paragraph Object

Other resources

Paragraph Object Members


Paragraph.AddSpaceBetweenFarEastAndDigit Property (Word)

 Copy code hover
[image]

Paragraph.AddSpaceBetweenFarEastAndDigit Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word is set to automatically add spaces between Japanese text and numbers for the specified paragraphs. This property returns wdUndefined if it's set to True for only some of the specified paragraphs. Read/write Long.

Syntax

expression .AddSpaceBetweenFarEastAndDigit

expression A variable that represents a Paragraph object.

Example

This example sets Microsoft Word to automatically add spaces between Japanese text and numbers for the first paragraph in the active document.

VBA Copy code Copy code
ActiveDocument.Paragraphs(1).AddSpaceBetweenFarEastAndDigit = True

See also

Concepts

Paragraph Object

Other resources

Paragraph Object Members


Paragraph.Alignment Property (Word)

 Copy code hover
[image]

Paragraph.Alignment Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a WdParagraphAlignment constant that represents the alignment for the specified paragraphs. Read/write.

Syntax

expression .Alignment

expression Required. A variable that represents a Paragraph object.

Remarks

Some of the WdParagraphAlignment constants, depending on the language support (U.S. English, for example) that you've selected or installed.

Example

This example right-aligns the first paragraph in the active document.

VBA Copy code Copy code
Sub AlignParagraph()
 ActiveDocument.Paragraphs(1).Alignment = _
 wdAlignParagraphRight
End Sub

See also

Concepts

Paragraph Object

Other resources

Paragraph Object Members


Paragraph.Application Property (Word)

 Copy code hover
[image]

Paragraph.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a Paragraph object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

Paragraph Object

Other resources

Paragraph Object Members


Paragraph.AutoAdjustRightIndent Property (Word)

 Copy code hover
[image]

Paragraph.AutoAdjustRightIndent Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word is set to automatically adjust the right indent for the specified paragraphs if you've specified a set number of characters per line. Returns wdUndefined if the AutoAdjustRightIndent property is set to True for only some of the specified paragraphs. Read/write Long.

Syntax

expression .AutoAdjustRightIndent

expression A variable that represents a Paragraph object.

Example

This example sets Microsoft Word to automatically adjust the right indent for the selected paragraphs if you've specified a set number of characters per line.

VBA Copy code Copy code
With Selection.ParagraphFormat
 .AutoAdjustRightIndent = True
End With

See also

Concepts

Paragraph Object

Other resources

Paragraph Object Members


Paragraph.BaseLineAlignment Property (Word)

 Copy code hover
[image]

Paragraph.BaseLineAlignment Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a WdBaselineAlignment constant that represents the vertical position of fonts on a line. Read/write.

Syntax

expression .BaseLineAlignment

expression Required. A variable that represents a Paragraph object.

Example

This example sets Microsoft Word to automatically adjust the baseline font alignment in the active document.

VBA Copy code Copy code
ActiveDocument.BaseLineAlignment = wdBaselineAlignAuto

See also

Concepts

Paragraph Object

Other resources

Paragraph Object Members


Paragraph.Borders Property (Word)

 Copy code hover
[image]

Paragraph.Borders Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Borders collection that represents all the borders for the specified paragraph.

Syntax

expression .Borders

expression Required. A variable that represents a Paragraph object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

See also

Concepts

Paragraph Object

Other resources

Paragraph Object Members


Paragraph.CharacterUnitFirstLineIndent Property (Word)

 Copy code hover
[image]

Paragraph.CharacterUnitFirstLineIndent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the value (in characters) for a first-line or hanging indent. Use a positive value to set a first-line indent, and use a negative value to set a hanging indent. Read/write Single.

Syntax

expression .CharacterUnitFirstLineIndent

expression Required. A variable that represents a Paragraph object.

Example

This example sets a first-line indent of one character for the first paragraph in the active document.

VBA Copy code Copy code
ActiveDocument.Paragraphs(1) _
 .CharacterUnitFirstLineIndent = 1

This example sets a hanging indent of 1.5 characters for the second paragraph in the active document.

VBA Copy code Copy code
ActiveDocument.Paragraphs(2) _
 .CharacterUnitFirstLineIndent = -1.5

See also

Concepts

Paragraph Object

Other resources

Paragraph Object Members


Paragraph.CharacterUnitLeftIndent Property (Word)

 Copy code hover
[image]

Paragraph.CharacterUnitLeftIndent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the left indent value (in characters) for the specified paragraphs. Read/write Single.

Syntax

expression .CharacterUnitLeftIndent

expression Required. A variable that represents a Paragraph object.

Example

This example sets the left indent of the first paragraph in the active document to one character from the left margin.

VBA Copy code Copy code
ActiveDocument.Paragraphs(1) _
 .CharacterUnitLeftIndent = 1

See also

Concepts

Paragraph Object

Other resources

Paragraph Object Members


Paragraph.CharacterUnitRightIndent Property (Word)

 Copy code hover
[image]

Paragraph.CharacterUnitRightIndent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the right indent value (in characters) for the specified paragraphs. Read/write Single.

Syntax

expression .CharacterUnitRightIndent

expression Required. A variable that represents a Paragraph object.

Example

This example sets the right indent for all paragraphs in the active document to one character from the right margin.

VBA Copy code Copy code
ActiveDocument.Paragraphs _
 .CharacterUnitRightIndent = 1

See also

Concepts

Paragraph Object

Other resources

Paragraph Object Members


Paragraph.CollapsedState Property (Word)

 Copy code hover
[image]

Paragraph.CollapsedState Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets whether the specified paragraph is currently in a collapsed state. Read-write Boolean.

Version information

Version Added: Word 2013

Syntax

expression .CollapsedState

expression A variable that represents a Paragraph object.

Property value

BOOL

See also

Concepts

Paragraph Object

Other resources

Paragraph Members


Paragraph.CollapseHeadingByDefault Property (Word)

 Copy code hover
[image]

Paragraph.CollapseHeadingByDefault Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets whether the specified paragraph is collapsed by default when the document loads. Read-write Boolean.

Version information

Version Added: Word 2013

Syntax

expression .CollapseHeadingByDefault

expression A variable that represents a Paragraph object.

Property value

BOOL

See also

Concepts

Paragraph Object

Other resources

Paragraph Members


Paragraph.Creator Property (Word)

 Copy code hover
[image]

Paragraph.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a Paragraph object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Paragraph Object

Other resources

Paragraph Object Members


Paragraph.DisableLineHeightGrid Property (Word)

 Copy code hover
[image]

Paragraph.DisableLineHeightGrid Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word aligns characters in the specified paragraphs to the line grid when a set number of lines per page is specified. Returns wdUndefined if the DisableLineHeightGrid property is set to True for only some of the specified paragraphs. Read/write Long.

Syntax

expression .DisableLineHeightGrid

expression A variable that represents a Paragraph object.

Example

This example sets Microsoft Word to align characters in the selected paragraphs to the line grid if you've specified a set number of lines per page.

VBA Copy code Copy code
With Selection.ParagraphFormat
 .DisableLineHeightGrid = True
End With

See also

Concepts

Paragraph Object

Other resources

Paragraph Object Members


Paragraph.DropCap Property (Word)

 Copy code hover
[image]

Paragraph.DropCap Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a DropCap object that represents a dropped capital letter for the specified paragraph. Read-only.

Syntax

expression .DropCap

expression A variable that represents a Paragraph object.

Example

This example sets a dropped capital letter for the first paragraph in the active document.

VBA Copy code Copy code
With ActiveDocument.Paragraphs(1).DropCap
 .FontName = "Arial"
 .Position = wdDropNormal
 .LinesToDrop = 3
 .DistanceFromText = InchesToPoints(0.1)
End With

See also

Concepts

Paragraph Object

Other resources

Paragraph Object Members


Paragraph.FarEastLineBreakControl Property (Word)

 Copy code hover
[image]

Paragraph.FarEastLineBreakControl Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word applies East Asian line-breaking rules to the specified paragraphs. Returns wdUndefined if the FarEastLineBreakControl property is set to True for only some of the specified paragraphs. Read/write Long.

Syntax

expression .FarEastLineBreakControl

expression A variable that represents a Paragraph object.

Example

This example sets Word to apply East Asian line-breaking rules to the first paragraph in the active document.

VBA Copy code Copy code
ActiveDocument.Paragraphs(1).FarEastLineBreakControl = True

See also

Concepts

Paragraph Object

Other resources

Paragraph Object Members


Paragraph.FirstLineIndent Property (Word)

 Copy code hover
[image]

Paragraph.FirstLineIndent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the value (in points) for a first line or hanging indent. Use a positive value to set a first-line indent, and use a negative value to set a hanging indent. Read/write Single.

Syntax

expression .FirstLineIndent

expression A variable that represents a Paragraph object.

Example

This example sets a first-line indent of 1 inch for the first paragraph in the active document.

VBA Copy code Copy code
ActiveDocument.Paragraphs(1).FirstLineIndent = _
 InchesToPoints(1)

This example sets a hanging indent of 0.5 inch for the second paragraph in the active document. The InchesToPoints method is used to convert inches to points.

VBA Copy code Copy code
ActiveDocument.Paragraphs(2).FirstLineIndent = _
 InchesToPoints(-0.5)

See also

Concepts

Paragraph Object

Other resources

Paragraph Object Members


Paragraph.Format Property (Word)

 Copy code hover
[image]

Paragraph.Format Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a ParagraphFormat object that represents the formatting of the specified paragraph or paragraphs.

Syntax

expression .Format

expression Required. A variable that represents a Paragraph object.

Example

This example returns the formatting of the first paragraph in the active document and then applies the formatting to the selection.

VBA Copy code Copy code
Set paraFormat = ActiveDocument.Paragraphs(1).Format.Duplicate
Selection.Paragraphs.Format = paraFormat

See also

Concepts

Paragraph Object

Other resources

Paragraph Object Members


Paragraph.HalfWidthPunctuationOnTopOfLine Property (Word)

 Copy code hover
[image]

Paragraph.HalfWidthPunctuationOnTopOfLine Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word changes punctuation symbols at the beginning of a line to half-width characters for the specified paragraphs. This property returns wdUndefined if it's set to True for only some of the specified paragraphs. Read/write Long.

Syntax

expression .HalfWidthPunctuationOnTopOfLine

expression A variable that represents a Paragraph object.

Example

This example sets Microsoft Word to change punctuation symbols at the beginning of a line to half-width characters for the first paragraph in the active document.

VBA Copy code Copy code
ActiveDocument.Paragraphs(1).HalfWidthPunctuationOnTopOfLine = True

See also

Concepts

Paragraph Object

Other resources

Paragraph Object Members


Paragraph.HangingPunctuation Property (Word)

 Copy code hover
[image]

Paragraph.HangingPunctuation Property (Word)
See also Send feedback

Published: July 16, 2012

True if hanging punctuation is enabled for the specified paragraphs. This property returns wdUndefined if it's set to True for only some of the specified paragraphs. Read/write Long.

Syntax

expression .HangingPunctuation

expression A variable that represents a Paragraph object.

Example

This example enables hanging punctuation for the first paragraph in the active document.

VBA Copy code Copy code
ActiveDocument.Paragraphs(1).HangingPunctuation = True

See also

Concepts

Paragraph Object

Other resources

Paragraph Object Members


Paragraph.Hyphenation Property (Word)

 Copy code hover
[image]

Paragraph.Hyphenation Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified paragraphs are included in automatic hyphenation. False if the specified paragraphs are to be excluded from automatic hyphenation. Read/write Long.

Syntax

expression .Hyphenation

expression A variable that represents a Paragraph object.

Remarks

This property can be True, False or wdUndefined.

Example

This example turns off automatic hyphenation for the first paragraph in the active document.

VBA Copy code Copy code
ActiveDocument.Paragraphs(1).Hyphenation = False

See also

Concepts

Paragraph Object

Other resources

Paragraph Object Members


Paragraph.ID Property (Word)

 Copy code hover
[image]

Paragraph.ID Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the identifying label for the specified object when the current document is saved as a Web page. Read/write String.

Syntax

expression .ID

expression Required. A variable that represents a Paragraph object.

See also

Concepts

Paragraph Object

Other resources

Paragraph Object Members


Paragraph.IsStyleSeparator Property (Word)

 Copy code hover
[image]

Paragraph.IsStyleSeparator Property (Word)
See also Send feedback

Published: July 16, 2012

True if a paragraph contains a special hidden paragraph mark that allows Microsoft Word to appear to join paragraphs of different paragraph styles. Read-only Boolean.

Syntax

expression .IsStyleSeparator

expression An expression that returns a Paragraph object.

Example

This example formats all paragraphs in which there is a style separator with the built-in "Normal" style.

VBA Copy code Copy code
Sub StyleSep()
 Dim pghDoc As Paragraph
 For Each pghDoc In ActiveDocument.Paragraphs
 If pghDoc.IsStyleSeparator = True Then
 pghDoc.Range.Select
 Selection.Style = "Normal"
 End If
 Next pghDoc
End Sub

This example adds a paragraph after each style separator and then deletes the style separator.

VBA Copy code Copy code
Sub RemoveStyleSeparator()
 Dim pghDoc As Paragraph
 Dim styName As String

 'Loop through all paragraphs in document to check if it is a style
 'separator. If it is, delete it and enter a regular paragraph
 For Each pghDoc In ActiveDocument.Paragraphs
 If pghDoc.IsStyleSeparator = True Then
 pghDoc.Range.Select
 With Selection
 .Collapse (wdCollapseEnd)
 .TypeParagraph
 .MoveLeft (1)
 .TypeBackspace
 End With
 End If
 Next pghDoc
End Sub

See also

Concepts

Paragraph Object

Other resources

Paragraph Object Members


Paragraph.KeepTogether Property (Word)

 Copy code hover
[image]

Paragraph.KeepTogether Property (Word)
See also Send feedback

Published: July 16, 2012

True if all lines in the specified paragraph remain on the same page when Microsoft Word repaginates the document. Read/write Long.

Syntax

expression .KeepTogether

expression A variable that represents a Paragraph object.

Remarks

This property can be True, False, or wdUndefined.

Example

This example formats the first paragraph in the active document so that all the lines in each paragraph are on the same page when Word repaginates the document.

VBA Copy code Copy code
ActiveDocument.Paragraphs(1).KeepTogether = True

See also

Concepts

Paragraph Object

Other resources

Paragraph Object Members


Paragraph.KeepWithNext Property (Word)

 Copy code hover
[image]

Paragraph.KeepWithNext Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified paragraph remains on the same page as the paragraph that follows it when Microsoft Word repaginates the document. Read/write Long.

Syntax

expression .KeepWithNext

expression A variable that represents a Paragraph object.

Remarks

This property can be True, False, or wdUndefined.

Example

This example keeps the third paragraph through sixth paragraph in the active document on the same page.

VBA Copy code Copy code
For i = 3 To 5
 ActiveDocument.Paragraphs(i).KeepWithNext = True
Next i

See also

Concepts

Paragraph Object

Other resources

Paragraph Object Members


Paragraph.LeftIndent Property (Word)

 Copy code hover
[image]

Paragraph.LeftIndent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Single that represents the left indent value (in points) for the specified paragraph. Read/write.

Syntax

expression .LeftIndent

expression A variable that represents a Paragraph object.

Example

This example sets the left indent of the first paragraph in the active document to 1 inch. The InchesToPoints method is used to convert inches to points.

VBA Copy code Copy code
ActiveDocument.Paragraphs(1).LeftIndent = InchesToPoints(1)

See also

Concepts

Paragraph Object

Other resources

Paragraph Object Members


Paragraph.LineSpacing Property (Word)

 Copy code hover
[image]

Paragraph.LineSpacing Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the line spacing (in points) for the specified paragraphs. Read/write Single.

Syntax

expression .LineSpacing

expression An expression that represents a Paragraph object.

Remarks

Use the LinesToPoints method to convert a number of lines to the corresponding value in points. For example, LinesToPoints(2) returns the value 24.

The LineSpacing property can be set after the LineSpacingRule property has been set to:

  • wdLineSpaceAtLeast the line spacing can be greater than or equal to, but never less than, the specified LineSpacing value.

  • wdLineSpaceExactly the line spacing never changes from the specified LineSpacing value, even if a larger font is used within the paragraph.

  • wdLineSpaceMultiple a LineSpacing property value must be specified, in points.

Example

This example sets the line spacing for the first paragraph in the active document to always be at least 12 points.

VBA Copy code Copy code
With ActiveDocument.Paragraphs(1)
 .LineSpacingRule = wdLineSpaceAtLeast
 .LineSpacing = 12
End With

See also

Concepts

Paragraph Object

Other resources

Paragraph Object Members


Paragraph.LineSpacingRule Property (Word)

 Copy code hover
[image]

Paragraph.LineSpacingRule Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the line spacing for the specified paragraph. Read/write WdLineSpacing.

Syntax

expression .LineSpacingRule

expression Required. A variable that represents a Paragraph object.

Remarks

Use wdLineSpaceSingle, wdLineSpace1pt5, or wdLineSpaceDouble to set the line spacing to one of these values. To set the line spacing to an exact number of points or to a multiple number of lines, you must also set the LineSpacing property.

Example

This example double-spaces the lines in the first paragraph of the active document.

VBA Copy code Copy code
ActiveDocument.Paragraphs(1).LineSpacingRule = _
 wdLineSpaceDouble

This example returns the line spacing rule used for the first paragraph in the selection.

VBA Copy code Copy code
lrule = Selection.Paragraphs(1).LineSpacingRule

See also

Concepts

Paragraph Object

Other resources

Paragraph Object Members


Paragraph.LineUnitAfter Property (Word)

 Copy code hover
[image]

Paragraph.LineUnitAfter Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the amount of spacing (in gridlines) after the specified paragraph. Read/write Single.

Syntax

expression .LineUnitAfter

expression Required. A variable that represents a Paragraph object.

Example

This example sets the spacing after the first paragraph in the active document to one gridline.

VBA Copy code Copy code
ActiveDocument.Paragraphs(1).LineUnitAfter = 1

See also

Concepts

Paragraph Object

Other resources

Paragraph Object Members


Paragraph.LineUnitBefore Property (Word)

 Copy code hover
[image]

Paragraph.LineUnitBefore Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the amount of spacing (in gridlines) before the specified paragraph. Read/write Single.

Syntax

expression .LineUnitBefore

expression Required. A variable that represents a Paragraph object.

Example

This example sets the spacing before the second paragraph in the active document to one gridline.

VBA Copy code Copy code
ActiveDocument.Paragraphs(2).LineUnitBefore = 1

See also

Concepts

Paragraph Object

Other resources

Paragraph Object Members


Paragraph.ListNumberOriginal Property (Word)

 Copy code hover
[image]

Paragraph.ListNumberOriginal Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Integer that represents the original list level for a paragraph. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .ListNumberOriginal(Level)

expression An expression that returns a Paragraph object.

Parameters

Name | Required/Optional | Data Type | Description
Level | Required | Integer | Specifies the list level.

See also

Concepts

Paragraph Object

Other resources

Paragraph Object Members


Paragraph.MirrorIndents Property (Word)

 Copy code hover
[image]

Paragraph.MirrorIndents Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Long that represents whether left and right indents are the same width. Can be True, False, or wdUndefined. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .MirrorIndents

expression An expression that returns a Paragraph object.

See also

Concepts

Paragraph Object

Other resources

Paragraph Object Members


Paragraph.NoLineNumber Property (Word)

 Copy code hover
[image]

Paragraph.NoLineNumber Property (Word)
See also Send feedback

Published: July 16, 2012

True if line numbers are repressed for the specified paragraph. Read/write Long.

Syntax

expression .NoLineNumber

expression A variable that represents a Paragraph object.

Remarks

This property can be True, False, or wdUndefined. Use the LineNumbering property of the PageSetup object to set line numbers.

Example

This example enables line numbering for the active document. The starting number is set to 1, and the numbering is continuous throughout all sections in the document. Line numbering is then repressed for the second paragraph.

VBA Copy code Copy code
With ActiveDocument.PageSetup.LineNumbering
 .Active = True
 .StartingNumber = 1
 .CountBy = 1
 .RestartMode = wdRestartContinuous
End With
ActiveDocument.Paragraphs(2).NoLineNumber = True

See also

Concepts

Paragraph Object

Other resources

Paragraph Object Members


Paragraph.OutlineLevel Property (Word)

 Copy code hover
[image]

Paragraph.OutlineLevel Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the outline level for the specified paragraph. Read/write WdOutlineLevel.

Syntax

expression .OutlineLevel

expression Required. A variable that represents a Paragraph object.

Remarks

If a paragraph has a heading style applied to it (Heading 1 through Heading 9), the outline level is the same as the heading style and cannot be changed. Outline levels are visible only in outline view or the document map pane.

Example

This example returns the outline level of the first paragraph in the active document.

VBA Copy code Copy code
temp = ActiveDocument.Paragraphs(1).OutlineLevel

This example sets the outline level for each paragraph in the active document. First the Normal style is applied to all paragraphs. The Mod operator is used to determine which outline level (1, 2, or 3) to apply to successive paragraphs in the document, and then the view is changed to outline view.

VBA Copy code Copy code
Set myParas = ActiveDocument.Paragraphs
ActiveDocument.Paragraphs.Style = wdStyleNormal
For x = 1 To myParas.Count
 If x Mod 3 = 1 Then
 myParas(x).OutlineLevel = wdOutlineLevel1
 ElseIf x Mod 3 = 2 Then
 myParas(x).OutlineLevel = wdOutlineLevel2
 Else
 myParas(x).OutlineLevel = wdOutlineLevel3
 End If
Next x
ActiveDocument.ActiveWindow.View.Type = wdOutlineView

See also

Concepts

Paragraph Object

Other resources

Paragraph Object Members


Paragraph.PageBreakBefore Property (Word)

 Copy code hover
[image]

Paragraph.PageBreakBefore Property (Word)
See also Send feedback

Published: July 16, 2012

True if a page break is forced before the specified paragraphs. Read/write Long.

Syntax

expression .PageBreakBefore

expression A variable that represents a Paragraph object.

Remarks

This property can be True, False, or wdUndefined.

Example

This example forces a page break before the first paragraph in the selection.

VBA Copy code Copy code
Selection.Paragraphs(1).PageBreakBefore = True

See also

Concepts

Paragraph Object

Other resources

Paragraph Object Members


Paragraph.Parent Property (Word)

 Copy code hover
[image]

Paragraph.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Paragraph object.

Syntax

expression .Parent

expression Required. A variable that represents a Paragraph object.

See also

Concepts

Paragraph Object

Other resources

Paragraph Object Members


Paragraph.Range Property (Word)

 Copy code hover
[image]

Paragraph.Range Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the portion of a document that is contained within the specified paragraph.

Syntax

expression .Range

expression Required. A variable that represents a Paragraph object.

Example

This example applies the Heading 1 style to the first paragraph in the active document.

VBA Copy code Copy code
ActiveDocument.Paragraphs(1).Range.Style = wdStyleHeading1

See also

Concepts

Paragraph Object

Other resources

Paragraph Object Members


Paragraph.ReadingOrder Property (Word)

 Copy code hover
[image]

Paragraph.ReadingOrder Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the reading order of the specified paragraph without changing the alignment. Read/write WdReadingOrder.

Syntax

expression .ReadingOrder

expression Required. A variable that represents a Paragraph object.

Remarks

Use the LtrPara, LtrRun, RtlPara, and RtlRun methods of the Selection object to change the paragraph alignment along with the reading order.

Example

This example sets the reading order of the first paragraph to right-to-left.

VBA Copy code Copy code
ActiveDocument.Paragraphs(1).ReadingOrder = _
 wdReadingOrderRtl

See also

Concepts

Paragraph Object

Other resources

Paragraph Object Members


Paragraph.RightIndent Property (Word)

 Copy code hover
[image]

Paragraph.RightIndent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the right indent (in points) for the specified paragraph. Read/write Single.

Syntax

expression .RightIndent

expression Required. A variable that represents a Paragraph object.

Example

This example sets the right indent for the first paragraph in the active document to 1 inch from the right margin. The InchesToPoints method is used to convert inches to points.

VBA Copy code Copy code
ActiveDocument.Paragraphs(1).RightIndent = InchesToPoints(1)

See also

Concepts

Paragraph Object

Other resources

Paragraph Object Members


Paragraph.Shading Property (Word)

 Copy code hover
[image]

Paragraph.Shading Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Shading object that refers to the shading formatting for the specified paragraph.

Syntax

expression .Shading

expression Required. A variable that represents a Paragraph object.

Example

This example applies yellow shading to the first paragraph in the selection.

VBA Copy code Copy code
With Selection.Paragraphs(1).Shading
 .Texture = wdTexture12Pt5Percent
 .BackgroundPatternColorIndex = wdYellow
 .ForegroundPatternColorIndex = wdBlack
End With

See also

Concepts

Paragraph Object

Other resources

Paragraph Object Members


Paragraph.SpaceAfter Property (Word)

 Copy code hover
[image]

Paragraph.SpaceAfter Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the amount of spacing (in points) after the specified paragraph or text column. Read/write Single.

Syntax

expression .SpaceAfter

expression Required. A variable that represents a Paragraph object.

Example

This example sets the spacing after the first paragraph in the active document to 12 points.

VBA Copy code Copy code
ActiveDocument.Paragraphs(1).SpaceAfter = 12

See also

Concepts

Paragraph Object

Other resources

Paragraph Object Members


Paragraph.SpaceAfterAuto Property (Word)

 Copy code hover
[image]

Paragraph.SpaceAfterAuto Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word automatically sets the amount of spacing after the specified paragraphs. Read/write Long.

Syntax

expression .SpaceAfterAuto

expression A variable that represents a Paragraph object.

Remarks

Returns wdUndefined if the SpaceAfterAuto property is set to True for only some of the specified paragraphs. Can be set to either True or False.

If SpaceAfterAuto is set to True, the SpaceAfter property is ignored.

Example

This example displays a report showing the SpaceAfterAuto settings for the first paragraph in the active document.

VBA Copy code Copy code
Select Case ActiveDocument.Paragraphs(1).SpaceAfterAuto
 Case True
 x = "Spacing after paragraphs is handled " _
 & "automatically for all paragraphs."
 Case False
 x = "Spacing after paragraphs is handled " _
 & "manually for all paragraphs."
 Case wdUndefined
 x = "Spacing after paragraphs is handled " _
 & "automatically for some paragraphs, " _
 & "manually for some paragraphs."
End Select

See also

Concepts

Paragraph Object

Other resources

Paragraph Object Members


Paragraph.SpaceBefore Property (Word)

 Copy code hover
[image]

Paragraph.SpaceBefore Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the spacing (in points) before the specified paragraphs. Read/write Single.

Syntax

expression .SpaceBefore

expression Required. A variable that represents a Paragraph object.

Example

This example sets the spacing before the second paragraph in the active document to 12 points.

VBA Copy code Copy code
ActiveDocument.Paragraphs(2).SpaceBefore = 12

See also

Concepts

Paragraph Object

Other resources

Paragraph Object Members


Paragraph.SpaceBeforeAuto Property (Word)

 Copy code hover
[image]

Paragraph.SpaceBeforeAuto Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word automatically sets the amount of spacing before the specified paragraphs. Read/write Long.

Syntax

expression .SpaceBeforeAuto

expression A variable that represents a Paragraph object.

Remarks

This property returns wdUndefined if the SpaceBeforeAuto property is set to True for only some of the specified paragraphs. Can be set to either True or False.

If SpaceBeforeAuto is set to True, the SpaceBefore property is ignored.

Example

This example displays a report showing the SpaceBeforeAuto settings for the first paragraph in the active document.

VBA Copy code Copy code
Select Case ActiveDocument.Paragraphs(1).SpaceBeforeAuto
 Case True
 x = "Spacing before paragraphs is handled " _
 & "automatically for all paragraphs."
 Case False
 x = "Spacing before paragraphs is handled " _
 & "manually for all paragraphs."
 Case wdUndefined
 x = "Spacing before paragraphs is handled " _
 & "automatically for some paragraphs, " _
 & "manually for some paragraphs."
End Select

See also

Concepts

Paragraph Object

Other resources

Paragraph Object Members


Paragraph.Style Property (Word)

 Copy code hover
[image]

Paragraph.Style Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the style for the specified object. Read/write Variant.

Syntax

expression .Style

expression Required. A variable that represents a Paragraph object.

Remarks

To set this property, specify the local name of the style, an integer, a WdBuiltinStyle constant, or an object that represents the style.

Example

This example displays the style for each paragraph in the active document.

VBA Copy code Copy code
For Each para in ActiveDocument.Paragraphs
 MsgBox para.Style
Next para

This example sets alternating styles of Heading 3 and Normal for all the paragraphs in the active document.

VBA Copy code Copy code
For i = 1 To ActiveDocument.Paragraphs.Count
 If i Mod 2 = 0 Then
 ActiveDocument.Paragraphs(i).Style = wdStyleNormal
 Else: ActiveDocument.Paragraphs(i).Style = wdStyleHeading3
 End If
Next i

See also

Concepts

Paragraph Object

Other resources

Paragraph Object Members


Paragraph.TabStops Property (Word)

 Copy code hover
[image]

Paragraph.TabStops Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a TabStops collection that represents all the custom tab stops for the specified paragraph. Read/write.

Syntax

expression .TabStops

expression A variable that represents a Paragraph object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example sets the tab stops for every paragraph in the document to match the tab stops in the first paragraph.

VBA Copy code Copy code
Set para1Tabs = ActiveDocument.Paragraphs(1).TabStops
ActiveDocument.Paragraphs.TabStops = para1Tabs

See also

Concepts

Paragraph Object

Other resources

Paragraph Object Members


Paragraph.TextboxTightWrap Property (Word)

 Copy code hover
[image]

Paragraph.TextboxTightWrap Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a WdTextboxTightWrap constant that represents how tightly text wraps around shapes or text boxes. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .TextboxTightWrap

expression An expression that returns a Paragraph object.

See also

Concepts

Paragraph Object

Other resources

Paragraph Object Members


Paragraph.WidowControl Property (Word)

 Copy code hover
[image]

Paragraph.WidowControl Property (Word)
See also Send feedback

Published: July 16, 2012

True if the first and last lines in the specified paragraph remain on the same page as the rest of the paragraph when Word repaginates the document. Read/write Long.

Syntax

expression .WidowControl

expression A variable that represents a Paragraph object.

Remarks

This property can be True, False or wdUndefined.

Example

This example formats the first paragraph in the active document so that the first or last line in a paragraph can appear by itself at the top or bottom of a page.

VBA Copy code Copy code
ActiveDocument.Paragraphs(1).WidowControl = False

See also

Concepts

Paragraph Object

Other resources

Paragraph Object Members


Paragraph.WordWrap Property (Word)

 Copy code hover
[image]

Paragraph.WordWrap Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word wraps Latin text in the middle of a word in the specified paragraphs or text frames. Read/write Long.

Syntax

expression .WordWrap

expression Required. A variable that represents a Paragraph object.

Remarks

This property returns wdUndefined if it's set to True for only some of the specified paragraphs or text frames. This usage may not be available to you, depending on the language support (U.S. English, for example) that you have selected or installed.

Example

This example sets Microsoft Word to wrap Latin text in the middle of a word in the first paragraph of the active document.

VBA Copy code Copy code
ActiveDocument.Paragraphs(1).WordWrap = False

See also

Concepts

Paragraph Object

Other resources

Paragraph Object Members


Paragraph Methods (Word)

 Copy code hover
[image]

Paragraph Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
CloseUp | Removes any spacing before the specified paragraph.
Indent | Indents one or more paragraphs by one level.
IndentCharWidth | Indents a paragraphs by a specified number of characters.
IndentFirstLineCharWidth | Indents the first line of one or more paragraphs by a specified number of characters.
JoinList | Joins a list paragraph with the closest list above or below the specified paragraph.
ListAdvanceTo | Sets the list levels for a paragraph in a list.
Next | Returns a Paragraph object that represents the next paragraph.
OpenOrCloseUp | Toggles the spacing before a paragraph.
OpenUp | Sets spacing before the specified paragraphs to 12 points.
Outdent | Removes one level of indent for one or more paragraphs.
OutlineDemote | Applies the next heading level style (Heading 1 through Heading 8) to the specified paragraph or paragraphs.
OutlineDemoteToBody | Demotes the specified paragraph to body text by applying the Normal style.
OutlinePromote | Applies the previous heading level style (Heading 1 through Heading 8) to the specified paragraph or paragraphs.
Previous | Returns the previous paragraph as a Paragraph object.
Reset | Removes manual paragraph formatting (formatting not applied using a style).
ResetAdvanceTo | Resets a paragraph that uses custom list levels to the original level settings.
SelectNumber | Selects the number or bullet in a list.
SeparateList | Separates a list into two separate lists. For numbered lists, the new list restarts numbering at the starting number, usually 1.
Space1 | Single-spaces the specified paragraphs.
Space15 | Formats the specified paragraphs with 1.5-line spacing.
Space2 | Double-spaces the specified paragraphs.
TabHangingIndent | Sets a hanging indent to a specified number of tab stops. .
TabIndent | Sets the left indent for the specified paragraphs to a specified number of tab stops. .


Paragraph.CloseUp Method (Word)

 Copy code hover
[image]

Paragraph.CloseUp Method (Word)
See also Send feedback

Published: July 16, 2012

Removes any spacing before the specified paragraph.

Syntax

expression .CloseUp

expression Required. A variable that represents a Paragraph object.

Remarks

The following two statements are equivalent:

VBA Copy code Copy code
ActiveDocument.Paragraphs(1).CloseUp
ActiveDocument.Paragraphs(1).SpaceBefore = 0

Example

This example removes any space before the first paragraph in the selection.

VBA Copy code Copy code
Selection.Paragraphs(1).CloseUp

See also

Concepts

Paragraph Object

Other resources

Paragraph Object Members


Paragraph.Indent Method (Word)

 Copy code hover
[image]

Paragraph.Indent Method (Word)
See also Send feedback

Published: July 16, 2012

Indents one or more paragraphs by one level.

Syntax

expression .Indent

expression Required. A variable that represents a Paragraph object.

Remarks

This method is equivalent to clicking the Increase Indent button on the Formatting toolbar.

Example

This example indents all the paragraphs in the active document twice, and then it removes one level of the indent for the first paragraph.

VBA Copy code Copy code
With ActiveDocument.Paragraphs
 .Indent
 .Indent
End With
ActiveDocument.Paragraphs(1).Outdent

See also

Concepts

Paragraph Object

Other resources

Paragraph Object Members


Paragraph.IndentCharWidth Method (Word)

 Copy code hover
[image]

Paragraph.IndentCharWidth Method (Word)
See also Send feedback

Published: July 16, 2012

Indents a paragraphs by a specified number of characters.

Syntax

expression .IndentCharWidth(Count)

expression Required. A variable that represents a Paragraph object.

Parameters

Name | Required/Optional | Data Type | Description
Count | Required | Integer | The number of characters by which the specified paragraphs are to be indented.

Remarks

This method is equivalent to clicking the Increase Indent button on the Formatting toolbar.

Example

This example indents the first paragraph of the active document by 10 characters.

VBA Copy code Copy code
With ActiveDocument.Paragraphs(1)
 .IndentCharWidth 10
End With

See also

Concepts

Paragraph Object

Other resources

Paragraph Object Members


Paragraph.IndentFirstLineCharWidth Method (Word)

 Copy code hover
[image]

Paragraph.IndentFirstLineCharWidth Method (Word)
See also Send feedback

Published: July 16, 2012

Indents the first line of one or more paragraphs by a specified number of characters.

Syntax

expression .IndentFirstLineCharWidth(Count)

expression Required. A variable that represents a Paragraph object.

Parameters

Name | Required/Optional | Data Type | Description
Count | Required | Integer | The number of characters by which the first line of each specified paragraph is to be indented.

Example

This example indents the first line of the first paragraph in the active document by 10 characters.

VBA Copy code Copy code
With ActiveDocument.Paragraphs(1)
 .IndentFirstLineCharWidth 10
End With

See also

Concepts

Paragraph Object

Other resources

Paragraph Object Members


Paragraph.JoinList Method (Word)

 Copy code hover
[image]

Paragraph.JoinList Method (Word)
See also Send feedback

Published: July 16, 2012

Joins a list paragraph with the closest list above or below the specified paragraph.

Version Information

Version Added: Project 2007

Syntax

expression .JoinList

expression An expression that returns a Paragraph object.

See also

Concepts

Paragraph Object

Other resources

Paragraph Object Members


Paragraph.ListAdvanceTo Method (Word)

 Copy code hover
[image]

Paragraph.ListAdvanceTo Method (Word)
See also Send feedback

Published: July 16, 2012

Sets the list levels for a paragraph in a list.

Version Information

Version Added: Project 2007

Syntax

expression .ListAdvanceTo(Level1, Level2, Level3, Level4, Level5, Level6, Level7, Level8, Level9)

expression An expression that returns a Paragraph object.

Parameters

Name | Required/Optional | Data Type | Description
Level1 to Level9 | Optional | Integer | Specifies the list level.

Remarks

Microsoft Word adjusts the numbering value to be used for numbering each list level for the specified paragraph by inserting the necessary intervening paragraphs as hidden text between the specified paragraph and the previous paragraph.

See also

Concepts

Paragraph Object

Other resources

Paragraph Object Members


Paragraph.Next Method (Word)

 Copy code hover
[image]

Paragraph.Next Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a Paragraph object that represents the next paragraph.

Syntax

expression .Next(Count)

expression Required. A variable that represents a Paragraph object.

Parameters

Name | Required/Optional | Data Type | Description
Count | Optional | Variant | The number of paragraphs by which you want to move ahead. The default value is one.

Return Value

Paragraph

Example

This example inserts a number and a tab before the first nine paragraphs in the active document.

VBA Copy code Copy code
For n = 0 To 8
 Set myRange = ActiveDocument.Paragraphs(1).Next(Count:=n).Range
 myRange.Collapse Direction:=wdCollapseStart
 myRange.InsertAfter n + 1 & vbTab
Next n

See also

Concepts

Paragraph Object

Other resources

Paragraph Object Members


Paragraph.OpenOrCloseUp Method (Word)

 Copy code hover
[image]

Paragraph.OpenOrCloseUp Method (Word)
See also Send feedback

Published: July 16, 2012

Toggles the spacing before a paragraph.

Syntax

expression .OpenOrCloseUp

expression Required. A variable that represents a Paragraph object.

Remarks

If spacing before the specified paragraphs is 0 (zero), this method sets spacing to 12 points. If spacing before the paragraphs is greater than 0 (zero), this method sets spacing to 0 (zero).

Example

This example toggles the formatting of the first paragraph in the active document to either add 12 points of space before the paragraph or leave no space before it.

VBA Copy code Copy code
ActiveDocument.Paragraphs(1).OpenOrCloseUp

See also

Concepts

Paragraph Object

Other resources

Paragraph Object Members


Paragraph.OpenUp Method (Word)

 Copy code hover
[image]

Paragraph.OpenUp Method (Word)
See also Send feedback

Published: July 16, 2012

Sets spacing before the specified paragraphs to 12 points.

Syntax

expression .OpenUp

expression Required. A variable that represents a Paragraph object.

Remarks

You can also use the SpaceBefore property to set the spacing for a paragraph. The following two statements are equivalent:

VBA Copy code Copy code
ActiveDocument.Paragraphs(1).OpenUp
ActiveDocument.Paragraphs(1).SpaceBefore = 12

Example

This example changes the formatting of the second paragraph in the active document to leave 12 points of space before the paragraph.

VBA Copy code Copy code
ActiveDocument.Paragraphs(2).OpenUp

See also

Concepts

Paragraph Object

Other resources

Paragraph Object Members


Paragraph.Outdent Method (Word)

 Copy code hover
[image]

Paragraph.Outdent Method (Word)
See also Send feedback

Published: July 16, 2012

Removes one level of indent for one or more paragraphs.

Syntax

expression .Outdent

expression Required. A variable that represents a Paragraph object.

Remarks

This method is equivalent to clicking the Decrease Indent button on the Formatting toolbar.

Example

This example indents all the paragraphs in the active document twice, and then it removes one level of the indent for the first paragraph.

VBA Copy code Copy code
With ActiveDocument.Paragraphs
 .Indent
 .Indent
End With
ActiveDocument.Paragraphs(1).Outdent

See also

Concepts

Paragraph Object

Other resources

Paragraph Object Members


Paragraph.OutlineDemote Method (Word)

 Copy code hover
[image]

Paragraph.OutlineDemote Method (Word)
See also Send feedback

Published: July 16, 2012

Applies the next heading level style (Heading 1 through Heading 8) to the specified paragraph or paragraphs.

Syntax

expression .OutlineDemote

expression Required. A variable that represents a Paragraph object.

Remarks

If a paragraph is formatted with the Heading 2 style, this method demotes the paragraph by changing the style to Heading 3.

Example

This example demotes the first paragraph in the selection.

VBA Copy code Copy code
Selection.Paragraphs(1).OutlineDemote

This example demotes the third paragraph in the active document.

VBA Copy code Copy code
ActiveDocument.Paragraphs(3).OutlineDemote

See also

Concepts

Paragraph Object

Other resources

Paragraph Object Members


Paragraph.OutlineDemoteToBody Method (Word)

 Copy code hover
[image]

Paragraph.OutlineDemoteToBody Method (Word)
See also Send feedback

Published: July 16, 2012

Demotes the specified paragraph to body text by applying the Normal style.

Syntax

expression .OutlineDemoteToBody

expression Required. A variable that represents a Paragraph object.

Example

This example demotes the first paragraph in the selection to body text.

VBA Copy code Copy code
Selection.Paragraphs(1).OutlineDemoteToBody

This example switches the active window to outline view and demotes the first paragraph in the selection to body text.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.View.Type = wdOutlineView
Selection.Paragraphs(1).OutlineDemoteToBody

See also

Concepts

Paragraph Object

Other resources

Paragraph Object Members


Paragraph.OutlinePromote Method (Word)

 Copy code hover
[image]

Paragraph.OutlinePromote Method (Word)
See also Send feedback

Published: July 16, 2012

Applies the previous heading level style (Heading 1 through Heading 8) to the specified paragraph or paragraphs.

Syntax

expression .OutlinePromote

expression Required. A variable that represents a Paragraph object.

Remarks

If a paragraph is formatted with the Heading 2 style, this method promotes the paragraph by changing the style to Heading 1.

Example

This example promotes the first paragraph in the selection.

VBA Copy code Copy code
Selection.Paragraphs(1).OutlinePromote

This example switches the active window to outline view and promotes the first paragraph in the active document.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.View.Type = wdOutlineView
ActiveDocument.Paragraphs(1).OutlinePromote

See also

Concepts

Paragraph Object

Other resources

Paragraph Object Members


Paragraph.Previous Method (Word)

 Copy code hover
[image]

Paragraph.Previous Method (Word)
See also Send feedback

Published: July 16, 2012

Returns the previous paragraph as a Paragraph object.

Syntax

expression .Previous(Count)

expression Required. A variable that represents a Paragraph object.

Parameters

Name | Required/Optional | Data Type | Description
Count | Optional | Variant | The number of paragraphs by which you want to move back. The default value is 1.

Return Value

Paragraph

Example

This example selects the paragraph that precedes the selection in the active document.

VBA Copy code Copy code
Selection.Previous(Unit:=wdParagraph, Count:=1).Select

See also

Concepts

Paragraph Object

Other resources

Paragraph Object Members


Paragraph.Reset Method (Word)

 Copy code hover
[image]

Paragraph.Reset Method (Word)
See also Send feedback

Published: July 16, 2012

Removes manual paragraph formatting (formatting not applied using a style).

Syntax

expression .Reset

expression Required. A variable that represents a Paragraph object.

Remarks

If you manually right align a paragraph and the underlying style has a different alignment, the Reset method changes the alignment to match the formatting of the underlying style.

Example

This example removes manual paragraph formatting from the second paragraph in the active document.

VBA Copy code Copy code
ActiveDocument.Paragraphs(2).Reset

See also

Concepts

Paragraph Object

Other resources

Paragraph Object Members


Paragraph.ResetAdvanceTo Method (Word)

 Copy code hover
[image]

Paragraph.ResetAdvanceTo Method (Word)
See also Send feedback

Published: July 16, 2012

Resets a paragraph that uses custom list levels to the original level settings.

Version Information

Version Added: Project 2007

Syntax

expression .ResetAdvanceTo

expression An expression that returns a Paragraph object.

Remarks

Microsoft Word adjusts the numbering value to be used for numbering each list level for the specified paragraph by removing any intervening hidden paragraphs between the specified paragraph and the previous paragraph.

See also

Concepts

Paragraph Object

Other resources

Paragraph Object Members


Paragraph.SelectNumber Method (Word)

 Copy code hover
[image]

Paragraph.SelectNumber Method (Word)
See also Send feedback

Published: July 16, 2012

Selects the number or bullet in a list.

Syntax

expression .SelectNumber

expression Required. A variable that represents a Paragraph object.

Remarks

If the SelectNumber method is called from a paragraph, selection, or range that does not contain a list, an error message is displayed.

Example

This example selects the bullet or number for the list that contains the selected paragraph in the active document, and then it increases the font size of the bullet or number to 17 points. This example assumes that the first paragraph in the selection is formatted as a bulleted or numbered list.

VBA Copy code Copy code
Sub SelectParaNumber()
 With Selection
 .Paragraphs(1).SelectNumber
 .Font.Size = 17
 End With
End Sub

See also

Concepts

Paragraph Object

Other resources

Paragraph Object Members


Paragraph.SeparateList Method (Word)

 Copy code hover
[image]

Paragraph.SeparateList Method (Word)
See also Send feedback

Published: July 16, 2012

Separates a list into two separate lists. For numbered lists, the new list restarts numbering at the starting number, usually 1.

Version Information

Version Added: Project 2007

Syntax

expression .SeparateList

expression An expression that returns a Paragraph object.

See also

Concepts

Paragraph Object

Other resources

Paragraph Object Members


Paragraph.Space1 Method (Word)

 Copy code hover
[image]

Paragraph.Space1 Method (Word)
See also Send feedback

Published: July 16, 2012

Single-spaces the specified paragraphs.

Syntax

expression .Space1

expression Required. A variable that represents a Paragraph object.

Remarks

The exact spacing is determined by the font size of the largest characters in each paragraph.

You can also use the LineSpacingRule property to set the line spacing for a paragraph. The following two statements are equivalent:

VBA Copy code Copy code
ActiveDocument.Paragraphs(1).Space1
ActiveDocument.Paragraphs(1).LineSpacingRule = wdLineSpaceSingle

Example

This example changes the first paragraph in the active document to single spacing.

VBA Copy code Copy code
ActiveDocument.Paragraphs(1).Space1

See also

Concepts

Paragraph Object

Other resources

Paragraph Object Members


Paragraph.Space15 Method (Word)

 Copy code hover
[image]

Paragraph.Space15 Method (Word)
See also Send feedback

Published: July 16, 2012

Formats the specified paragraphs with 1.5-line spacing.

Syntax

expression .Space15

expression Required. A variable that represents a Paragraph object.

Remarks

The exact spacing is determined by adding 6 points to the font size of the largest character in each paragraph.

You can also use the LineSpacingRule property to set the line spacing for a paragraph. The following two statements are equivalent:

VBA Copy code Copy code
ActiveDocument.Paragraphs(1).Space15
ActiveDocument.Paragraphs(1).LineSpacingRule = wdLineSpace1pt5

Example

This example changes the first paragraph in the active document to 1.5-line spacing.

VBA Copy code Copy code
ActiveDocument.Paragraphs(1).Space15

See also

Concepts

Paragraph Object

Other resources

Paragraph Object Members


Paragraph.Space2 Method (Word)

 Copy code hover
[image]

Paragraph.Space2 Method (Word)
See also Send feedback

Published: July 16, 2012

Double-spaces the specified paragraphs.

Syntax

expression .Space2

expression Required. A variable that represents a Paragraph object.

Remarks

The exact spacing is determined by adding 12 points to the font size of the largest character in each paragraph.

You can also use the LineSpacingRule property to set the line spacing for a paragraph. The following two statements are equivalent:

VBA Copy code Copy code
ActiveDocument.Paragraphs(1).Space2
ActiveDocument.Paragraphs(1).LineSpacingRule = wdLineSpaceDouble

Example

This example changes the first paragraph in the selection to double spacing.

VBA Copy code Copy code
Selection.Paragraphs(1).Space2

See also

Concepts

Paragraph Object

Other resources

Paragraph Object Members


Paragraph.TabHangingIndent Method (Word)

 Copy code hover
[image]

Paragraph.TabHangingIndent Method (Word)
See also Send feedback

Published: July 16, 2012

Sets a hanging indent to a specified number of tab stops. .

Syntax

expression .TabHangingIndent(Count)

expression Required. A variable that represents a Paragraph object.

Parameters

Name | Required/Optional | Data Type | Description
Count | Required | Integer | The number of tab stops to indent (if positive) or the number of tab stops to remove from the indent (if negative).

Remarks

You can also use this method to remove tab stops from a hanging indent if the value of Count is a negative number.

Example

This example sets a hanging indent to the second tab stop for the first paragraph in the active document.

VBA Copy code Copy code
ActiveDocument.Paragraphs(1).TabHangingIndent(2)

This example moves the hanging indent back one tab stop for the first paragraph in the active document.

VBA Copy code Copy code
ActiveDocument.Paragraphs(1).TabHangingIndent(-1)

See also

Concepts

Paragraph Object

Other resources

Paragraph Object Members


Paragraph.TabIndent Method (Word)

 Copy code hover
[image]

Paragraph.TabIndent Method (Word)
See also Send feedback

Published: July 16, 2012

Sets the left indent for the specified paragraphs to a specified number of tab stops. .

Syntax

expression .TabIndent(Count)

expression Required. A variable that represents a Paragraph object.

Parameters

Name | Required/Optional | Data Type | Description
Count | Required | Integer | The number of tab stops to indent (if positive) or the number of tab stops to remove from the indent (if negative).

Remarks

You can also use this method to remove the indent if the value of Count is a negative number.

Example

This example indents the first paragraph in the active document to the second tab stop.

VBA Copy code Copy code
ActiveDocument.Paragraphs(1).TabIndent(2)

This example moves the indent of the first paragraph in the active document back one tab stop.

VBA Copy code Copy code
ActiveDocument.Paragraphs(1).TabIndent(-1)

See also

Concepts

Paragraph Object

Other resources

Paragraph Object Members


ParagraphFormat Object (Word)

 Copy code hover
[image]

ParagraphFormat Object (Word)
See also Send feedback

Published: July 16, 2012

Represents all the formatting for a paragraph.

Remarks

Use the Format property to return the ParagraphFormat object for a paragraph or paragraphs. The ParagraphFormat property returns the ParagraphFormat object for a selection, range, style, Find object, or Replacement object. The following example centers the third paragraph in the active document.

VBA Copy code Copy code
ActiveDocument.Paragraphs(3).Format.Alignment = _
 wdAlignParagraphCenter

The following example finds the next double-spaced paragraph after the selection.

VBA Copy code Copy code
With Selection.Find
 .ClearFormatting
 .ParagraphFormat.LineSpacingRule = wdLineSpaceDouble
 .Text = ""
 .Forward = True
 .Wrap = wdFindContinue
End With
Selection.Find.Execute

You can use Visual Basic's New keyword to create a new, standalone ParagraphFormat object. The following example creates a ParagraphFormat object, sets some formatting properties for it, and then applies all of its properties to the first paragraph in the active document.

VBA Copy code Copy code
Dim myParaF As New ParagraphFormat
myParaF.Alignment = wdAlignParagraphCenter
myParaF.Borders.Enable = True
ActiveDocument.Paragraphs(1).Format = myParaF

You can also make a standalone copy of an existing ParagraphFormat object by using the Duplicate property. The following example duplicates the paragraph formatting of the first paragraph in the active document and stores the formatting in myDup. The example changes the left indent of myDup to 1 inch, creates a new document, inserts text into the document, and applies the paragraph formatting of myDup to the text.

VBA Copy code Copy code
Set myDup = ActiveDocument.Paragraphs(1).Format.Duplicate
myDup.LeftIndent = InchesToPoints(1)
Documents.Add
Selection.InsertAfter "This is a new paragraph."
Selection.Paragraphs.Format = myDup

See also

Concepts

Word Object Model Reference

Other resources

ParagraphFormat Object Members


ParagraphFormat Members (Word)

 Copy code hover
[image]

ParagraphFormat Members (Word)
Send feedback

Published: July 16, 2012

Represents all the formatting for a paragraph.

Methods

Name | Description
CloseUp | Removes any spacing before paragraphs in the specified paragraph format.
IndentCharWidth | Indents one or more paragraphs by a specified number of characters.
IndentFirstLineCharWidth | Indents the first line of one or more paragraphs by a specified number of characters.
OpenOrCloseUp | Toggles the spacing before the specified paragraphs.
OpenUp | Sets spacing before the specified paragraphs to 12 points.
Reset | Removes manual paragraph formatting (formatting not applied using a style).
Space1 | Single-spaces the specified paragraphs.
Space15 | Formats the specified paragraphs with 1.5-line spacing.
Space2 | Double-spaces the specified paragraphs.
TabHangingIndent | Sets a hanging indent to a specified number of tab stops. .
TabIndent | Sets the left indent for the specified paragraphs to a specified number of tab stops.

Properties

Name | Description
AddSpaceBetweenFarEastAndAlpha | True if Microsoft Word is set to automatically add spaces between Japanese and Latin text for the specified paragraphs. This property returns wdUndefined if it's set to True for only some of the specified paragraphs. Read/write Long.
AddSpaceBetweenFarEastAndDigit | True if Microsoft Word is set to automatically add spaces between Japanese text and numbers for the specified paragraphs. This property returns wdUndefined if it's set to True for only some of the specified paragraphs. Read/write Long.
Alignment | Returns or sets a WdParagraphAlignment constant that represents the alignment for the specified paragraphs. Read/write.
Application | Returns an Application object that represents the Microsoft Word application.
AutoAdjustRightIndent | True if Microsoft Word is set to automatically adjust the right indent for the specified paragraphs if you've specified a set number of characters per line. Returns wdUndefined if the AutoAdjustRightIndent property is set to True for only some of the specified paragraphs. Read/write Long.
BaseLineAlignment | Returns or sets a WdBaselineAlignment constant that represents the vertical position of fonts on a line. Read/write.
Borders | Returns a Borders collection that represents all the borders for the specified object.
CharacterUnitFirstLineIndent | Returns or sets the value (in characters) for a first-line or hanging indent. Use a positive value to set a first-line indent, and use a negative value to set a hanging indent. Read/write Single.
CharacterUnitLeftIndent | Returns or sets the left indent value (in characters) for the specified paragraphs. Read/write Single.
CharacterUnitRightIndent | Returns or sets the right indent value (in characters) for the specified paragraphs. Read/write Single.
CollapsedByDefault | Returns or sets whether the specified paragraph format is collapsed by default. Read-write Long.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
DisableLineHeightGrid | True if Microsoft Word aligns characters in the specified paragraphs to the line grid when a set number of lines per page is specified. Returns wdUndefined if the DisableLineHeightGrid property is set to True for only some of the specified paragraphs. Read/write Long.
Duplicate | Returns a read-only ParagraphFormat object that represents the paragraph formatting of the specified paragraph.
FarEastLineBreakControl | True if Microsoft Word applies East Asian line-breaking rules to the specified paragraphs. Returns wdUndefined if the FarEastLineBreakControl property is set to True for only some of the specified paragraphs. Read/write Long.
FirstLineIndent | Returns or sets the value (in points) for a first line or hanging indent. Use a positive value to set a first-line indent, and use a negative value to set a hanging indent. Read/write Single.
HalfWidthPunctuationOnTopOfLine | True if Microsoft Word changes punctuation symbols at the beginning of a line to half-width characters for the specified paragraphs. This property returns wdUndefined if it's set to True for only some of the specified paragraphs. Read/write Long.
HangingPunctuation | True if hanging punctuation is enabled for the specified paragraphs. This property returns wdUndefined if it's set to True for only some of the specified paragraphs. Read/write Long.
Hyphenation | True if the specified paragraphs are included in automatic hyphenation. False if the specified paragraphs are to be excluded from automatic hyphenation. Read/write Long.
KeepTogether | True if all lines in the specified paragraphs remain on the same page when Microsoft Word repaginates the document. Read/write Long.
KeepWithNext | True if the specified paragraph remains on the same page as the paragraph that follows it when Microsoft Word repaginates the document. Read/write Long.
LeftIndent | Returns or sets a Single that represents the left indent value (in points) for the specified paragraph formatting. Read/write.
LineSpacing | Returns or sets the line spacing (in points) for the specified paragraphs. Read/write Single.
LineSpacingRule | Returns or sets the line spacing for the specified paragraph formatting. Read/write WdLineSpacing.
LineUnitAfter | Returns or sets the amount of spacing (in gridlines) after the specified paragraphs. Read/write Single.
LineUnitBefore | Returns or sets the amount of spacing (in gridlines) before the specified paragraphs. Read/write Single.
MirrorIndents | Returns or sets a Long that represents whether left and right indents are the same width. Can be True, False, or wdUndefined. Read/write.
NoLineNumber | True if line numbers are repressed for the specified paragraphs. Can be True, False, or wdUndefined. Read/write Long.
OutlineLevel | Returns or sets the outline level for the specified paragraphs. Read/write WdOutlineLevel.
PageBreakBefore | True if a page break is forced before the specified paragraphs. Can be True, False, or wdUndefined. Read/write Long.
Parent | Returns an Object that represents the parent object of the specified ParagraphFormat object.
ReadingOrder | Returns or sets the reading order of the specified paragraphs without changing their alignment. Read/write WdReadingOrder.
RightIndent | Returns or sets the right indent (in points) for the specified paragraphs. Read/write Single.
Shading | Returns a Shading object that refers to the shading formatting for the specified object.
SpaceAfter | Returns or sets the amount of spacing (in points) after the specified paragraph or text column. Read/write Single.
SpaceAfterAuto | True if Microsoft Word automatically sets the amount of spacing after the specified paragraphs. Read/write Long.
SpaceBefore | Returns or sets the spacing (in points) before the specified paragraphs. Read/write Single.
SpaceBeforeAuto | True if Microsoft Word automatically sets the amount of spacing before the specified paragraphs. Read/write Long.
Style | Returns or sets the style for the specified object. Read/write Variant.
TabStops | Returns or sets a TabStops collection that represents all the custom tab stops for the specified paragraphs. Read/write.
TextboxTightWrap | Returns or sets a WdTextboxTightWrap constant that represents how tightly text wraps around shapes or text boxes. Read/write.
WidowControl | True if the first and last lines in the specified paragraph remain on the same page as the rest of the paragraph when Word repaginates the document. Can be True, False or wdUndefined. Read/write Long.
WordWrap | True if Microsoft Word wraps Latin text in the middle of a word in the specified paragraphs or text frames. Read/write Long.


ParagraphFormat Properties (Word)

 Copy code hover
[image]

ParagraphFormat Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
AddSpaceBetweenFarEastAndAlpha | True if Microsoft Word is set to automatically add spaces between Japanese and Latin text for the specified paragraphs. This property returns wdUndefined if it's set to True for only some of the specified paragraphs. Read/write Long.
AddSpaceBetweenFarEastAndDigit | True if Microsoft Word is set to automatically add spaces between Japanese text and numbers for the specified paragraphs. This property returns wdUndefined if it's set to True for only some of the specified paragraphs. Read/write Long.
Alignment | Returns or sets a WdParagraphAlignment constant that represents the alignment for the specified paragraphs. Read/write.
Application | Returns an Application object that represents the Microsoft Word application.
AutoAdjustRightIndent | True if Microsoft Word is set to automatically adjust the right indent for the specified paragraphs if you've specified a set number of characters per line. Returns wdUndefined if the AutoAdjustRightIndent property is set to True for only some of the specified paragraphs. Read/write Long.
BaseLineAlignment | Returns or sets a WdBaselineAlignment constant that represents the vertical position of fonts on a line. Read/write.
Borders | Returns a Borders collection that represents all the borders for the specified object.
CharacterUnitFirstLineIndent | Returns or sets the value (in characters) for a first-line or hanging indent. Use a positive value to set a first-line indent, and use a negative value to set a hanging indent. Read/write Single.
CharacterUnitLeftIndent | Returns or sets the left indent value (in characters) for the specified paragraphs. Read/write Single.
CharacterUnitRightIndent | Returns or sets the right indent value (in characters) for the specified paragraphs. Read/write Single.
CollapsedByDefault | Returns or sets whether the specified paragraph format is collapsed by default. Read-write Long.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
DisableLineHeightGrid | True if Microsoft Word aligns characters in the specified paragraphs to the line grid when a set number of lines per page is specified. Returns wdUndefined if the DisableLineHeightGrid property is set to True for only some of the specified paragraphs. Read/write Long.
Duplicate | Returns a read-only ParagraphFormat object that represents the paragraph formatting of the specified paragraph.
FarEastLineBreakControl | True if Microsoft Word applies East Asian line-breaking rules to the specified paragraphs. Returns wdUndefined if the FarEastLineBreakControl property is set to True for only some of the specified paragraphs. Read/write Long.
FirstLineIndent | Returns or sets the value (in points) for a first line or hanging indent. Use a positive value to set a first-line indent, and use a negative value to set a hanging indent. Read/write Single.
HalfWidthPunctuationOnTopOfLine | True if Microsoft Word changes punctuation symbols at the beginning of a line to half-width characters for the specified paragraphs. This property returns wdUndefined if it's set to True for only some of the specified paragraphs. Read/write Long.
HangingPunctuation | True if hanging punctuation is enabled for the specified paragraphs. This property returns wdUndefined if it's set to True for only some of the specified paragraphs. Read/write Long.
Hyphenation | True if the specified paragraphs are included in automatic hyphenation. False if the specified paragraphs are to be excluded from automatic hyphenation. Read/write Long.
KeepTogether | True if all lines in the specified paragraphs remain on the same page when Microsoft Word repaginates the document. Read/write Long.
KeepWithNext | True if the specified paragraph remains on the same page as the paragraph that follows it when Microsoft Word repaginates the document. Read/write Long.
LeftIndent | Returns or sets a Single that represents the left indent value (in points) for the specified paragraph formatting. Read/write.
LineSpacing | Returns or sets the line spacing (in points) for the specified paragraphs. Read/write Single.
LineSpacingRule | Returns or sets the line spacing for the specified paragraph formatting. Read/write WdLineSpacing.
LineUnitAfter | Returns or sets the amount of spacing (in gridlines) after the specified paragraphs. Read/write Single.
LineUnitBefore | Returns or sets the amount of spacing (in gridlines) before the specified paragraphs. Read/write Single.
MirrorIndents | Returns or sets a Long that represents whether left and right indents are the same width. Can be True, False, or wdUndefined. Read/write.
NoLineNumber | True if line numbers are repressed for the specified paragraphs. Can be True, False, or wdUndefined. Read/write Long.
OutlineLevel | Returns or sets the outline level for the specified paragraphs. Read/write WdOutlineLevel.
PageBreakBefore | True if a page break is forced before the specified paragraphs. Can be True, False, or wdUndefined. Read/write Long.
Parent | Returns an Object that represents the parent object of the specified ParagraphFormat object.
ReadingOrder | Returns or sets the reading order of the specified paragraphs without changing their alignment. Read/write WdReadingOrder.
RightIndent | Returns or sets the right indent (in points) for the specified paragraphs. Read/write Single.
Shading | Returns a Shading object that refers to the shading formatting for the specified object.
SpaceAfter | Returns or sets the amount of spacing (in points) after the specified paragraph or text column. Read/write Single.
SpaceAfterAuto | True if Microsoft Word automatically sets the amount of spacing after the specified paragraphs. Read/write Long.
SpaceBefore | Returns or sets the spacing (in points) before the specified paragraphs. Read/write Single.
SpaceBeforeAuto | True if Microsoft Word automatically sets the amount of spacing before the specified paragraphs. Read/write Long.
Style | Returns or sets the style for the specified object. Read/write Variant.
TabStops | Returns or sets a TabStops collection that represents all the custom tab stops for the specified paragraphs. Read/write.
TextboxTightWrap | Returns or sets a WdTextboxTightWrap constant that represents how tightly text wraps around shapes or text boxes. Read/write.
WidowControl | True if the first and last lines in the specified paragraph remain on the same page as the rest of the paragraph when Word repaginates the document. Can be True, False or wdUndefined. Read/write Long.
WordWrap | True if Microsoft Word wraps Latin text in the middle of a word in the specified paragraphs or text frames. Read/write Long.


ParagraphFormat.AddSpaceBetweenFarEastAndAlpha Property (Word)

 Copy code hover
[image]

ParagraphFormat.AddSpaceBetweenFarEastAndAlpha Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word is set to automatically add spaces between Japanese and Latin text for the specified paragraphs. This property returns wdUndefined if it's set to True for only some of the specified paragraphs. Read/write Long.

Syntax

expression .AddSpaceBetweenFarEastAndAlpha

expression A variable that represents a ParagraphFormat object.

Example

This example sets Microsoft Word to automatically add spaces between Japanese and Latin text for the first paragraph in the active document.

VBA Copy code Copy code
ActiveDocument.Paragraphs(1).AddSpaceBetweenFarEastAndAlpha = True

See also

Concepts

ParagraphFormat Object

Other resources

ParagraphFormat Object Members


ParagraphFormat.AddSpaceBetweenFarEastAndDigit Property (Word)

 Copy code hover
[image]

ParagraphFormat.AddSpaceBetweenFarEastAndDigit Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word is set to automatically add spaces between Japanese text and numbers for the specified paragraphs. This property returns wdUndefined if it's set to True for only some of the specified paragraphs. Read/write Long.

Syntax

expression .AddSpaceBetweenFarEastAndDigit

expression A variable that represents a ParagraphFormat object.

Example

This example sets Microsoft Word to automatically add spaces between Japanese text and numbers for the first paragraph in the active document.

VBA Copy code Copy code
ActiveDocument.Paragraphs(1).AddSpaceBetweenFarEastAndDigit = True

See also

Concepts

ParagraphFormat Object

Other resources

ParagraphFormat Object Members


ParagraphFormat.Alignment Property (Word)

 Copy code hover
[image]

ParagraphFormat.Alignment Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a WdParagraphAlignment constant that represents the alignment for the specified paragraphs. Read/write.

Syntax

expression .Alignment

expression Required. A variable that represents a ParagraphFormat object.

Remarks

Some of the constants listed above may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.

See also

Concepts

ParagraphFormat Object

Other resources

ParagraphFormat Object Members


ParagraphFormat.Application Property (Word)

 Copy code hover
[image]

ParagraphFormat.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a ParagraphFormat object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

ParagraphFormat Object

Other resources

ParagraphFormat Object Members


ParagraphFormat.AutoAdjustRightIndent Property (Word)

 Copy code hover
[image]

ParagraphFormat.AutoAdjustRightIndent Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word is set to automatically adjust the right indent for the specified paragraphs if you've specified a set number of characters per line. Returns wdUndefined if the AutoAdjustRightIndent property is set to True for only some of the specified paragraphs. Read/write Long.

Syntax

expression .AutoAdjustRightIndent

expression A variable that represents a ParagraphFormat object.

Example

This example sets Microsoft Word to automatically adjust the right indent for the selected paragraphs if you've specified a set number of characters per line.

VBA Copy code Copy code
With Selection.ParagraphFormat
 .AutoAdjustRightIndent = True
End With

See also

Concepts

ParagraphFormat Object

Other resources

ParagraphFormat Object Members


ParagraphFormat.BaseLineAlignment Property (Word)

 Copy code hover
[image]

ParagraphFormat.BaseLineAlignment Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a WdBaselineAlignment constant that represents the vertical position of fonts on a line. Read/write.

Syntax

expression .BaseLineAlignment

expression Required. A variable that represents a ParagraphFormat object.

See also

Concepts

ParagraphFormat Object

Other resources

ParagraphFormat Object Members


ParagraphFormat.Borders Property (Word)

 Copy code hover
[image]

ParagraphFormat.Borders Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Borders collection that represents all the borders for the specified object.

Syntax

expression .Borders

expression Required. A variable that represents a ParagraphFormat object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

See also

Concepts

ParagraphFormat Object

Other resources

ParagraphFormat Object Members


ParagraphFormat.CharacterUnitFirstLineIndent Property (Word)

 Copy code hover
[image]

ParagraphFormat.CharacterUnitFirstLineIndent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the value (in characters) for a first-line or hanging indent. Use a positive value to set a first-line indent, and use a negative value to set a hanging indent. Read/write Single.

Syntax

expression .CharacterUnitFirstLineIndent

expression Required. A variable that represents a ParagraphFormat object.

Example

This example sets a first-line indent of one character for the first paragraph in the active document.

VBA Copy code Copy code
ActiveDocument.Paragraphs(1) _
 .CharacterUnitFirstLineIndent = 1

This example sets a hanging indent of 1.5 characters for the second paragraph in the active document.

VBA Copy code Copy code
ActiveDocument.Paragraphs(2) _
 .CharacterUnitFirstLineIndent = -1.5

See also

Concepts

ParagraphFormat Object

Other resources

ParagraphFormat Object Members


ParagraphFormat.CharacterUnitLeftIndent Property (Word)

 Copy code hover
[image]

ParagraphFormat.CharacterUnitLeftIndent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the left indent value (in characters) for the specified paragraphs. Read/write Single.

Syntax

expression .CharacterUnitLeftIndent

expression Required. A variable that represents a ParagraphFormat object.

Example

This example sets the left indent of the first paragraph in the active document to one character from the left margin.

VBA Copy code Copy code
ActiveDocument.Paragraphs(1) _
 .CharacterUnitLeftIndent = 1

See also

Concepts

ParagraphFormat Object

Other resources

ParagraphFormat Object Members


ParagraphFormat.CharacterUnitRightIndent Property (Word)

 Copy code hover
[image]

ParagraphFormat.CharacterUnitRightIndent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the right indent value (in characters) for the specified paragraphs. Read/write Single.

Syntax

expression .CharacterUnitRightIndent

expression Required. A variable that represents a ParagraphFormat object.

Example

This example sets the right indent for all paragraphs in the active document to one character from the right margin.

VBA Copy code Copy code
ActiveDocument.Paragraphs _
 .CharacterUnitRightIndent = 1

See also

Concepts

ParagraphFormat Object

Other resources

ParagraphFormat Object Members


ParagraphFormat.CollapsedByDefault Property (Word)

 Copy code hover
[image]

ParagraphFormat.CollapsedByDefault Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets whether the specified paragraph format is collapsed by default. Read-write Long.

Version information

Version Added: Word 2013

Syntax

expression .CollapsedByDefault

expression A variable that represents a ParagraphFormat object.

Remarks

The CollapsedByDefault property setting corresponds to the setting of the Collapsed by Default box under general on the Indents and Spacing tab of the Paragraph dialog box.

Property value

INT32

See also

Concepts

ParagraphFormat Object

Other resources

ParagraphFormat Members


ParagraphFormat.Creator Property (Word)

 Copy code hover
[image]

ParagraphFormat.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a ParagraphFormat object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

ParagraphFormat Object

Other resources

ParagraphFormat Object Members


ParagraphFormat.DisableLineHeightGrid Property (Word)

 Copy code hover
[image]

ParagraphFormat.DisableLineHeightGrid Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word aligns characters in the specified paragraphs to the line grid when a set number of lines per page is specified. Returns wdUndefined if the DisableLineHeightGrid property is set to True for only some of the specified paragraphs. Read/write Long.

Syntax

expression .DisableLineHeightGrid

expression A variable that represents a ParagraphFormat object.

Example

This example sets Microsoft Word to align characters in the selected paragraphs to the line grid if you've specified a set number of lines per page.

VBA Copy code Copy code
With Selection.ParagraphFormat
 .DisableLineHeightGrid = True
End With

See also

Concepts

ParagraphFormat Object

Other resources

ParagraphFormat Object Members


ParagraphFormat.Duplicate Property (Word)

 Copy code hover
[image]

ParagraphFormat.Duplicate Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a read-only ParagraphFormat object that represents the paragraph formatting of the specified paragraph.

Syntax

expression .Duplicate

expression Required. A variable that represents a ParagraphFormat object.

Remarks

You can use the Duplicate property to pick up the settings of all the properties of a duplicated ParagraphFormat object. You can assign the object returned by the Duplicate property to another object of the same type to apply those settings all at once. Before assigning the duplicate object to another object, you can change any of the properties of the duplicate object without affecting the original.

Example

This example duplicates the paragraph formatting of the first paragraph in the active document and stores the formatting in the variable myDup, and then it changes the left indent for myDup to 1 inch. The example also creates a new document, inserts text into it, and then applies the paragraph formatting stored in myDup to the text.

VBA Copy code Copy code
ActiveDocument.Range(Start:=0, End:=0).InsertAfter _
 "Paragraph Number 1"
Set myDup = ActiveDocument.Paragraphs(1).Format.Duplicate
myDup.LeftIndent = InchesToPoints(1)
Documents.Add
Selection.InsertAfter "This is a new paragraph."
Selection.Paragraphs.Format = myDup

See also

Concepts

ParagraphFormat Object

Other resources

ParagraphFormat Object Members


ParagraphFormat.FarEastLineBreakControl Property (Word)

 Copy code hover
[image]

ParagraphFormat.FarEastLineBreakControl Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word applies East Asian line-breaking rules to the specified paragraphs. Returns wdUndefined if the FarEastLineBreakControl property is set to True for only some of the specified paragraphs. Read/write Long.

Syntax

expression .FarEastLineBreakControl

expression A variable that represents a ParagraphFormat object.

Example

This example sets Word to apply East Asian line-breaking rules to the first paragraph in the active document.

VBA Copy code Copy code
ActiveDocument.Paragraphs(1).FarEastLineBreakControl = True

See also

Concepts

ParagraphFormat Object

Other resources

ParagraphFormat Object Members


ParagraphFormat.FirstLineIndent Property (Word)

 Copy code hover
[image]

ParagraphFormat.FirstLineIndent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the value (in points) for a first line or hanging indent. Use a positive value to set a first-line indent, and use a negative value to set a hanging indent. Read/write Single.

Syntax

expression .FirstLineIndent

expression A variable that represents a ParagraphFormat object.

Example

This example sets a first-line indent of 1 inch for the first paragraph in the active document.

VBA Copy code Copy code
ActiveDocument.Paragraphs(1).FirstLineIndent = _
 InchesToPoints(1)

This example sets a hanging indent of 0.5 inch for the second paragraph in the active document. The InchesToPoints method is used to convert inches to points.

VBA Copy code Copy code
ActiveDocument.Paragraphs(2).FirstLineIndent = _
 InchesToPoints(-0.5)

See also

Concepts

ParagraphFormat Object

Other resources

ParagraphFormat Object Members


ParagraphFormat.HalfWidthPunctuationOnTopOfLine Property (Word)

 Copy code hover
[image]

ParagraphFormat.HalfWidthPunctuationOnTopOfLine Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word changes punctuation symbols at the beginning of a line to half-width characters for the specified paragraphs. This property returns wdUndefined if it's set to True for only some of the specified paragraphs. Read/write Long.

Syntax

expression .HalfWidthPunctuationOnTopOfLine

expression A variable that represents a ParagraphFormat object.

Example

This example sets Microsoft Word to change punctuation symbols at the beginning of a line to half-width characters for the first paragraph in the active document.

VBA Copy code Copy code
ActiveDocument.Paragraphs(1).HalfWidthPunctuationOnTopOfLine = True

See also

Concepts

ParagraphFormat Object

Other resources

ParagraphFormat Object Members


ParagraphFormat.HangingPunctuation Property (Word)

 Copy code hover
[image]

ParagraphFormat.HangingPunctuation Property (Word)
See also Send feedback

Published: July 16, 2012

True if hanging punctuation is enabled for the specified paragraphs. This property returns wdUndefined if it's set to True for only some of the specified paragraphs. Read/write Long.

Syntax

expression .HangingPunctuation

expression A variable that represents a ParagraphFormat object.

Example

This example enables hanging punctuation for the first paragraph in the active document.

VBA Copy code Copy code
ActiveDocument.Paragraphs(1).HangingPunctuation = True

See also

Concepts

ParagraphFormat Object

Other resources

ParagraphFormat Object Members


ParagraphFormat.Hyphenation Property (Word)

 Copy code hover
[image]

ParagraphFormat.Hyphenation Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified paragraphs are included in automatic hyphenation. False if the specified paragraphs are to be excluded from automatic hyphenation. Read/write Long.

Syntax

expression .Hyphenation

expression A variable that represents a ParagraphFormat object.

Remarks

This property can be True, False or wdUndefined.

Example

This example turns off automatic hyphenation for all paragraphs in the active document that have the Normal style.

VBA Copy code Copy code
ActiveDocument.Styles("Normal").ParagraphFormat.Hyphenation = False

See also

Concepts

ParagraphFormat Object

Other resources

ParagraphFormat Object Members


ParagraphFormat.KeepTogether Property (Word)

 Copy code hover
[image]

ParagraphFormat.KeepTogether Property (Word)
See also Send feedback

Published: July 16, 2012

True if all lines in the specified paragraphs remain on the same page when Microsoft Word repaginates the document. Read/write Long.

Syntax

expression .KeepTogether

expression A variable that represents a ParagraphFormat object.

Remarks

This property can be True, False, or wdUndefined.

See also

Concepts

ParagraphFormat Object

Other resources

ParagraphFormat Object Members


ParagraphFormat.KeepWithNext Property (Word)

 Copy code hover
[image]

ParagraphFormat.KeepWithNext Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified paragraph remains on the same page as the paragraph that follows it when Microsoft Word repaginates the document. Read/write Long.

Syntax

expression .KeepWithNext

expression A variable that represents a ParagraphFormat object.

Remarks

This property can be True, False, or wdUndefined.

See also

Concepts

ParagraphFormat Object

Other resources

ParagraphFormat Object Members


ParagraphFormat.LeftIndent Property (Word)

 Copy code hover
[image]

ParagraphFormat.LeftIndent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Single that represents the left indent value (in points) for the specified paragraph formatting. Read/write.

Syntax

expression .LeftIndent

expression A variable that represents a ParagraphFormat object.

See also

Concepts

ParagraphFormat Object

Other resources

ParagraphFormat Object Members


ParagraphFormat.LineSpacing Property (Word)

 Copy code hover
[image]

ParagraphFormat.LineSpacing Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the line spacing (in points) for the specified paragraphs. Read/write Single.

Syntax

expression .LineSpacing

expression An expression that represents a ParagraphFormat object.

Remarks

Use the LinesToPoints method to convert a number of lines to the corresponding value in points. For example, LinesToPoints(2) returns the value 24.

The LineSpacing property can be set after the LineSpacingRule property has been set to:

  • wdLineSpaceAtLeast the line spacing can be greater than or equal to, but never less than, the specified LineSpacing value.

  • wdLineSpaceExactly the line spacing never changes from the specified LineSpacing value, even if a larger font is used within the paragraph.

  • wdLineSpaceMultiple a LineSpacing property value must be specified, in points.

Example

This example sets the line spacing for the selected paragraphs to be at least 24 points.

VBA Copy code Copy code
With Selection.ParagraphFormat
 .LineSpacingRule = wdLineSpaceAtLeast
 .LineSpacing = 24
End With

See also

Concepts

ParagraphFormat Object

Other resources

ParagraphFormat Object Members


ParagraphFormat.LineSpacingRule Property (Word)

 Copy code hover
[image]

ParagraphFormat.LineSpacingRule Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the line spacing for the specified paragraph formatting. Read/write WdLineSpacing.

Syntax

expression .LineSpacingRule

expression Required. A variable that represents a ParagraphFormat object.

Remarks

Use wdLineSpaceSingle, wdLineSpace1pt5, or wdLineSpaceDouble to set the line spacing to one of these values. To set the line spacing to an exact number of points or to a multiple number of lines, you must also set the LineSpacing property.

Example

This example double-spaces the lines in the first paragraph of the active document.

VBA Copy code Copy code
ActiveDocument.Paragraphs(1).LineSpacingRule = _
 wdLineSpaceDouble

This example returns the line spacing rule used for the first paragraph in the selection.

VBA Copy code Copy code
lrule = Selection.Paragraphs(1).LineSpacingRule

See also

Concepts

ParagraphFormat Object

Other resources

ParagraphFormat Object Members


ParagraphFormat.LineUnitAfter Property (Word)

 Copy code hover
[image]

ParagraphFormat.LineUnitAfter Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the amount of spacing (in gridlines) after the specified paragraphs. Read/write Single.

Syntax

expression .LineUnitAfter

expression Required. A variable that represents a ParagraphFormat object.

See also

Concepts

ParagraphFormat Object

Other resources

ParagraphFormat Object Members


ParagraphFormat.LineUnitBefore Property (Word)

 Copy code hover
[image]

ParagraphFormat.LineUnitBefore Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the amount of spacing (in gridlines) before the specified paragraphs. Read/write Single.

Syntax

expression .LineUnitBefore

expression Required. A variable that represents a ParagraphFormat object.

See also

Concepts

ParagraphFormat Object

Other resources

ParagraphFormat Object Members


ParagraphFormat.MirrorIndents Property (Word)

 Copy code hover
[image]

ParagraphFormat.MirrorIndents Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Long that represents whether left and right indents are the same width. Can be True, False, or wdUndefined. Read/write.

Syntax

expression .MirrorIndents

expression An expression that returns a ParagraphFormat object.

See also

Concepts

ParagraphFormat Object

Other resources

ParagraphFormat Object Members


ParagraphFormat.NoLineNumber Property (Word)

 Copy code hover
[image]

ParagraphFormat.NoLineNumber Property (Word)
See also Send feedback

Published: July 16, 2012

True if line numbers are repressed for the specified paragraphs. Can be True, False, or wdUndefined. Read/write Long.

Syntax

expression .NoLineNumber

expression A variable that represents a ParagraphFormat object.

Remarks

Use the LineNumbering property of the PageSetup object to turn on line numbering.

See also

Concepts

ParagraphFormat Object

Other resources

ParagraphFormat Object Members


ParagraphFormat.OutlineLevel Property (Word)

 Copy code hover
[image]

ParagraphFormat.OutlineLevel Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the outline level for the specified paragraphs. Read/write WdOutlineLevel.

Syntax

expression .OutlineLevel

expression Required. A variable that represents a ParagraphFormat object.

Remarks

If a paragraph has a heading style applied to it (Heading 1 through Heading 9), the outline level is the same as the heading style and cannot be changed. Outline levels are visible only in outline view or the document map pane.

See also

Concepts

ParagraphFormat Object

Other resources

ParagraphFormat Object Members


ParagraphFormat.PageBreakBefore Property (Word)

 Copy code hover
[image]

ParagraphFormat.PageBreakBefore Property (Word)
See also Send feedback

Published: July 16, 2012

True if a page break is forced before the specified paragraphs. Can be True, False, or wdUndefined. Read/write Long.

Syntax

expression .PageBreakBefore

expression A variable that represents a ParagraphFormat object.

Example

This example forces a page break before the first paragraph in the selection.

VBA Copy code Copy code
Selection.Paragraphs(1).PageBreakBefore = True

See also

Concepts

ParagraphFormat Object

Other resources

ParagraphFormat Object Members


ParagraphFormat.Parent Property (Word)

 Copy code hover
[image]

ParagraphFormat.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified ParagraphFormat object.

Syntax

expression .Parent

expression Required. A variable that represents a ParagraphFormat object.

See also

Concepts

ParagraphFormat Object

Other resources

ParagraphFormat Object Members


ParagraphFormat.ReadingOrder Property (Word)

 Copy code hover
[image]

ParagraphFormat.ReadingOrder Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the reading order of the specified paragraphs without changing their alignment. Read/write WdReadingOrder.

Syntax

expression .ReadingOrder

expression Required. A variable that represents a ParagraphFormat object.

Remarks

Use the LtrPara, LtrRun, RtlPara, and RtlRun methods of the Selection object to change the paragraph alignment along with the reading order.

Example

This example sets the reading order of the first paragraph to right-to-left.

VBA Copy code Copy code
ActiveDocument.Paragraphs(1).ReadingOrder = _
 wdReadingOrderRtl

See also

Concepts

ParagraphFormat Object

Other resources

ParagraphFormat Object Members


ParagraphFormat.RightIndent Property (Word)

 Copy code hover
[image]

ParagraphFormat.RightIndent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the right indent (in points) for the specified paragraphs. Read/write Single.

Syntax

expression .RightIndent

expression Required. A variable that represents a ParagraphFormat object.

Example

This example sets the right indent for all paragraphs in the active document to 1 inch from the right margin. The InchesToPoints method is used to convert inches to points.

VBA Copy code Copy code
ActiveDocument.Paragraphs.RightIndent = InchesToPoints(1)

See also

Concepts

ParagraphFormat Object

Other resources

ParagraphFormat Object Members


ParagraphFormat.Shading Property (Word)

 Copy code hover
[image]

ParagraphFormat.Shading Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Shading object that refers to the shading formatting for the specified object.

Syntax

expression .Shading

expression Required. A variable that represents a ParagraphFormat object.

See also

Concepts

ParagraphFormat Object

Other resources

ParagraphFormat Object Members


ParagraphFormat.SpaceAfter Property (Word)

 Copy code hover
[image]

ParagraphFormat.SpaceAfter Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the amount of spacing (in points) after the specified paragraph or text column. Read/write Single.

Syntax

expression .SpaceAfter

expression Required. A variable that represents a ParagraphFormat object.

Example

This example sets the spacing after all paragraphs in the active document to 12 points.

VBA Copy code Copy code
ActiveDocument.Range.ParagraphFormat.SpaceAfter = 12

See also

Concepts

ParagraphFormat Object

Other resources

ParagraphFormat Object Members


ParagraphFormat.SpaceAfterAuto Property (Word)

 Copy code hover
[image]

ParagraphFormat.SpaceAfterAuto Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word automatically sets the amount of spacing after the specified paragraphs. Read/write Long.

Syntax

expression .SpaceAfterAuto

expression A variable that represents a ParagraphFormat object.

Remarks

Returns wdUndefined if the SpaceAfterAuto property is set to True for only some of the specified paragraphs. Can be set to either True or False.

If SpaceAfterAuto is set to True, the SpaceAfter property is ignored.

Example

This example displays a report showing the SpaceAfterAuto settings for the active document.

VBA Copy code Copy code
Select Case ActiveDocument.Range.ParagraphFormat.SpaceAfterAuto
 Case True
 x = "Spacing after paragraphs is handled " _
 & "automatically for all paragraphs."
 Case False
 x = "Spacing after paragraphs is handled " _
 & "manually for all paragraphs."
 Case wdUndefined
 x = "Spacing after paragraphs is handled " _
 & "automatically for some paragraphs, " _
 & "manually for some paragraphs."
End Select

See also

Concepts

ParagraphFormat Object

Other resources

ParagraphFormat Object Members


ParagraphFormat.SpaceBefore Property (Word)

 Copy code hover
[image]

ParagraphFormat.SpaceBefore Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the spacing (in points) before the specified paragraphs. Read/write Single.

Syntax

expression .SpaceBefore

expression Required. A variable that represents a ParagraphFormat object.

Example

This example sets the spacing before all paragraphs in the active document to 12 points.

VBA Copy code Copy code
ActiveDocument.Range.ParagraphFormat.SpaceBefore = 12

See also

Concepts

ParagraphFormat Object

Other resources

ParagraphFormat Object Members


ParagraphFormat.SpaceBeforeAuto Property (Word)

 Copy code hover
[image]

ParagraphFormat.SpaceBeforeAuto Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word automatically sets the amount of spacing before the specified paragraphs. Read/write Long.

Syntax

expression .SpaceBeforeAuto

expression A variable that represents a ParagraphFormat object.

Remarks

Returns wdUndefined if the SpaceBeforeAuto property is set to True for only some of the specified paragraphs. Can be set to either True or False.

If SpaceBeforeAuto is set to True, the SpaceBefore property is ignored.

Example

This example displays a report showing the SpaceBeforeAuto settings for the active document.

VBA Copy code Copy code
Select Case ActiveDocument.Range.ParagraphFormat.SpaceBeforeAuto
 Case True
 x = "Spacing before paragraphs is handled " _
 & "automatically for all paragraphs."
 Case False
 x = "Spacing before paragraphs is handled " _
 & "manually for all paragraphs."
 Case wdUndefined
 x = "Spacing before paragraphs is handled " _
 & "automatically for some paragraphs, " _
 & "manually for some paragraphs."
End Select

See also

Concepts

ParagraphFormat Object

Other resources

ParagraphFormat Object Members


ParagraphFormat.Style Property (Word)

 Copy code hover
[image]

ParagraphFormat.Style Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the style for the specified object. Read/write Variant.

Syntax

expression .Style

expression Required. A variable that represents a ParagraphFormat object.

Remarks

To set this property, specify the local name of the style, an integer, a WdBuiltinStyle constant, or an object that represents the style.

See also

Concepts

ParagraphFormat Object

Other resources

ParagraphFormat Object Members


ParagraphFormat.TabStops Property (Word)

 Copy code hover
[image]

ParagraphFormat.TabStops Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a TabStops collection that represents all the custom tab stops for the specified paragraphs. Read/write.

Syntax

expression .TabStops

expression A variable that represents a ParagraphFormat object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example adds a centered tab stop at 2 inches to all the paragraphs in the active document. The InchesToPoints method is used to convert inches to points.

VBA Copy code Copy code
With ActiveDocument.Paragraphs.TabStops
 .Add Position:= InchesToPoints(2), Alignment:= wdAlignTabCenter
End With

This example sets the tab stops for every paragraph in the document to match the tab stops in the first paragraph.

VBA Copy code Copy code
Set para1Tabs = ActiveDocument.Paragraphs(1).TabStops
ActiveDocument.Paragraphs.TabStops = para1Tabs

See also

Concepts

ParagraphFormat Object

Other resources

ParagraphFormat Object Members


ParagraphFormat.TextboxTightWrap Property (Word)

 Copy code hover
[image]

ParagraphFormat.TextboxTightWrap Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a WdTextboxTightWrap constant that represents how tightly text wraps around shapes or text boxes. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .TextboxTightWrap

expression An expression that returns a ParagraphFormat object.

See also

Concepts

ParagraphFormat Object

Other resources

ParagraphFormat Object Members


ParagraphFormat.WidowControl Property (Word)

 Copy code hover
[image]

ParagraphFormat.WidowControl Property (Word)
See also Send feedback

Published: July 16, 2012

True if the first and last lines in the specified paragraph remain on the same page as the rest of the paragraph when Word repaginates the document. Can be True, False or wdUndefined. Read/write Long.

Syntax

expression .WidowControl

expression A variable that represents a ParagraphFormat object.

Example

This example formats the paragraphs in the active document so that the first or last line in a paragraph can appear by itself at the top or bottom of a page.

VBA Copy code Copy code
ActiveDocument.Paragraphs.WidowControl = False

See also

Concepts

ParagraphFormat Object

Other resources

ParagraphFormat Object Members


ParagraphFormat.WordWrap Property (Word)

 Copy code hover
[image]

ParagraphFormat.WordWrap Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word wraps Latin text in the middle of a word in the specified paragraphs or text frames. Read/write Long.

Syntax

expression .WordWrap

expression Required. A variable that represents a ParagraphFormat object.

Remarks

This property returns wdUndefined if it is set to True for only some of the specified paragraphs or text frames. This usage may not be available to you, depending on the language support (U.S. English, for example) that you have selected or installed.

Example

This example sets Microsoft Word to wrap Latin text in the middle of a word in the first paragraph of the active document.

VBA Copy code Copy code
ActiveDocument.Paragraphs(1).WordWrap = True

See also

Concepts

ParagraphFormat Object

Other resources

ParagraphFormat Object Members


ParagraphFormat Methods (Word)

 Copy code hover
[image]

ParagraphFormat Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
CloseUp | Removes any spacing before paragraphs in the specified paragraph format.
IndentCharWidth | Indents one or more paragraphs by a specified number of characters.
IndentFirstLineCharWidth | Indents the first line of one or more paragraphs by a specified number of characters.
OpenOrCloseUp | Toggles the spacing before the specified paragraphs.
OpenUp | Sets spacing before the specified paragraphs to 12 points.
Reset | Removes manual paragraph formatting (formatting not applied using a style).
Space1 | Single-spaces the specified paragraphs.
Space15 | Formats the specified paragraphs with 1.5-line spacing.
Space2 | Double-spaces the specified paragraphs.
TabHangingIndent | Sets a hanging indent to a specified number of tab stops. .
TabIndent | Sets the left indent for the specified paragraphs to a specified number of tab stops.


ParagraphFormat.CloseUp Method (Word)

 Copy code hover
[image]

ParagraphFormat.CloseUp Method (Word)
See also Send feedback

Published: July 16, 2012

Removes any spacing before paragraphs in the specified paragraph format.

Syntax

expression .CloseUp

expression Required. A variable that represents a ParagraphFormat object.

Remarks

The following two statements are equivalent:

VBA Copy code Copy code
ParagraphFormat.CloseUp
ParagraphFormat.SpaceBefore = 0

See also

Concepts

ParagraphFormat Object

Other resources

ParagraphFormat Object Members


ParagraphFormat.IndentCharWidth Method (Word)

 Copy code hover
[image]

ParagraphFormat.IndentCharWidth Method (Word)
See also Send feedback

Published: July 16, 2012

Indents one or more paragraphs by a specified number of characters.

Syntax

expression .IndentCharWidth(Count)

expression Required. A variable that represents a ParagraphFormat object.

Parameters

Name | Required/Optional | Data Type | Description
Count | Required | Integer | The number of characters by which the specified paragraphs are to be indented.

Remarks

Using this method is equivalent to clicking the Increase Indent button on the Formatting toolbar.

Example

This example indents the first paragraph of the active document by 10 characters.

VBA Copy code Copy code
Selection.ParagraphFormat.IndentCharWidth 10

See also

Concepts

ParagraphFormat Object

Other resources

ParagraphFormat Object Members


ParagraphFormat.IndentFirstLineCharWidth Method (Word)

 Copy code hover
[image]

ParagraphFormat.IndentFirstLineCharWidth Method (Word)
See also Send feedback

Published: July 16, 2012

Indents the first line of one or more paragraphs by a specified number of characters.

Syntax

expression .IndentFirstLineCharWidth(Count)

expression Required. A variable that represents a ParagraphFormat object.

Parameters

Name | Required/Optional | Data Type | Description
Count | Required | Integer | The number of characters by which the first line of each specified paragraph is to be indented.

Example

This example indents the first line of the first paragraph in the active document by 10 characters.

VBA Copy code Copy code
Selection.ParagraphFormat.IndentFirstLineCharWidth 10

See also

Concepts

ParagraphFormat Object

Other resources

ParagraphFormat Object Members


ParagraphFormat.OpenOrCloseUp Method (Word)

 Copy code hover
[image]

ParagraphFormat.OpenOrCloseUp Method (Word)
See also Send feedback

Published: July 16, 2012

Toggles the spacing before the specified paragraphs.

Syntax

expression .OpenOrCloseUp

expression Required. A variable that represents a ParagraphFormat object.

Remarks

If the spacing before the specified paragraphs is 0 (zero), this method sets spacing to 12 points. If the spacing before the paragraphs is greater than 0 (zero), this method sets spacing to 0 (zero).

Example

This example toggles the formatting of the first paragraph in the active document to either add 12 points of space before the paragraph or leave no space before it.

VBA Copy code Copy code
Selection.ParagraphFormat.OpenOrCloseUp

See also

Concepts

ParagraphFormat Object

Other resources

ParagraphFormat Object Members


ParagraphFormat.OpenUp Method (Word)

 Copy code hover
[image]

ParagraphFormat.OpenUp Method (Word)
See also Send feedback

Published: July 16, 2012

Sets spacing before the specified paragraphs to 12 points.

Syntax

expression .OpenUp

expression Required. A variable that represents a ParagraphFormat object.

Remarks

You can also use the SpaceBefore property to set the spacing of paragraphs. The following two statements are equivalent:

VBA Copy code Copy code
Selection.ParagraphFormat.OpenUp
Selection.ParagraphFormat.SpaceBefore = 12

Example

This example changes the formatting of the second paragraph in the active document to leave 12 points of space before the paragraph.

VBA Copy code Copy code
Selection.ParagraphFormat.OpenUp

See also

Concepts

ParagraphFormat Object

Other resources

ParagraphFormat Object Members


ParagraphFormat.Reset Method (Word)

 Copy code hover
[image]

ParagraphFormat.Reset Method (Word)
See also Send feedback

Published: July 16, 2012

Removes manual paragraph formatting (formatting not applied using a style).

Syntax

expression .Reset

expression Required. A variable that represents a Paragraph object.

Remarks

If you manually right align a paragraph and the underlying style has a different alignment, the Reset method changes the alignment to match the formatting of the underlying style.

Example

This example removes manual paragraph formatting from the second paragraph in the active document.

VBA Copy code Copy code
ActiveDocument.Paragraphs(2).Reset

See also

Concepts

ParagraphFormat Object

Other resources

ParagraphFormat Object Members


ParagraphFormat.Space1 Method (Word)

 Copy code hover
[image]

ParagraphFormat.Space1 Method (Word)
See also Send feedback

Published: July 16, 2012

Single-spaces the specified paragraphs.

Syntax

expression .Space1

expression Required. A variable that represents a ParagraphFormat object.

Remarks

The exact spacing is determined by the font size of the largest characters in each paragraph.

You can also use the LineSpacingRule property to set the spacing of paragraphs. The following two statements are equivalent:

VBA Copy code Copy code
Selection.ParagraphFormat.Space1
Selection.ParagraphFormat.LineSpacingRule = wdLineSpaceSingle

Example

This example changes the first paragraph in the active document to single spacing.

VBA Copy code Copy code
Selection.ParagraphFormat.Space1

See also

Concepts

ParagraphFormat Object

Other resources

ParagraphFormat Object Members


ParagraphFormat.Space15 Method (Word)

 Copy code hover
[image]

ParagraphFormat.Space15 Method (Word)
See also Send feedback

Published: July 16, 2012

Formats the specified paragraphs with 1.5-line spacing.

Syntax

expression .Space15

expression Required. A variable that represents a ParagraphFormat object.

Remarks

The exact spacing is determined by adding 6 points to the font size of the largest character in each paragraph.

You can also use the LineSpacingRule property to set the spacing of paragraphs. The following two statements are equivalent:

VBA Copy code Copy code
Selection.ParagraphFormat.Space15
Selection.ParagraphFormat.LineSpacingRule = wdLineSpace1pt5

Example

This example changes the first paragraph in the active document to 1.5-line spacing.

VBA Copy code Copy code
Selection.ParagraphFormat.Space15

See also

Concepts

ParagraphFormat Object

Other resources

ParagraphFormat Object Members


ParagraphFormat.Space2 Method (Word)

 Copy code hover
[image]

ParagraphFormat.Space2 Method (Word)
See also Send feedback

Published: July 16, 2012

Double-spaces the specified paragraphs.

Syntax

expression .Space2

expression Required. A variable that represents a ParagraphFormat object.

Remarks

The exact spacing is determined by adding 12 points to the font size of the largest character in each paragraph.

You can also use the LineSpacingRule property to set the spacing of paragraphs. For example, the following two statements are equivalent:

VBA Copy code Copy code
Selection.ParagraphFormat.Space2
Selection.ParagraphFormat.LineSpacingRule = wdLineSpaceDouble

Example

This example changes the first paragraph in the selection to double spacing.

VBA Copy code Copy code
Selection.ParagraphFormat.Space2

See also

Concepts

ParagraphFormat Object

Other resources

ParagraphFormat Object Members


ParagraphFormat.TabHangingIndent Method (Word)

 Copy code hover
[image]

ParagraphFormat.TabHangingIndent Method (Word)
See also Send feedback

Published: July 16, 2012

Sets a hanging indent to a specified number of tab stops. .

Syntax

expression .TabHangingIndent(Count)

expression Required. A variable that represents a ParagraphFormat object.

Parameters

Name | Required/Optional | Data Type | Description
Count | Required | Integer | The number of tab stops to indent (if positive) or the number of tab stops to remove from the indent (if negative).

Remarks

You can also use this method to remove tab stops from a hanging indent if the value of Count is a negative number.

Example

This example sets a hanging indent of the selected paragraphs to the second tab stop.

VBA Copy code Copy code
Selection.ParagraphFormat.TabHangingIndent(2)

This example moves the hanging indent of the selected paragraphs back one tab stop.

VBA Copy code Copy code
Selection.ParagraphFormat.TabHangingIndent(-1)

See also

Concepts

ParagraphFormat Object

Other resources

ParagraphFormat Object Members


ParagraphFormat.TabIndent Method (Word)

 Copy code hover
[image]

ParagraphFormat.TabIndent Method (Word)
See also Send feedback

Published: July 16, 2012

Sets the left indent for the specified paragraphs to a specified number of tab stops.

Syntax

expression .TabIndent(Count)

expression Required. A variable that represents a ParagraphFormat object.

Parameters

Name | Required/Optional | Data Type | Description
Count | Required | Integer | The number of tab stops to indent (if positive) or the number of tab stops to remove from the indent (if negative).

Remarks

You can also use this method to remove an indent if the value of Count is a negative number.

Example

This example indents the selected paragraphs to the second tab stop.

VBA Copy code Copy code
Selection.ParagraphFormat.TabIndent(2)

This example moves the indent of the selected paragraphs back one tab stop.

VBA Copy code Copy code
Selection.ParagraphFormat.TabIndent(-1)

See also

Concepts

ParagraphFormat Object

Other resources

ParagraphFormat Object Members


Paragraphs Object (Word)

 Copy code hover
[image]

Paragraphs Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of Paragraph objects in a selection, range, or document.

Remarks

Use the Paragraphs property to return the Paragraphs collection. The following example formats the selected paragraphs to be double-spaced and right-aligned.

VBA Copy code Copy code
With Selection.Paragraphs
 .Alignment = wdAlignParagraphRight
 .LineSpacingRule = wdLineSpaceDouble
End With

Use the Add, InsertParagraph, InsertParagraphAfter, or InsertParagraphBefore method to add a new paragraph to a document. The following example adds a new paragraph before the first paragraph in the selection.

VBA Copy code Copy code
Selection.Paragraphs.Add Range:=Selection.Paragraphs(1).Range

The following example also adds a paragraph before the first paragraph in the selection.

VBA Copy code Copy code
Selection.Paragraphs(1).Range.InsertParagraphBefore

Use Paragraphs(Index), where Index is the index number, to return a single Paragraph object. The following example right aligns the first paragraph in the active document.

VBA Copy code Copy code
ActiveDocument.Paragraphs(1).Alignment = wdAlignParagraphRight

The Count property for this collection in a document returns the number of items in the main story only. To count items in other stories use the collection with the Range object.

See also

Concepts

Word Object Model Reference

Other resources

Paragraphs Object Members


Paragraphs Members (Word)

 Copy code hover
[image]

Paragraphs Members (Word)
Send feedback

Published: July 16, 2012

A collection of Paragraph objects in a selection, range, or document.

Methods

Name | Description
Add | Returns a Paragraph object that represents a new, blank paragraph added to a document.
CloseUp | Removes any spacing before the specified paragraphs.
DecreaseSpacing | Decreases the spacing before and after paragraphs in six-point increments.
IncreaseSpacing | Increases the spacing before and after paragraphs in six-point increments.
Indent | Indents one or more paragraphs by one level.
IndentCharWidth | Indents one or more paragraphs by a specified number of characters.
IndentFirstLineCharWidth | Indents the first line of one or more paragraphs by a specified number of characters.
Item | Returns an individual Paragraph object in a collection.
OpenOrCloseUp | Toggles spacing before paragraphs.
OpenUp | Sets spacing before the specified paragraphs to 12 points.
Outdent | Removes one level of indent for one or more paragraphs.
OutlineDemote | Applies the next heading level style (Heading 1 through Heading 8) to the specified paragraphs.
OutlineDemoteToBody | Demotes the specified paragraph or paragraphs to body text by applying the Normal style.
OutlinePromote | Applies the previous heading level style (Heading 1 through Heading 8) to the specified paragraph or paragraphs.
Reset | Removes manual paragraph formatting (formatting not applied using a style). .
Space1 | Single-spaces the specified paragraphs.
Space15 | Formats the specified paragraphs with 1.5-line spacing.
Space2 | Double-spaces the specified paragraphs. .
TabHangingIndent | Sets a hanging indent to a specified number of tab stops.
TabIndent | Sets the left indent for the specified paragraphs to a specified number of tab stops.

Properties

Name | Description
AddSpaceBetweenFarEastAndAlpha | True if Microsoft Word is set to automatically add spaces between Japanese and Latin text for the specified paragraphs. This property returns wdUndefined if it's set to True for only some of the specified paragraphs. Read/write Long.
AddSpaceBetweenFarEastAndDigit | True if Microsoft Word is set to automatically add spaces between Japanese text and numbers for the specified paragraphs. This property returns wdUndefined if it's set to True for only some of the specified paragraphs. Read/write Long.
Alignment | Returns or sets a WdParagraphAlignment constant that represents the alignment for the specified paragraphs. Read/write.
Application | Returns an Application object that represents the Microsoft Word application.
AutoAdjustRightIndent | True if Microsoft Word is set to automatically adjust the right indent for the specified paragraphs if you've specified a set number of characters per line. Returns wdUndefined if the AutoAdjustRightIndent property is set to True for only some of the specified paragraphs. Read/write Long.
BaseLineAlignment | Returns or sets a WdBaselineAlignment constant that represents the vertical position of fonts on a line. Read/write.
Borders | Returns a Borders collection that represents all the borders for the specified object.
CharacterUnitFirstLineIndent | Returns or sets the value (in characters) for a first-line or hanging indent. Use a positive value to set a first-line indent, and use a negative value to set a hanging indent. Read/write Single.
CharacterUnitLeftIndent | Returns or sets the left indent value (in characters) for the specified paragraphs. Read/write Single.
CharacterUnitRightIndent | Returns or sets the right indent value (in characters) for the specified paragraphs. Read/write Single.
Count | Returns a Long that represents the number of paragraphs in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
DisableLineHeightGrid | True if Microsoft Word aligns characters in the specified paragraphs to the line grid when a set number of lines per page is specified. Returns wdUndefined if the DisableLineHeightGrid property is set to True for only some of the specified paragraphs. Read/write Long.
FarEastLineBreakControl | True if Microsoft Word applies East Asian line-breaking rules to the specified paragraphs. Returns wdUndefined if the FarEastLineBreakControl property is set to True for only some of the specified paragraphs. Read/write Long.
First | Returns a Paragraph object that represents the first item in the Paragraphs collection.
FirstLineIndent | Returns or sets the value (in points) for a first line or hanging indent. Use a positive value to set a first-line indent, and use a negative value to set a hanging indent. Read/write Single.
Format | Returns or sets a ParagraphFormat object that represents the formatting of the specified paragraph or paragraphs.
HalfWidthPunctuationOnTopOfLine | True if Microsoft Word changes punctuation symbols at the beginning of a line to half-width characters for the specified paragraphs. This property returns wdUndefined if it's set to True for only some of the specified paragraphs. Read/write Long.
HangingPunctuation | True if hanging punctuation is enabled for the specified paragraphs. This property returns wdUndefined if it's set to True for only some of the specified paragraphs. Read/write Long.
Hyphenation | True if the specified paragraphs are included in automatic hyphenation. False if the specified paragraphs are to be excluded from automatic hyphenation. Read/write Long.
KeepTogether | True if all lines in the specified paragraphs remain on the same page when Microsoft Word repaginates the document. Read/write Long.
KeepWithNext | True if the specified paragraphs remain on the same page as the paragraphs that follow it when Microsoft Word repaginates the document. Read/write Long.
Last | Returns a Paragraph object that represents the last item in the collection of paragraphs.
LeftIndent | Returns or sets a Single that represents the left indent value (in points) for the specified paragraphs. Read/write.
LineSpacing | Returns or sets the line spacing (in points) for the specified paragraphs. Read/write Single.
LineSpacingRule | Returns or sets the line spacing for the specified paragraphs. Read/write WdLineSpacing.
LineUnitAfter | Returns or sets the amount of spacing (in gridlines) after the specified paragraphs. Read/write Single.
LineUnitBefore | Returns or sets the amount of spacing (in gridlines) before the specified paragraphs. Read/write Single.
NoLineNumber | True if line numbers are repressed for the specified paragraphs. Can be True, False, or wdUndefined. Read/write Long.
OutlineLevel | Returns or sets the outline level for the specified paragraphs. Read/write WdOutlineLevel.
PageBreakBefore | True if a page break is forced before the specified paragraphs. Can be True, False, or wdUndefined. Read/write Long.
Parent | Returns an Object that represents the parent object of the specified Paragraphs object.
ReadingOrder | Returns or sets the reading order of the specified paragraphs without changing their alignment. Read/write WdReadingOrder.
RightIndent | Returns or sets the right indent (in points) for the specified paragraphs. Read/write Single.
Shading | Returns a Shading object that refers to the shading formatting for the specified paragraphs.
SpaceAfter | Returns or sets the amount of spacing (in points) after the specified paragraph or text column. Read/write Single.
SpaceAfterAuto | True if Microsoft Word automatically sets the amount of spacing after the specified paragraphs. Read/write Long.
SpaceBefore | Returns or sets the spacing (in points) before the specified paragraphs. Read/write Single.
SpaceBeforeAuto | True if Microsoft Word automatically sets the amount of spacing before the specified paragraphs. Read/write Long.
Style | Returns or sets the style for the specified paragraphs. Read/write Variant.
TabStops | Returns or sets a TabStops collection that represents all the custom tab stops for the specified paragraphs. Read/write.
WidowControl | True if the first and last lines in the specified paragraph remain on the same page as the rest of the paragraph when Word repaginates the document. Can be True, False or wdUndefined. Read/write Long.
WordWrap | True if Microsoft Word wraps Latin text in the middle of a word in the specified paragraphs. Read/write Long.


Paragraphs Properties (Word)

 Copy code hover
[image]

Paragraphs Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
AddSpaceBetweenFarEastAndAlpha | True if Microsoft Word is set to automatically add spaces between Japanese and Latin text for the specified paragraphs. This property returns wdUndefined if it's set to True for only some of the specified paragraphs. Read/write Long.
AddSpaceBetweenFarEastAndDigit | True if Microsoft Word is set to automatically add spaces between Japanese text and numbers for the specified paragraphs. This property returns wdUndefined if it's set to True for only some of the specified paragraphs. Read/write Long.
Alignment | Returns or sets a WdParagraphAlignment constant that represents the alignment for the specified paragraphs. Read/write.
Application | Returns an Application object that represents the Microsoft Word application.
AutoAdjustRightIndent | True if Microsoft Word is set to automatically adjust the right indent for the specified paragraphs if you've specified a set number of characters per line. Returns wdUndefined if the AutoAdjustRightIndent property is set to True for only some of the specified paragraphs. Read/write Long.
BaseLineAlignment | Returns or sets a WdBaselineAlignment constant that represents the vertical position of fonts on a line. Read/write.
Borders | Returns a Borders collection that represents all the borders for the specified object.
CharacterUnitFirstLineIndent | Returns or sets the value (in characters) for a first-line or hanging indent. Use a positive value to set a first-line indent, and use a negative value to set a hanging indent. Read/write Single.
CharacterUnitLeftIndent | Returns or sets the left indent value (in characters) for the specified paragraphs. Read/write Single.
CharacterUnitRightIndent | Returns or sets the right indent value (in characters) for the specified paragraphs. Read/write Single.
Count | Returns a Long that represents the number of paragraphs in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
DisableLineHeightGrid | True if Microsoft Word aligns characters in the specified paragraphs to the line grid when a set number of lines per page is specified. Returns wdUndefined if the DisableLineHeightGrid property is set to True for only some of the specified paragraphs. Read/write Long.
FarEastLineBreakControl | True if Microsoft Word applies East Asian line-breaking rules to the specified paragraphs. Returns wdUndefined if the FarEastLineBreakControl property is set to True for only some of the specified paragraphs. Read/write Long.
First | Returns a Paragraph object that represents the first item in the Paragraphs collection.
FirstLineIndent | Returns or sets the value (in points) for a first line or hanging indent. Use a positive value to set a first-line indent, and use a negative value to set a hanging indent. Read/write Single.
Format | Returns or sets a ParagraphFormat object that represents the formatting of the specified paragraph or paragraphs.
HalfWidthPunctuationOnTopOfLine | True if Microsoft Word changes punctuation symbols at the beginning of a line to half-width characters for the specified paragraphs. This property returns wdUndefined if it's set to True for only some of the specified paragraphs. Read/write Long.
HangingPunctuation | True if hanging punctuation is enabled for the specified paragraphs. This property returns wdUndefined if it's set to True for only some of the specified paragraphs. Read/write Long.
Hyphenation | True if the specified paragraphs are included in automatic hyphenation. False if the specified paragraphs are to be excluded from automatic hyphenation. Read/write Long.
KeepTogether | True if all lines in the specified paragraphs remain on the same page when Microsoft Word repaginates the document. Read/write Long.
KeepWithNext | True if the specified paragraphs remain on the same page as the paragraphs that follow it when Microsoft Word repaginates the document. Read/write Long.
Last | Returns a Paragraph object that represents the last item in the collection of paragraphs.
LeftIndent | Returns or sets a Single that represents the left indent value (in points) for the specified paragraphs. Read/write.
LineSpacing | Returns or sets the line spacing (in points) for the specified paragraphs. Read/write Single.
LineSpacingRule | Returns or sets the line spacing for the specified paragraphs. Read/write WdLineSpacing.
LineUnitAfter | Returns or sets the amount of spacing (in gridlines) after the specified paragraphs. Read/write Single.
LineUnitBefore | Returns or sets the amount of spacing (in gridlines) before the specified paragraphs. Read/write Single.
NoLineNumber | True if line numbers are repressed for the specified paragraphs. Can be True, False, or wdUndefined. Read/write Long.
OutlineLevel | Returns or sets the outline level for the specified paragraphs. Read/write WdOutlineLevel.
PageBreakBefore | True if a page break is forced before the specified paragraphs. Can be True, False, or wdUndefined. Read/write Long.
Parent | Returns an Object that represents the parent object of the specified Paragraphs object.
ReadingOrder | Returns or sets the reading order of the specified paragraphs without changing their alignment. Read/write WdReadingOrder.
RightIndent | Returns or sets the right indent (in points) for the specified paragraphs. Read/write Single.
Shading | Returns a Shading object that refers to the shading formatting for the specified paragraphs.
SpaceAfter | Returns or sets the amount of spacing (in points) after the specified paragraph or text column. Read/write Single.
SpaceAfterAuto | True if Microsoft Word automatically sets the amount of spacing after the specified paragraphs. Read/write Long.
SpaceBefore | Returns or sets the spacing (in points) before the specified paragraphs. Read/write Single.
SpaceBeforeAuto | True if Microsoft Word automatically sets the amount of spacing before the specified paragraphs. Read/write Long.
Style | Returns or sets the style for the specified paragraphs. Read/write Variant.
TabStops | Returns or sets a TabStops collection that represents all the custom tab stops for the specified paragraphs. Read/write.
WidowControl | True if the first and last lines in the specified paragraph remain on the same page as the rest of the paragraph when Word repaginates the document. Can be True, False or wdUndefined. Read/write Long.
WordWrap | True if Microsoft Word wraps Latin text in the middle of a word in the specified paragraphs. Read/write Long.


Paragraphs.AddSpaceBetweenFarEastAndAlpha Property (Word)

 Copy code hover
[image]

Paragraphs.AddSpaceBetweenFarEastAndAlpha Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word is set to automatically add spaces between Japanese and Latin text for the specified paragraphs. This property returns wdUndefined if it's set to True for only some of the specified paragraphs. Read/write Long.

Syntax

expression .AddSpaceBetweenFarEastAndAlpha

expression A variable that represents a Paragraphs collection.

Example

This example sets Microsoft Word to automatically add spaces between Japanese and Latin text for the first paragraph in the active document.

VBA Copy code Copy code
ActiveDocument.Paragraphs(1).AddSpaceBetweenFarEastAndAlpha = True

See also

Concepts

Paragraphs Collection Object

Other resources

Paragraphs Object Members


Paragraphs.AddSpaceBetweenFarEastAndDigit Property (Word)

 Copy code hover
[image]

Paragraphs.AddSpaceBetweenFarEastAndDigit Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word is set to automatically add spaces between Japanese text and numbers for the specified paragraphs. This property returns wdUndefined if it's set to True for only some of the specified paragraphs. Read/write Long.

Syntax

expression .AddSpaceBetweenFarEastAndDigit

expression A variable that represents a Paragraphs collection.

Example

This example sets Microsoft Word to automatically add spaces between Japanese text and numbers for the first paragraph in the active document.

VBA Copy code Copy code
ActiveDocument.Paragraphs(1).AddSpaceBetweenFarEastAndDigit = True

See also

Concepts

Paragraphs Collection Object

Other resources

Paragraphs Object Members


Paragraphs.Alignment Property (Word)

 Copy code hover
[image]

Paragraphs.Alignment Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a WdParagraphAlignment constant that represents the alignment for the specified paragraphs. Read/write.

Syntax

expression .Alignment

expression Required. A variable that represents a Paragraphs collection.

Remarks

Some of the WdParagraphAlignment constants may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.

See also

Concepts

Paragraphs Collection Object

Other resources

Paragraphs Object Members


Paragraphs.Application Property (Word)

 Copy code hover
[image]

Paragraphs.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a Paragraphs collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

Paragraphs Collection Object

Other resources

Paragraphs Object Members


Paragraphs.AutoAdjustRightIndent Property (Word)

 Copy code hover
[image]

Paragraphs.AutoAdjustRightIndent Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word is set to automatically adjust the right indent for the specified paragraphs if you've specified a set number of characters per line. Returns wdUndefined if the AutoAdjustRightIndent property is set to True for only some of the specified paragraphs. Read/write Long.

Syntax

expression .AutoAdjustRightIndent

expression A variable that represents a Paragraphs collection.

Example

This example sets Word to automatically adjust the right indent for the selected paragraphs if you've specified a set number of characters per line.

VBA Copy code Copy code
With Selection.ParagraphFormat
 .AutoAdjustRightIndent = True
End With

See also

Concepts

Paragraphs Collection Object

Other resources

Paragraphs Object Members


Paragraphs.BaseLineAlignment Property (Word)

 Copy code hover
[image]

Paragraphs.BaseLineAlignment Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a WdBaselineAlignment constant that represents the vertical position of fonts on a line. Read/write.

Syntax

expression .BaseLineAlignment

expression Required. A variable that represents a Paragraphs collection.

Example

This example sets Microsoft Word to automatically adjust the baseline font alignment in the active document.

VBA Copy code Copy code
ActiveDocument.BaseLineAlignment = wdBaselineAlignAuto

See also

Concepts

Paragraphs Collection Object

Other resources

Paragraphs Object Members


Paragraphs.Borders Property (Word)

 Copy code hover
[image]

Paragraphs.Borders Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Borders collection that represents all the borders for the specified object.

Syntax

expression .Borders

expression Required. A variable that represents a Paragraphs collection.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

See also

Concepts

Paragraphs Collection Object

Other resources

Paragraphs Object Members


Paragraphs.CharacterUnitFirstLineIndent Property (Word)

 Copy code hover
[image]

Paragraphs.CharacterUnitFirstLineIndent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the value (in characters) for a first-line or hanging indent. Use a positive value to set a first-line indent, and use a negative value to set a hanging indent. Read/write Single.

Syntax

expression .CharacterUnitFirstLineIndent

expression Required. A variable that represents a Paragraphs collection.

Example

This example sets a first-line indent of one character for the first paragraph in the active document.

VBA Copy code Copy code
ActiveDocument.Paragraphs(1) _
 .CharacterUnitFirstLineIndent = 1

This example sets a hanging indent of 1.5 characters for the second paragraph in the active document.

VBA Copy code Copy code
ActiveDocument.Paragraphs(2) _
 .CharacterUnitFirstLineIndent = -1.5

See also

Concepts

Paragraphs Collection Object

Other resources

Paragraphs Object Members


Paragraphs.CharacterUnitLeftIndent Property (Word)

 Copy code hover
[image]

Paragraphs.CharacterUnitLeftIndent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the left indent value (in characters) for the specified paragraphs. Read/write Single.

Syntax

expression .CharacterUnitLeftIndent

expression Required. A variable that represents a Paragraphs collection.

Example

This example sets the left indent of the first paragraph in the active document to one character from the left margin.

VBA Copy code Copy code
ActiveDocument.Paragraphs(1) _
 .CharacterUnitLeftIndent = 1

See also

Concepts

Paragraphs Collection Object

Other resources

Paragraphs Object Members


Paragraphs.CharacterUnitRightIndent Property (Word)

 Copy code hover
[image]

Paragraphs.CharacterUnitRightIndent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the right indent value (in characters) for the specified paragraphs. Read/write Single.

Syntax

expression .CharacterUnitRightIndent

expression Required. A variable that represents a Paragraphs collection.

Example

This example sets the right indent for all paragraphs in the active document to one character from the right margin.

VBA Copy code Copy code
ActiveDocument.Paragraphs _
 .CharacterUnitRightIndent = 1

See also

Concepts

Paragraphs Collection Object

Other resources

Paragraphs Object Members


Paragraphs.Count Property (Word)

 Copy code hover
[image]

Paragraphs.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of paragraphs in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents a Paragraphs collection.

Example

This example displays the number of paragraphs in the active document.

VBA Copy code Copy code
MsgBox "The active document contains " & _
 ActiveDocument.Paragraphs.Count & " paragraphs."

See also

Concepts

Paragraphs Collection Object

Other resources

Paragraphs Object Members


Paragraphs.Creator Property (Word)

 Copy code hover
[image]

Paragraphs.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a Paragraphs collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Paragraphs Collection Object

Other resources

Paragraphs Object Members


Paragraphs.DisableLineHeightGrid Property (Word)

 Copy code hover
[image]

Paragraphs.DisableLineHeightGrid Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word aligns characters in the specified paragraphs to the line grid when a set number of lines per page is specified. Returns wdUndefined if the DisableLineHeightGrid property is set to True for only some of the specified paragraphs. Read/write Long.

Syntax

expression .DisableLineHeightGrid

expression A variable that represents a Paragraphs collection.

Example

This example sets Word to align characters in the selected paragraphs to the line grid if you've specified a set number of lines per page.

VBA Copy code Copy code
With Selection.ParagraphFormat
 .DisableLineHeightGrid = True
End With

See also

Concepts

Paragraphs Collection Object

Other resources

Paragraphs Object Members


Paragraphs.FarEastLineBreakControl Property (Word)

 Copy code hover
[image]

Paragraphs.FarEastLineBreakControl Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word applies East Asian line-breaking rules to the specified paragraphs. Returns wdUndefined if the FarEastLineBreakControl property is set to True for only some of the specified paragraphs. Read/write Long.

Syntax

expression .FarEastLineBreakControl

expression A variable that represents a Paragraphs collection.

Example

This example sets Word to apply East Asian line-breaking rules to the first paragraph in the active document.

VBA Copy code Copy code
ActiveDocument.Paragraphs(1).FarEastLineBreakControl = True

See also

Concepts

Paragraphs Collection Object

Other resources

Paragraphs Object Members


Paragraphs.First Property (Word)

 Copy code hover
[image]

Paragraphs.First Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Paragraph object that represents the first item in the Paragraphs collection.

Syntax

expression .First

expression Required. A variable that represents a Paragraphs collection.

See also

Concepts

Paragraphs Collection Object

Other resources

Paragraphs Object Members


Paragraphs.FirstLineIndent Property (Word)

 Copy code hover
[image]

Paragraphs.FirstLineIndent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the value (in points) for a first line or hanging indent. Use a positive value to set a first-line indent, and use a negative value to set a hanging indent. Read/write Single.

Syntax

expression .FirstLineIndent

expression A variable that represents a Paragraphs collection.

Example

This example sets a first-line indent of 1 inch for the first paragraph in the active document.

VBA Copy code Copy code
ActiveDocument.Paragraphs.FirstLineIndent = _
 InchesToPoints(1)

This example sets a hanging indent of 0.5 inch for the second paragraph in the active document. The InchesToPoints method is used to convert inches to points.

VBA Copy code Copy code
ActiveDocument.Paragraphs.FirstLineIndent = _
 InchesToPoints(-0.5)

See also

Concepts

Paragraphs Collection Object

Other resources

Paragraphs Object Members


Paragraphs.Format Property (Word)

 Copy code hover
[image]

Paragraphs.Format Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a ParagraphFormat object that represents the formatting of the specified paragraph or paragraphs.

Syntax

expression .Format

expression Required. A variable that represents a Paragraphs collection.

Example

The following example left-aligns all the paragraphs in the active document.

VBA Copy code Copy code
ActiveDocument.Paragraphs.Format.Alignment = wdAlignParagraphLeft

See also

Concepts

Paragraphs Collection Object

Other resources

Paragraphs Object Members


Paragraphs.HalfWidthPunctuationOnTopOfLine Property (Word)

 Copy code hover
[image]

Paragraphs.HalfWidthPunctuationOnTopOfLine Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word changes punctuation symbols at the beginning of a line to half-width characters for the specified paragraphs. This property returns wdUndefined if it's set to True for only some of the specified paragraphs. Read/write Long.

Syntax

expression .HalfWidthPunctuationOnTopOfLine

expression A variable that represents a Paragraphs collection.

Example

This example sets Microsoft Word to change punctuation symbols at the beginning of a line to half-width characters for the first paragraph in the active document.

VBA Copy code Copy code
ActiveDocument.Paragraphs.HalfWidthPunctuationOnTopOfLine = True

See also

Concepts

Paragraphs Collection Object

Other resources

Paragraphs Object Members


Paragraphs.HangingPunctuation Property (Word)

 Copy code hover
[image]

Paragraphs.HangingPunctuation Property (Word)
See also Send feedback

Published: July 16, 2012

True if hanging punctuation is enabled for the specified paragraphs. This property returns wdUndefined if it's set to True for only some of the specified paragraphs. Read/write Long.

Syntax

expression .HangingPunctuation

expression A variable that represents a Paragraphs collection.

Example

This example enables hanging punctuation for the first paragraph in the active document.

VBA Copy code Copy code
ActiveDocument.Paragraphs.HangingPunctuation = True

See also

Concepts

Paragraphs Collection Object

Other resources

Paragraphs Object Members


Paragraphs.Hyphenation Property (Word)

 Copy code hover
[image]

Paragraphs.Hyphenation Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified paragraphs are included in automatic hyphenation. False if the specified paragraphs are to be excluded from automatic hyphenation. Read/write Long.

Syntax

expression .Hyphenation

expression A variable that represents a Paragraphs collection.

Remarks

This property can be True, False or wdUndefined.

Example

This example turns off automatic hyphenation for all paragraphs in the active document.

VBA Copy code Copy code
ActiveDocument.Paragraphs.Hyphenation = False

See also

Concepts

Paragraphs Collection Object

Other resources

Paragraphs Object Members


Paragraphs.KeepTogether Property (Word)

 Copy code hover
[image]

Paragraphs.KeepTogether Property (Word)
See also Send feedback

Published: July 16, 2012

True if all lines in the specified paragraphs remain on the same page when Microsoft Word repaginates the document. Read/write Long.

Syntax

expression .KeepTogether

expression A variable that represents a Paragraphs collection.

Remarks

This property can be True, False, or wdUndefined.

Example

This example formats the paragraphs in the active document so that all the lines in each paragraph are on the same page when Word repaginates the document.

VBA Copy code Copy code
ActiveDocument.Paragraphs.KeepTogether = True

See also

Concepts

Paragraphs Collection Object

Other resources

Paragraphs Object Members


Paragraphs.KeepWithNext Property (Word)

 Copy code hover
[image]

Paragraphs.KeepWithNext Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified paragraphs remain on the same page as the paragraphs that follow it when Microsoft Word repaginates the document. Read/write Long.

Syntax

expression .KeepWithNext

expression A variable that represents a Paragraphs collection.

Remarks

This property can be True, False, or wdUndefined.

Example

This example sets all paragraphs in the current selection to be on the same page.

VBA Copy code Copy code
Selection.Paragraphs.KeepWithNext = True

See also

Concepts

Paragraphs Collection Object

Other resources

Paragraphs Object Members


Paragraphs.Last Property (Word)

 Copy code hover
[image]

Paragraphs.Last Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Paragraph object that represents the last item in the collection of paragraphs.

Syntax

expression .Last

expression Required. A variable that represents a Paragraphs collection.

Example

This example formats the last paragraph in the active document to be right-aligned.

VBA Copy code Copy code
ActiveDocument.Paragraphs.Last.Alignment = wdAlignParagraphRight

See also

Concepts

Paragraphs Collection Object

Other resources

Paragraphs Object Members


Paragraphs.LeftIndent Property (Word)

 Copy code hover
[image]

Paragraphs.LeftIndent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Single that represents the left indent value (in points) for the specified paragraphs. Read/write.

Syntax

expression .LeftIndent

expression A variable that represents a Paragraphs collection.

Example

This example sets the left indent of all paragraphs in the active document to 1 inch. The InchesToPoints method is used to convert inches to points.

VBA Copy code Copy code
ActiveDocument.Paragraphs.LeftIndent = InchesToPoints(1)

See also

Concepts

Paragraphs Collection Object

Other resources

Paragraphs Object Members


Paragraphs.LineSpacing Property (Word)

 Copy code hover
[image]

Paragraphs.LineSpacing Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the line spacing (in points) for the specified paragraphs. Read/write Single.

Syntax

expression .LineSpacing

expression An expression that represents a Paragraphs object.

Remarks

Use the LinesToPoints method to convert a number of lines to the corresponding value in points. For example, LinesToPoints(2) returns the value 24.

The LineSpacing property can be set after the LineSpacingRule property has been set to:

  • wdLineSpaceAtLeast the line spacing can be greater than or equal to, but never less than, the specified LineSpacing value.

  • wdLineSpaceExactly the line spacing never changes from the specified LineSpacing value, even if a larger font is used within the paragraph.

  • wdLineSpaceMultiple a LineSpacing property value must be specified, in points.

Example

This example triple-spaces the lines in the selected paragraphs.

VBA Copy code Copy code
With Selection.Paragraphs
 .LineSpacingRule = wdLineSpaceMultiple
 .LineSpacing = LinesToPoints(3)
End With

See also

Concepts

Paragraphs Collection Object

Other resources

Paragraphs Object Members


Paragraphs.LineSpacingRule Property (Word)

 Copy code hover
[image]

Paragraphs.LineSpacingRule Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the line spacing for the specified paragraphs. Read/write WdLineSpacing.

Syntax

expression .LineSpacingRule

expression Required. A variable that represents a Paragraphs collection.

Remarks

Use wdLineSpaceSingle, wdLineSpace1pt5, or wdLineSpaceDouble to set the line spacing to one of these values. To set the line spacing to an exact number of points or to a multiple number of lines, you must also set the LineSpacing property.

Example

This example double-spaces the lines in all paragraphs of the active document.

VBA Copy code Copy code
ActiveDocument.Paragraphs.LineSpacingRule = _
 wdLineSpaceDouble

See also

Concepts

Paragraphs Collection Object

Other resources

Paragraphs Object Members


Paragraphs.LineUnitAfter Property (Word)

 Copy code hover
[image]

Paragraphs.LineUnitAfter Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the amount of spacing (in gridlines) after the specified paragraphs. Read/write Single.

Syntax

expression .LineUnitAfter

expression Required. A variable that represents a Paragraphs collection.

Example

This example sets the spacing after all paragraphs in the active document to one gridline.

VBA Copy code Copy code
ActiveDocument.Paragraphs.LineUnitAfter = 1

See also

Concepts

Paragraphs Collection Object

Other resources

Paragraphs Object Members


Paragraphs.LineUnitBefore Property (Word)

 Copy code hover
[image]

Paragraphs.LineUnitBefore Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the amount of spacing (in gridlines) before the specified paragraphs. Read/write Single.

Syntax

expression .LineUnitBefore

expression Required. A variable that represents a Paragraphs collection.

Example

This example sets the spacing before all paragraphs in the active document to one gridline.

VBA Copy code Copy code
ActiveDocument.Paragraphs.LineUnitBefore = 1

See also

Concepts

Paragraphs Collection Object

Other resources

Paragraphs Object Members


Paragraphs.NoLineNumber Property (Word)

 Copy code hover
[image]

Paragraphs.NoLineNumber Property (Word)
See also Send feedback

Published: July 16, 2012

True if line numbers are repressed for the specified paragraphs. Can be True, False, or wdUndefined. Read/write Long.

Syntax

expression .NoLineNumber

expression A variable that represents a Paragraphs collection.

Remarks

Use the LineNumbering property of the PageSetup object to set line numbers.

Example

This example enables line numbering for the active document. The starting number is set to 1, and the numbering is continuous throughout all sections in the document. Line numbering is then repressed for the second paragraph.

VBA Copy code Copy code
With ActiveDocument.PageSetup.LineNumbering
 .Active = True
 .StartingNumber = 1
 .CountBy = 1
 .RestartMode = wdRestartContinuous
End With
ActiveDocument.Paragraphs(2).NoLineNumber = True

See also

Concepts

Paragraphs Collection Object

Other resources

Paragraphs Object Members


Paragraphs.OutlineLevel Property (Word)

 Copy code hover
[image]

Paragraphs.OutlineLevel Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the outline level for the specified paragraphs. Read/write WdOutlineLevel.

Syntax

expression .OutlineLevel

expression Required. A variable that represents a Paragraphs collection.

Remarks

If a paragraph has a heading style applied to it (Heading 1 through Heading 9), the outline level is the same as the heading style and cannot be changed. Outline levels are visible only in outline view or the document map pane.

Example

This example returns the outline level of all paragraphs in the active document.

VBA Copy code Copy code
temp = ActiveDocument.Paragraphs.OutlineLevel

See also

Concepts

Paragraphs Collection Object

Other resources

Paragraphs Object Members


Paragraphs.PageBreakBefore Property (Word)

 Copy code hover
[image]

Paragraphs.PageBreakBefore Property (Word)
See also Send feedback

Published: July 16, 2012

True if a page break is forced before the specified paragraphs. Can be True, False, or wdUndefined. Read/write Long.

Syntax

expression .PageBreakBefore

expression A variable that represents a Paragraphs collection.

Example

This example forces a page break before the first paragraph in the selection.

VBA Copy code Copy code
Selection.Paragraphs.PageBreakBefore = True

See also

Concepts

Paragraphs Collection Object

Other resources

Paragraphs Object Members


Paragraphs.Parent Property (Word)

 Copy code hover
[image]

Paragraphs.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Paragraphs object.

Syntax

expression .Parent

expression Required. A variable that represents a Paragraphs collection.

See also

Concepts

Paragraphs Collection Object

Other resources

Paragraphs Object Members


Paragraphs.ReadingOrder Property (Word)

 Copy code hover
[image]

Paragraphs.ReadingOrder Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the reading order of the specified paragraphs without changing their alignment. Read/write WdReadingOrder.

Syntax

expression .ReadingOrder

expression Required. A variable that represents a Paragraphs collection.

Remarks

Use the LtrPara, LtrRun, RtlPara, and RtlRun methods of the Selection object to change the paragraph alignment along with the reading order.

Example

This example sets the reading order of all paragraphs in the active document to right-to-left.

VBA Copy code Copy code
ActiveDocument.Paragraphs.ReadingOrder = _
 wdReadingOrderRtl

See also

Concepts

Paragraphs Collection Object

Other resources

Paragraphs Object Members


Paragraphs.RightIndent Property (Word)

 Copy code hover
[image]

Paragraphs.RightIndent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the right indent (in points) for the specified paragraphs. Read/write Single.

Syntax

expression .RightIndent

expression Required. A variable that represents a Paragraphs collection.

Example

This example sets the right indent for all paragraphs in the active document to 1 inch from the right margin. The InchesToPoints method is used to convert inches to points.

VBA Copy code Copy code
ActiveDocument.Paragraphs.RightIndent = InchesToPoints(1)

See also

Concepts

Paragraphs Collection Object

Other resources

Paragraphs Object Members


Paragraphs.Shading Property (Word)

 Copy code hover
[image]

Paragraphs.Shading Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Shading object that refers to the shading formatting for the specified paragraphs.

Syntax

expression .Shading

expression Required. A variable that represents a Paragraphs collection.

Example

This example applies yellow shading to the all paragraphs in the selection.

VBA Copy code Copy code
With Selection.Paragraphs.Shading
 .Texture = wdTexture12Pt5Percent
 .BackgroundPatternColorIndex = wdYellow
 .ForegroundPatternColorIndex = wdBlack
End With

See also

Concepts

Paragraphs Collection Object

Other resources

Paragraphs Object Members


Paragraphs.SpaceAfter Property (Word)

 Copy code hover
[image]

Paragraphs.SpaceAfter Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the amount of spacing (in points) after the specified paragraph or text column. Read/write Single.

Syntax

expression .SpaceAfter

expression Required. A variable that represents a Paragraphs collection.

Example

This example sets the spacing after all paragraphs in the active document to 12 points.

VBA Copy code Copy code
ActiveDocument.Paragraphs.SpaceAfter = 12

See also

Concepts

Paragraphs Collection Object

Other resources

Paragraphs Object Members


Paragraphs.SpaceAfterAuto Property (Word)

 Copy code hover
[image]

Paragraphs.SpaceAfterAuto Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word automatically sets the amount of spacing after the specified paragraphs. Read/write Long.

Syntax

expression .SpaceAfterAuto

expression A variable that represents a Paragraphs collection.

Remarks

This property returns wdUndefined if the SpaceAfterAuto property is set to True for only some of the specified paragraphs. Can be set to either True or False.

If SpaceAfterAuto is set to True, the SpaceAfter property is ignored.

Example

This example displays a report showing the SpaceAfterAuto settings for the active document.

VBA Copy code Copy code
Select Case ActiveDocument.Paragraphs.SpaceAfterAuto
 Case True
 x = "Spacing after paragraphs is handled " _
 & "automatically for all paragraphs."
 Case False
 x = "Spacing after paragraphs is handled " _
 & "manually for all paragraphs."
 Case wdUndefined
 x = "Spacing after paragraphs is handled " _
 & "automatically for some paragraphs, " _
 & "manually for some paragraphs."
End Select

See also

Concepts

Paragraphs Collection Object

Other resources

Paragraphs Object Members


Paragraphs.SpaceBefore Property (Word)

 Copy code hover
[image]

Paragraphs.SpaceBefore Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the spacing (in points) before the specified paragraphs. Read/write Single.

Syntax

expression .SpaceBefore

expression Required. A variable that represents a Paragraphs collection.

Example

This example sets the spacing before all paragraphs in the active document to 12 points.

VBA Copy code Copy code
ActiveDocument.Paragraphs.SpaceBefore = 12

See also

Concepts

Paragraphs Collection Object

Other resources

Paragraphs Object Members


Paragraphs.SpaceBeforeAuto Property (Word)

 Copy code hover
[image]

Paragraphs.SpaceBeforeAuto Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word automatically sets the amount of spacing before the specified paragraphs. Read/write Long.

Syntax

expression .SpaceBeforeAuto

expression A variable that represents a Paragraphs collection.

Remarks

This property returns wdUndefined if the SpaceBeforeAuto property is set to True for only some of the specified paragraphs. Can be set to either True or False.

If SpaceBeforeAuto is set to True, the SpaceBefore property is ignored.

Example

This example displays a report showing the SpaceBeforeAuto settings for the active document.

VBA Copy code Copy code
Select Case ActiveDocument.Paragraphs.SpaceBeforeAuto
 Case True
 x = "Spacing before paragraphs is handled " _
 & "automatically for all paragraphs."
 Case False
 x = "Spacing before paragraphs is handled " _
 & "manually for all paragraphs."
 Case wdUndefined
 x = "Spacing before paragraphs is handled " _
 & "automatically for some paragraphs, " _
 & "manually for some paragraphs."
End Select

See also

Concepts

Paragraphs Collection Object

Other resources

Paragraphs Object Members


Paragraphs.Style Property (Word)

 Copy code hover
[image]

Paragraphs.Style Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the style for the specified paragraphs. Read/write Variant.

Syntax

expression .Style

expression Required. A variable that represents a Paragraphs collection.

Remarks

To set this property, specify the local name of the style, an integer, a WdBuiltinStyle constant, or an object that represents the style.

When you return the style for a range that includes more than one style, only the first character or paragraph style is returned.

See also

Concepts

Paragraphs Collection Object

Other resources

Paragraphs Object Members


Paragraphs.TabStops Property (Word)

 Copy code hover
[image]

Paragraphs.TabStops Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a TabStops collection that represents all the custom tab stops for the specified paragraphs. Read/write.

Syntax

expression .TabStops

expression A variable that represents a Paragraphs collection.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example adds a centered tab stop at 2 inches to all the paragraphs in the active document. The InchesToPoints method is used to convert inches to points.

VBA Copy code Copy code
With ActiveDocument.Paragraphs.TabStops
 .Add Position:= InchesToPoints(2), Alignment:= wdAlignTabCenter
End With

This example sets the tab stops for every paragraph in the document to match the tab stops in the first paragraph.

VBA Copy code Copy code
Set para1Tabs = ActiveDocument.Paragraphs(1).TabStops
ActiveDocument.Paragraphs.TabStops = para1Tabs

See also

Concepts

Paragraphs Collection Object

Other resources

Paragraphs Object Members


Paragraphs.WidowControl Property (Word)

 Copy code hover
[image]

Paragraphs.WidowControl Property (Word)
See also Send feedback

Published: July 16, 2012

True if the first and last lines in the specified paragraph remain on the same page as the rest of the paragraph when Word repaginates the document. Can be True, False or wdUndefined. Read/write Long.

Syntax

expression .WidowControl

expression A variable that represents a Paragraphs collection.

Example

This example formats the paragraphs in the active document so that the first or last line in a paragraph can appear by itself at the top or bottom of a page.

VBA Copy code Copy code
ActiveDocument.Paragraphs.WidowControl = False

See also

Concepts

Paragraphs Collection Object

Other resources

Paragraphs Object Members


Paragraphs.WordWrap Property (Word)

 Copy code hover
[image]

Paragraphs.WordWrap Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word wraps Latin text in the middle of a word in the specified paragraphs. Read/write Long.

Syntax

expression .WordWrap

expression Required. A variable that represents a Paragraphs collection.

Remarks

This property returns wdUndefined if it's set to True for only some of the specified paragraphs. This property may not be available to you, depending on the language support (U.S. English, for example) that you have selected or installed.

Example

This example sets Microsoft Word to wrap Latin text in the middle of a word in the first paragraph of the active document.

VBA Copy code Copy code
ActiveDocument.Paragraphs(1).WordWrap = True

See also

Concepts

Paragraphs Collection Object

Other resources

Paragraphs Object Members


Paragraphs Methods (Word)

 Copy code hover
[image]

Paragraphs Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Returns a Paragraph object that represents a new, blank paragraph added to a document.
CloseUp | Removes any spacing before the specified paragraphs.
DecreaseSpacing | Decreases the spacing before and after paragraphs in six-point increments.
IncreaseSpacing | Increases the spacing before and after paragraphs in six-point increments.
Indent | Indents one or more paragraphs by one level.
IndentCharWidth | Indents one or more paragraphs by a specified number of characters.
IndentFirstLineCharWidth | Indents the first line of one or more paragraphs by a specified number of characters.
Item | Returns an individual Paragraph object in a collection.
OpenOrCloseUp | Toggles spacing before paragraphs.
OpenUp | Sets spacing before the specified paragraphs to 12 points.
Outdent | Removes one level of indent for one or more paragraphs.
OutlineDemote | Applies the next heading level style (Heading 1 through Heading 8) to the specified paragraphs.
OutlineDemoteToBody | Demotes the specified paragraph or paragraphs to body text by applying the Normal style.
OutlinePromote | Applies the previous heading level style (Heading 1 through Heading 8) to the specified paragraph or paragraphs.
Reset | Removes manual paragraph formatting (formatting not applied using a style). .
Space1 | Single-spaces the specified paragraphs.
Space15 | Formats the specified paragraphs with 1.5-line spacing.
Space2 | Double-spaces the specified paragraphs. .
TabHangingIndent | Sets a hanging indent to a specified number of tab stops.
TabIndent | Sets the left indent for the specified paragraphs to a specified number of tab stops.


Paragraphs.Add Method (Word)

 Copy code hover
[image]

Paragraphs.Add Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a Paragraph object that represents a new, blank paragraph added to a document.

Syntax

expression .Add(Range)

expression Required. A variable that represents a Paragraphs collection.

Parameters

Name | Required/Optional | Data Type | Description
Range | Optional | Variant | The range before which you want the new paragraph to be added. The new paragraph doesn't replace the range.

Return Value

Paragraph

Remarks

If Range isn't specified, the new paragraph is added after the selection or range or at the end of the document, depending on expression.

Example

This example adds a paragraph after the selection.

VBA Copy code Copy code
Selection.Paragraphs.Add

This example adds a paragraph mark before the first paragraph in the selection.

VBA Copy code Copy code
Selection.Paragraphs.Add Range:=Selection.Paragraphs(1).Range

This example adds a paragraph mark before the second paragraph in the active document.

VBA Copy code Copy code
ActiveDocument.Paragraphs.Add _
 Range:=ActiveDocument.Paragraphs(2).Range

This example adds a new paragraph mark at the end of the active document.

VBA Copy code Copy code
ActiveDocument.Paragraphs.Add

See also

Concepts

Paragraphs Collection Object

Other resources

Paragraphs Object Members


Paragraphs.CloseUp Method (Word)

 Copy code hover
[image]

Paragraphs.CloseUp Method (Word)
See also Send feedback

Published: July 16, 2012

Removes any spacing before the specified paragraphs.

Syntax

expression .CloseUp

expression Required. A variable that represents a Paragraphs collection.

Remarks

The following two statements are equivalent:

VBA Copy code Copy code
ActiveDocument.Paragraphs.CloseUp
ActiveDocument.Paragraphs.SpaceBefore = 0

Example

This example removes any space before the first paragraph in the selection.

VBA Copy code Copy code
Selection.Paragraphs.CloseUp

See also

Concepts

Paragraphs Collection Object

Other resources

Paragraphs Object Members


Paragraphs.DecreaseSpacing Method (Word)

 Copy code hover
[image]

Paragraphs.DecreaseSpacing Method (Word)
See also Send feedback

Published: July 16, 2012

Decreases the spacing before and after paragraphs in six-point increments.

Syntax

expression .DecreaseSpacing

expression Required. A variable that represents a Paragraphs collection.

Example

This example decreases the before and after spacing of a paragraph or selection of paragraphs by six points each time the procedure is run. If the before and after spacing are both zero, the procedure will do nothing.

VBA Copy code Copy code
Sub DecreaseParaSpacing()
 Selection.Paragraphs.DecreaseSpacing
End Sub

See also

Concepts

Paragraphs Collection Object

Other resources

Paragraphs Object Members


Paragraphs.IncreaseSpacing Method (Word)

 Copy code hover
[image]

Paragraphs.IncreaseSpacing Method (Word)
See also Send feedback

Published: July 16, 2012

Increases the spacing before and after paragraphs in six-point increments.

Syntax

expression .IncreaseSpacing

expression Required. A variable that represents a Paragraphs collection.

Example

This example increases the before and after spacing of a paragraph or selection of paragraphs by six points each time the procedure is run.

VBA Copy code Copy code
Sub IncreaseParaSpacing()
 Selection.Paragraphs.IncreaseSpacing
End Sub

See also

Concepts

Paragraphs Collection Object

Other resources

Paragraphs Object Members


Paragraphs.Indent Method (Word)

 Copy code hover
[image]

Paragraphs.Indent Method (Word)
See also Send feedback

Published: July 16, 2012

Indents one or more paragraphs by one level.

Syntax

expression .Indent

expression Required. A variable that represents a Paragraphs collection.

Remarks

This method is equivalent to clicking the Increase Indent button on the Formatting toolbar.

Example

This example indents all the paragraphs in the active document twice, and then it removes one level of the indent for the first paragraph.

VBA Copy code Copy code
With ActiveDocument.Paragraphs
 .Indent
 .Indent
End With
ActiveDocument.Paragraphs(1).Outdent

See also

Concepts

Paragraphs Collection Object

Other resources

Paragraphs Object Members


Paragraphs.IndentCharWidth Method (Word)

 Copy code hover
[image]

Paragraphs.IndentCharWidth Method (Word)
See also Send feedback

Published: July 16, 2012

Indents one or more paragraphs by a specified number of characters.

Syntax

expression .IndentCharWidth(Count)

expression Required. A variable that represents a Paragraphs collection.

Parameters

Name | Required/Optional | Data Type | Description
Count | Required | Integer | The number of characters by which the specified paragraphs are to be indented.

Remarks

This method is equivalent to clicking the Increase Indent button on the Formatting toolbar.

Example

This example indents all paragraphs in the active document by 10 characters.

VBA Copy code Copy code
With ActiveDocument.Paragraphs
 .IndentCharWidth 10
End With

See also

Concepts

Paragraphs Collection Object

Other resources

Paragraphs Object Members


Paragraphs.IndentFirstLineCharWidth Method (Word)

 Copy code hover
[image]

Paragraphs.IndentFirstLineCharWidth Method (Word)
See also Send feedback

Published: July 16, 2012

Indents the first line of one or more paragraphs by a specified number of characters.

Syntax

expression .IndentFirstLineCharWidth(Count)

expression Required. A variable that represents a Paragraphs collection.

Parameters

Name | Required/Optional | Data Type | Description
Count | Required | Integer | The number of characters by which the first line of each specified paragraph is to be indented.

Example

This example indents the first line of all paragraphs in the active document by 10 characters.

VBA Copy code Copy code
With ActiveDocument.Paragraphs
 .IndentFirstLineCharWidth 10
End With

See also

Concepts

Paragraphs Collection Object

Other resources

Paragraphs Object Members


Paragraphs.Item Method (Word)

 Copy code hover
[image]

Paragraphs.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual Paragraph object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents a Paragraphs collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The individual object to be returned. Can be a Long indicating the ordinal position of the individual object.

Return Value

Paragraph

See also

Concepts

Paragraphs Collection Object

Other resources

Paragraphs Object Members


Paragraphs.OpenOrCloseUp Method (Word)

 Copy code hover
[image]

Paragraphs.OpenOrCloseUp Method (Word)
See also Send feedback

Published: July 16, 2012

Toggles spacing before paragraphs.

Syntax

expression .OpenOrCloseUp

expression Required. A variable that represents a Paragraphs collection.

Remarks

If spacing before the specified paragraphs is 0 (zero), this method sets spacing to 12 points. If spacing before the paragraphs is greater than 0 (zero), this method sets spacing to 0 (zero).

Example

This example toggles the formatting of the first paragraph in the active document to either add 12 points of space before the paragraph or leave no space before it.

VBA Copy code Copy code
ActiveDocument.Paragraphs(1).OpenOrCloseUp

See also

Concepts

Paragraphs Collection Object

Other resources

Paragraphs Object Members


Paragraphs.OpenUp Method (Word)

 Copy code hover
[image]

Paragraphs.OpenUp Method (Word)
See also Send feedback

Published: July 16, 2012

Sets spacing before the specified paragraphs to 12 points.

Syntax

expression .OpenUp

expression Required. A variable that represents a Paragraphs collection.

Remarks

You can also use the SpaceBefore property to set the spacing before paragraphs. The following two statements are equivalent:

VBA Copy code Copy code
ActiveDocument.Paragraphs.OpenUp
ActiveDocument.Paragraphs.SpaceBefore = 12

Example

This example changes the formatting of the second paragraph in the active document to leave 12 points of space before the paragraph.

VBA Copy code Copy code
ActiveDocument.Paragraphs(2).OpenUp

See also

Concepts

Paragraphs Collection Object

Other resources

Paragraphs Object Members


Paragraphs.Outdent Method (Word)

 Copy code hover
[image]

Paragraphs.Outdent Method (Word)
See also Send feedback

Published: July 16, 2012

Removes one level of indent for one or more paragraphs.

Syntax

expression .Outdent

expression Required. A variable that represents a Paragraphs collection.

Remarks

This method is equivalent to clicking the Decrease Indent button on the Formatting toolbar.

Example

This example indents all the paragraphs in the active document twice, and then it removes one level of the indent for the first paragraph.

VBA Copy code Copy code
With ActiveDocument.Paragraphs
 .Indent
 .Indent
End With
ActiveDocument.Paragraphs(1).Outdent

See also

Concepts

Paragraphs Collection Object

Other resources

Paragraphs Object Members


Paragraphs.OutlineDemote Method (Word)

 Copy code hover
[image]

Paragraphs.OutlineDemote Method (Word)
See also Send feedback

Published: July 16, 2012

Applies the next heading level style (Heading 1 through Heading 8) to the specified paragraphs.

Syntax

expression .OutlineDemote

expression Required. A variable that represents a Paragraphs collection.

Remarks

If a paragraph is formatted with the Heading 2 style, this method demotes the paragraph by changing the style to Heading 3.

Example

This example demotes the selected paragraphs.

VBA Copy code Copy code
Selection.Paragraphs.OutlineDemote

This example demotes all paragraphs in the active document.

VBA Copy code Copy code
ActiveDocument.Paragraphs.OutlineDemote

See also

Concepts

Paragraphs Collection Object

Other resources

Paragraphs Object Members


Paragraphs.OutlineDemoteToBody Method (Word)

 Copy code hover
[image]

Paragraphs.OutlineDemoteToBody Method (Word)
See also Send feedback

Published: July 16, 2012

Demotes the specified paragraph or paragraphs to body text by applying the Normal style.

Syntax

expression .OutlineDemoteToBody

expression Required. A variable that represents a Paragraphs collection.

Example

This example demotes the selected paragraphs to body text by applying the Normal style.

VBA Copy code Copy code
Selection.Paragraphs.OutlineDemoteToBody

This example switches the active window to outline view and demotes all selected paragraphs to body text.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.View.Type = wdOutlineView
Selection.Paragraphs.OutlineDemoteToBody

See also

Concepts

Paragraphs Collection Object

Other resources

Paragraphs Object Members


Paragraphs.OutlinePromote Method (Word)

 Copy code hover
[image]

Paragraphs.OutlinePromote Method (Word)
See also Send feedback

Published: July 16, 2012

Applies the previous heading level style (Heading 1 through Heading 8) to the specified paragraph or paragraphs.

Syntax

expression .OutlinePromote

expression Required. A variable that represents a Paragraphs collection.

Remarks

If a paragraph is formatted with the Heading 2 style, this method promotes the paragraph by changing the style to Heading 1.

Example

This example promotes the selected paragraphs.

VBA Copy code Copy code
Selection.Paragraphs.OutlinePromote

This example switches the active window to outline view and promotes all paragraphs in the active document.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.View.Type = wdOutlineView
ActiveDocument.Paragraphs.OutlinePromote

See also

Concepts

Paragraphs Collection Object

Other resources

Paragraphs Object Members


Paragraphs.Reset Method (Word)

 Copy code hover
[image]

Paragraphs.Reset Method (Word)
See also Send feedback

Published: July 16, 2012

Removes manual paragraph formatting (formatting not applied using a style). .

Syntax

expression .Reset

expression Required. A variable that represents a Paragraphs collection.

Remarks

If you manually right align a paragraph and the underlying style has a different alignment, the Reset method changes the alignment to match the formatting of the underlying style.

See also

Concepts

Paragraphs Collection Object

Other resources

Paragraphs Object Members


Paragraphs.Space1 Method (Word)

 Copy code hover
[image]

Paragraphs.Space1 Method (Word)
See also Send feedback

Published: July 16, 2012

Single-spaces the specified paragraphs.

Syntax

expression .Space1

expression Required. A variable that represents a Paragraphs collection.

Remarks

The exact spacing is determined by the font size of the largest characters in each paragraph.

You can also use the LineSpacingRule property to set paragraph spacing. The following two statements are equivalent:

VBA Copy code Copy code
ActiveDocument.Paragraphs.Space1
ActiveDocument.Paragraphs.LineSpacingRule = wdLineSpaceSingle

Example

This example changes all paragraphs in the active document to single spacing.

VBA Copy code Copy code
ActiveDocument.Paragraphs.Space1

See also

Concepts

Paragraphs Collection Object

Other resources

Paragraphs Object Members


Paragraphs.Space15 Method (Word)

 Copy code hover
[image]

Paragraphs.Space15 Method (Word)
See also Send feedback

Published: July 16, 2012

Formats the specified paragraphs with 1.5-line spacing.

Syntax

expression .Space15

expression Required. A variable that represents a Paragraphs collection.

Remarks

The exact spacing is determined by adding 6 points to the font size of the largest character in each paragraph.

You can also use the LineSpacingRule property to set paragraph spacing. The following two statements are equivalent:

VBA Copy code Copy code
ActiveDocument.Paragraphs.Space15
ActiveDocument.Paragraphs.LineSpacingRule = wdLineSpace1pt5

Example

This example changes all paragraphs in the active document to 1.5-line spacing.

VBA Copy code Copy code
ActiveDocument.Paragraphs.Space15

See also

Concepts

Paragraphs Collection Object

Other resources

Paragraphs Object Members


Paragraphs.Space2 Method (Word)

 Copy code hover
[image]

Paragraphs.Space2 Method (Word)
See also Send feedback

Published: July 16, 2012

Double-spaces the specified paragraphs. .

Syntax

expression .Space2

expression Required. A variable that represents a Paragraphs collection.

Remarks

The exact spacing is determined by adding 12 points to the font size of the largest character in each paragraph.

You can also use the LineSpacingRule property to set paragraph spacing. The following two statements are equivalent:

VBA Copy code Copy code
ActiveDocument.Paragraphs.Space2
ActiveDocument.Paragraphs.LineSpacingRule = wdLineSpaceDouble

Example

This example changes all selected paragraphs to double spacing.

VBA Copy code Copy code
Selection.Paragraphs.Space2

See also

Concepts

Paragraphs Collection Object

Other resources

Paragraphs Object Members


Paragraphs.TabHangingIndent Method (Word)

 Copy code hover
[image]

Paragraphs.TabHangingIndent Method (Word)
See also Send feedback

Published: July 16, 2012

Sets a hanging indent to a specified number of tab stops.

Syntax

expression .TabHangingIndent(Count)

expression Required. A variable that represents a Paragraphs collection.

Parameters

Name | Required/Optional | Data Type | Description
Count | Required | Integer | The number of tab stops to indent (if positive) or the number of tab stops to remove from the indent (if negative).

Remarks

You can also use this method to remove tab stops from a hanging indent if the value of Count is a negative number.

Example

This example sets a hanging indent all paragraphs in the active document.

VBA Copy code Copy code
ActiveDocument.Paragraphs.TabHangingIndent(2)

This example moves the hanging indent back one tab stop for all paragraphs in the active document.

VBA Copy code Copy code
ActiveDocument.Paragraphs.TabHangingIndent(-1)

See also

Concepts

Paragraphs Collection Object

Other resources

Paragraphs Object Members


Paragraphs.TabIndent Method (Word)

 Copy code hover
[image]

Paragraphs.TabIndent Method (Word)
See also Send feedback

Published: July 16, 2012

Sets the left indent for the specified paragraphs to a specified number of tab stops.

Syntax

expression .TabIndent(Count)

expression Required. A variable that represents a Paragraphs collection.

Parameters

Name | Required/Optional | Data Type | Description
Count | Required | Integer | The number of tab stops to indent (if positive) or the number of tab stops to remove from the indent (if negative).

Remarks

You can also use this method to remove the indent if the value of Count is a negative number.

Example

This example indents all paragraphs in the active document to the second tab stop.

VBA Copy code Copy code
ActiveDocument.Paragraphs.TabIndent(2)

This example moves the indent of all paragraphs in the active document back one tab stop.

VBA Copy code Copy code
ActiveDocument.Paragraphs.TabIndent(-1)

See also

Concepts

Paragraphs Collection Object

Other resources

Paragraphs Object Members


PictureFormat Object (Word)

 Copy code hover
[image]

PictureFormat Object (Word)
See also Send feedback

Published: July 16, 2012

Contains properties and methods that apply to pictures and OLE objects. The LinkFormat object contains properties and methods that apply to linked OLE objects only. The OLEFormat object contains properties and methods that apply to OLE objects whether or not they're linked.

Remarks

Use the PictureFormat property to return a PictureFormat object. The following example sets the brightness, contrast, and color transformation for shape one on the active document and crops 18 points off the bottom of the shape. For this example to work, shape one must be either a picture or an OLE object.

VBA Copy code Copy code
With ActiveDocument.Shapes(1).PictureFormat
 .Brightness = 0.3
 .Contrast = 0.7
 .ColorType = msoPictureGrayScale
 .CropBottom = 18
End With

See also

Concepts

Word Object Model Reference

Other resources

PictureFormat Object Members


PictureFormat Members (Word)

 Copy code hover
[image]

PictureFormat Members (Word)
Send feedback

Published: July 16, 2012

Contains properties and methods that apply to pictures and OLE objects. The LinkFormat object contains properties and methods that apply to linked OLE objects only. The OLEFormat object contains properties and methods that apply to OLE objects whether or not they're linked.

Methods

Name | Description
IncrementBrightness | Changes the brightness of the picture by the specified amount.
IncrementContrast | Changes the contrast of the picture by the specified amount.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Brightness | Returns or sets the brightness of the specified picture or OLE object. The value for this property must be a number from 0.0 (dimmest) to 1.0 (brightest). Read/write Single.
ColorType | Returns or sets the type of color transformation applied to the specified picture or OLE object. Read/write MsoPictureColorType.
Contrast | Returns or sets the contrast for the specified picture or OLE object. The value for this property must be a number from 0.0 (the least contrast) to 1.0 (the greatest contrast). Read/write Single.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Crop | Returns or sets a Crop object that represents an image cropping. Read/write.
CropBottom | Returns or sets the number of points that are cropped off the bottom of the specified picture or OLE object. Read/write Single.
CropLeft | Returns or sets the number of points that are cropped off the left side of the specified picture or OLE object. Read/write Single.
CropRight | Returns or sets the number of points that are cropped off the right side of the specified picture or OLE object. Read/write Single.
CropTop | Returns or sets the number of points that are cropped off the top of the specified picture or OLE object. Read/write Single.
Parent | Returns an Object that represents the parent object of the specified PictureFormat object.
TransparencyColor | Returns or sets the transparent color for the specified picture as a red-green-blue (RGB) value. Read/write Long.
TransparentBackground | MsoTrue if the parts of the picture that are defined with a transparent color actually appear transparent. Use the TransparencyColor property to set the transparent color. Applies to bitmaps only. Read/write MsoTriState.


PictureFormat Properties (Word)

 Copy code hover
[image]

PictureFormat Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Brightness | Returns or sets the brightness of the specified picture or OLE object. The value for this property must be a number from 0.0 (dimmest) to 1.0 (brightest). Read/write Single.
ColorType | Returns or sets the type of color transformation applied to the specified picture or OLE object. Read/write MsoPictureColorType.
Contrast | Returns or sets the contrast for the specified picture or OLE object. The value for this property must be a number from 0.0 (the least contrast) to 1.0 (the greatest contrast). Read/write Single.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Crop | Returns or sets a Crop object that represents an image cropping. Read/write.
CropBottom | Returns or sets the number of points that are cropped off the bottom of the specified picture or OLE object. Read/write Single.
CropLeft | Returns or sets the number of points that are cropped off the left side of the specified picture or OLE object. Read/write Single.
CropRight | Returns or sets the number of points that are cropped off the right side of the specified picture or OLE object. Read/write Single.
CropTop | Returns or sets the number of points that are cropped off the top of the specified picture or OLE object. Read/write Single.
Parent | Returns an Object that represents the parent object of the specified PictureFormat object.
TransparencyColor | Returns or sets the transparent color for the specified picture as a red-green-blue (RGB) value. Read/write Long.
TransparentBackground | MsoTrue if the parts of the picture that are defined with a transparent color actually appear transparent. Use the TransparencyColor property to set the transparent color. Applies to bitmaps only. Read/write MsoTriState.


PictureFormat.Application Property (Word)

 Copy code hover
[image]

PictureFormat.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a PictureFormat object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

PictureFormat Object

Other resources

PictureFormat Object Members


PictureFormat.Brightness Property (Word)

 Copy code hover
[image]

PictureFormat.Brightness Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the brightness of the specified picture or OLE object. The value for this property must be a number from 0.0 (dimmest) to 1.0 (brightest). Read/write Single.

Syntax

expression .Brightness

expression A variable that represents a PictureFormat object.

Example

This example sets the brightness for the first shape on the active document. The first shape must be either a picture or an OLE object.

VBA Copy code Copy code
Dim docActive As Document

Set docActive = ActiveDocument
VBA Copy code Copy code
docActive.Shapes(1).PictureFormat.Brightness = 0.3

See also

Concepts

PictureFormat Object

Other resources

PictureFormat Object Members


PictureFormat.ColorType Property (Word)

 Copy code hover
[image]

PictureFormat.ColorType Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the type of color transformation applied to the specified picture or OLE object. Read/write MsoPictureColorType.

Syntax

expression .ColorType

expression Required. A variable that represents a PictureFormat object.

Example

This example sets the color transformation to grayscale for the first shape on the active document. The first shape must be either a picture or an OLE object.

VBA Copy code Copy code
Dim docActive As Document

Set docActive = ActiveDocument

docActive.Shapes(1).PictureFormat.ColorType = _
 msoPictureGrayScale

See also

Concepts

PictureFormat Object

Other resources

PictureFormat Object Members


PictureFormat.Contrast Property (Word)

 Copy code hover
[image]

PictureFormat.Contrast Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the contrast for the specified picture or OLE object. The value for this property must be a number from 0.0 (the least contrast) to 1.0 (the greatest contrast). Read/write Single.

Syntax

expression .Contrast

expression A variable that represents a PictureFormat object.

Example

This example sets the contrast for the first shape on the active document. The first shape must be either a picture or an OLE object.

VBA Copy code Copy code
Dim docActive As Document

Set docActive = ActiveDocument

docActive.Shapes(1).PictureFormat.Contrast = 0.8

See also

Concepts

PictureFormat Object

Other resources

PictureFormat Object Members


PictureFormat.Creator Property (Word)

 Copy code hover
[image]

PictureFormat.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a PictureFormat object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

PictureFormat Object

Other resources

PictureFormat Object Members


PictureFormat.Crop Property (Word)

 Copy code hover
[image]

PictureFormat.Crop Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Crop object that represents an image cropping. Read/write.

Version Information

Version Added: Word 2010

Syntax

expression .Crop

expression An expression that returns a PictureFormat object.

Remarks

Use the Crop property to work with an image cropping.

Example

The following code example creates a cropping of the first image in the active document and sets the crop height to 100 point.

VBA Copy code Copy code
Dim myInlineShape As InlineShape
Dim myCrop As Crop

Set myInlineShape = ActiveDocument.InlineShapes(1)
Set myCrop = myInlineShape.PictureFormat.Crop

myCrop.ShapeHeight = 100

See also

Concepts

PictureFormat Object

Other resources

PictureFormat Object Members


PictureFormat.CropBottom Property (Word)

 Copy code hover
[image]

PictureFormat.CropBottom Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the number of points that are cropped off the bottom of the specified picture or OLE object. Read/write Single.

Syntax

expression .CropBottom

expression A variable that represents a PictureFormat object.

Remarks

Cropping is calculated relative to the original size of the picture. For example, if you insert a picture that is originally 100 points high, rescale it so that it is 200 points high, and then set the CropBottom property to 50, 100 points (not 50) will be cropped off the bottom of your picture.

Example

This example crops 20 points off the bottom of shape three on the active document. For the example to work, shape three must be either a picture or an OLE object.

VBA Copy code Copy code
ActiveDocument.Shapes(3).PictureFormat.CropBottom = 20

This example crops the percentage specified by the user off the bottom of the selected shape, regardless of whether the shape has been scaled. For the example to work, the selected shape must be either a picture or an OLE object.

VBA Copy code Copy code
Dim dblPercent As Double
Dim shapeCrop As Shape
Dim sngHeight As Single
Dim sngCrop As Single

dblPercent = Val(InputBox("What percentage do you want " _
 & "to crop off the bottom of this picture?"))

Set shapeCrop = _
 Selection.ShapeRange(1)

With shapeCrop.Duplicate
 .ScaleHeight 1, True
 sngHeight = .Height
 .Delete
End With

sngCrop = sngHeight * dblPercent / 100

shapeCrop.PictureFormat.CropBottom = sngCrop

See also

Concepts

PictureFormat Object

Other resources

PictureFormat Object Members


PictureFormat.CropLeft Property (Word)

 Copy code hover
[image]

PictureFormat.CropLeft Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the number of points that are cropped off the left side of the specified picture or OLE object. Read/write Single.

Syntax

expression .CropLeft

expression A variable that represents a PictureFormat object.

Remarks

Cropping is calculated relative to the original size of the picture. For example, if you insert a picture that is originally 100 points wide, rescale it so that it is 200 points wide, and then set the CropLeft property to 50, 100 points (not 50) will be cropped off the left side of your picture.

Example

This example crops 20 points off the left side of shape three on the active document. For the example to work, shape three must be either a picture or an OLE object.

VBA Copy code Copy code
ActiveDocument.Shapes(3).PictureFormat.CropLeft = 20

This example crops the percentage specified by the user off the left side of the selected shape, regardless of whether the shape has been scaled. For the example to work, the selected shape must be either a picture or an OLE object.

VBA Copy code Copy code
Dim dblPercent As Double
Dim shapeCrop As Shape
Dim sngHeight As Single
Dim sngCrop As Single

dblPercent = Val(InputBox("What percentage do you want " _
 & "to crop off the left of this picture?"))

Set shapeCrop = _
 Selection.ShapeRange(1)

With shapeCrop.Duplicate
 .ScaleHeight 1, True
 sngHeight = .Height
 .Delete
End With

sngCrop = sngHeight * dblPercent / 100

shapeCrop.PictureFormat.CropLeft = sngCrop

See also

Concepts

PictureFormat Object

Other resources

PictureFormat Object Members


PictureFormat.CropRight Property (Word)

 Copy code hover
[image]

PictureFormat.CropRight Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the number of points that are cropped off the right side of the specified picture or OLE object. Read/write Single.

Syntax

expression .CropRight

expression A variable that represents a PictureFormat object.

Remarks

Cropping is calculated relative to the original size of the picture. For example, if you insert a picture that is originally 100 points wide, rescale it so that it is 200 points wide, and then set the CropRight property to 50, 100 points (not 50) will be cropped off the right side of your picture.

Example

This example crops 20 points off the right side of shape three on the active document. For this example to work, shape three must be either a picture or an OLE object.

VBA Copy code Copy code
ActiveDocument.Shapes(3).PictureFormat.CropRight = 20

This example crops the percentage specified by the user off the right side of the selected shape, regardless of whether the shape has been scaled. For the example to work, the selected shape must be either a picture or an OLE object.

VBA Copy code Copy code
Dim dblPercent As Double
Dim shapeCrop As Shape
Dim sngHeight As Single
Dim sngCrop As Single

dblPercent = Val(InputBox("What percentage do you want " _
 & "to crop off the right of this picture?"))

Set shapeCrop = _
 Selection.ShapeRange(1)

With shapeCrop.Duplicate
 .ScaleHeight 1, True
 sngHeight = .Height
 .Delete
End With

sngCrop = sngHeight * dblPercent / 100

shapeCrop.PictureFormat.CropRight = sngCrop

See also

Concepts

PictureFormat Object

Other resources

PictureFormat Object Members


PictureFormat.CropTop Property (Word)

 Copy code hover
[image]

PictureFormat.CropTop Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the number of points that are cropped off the top of the specified picture or OLE object. Read/write Single.

Syntax

expression .CropTop

expression A variable that represents a PictureFormat object.

Remarks

Cropping is calculated relative to the original size of the picture. For example, if you insert a picture that is originally 100 points high, rescale it so that it is 200 points high, and then set the CropTop property to 50, 100 points (not 50) will be cropped off the top of your picture.

Example

This example crops 20 points off the top of shape three on the active document. For the example to work, shape three must be either a picture or an OLE object.

VBA Copy code Copy code
ActiveDocument.Shapes(3).PictureFormat.CropTop = 20

This example crops the percentage specified by the user off the top of the selected shape, regardless of whether the shape has been scaled. For the example to work, the selected shape must be either a picture or an OLE object.

VBA Copy code Copy code
Dim dblPercent As Double
Dim shapeCrop As Shape
Dim sngHeight As Single
Dim sngCrop As Single

dblPercent = Val(InputBox("What percentage do you want " _
 & "to crop off the top of this picture?"))

Set shapeCrop = _
 Selection.ShapeRange(1)

With shapeCrop.Duplicate
 .ScaleHeight 1, True
 sngHeight = .Height
 .Delete
End With

sngCrop = sngHeight * dblPercent / 100

shapeCrop.PictureFormat.CropTop = sngCrop

See also

Concepts

PictureFormat Object

Other resources

PictureFormat Object Members


PictureFormat.Parent Property (Word)

 Copy code hover
[image]

PictureFormat.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified PictureFormat object.

Syntax

expression .Parent

expression Required. A variable that represents a PictureFormat object.

See also

Concepts

PictureFormat Object

Other resources

PictureFormat Object Members


PictureFormat.TransparencyColor Property (Word)

 Copy code hover
[image]

PictureFormat.TransparencyColor Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the transparent color for the specified picture as a red-green-blue (RGB) value. Read/write Long.

Syntax

expression .TransparencyColor

expression An expression that returns a PictureFormat object.

Remarks

For this property to take effect, the TransparentBackground property must be set to True. Applies to bitmaps only.

If you want to be able to see through the transparent parts of the picture all the way to the objects behind the picture, you must set the Visible property of the picture's FillFormat object to False. If your picture has a transparent color and the Visible property of the picture's FillFormat object is set to True, the picture's fill will be visible through the transparent color, but objects behind the picture will be obscured.

Example

This example sets the color returned by the RGB function as the transparent color for shape one in the active document. For the example to work, shape one must be a bitmap.

VBA Copy code Copy code
blueScreen = RGB(0, 0, 255)
With ActiveDocument.Shapes(1)
 With .PictureFormat
 .TransparentBackground = True
 .TransparencyColor = blueScreen
 End With
 .Fill.Visible = False
End With

See also

Concepts

PictureFormat Object

Other resources

PictureFormat Object Members


PictureFormat.TransparentBackground Property (Word)

 Copy code hover
[image]

PictureFormat.TransparentBackground Property (Word)
See also Send feedback

Published: July 16, 2012

MsoTrue if the parts of the picture that are defined with a transparent color actually appear transparent. Use the TransparencyColor property to set the transparent color. Applies to bitmaps only. Read/write MsoTriState.

Syntax

expression .TransparentBackground

expression Required. A variable that represents a PictureFormat object.

Remarks

If you want to be able to see through the transparent parts of the picture all the way to the objects behind the picture, you must set the Visible property of the picture's FillFormat object to False. If your picture has a transparent color and the Visible property of the picture's FillFormat object is set to True, the picture's fill will be visible through the transparent color, but objects behind the picture will be obscured.

Example

This example sets the color returned by the RGB function as the transparent color for shape one in the active document. For the example to work, shape one must be a bitmap.

VBA Copy code Copy code
blueScreen = RGB(0, 0, 255)
With ActiveDocument.Shapes(1)
 With .PictureFormat
 .TransparentBackground = msoTrue
 .TransparencyColor = blueScreen
 End With
 .Fill.Visible = False
End With

See also

Concepts

PictureFormat Object

Other resources

PictureFormat Object Members


PictureFormat Methods (Word)

 Copy code hover
[image]

PictureFormat Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
IncrementBrightness | Changes the brightness of the picture by the specified amount.
IncrementContrast | Changes the contrast of the picture by the specified amount.


PictureFormat.IncrementBrightness Method (Word)

 Copy code hover
[image]

PictureFormat.IncrementBrightness Method (Word)
See also Send feedback

Published: July 16, 2012

Changes the brightness of the picture by the specified amount.

Syntax

expression .IncrementBrightness(Increment)

expression Required. A variable that represents a PictureFormat object.

Parameters

Name | Required/Optional | Data Type | Description
Increment | Required | Single | Specifies how much to change the value of the Brightness property for the picture. A positive value makes the picture brighter; a negative value makes the picture darker.

Remarks

You cannot adjust the brightness of a picture past the upper or lower limit for the Brightness property. For example, if the Brightness property is initially set to 0.9 and you specify 0.3 for the Increment argument, the resulting brightness level will be 1.0, which is the upper limit for the Brightness property, instead of 1.2.

Use the Brightness property to set the absolute brightness of the picture.

Example

This example creates a duplicate of the first shape on the active document and then moves and darkens the duplicate. For the example to work, the first shape must be either a picture or an OLE object.

VBA Copy code Copy code
Dim docActive As Document

Set docActive = ActiveDocument

With docActive.Shapes(1).Duplicate
 .PictureFormat.IncrementBrightness -0.2
 .IncrementLeft 50
 .IncrementTop 50
End With

See also

Concepts

PictureFormat Object

Other resources

PictureFormat Object Members


PictureFormat.IncrementContrast Method (Word)

 Copy code hover
[image]

PictureFormat.IncrementContrast Method (Word)
See also Send feedback

Published: July 16, 2012

Changes the contrast of the picture by the specified amount.

Syntax

expression .IncrementContrast(Increment)

expression Required. A variable that represents a PictureFormat object.

Parameters

Name | Required/Optional | Data Type | Description
Increment | Required | Single | Specifies how much to change the value of the Contrast property for the picture. A positive value increases the contrast; a negative value decreases the contrast.

Remarks

Use the Contrast property to set the absolute contrast for the picture.

You cannot adjust the contrast of a picture past the upper or lower limit for the Contrast property. For example, if the Contrast property is initially set to 0.9 and you specify 0.3 for the Increment argument, the resulting contrast level will be 1.0, which is the upper limit for the Contrast property, instead of 1.2.

Example

This example increases the contrast for all embedded OLE objects on the active document that aren't already set to maximum contrast.

VBA Copy code Copy code
Dim docActive As Document
Dim shapeLoop As Shape

Set docActive = ActiveDocument

For Each shapeLoop In docActive.Shapes
 If shapeLoop.Type = msoEmbeddedOLEObject Then
 shapeLoop.PictureFormat.IncrementContrast 0.1
 End If
Next shapeLoop

See also

Concepts

PictureFormat Object

Other resources

PictureFormat Object Members


PlotArea Object (Word)

 Copy code hover
[image]

PlotArea Object (Word)
See also Send feedback

Published: July 16, 2012

Represents the plot area of a chart.

Version Information

Version Added: Word 2007

Remarks

This is the area where your chart data is plotted. The plot area on a 2-D chart contains the data markers, gridlines, data labels, trendlines, and optional chart items placed in the chart area. The plot area on a 3-D chart contains all the above items plus the walls, floor, axes, axis titles, and tick-mark labels in the chart.

The plot area is surrounded by the chart area. The chart area on a 2-D chart contains the axes, the chart title, the axis titles, and the legend. The chart area on a 3-D chart contains the chart title and the legend. For information about formatting the chart area, see the ChartArea object.

Example

Use the PlotArea property to return a PlotArea object. The following example places a dashed border around the chart area of the first chart in the active document, and then places a dotted border around the plot area.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart
 .ChartArea.Border.LineStyle = xlDash
 .PlotArea.Border.LineStyle = xlDot
 End With
 End If
End With

See also

Concepts

Word Object Model Reference

Other resources

PlotArea Object Members


PlotArea Members (Word)

 Copy code hover
[image]

PlotArea Members (Word)
Send feedback

Published: July 16, 2012

Represents the plot area of a chart.

Methods

Name | Description
ClearFormats | Clears the formatting of the object.
Select | Selects the object.

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Format | Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.
Height | Returns or sets the height, in points, of the object. Read/write Double.
InsideHeight | Returns or sets the inside height, in points, of the plot area. Read/write Double.
InsideLeft | Returns or sets the distance, in points, from the chart edge to the inside left edge of the plot area. Read/write Double.
InsideTop | Returns or sets the distance, in points, from the chart edge to the inside top edge of the plot area. Read/write Double.
InsideWidth | Returns or sets the inside width, in points, of the plot area. Read/write Double.
Left | Returns or sets the distance, in points, from the left edge of the object to the left edge of the chart area. Read/write Double.
Name | Returns the name of the object. Read-only String.
Parent | Returns the parent for the specified object. Read-only Object.
Position | Returns or sets the position of the plot area on the chart. Read/write XlChartElementPosition.
Top | Returns or sets the distance, in points, from the top edge of the object to the top of the first row (on a worksheet) or the top of the chart area (on a chart). Read/write Double.
Width | Returns or sets the width, in points, of the object. Read/write Double.


PlotArea Properties (Word)

 Copy code hover
[image]

PlotArea Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Format | Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.
Height | Returns or sets the height, in points, of the object. Read/write Double.
InsideHeight | Returns or sets the inside height, in points, of the plot area. Read/write Double.
InsideLeft | Returns or sets the distance, in points, from the chart edge to the inside left edge of the plot area. Read/write Double.
InsideTop | Returns or sets the distance, in points, from the chart edge to the inside top edge of the plot area. Read/write Double.
InsideWidth | Returns or sets the inside width, in points, of the plot area. Read/write Double.
Left | Returns or sets the distance, in points, from the left edge of the object to the left edge of the chart area. Read/write Double.
Name | Returns the name of the object. Read-only String.
Parent | Returns the parent for the specified object. Read-only Object.
Position | Returns or sets the position of the plot area on the chart. Read/write XlChartElementPosition.
Top | Returns or sets the distance, in points, from the top edge of the object to the top of the first row (on a worksheet) or the top of the chart area (on a chart). Read/write Double.
Width | Returns or sets the width, in points, of the object. Read/write Double.


PlotArea.Application Property (Word)

 Copy code hover
[image]

PlotArea.Application Property (Word)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Application

expression A variable that represents a PlotArea object.

Example

The following example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveDocument
If myObject.Application.Value = "Microsoft Word" Then
 MsgBox "This is a Word Application object."
Else
 MsgBox "This is not a Word Application object."
End If

See also

Concepts

PlotArea Object

Other resources

PlotArea Object Members


PlotArea.Creator Property (Word)

 Copy code hover
[image]

PlotArea.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version Information

Version Added: Word 2007

Syntax

expression .Creator

expression A variable that represents a PlotArea object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD". This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Word has the creator code MSWD. For more information about this property, consult the language reference Help included with Microsoft Office for Mac.

See also

Concepts

PlotArea Object

Other resources

PlotArea Object Members


PlotArea.Format Property (Word)

 Copy code hover
[image]

PlotArea.Format Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.

Version Information

Version Added: Word 2007

Syntax

expression .Format

expression A variable that represents a PlotArea object.

See also

Concepts

PlotArea Object

Other resources

PlotArea Object Members


PlotArea.Height Property (Word)

 Copy code hover
[image]

PlotArea.Height Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the height, in points, of the object. Read/write Double.

Version Information

Version Added: Word 2007

Syntax

expression .Height

expression A variable that represents a PlotArea object.

See also

Concepts

PlotArea Object

Other resources

PlotArea Object Members


PlotArea.InsideHeight Property (Word)

 Copy code hover
[image]

PlotArea.InsideHeight Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the inside height, in points, of the plot area. Read/write Double.

Version Information

Version Added: Word 2007

Syntax

expression .InsideHeight

expression A variable that represents a PlotArea object.

Remarks

The plot area used for this measurement does not include the axis labels. The Height property for the plot area uses the bounding rectangle that includes the axis labels.

Example

The following example draws a dotted rectangle around the inside of the plot area for the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart
 Set pa = .PlotArea
 With .Shapes.AddShape(msoShapeRectangle, _
 pa.InsideLeft, pa.InsideTop, _
 pa.InsideWidth, pa.InsideHeight)
 .Fill.Transparency = 1
 .Line.DashStyle = msoLineDashDot
 End With
 End With
 End If
End With

See also

Concepts

PlotArea Object

Other resources

PlotArea Object Members


PlotArea.InsideLeft Property (Word)

 Copy code hover
[image]

PlotArea.InsideLeft Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the distance, in points, from the chart edge to the inside left edge of the plot area. Read/write Double.

Version Information

Version Added: Word 2007

Syntax

expression .InsideLeft

expression A variable that represents a PlotArea object.

Remarks

The plot area used for this measurement does not include the axis labels. The Left property for the plot area uses the bounding rectangle that includes the axis labels.

Example

The following example draws a dotted rectangle around the inside of the plot area for the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart
 Set pa = .PlotArea
 With .Shapes.AddShape(msoShapeRectangle, _
 pa.InsideLeft, pa.InsideTop, _
 pa.InsideWidth, pa.InsideHeight)
 .Fill.Transparency = 1
 .Line.DashStyle = msoLineDashDot
 End With
 End With
 End If
End With

See also

Concepts

PlotArea Object

Other resources

PlotArea Object Members


PlotArea.InsideTop Property (Word)

 Copy code hover
[image]

PlotArea.InsideTop Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the distance, in points, from the chart edge to the inside top edge of the plot area. Read/write Double.

Version Information

Version Added: Word 2007

Syntax

expression .InsideTop

expression A variable that represents a PlotArea object.

Remarks

The plot area used for this measurement does not include the axis labels. The Top property for the plot area uses the bounding rectangle that includes the axis labels.

Example

The following example draws a dotted rectangle around the inside of the plot area for the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart
 Set pa = .PlotArea
 With .Shapes.AddShape(msoShapeRectangle, _
 pa.InsideLeft, pa.InsideTop, _
 pa.InsideWidth, pa.InsideHeight)
 .Fill.Transparency = 1
 .Line.DashStyle = msoLineDashDot
 End With
 End With
 End If
End With

See also

Concepts

PlotArea Object

Other resources

PlotArea Object Members


PlotArea.InsideWidth Property (Word)

 Copy code hover
[image]

PlotArea.InsideWidth Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the inside width, in points, of the plot area. Read/write Double.

Version Information

Version Added: Word 2007

Syntax

expression .InsideWidth

expression A variable that represents a PlotArea object.

Remarks

The plot area used for this measurement does not include the axis labels. The Width property for the plot area uses the bounding rectangle that includes the axis labels.

Example

The following example draws a dotted rectangle around the inside of the plot area for the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart
 Set pa = .PlotArea
 With .Shapes.AddShape(msoShapeRectangle, _
 pa.InsideLeft, pa.InsideTop, _
 pa.InsideWidth, pa.InsideHeight)
 .Fill.Transparency = 1
 .Line.DashStyle = msoLineDashDot
 End With
 End With
 End If
End With

See also

Concepts

PlotArea Object

Other resources

PlotArea Object Members


PlotArea.Left Property (Word)

 Copy code hover
[image]

PlotArea.Left Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the distance, in points, from the left edge of the object to the left edge of the chart area. Read/write Double.

Version Information

Version Added: Word 2007

Syntax

expression .Left

expression A variable that represents a PlotArea object.

See also

Concepts

PlotArea Object

Other resources

PlotArea Object Members


PlotArea.Name Property (Word)

 Copy code hover
[image]

PlotArea.Name Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the name of the object. Read-only String.

Version Information

Version Added: Word 2007

Syntax

expression .Name

expression A variable that represents a PlotArea object.

See also

Concepts

PlotArea Object

Other resources

PlotArea Object Members


PlotArea.Parent Property (Word)

 Copy code hover
[image]

PlotArea.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the parent for the specified object. Read-only Object.

Version Information

Version Added: Word 2007

Syntax

expression .Parent

expression A variable that represents a PlotArea object.

See also

Concepts

PlotArea Object

Other resources

PlotArea Object Members


PlotArea.Position Property (Word)

 Copy code hover
[image]

PlotArea.Position Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the position of the plot area on the chart. Read/write XlChartElementPosition.

Version Information

Version Added: Word 2007

Syntax

expression .Position

expression A variable that represents a PlotArea object.

See also

Concepts

PlotArea Object

Other resources

PlotArea Object Members


PlotArea.Top Property (Word)

 Copy code hover
[image]

PlotArea.Top Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the distance, in points, from the top edge of the object to the top of the first row (on a worksheet) or the top of the chart area (on a chart). Read/write Double.

Version Information

Version Added: Word 2007

Syntax

expression .Top

expression A variable that represents a PlotArea object.

See also

Concepts

PlotArea Object

Other resources

PlotArea Object Members


PlotArea.Width Property (Word)

 Copy code hover
[image]

PlotArea.Width Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the width, in points, of the object. Read/write Double.

Version Information

Version Added: Word 2007

Syntax

expression .Width

expression A variable that represents a PlotArea object.

See also

Concepts

PlotArea Object

Other resources

PlotArea Object Members


PlotArea Methods (Word)

 Copy code hover
[image]

PlotArea Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
ClearFormats | Clears the formatting of the object.
Select | Selects the object.


PlotArea.ClearFormats Method (Word)

 Copy code hover
[image]

PlotArea.ClearFormats Method (Word)
See also Send feedback

Published: July 16, 2012

Clears the formatting of the object.

Version Information

Version Added: Word 2007

Syntax

expression .ClearFormats

expression A variable that represents a PlotArea object.

See also

Concepts

PlotArea Object

Other resources

PlotArea Object Members


PlotArea.Select Method (Word)

 Copy code hover
[image]

PlotArea.Select Method (Word)
See also Send feedback

Published: July 16, 2012

Selects the object.

Version Information

Version Added: Word 2007

Syntax

expression .Select

expression A variable that represents a PlotArea object.

See also

Concepts

PlotArea Object

Other resources

PlotArea Object Members


Point Object (Word)

 Copy code hover
[image]

Point Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a single point in a series in a chart.

Version Information

Version Added: Word 2007

Remarks

The Point object is a member of the Points collection. The Points collection contains all the points in one series.

Example

Use Points(Index), where Index is the point index number, to return a single Point object. Points are numbered from left to right on the series. Points(1) is the leftmost point, and Points(Points.Count) is the rightmost point. The following example sets the marker style for the third point in series one for the first chart in the active document. The specified series must be a 2-D line, scatter, or radar series.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.SeriesCollection(1).Points(3).MarkerStyle = xlDiamond
 End If
End With

See also

Concepts

Word Object Model Reference

Other resources

Point Object Members


Point Members (Word)

 Copy code hover
[image]

Point Members (Word)
Send feedback

Published: July 16, 2012

Represents a single point in a series in a chart.

Methods

Name | Description
ApplyDataLabels | Applies data labels to a point.
ClearFormats | Clears the formatting of the object.
Copy | If the point has a picture fill, copies the picture to the Clipboard.
Delete | Deletes the object.
Paste | Pastes a picture from the Clipboard as the marker on the selected point.
PieSliceLocation | Returns the vertical or horizontal position of a point on a chart item, in points, from the top or left edge of the object to the top or left edge of the chart area.
Select | Selects the object.

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
ApplyPictToEnd | True if a picture is applied to the end of the point or all points in the series. Read/write Boolean.
ApplyPictToFront | True if a picture is applied to the front of the point or all points in the series. Read/write Boolean.
ApplyPictToSides | True if a picture is applied to the sides of the point or all points in the series. Read/write Boolean.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
DataLabel | Returns the data label associated with the point. Read-only DataLabel.
Explosion | Returns or sets the explosion value for a pie-chart or doughnut-chart slice. Read/write Long.
Format | Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.
Has3DEffect | True if a point has a three-dimensional appearance. Read/write Boolean.
HasDataLabel | True if the point has a data label. Read/write Boolean.
Height | Returns the height, in points, of the object. Read-only.
InvertIfNegative | True if Microsoft Word inverts the pattern in the object when it corresponds to a negative number. Read/write Variant.
Left | Returns a value that represents the distance, in points, from the left edge of the object to the left edge of the chart area. Read-only.
MarkerBackgroundColor | Sets the marker background color as an RGB value or returns the corresponding color index value. Read/write Long.
MarkerBackgroundColorIndex | Returns or sets the marker background color as an index into the current color palette, or as one of the following XlColorIndex constants: xlColorIndexAutomatic or xlColorIndexNone. Read/write Long.
MarkerForegroundColor | Sets the marker foreground color as an RGB value or returns the corresponding color index value. Read/write Long.
MarkerForegroundColorIndex | Returns or sets the marker foreground color as an index into the current color palette, or as one of the following XlColorIndex constants: xlColorIndexAutomatic or xlColorIndexNone. Read/write Long.
MarkerSize | Returns or sets the data-marker size, in points. Read/write Long.
MarkerStyle | Returns or sets the marker style for a point or series in a line chart, scatter chart, or radar chart. Read/write XlMarkerStyle.
Name | Returns the object name. Read-only.
Parent | Returns the parent for the specified object. Read-only Object.
PictureType | Returns or sets a value that specifies how pictures are displayed on a column or bar picture chart. Read/write XlChartPictureType.
PictureUnit2 | Returns or sets the unit for each picture on the chart if the PictureType property is set to xlStackScale (if not, this property is ignored). Read/write Double.
SecondaryPlot | True if the point is in the secondary section of either a pie-of-pie chart or a bar-of-pie chart. Read/write Boolean.
Shadow | Returns or sets a value that indicates whether the object has a shadow. Read/write Boolean.
Top | Returns a value that represents the distance, in points, from the top edge of the object to the top edge of the chart area. Read-only.
Width | Returns the width, in points, of the object. Read-only.


Point Properties (Word)

 Copy code hover
[image]

Point Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
ApplyPictToEnd | True if a picture is applied to the end of the point or all points in the series. Read/write Boolean.
ApplyPictToFront | True if a picture is applied to the front of the point or all points in the series. Read/write Boolean.
ApplyPictToSides | True if a picture is applied to the sides of the point or all points in the series. Read/write Boolean.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
DataLabel | Returns the data label associated with the point. Read-only DataLabel.
Explosion | Returns or sets the explosion value for a pie-chart or doughnut-chart slice. Read/write Long.
Format | Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.
Has3DEffect | True if a point has a three-dimensional appearance. Read/write Boolean.
HasDataLabel | True if the point has a data label. Read/write Boolean.
Height | Returns the height, in points, of the object. Read-only.
InvertIfNegative | True if Microsoft Word inverts the pattern in the object when it corresponds to a negative number. Read/write Variant.
Left | Returns a value that represents the distance, in points, from the left edge of the object to the left edge of the chart area. Read-only.
MarkerBackgroundColor | Sets the marker background color as an RGB value or returns the corresponding color index value. Read/write Long.
MarkerBackgroundColorIndex | Returns or sets the marker background color as an index into the current color palette, or as one of the following XlColorIndex constants: xlColorIndexAutomatic or xlColorIndexNone. Read/write Long.
MarkerForegroundColor | Sets the marker foreground color as an RGB value or returns the corresponding color index value. Read/write Long.
MarkerForegroundColorIndex | Returns or sets the marker foreground color as an index into the current color palette, or as one of the following XlColorIndex constants: xlColorIndexAutomatic or xlColorIndexNone. Read/write Long.
MarkerSize | Returns or sets the data-marker size, in points. Read/write Long.
MarkerStyle | Returns or sets the marker style for a point or series in a line chart, scatter chart, or radar chart. Read/write XlMarkerStyle.
Name | Returns the object name. Read-only.
Parent | Returns the parent for the specified object. Read-only Object.
PictureType | Returns or sets a value that specifies how pictures are displayed on a column or bar picture chart. Read/write XlChartPictureType.
PictureUnit2 | Returns or sets the unit for each picture on the chart if the PictureType property is set to xlStackScale (if not, this property is ignored). Read/write Double.
SecondaryPlot | True if the point is in the secondary section of either a pie-of-pie chart or a bar-of-pie chart. Read/write Boolean.
Shadow | Returns or sets a value that indicates whether the object has a shadow. Read/write Boolean.
Top | Returns a value that represents the distance, in points, from the top edge of the object to the top edge of the chart area. Read-only.
Width | Returns the width, in points, of the object. Read-only.


Point.Application Property (Word)

 Copy code hover
[image]

Point.Application Property (Word)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Application

expression A variable that represents a Point object.

Example

The following example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveDocument
If myObject.Application.Value = "Microsoft Word" Then
 MsgBox "This is a Word Application object."
Else
 MsgBox "This is not a Word Application object."
End If

See also

Concepts

Point Object

Other resources

Point Object Members


Point.ApplyPictToEnd Property (Word)

 Copy code hover
[image]

Point.ApplyPictToEnd Property (Word)
See also Send feedback

Published: July 16, 2012

True if a picture is applied to the end of the point or all points in the series. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .ApplyPictToEnd

expression A variable that represents a Point object.

Example

The following example applies pictures to the end of all points in the first series of the first chart in the active document. The series must already have pictures applied to it (setting this property changes the picture orientation).

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.SeriesCollection(1).ApplyPictToEnd = True
 End If
End With

See also

Concepts

Point Object

Other resources

Point Object Members


Point.ApplyPictToFront Property (Word)

 Copy code hover
[image]

Point.ApplyPictToFront Property (Word)
See also Send feedback

Published: July 16, 2012

True if a picture is applied to the front of the point or all points in the series. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .ApplyPictToFront

expression A variable that represents a Point object.

Example

The following example applies pictures to the front of all points in the first series of the first chart in the active document. The series must already have pictures applied to it (setting this property changes the picture orientation).

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.SeriesCollection(1).ApplyPictToFront = True
 End If
End With

See also

Concepts

Point Object

Other resources

Point Object Members


Point.ApplyPictToSides Property (Word)

 Copy code hover
[image]

Point.ApplyPictToSides Property (Word)
See also Send feedback

Published: July 16, 2012

True if a picture is applied to the sides of the point or all points in the series. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .ApplyPictToSides

expression A variable that represents a Point object.

Example

The following example applies pictures to the sides of all points in the first series of the first chart in the active document. The series must already have pictures applied to it (setting this property changes the picture orientation).

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.SeriesCollection(1).ApplyPictToSides = True
 End If
End With

See also

Concepts

Point Object

Other resources

Point Object Members


Point.Creator Property (Word)

 Copy code hover
[image]

Point.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version Information

Version Added: Word 2007

Syntax

expression .Creator

expression A variable that represents a Point object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD". This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Word has the creator code MSWD. For more information about this property, consult the language reference Help included with Microsoft Office for Mac.

See also

Concepts

Point Object

Other resources

Point Object Members


Point.DataLabel Property (Word)

 Copy code hover
[image]

Point.DataLabel Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the data label associated with the point. Read-only DataLabel.

Version Information

Version Added: Word 2007

Syntax

expression .DataLabel

expression A variable that represents a Point object.

Example

The following example enables the data label for point seven in series three of the first chart in the active document, and then it sets the data label color to blue.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.SeriesCollection(3).Points(7)
 .HasDataLabel = True
 .ApplyDataLabels type:=xlValue
 .DataLabel.Font.ColorIndex = 5
 End With
 End If
End With

See also

Concepts

Point Object

Other resources

Point Object Members


Point.Explosion Property (Word)

 Copy code hover
[image]

Point.Explosion Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the explosion value for a pie-chart or doughnut-chart slice. Read/write Long.

Version Information

Version Added: Word 2007

Syntax

expression .Explosion

expression A variable that represents a Point object.

Remarks

This property returns 0 (zero) if there is no explosion (the tip of the slice is in the center of the pie).

Example

The following example sets the explosion value for point two of the first chart in the active document. You should run the example on a pie chart.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.SeriesCollection(1).Points(2).Explosion = 20
 End If
End With

See also

Concepts

Point Object

Other resources

Point Object Members


Point.Format Property (Word)

 Copy code hover
[image]

Point.Format Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.

Version Information

Version Added: Word 2007

Syntax

expression .Format

expression A variable that represents a Point object.

See also

Concepts

Point Object

Other resources

Point Object Members


Point.Has3DEffect Property (Word)

 Copy code hover
[image]

Point.Has3DEffect Property (Word)
See also Send feedback

Published: July 16, 2012

True if a point has a three-dimensional appearance. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .Has3DEffect

expression A variable that represents a Point object.

Remarks

This property applies only to bubble charts.

See also

Concepts

Point Object

Other resources

Point Object Members


Point.HasDataLabel Property (Word)

 Copy code hover
[image]

Point.HasDataLabel Property (Word)
See also Send feedback

Published: July 16, 2012

True if the point has a data label. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .HasDataLabel

expression A variable that represents a Point object.

Example

The following example enables the data label for point seven in series three for the first chart in the active document, and then it sets the data label color to blue.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With Chart.SeriesCollection(3).Points(7)
 .HasDataLabel = True
 .ApplyDataLabels Type:=xlValue
 .DataLabel.Font.ColorIndex = 5
 End With
 End If
End With

See also

Concepts

Point Object

Other resources

Point Object Members


Point.Height Property (Word)

 Copy code hover
[image]

Point.Height Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the height, in points, of the object. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .Height

expression A variable that represents a Point object.

Return Value

Double

See also

Concepts

Point Object

Other resources

Point Object Members


Point.InvertIfNegative Property (Word)

 Copy code hover
[image]

Point.InvertIfNegative Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word inverts the pattern in the object when it corresponds to a negative number. Read/write Variant.

Version Information

Version Added: Word 2007

Syntax

expression .InvertIfNegative

expression A variable that represents a Point object.

See also

Concepts

Point Object

Other resources

Point Object Members


Point.Left Property (Word)

 Copy code hover
[image]

Point.Left Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a value that represents the distance, in points, from the left edge of the object to the left edge of the chart area. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .Left

expression A variable that represents a Point object.

Return Value

Double

See also

Concepts

Point Object

Other resources

Point Object Members


Point.MarkerBackgroundColor Property (Word)

 Copy code hover
[image]

Point.MarkerBackgroundColor Property (Word)
See also Send feedback

Published: July 16, 2012

Sets the marker background color as an RGB value or returns the corresponding color index value. Read/write Long.

Version Information

Version Added: Word 2007

Syntax

expression .MarkerBackgroundColor

expression A variable that represents a Point object.

Remarks

This property applies only to line, scatter, and radar charts.

Example

The following example sets the marker background and foreground colors for the second point in series one for the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.SeriesCollection(1).Points(2)
 ' Set the background color to green.
 .MarkerBackgroundColor = RGB(0,255,0)

 ' Set the foreground color to red.
 .MarkerForegroundColor = RGB(255,0,0)
 End With
 End If
End With

See also

Concepts

Point Object

Other resources

Point Object Members


Point.MarkerBackgroundColorIndex Property (Word)

 Copy code hover
[image]

Point.MarkerBackgroundColorIndex Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the marker background color as an index into the current color palette, or as one of the following XlColorIndex constants: xlColorIndexAutomatic or xlColorIndexNone. Read/write Long.

Version Information

Version Added: Word 2007

Syntax

expression .MarkerBackgroundColorIndex

expression A variable that represents a Point object.

Remarks

The property applies only to line, scatter, and radar charts.

Example

The following example sets the marker background and foreground colors for the second point in series one for the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.SeriesCollection(1).Points(2)
 ' Set the background color to green.
 .MarkerBackgroundColorIndex = 4

 ' Set the foreground color to red.
 .MarkerForegroundColorIndex = 3
 End With
 End If
End With

See also

Concepts

Point Object

Other resources

Point Object Members


Point.MarkerForegroundColor Property (Word)

 Copy code hover
[image]

Point.MarkerForegroundColor Property (Word)
See also Send feedback

Published: July 16, 2012

Sets the marker foreground color as an RGB value or returns the corresponding color index value. Read/write Long.

Version Information

Version Added: Word 2007

Syntax

expression .MarkerForegroundColor

expression A variable that represents a Point object.

Remarks

This property applies only to line, scatter, and radar charts.

Example

The following example sets the marker background and foreground colors for the second point in series one for the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.SeriesCollection(1).Points(2)
 ' Set the background color to green.
 .MarkerBackgroundColor = RGB(0,255,0)

 ' Set the foreground color to red.
 .MarkerForegroundColor = RGB(255,0,0)
 End With
 End If
End With

See also

Concepts

Point Object

Other resources

Point Object Members


Point.MarkerForegroundColorIndex Property (Word)

 Copy code hover
[image]

Point.MarkerForegroundColorIndex Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the marker foreground color as an index into the current color palette, or as one of the following XlColorIndex constants: xlColorIndexAutomatic or xlColorIndexNone. Read/write Long.

Version Information

Version Added: Word 2007

Syntax

expression .MarkerForegroundColorIndex

expression A variable that represents a Point object.

Remarks

This property applies only to line, scatter, and radar charts.

Example

The following example sets the marker background and foreground colors for the second point in series one for the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.SeriesCollection(1).Points(2)
 ' Set the background color to green.
 .MarkerBackgroundColorIndex = 4

 ' Set the foreground color to red.
 .MarkerForegroundColorIndex = 3
 End With
 End If
End With

See also

Concepts

Point Object

Other resources

Point Object Members


Point.MarkerSize Property (Word)

 Copy code hover
[image]

Point.MarkerSize Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the data-marker size, in points. Read/write Long.

Version Information

Version Added: Word 2007

Syntax

expression .MarkerSize

expression A variable that represents a Point object.

Remarks

This property can have a value from 2 through 72.

See also

Concepts

Point Object

Other resources

Point Object Members


Point.MarkerStyle Property (Word)

 Copy code hover
[image]

Point.MarkerStyle Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the marker style for a point or series in a line chart, scatter chart, or radar chart. Read/write XlMarkerStyle.

Version Information

Version Added: Word 2007

Syntax

expression .MarkerStyle

expression A variable that represents a Point object.

Remarks

MarkerStyle can be one of the following XlMarkerStyle constants:

  • xlMarkerStyleAutomatic—Automatic markers.

  • xlMarkerStyleCircle—Circular markers.

  • xlMarkerStyleDash—Long bar markers.

  • xlMarkerStyleDiamond—Diamond-shaped markers.

  • xlMarkerStyleDot—Short bar markers.

  • xlMarkerStyleNone—No markers.

  • xlMarkerStylePicture—Picture markers.

  • xlMarkerStylePlus—Square markers with a plus sign.

  • xlMarkerStyleSquare—Square markers.

  • xlMarkerStyleStar—Square markers with an asterisk.

  • xlMarkerStyleTriangle—Triangular markers.

  • xlMarkerStyleX—Square markers with an X.

See also

Concepts

Point Object

Other resources

Point Object Members


Point.Name Property (Word)

 Copy code hover
[image]

Point.Name Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the object name. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .Name

expression A variable that represents a Point object.

Return Value

String

Remarks

This property corresponds to the name of a data point on a chart. The name is represented using the following format: S<series number>P<point number>.

See also

Concepts

Point Object

Other resources

Point Object Members


Point.Parent Property (Word)

 Copy code hover
[image]

Point.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the parent for the specified object. Read-only Object.

Version Information

Version Added: Word 2007

Syntax

expression .Parent

expression A variable that represents a Point object.

See also

Concepts

Point Object

Other resources

Point Object Members


Point.PictureType Property (Word)

 Copy code hover
[image]

Point.PictureType Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a value that specifies how pictures are displayed on a column or bar picture chart. Read/write XlChartPictureType.

Version Information

Version Added: Word 2007

Syntax

expression .PictureType

expression A variable that represents a Point object.

See also

Concepts

Point Object

Other resources

Point Object Members


Point.PictureUnit2 Property (Word)

 Copy code hover
[image]

Point.PictureUnit2 Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the unit for each picture on the chart if the PictureType property is set to xlStackScale (if not, this property is ignored). Read/write Double.

Version Information

Version Added: Word 2007

Syntax

expression .PictureUnit2

expression A variable that represents a Point object.

See also

Concepts

Point Object

Other resources

Point Object Members


Point.SecondaryPlot Property (Word)

 Copy code hover
[image]

Point.SecondaryPlot Property (Word)
See also Send feedback

Published: July 16, 2012

True if the point is in the secondary section of either a pie-of-pie chart or a bar-of-pie chart. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .SecondaryPlot

expression A variable that represents a Point object.

Remarks

This property applies only to points on pie-of-pie charts or bar-of-pie charts.

Example

The following example moves point four to the secondary section of the chart. You must run this example on either a pie-of-pie chart or a bar-of-pie chart.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.SeriesCollection(1)
 .Points(4).SecondaryPlot = True
 End With
 End If
End With

See also

Concepts

Point Object

Other resources

Point Object Members


Point.Shadow Property (Word)

 Copy code hover
[image]

Point.Shadow Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a value that indicates whether the object has a shadow. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .Shadow

expression A variable that represents a Point object.

See also

Concepts

Point Object

Other resources

Point Object Members


Point.Top Property (Word)

 Copy code hover
[image]

Point.Top Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a value that represents the distance, in points, from the top edge of the object to the top edge of the chart area. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .Top

expression A variable that represents a Point object.

Return Value

Double

See also

Concepts

Point Object

Other resources

Point Object Members


Point.Width Property (Word)

 Copy code hover
[image]

Point.Width Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the width, in points, of the object. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .Width

expression A variable that represents a Point object.

See also

Concepts

Point Object

Other resources

Point Object Members


Point Methods (Word)

 Copy code hover
[image]

Point Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
ApplyDataLabels | Applies data labels to a point.
ClearFormats | Clears the formatting of the object.
Copy | If the point has a picture fill, copies the picture to the Clipboard.
Delete | Deletes the object.
Paste | Pastes a picture from the Clipboard as the marker on the selected point.
PieSliceLocation | Returns the vertical or horizontal position of a point on a chart item, in points, from the top or left edge of the object to the top or left edge of the chart area.
Select | Selects the object.


Point.ApplyDataLabels Method (Word)

 Copy code hover
[image]

Point.ApplyDataLabels Method (Word)
See also Send feedback

Published: July 16, 2012

Applies data labels to a point.

Version Information

Version Added: Word 2007

Syntax

expression .ApplyDataLabels(Type, LegendKey, AutoText, HasLeaderLines, ShowSeriesName, ShowCategoryName, ShowValue, ShowPercentage, ShowBubbleSize, Separator)

expression A variable that represents a Point object.

Parameters

Name | Required/Optional | Data Type | Description
Type | Optional | XlDataLabelsType | The type of data label to apply.
LegendKey | Optional | Variant | True to show the legend key next to the point. The default is False.
AutoText | Optional | Variant | True if the object automatically generates appropriate text based on content.
HasLeaderLines | Optional | Variant | For the Chart and Series objects, True if the series has leader lines.
ShowSeriesName | Optional | Variant | True to enable the series name for the data label; otherwise, False.
ShowCategoryName | Optional | Variant | True to enable the category name for the data label; otherwise, False.
ShowValue | Optional | Variant | True to enable the value for the data label; otherwise, False.
ShowPercentage | Optional | Variant | True to enable the percentage for the data label; otherwise, False.
ShowBubbleSize | Optional | Variant | True to enable the bubble size for the data label; otherwise, False.
Separator | Optional | Variant | The separator for the data label.

Remarks

The Type parameter can be one of the following XlDataLabelsType constants:

  • xlDataLabelsShowBubbleSizes—The bubble size for the data label.

  • xlDataLabelsShowLabelAndPercent—The percentage of the total, and the category for the point. Available only for pie charts and doughnut charts.

  • xlDataLabelsShowPercent—The percentage of the total. Available only for pie charts and doughnut charts.

  • xlDataLabelsShowLabel—The category for the point.

  • xlDataLabelsShowNone—No data labels.

  • xlDataLabelsShowValue—(Default) The value for the point (assumed if this argument is not specified).

Example

The following example applies category labels to series one of the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.SeriesCollection(1). _
 ApplyDataLabels Type:=xlDataLabelsShowLabel
 End If
End With

See also

Concepts

Point Object

Other resources

Point Object Members


Point.ClearFormats Method (Word)

 Copy code hover
[image]

Point.ClearFormats Method (Word)
See also Send feedback

Published: July 16, 2012

Clears the formatting of the object.

Version Information

Version Added: Word 2007

Syntax

expression .ClearFormats

expression A variable that represents a Point object.

See also

Concepts

Point Object

Other resources

Point Object Members


Point.Copy Method (Word)

 Copy code hover
[image]

Point.Copy Method (Word)
See also Send feedback

Published: July 16, 2012

If the point has a picture fill, copies the picture to the Clipboard.

Version Information

Version Added: Word 2007

Syntax

expression .Copy

expression A variable that represents a Point object.

See also

Concepts

Point Object

Other resources

Point Object Members


Point.Delete Method (Word)

 Copy code hover
[image]

Point.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Version Information

Version Added: Word 2007

Syntax

expression .Delete

expression A variable that represents a Point object.

Remarks

Deleting a Point object deletes the entire series.

See also

Concepts

Point Object

Other resources

Point Object Members


Point.Paste Method (Word)

 Copy code hover
[image]

Point.Paste Method (Word)
See also Send feedback

Published: July 16, 2012

Pastes a picture from the Clipboard as the marker on the selected point.

Version Information

Version Added: Word 2007

Syntax

expression .Paste

expression A variable that represents a Point object.

Remarks

You can use this method on column, bar, line, or radar charts, and it sets the MarkerStyle property to xlMarkerStylePicture.

Example

The following example pastes a picture from the Clipboard into point one in series one for the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.SeriesCollection(1).Points(1).Paste
 End If
End With

See also

Concepts

Point Object

Other resources

Point Object Members


Point.PieSliceLocation Method (Word)

 Copy code hover
[image]

Point.PieSliceLocation Method (Word)
See also Send feedback

Published: July 16, 2012

Returns the vertical or horizontal position of a point on a chart item, in points, from the top or left edge of the object to the top or left edge of the chart area.

Version Information

Version Added: Word 2010

Syntax

expression .PieSliceLocation(loc, Index)

expression A variable that represents a Point object.

Parameters

Name | Required/Optional | Data Type | Description
loc | Required | XlPieSliceLocation | Specifies a horizontal or vertical coordinate.
Index | Optional | XlPieSliceIndex | Specifies which pie slice position coordinate to return. The default value is xlOuterCenterPoint.

Return Value

Double

Remarks

This property only applies to pie chart types.

See also

Concepts

Point Object

Other resources

Point Object Members


Point.Select Method (Word)

 Copy code hover
[image]

Point.Select Method (Word)
See also Send feedback

Published: July 16, 2012

Selects the object.

Version Information

Version Added: Word 2007

Syntax

expression .Select

expression A variable that represents a Point object.

See also

Concepts

Point Object

Other resources

Point Object Members


Points Object (Word)

 Copy code hover
[image]

Points Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of all the Point objects in the specified series in a chart.

Version Information

Version Added: Word 2007

Remarks

Use Points(Index), where Index is the point index number, to return a single Point object. Points are numbered from left to right on the series. Points(1) is the leftmost point, and Points(Points.Count) is the rightmost point.

Example

Use the Points method to return the Points collection. The following example adds a data label to the last point in series one for the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.SeriesCollection(1).Points
 .Item(.Count).ApplyDataLabels Type:=xlShowValue
 End With
 End If
End With

The following example sets the marker style for the third point in series one for the first chart in the active document. The specified series must be a 2-D line, scatter, or radar series.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.SeriesCollection(1).Points(3).MarkerStyle = xlDiamond
 End If
End With

See also

Concepts

Word Object Model Reference

Other resources

Points Object Members


Points Members (Word)

 Copy code hover
[image]

Points Members (Word)
Send feedback

Published: July 16, 2012

A collection of all the Point objects in the specified series in a chart.

Methods

Name | Description
Item | Returns a single object from a collection.

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
Count | Returns the number of objects in the collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns the parent for the specified object. Read-only Object.


Points Properties (Word)

 Copy code hover
[image]

Points Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
Count | Returns the number of objects in the collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns the parent for the specified object. Read-only Object.


Points.Application Property (Word)

 Copy code hover
[image]

Points.Application Property (Word)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Application

expression A variable that represents a Points object.

Example

The following example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveDocument
If myObject.Application.Value = "Microsoft Word" Then
 MsgBox "This is a Word Application object."
Else
 MsgBox "This is not a Word Application object."
End If

See also

Concepts

Points Object

Other resources

Points Object Members


Points.Count Property (Word)

 Copy code hover
[image]

Points.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the number of objects in the collection. Read-only Long.

Version Information

Version Added: Word 2007

Syntax

expression .Count

expression A variable that represents a Points object.

See also

Concepts

Points Object

Other resources

Points Object Members


Points.Creator Property (Word)

 Copy code hover
[image]

Points.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version Information

Version Added: Word 2007

Syntax

expression .Creator

expression A variable that represents a Points object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD". This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Word has the creator code MSWD. For more information about this property, consult the language reference Help included with Microsoft Office for Mac.

See also

Concepts

Points Object

Other resources

Points Object Members


Points.Parent Property (Word)

 Copy code hover
[image]

Points.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the parent for the specified object. Read-only Object.

Version Information

Version Added: Word 2007

Syntax

expression .Parent

expression A variable that represents a Points object.

See also

Concepts

Points Object

Other resources

Points Object Members


Points Methods (Word)

 Copy code hover
[image]

Points Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Item | Returns a single object from a collection.


Points.Item Method (Word)

 Copy code hover
[image]

Points.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a single object from a collection.

Version Information

Version Added: Word 2007

Syntax

expression .Item(Index)

expression A variable that represents a Points object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The index number for the object.

Return Value

A Point object that the collection contains.

Example

The following example sets the marker style for the third point in series one in embedded chart one on worksheet one. The specified series must be a 2-D line, scatter, or radar series.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.SeriesCollection(1).Points.Item(3). _
 MarkerStyle = xlDiamond
 End If
End With

See also

Concepts

Points Object

Other resources

Points Object Members


ProofreadingErrors Object (Word)

 Copy code hover
[image]

ProofreadingErrors Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of spelling and grammatical errors for the specified document or range.

Remarks

Use the SpellingErrors or GrammaticalErrors property to return the ProofreadingErrors collection. The following example counts the spelling and grammatical errors in the selection and displays the results in a message box.

VBA Copy code Copy code
Set pr1 = Selection.Range.SpellingErrors
 sc = pr1.Count
Set pr2 = Selection.Range.GrammaticalErrors
 gc = pr2.Count
Msgbox "Spelling errors: " & sc & vbCr _
 & "Grammatical errors: " & gc

Use SpellingErrors(Index), where Index is the index number, to return a single spelling error (represented by a Range object). The following example finds the second spelling error in the selection and then selects it.

VBA Copy code Copy code
Set myRange = Selection.Range.SpellingErrors(2)
myRange.Select

Use GrammarErrors(Index), where Index is the index number, to return a single grammatical error (represented by a Range object). The following example returns the sentence that contains the first grammatical error in the selection.

VBA Copy code Copy code
Set myRange = Selection.Range.GrammaticalErrors(1)
Msgbox myRange.Text

The Count property for this collection in a document returns the number of items in the main story only. To count items in other stories use the collection with the Range object. If all the words in the document or range are spelled correctly and are grammatically correct, the Count property for the ProofreadingErrors object returns 0 (zero) and the SpellingChecked and GrammarChecked properties return True.

Note Note

There is no ProofreadingError object; instead, each item in the ProofreadingErrors collection is a Range object that represents one spelling or grammatical error.

See also

Concepts

Word Object Model Reference

Other resources

ProofreadingErrors Object Members


ProofreadingErrors Members (Word)

 Copy code hover
[image]

ProofreadingErrors Members (Word)
Send feedback

Published: July 16, 2012

A collection of spelling and grammatical errors for the specified document or range.

Methods

Name | Description
Item | Returns an individual Range object in a collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of proofreading errors in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified ProofreadingErrors object.
Type | Returns the type of proofreading error. Read-only WdProofreadingErrorType.


ProofreadingErrors Properties (Word)

 Copy code hover
[image]

ProofreadingErrors Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of proofreading errors in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified ProofreadingErrors object.
Type | Returns the type of proofreading error. Read-only WdProofreadingErrorType.


ProofreadingErrors.Application Property (Word)

 Copy code hover
[image]

ProofreadingErrors.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a ProofreadingErrors collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

ProofreadingErrors Collection Object

Other resources

ProofreadingErrors Object Members


ProofreadingErrors.Count Property (Word)

 Copy code hover
[image]

ProofreadingErrors.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of proofreading errors in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents a ProofreadingErrors collection.

See also

Concepts

ProofreadingErrors Collection Object

Other resources

ProofreadingErrors Object Members


ProofreadingErrors.Creator Property (Word)

 Copy code hover
[image]

ProofreadingErrors.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a ProofreadingErrors collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

ProofreadingErrors Collection Object

Other resources

ProofreadingErrors Object Members


ProofreadingErrors.Parent Property (Word)

 Copy code hover
[image]

ProofreadingErrors.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified ProofreadingErrors object.

Syntax

expression .Parent

expression Required. A variable that represents a ProofreadingErrors collection.

See also

Concepts

ProofreadingErrors Collection Object

Other resources

ProofreadingErrors Object Members


ProofreadingErrors.Type Property (Word)

 Copy code hover
[image]

ProofreadingErrors.Type Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the type of proofreading error. Read-only WdProofreadingErrorType.

Syntax

expression .Type

expression Required. A variable that represents a ProofreadingErrors collection.

See also

Concepts

ProofreadingErrors Collection Object

Other resources

ProofreadingErrors Object Members


ProofreadingErrors Methods (Word)

 Copy code hover
[image]

ProofreadingErrors Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Item | Returns an individual Range object in a collection.


ProofreadingErrors.Item Method (Word)

 Copy code hover
[image]

ProofreadingErrors.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual Range object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents a ProofreadingErrors collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The individual object to be returned. Can be a Long indicating the ordinal position of the individual object.

Return Value

Range

See also

Concepts

ProofreadingErrors Collection Object

Other resources

ProofreadingErrors Object Members


ProtectedViewWindow Object (Word)

 Copy code hover
[image]

ProtectedViewWindow Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a protected view window.

Version Information

Version Added: Word 2010

Remarks

Documents displayed in a protected view window cannot be edited and are restricted from running active content such as Visual Basic for Applications macros and Data Connections.

Use ProtectedViewWindows(Index), where Index is the index number to return a single ProtectedViewWindow object.

Example

The index number represents the position of the protected view window in the ProtectedViewWindows collection.. The following code example returns the first protected view window.

VBA Copy code Copy code
Dim pvWindow As ProtectedViewWindow

Set pvWindow = ProtectedViewWindows(1)

See also

Concepts

Word Object Model Reference

Other resources

ProtectedViewWindow Object Members


ProtectedViewWindow Members (Word)

 Copy code hover
[image]

ProtectedViewWindow Members (Word)
Send feedback

Published: July 16, 2012

Represents a protected view window.

Methods

Name | Description
Activate | Activates the specified protected view window.
Close | Closes the specified protected view window.
Edit |
ToggleRibbon | Shows or hides the ribbon.

Properties

Name | Description
Active | True if the specified protected view window is active. Read-only Boolean.
Application | Returns an Application object that represents the Microsoft Word application. Read-only.
Caption | Returns or sets the caption text that is displayed in the title bar of the document or protected view window. Read/write String.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Document | Returns a Document object associated with the protected view window. Read-only.
Height | Returns or sets the height of the protected view window. Read/write Long.
Index | Returns a Long that represents the position of an item in a collection. Read-only.
Left | Returns or sets a Long, in points, that represents the horizontal position of the specified protected view window. Read/write.
Parent | Returns an Object that represents the parent object of the specified ProtectedViewWindow object.
SourceName | Returns the name of the source file for the specified protected view window. Read-only String.
SourcePath | Returns the path of the source file for the specified protected view window. Read-only String.
Top | Returns or sets the vertical position, in points, of the specified protected view window. Read/write Long
Visible | True if the specified protected view window is visible. Read/write. Boolean.
Width | Returns or sets the width, in points, of the specified protectd view window. Read/write Long.
WindowState | Returns or sets the state of the specified protected view window. Read/write WdWindowState.


ProtectedViewWindow Properties (Word)

 Copy code hover
[image]

ProtectedViewWindow Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Active | True if the specified protected view window is active. Read-only Boolean.
Application | Returns an Application object that represents the Microsoft Word application. Read-only.
Caption | Returns or sets the caption text that is displayed in the title bar of the document or protected view window. Read/write String.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Document | Returns a Document object associated with the protected view window. Read-only.
Height | Returns or sets the height of the protected view window. Read/write Long.
Index | Returns a Long that represents the position of an item in a collection. Read-only.
Left | Returns or sets a Long, in points, that represents the horizontal position of the specified protected view window. Read/write.
Parent | Returns an Object that represents the parent object of the specified ProtectedViewWindow object.
SourceName | Returns the name of the source file for the specified protected view window. Read-only String.
SourcePath | Returns the path of the source file for the specified protected view window. Read-only String.
Top | Returns or sets the vertical position, in points, of the specified protected view window. Read/write Long
Visible | True if the specified protected view window is visible. Read/write. Boolean.
Width | Returns or sets the width, in points, of the specified protectd view window. Read/write Long.
WindowState | Returns or sets the state of the specified protected view window. Read/write WdWindowState.


ProtectedViewWindow.Active Property (Word)

 Copy code hover
[image]

ProtectedViewWindow.Active Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified protected view window is active. Read-only Boolean.

Version Information

Version Added: Word 2010

Syntax

expression .Active

expression An expression that returns a ProtectedViewWindow object.

Example

The following code example activates the first protected view window in the ProtectedViewWindows collection if the window is not currently active.

VBA Copy code Copy code
ProtectedViewWindows.Open FileName:="C:\MyFiles\MyDoc.doc"

See also

Concepts

ProtectedViewWindow Object

Other resources

ProtectedViewWindow Object Members


ProtectedViewWindow.Application Property (Word)

 Copy code hover
[image]

ProtectedViewWindow.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .Application

expression An expression that returns a ProtectedViewWindow object.

See also

Concepts

ProtectedViewWindow Object

Other resources

ProtectedViewWindow Object Members


ProtectedViewWindow.Caption Property (Word)

 Copy code hover
[image]

ProtectedViewWindow.Caption Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the caption text that is displayed in the title bar of the document or protected view window. Read/write String.

Version Information

Version Added: Word 2010

Syntax

expression .Caption

expression An expression that returns a ProtectedViewWindow object.

Remarks

To change the caption of the protected view window to the default text, set this property to an empty string ("").

Example

The following code example displays the caption for the active protected view window.

VBA Copy code Copy code
MsgBox "The caption for the active protected " & _
 "view window is: " & ActiveProtectedViewWindow.Caption

The following code example changes the caption for the active protected view window.

VBA Copy code Copy code
ActiveProtectedViewWindow.Caption = Application.UserName & "'s copy of Word"

See also

Concepts

ProtectedViewWindow Object

Other resources

ProtectedViewWindow Object Members


ProtectedViewWindow.Creator Property (Word)

 Copy code hover
[image]

ProtectedViewWindow.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version Information

Version Added: Word 2010

Syntax

expression .Creator

expression An expression that returns a ProtectedViewWindow object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD". This property was primarily designed to be used on the Apple Macintosh, where each application has a four-character creator code. For example, Word has the creator code MSWD. For more information about this property, see the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

ProtectedViewWindow Object

Other resources

ProtectedViewWindow Object Members


ProtectedViewWindow.Document Property (Word)

 Copy code hover
[image]

ProtectedViewWindow.Document Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Document object associated with the protected view window. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .Document

expression A variable that represents a ProtectedViewWindow object.

Remarks

A document displayed in a protected view window is not a member of the Documents collection. Instead, use the Document property to access a document that is displayed in a protected view window.

Example

The following code example displays the name of the document in the active protected view window.

VBA Copy code Copy code
Dim myDoc As Document

Set myDoc = ActiveProtectedViewWindow.Document
MsgBox myDoc.Name

See also

Concepts

ProtectedViewWindow Object

Other resources

ProtectedViewWindow Object Members


ProtectedViewWindow.Height Property (Word)

 Copy code hover
[image]

ProtectedViewWindow.Height Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the height of the protected view window. Read/write Long.

Version Information

Version Added: Word 2010

Syntax

expression .Height

expression An expression that returns a ProtectedViewWindow object.

Remarks

You cannot set this property if the window is maximized or minimized. Use the UsableHeight property of the Application object to determine the maximum size for the window. Use the WindowState property to determine the window state.

Example

The following code example changes the height of the active protected view window to fill the application window area.

VBA Copy code Copy code
With ActiveProtectedViewWindow
 .WindowState = wdWindowStateNormal
 .Height = Application.UsableHeight
End With

See also

Concepts

ProtectedViewWindow Object

Other resources

ProtectedViewWindow Object Members


ProtectedViewWindow.Index Property (Word)

 Copy code hover
[image]

ProtectedViewWindow.Index Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the position of an item in a collection. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .Index

expression An expression that returns a ProtectedViewWindow object.

See also

Concepts

ProtectedViewWindow Object

Other resources

ProtectedViewWindow Object Members


ProtectedViewWindow.Left Property (Word)

 Copy code hover
[image]

ProtectedViewWindow.Left Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Long, in points, that represents the horizontal position of the specified protected view window. Read/write.

Version Information

Version Added: Word 2010

Syntax

expression .Left

expression An expression that returns a ProtectedViewWindow object.

Example

The following code example sets the horizontal position of the active protected view window to 100 point.

VBA Copy code Copy code
With ActiveProtectedViewWindow
 .WindowState = wdWindowStateNormal
 .Left = 100
 .Top = 0
End With

See also

Concepts

ProtectedViewWindow Object

Other resources

ProtectedViewWindow Object Members


ProtectedViewWindow.Parent Property (Word)

 Copy code hover
[image]

ProtectedViewWindow.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified ProtectedViewWindow object.

Version Information

Version Added: Word 2010

Syntax

expression .Parent

expression An expression that returns a ProtectedViewWindow object.

See also

Concepts

ProtectedViewWindow Object

Other resources

ProtectedViewWindow Object Members


ProtectedViewWindow.SourceName Property (Word)

 Copy code hover
[image]

ProtectedViewWindow.SourceName Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the name of the source file for the specified protected view window. Read-only String.

Version Information

Version Added: Word 2010

Syntax

expression .SourceName

expression An expression that returns a ProtectedViewWindow object.

Remarks

This property does not return the path for the source file.

Example

The following code example returns the path and name of the document associated with the specified protected view window.

VBA Copy code Copy code
MsgBox ActiveProtectedViewWindow.SourcePath & "\" _
 & ActiveProtectedViewWindow.SourceName

See also

Concepts

ProtectedViewWindow Object

Other resources

ProtectedViewWindow Object Members


ProtectedViewWindow.SourcePath Property (Word)

 Copy code hover
[image]

ProtectedViewWindow.SourcePath Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the path of the source file for the specified protected view window. Read-only String.

Version Information

Version Added: Word 2010

Syntax

expression .SourcePath

expression An expression that returns a ProtectedViewWindow object.

Remarks

The path does not include a trailing character (for example, "C:\MSOffice"). Use the PathSeparator property to add the character that separates folders and drive letters. Use the SourceName property to return the file name without the path.

Example

The following code example returns the path and name of the document associated with the specified protected view window.

VBA Copy code Copy code
MsgBox ActiveProtectedViewWindow.SourcePath & Application.PathSeparator _
 & ActiveProtectedViewWindow.SourceName

See also

Concepts

ProtectedViewWindow Object

Other resources

ProtectedViewWindow Object Members


ProtectedViewWindow.Top Property (Word)

 Copy code hover
[image]

ProtectedViewWindow.Top Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the vertical position, in points, of the specified protected view window. Read/write Long

Version Information

Version Added: Word 2010

Syntax

expression .Top

expression An expression that returns a ProtectedViewWindow object.

Example

The following code example sets the vertical position of the active protected view window to 100 point.

VBA Copy code Copy code
With ActiveProtectedViewWindow
 .WindowState = wdWindowStateNormal
 .Left = 0
 .Top = 100
End With

See also

Concepts

ProtectedViewWindow Object

Other resources

ProtectedViewWindow Object Members


ProtectedViewWindow.Visible Property (Word)

 Copy code hover
[image]

ProtectedViewWindow.Visible Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified protected view window is visible. Read/write. Boolean.

Version Information

Version Added: Word 2010

Syntax

expression .Visible

expression An expression that returns a ProtectedViewWindow object.

Remarks

Some methods and properties may be unavailable if the Visible property is False.

See also

Concepts

ProtectedViewWindow Object

Other resources

ProtectedViewWindow Object Members


ProtectedViewWindow.Width Property (Word)

 Copy code hover
[image]

ProtectedViewWindow.Width Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the width, in points, of the specified protectd view window. Read/write Long.

Version Information

Version Added: Word 2010

Syntax

expression .Width

expression An expression that returns a ProtectedViewWindow object.

Example

The following code example changes the state, height, and width of the active protected view window.

VBA Copy code Copy code
With ActiveProtectedViewWindow
 .WindowState = wdWindowStateNormal
 .Height = 400
 .Width = 500
End With

See also

Concepts

ProtectedViewWindow Object

Other resources

ProtectedViewWindow Object Members


ProtectedViewWindow.WindowState Property (Word)

 Copy code hover
[image]

ProtectedViewWindow.WindowState Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the state of the specified protected view window. Read/write WdWindowState.

Version Information

Version Added: Word 2010

Syntax

expression .WindowState

expression An expression that returns a ProtectedViewWindow object.

Remarks

The wdWindowStateNormal constant indicates a window that is not maximized or minimized. The state of an inactive window cannot be set. Use the Activate method to activate a window prior to setting the window state.

Example

The following code example minimizes the active protected view window.

VBA Copy code Copy code
ActiveProtectedViewWindow.WindowState = wdWindowStateMinimize

See also

Concepts

ProtectedViewWindow Object

Other resources

ProtectedViewWindow Object Members


ProtectedViewWindow Methods (Word)

 Copy code hover
[image]

ProtectedViewWindow Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Activate | Activates the specified protected view window.
Close | Closes the specified protected view window.
Edit |
ToggleRibbon | Shows or hides the ribbon.


ProtectedViewWindow.Activate Method (Word)

 Copy code hover
[image]

ProtectedViewWindow.Activate Method (Word)
See also Send feedback

Published: July 16, 2012

Activates the specified protected view window.

Version Information

Version Added: Word 2010

Syntax

expression .Activate

expression An expression that returns a ProtectedViewWindow Object object.

Return Value

Nothing

Example

The following code example activates the next protected view window in the ProtectedViewWindows collection.

VBA Copy code Copy code
Dim pvWindow As ProtectedViewWindow

' At least one document must be open in protected view for this statement to execute.
ProtectedViewWindows(1).Activate

See also

Concepts

ProtectedViewWindow Object

Other resources

ProtectedViewWindow Object Members


ProtectedViewWindow.Close Method (Word)

 Copy code hover
[image]

ProtectedViewWindow.Close Method (Word)
See also Send feedback

Published: July 16, 2012

Closes the specified protected view window.

Version Information

Version Added: Word 2010

Syntax

expression .Close

expression An expression that returns a ProtectedViewWindow object.

Return Value

Nothing

Example

The following code example closes the active protected view window.

VBA Copy code Copy code
Activeprotectedviewwindow.Close

See also

Concepts

ProtectedViewWindow Object

Other resources

ProtectedViewWindow Object Members


ProtectedViewWindow.Edit Method (Word)

 Copy code hover
[image]

ProtectedViewWindow.Edit Method (Word)
See also Send feedback

Published: July 16, 2012

Version Information

Version Added: Word 2010

Syntax

expression .Edit(PasswordTemplate, WritePasswordDocument, WritePasswordTemplate)

expression An expression that returns a ProtectedViewWindow object.

Parameters

Name | Required/Optional | Data Type | Description
PasswordTemplate | Optional | Variant | The password for opening the template.
WritePasswordDocument | Optional | Variant | The password for saving changes to the document.
WritePasswordTemplate | Optional | Variant | The password for saving changes to the template.

Return Value

Document

Remarks

Avoid using hard-coded passwords in your applications. If a password is required in a procedure, request the password from the user, store it in a variable, and then use the variable in your code.

Example

The following code example opens (for editing) the document associated with the active protected view window.

VBA Copy code Copy code
Dim pvDoc As Document

Set pvDoc = ActiveProtectedViewWindow.Edit

See also

Concepts

ProtectedViewWindow Object

Other resources

ProtectedViewWindow Object Members


ProtectedViewWindow.ToggleRibbon Method (Word)

 Copy code hover
[image]

ProtectedViewWindow.ToggleRibbon Method (Word)
See also Send feedback

Published: July 16, 2012

Shows or hides the ribbon.

Version Information

Version Added: Word 2010

Syntax

expression .ToggleRibbon

expression An expression that returns a ProtectedViewWindow object.

Remarks

If the ribbon is visible, the ToggleRibbon method hides it; if the ribbon is hidden, the ToggleRibbon method shows it.

Example

The following code example toggles the ribbon for the active protected view window.

VBA Copy code Copy code
ActiveProtectedViewWindow.ToggleRibbon

See also

Concepts

ProtectedViewWindow Object

Other resources

ProtectedViewWindow Object Members


ProtectedViewWindows Object (Word)

 Copy code hover
[image]

ProtectedViewWindows Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of all the ProtectedViewWindow objects that are currently open in Word 2010.

Version Information

Version Added: Word 2010

Remarks

Use the ProtectedViewWindows property to return the ProtectedViewWindows collection.

Example

The following code example displays the number of protected view windows that are open.

VBA Copy code Copy code
MsgBox "There are " & ProtectedViewWindows.Count & _
 " protected view windows currently open."

See also

Concepts

Word Object Model Reference

Other resources

ProtectedViewWindows Object Members


ProtectedViewWindows Members (Word)

 Copy code hover
[image]

ProtectedViewWindows Members (Word)
Send feedback

Published: July 16, 2012

A collection of all the ProtectedViewWindow objects that are currently open in Word 2010.

Methods

Name | Description
Item | Returns an individual ProtectedViewWindows object in a collection.
Open | Opens the specified document in a new protected view window.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application. Read-only.
Count | Returns a Long that represents the number of protected view windows in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified ProtectedViewWindows object.


ProtectedViewWindows Properties (Word)

 Copy code hover
[image]

ProtectedViewWindows Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application. Read-only.
Count | Returns a Long that represents the number of protected view windows in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified ProtectedViewWindows object.


ProtectedViewWindows.Application Property (Word)

 Copy code hover
[image]

ProtectedViewWindows.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .Application

expression An expression that returns a ProtectedViewWindows object.

See also

Concepts

ProtectedViewWindows Object

Other resources

ProtectedViewWindows Object Members


ProtectedViewWindows.Count Property (Word)

 Copy code hover
[image]

ProtectedViewWindows.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of protected view windows in the collection. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .Count

expression An expression that returns a ProtectedViewWindows object.

Example

The following code example displays the number of protected view windows that are currently open.

VBA Copy code Copy code
MsgBox ProtectedViewWindows.Count

See also

Concepts

ProtectedViewWindows Object

Other resources

ProtectedViewWindows Object Members


ProtectedViewWindows.Creator Property (Word)

 Copy code hover
[image]

ProtectedViewWindows.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version Information

Version Added: Word 2010

Syntax

expression .Creator

expression An expression that returns a ProtectedViewWindows object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD". This property was primarily designed to be used on the Apple Macintosh, where each application has a four-character creator code. For example, Word has the creator code MSWD. For more information about this property, see the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

ProtectedViewWindows Object

Other resources

ProtectedViewWindows Object Members


ProtectedViewWindows.Parent Property (Word)

 Copy code hover
[image]

ProtectedViewWindows.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified ProtectedViewWindows object.

Version Information

Version Added: Word 2010

Syntax

expression .Parent

expression An expression that returns a ProtectedViewWindows object.

See also

Concepts

ProtectedViewWindows Object

Other resources

ProtectedViewWindows Object Members


ProtectedViewWindows Methods (Word)

 Copy code hover
[image]

ProtectedViewWindows Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Item | Returns an individual ProtectedViewWindows object in a collection.
Open | Opens the specified document in a new protected view window.


ProtectedViewWindows.Item Method (Word)

 Copy code hover
[image]

ProtectedViewWindows.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual ProtectedViewWindows object in a collection.

Version Information

Version Added: Word 2010

Syntax

expression .Item(Index)

expression An expression that returns a ProtectedViewWindows object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The individual object to be returned.

Return Value

ProtectedViewWindow

See also

Concepts

ProtectedViewWindows Object

Other resources

ProtectedViewWindows Object Members


ProtectedViewWindows.Open Method (Word)

 Copy code hover
[image]

ProtectedViewWindows.Open Method (Word)
See also Send feedback

Published: July 16, 2012

Opens the specified document in a new protected view window.

Version Information

Version Added: Word 2010

Syntax

expression .Open(FileName, AddToRecentFiles, PasswordDocument, Visible, OpenAndRepair)

expression An expression that returns a ProtectedViewWindows object.

Parameters

Name | Required/Optional | Data Type | Description
FileName | Required | Variant | The name of the document (paths are accepted).
AddToRecentFiles | Optional | Variant | True to add the file name to the list of recently used files at the bottom of the File menu.
PasswordDocument | Optional | Variant | The password for opening the document.
Visible | Optional | Variant | True if the document is opened in a visible window. The default value is True.
OpenAndRepair | Optional | Variant | True to repair the document to prevent document corruption.

Return Value

ProtectedViewWindow

Remarks

Avoid using hard-coded passwords in your applications. If a password is required in a procedure, request the password from the user, store it in a variable, and then use the variable in your code.

Example

The following code example opens a document in a new protected view window.

VBA Copy code Copy code
ProtectedViewWindows.Open FileName:="C:\MyFiles\MyDoc.doc"

See also

Concepts

ProtectedViewWindows Object

Other resources

ProtectedViewWindows Object Members


Range Object (Word)

 Copy code hover
[image]

Range Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a contiguous area in a document. Each Range object is defined by a starting and ending character position.

Remarks

Similar to the way bookmarks are used in a document, Range objects are used in Visual Basic procedures to identify specific portions of a document. However, unlike a bookmark, a Range object only exists while the procedure that defined it is running.Range objects are independent of the selection. That is, you can define and manipulate a range without changing the selection. You can also define multiple ranges in a document, while there can be only one selection per pane.

Use the Range method to return a Range object defined by the given starting and ending character positions. The following example returns a Range object that refers to the first 10 characters in the active document.

VBA Copy code Copy code
Set myRange = ActiveDocument.Range(Start:=0, End:=10)

Use the Range property to return a Range object defined by the beginning and end of another object. The Range property applies to many objects (for example, Paragraph, Bookmark, and Cell). The following example returns a Range object that refers to the first paragraph in the active document.

VBA Copy code Copy code
Set aRange = ActiveDocument.Paragraphs(1).Range

The following example returns a Range object that refers to the second through fourth paragraphs in the active document

VBA Copy code Copy code
Set aRange = ActiveDocument.Range( _
 Start:=ActiveDocument.Paragraphs(2).Range.Start, _
 End:=ActiveDocument.Paragraphs(4).Range.End)

For more information about working with Range objects, see Working with Range Objects .

See also

Concepts

Word Object Model Reference

Other resources

Range Object Members


Range Members (Word)

 Copy code hover
[image]

Range Members (Word)
Send feedback

Published: July 16, 2012

Represents a contiguous area in a document. Each Range object is defined by a starting and ending character position.

Methods

Name | Description
AutoFormat | Automatically formats a document. Use the Kind property to specify a document type.
Calculate | Calculates a mathematical expression within a range or selection. Returns the result as a Single.
CheckGrammar | Begins a spelling and grammar check for the specified range.
CheckSpelling | Begins a spelling check for the specified document or range.
CheckSynonyms | Displays the Thesaurus dialog box, which lists alternative word choices, or synonyms, for the text in the specified range.
Collapse | Collapses a range or selection to the starting or ending position. After a range or selection is collapsed, the starting and ending points are equal.
ComputeStatistics | Returns a Long that represents a statistic based on the contents of the specified range.
ConvertHangulAndHanja | Converts the specified range from hangul to hanja or vice versa.
ConvertToTable | Converts text within a range to a table. Returns the table as a Table object.
Copy | Copies the specified range to the Clipboard.
CopyAsPicture | The CopyAsPicture method works the same way as the Copy method.
Cut | Removes the specified object from the document and places it on the Clipboard.
Delete | Deletes the specified number of characters or words.
DetectLanguage | Analyzes the specified text to determine the language that it is written in.
EndOf | Moves or extends the ending character position of a range to the end of the nearest specified text unit.
Expand | Expands the specified range or selection. Returns the number of characters added to the range or selection. Long.
ExportAsFixedFormat | Saves a portion of a document as PDF or XPS format.
ExportFragment | Exports the selected range into a document for use as a document fragment.
GetSpellingSuggestions | Returns a SpellingSuggestions collection that represents the words suggested as spelling replacements for the first word in the specified range.
GoTo | Returns a Range object that represents the start position of the specified item, such as a page, bookmark, or field.
GoToEditableRange | Returns a Range object that represents an area of a document that can be modified by the specified user or group of users.
GoToNext | Returns a Range object that refers to the start position of the next item or location specified by the What argument. .
GoToPrevious | Returns a Range object that refers to the start position of the previous item or location specified by the What argument.
ImportFragment | Imports a document fragment into the document at the specified range.
InRange | Returns True if the range to which the method is applied is contained in the range specified by the Range argument.
InsertAfter | Inserts the specified text at the end of a range.
InsertAlignmentTab | Inserts an absolute tab that is always positioned in the same spot, relative to either the margins or indents.
InsertAutoText | Attempts to match the text in the specified range or the text surrounding the range with an existing AutoText entry name.
InsertBefore | Inserts the specified text before the specified range.
InsertBreak | Inserts a page, column, or section break.
InsertCaption | Inserts a caption immediately preceding or following the specified range.
InsertCrossReference | Inserts a cross-reference to a heading, bookmark, footnote, or endnote, or to an item for which a caption label is defined (for example, an equation, figure, or table).
InsertDatabase | Retrieves data from a data source (for example, a separate Microsoft Word document, a Microsoft Excel worksheet, or a Microsoft Access database) and inserts the data as a table in place of the specified range.
InsertDateTime | Inserts the current date or time, or both, either as text or as a TIME field.
InsertFile | Inserts all or part of the specified file.
InsertParagraph | Replaces the specified range with a new paragraph.
InsertParagraphAfter | Inserts a paragraph mark after a range.
InsertParagraphBefore | Inserts a new paragraph before the specified range.
InsertSymbol | Inserts a symbol in place of the specified range.
InsertXML | Inserts the specified XML into the document at the specified range, replacing any text contained within the range.
InStory | True if the range to which this method is applied is in the same story as the range specified by the Range argument.
IsEqual | True if the range to which this method is applied is equal to the range specified by the Range argument.
LookupNameProperties | Looks up a name in the global address book list and displays the Properties dialog box, which includes information about the specified name.
ModifyEnclosure | Adds, modifies, or removes an enclosure around the specified character or characters.
Move | Collapses the specified range to its start or end position and then moves the collapsed object by the specified number of units.
MoveEnd | Moves the ending character position of a range. .
MoveEndUntil | Moves the end position of the specified range until any of the specified characters are found in the document. If the movement is forward in the document, the range is expanded.
MoveEndWhile | Moves the ending character position of a range while any of the specified characters are found in the document.
MoveStart | Moves the start position of the specified range.
MoveStartUntil | Moves the start position of the specified range until one of the specified characters is found in the document.
MoveStartWhile | Moves the start position of the specified range while any of the specified characters are found in the document.
MoveUntil | Moves the specified range until one of the specified characters is found in the document.
MoveWhile | Moves the specified range while any of the specified characters are found in the document.
Next | Returns a Range object that represents the specified unit relative to the specified range.
NextSubdocument | Moves the range to the next subdocument.
Paste | Inserts the contents of the Clipboard at the specified range.
PasteAndFormat | Pastes the selected table cells and formats them as specified.
PasteAppendTable | Merges pasted cells into an existing table by inserting the pasted rows between the selected rows. No cells are overwritten.
PasteAsNestedTable | Pastes a cell or group of cells as a nested table into the selected range.
PasteExcelTable | Pastes and formats a Microsoft Excel table.
PasteSpecial | Inserts the contents of the Clipboard. .
PhoneticGuide | Adds phonetic guides to the specified range.
Previous | Returns the previous range a relative to the specified range.
PreviousSubdocument | Moves the range to the previous subdocument.
Relocate | In outline view, moves the paragraphs within the specified range after the next visible paragraph or before the previous visible paragraph.
Select | Selects the specified range.
SetListLevel | Sets the list level for one or more items in a numbered list.
SetRange | Sets the starting and ending character positions for an existing range.
Sort | Sorts the paragraphs in the specified range.
SortAscending | Sorts paragraphs or table rows in ascending alphanumeric order.
SortByHeadings | Sorts the headings in the specified range.
SortDescending | Sorts paragraphs in descending alphanumeric order.
StartOf | Moves or extends the start position of the specified range or selection to the beginning of the nearest specified text unit. This method returns a Long that indicates the number of characters by which the range or selection was moved or extended. The method returns a negative number if the movement is backward through the document.
TCSCConverter | Converts the specified range from Traditional Chinese to Simplified Chinese or vice versa.
WholeStory | Expands a range to include the entire story.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Bold | True if the range is formatted as bold. Read/write Long.
BoldBi | True if the font or range is formatted as bold. Returns True, False, or wdUndefined (for a mixture of bold and non-bold text). Can be set to True, False, or wdToggle. Read/write Long.
BookmarkID | Returns the number of the bookmark that encloses the beginning of the specified range; returns 0 (zero) if there is no corresponding bookmark. Read-only Long.
Bookmarks | Returns a Bookmarks collection that represents all the bookmarks in a document, range, or selection. Read-only.
Borders | Returns a Borders collection that represents all the borders for the specified object.
Case | Returns or sets a WdCharacterCase constant that represents the case of the text in the specified range. Read/write.
Cells | Returns a Cells collection that represents the table cells in a range. Read-only.
Characters | Returns a Characters collection that represents the characters in a range. Read-only.
CharacterStyle | Returns a Variant that represents the style used to format one or more characters. Read-only.
CharacterWidth | Returns or sets the character width of the specified range. Read/write WdCharacterWidth.
Columns | Returns a Columns collection that represents all the table columns in the range. Read-only.
CombineCharacters | True if the specified range contains combined characters. Read/write Boolean.
Comments | Returns a Comments collection that represents all the comments in the specified document, selection, or range. Read-only.
Conflicts | Returns a Conflicts collection object that contains all the conflict objects in the range. Read-only.
ContentControls | Returns a ContentControls collection that represents the content controls contained within a range. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
DisableCharacterSpaceGrid | True if Microsoft Word ignores the number of characters per line for the corresponding Range object. Read/write Boolean.
Document | Returns a Document object associated with the specified range. Read-only.
Duplicate | Returns a read-only Range object that represents all the properties of the specified range.
Editors | Returns an Editors object that represents all the users authorized to modify a selection or range within a document.
EmphasisMark | Returns or sets the emphasis mark for a character or designated character string. Read/write WdEmphasisMark.
End | Returns or sets the ending character position of a range. Read/write Long.
EndnoteOptions | Returns an EndnoteOptions object that represents the endnotes in a range.
Endnotes | Returns an Endnotes collection that represents all the endnotes in a range. Read-only.
EnhMetaFileBits | Returns a Variant that represents a picture representation of how a range of text appears.
Fields | Returns a Fields collection that represents all the fields in the range. Read-only.
Find | Returns a Find object that contains the criteria for a find operation. Read-only.
FitTextWidth | Returns or sets the width (in the current measurement units) in which Microsoft Word fits the text in the current selection or range. Read/write Single.
Font | Returns or sets a Font object that represents the character formatting of the specified object. Read/write Font.
FootnoteOptions | Returns FootnoteOptions object that represents the footnotes in a selection or range.
Footnotes | Returns a Footnotes collection that represents all the footnotes in a range. Read-only.
FormattedText | Returns or sets a Range object that includes the formatted text in the specified range or selection. Read/write.
FormFields | Returns a FormFields collection that represents all the form fields in the range. Read-only.
Frames | Returns a Frames collection that represents all the frames in a range. Read-only.
GrammarChecked | True if a grammar check has been run on the specified range or document. Read/write Boolean.
GrammaticalErrors | Returns a ProofreadingErrors collection that represents the sentences that failed the grammar check on the specified document or range. Read-only.
HighlightColorIndex | Returns or sets the highlight color for the specified range. Read/write WdColorIndex.
HorizontalInVertical | Returns or sets the formatting for horizontal text set within vertical text. Read/write WdHorizontalInVerticalType.
HTMLDivisions | Returns an HTMLDivisions object that represents an HTML division in a Web document.
Hyperlinks | Returns a Hyperlinks collection that represents all the hyperlinks in the specified range. Read-only.
ID | Returns or sets the identification name for the specified range. Read/write String.
Information | Returns information about the specified range. Read-only Variant.
InlineShapes | Returns an InlineShapes collection that represents all the InlineShape objects in a range. Read-only.
IsEndOfRowMark | True if the specified range is collapsed and is located at the end-of-row mark in a table. Read-only Boolean.
Italic | True if the font or range is formatted as italic. Read/write Long.
ItalicBi | True if the font or range is formatted as italic. Read/write Long.
Kana | Returns or sets whether the specified range of Japanese language text is hiragana or katakana. Read/write WdKana.
LanguageDetected | Returns or sets a value that specifies whether Microsoft Word has detected the language of the specified text. Read/write Boolean.
LanguageID | Returns or sets a WdLanguageID constant that represents the language for the specified range. Read/write.
LanguageIDFarEast | Returns or sets an East Asian language for the specified object. Read/write WdLanguageID.
LanguageIDOther | Returns or sets the language for the specified range. Read/write WdLanguageID.
ListFormat | Returns a ListFormat object that represents all the list formatting characteristics of a range. Read-only.
ListParagraphs | Returns a ListParagraphs collection that represents all the numbered paragraphs in the range. Read-only.
ListStyle | Returns a Variant that represents the style used to format a bulleted list or numbered list. Read-only.
Locks | Returns a CoAuthLocks collection object that represents all the locks in the range. Read-only.
NextStoryRange | Returns a Range object that refers to the next story. Read-only Range.
NoProofing | True if the spelling and grammar checker ignores the specified text. Read/write Long.
OMaths | Returns an OMaths collection that represents the OMath objects within the specified range. Read-only.
Orientation | Returns or sets the orientation of text in a range when the Text Direction feature is enabled. Read/write WdTextOrientation.
PageSetup | Returns a PageSetup object that's associated with the specified range.
ParagraphFormat | Returns or sets a ParagraphFormat object that represents the paragraph settings for the specified range. Read/write.
Paragraphs | Returns a Paragraphs collection that represents all the paragraphs in the specified range. Read-only.
ParagraphStyle | Returns a Variant that represents the style used to format a paragraph. Read-only.
Parent | Returns an Object that represents the parent object of the specified Range object.
ParentContentControl | Returns a ContentControl object that represents the parent content control for the specified range. Read-only.
PreviousBookmarkID | Returns the number of the last bookmark that starts before or at the same place as the specified range. Read-only Long.
ReadabilityStatistics | Returns a ReadabilityStatistics collection that represents the readability statistics for the specified document or range. Read-only.
Revisions | Returns a Revisions collection that represents the tracked changes in the range. Read-only.
Rows | Returns a Rows collection that represents all the table rows in a range. Read-only.
Scripts | Returns a Scripts collection that represents the collection of HTML scripts in the specified object.
Sections | Returns a Sections collection that represents the sections in the specified range. Read-only.
Sentences | Returns a Sentences collection that represents all the sentences in the range. Read-only.
Shading | Returns a Shading object that refers to the shading formatting for the specified object.
ShapeRange | Returns a ShapeRange collection that represents all the Shape objects in the specified range. Read-only.
ShowAll | True if all nonprinting characters (such as hidden text, tab marks, space marks, and paragraph marks) are displayed. Read/write Boolean.
SpellingChecked | True if spelling has been checked throughout the specified range or document. False if all or some of the range or document has not been checked for spelling. Read/write Boolean.
SpellingErrors | Returns a ProofreadingErrors collection that represents the words identified as spelling errors in the specified range. Read-only.
Start | Returns or sets the starting character position of a range. Read/write Long.
StoryLength | Returns the number of characters in the story that contains the specified range. Read-only Long.
StoryType | Returns the story type for the specified range, selection, or bookmark. Read-only WdStoryType.
Style | Returns or sets the style for the specified object. Read/write Variant.
Subdocuments | Returns a Subdocuments collection that represents all the subdocuments in the specified range or document. Read-only.
SynonymInfo | Returns a SynonymInfo object that contains information from the thesaurus on synonyms, antonyms, or related words and expressions for the contents of a range.
Tables | Returns a Tables collection that represents all the tables in the specified range. Read-only.
TableStyle | Returns a Variant that represents the style used to format a table. Read-only.
Text | Returns or sets the text in the specified range or selection. Read/write String. Read/write String.
TextRetrievalMode | Returns a TextRetrievalMode object that controls how text is retrieved from the specified Range. Read/write.
TextVisibleOnScreen | Returns a Long that indicates whether the text in the specified range is visible on the screen. Read-only.
TopLevelTables | Returns a Tables collection that represents the tables at the outermost nesting level in the current range. Read-only.
TwoLinesInOne | Returns or sets whether Microsoft Word sets two lines of text in one and specifies the characters that enclose the text, if any. Read/write WdTwoLinesInOneType.
Underline | Returns or sets the type of underline applied to a range. Read/write WdUnderline.
Updates | Returns a CoAuthUpdates collection object that represents all updates that were merged into the specified range at the last explicit save. Read-only.
WordOpenXML | Returns a String that represents the XML contained within the range in the Microsoft Word Open XML format. Read-only.
Words | Returns a Words collection that represents all the words in a range. Read-only.
XML | Returns a String that represents the XML text in the specified object. .


Range Properties (Word)

 Copy code hover
[image]

Range Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Bold | True if the range is formatted as bold. Read/write Long.
BoldBi | True if the font or range is formatted as bold. Returns True, False, or wdUndefined (for a mixture of bold and non-bold text). Can be set to True, False, or wdToggle. Read/write Long.
BookmarkID | Returns the number of the bookmark that encloses the beginning of the specified range; returns 0 (zero) if there is no corresponding bookmark. Read-only Long.
Bookmarks | Returns a Bookmarks collection that represents all the bookmarks in a document, range, or selection. Read-only.
Borders | Returns a Borders collection that represents all the borders for the specified object.
Case | Returns or sets a WdCharacterCase constant that represents the case of the text in the specified range. Read/write.
Cells | Returns a Cells collection that represents the table cells in a range. Read-only.
Characters | Returns a Characters collection that represents the characters in a range. Read-only.
CharacterStyle | Returns a Variant that represents the style used to format one or more characters. Read-only.
CharacterWidth | Returns or sets the character width of the specified range. Read/write WdCharacterWidth.
Columns | Returns a Columns collection that represents all the table columns in the range. Read-only.
CombineCharacters | True if the specified range contains combined characters. Read/write Boolean.
Comments | Returns a Comments collection that represents all the comments in the specified document, selection, or range. Read-only.
Conflicts | Returns a Conflicts collection object that contains all the conflict objects in the range. Read-only.
ContentControls | Returns a ContentControls collection that represents the content controls contained within a range. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
DisableCharacterSpaceGrid | True if Microsoft Word ignores the number of characters per line for the corresponding Range object. Read/write Boolean.
Document | Returns a Document object associated with the specified range. Read-only.
Duplicate | Returns a read-only Range object that represents all the properties of the specified range.
Editors | Returns an Editors object that represents all the users authorized to modify a selection or range within a document.
EmphasisMark | Returns or sets the emphasis mark for a character or designated character string. Read/write WdEmphasisMark.
End | Returns or sets the ending character position of a range. Read/write Long.
EndnoteOptions | Returns an EndnoteOptions object that represents the endnotes in a range.
Endnotes | Returns an Endnotes collection that represents all the endnotes in a range. Read-only.
EnhMetaFileBits | Returns a Variant that represents a picture representation of how a range of text appears.
Fields | Returns a Fields collection that represents all the fields in the range. Read-only.
Find | Returns a Find object that contains the criteria for a find operation. Read-only.
FitTextWidth | Returns or sets the width (in the current measurement units) in which Microsoft Word fits the text in the current selection or range. Read/write Single.
Font | Returns or sets a Font object that represents the character formatting of the specified object. Read/write Font.
FootnoteOptions | Returns FootnoteOptions object that represents the footnotes in a selection or range.
Footnotes | Returns a Footnotes collection that represents all the footnotes in a range. Read-only.
FormattedText | Returns or sets a Range object that includes the formatted text in the specified range or selection. Read/write.
FormFields | Returns a FormFields collection that represents all the form fields in the range. Read-only.
Frames | Returns a Frames collection that represents all the frames in a range. Read-only.
GrammarChecked | True if a grammar check has been run on the specified range or document. Read/write Boolean.
GrammaticalErrors | Returns a ProofreadingErrors collection that represents the sentences that failed the grammar check on the specified document or range. Read-only.
HighlightColorIndex | Returns or sets the highlight color for the specified range. Read/write WdColorIndex.
HorizontalInVertical | Returns or sets the formatting for horizontal text set within vertical text. Read/write WdHorizontalInVerticalType.
HTMLDivisions | Returns an HTMLDivisions object that represents an HTML division in a Web document.
Hyperlinks | Returns a Hyperlinks collection that represents all the hyperlinks in the specified range. Read-only.
ID | Returns or sets the identification name for the specified range. Read/write String.
Information | Returns information about the specified range. Read-only Variant.
InlineShapes | Returns an InlineShapes collection that represents all the InlineShape objects in a range. Read-only.
IsEndOfRowMark | True if the specified range is collapsed and is located at the end-of-row mark in a table. Read-only Boolean.
Italic | True if the font or range is formatted as italic. Read/write Long.
ItalicBi | True if the font or range is formatted as italic. Read/write Long.
Kana | Returns or sets whether the specified range of Japanese language text is hiragana or katakana. Read/write WdKana.
LanguageDetected | Returns or sets a value that specifies whether Microsoft Word has detected the language of the specified text. Read/write Boolean.
LanguageID | Returns or sets a WdLanguageID constant that represents the language for the specified range. Read/write.
LanguageIDFarEast | Returns or sets an East Asian language for the specified object. Read/write WdLanguageID.
LanguageIDOther | Returns or sets the language for the specified range. Read/write WdLanguageID.
ListFormat | Returns a ListFormat object that represents all the list formatting characteristics of a range. Read-only.
ListParagraphs | Returns a ListParagraphs collection that represents all the numbered paragraphs in the range. Read-only.
ListStyle | Returns a Variant that represents the style used to format a bulleted list or numbered list. Read-only.
Locks | Returns a CoAuthLocks collection object that represents all the locks in the range. Read-only.
NextStoryRange | Returns a Range object that refers to the next story. Read-only Range.
NoProofing | True if the spelling and grammar checker ignores the specified text. Read/write Long.
OMaths | Returns an OMaths collection that represents the OMath objects within the specified range. Read-only.
Orientation | Returns or sets the orientation of text in a range when the Text Direction feature is enabled. Read/write WdTextOrientation.
PageSetup | Returns a PageSetup object that's associated with the specified range.
ParagraphFormat | Returns or sets a ParagraphFormat object that represents the paragraph settings for the specified range. Read/write.
Paragraphs | Returns a Paragraphs collection that represents all the paragraphs in the specified range. Read-only.
ParagraphStyle | Returns a Variant that represents the style used to format a paragraph. Read-only.
Parent | Returns an Object that represents the parent object of the specified Range object.
ParentContentControl | Returns a ContentControl object that represents the parent content control for the specified range. Read-only.
PreviousBookmarkID | Returns the number of the last bookmark that starts before or at the same place as the specified range. Read-only Long.
ReadabilityStatistics | Returns a ReadabilityStatistics collection that represents the readability statistics for the specified document or range. Read-only.
Revisions | Returns a Revisions collection that represents the tracked changes in the range. Read-only.
Rows | Returns a Rows collection that represents all the table rows in a range. Read-only.
Scripts | Returns a Scripts collection that represents the collection of HTML scripts in the specified object.
Sections | Returns a Sections collection that represents the sections in the specified range. Read-only.
Sentences | Returns a Sentences collection that represents all the sentences in the range. Read-only.
Shading | Returns a Shading object that refers to the shading formatting for the specified object.
ShapeRange | Returns a ShapeRange collection that represents all the Shape objects in the specified range. Read-only.
ShowAll | True if all nonprinting characters (such as hidden text, tab marks, space marks, and paragraph marks) are displayed. Read/write Boolean.
SpellingChecked | True if spelling has been checked throughout the specified range or document. False if all or some of the range or document has not been checked for spelling. Read/write Boolean.
SpellingErrors | Returns a ProofreadingErrors collection that represents the words identified as spelling errors in the specified range. Read-only.
Start | Returns or sets the starting character position of a range. Read/write Long.
StoryLength | Returns the number of characters in the story that contains the specified range. Read-only Long.
StoryType | Returns the story type for the specified range, selection, or bookmark. Read-only WdStoryType.
Style | Returns or sets the style for the specified object. Read/write Variant.
Subdocuments | Returns a Subdocuments collection that represents all the subdocuments in the specified range or document. Read-only.
SynonymInfo | Returns a SynonymInfo object that contains information from the thesaurus on synonyms, antonyms, or related words and expressions for the contents of a range.
Tables | Returns a Tables collection that represents all the tables in the specified range. Read-only.
TableStyle | Returns a Variant that represents the style used to format a table. Read-only.
Text | Returns or sets the text in the specified range or selection. Read/write String. Read/write String.
TextRetrievalMode | Returns a TextRetrievalMode object that controls how text is retrieved from the specified Range. Read/write.
TextVisibleOnScreen | Returns a Long that indicates whether the text in the specified range is visible on the screen. Read-only.
TopLevelTables | Returns a Tables collection that represents the tables at the outermost nesting level in the current range. Read-only.
TwoLinesInOne | Returns or sets whether Microsoft Word sets two lines of text in one and specifies the characters that enclose the text, if any. Read/write WdTwoLinesInOneType.
Underline | Returns or sets the type of underline applied to a range. Read/write WdUnderline.
Updates | Returns a CoAuthUpdates collection object that represents all updates that were merged into the specified range at the last explicit save. Read-only.
WordOpenXML | Returns a String that represents the XML contained within the range in the Microsoft Word Open XML format. Read-only.
Words | Returns a Words collection that represents all the words in a range. Read-only.
XML | Returns a String that represents the XML text in the specified object. .


Range.Application Property (Word)

 Copy code hover
[image]

Range.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a Range object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Bold Property (Word)

 Copy code hover
[image]

Range.Bold Property (Word)
See also Send feedback

Published: July 16, 2012

True if the range is formatted as bold. Read/write Long.

Syntax

expression .Bold

expression A variable that represents a Range object.

Remarks

Returns True, False or wdUndefined (a mixture of True and False). Can be set to True, False, or wdToggle.

Example

This example toggles the bold format for the selected text.

VBA Copy code Copy code
If Selection.Type = wdSelectionNormal Then
 Selection.Range.Bold = wdToggle
End If

This example makes the first paragraph in the active document bold.

VBA Copy code Copy code
ActiveDocument.Paragraphs(1).Range.Bold = True

See also

Concepts

Range Object

Other resources

Range Object Members


Range.BoldBi Property (Word)

 Copy code hover
[image]

Range.BoldBi Property (Word)
See also Send feedback

Published: July 16, 2012

True if the font or range is formatted as bold. Returns True, False, or wdUndefined (for a mixture of bold and non-bold text). Can be set to True, False, or wdToggle. Read/write Long.

Syntax

expression .BoldBi

expression An expression that returns a Range object.

Example

This example makes the first paragraph in the active right-to-left language document bold.

VBA Copy code Copy code
ActiveDocument.Paragraphs(1).Range.BoldBi = True

See also

Concepts

Range Object

Other resources

Range Object Members


Range.BookmarkID Property (Word)

 Copy code hover
[image]

Range.BookmarkID Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the number of the bookmark that encloses the beginning of the specified range; returns 0 (zero) if there is no corresponding bookmark. Read-only Long.

Syntax

expression .BookmarkID

expression A variable that represents a Range object.

Remarks

The number or the bookmark corresponds to the position of the bookmark in the document: 1 for the first bookmark, 2 for the second one, and so on.

Example

This example adds a bookmark named "temp" at the beginning of the document if there is not already a bookmark set for that location.

VBA Copy code Copy code
Set myRange = ActiveDocument.Content
myRange.Collapse Direction:=wdCollapseStart
If myRange.BookmarkID = 0 Then
 ActiveDocument.Bookmarks.Add Name:="temp", Range:=myRange
End If

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Bookmarks Property (Word)

 Copy code hover
[image]

Range.Bookmarks Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Bookmarks collection that represents all the bookmarks in a document, range, or selection. Read-only.

Syntax

expression .Bookmarks

expression A variable that represents a Range object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Borders Property (Word)

 Copy code hover
[image]

Range.Borders Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Borders collection that represents all the borders for the specified object.

Syntax

expression .Borders

expression Required. A variable that represents a Range object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Case Property (Word)

 Copy code hover
[image]

Range.Case Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a WdCharacterCase constant that represents the case of the text in the specified range. Read/write.

Syntax

expression .Case

expression Required. A variable that represents a Range object.

Remarks

Some of the constants listed above may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Cells Property (Word)

 Copy code hover
[image]

Range.Cells Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Cells collection that represents the table cells in a range. Read-only.

Syntax

expression .Cells

expression A variable that represents a Range object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example creates a 3x3 table and assigns a sequential cell number to each cell in the table.

VBA Copy code Copy code
Set newDoc = Documents.Add
Set myTable = newDoc.Tables.Add(Selection.Range, 3, 3)
i = 1
For Each c In myTable.Range.Cells
 c.Range.InsertAfter "Cell " & i
 i = i + 1
Next c

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Characters Property (Word)

 Copy code hover
[image]

Range.Characters Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Characters collection that represents the characters in a range. Read-only.

Syntax

expression .Characters

expression A variable that represents a Range object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

See also

Concepts

Range Object

Other resources

Range Object Members


Range.CharacterStyle Property (Word)

 Copy code hover
[image]

Range.CharacterStyle Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Variant that represents the style used to format one or more characters. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .CharacterStyle

expression An expression that returns a Range object.

See also

Concepts

Range Object

Other resources

Range Object Members


Range.CharacterWidth Property (Word)

 Copy code hover
[image]

Range.CharacterWidth Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the character width of the specified range. Read/write WdCharacterWidth.

Syntax

expression .CharacterWidth

expression Required. A variable that represents a Range object.

Example

This example converts the current selection to half-width characters.

VBA Copy code Copy code
Selection.Range.CharacterWidth = wdWidthHalfWidth

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Columns Property (Word)

 Copy code hover
[image]

Range.Columns Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Columns collection that represents all the table columns in the range. Read-only.

Syntax

expression .Columns

expression A variable that represents a Range object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example displays the number of columns in the first table in the active document.

VBA Copy code Copy code
If ActiveDocument.Tables.Count >= 1 Then
 MsgBox ActiveDocument.Tables(1).Columns.Count
End If

This example sets the width of the current column to 1 inch.

VBA Copy code Copy code
If Selection.Information(wdWithInTable) = True Then
 Selection.Columns.SetWidth ColumnWidth:=InchesToPoints(1), _
 RulerStyle:=wdAdjustProportional
End If

See also

Concepts

Range Object

Other resources

Range Object Members


Range.CombineCharacters Property (Word)

 Copy code hover
[image]

Range.CombineCharacters Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified range contains combined characters. Read/write Boolean.

Syntax

expression .CombineCharacters

expression An expression that returns a Range object.

Example

This example combines the characters in the selected range.

VBA Copy code Copy code
Selection.Range.CombineCharacters = True

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Comments Property (Word)

 Copy code hover
[image]

Range.Comments Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Comments collection that represents all the comments in the specified document, selection, or range. Read-only.

Syntax

expression .Comments

expression A variable that represents a Range object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Conflicts Property (Word)

 Copy code hover
[image]

Range.Conflicts Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Conflicts collection object that contains all the conflict objects in the range. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .Conflicts

expression An expression that returns a Range object.

Remarks

Use the Conflicts property to return the Conflicts collection object for a document. Use Conflicts(Index), where Index is the conflict index number, to return a single Conflict object.

Note Note

This property is only available for co-authoring enabled documents. If you attempt to access this property on a document that is not enabled for co-authoring, you will receive a run-time error.

Example

The following code example displays the number of conflicts in the first paragraph of the active document.

VBA Copy code Copy code
MsgBox ActiveDocument.Paragraphs(1).Range.Conflicts.Count

See also

Concepts

Range Object

Other resources

Range Object Members


Range.ContentControls Property (Word)

 Copy code hover
[image]

Range.ContentControls Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a ContentControls collection that represents the content controls contained within a range. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .ContentControls

expression An expression that returns a Range object.

Example

The following example inserts a drop-down list content control into the active document at the specified position.

VBA Copy code Copy code
Dim objCC As ContentControl
Dim objRange as Range

Set objRange = ActiveDocument.Range(200, 200)
Set objCC = objRange.ContentControls.Add(wdContentControlDropdownList)

'List entries
objCC.DropdownListEntries.Add "Cat"
objCC.DropdownListEntries.Add "Dog"
objCC.DropdownListEntries.Add "Horse"
objCC.DropdownListEntries.Add "Monkey"
objCC.DropdownListEntries.Add "Snake"
objCC.DropdownListEntries.Add "Other"

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Creator Property (Word)

 Copy code hover
[image]

Range.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a Range object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Range Object

Other resources

Range Object Members


Range.DisableCharacterSpaceGrid Property (Word)

 Copy code hover
[image]

Range.DisableCharacterSpaceGrid Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word ignores the number of characters per line for the corresponding Range object. Read/write Boolean.

Syntax

expression .DisableCharacterSpaceGrid

expression A variable that represents a Range object.

Remarks

Returns wdUndefined if the DisableCharacterSpaceGrid property is set to True for only some of the specified font or range.

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Document Property (Word)

 Copy code hover
[image]

Range.Document Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Document object associated with the specified range. Read-only.

Syntax

expression .Document

expression A variable that represents a Range object.

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Duplicate Property (Word)

 Copy code hover
[image]

Range.Duplicate Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a read-only Range object that represents all the properties of the specified range.

Syntax

expression .Duplicate

expression Required. A variable that represents a Range object.

Remarks

By duplicating a Range object, you can change the starting or ending character position of the duplicate range without changing the original range.

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Editors Property (Word)

 Copy code hover
[image]

Range.Editors Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Editors object that represents all the users authorized to modify a selection or range within a document.

Syntax

expression .Editors

expression Required. A variable that represents a Range object.

Example

The following example gives the current user editing permission to modify the active selection.

VBA Copy code Copy code
Dim objEditor As Editor

Set objEditor = Selection.Editors.Add(wdEditorCurrent)

See also

Concepts

Range Object

Other resources

Range Object Members


Range.EmphasisMark Property (Word)

 Copy code hover
[image]

Range.EmphasisMark Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the emphasis mark for a character or designated character string. Read/write WdEmphasisMark.

Syntax

expression .EmphasisMark

expression Required. A variable that represents a Range object.

Example

This example sets the emphasis mark over the fourth word in the active document to a comma.

VBA Copy code Copy code
ActiveDocument.Words(4).EmphasisMark = wdEmphasisMarkOverComma

See also

Concepts

Range Object

Other resources

Range Object Members


Range.End Property (Word)

 Copy code hover
[image]

Range.End Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the ending character position of a range. Read/write Long.

Syntax

expression .End

expression A variable that represents a Range object.

Remarks

Range objects all have a starting position and an ending position. The ending position is the point farthest away from the beginning of the story. If this property is set to a value smaller than the Start property, the Start property is set to the same value (that is, the Start and End property are equal).

This property returns the ending character position relative to the beginning of the story. The main document story (wdMainTextStory) begins with character position 0 (zero). You can change the size of a selection, range, or bookmark by setting this property.

Example

This example changes the ending position of myRange by one character.

VBA Copy code Copy code
Set myRange = ActiveDocument.Paragraphs(1).Range
myRange.End = myRange.End - 1

See also

Concepts

Range Object

Other resources

Range Object Members


Range.EndnoteOptions Property (Word)

 Copy code hover
[image]

Range.EndnoteOptions Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an EndnoteOptions object that represents the endnotes in a range.

Syntax

expression .EndnoteOptions

expression Required. A variable that represents a Range object.

Example

This example sets the starting number for endnotes in section two of the active document to one if the starting number is not one.

VBA Copy code Copy code
Sub SetEndnoteOptionsRange()
 With ActiveDocument.Sections(2).Range.EndnoteOptions
 If .StartingNumber <> 1 Then
 .StartingNumber = 1
 End If
 End With
End Sub

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Endnotes Property (Word)

 Copy code hover
[image]

Range.Endnotes Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Endnotes collection that represents all the endnotes in a range. Read-only.

Syntax

expression .Endnotes

expression A variable that represents a Range object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

See also

Concepts

Range Object

Other resources

Range Object Members


Range.EnhMetaFileBits Property (Word)

 Copy code hover
[image]

Range.EnhMetaFileBits Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Variant that represents a picture representation of how a range of text appears.

Syntax

expression .EnhMetaFileBits

expression Required. A variable that represents a Range object.

Remarks

The EnhMetaFileBits property returns an array of bytes, which can be used with the Microsoft Windows 32 Application Programming Interface from within the Microsoft Visual Basic or Microsoft C++ development environment.

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Fields Property (Word)

 Copy code hover
[image]

Range.Fields Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Fields collection that represents all the fields in the range. Read-only.

Syntax

expression .Fields

expression Required. A variable that represents a Range object.

Example

This example removes all the fields from the main text story and the footer in the active document.

VBA Copy code Copy code
For Each aField in ActiveDocument.Fields
 aField.Delete
Next aField
Set myRange = ActiveDocument.Sections(1).Footers _
 (wdHeaderFooterPrimary).Range
For Each aField In myRange.Fields
 aField.Delete
Next aField

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Find Property (Word)

 Copy code hover
[image]

Range.Find Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Find object that contains the criteria for a find operation. Read-only.

Syntax

expression .Find

expression A variable that represents a Range object.

See also

Concepts

Range Object

Other resources

Range Object Members


Range.FitTextWidth Property (Word)

 Copy code hover
[image]

Range.FitTextWidth Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the width (in the current measurement units) in which Microsoft Word fits the text in the current selection or range. Read/write Single.

Syntax

expression .FitTextWidth

expression Required. A variable that represents a Range object.

Example

This example fits the current selection into a space five centimeters wide.

VBA Copy code Copy code
Selection.FitTextWidth = CentimetersToPoints(5)

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Font Property (Word)

 Copy code hover
[image]

Range.Font Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Font object that represents the character formatting of the specified object. Read/write Font.

Syntax

expression .Font

expression A variable that represents a Range object.

Remarks

To set this property, specify an expression that returns a Font object.

Example

This example removes bold formatting from the Heading 1 style in the active document.

VBA Copy code Copy code
ActiveDocument.Styles(wdStyleHeading1).Font.Bold = False

This example switches the font of the second paragraph in the active document between Arial and Times New Roman.

VBA Copy code Copy code
Set myRange = ActiveDocument.Paragraphs(2).Range
If myRange.Font.Name = "Times New Roman" Then
 myRange.Font.Name = "Arial"
Else
 myRange.Font.Name = "Times New Roman"
End If

See also

Concepts

Range Object

Other resources

Range Object Members


Range.FootnoteOptions Property (Word)

 Copy code hover
[image]

Range.FootnoteOptions Property (Word)
See also Send feedback

Published: July 16, 2012

Returns FootnoteOptions object that represents the footnotes in a selection or range.

Syntax

expression .FootnoteOptions

expression Required. A variable that represents a Range object.

Example

This example sets the numbering rule in section two to restart at the beginning of the new section.

VBA Copy code Copy code
Sub SetFootnoteOptionsRange()
 ActiveDocument.Sections(2).Range.FootnoteOptions _
 .NumberingRule = wdRestartSection
End Sub

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Footnotes Property (Word)

 Copy code hover
[image]

Range.Footnotes Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Footnotes collection that represents all the footnotes in a range. Read-only.

Syntax

expression .Footnotes

expression A variable that represents a Range object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

See also

Concepts

Range Object

Other resources

Range Object Members


Range.FormattedText Property (Word)

 Copy code hover
[image]

Range.FormattedText Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Range object that includes the formatted text in the specified range or selection. Read/write.

Syntax

expression .FormattedText

expression A variable that represents a Range object.

Remarks

This property returns a Range object with the character formatting and text from the specified range or selection. Paragraph formatting is included in the Range object if there is a paragraph mark in the range or selection.

When you set this property, the text in the range is replaced with formatted text. If you do not want to replace the existing text, use the Collapse method before using this property (see the first example).

See also

Concepts

Range Object

Other resources

Range Object Members


Range.FormFields Property (Word)

 Copy code hover
[image]

Range.FormFields Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a FormFields collection that represents all the form fields in the range. Read-only.

Syntax

expression .FormFields

expression A variable that represents a Range object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example retrieves the type of the first form field in section two.

VBA Copy code Copy code
myType = ActiveDocument.Sections(2).Range.FormFields(1).Type
Select Case myType
 Case wdFieldFormTextInput
 thetype = "TextBox"
 Case wdFieldFormDropDown
 thetype = "DropDown"
 Case wdFieldFormCheckBox
 thetype = "CheckBox"
End Select

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Frames Property (Word)

 Copy code hover
[image]

Range.Frames Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Frames collection that represents all the frames in a range. Read-only.

Syntax

expression .Frames

expression A variable that represents a Range object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example causes text to wrap around frames in the first section in the active document.

VBA Copy code Copy code
For Each aFrame In ActiveDocument.Sections(1).Range.Frames
 aFrame.TextWrap = True
Next aFrame

See also

Concepts

Range Object

Other resources

Range Object Members


Range.GrammarChecked Property (Word)

 Copy code hover
[image]

Range.GrammarChecked Property (Word)
See also Send feedback

Published: July 16, 2012

True if a grammar check has been run on the specified range or document. Read/write Boolean.

Syntax

expression .GrammarChecked

expression A variable that represents a Range object.

Remarks

False if some or all of the specified range or document has not been checked for grammar. To recheck the grammar in a range or document, set the GrammarChecked property to False.

See also

Concepts

Range Object

Other resources

Range Object Members


Range.GrammaticalErrors Property (Word)

 Copy code hover
[image]

Range.GrammaticalErrors Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a ProofreadingErrors collection that represents the sentences that failed the grammar check on the specified document or range. Read-only.

Syntax

expression .GrammaticalErrors

expression A variable that represents a Range object.

Remarks

There can be more than one error per sentence. If there are no grammatical errors, the Count property for the ProofreadingErrors object returned by the GrammaticalErrors property returns 0 (zero).

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example checks the third paragraph in the active document for grammatical errors and displays each sentence that contains one or more errors.

VBA Copy code Copy code
Set myErrors = ActiveDocument.Paragraphs(3).Range.GrammaticalErrors
For Each myerr In myErrors
 MsgBox myerr.Text
Next myerr

See also

Concepts

Range Object

Other resources

Range Object Members


Range.HighlightColorIndex Property (Word)

 Copy code hover
[image]

Range.HighlightColorIndex Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the highlight color for the specified range. Read/write WdColorIndex.

Syntax

expression .HighlightColorIndex

expression Required. A variable that represents a Range object.

Example

This example removes highlight formatting from the selection.

VBA Copy code Copy code
Selection.Range.HighlightColorIndex = wdNoHighlight

This example applies yellow highlighting to each bookmark in the active document.

VBA Copy code Copy code
For Each abookmark In ActiveDocument.Bookmarks
 abookmark.Range.HighlightColorIndex = wdYellow
Next abookmark

See also

Concepts

Range Object

Other resources

Range Object Members


Range.HorizontalInVertical Property (Word)

 Copy code hover
[image]

Range.HorizontalInVertical Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the formatting for horizontal text set within vertical text. Read/write WdHorizontalInVerticalType.

Syntax

expression .HorizontalInVertical

expression Required. A variable that represents a Range object.

Example

This example formats the current selection as horizontal text within a run of vertical text, fitting the text to the line width of the vertical text.

VBA Copy code Copy code
Selection.Range.HorizontalInVertical = wdHorizontalInVerticalFitInLine

See also

Concepts

Range Object

Other resources

Range Object Members


Range.HTMLDivisions Property (Word)

 Copy code hover
[image]

Range.HTMLDivisions Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an HTMLDivisions object that represents an HTML division in a Web document.

Syntax

expression .HTMLDivisions

expression Required. A variable that represents a Range object.

Example

This example formats three nested divisions in the active document. This example assumes that the active document is an HTML document with at least three divisions.

VBA Copy code Copy code
Sub FormatHTMLDivisions()
 With ActiveDocument.Range.HTMLDivisions(1)
 With .Borders(wdBorderLeft)
 .Color = wdColorRed
 .LineStyle = wdLineStyleSingle
 End With
 With .Borders(wdBorderRight)
 .Color = wdColorRed
 .LineStyle = wdLineStyleSingle
 End With
 With .HTMLDivisions(1)
 .LeftIndent = InchesToPoints(1)
 .RightIndent = InchesToPoints(1)
 With .Borders(wdBorderTop)
 .Color = wdColorBlue
 .LineStyle = wdLineStyleDouble
 End With
 With .Borders(wdBorderBottom)
 .Color = wdColorBlue
 .LineStyle = wdLineStyleDouble
 End With
 With .HTMLDivisions(1)
 .LeftIndent = InchesToPoints(1)
 .RightIndent = InchesToPoints(1)
 With .Borders(wdBorderLeft)
 .LineStyle = wdLineStyleDot
 End With
 With .Borders(wdBorderRight)
 .LineStyle = wdLineStyleDot
 End With
 With .Borders(wdBorderTop)
 .LineStyle = wdLineStyleDot
 End With
 With .Borders(wdBorderBottom)
 .LineStyle = wdLineStyleDot
 End With
 End With
 End With
 End With

End Sub

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Hyperlinks Property (Word)

 Copy code hover
[image]

Range.Hyperlinks Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Hyperlinks collection that represents all the hyperlinks in the specified range. Read-only.

Syntax

expression .Hyperlinks

expression A variable that represents a Range object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example displays the name of every hyperlink in the first ten paragraphs in the active document.

VBA Copy code Copy code
Dim objLink As Hyperlink
Dim objRange As Range

Set objRange = ActiveDocument.Range( _
 Paragraphs(1).Range.Start, _
 Paragraphs(10).Range.End)

For Each objLink In objRange.Hyperlinks
 If InStr(LCase(objLink.Address), "microsoft") <> 0 Then
 MsgBox objLink.Name
 End If
Next objLink

See also

Concepts

Range Object

Other resources

Range Object Members


Range.ID Property (Word)

 Copy code hover
[image]

Range.ID Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the identification name for the specified range. Read/write String.

Syntax

expression .ID

expression Required. A variable that represents a Range object.

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Information Property (Word)

 Copy code hover
[image]

Range.Information Property (Word)
See also Send feedback

Published: July 16, 2012

Returns information about the specified range. Read-only Variant.

Syntax

expression .Information(Type)

expression Required. A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
Type | Required | WdInformation | The information type.

Example

If the tenth word is in a table, this example selects the table.

VBA Copy code Copy code
If ActiveDocument.Words(10).Information(wdWithInTable) Then _
 ActiveDocument.Words(10).Tables(1).Select

See also

Concepts

Range Object

Other resources

Range Object Members


Range.InlineShapes Property (Word)

 Copy code hover
[image]

Range.InlineShapes Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an InlineShapes collection that represents all the InlineShape objects in a range. Read-only.

Syntax

expression .InlineShapes

expression A variable that represents a Range object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example displays the number of shapes and inline shapes in the active document.

VBA Copy code Copy code
Set doc = ActiveDocument
Msgbox "InlineShape = " & doc.InlineShapes.Count & _
 vbCr & "Shapes = " & doc.Shapes.Count

See also

Concepts

Range Object

Other resources

Range Object Members


Range.IsEndOfRowMark Property (Word)

 Copy code hover
[image]

Range.IsEndOfRowMark Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified range is collapsed and is located at the end-of-row mark in a table. Read-only Boolean.

Syntax

expression .IsEndOfRowMark

expression A variable that represents a Range object.

Remarks

This property is the equivalent of the following expression:

VBA Copy code Copy code
ActiveDocument.Range.Information(wdAtEndOfRowMarker)

Example

This example collapses the selection and selects the current row if the insertion point is at the end of the row (just before the end-of-row mark).

VBA Copy code Copy code
ActiveDocument.Range.Collapse Direction:=wdCollapseEnd
If ActiveDocument.Range.IsEndOfRowMark = True Then
 ActiveDocument.Range.Rows(1).Select
End If

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Italic Property (Word)

 Copy code hover
[image]

Range.Italic Property (Word)
See also Send feedback

Published: July 16, 2012

True if the font or range is formatted as italic. Read/write Long.

Syntax

expression .Italic

expression A variable that represents a Range object.

Remarks

This property returns True, False or wdUndefined (a mixture of True and False) and can be set to True, False, or wdToggle.

Example

This example formats the first word in the active document as italic.

VBA Copy code Copy code
ActiveDocument.Words(1).Italic = True

See also

Concepts

Range Object

Other resources

Range Object Members


Range.ItalicBi Property (Word)

 Copy code hover
[image]

Range.ItalicBi Property (Word)
See also Send feedback

Published: July 16, 2012

True if the font or range is formatted as italic. Read/write Long.

Syntax

expression .ItalicBi

expression Required. A variable that represents a Range object.

Remarks

This property returns True, False or wdUndefined (for a mixture of italic and non-italic text). Can be set to True, False, or wdToggle.

Note Note

The ItalicBi property applies to text in right-to-left languages.

Example

This example italicizes the first paragraph in the active right-to-left language document.

VBA Copy code Copy code
ActiveDocument.Paragraphs(1).Range.ItalicBi = True

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Kana Property (Word)

 Copy code hover
[image]

Range.Kana Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets whether the specified range of Japanese language text is hiragana or katakana. Read/write WdKana.

Syntax

expression .Kana

expression Required. A variable that represents a Range object.

Remarks

This property returns wdUndefined if the range contains a mix of hiragana and katakana or if the range contains some non-Japanese text. If you set the Kana property to wdUndefined, an error occurs.

Example

This example displays what type of Japanese text the current selection contains.

VBA Copy code Copy code
Select Case Selection.Range.Kana
 Case wdKanaHiragana
 MsgBox "This text is hiragana."
 Case wdKanaKatakana
 MsgBox "This text is katakana."
 Case wdUndefined
 MsgBox "This text is a mix of " _
 & "hiragana and katakana."
End Select

See also

Concepts

Range Object

Other resources

Range Object Members


Range.LanguageDetected Property (Word)

 Copy code hover
[image]

Range.LanguageDetected Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a value that specifies whether Microsoft Word has detected the language of the specified text. Read/write Boolean.

Syntax

expression .LanguageDetected

expression Required. A variable that represents a Document object.

Remarks

Check the LanguageID property for the results of any previous language detection.

The LanguageDetected property is set to True when the DetectLanguage method is called. To reevaluate the language of the specified text, you must first set the LanguageDetected property to False.

Example

This example checks the active document to determine the language it's written in and then displays the result.

VBA Copy code Copy code
With ActiveDocument.Range
 If .LanguageDetected = True Then
 x = MsgBox("This document has already " _
 & "been checked. Do you want to check " _
 & "it again?", vbYesNo)
 If x = vbYes Then
 .LanguageDetected = False
 .DetectLanguage
 End If
 Else
 .DetectLanguage
 End If
 If .Range.LanguageID = wdEnglishUS Then
 MsgBox "This is a U.S. English document."
 Else
 MsgBox "This is not a U.S. English document."
 End If
End With

See also

Concepts

Range Object

Other resources

Range Object Members


Range.LanguageID Property (Word)

 Copy code hover
[image]

Range.LanguageID Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a WdLanguageID constant that represents the language for the specified range. Read/write.

Syntax

expression .LanguageID

expression An expression that represents a Range object.

Remarks

Some of the WdLanguageID constants may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.

Example

This example formats the second paragraph in the active document as French and then adds a new custom dictionary that will be used on the French text.

VBA Copy code Copy code
ActiveDocument.Paragraphs(2).Range.LanguageID = wdFrench
Set myDictionary = CustomDictionaries.Add(Filename:="French.dic")
With myDictionary
 .LanguageSpecific = True
 .LanguageID = wdFrench
End With

See also

Concepts

Range Object

Other resources

Range Object Members


Range.LanguageIDFarEast Property (Word)

 Copy code hover
[image]

Range.LanguageIDFarEast Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets an East Asian language for the specified object. Read/write WdLanguageID.

Syntax

expression .LanguageIDFarEast

expression Required. A variable that represents a Range object.

Example

This example sets the language of the first paragraph in the active document to Korean.

VBA Copy code Copy code
ActiveDocument.Paragraphs(1).Range.LanguageIDFarEast = wdKorean

See also

Concepts

Range Object

Other resources

Range Object Members


Range.LanguageIDOther Property (Word)

 Copy code hover
[image]

Range.LanguageIDOther Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the language for the specified range. Read/write WdLanguageID.

Syntax

expression .LanguageIDOther

expression Required. A variable that represents a Range object.

Example

This example sets the language of the selection to French.

VBA Copy code Copy code
Selection.Range.LanguageIDOther = wdFrench

See also

Concepts

Range Object

Other resources

Range Object Members


Range.ListFormat Property (Word)

 Copy code hover
[image]

Range.ListFormat Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a ListFormat object that represents all the list formatting characteristics of a range. Read-only.

Syntax

expression .ListFormat

expression A variable that represents a Range object.

Example

This example sets the variable myDoc to a range that includes paragraphs three through six of the active document. The example then either applies the default outline-numbered list format to the range or removes it, depending on whether or not the format was already applied to the range.

VBA Copy code Copy code
Set myDoc = ActiveDocument
Set myRange = _
 myDoc.Range(Start:= myDoc.Paragraphs(3).Range.Start, _
 End:=myDoc.Paragraphs(6).Range.End)
myRange.ListFormat.ApplyOutlineNumberDefault

This example applies the second list template on the Numbered tab in the Bullets and Numbering dialog box to all the paragraphs in the selection.

VBA Copy code Copy code
Selection.Range.ListFormat.ApplyListTemplate _
 ListTemplate:=ListGalleries(wdNumberGallery).ListTemplates(2)

See also

Concepts

Range Object

Other resources

Range Object Members


Range.ListParagraphs Property (Word)

 Copy code hover
[image]

Range.ListParagraphs Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a ListParagraphs collection that represents all the numbered paragraphs in the range. Read-only.

Syntax

expression .ListParagraphs

expression A variable that represents a Range object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

See also

Concepts

Range Object

Other resources

Range Object Members


Range.ListStyle Property (Word)

 Copy code hover
[image]

Range.ListStyle Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Variant that represents the style used to format a bulleted list or numbered list. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .ListStyle

expression An expression that returns a Range object.

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Locks Property (Word)

 Copy code hover
[image]

Range.Locks Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a CoAuthLocks collection object that represents all the locks in the range. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .Locks

expression An expression that returns a Range object.

Remarks

Use the Locks property to return the CoAuthLocks collection.

Note Note

This property is only available for co-authoring enabled documents. If you attempt to access this property on a document that is not enabled for co-authoring, you will receive a run-time error.

Example

The following code example displays the number of locks in the first paragraph of the active document.

VBA Copy code Copy code
MsgBox ActiveDocument.Paragraphs(1).Range.Locks.Count

See also

Concepts

Range Object

Other resources

Range Object Members


Range.NextStoryRange Property (Word)

 Copy code hover
[image]

Range.NextStoryRange Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Range object that refers to the next story. Read-only Range.

Syntax

expression .NextStoryRange

expression Required. A variable that represents a Range object.

Remarks

The following table describes the range returned depending on the type of story.

Story type | Item returned by the NextStoryRange method
wdMainTextStory, wdFootnotesStory, wdEndnotesStory, and wdCommentsStory | Always returns Nothing
wdTextFrameStory | The story of the next set of linked text boxes
wdEvenPagesHeaderStory, wdPrimaryHeaderStory, wdEvenPagesFooterStory, wdPrimaryFooterStory, wdFirstPageHeaderStory, wdFirstPageFooterStory | The next section's story of the same type

See also

Concepts

Range Object

Other resources

Range Object Members


Range.NoProofing Property (Word)

 Copy code hover
[image]

Range.NoProofing Property (Word)
See also Send feedback

Published: July 16, 2012

True if the spelling and grammar checker ignores the specified text. Read/write Long.

Syntax

expression .NoProofing

expression A variable that represents a Range object.

Remarks

This property returns wdUndefined if the NoProofing property is set to True for only some of the specified text.

Example

This example marks the current selection to be ignored by the spelling and grammar checker.

VBA Copy code Copy code
Selection.Range.NoProofing = True

See also

Concepts

Range Object

Other resources

Range Object Members


Range.OMaths Property (Word)

 Copy code hover
[image]

Range.OMaths Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMaths collection that represents the OMath objects within the specified range. Read-only.

Syntax

expression .OMaths

expression An expression that returns a Range object.

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Orientation Property (Word)

 Copy code hover
[image]

Range.Orientation Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the orientation of text in a range when the Text Direction feature is enabled. Read/write WdTextOrientation.

Syntax

expression .Orientation

expression Required. A variable that represents a Range object.

Remarks

Some of the WdTextOrientation constants may not be available to you, depending on the language support (U.S. English, for example) that you have selected or installed.

You can set the orientation for a text frame or for a range that happens to occur inside a text frame. For information about the difference between a text frame and a text box, see the TextFrame object.

See also

Concepts

Range Object

Other resources

Range Object Members


Range.PageSetup Property (Word)

 Copy code hover
[image]

Range.PageSetup Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a PageSetup object that's associated with the specified range.

Syntax

expression .PageSetup

expression A variable that represents a Range object.

See also

Concepts

Range Object

Other resources

Range Object Members


Range.ParagraphFormat Property (Word)

 Copy code hover
[image]

Range.ParagraphFormat Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a ParagraphFormat object that represents the paragraph settings for the specified range. Read/write.

Syntax

expression .ParagraphFormat

expression A variable that represents a Range object.

Example

This example sets paragraph formatting for a range that includes the entire contents of MyDoc.doc. Paragraphs in this document are double-spaced and have a custom tab stop at 0.25 inch.

VBA Copy code Copy code
Set myRange = Documents("MyDoc.doc").Content
With myRange.ParagraphFormat
 .Space2
 .TabStops.Add Position:=InchesToPoints(.25)
End With

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Paragraphs Property (Word)

 Copy code hover
[image]

Range.Paragraphs Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Paragraphs collection that represents all the paragraphs in the specified range. Read-only.

Syntax

expression .Paragraphs

expression A variable that represents a Range object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example sets the line spacing to single for the collection of all paragraphs in section one in the active document.

VBA Copy code Copy code
ActiveDocument.Sections(1).Range.Paragraphs.LineSpacingRule = _
 wdLineSpaceSingle

See also

Concepts

Range Object

Other resources

Range Object Members


Range.ParagraphStyle Property (Word)

 Copy code hover
[image]

Range.ParagraphStyle Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Variant that represents the style used to format a paragraph. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .ParagraphStyle

expression An expression that returns a Range object.

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Parent Property (Word)

 Copy code hover
[image]

Range.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Range object.

Syntax

expression .Parent

expression Required. A variable that represents a Range object.

See also

Concepts

Range Object

Other resources

Range Object Members


Range.ParentContentControl Property (Word)

 Copy code hover
[image]

Range.ParentContentControl Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a ContentControl object that represents the parent content control for the specified range. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .ParentContentControl

expression An expression that returns a Range object.

Remarks

This property returns Nothing if there is no parent content control for the specified range.

See also

Concepts

Range Object

Other resources

Range Object Members


Range.PreviousBookmarkID Property (Word)

 Copy code hover
[image]

Range.PreviousBookmarkID Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the number of the last bookmark that starts before or at the same place as the specified range. Read-only Long.

Syntax

expression .PreviousBookmarkID

expression A variable that represents a Range object.

Remarks

This property returns 0 (zero) if there is no corresponding bookmark

Example

This example displays the name of the bookmark that precedes the second paragraph.

VBA Copy code Copy code
num = ActiveDocument.Paragraphs(2).Range.PreviousBookmarkID
If num <> 0 Then MsgBox ActiveDocument.Content.Bookmarks(num).Name

See also

Concepts

Range Object

Other resources

Range Object Members


Range.ReadabilityStatistics Property (Word)

 Copy code hover
[image]

Range.ReadabilityStatistics Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a ReadabilityStatistics collection that represents the readability statistics for the specified document or range. Read-only.

Syntax

expression .ReadabilityStatistics

expression A variable that represents a Range object.

Remarks

For information about returning a single member of a collection, see Returning a Single Object from a Collection.

Example

This example displays each readability statistic, along with its value, for document one.

VBA Copy code Copy code
For Each rs In Documents(1).ReadabilityStatistics
 Msgbox rs.Name & " - " & rs.Value
Next rs

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Revisions Property (Word)

 Copy code hover
[image]

Range.Revisions Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Revisions collection that represents the tracked changes in the range. Read-only.

Syntax

expression .Revisions

expression A variable that represents a Range object.

Remarks

For information about returning a single member of a collection, see Returning a Single Object from a Collection.

Example

This example displays the number of tracked changes in the first section in the active document.

VBA Copy code Copy code
MsgBox ActiveDocument.Sections(1).Range.Revisions.Count

This example accepts all tracked changes in the first paragraph in the selection.

VBA Copy code Copy code
Set myRange = Selection.Paragraphs(1).Range
myRange.Revisions.AcceptAll

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Rows Property (Word)

 Copy code hover
[image]

Range.Rows Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Rows collection that represents all the table rows in a range. Read-only.

Syntax

expression .Rows

expression A variable that represents a Range object.

Remarks

For information about returning a single member of a collection, see Returning a Single Object from a Collection.

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Scripts Property (Word)

 Copy code hover
[image]

Range.Scripts Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Scripts collection that represents the collection of HTML scripts in the specified object.

Syntax

expression .Scripts

expression Required. A variable that represents a Range object.

Example

This example tests the second Script object in the specified range to determine its language.

VBA Copy code Copy code
Select Case Selection.Range.Scripts(2).Language
 Case msoScriptLanguageASP
 MsgBox "Active Server Pages"
 Case msoScriptLanguageVisualBasic
 MsgBox "VBScript"
 Case msoScriptLanguageJava
 MsgBox "JavaScript"
 Case msoScriptLanguageOther
 MsgBox "Unknown type of script"
End Select

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Sections Property (Word)

 Copy code hover
[image]

Range.Sections Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Sections collection that represents the sections in the specified range. Read-only.

Syntax

expression .Sections

expression A variable that represents a Range object.

Remarks

For information about returning a single member of a collection, see Returning a Single Object from a Collection.

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Sentences Property (Word)

 Copy code hover
[image]

Range.Sentences Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Sentences collection that represents all the sentences in the range. Read-only.

Syntax

expression .Sentences

expression A variable that represents a Range object.

Remarks

For information about returning a single member of a collection, see Returning a Single Object from a Collection.

Example

This example displays the number of sentences in the first paragraph in the active document.

VBA Copy code Copy code
MsgBox ActiveDocument.Paragraphs(1).Range _
 .Sentences.Count & " sentences"

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Shading Property (Word)

 Copy code hover
[image]

Range.Shading Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Shading object that refers to the shading formatting for the specified object.

Syntax

expression .Shading

expression Required. A variable that represents a Range object.

Example

This example applies yellow shading to the first paragraph in the selection.

VBA Copy code Copy code
With Selection.Paragraphs(1).Shading
 .Texture = wdTexture12Pt5Percent
 .BackgroundPatternColorIndex = wdYellow
 .ForegroundPatternColorIndex = wdBlack
End With

This example applies 10 percent shading to the first word in the active document.

VBA Copy code Copy code
ActiveDocument.Words(1).Shading.Texture = wdTexture10Percent

See also

Concepts

Range Object

Other resources

Range Object Members


Range.ShapeRange Property (Word)

 Copy code hover
[image]

Range.ShapeRange Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a ShapeRange collection that represents all the Shape objects in the specified range. Read-only.

Syntax

expression .ShapeRange

expression A variable that represents a Range object.

Remarks

A shape range can contain drawings, shapes, pictures, OLE objects, ActiveX controls, text objects, and callouts.

Example

The following example sets the fill foreground color to purple for all the shapes in the active document.

VBA Copy code Copy code
ActiveDocument.Content.ShapeRange.Fill.ForeColor.RGB = _
 RGB(255, 0, 255)

See also

Concepts

Range Object

Other resources

Range Object Members


Range.ShowAll Property (Word)

 Copy code hover
[image]

Range.ShowAll Property (Word)
See also Send feedback

Published: July 16, 2012

True if all nonprinting characters (such as hidden text, tab marks, space marks, and paragraph marks) are displayed. Read/write Boolean.

Syntax

expression .ShowAll

expression Required. A variable that represents a Range object.

Remarks

This property only affects the specified range when Show Markup is set to Show Revisions in Balloons. When Range.ShowAll is set to False, Range.Text provides all of the text in the range except deleted text. If you set Range.ShowAll to True, then Range.Text provides all of the text in the range including the text that was deleted.

Example

The following example displays all the text in the specified range, excluding deleted text.

Note Note

This example assumes that the active document has change tracking enabled, that Show Markup is set to Show Revisions in Balloons, and that some text has been deleted from the document.

VBA Copy code Copy code
Sub HideDeletedText()
Dim r As Range

Set r = ActiveDocument.Range
r.ShowAll = False
Debug.Print r.Text

End Sub

See also

Concepts

Range Object

Other resources

Range Object Members


Range.SpellingChecked Property (Word)

 Copy code hover
[image]

Range.SpellingChecked Property (Word)
See also Send feedback

Published: July 16, 2012

True if spelling has been checked throughout the specified range or document. False if all or some of the range or document has not been checked for spelling. Read/write Boolean.

Syntax

expression .SpellingChecked

expression A variable that represents a Range object.

Remarks

To recheck the spelling in a range or document, set the SpellingChecked property to False.

To see whether the range or document contains spelling errors, use the SpellingErrors property.

Example

This example determines whether spelling in section one of the active document has been checked. If spelling has not been checked, the example starts a spelling check.

VBA Copy code Copy code
Set myRange = ActiveDocument.Sections(1).Range
isChecked = myRange.SpellingChecked
If isChecked = False Then
 myRange.CheckSpelling
Else
 MsgBox "Spelling has already been checked in the range."
End If

See also

Concepts

Range Object

Other resources

Range Object Members


Range.SpellingErrors Property (Word)

 Copy code hover
[image]

Range.SpellingErrors Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a ProofreadingErrors collection that represents the words identified as spelling errors in the specified range. Read-only.

Syntax

expression .SpellingErrors

expression A variable that represents a Range object.

Remarks

For information about returning a single member of a collection, see Returning a Single Object from a Collection.

Example

This example checks the specified range for spelling errors and displays each error found.

VBA Copy code Copy code
Set myErrors = ActiveDocument.Paragraphs(3).Range.SpellingErrors
If myErrors.Count = 0 Then
 Msgbox "No spelling errors found."
Else
 For Each myErr in myErrors
 Msgbox myErr.Text
 Next
End If

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Start Property (Word)

 Copy code hover
[image]

Range.Start Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the starting character position of a range. Read/write Long.

Syntax

expression .Start

expression A variable that represents a Range object.

Remarks

Range objects have starting and ending character positions. The starting position refers to the character position closest to the beginning of the story. If this property is set to a value larger than that of the End property, the End property is set to the same value as that of Start property.

This property returns the starting character position relative to the beginning of the story. The main text story (wdMainTextStory) begins with character position 0 (zero). You can change the size of a selection, range, or bookmark by setting this property.

Example

This example returns the starting position of the second paragraph and the ending position of the fourth paragraph in the active document. The character positions are used to create the range myRange.

VBA Copy code Copy code
pos = ActiveDocument.Paragraphs(2).Range.Start
pos2 = ActiveDocument.Paragraphs(4).Range.End
Set myRange = ActiveDocument.Range(Start:=pos, End:=pos2)

This example moves the starting position of myRange one character to the right (this reduces the size of the range by one character).

VBA Copy code Copy code
Set myRange = Selection.Range
myRange.SetRange Start:=myRange.Start + 1, End:=myRange.End

See also

Concepts

Range Object

Other resources

Range Object Members


Range.StoryLength Property (Word)

 Copy code hover
[image]

Range.StoryLength Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the number of characters in the story that contains the specified range. Read-only Long.

Syntax

expression .StoryLength

expression A variable that represents a Range object.

Example

This example determines whether the header in the active document is empty. If the header story is not empty, a message box displays the contents of the header. If the document header is empty, StoryLength returns 1 for the final paragraph mark.

VBA Copy code Copy code
Set myRange = ActiveDocument.Sections(1) _
 .Headers(wdHeaderFooterPrimary).Range
If myRange.StoryLength > 1 Then MsgBox myRange.Text

This example closes the document without saving changes, if it is empty.

VBA Copy code Copy code
If ActiveDocument.Content.StoryLength = 1 Then _
 ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges

See also

Concepts

Range Object

Other resources

Range Object Members


Range.StoryType Property (Word)

 Copy code hover
[image]

Range.StoryType Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the story type for the specified range, selection, or bookmark. Read-only WdStoryType.

Syntax

expression .StoryType

expression Required. A variable that represents a Range object.

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Style Property (Word)

 Copy code hover
[image]

Range.Style Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the style for the specified object. Read/write Variant.

Syntax

expression .Style

expression Required. A variable that represents a Range object.

Remarks

To set this property, specify the local name of the style, an integer, a WdBuiltinStyle constant, or an object that represents the style. When you return the style for a range that includes more than one style, only the first character or paragraph style is returned.

Example

This example displays the style for each character in the selection.

Note Note

Each element of the Characters collection is a Range object.

VBA Copy code Copy code
For each c in Selection.Characters
 MsgBox c.Style
Next c

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Subdocuments Property (Word)

 Copy code hover
[image]

Range.Subdocuments Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Subdocuments collection that represents all the subdocuments in the specified range or document. Read-only.

Syntax

expression .Subdocuments

expression A variable that represents a Range object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example displays the number of subdocuments embedded in the active document.

VBA Copy code Copy code
MsgBox ActiveDocument.Range.Subdocuments.Count

See also

Concepts

Range Object

Other resources

Range Object Members


Range.SynonymInfo Property (Word)

 Copy code hover
[image]

Range.SynonymInfo Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a SynonymInfo object that contains information from the thesaurus on synonyms, antonyms, or related words and expressions for the contents of a range.

Syntax

expression .SynonymInfo

expression Required. A variable that represents a Range object.

Example

This example returns a list of synonyms for the selection's first meaning.

VBA Copy code Copy code
Slist = Selection.Range.SynonymInfo.SynonymList(Meaning:=1)
For i = 1 To UBound(Slist)
 Msgbox Slist(i)
Next i

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Tables Property (Word)

 Copy code hover
[image]

Range.Tables Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Tables collection that represents all the tables in the specified range. Read-only.

Syntax

expression .Tables

expression A variable that represents a Range object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example creates a 5x5 table in the active document and then applies a predefined format to it.

VBA Copy code Copy code
Selection.Collapse Direction:=wdCollapseStart
Set myTable = ActiveDocument.Tables.Add(Range:=Selection.Range, _
NumRows:=5, NumColumns:=5)
myTable.AutoFormat Format:=wdTableFormatClassic2

This example inserts numbers and text into the first column of the first table in the active document.

VBA Copy code Copy code
num = 90
For Each acell In ActiveDocument.Tables(1).Columns(1).Cells
 acell.Range.Text = num & " Sales"
 num = num + 1
Next acell

See also

Concepts

Range Object

Other resources

Range Object Members


Range.TableStyle Property (Word)

 Copy code hover
[image]

Range.TableStyle Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Variant that represents the style used to format a table. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .TableStyle

expression An expression that returns a Range object.

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Text Property (Word)

 Copy code hover
[image]

Range.Text Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the text in the specified range or selection. Read/write String. Read/write String.

Syntax

expression .Text

expression A variable that represents a Range object.

Remarks

The Text property returns the plain, unformatted text of the range. When you set this property, the existing text in the range is replaced.

Example

This example replaces the first word in the active document with "Dear."

VBA Copy code Copy code
Set myRange = ActiveDocument.Words(1)
myRange.Text = "Dear "

See also

Concepts

Range Object

Other resources

Range Object Members


Range.TextRetrievalMode Property (Word)

 Copy code hover
[image]

Range.TextRetrievalMode Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a TextRetrievalMode object that controls how text is retrieved from the specified Range. Read/write.

Syntax

expression .TextRetrievalMode

expression A variable that represents a Range object.

Example

This example retrieves the selected text (excluding any hidden text) and inserts it at the beginning of the third paragraph in the active document.

VBA Copy code Copy code
If Selection.Type = wdSelectionNormal Then
 Set Range1 = Selection.Range
 Range1.TextRetrievalMode.IncludeHiddenText = False
 Set Range2 = ActiveDocument.Paragraphs(2).Range
 Range2.InsertAfter Range1.Text
End If

This example retrieves and displays the first three paragraphs as they appear in outline view.

VBA Copy code Copy code
Set myRange = ActiveDocument.Range(Start:=ActiveDocument _
 .Paragraphs(1).Range.Start, _
 End:=ActiveDocument.Paragraphs(3).Range.End)
myRange.TextRetrievalMode.ViewType = wdOutlineView
MsgBox myRange.Text

This example excludes field codes and hidden text from the range that refers to the selected text. The example then displays the text in a message box.

VBA Copy code Copy code
If Selection.Type = wdSelectionNormal Then
 Set aRange = Selection.Range
 With aRange.TextRetrievalMode
 .IncludeHiddenText = False
 .IncludeFieldCodes = False
 End With
 MsgBox aRange.Text
End If

See also

Concepts

Range Object

Other resources

Range Object Members


Range.TextVisibleOnScreen Property (Word)

 Copy code hover
[image]

Range.TextVisibleOnScreen Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that indicates whether the text in the specified range is visible on the screen. Read-only.

Version information

Version Added: Word 2013

Syntax

expression .TextVisibleOnScreen

expression A variable that represents a Range object.

Remarks

The TextVisibleOnScreen property returns 1 if all text in the range is visible; it returns 0 if no text in the range is visible; and it returns -1 if some text in the range is visible and some is not. Text that is not visible could be, for example, text that is in a collapsed heading.

Property value

INT32

See also

Concepts

Range Object

Other resources

Range Members


Range.TopLevelTables Property (Word)

 Copy code hover
[image]

Range.TopLevelTables Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Tables collection that represents the tables at the outermost nesting level in the current range. Read-only.

Syntax

expression .TopLevelTables

expression A variable that represents a Range object.

Remarks

This method returns a collection containing only those tables at the outermost nesting level within the context of the current range. These tables may not be at the outermost nesting level within the entire set of nested tables.

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example creates a new document, creates a nested table with three levels, and then fills the first cell of each table with its nesting level. The example selects the second column of the second-level table and then selects the first of the top-level tables in this selection. The innermost table is selected, even though it isn't a top-level table within the context of the entire set of nested tables.

VBA Copy code Copy code
Documents.Add
ActiveDocument.Tables.Add Selection.Range, _
 3, 3, wdWord9TableBehavior, wdAutoFitContent
With ActiveDocument.Tables(1).Range
 .Copy
 .Cells(1).Range.Text = .Cells(1).NestingLevel
 .Cells(5).Range.PasteAsNestedTable
 With .Cells(5).Tables(1).Range
 .Cells(1).Range.Text = .Cells(1).NestingLevel
 .Cells(5).Range.PasteAsNestedTable
 With .Cells(5).Tables(1).Range
 .Cells(1).Range.Text = _
 .Cells(1).NestingLevel
 End With
 .Columns(2).Select
 Selection.Range.TopLevelTables(1).Select
 End With
End With

See also

Concepts

Range Object

Other resources

Range Object Members


Range.TwoLinesInOne Property (Word)

 Copy code hover
[image]

Range.TwoLinesInOne Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets whether Microsoft Word sets two lines of text in one and specifies the characters that enclose the text, if any. Read/write WdTwoLinesInOneType.

Syntax

expression .TwoLinesInOne

expression Required. A variable that represents a Range object.

Remarks

Setting the TwoLinesInOne property to wdTwoLinesInOneNoBrackets sets two lines of text in one without enclosing the text in any characters. Setting the TwoLinesInOne property to wdTwoLinesInOneNone restores a line of combined text to two separate lines.

Example

This example formats the current selection as two lines of text in one, enclosed in parentheses.

VBA Copy code Copy code
Selection.Range.TwoLinesInOne = _
 wdTwoLinesInOneParentheses

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Underline Property (Word)

 Copy code hover
[image]

Range.Underline Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the type of underline applied to a range. Read/write WdUnderline.

Syntax

expression .Underline

expression Required. A variable that represents a Range object.

Example

This example applies a double underline to the fourth word in the active document.

VBA Copy code Copy code
ActiveDocument.Words(4).Underline = wdUnderlineDouble

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Updates Property (Word)

 Copy code hover
[image]

Range.Updates Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a CoAuthUpdates collection object that represents all updates that were merged into the specified range at the last explicit save. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .Updates

expression An expression that returns a Range object.

Remarks

Use the Updates property to return the CoAuthUpdates collection.

Note Note

This property is only available for co-authoring enabled documents. If you attempt to access this property on a document that is not enabled for co-authoring, you will receive a run-time error.

Example

The following code example displays the number of updates that were merged into the first paragraph of the active document at the last explicit save.

VBA Copy code Copy code
Dim countOfUpdates As Integer

countOfUpdates = ActiveDocument.Paragraphs(1).Range.Updates.Count

MsgBox "The number of updates is " & countOfUpdates

See also

Concepts

Range Object

Other resources

Range Object Members


Range.WordOpenXML Property (Word)

 Copy code hover
[image]

Range.WordOpenXML Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a String that represents the XML contained within the range in the Microsoft Word Open XML format. Read-only.

Syntax

expression .WordOpenXML

expression An expression that returns a Range object.

Remarks

This property returns only the XML in the document that is needed to represent the specified range.

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Words Property (Word)

 Copy code hover
[image]

Range.Words Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Words collection that represents all the words in a range. Read-only.

Syntax

expression .Words

expression A variable that represents a Range object.

Remarks

Punctuation and paragraph marks in a document are included in the Words collection.

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example displays the number of words in the selection. Paragraphs marks, partial words, and punctuation are included in the count.

VBA Copy code Copy code
MsgBox "There are " & Selection.Words.Count & " words."

This example steps through the words in myRange (which spans from the beginning of the active document to the end of the selection) and deletes the word "Franklin" (including the trailing space) wherever it occurs in the range.

VBA Copy code Copy code
Set myRange = ActiveDocument.Range(Start:=0, End:=Selection.End)
For Each aWord In myRange.Words
 If aWord.Text = "Franklin " Then aWord.Delete
Next aWord

See also

Concepts

Range Object

Other resources

Range Object Members


Range.XML Property (Word)

 Copy code hover
[image]

Range.XML Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a String that represents the XML text in the specified object. .

Syntax

expression .XML(DataOnly)

expression An expression that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
DataOnly | Optional | Boolean | True returns the text of the XML without the Word XML markup. The default setting is False.

See also

Concepts

Range Object

Other resources

Range Object Members


Range Methods (Word)

 Copy code hover
[image]

Range Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
AutoFormat | Automatically formats a document. Use the Kind property to specify a document type.
Calculate | Calculates a mathematical expression within a range or selection. Returns the result as a Single.
CheckGrammar | Begins a spelling and grammar check for the specified range.
CheckSpelling | Begins a spelling check for the specified document or range.
CheckSynonyms | Displays the Thesaurus dialog box, which lists alternative word choices, or synonyms, for the text in the specified range.
Collapse | Collapses a range or selection to the starting or ending position. After a range or selection is collapsed, the starting and ending points are equal.
ComputeStatistics | Returns a Long that represents a statistic based on the contents of the specified range.
ConvertHangulAndHanja | Converts the specified range from hangul to hanja or vice versa.
ConvertToTable | Converts text within a range to a table. Returns the table as a Table object.
Copy | Copies the specified range to the Clipboard.
CopyAsPicture | The CopyAsPicture method works the same way as the Copy method.
Cut | Removes the specified object from the document and places it on the Clipboard.
Delete | Deletes the specified number of characters or words.
DetectLanguage | Analyzes the specified text to determine the language that it is written in.
EndOf | Moves or extends the ending character position of a range to the end of the nearest specified text unit.
Expand | Expands the specified range or selection. Returns the number of characters added to the range or selection. Long.
ExportAsFixedFormat | Saves a portion of a document as PDF or XPS format.
ExportFragment | Exports the selected range into a document for use as a document fragment.
GetSpellingSuggestions | Returns a SpellingSuggestions collection that represents the words suggested as spelling replacements for the first word in the specified range.
GoTo | Returns a Range object that represents the start position of the specified item, such as a page, bookmark, or field.
GoToEditableRange | Returns a Range object that represents an area of a document that can be modified by the specified user or group of users.
GoToNext | Returns a Range object that refers to the start position of the next item or location specified by the What argument. .
GoToPrevious | Returns a Range object that refers to the start position of the previous item or location specified by the What argument.
ImportFragment | Imports a document fragment into the document at the specified range.
InRange | Returns True if the range to which the method is applied is contained in the range specified by the Range argument.
InsertAfter | Inserts the specified text at the end of a range.
InsertAlignmentTab | Inserts an absolute tab that is always positioned in the same spot, relative to either the margins or indents.
InsertAutoText | Attempts to match the text in the specified range or the text surrounding the range with an existing AutoText entry name.
InsertBefore | Inserts the specified text before the specified range.
InsertBreak | Inserts a page, column, or section break.
InsertCaption | Inserts a caption immediately preceding or following the specified range.
InsertCrossReference | Inserts a cross-reference to a heading, bookmark, footnote, or endnote, or to an item for which a caption label is defined (for example, an equation, figure, or table).
InsertDatabase | Retrieves data from a data source (for example, a separate Microsoft Word document, a Microsoft Excel worksheet, or a Microsoft Access database) and inserts the data as a table in place of the specified range.
InsertDateTime | Inserts the current date or time, or both, either as text or as a TIME field.
InsertFile | Inserts all or part of the specified file.
InsertParagraph | Replaces the specified range with a new paragraph.
InsertParagraphAfter | Inserts a paragraph mark after a range.
InsertParagraphBefore | Inserts a new paragraph before the specified range.
InsertSymbol | Inserts a symbol in place of the specified range.
InsertXML | Inserts the specified XML into the document at the specified range, replacing any text contained within the range.
InStory | True if the range to which this method is applied is in the same story as the range specified by the Range argument.
IsEqual | True if the range to which this method is applied is equal to the range specified by the Range argument.
LookupNameProperties | Looks up a name in the global address book list and displays the Properties dialog box, which includes information about the specified name.
ModifyEnclosure | Adds, modifies, or removes an enclosure around the specified character or characters.
Move | Collapses the specified range to its start or end position and then moves the collapsed object by the specified number of units.
MoveEnd | Moves the ending character position of a range. .
MoveEndUntil | Moves the end position of the specified range until any of the specified characters are found in the document. If the movement is forward in the document, the range is expanded.
MoveEndWhile | Moves the ending character position of a range while any of the specified characters are found in the document.
MoveStart | Moves the start position of the specified range.
MoveStartUntil | Moves the start position of the specified range until one of the specified characters is found in the document.
MoveStartWhile | Moves the start position of the specified range while any of the specified characters are found in the document.
MoveUntil | Moves the specified range until one of the specified characters is found in the document.
MoveWhile | Moves the specified range while any of the specified characters are found in the document.
Next | Returns a Range object that represents the specified unit relative to the specified range.
NextSubdocument | Moves the range to the next subdocument.
Paste | Inserts the contents of the Clipboard at the specified range.
PasteAndFormat | Pastes the selected table cells and formats them as specified.
PasteAppendTable | Merges pasted cells into an existing table by inserting the pasted rows between the selected rows. No cells are overwritten.
PasteAsNestedTable | Pastes a cell or group of cells as a nested table into the selected range.
PasteExcelTable | Pastes and formats a Microsoft Excel table.
PasteSpecial | Inserts the contents of the Clipboard. .
PhoneticGuide | Adds phonetic guides to the specified range.
Previous | Returns the previous range a relative to the specified range.
PreviousSubdocument | Moves the range to the previous subdocument.
Relocate | In outline view, moves the paragraphs within the specified range after the next visible paragraph or before the previous visible paragraph.
Select | Selects the specified range.
SetListLevel | Sets the list level for one or more items in a numbered list.
SetRange | Sets the starting and ending character positions for an existing range.
Sort | Sorts the paragraphs in the specified range.
SortAscending | Sorts paragraphs or table rows in ascending alphanumeric order.
SortByHeadings | Sorts the headings in the specified range.
SortDescending | Sorts paragraphs in descending alphanumeric order.
StartOf | Moves or extends the start position of the specified range or selection to the beginning of the nearest specified text unit. This method returns a Long that indicates the number of characters by which the range or selection was moved or extended. The method returns a negative number if the movement is backward through the document.
TCSCConverter | Converts the specified range from Traditional Chinese to Simplified Chinese or vice versa.
WholeStory | Expands a range to include the entire story.


Range.AutoFormat Method (Word)

 Copy code hover
[image]

Range.AutoFormat Method (Word)
See also Send feedback

Published: July 16, 2012

Automatically formats a document. Use the Kind property to specify a document type.

Syntax

expression .AutoFormat

expression Required. A variable that represents a Range object.

Example

This example automatically formats the selection.

VBA Copy code Copy code
Selection.Range.AutoFormat

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Calculate Method (Word)

 Copy code hover
[image]

Range.Calculate Method (Word)
See also Send feedback

Published: July 16, 2012

Calculates a mathematical expression within a range or selection. Returns the result as a Single.

Syntax

expression .Calculate

expression Required. A variable that represents a Range object.

Example

This example inserts a mathematical expression at the beginning of the active document, calculates the expression, and then appends the results to the range. The result is "1 + 1 = 2".

VBA Copy code Copy code
Set myRange = ActiveDocument.Range(0, 0)
myRange.InsertBefore "1 + 1 "
myRange.InsertAfter "= " & myRange.Calculate

See also

Concepts

Range Object

Other resources

Range Object Members


Range.CheckGrammar Method (Word)

 Copy code hover
[image]

Range.CheckGrammar Method (Word)
See also Send feedback

Published: July 16, 2012

Begins a spelling and grammar check for the specified range.

Syntax

expression .CheckGrammar

expression Required. A variable that represents a Range object.

Remarks

If the range contains errors, this method displays the Spelling and Grammar dialog box, with the Check grammar check box selected.

Example

This example begins a spelling and grammar check on section two in MyDocument.doc.

VBA Copy code Copy code
Set Range2 = Documents("MyDocument.doc").Sections(2).Range
Range2.CheckGrammar

This example begins a spelling and grammar check on the selection.

VBA Copy code Copy code
Selection.Range.CheckGrammar

See also

Concepts

Range Object

Other resources

Range Object Members


Range.CheckSpelling Method (Word)

 Copy code hover
[image]

Range.CheckSpelling Method (Word)
See also Send feedback

Published: July 16, 2012

Begins a spelling check for the specified document or range.

Syntax

expression .CheckSpelling(CustomDictionary, IgnoreUppercase, AlwaysSuggest, CustomDictionary2, CustomDictionary3, CustomDictionary4, CustomDictionary5, CustomDictionary6, CustomDictionary7, CustomDictionary8, CustomDictionary9, CustomDictionary10)

expression Required. A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
CustomDictionary | Optional | Variant | Either an expression that returns a Dictionary object or the file name of the custom dictionary.
IgnoreUppercase | Optional | Variant | True if capitalization is ignored. If this argument is omitted, the current value of the IgnoreUppercase property is used.
AlwaysSuggest | Optional | Variant | True for Microsoft Word to always suggest alternative spellings. If this argument is omitted, the current value of the SuggestSpellingCorrections property is used.
CustomDictionary2 | Optional |  | Either an expression that returns a Dictionary object or the file name of the custom dictionary. You can specify as many as nine additional dictionaries.
CustomDictionary3 | Optional |  | Either an expression that returns a Dictionary object or the file name of the custom dictionary. You can specify as many as nine additional dictionaries.
CustomDictionary4 | Optional |  | Either an expression that returns a Dictionary object or the file name of the custom dictionary. You can specify as many as nine additional dictionaries.
CustomDictionary5 | Optional |  | Either an expression that returns a Dictionary object or the file name of the custom dictionary. You can specify as many as nine additional dictionaries.
CustomDictionary6 | Optional |  | Either an expression that returns a Dictionary object or the file name of the custom dictionary. You can specify as many as nine additional dictionaries.
CustomDictionary7 | Optional |  | Either an expression that returns a Dictionary object or the file name of the custom dictionary. You can specify as many as nine additional dictionaries.
CustomDictionary8 | Optional |  | Either an expression that returns a Dictionary object or the file name of the custom dictionary. You can specify as many as nine additional dictionaries.
CustomDictionary9 | Optional |  | Either an expression that returns a Dictionary object or the file name of the custom dictionary. You can specify as many as nine additional dictionaries.
CustomDictionary10 | Optional |  | Either an expression that returns a Dictionary object or the file name of the custom dictionary. You can specify as many as nine additional dictionaries.

Remarks

If the document or range contains errors, this method displays the Spelling and Grammar dialog box, with the Check grammar check box cleared.

Example

This example begins a spelling check on all available stories of the active document.

VBA Copy code Copy code
Set range2 = Documents("MyDocument.doc").Sections(2).Range
range2.CheckSpelling IgnoreUpperCase:=False, _
 CustomDictionary:="MyWork.Dic", _
 CustomDictionary2:="MyTechnical.Dic"

See also

Concepts

Range Object

Other resources

Range Object Members


Range.CheckSynonyms Method (Word)

 Copy code hover
[image]

Range.CheckSynonyms Method (Word)
See also Send feedback

Published: July 16, 2012

Displays the Thesaurus dialog box, which lists alternative word choices, or synonyms, for the text in the specified range.

Syntax

expression .CheckSynonyms

expression Required. A variable that represents a Range object.

Example

This example displays the Thesaurus dialog box with synonyms for the selected text.

VBA Copy code Copy code
Selection.Range.CheckSynonyms

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Collapse Method (Word)

 Copy code hover
[image]

Range.Collapse Method (Word)
See also Send feedback

Published: July 16, 2012

Collapses a range or selection to the starting or ending position. After a range or selection is collapsed, the starting and ending points are equal.

Syntax

expression .Collapse(Direction)

expression Required. A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
Direction | Optional | Variant | The direction in which to collapse the range or selection. Can be either of the following WdCollapseDirection constants: wdCollapseEnd or wdCollapseStart. The default value is wdCollapseStart.

Remarks

If you use wdCollapseEnd to collapse a range that refers to an entire paragraph, the range is located after the ending paragraph mark (the beginning of the next paragraph). However, you can move the range back one character by using the MoveEnd method after the range is collapsed, as shown in the following example.

VBA Copy code Copy code
Set myRange = ActiveDocument.Paragraphs(1).Range
myRange.Collapse Direction:=wdCollapseEnd
myRange.MoveEnd Unit:=wdCharacter, Count:=-1

Example

This example sets myRange equal to the contents of the active document, collapses myRange, and then inserts a 2x2 table at the end of the document.

VBA Copy code Copy code
Set myRange = ActiveDocument.Content
myRange.Collapse Direction:=wdCollapseEnd
ActiveDocument.Tables.Add Range:=myRange, NumRows:=2, NumColumns:=2

See also

Concepts

Range Object

Other resources

Range Object Members


Range.ComputeStatistics Method (Word)

 Copy code hover
[image]

Range.ComputeStatistics Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents a statistic based on the contents of the specified range.

Syntax

expression .ComputeStatistics(Statistic)

expression Required. A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
Statistic | Required | WdStatistic | The type of statistic to compute.

Remarks

Some of the constants listed above may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.

Example

This example displays the number of words and characters in the first paragraph of Report.doc.

VBA Copy code Copy code
Set myRange = Documents("Report.doc").Paragraphs(1).Range
wordCount = myRange.ComputeStatistics(Statistic:=wdStatisticWords)
charCount = myRange.ComputeStatistics(Statistic:=wdStatisticCharacters)
MsgBox "The first paragraph contains " & wordCount _
 & " words and a total of " & charCount & " characters."

See also

Concepts

Range Object

Other resources

Range Object Members


Range.ConvertHangulAndHanja Method (Word)

 Copy code hover
[image]

Range.ConvertHangulAndHanja Method (Word)
See also Send feedback

Published: July 16, 2012

Converts the specified range from hangul to hanja or vice versa.

Syntax

expression .ConvertHangulAndHanja(ConversionsMode, FastConversion, CheckHangulEnding, EnableRecentOrdering, CustomDictionary)

expression Required. A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
ConversionsMode | Optional | Variant | Sets the direction for the conversion between hangul and hanja. Can be either of the following WdMultipleWordConversionsMode constants: wdHangulToHanja or wdHanjaToHangul. The default value is the current value of the MultipleWordConversionsMode property.
FastConversion | Optional | Variant | True if Microsoft Word automatically converts a word with only one suggestion for conversion. The default value is the current value of the HangulHanjaFastConversion property.
CheckHangulEnding | Optional | Variant | True if Word automatically detects hangul endings and ignores them. The default value is the current value of the CheckHangulEndings property. This argument is ignored if the ConversionsMode argument is set to wdHanjaToHangul.
EnableRecentOrdering | Optional | Variant | True if Word displays the most recently used words at the top of the suggestions list. The default value is the current value of the EnableHangulHanjaRecentOrdering property.
CustomDictionary | Optional | Variant | The name of a custom hangul-hanja conversion dictionary. Use this argument to use a custom dictionary with hangul-hanja conversions not contained in the main dictionary.

Example

This example converts the current selection from hangul to hanja.

VBA Copy code Copy code
Selection.Range.ConvertHangulAndHanja _
 ConversionsMode:=wdHangulToHanja, _
 FastConversion:=True, _
 EnableRecentOrdering:= True

See also

Concepts

Range Object

Other resources

Range Object Members


Range.ConvertToTable Method (Word)

 Copy code hover
[image]

Range.ConvertToTable Method (Word)
See also Send feedback

Published: July 16, 2012

Converts text within a range to a table. Returns the table as a Table object.

Syntax

expression .ConvertToTable(Separator, NumRows, NumColumns, InitialColumnWidth, Format, ApplyBorders, ApplyShading, ApplyFont, ApplyColor, ApplyHeadingRows, ApplyLastRow, ApplyFirstColumn, ApplyLastColumn, AutoFit, AutoFitBehavior, DefaultTableBehavior)

expression A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
Separator | Optional | Variant | Specifies the character used to separate text into cells. Can be a character or one of the following WdTableFieldSeparator constant. If this argument is omitted, the value of the DefaultTableSeparator property is used.
NumRows | Optional | Variant | The number of rows in the table. If this argument is omitted, Microsoft Word sets the number of rows, based on the contents of the range.
NumColumns | Optional | Variant | The number of columns in the table. If this argument is omitted, Word sets the number of columns, based on the contents of the range.
InitialColumnWidth | Optional | Variant | The initial width of each column, in points. If this argument is omitted, Word calculates and adjusts the column width so that the table stretches from margin to margin.
Format | Optional | Variant | Specifies one of the predefined formats listed in the Table AutoFormat dialog box. Can be one of the WdTableFormat constants.
ApplyBorders | Optional | Variant | True to apply the border properties of the specified format.
ApplyShading | Optional | Variant | True to apply the shading properties of the specified format.
ApplyFont | Optional | Variant | True to apply the font properties of the specified format.
ApplyColor | Optional | Variant | True to apply the color properties of the specified format.
ApplyHeadingRows | Optional | Variant | True to apply the heading-row properties of the specified format.
ApplyLastRow | Optional | Variant | True to apply the last-row properties of the specified format.
ApplyFirstColumn | Optional | Variant | True to apply the first-column properties of the specified format.
ApplyLastColumn | Optional | Variant | True to apply the last-column properties of the specified format.
AutoFit | Optional | Variant | True to decrease the width of the table columns as much as possible without changing the way text wraps in the cells.
AutoFitBehavior | Optional | Variant | Sets the AutoFit rules for how Word sizes a table. Can be one of the following WdAutoFitBehavior constant. If DefaultTableBehavior is wdWord8TableBehavior, this argument is ignored.
DefaultTableBehavior | Optional | Variant | Sets a value that specifies whether Microsoft Word automatically resizes cells in a table to fit the contents (AutoFit). Can be one of the WdDefaultTableBehavior constant.

Return Value

Table

Example

This example converts the first three paragraphs in the active document to a table.

VBA Copy code Copy code
Set aDoc = ActiveDocument
Set myRange = aDoc.Range(Start:=aDoc.Paragraphs(1).Range.Start, _
 End:=aDoc.Paragraphs(3).Range.End)
myRange.ConvertToTable Separator:=wdSeparateByParagraphs

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Copy Method (Word)

 Copy code hover
[image]

Range.Copy Method (Word)
See also Send feedback

Published: July 16, 2012

Copies the specified range to the Clipboard.

Syntax

expression .Copy

expression Required. A variable that represents a Range object.

Example

This example copies the first paragraph in the active document and pastes it at the end of the document.

VBA Copy code Copy code
ActiveDocument.Paragraphs(1).Range.Copy
Set myRange = ActiveDocument.Range _
 (Start:=ActiveDocument.Content.End - 1, _
 End:=ActiveDocument.Content.End - 1)
myRange.Paste

See also

Concepts

Range Object

Other resources

Range Object Members


Range.CopyAsPicture Method (Word)

 Copy code hover
[image]

Range.CopyAsPicture Method (Word)
See also Send feedback

Published: July 16, 2012

The CopyAsPicture method works the same way as the Copy method.

Syntax

expression .CopyAsPicture

expression Required. A variable that represents a Range object.

Example

This example copies the contents of the active document as a picture and pastes it as a picture at the end of the document.

VBA Copy code Copy code
Sub CopyPasteAsPicture()
 With ActiveDocument.Range
 .CopyAsPicture
 .Collapse Direction:=wdCollapseEnd
 .PasteSpecial DataType:=wdPasteMetafilePicture
 End With
End Sub

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Cut Method (Word)

 Copy code hover
[image]

Range.Cut Method (Word)
See also Send feedback

Published: July 16, 2012

Removes the specified object from the document and places it on the Clipboard.

Syntax

expression .Cut

expression Required. A variable that represents a Range object.

Remarks

The contents of the range are moved to the Clipboard but a collapsed range remains in the document.

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Delete Method (Word)

 Copy code hover
[image]

Range.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the specified number of characters or words.

Syntax

expression .Delete(Unit, Count)

expression Required. A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
Unit | Optional | Variant | The unit by which the collapsed range is to be deleted. Can be one of the WdUnits constants.
Count | Optional | Variant | The number of units to be deleted. To delete units after the range, collapse the range and use a positive number. To delete units before the range, collapse the range and use a negative number.

Return Value

Long

Remarks

This method returns a Long value that indicates the number of items deleted, or it returns 0 (zero) if the deletion was unsuccessful.

Example

This example selects and deletes the contents of the active document.

VBA Copy code Copy code
Sub DeleteSelection()
 Dim intResponse As Integer

 intResponse = MsgBox("Are you sure you want to " & _
 "delete the contents of the document?", vbYesNo)

 If intResponse = vbYes Then
 ActiveDocument.Content.Select
 Selection.Delete
 End If
End Sub

See also

Concepts

Range Object

Other resources

Range Object Members


Range.DetectLanguage Method (Word)

 Copy code hover
[image]

Range.DetectLanguage Method (Word)
See also Send feedback

Published: July 16, 2012

Analyzes the specified text to determine the language that it is written in.

Syntax

expression .DetectLanguage

expression Required. A variable that represents a Range object.

Remarks

The results of the DetectLanguage method are stored in the LanguageID property on a character-by-character basis. To read the LanguageID property, you must first specify a selection or range of text.

When applied to a Document object, the DetectLanguage method checks all available text in the document (headers, footers, text boxes, and so forth). If the specified text contains a partial sentence, the selection or range is extended to the end of the sentence.

If the DetectLanguage method has already been applied to the specified text, the LanguageDetected property is set to True. To reevaulate the language of the specified text, you must first set the LanguageDetected property to False.

For more information about automatic language detection, see About automatic language detection .

Example

This example checks the active document to determine the language it's written in and then displays the result.

VBA Copy code Copy code
With ActiveDocument
 If .LanguageDetected = True Then
 x = MsgBox("This document has already " _
 & "been checked. Do you want to check " _
 & "it again?", vbYesNo)
 If x = vbYes Then
 .LanguageDetected = False
 .DetectLanguage
 End If
 Else
 .DetectLanguage
 End If
 If .Range.LanguageID = wdEnglishUS Then
 MsgBox "This is a U.S. English document."
 Else
 MsgBox "This is not a U.S. English document."
 End If
End With

See also

Concepts

Range Object

Other resources

Range Object Members


Range.EndOf Method (Word)

 Copy code hover
[image]

Range.EndOf Method (Word)
See also Send feedback

Published: July 16, 2012

Moves or extends the ending character position of a range to the end of the nearest specified text unit.

Syntax

expression .EndOf(Unit, Extend)

expression Required. A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
Unit | Optional | Variant | The unit by which to move the ending character position. Can be any WdUnits, except wdLine. The default value is wdWord.
Extend | Required | WdMovementType | Specifies whether to move or extend the end of the range. If the value is wdMove, both ends of the range or selection object are moved to the end of the specified unit. If wdExtend is used, the end of the range or selection is extended to the end of the specified unit. The default value is wdMove.

Remarks

This method returns a value that indicates the number of character positions the range or selection was moved or extended (movement is forward in the document).

If the both the starting and ending positions for the range or selection are already at the end of the specified unit, this method doesn't move or extend the range or selection. For example, if the selection is at the end of a word and the trailing space, the following instruction doesn't change the selection (char equals 0 (zero)).

VBA Copy code Copy code
char = Selection.EndOf(Unit:=wdWord, Extend:=wdMove)

Example

This example extends the selection to the end of the paragraph.

VBA Copy code Copy code
charmoved = Selection.EndOf(Unit:=wdParagraph, Extend:=wdExtend)
If charmoved = 0 Then MsgBox "Selection unchanged"

This example moves myRange to the end of the first word in the selection (after the trailing space).

VBA Copy code Copy code
Set myRange = Selection.Characters(1)
myRange.EndOf Unit:=wdWord, Extend:=wdMove

This example adds a table, selects the first cell in row two, and then extends the selection to the end of the column.

VBA Copy code Copy code
Set myRange = ActiveDocument.Range(0, 0)
Set myTable = ActiveDocument.Tables.Add(Range:=myRange, _
 NumRows:=5, NumColumns:=3)
myTable.Cell(2, 1).Select
Selection.EndOf Unit:=wdColumn, Extend:=wdExtend

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Expand Method (Word)

 Copy code hover
[image]

Range.Expand Method (Word)
See also Send feedback

Published: July 16, 2012

Expands the specified range or selection. Returns the number of characters added to the range or selection. Long.

Syntax

expression .Expand(Unit)

expression Required. A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
Unit | Optional | Variant | The unit by which to expand the range. Can be one of the following WdUnits constants:wdCharacter, wdWord, wdSentence, wdParagraph, wdSection, wdStory, wdCellwdColumn, wdRow, or wdTable.

Example

This example creates a range that refers to the first word in the active document, and then it expands the range to reference the first paragraph in the document.

VBA Copy code Copy code
Set myRange = ActiveDocument.Words(1)
myRange.Expand Unit:=wdParagraph

This example capitalizes the first character in the selection and then expands the selection to include the entire sentence.

VBA Copy code Copy code
With Selection
 .Characters(1).Case = wdTitleSentence
 .Expand Unit:=wdSentence
End With

See also

Concepts

Range Object

Other resources

Range Object Members


Range.ExportAsFixedFormat Method (Word)

 Copy code hover
[image]

Range.ExportAsFixedFormat Method (Word)
See also Send feedback

Published: July 16, 2012

Saves a portion of a document as PDF or XPS format.

Version Information

Version Added: Word 2007

Syntax

expression .ExportAsFixedFormat(OutputFileName, ExportFormat, OpenAfterExport, OptimizeFor, ExportCurrentPage, Item, IncludeDocProps, KeepIRM, CreateBookmarks, DocStructureTags, BitmapMissingFonts, UseISO19005_1, FixedFormatExtClassPtr)

expression An expression that returns a Range object.

Parameters

Name | Required/Optional | Data Type | Description
OutputFileName | Required | String | The path and file name of the new PDF or XPS file.
ExportFormat | Required | WdExportFormat | Specifies either PDF or XPS format.
OpenAfterExport | Optional | Boolean | Opens the new file after exporting the contents.
OptimizeFor | Optional | WdExportOptimizeFor | Specifies whether to optimize for screen or print.
ExportCurrentPage | Optional | Boolean | Specifies whether to export the current page. True exports the entire page. False exports only the current selection.
Item | Optional | WdExportItem | Specifies whether the export process includes text only or includes text with markup.
IncludeDocProps | Optional | Boolean | Specifies whether to include document properties in the newly exported file.
KeepIRM | Optional | Boolean | Specifies whether to copy IRM permissions to an XPS document if the source document has IRM protections. Default value is True.
CreateBookmarks | Optional | WdExportCreateBookmarks | Specifies whether to export bookmarks and the type of bookmarks to export.
DocStructureTags | Optional | Boolean | Specifies whether to include extra data to help screen readers, for example information about the flow and logical organization of the content. Default value is True.
BitmapMissingFonts | Optional | Boolean | Specifies whether to include a bitmap of the text. Set this parameter to True when font licenses do not permit a font to be embedded in the PDF file. If False, the font is referenced, and the viewer's computer substitutes an appropriate font if the authored one is not available. Default value is True.
UseISO19005_1 | Optional | Boolean | Specifies whether to limit PDF usage to the PDF subset standardized as ISO 19005-1. If True, the resulting files are more reliably self-contained but may be larger or show more visual artifacts due to the restrictions of the format. Default value is False.
FixedFormatExtClassPtr | Optional | Variant | Specifies a pointer to an add-in that allows calls to an alternate implementation of code. The alternate implementation of code interprets the EMF and EMF+ page descriptions that are generated by the applications to make their own PDF or XPS. For more information, see "Extending the Office (2007) Fixed-Format Export Feature" on MSDN.

Remarks

You can save as a PDF or XPS file from a 2007 Microsoft Office system program only after you install an add-in. For more information, search for "Enable support for other file formats, such as PDF and XPS" on the Office Web site.

See also

Concepts

Range Object

Other resources

Range Object Members


Range.ExportFragment Method (Word)

 Copy code hover
[image]

Range.ExportFragment Method (Word)
Send feedback

Published: July 16, 2012

Exports the selected range into a document for use as a document fragment.

Version Information

Version Added: Word 2007

Syntax

expression .ExportFragment(FileName, Format)

expression An expression that returns a Range object.

Parameters

Name | Required/Optional | Data Type | Description
FileName | Required | String | Specifies the path and file name of the file in which to save the document fragment.
Format | Required | WdSaveFormat | Specifies the file format of the document fragment file.

Return Value

Nothing


Range.GetSpellingSuggestions Method (Word)

 Copy code hover
[image]

Range.GetSpellingSuggestions Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a SpellingSuggestions collection that represents the words suggested as spelling replacements for the first word in the specified range.

Syntax

expression .GetSpellingSuggestions(CustomDictionary, IgnoreUppercase, MainDictionary, SuggestionMode, CustomDictionary2, CustomDictionary3, CustomDictionary4, CustomDictionary5, CustomDictionary6, CustomDictionary7, CustomDictionary8, CustomDictionary9, CustomDictionary10)

expression Required. A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
CustomDictionary | Optional | Variant | Either an expression that returns a Dictionary object or the file name of the custom dictionary.
IgnoreUppercase | Optional | Variant | True to ignore words in all uppercase letters. If this argument is omitted, the current value of the IgnoreUppercase property is used.
MainDictionary | Optional | Variant | Either an expression that returns a Dictionary object or the file name of the main dictionary. If you don't specify a main dictionary, Microsoft Word uses the main dictionary that corresponds to the language formatting of the first word in the range.
SuggestionMode | Optional | Variant | Specifies the way Word makes spelling suggestions. Can be one of the following WdSpellingWordType constants. The default value is wdSpellword.
CustomDictionary2 - CustomDictionary10 | Optional | Variant | Either an expression that returns a Dictionary object or the file name of an additional custom dictionary. You can specify as many as nine additional dictionaries.

Return Value

SpellingSuggestions

Remarks

If the word is spelled correctly, the Count property of the SpellingSuggestions object returns 0 (zero).

Example

This example looks for the alternate spelling suggestions for the first word in the selected range. If there are suggestions, the example runs a spelling check on the selection.

VBA Copy code Copy code
If Selection.Range.GetSpellingSuggestions.Count = 0 Then
 Msgbox "No suggestions."
Else
 Selection.Range.CheckSpelling
End If

See also

Concepts

Range Object

Other resources

Range Object Members


Range.GoTo Method (Word)

 Copy code hover
[image]

Range.GoTo Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the start position of the specified item, such as a page, bookmark, or field.

Syntax

expression .GoTo(What, Which, Count, Name)

expression Required. A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
What | Optional | Variant | The kind of item to which the range is moved. Can be one of the WdGoToItem constants.
Which | Optional | Variant | The item to which the range is moved. Can be one of the WdGoToDirection constants.
Count | Optional | Variant | The number of the item in the document. The default value is 1. Only positive values are valid. To specify an item that precedes the range, use wdGoToPrevious as the Which argument and specify a Count value.
Name | Optional | Variant | If the What argument is wdGoToBookmark, wdGoToComment, wdGoToField, or wdGoToObject, this argument specifies a name. Only positive values are valid. To specify an item that precedes the range, use wdGoToPrevious as the Which argument and specify a Count value.

Remarks

The following example moves the range up two lines.

VBA Copy code Copy code
ActiveDocument.Range.GoTo What:=wdGoToLine, Which:=wdGoToPrevious, Count:=2

The following example moves to the next DATE field.

VBA Copy code Copy code
ActiveDocument.Range.GoTo What:=wdGoToField, Name:="Date"

The following example moves the range to the fourth line in the document.

VBA Copy code Copy code
ActiveDocument.Range.GoTo What:=wdGoToLine, Which:=wdGoToAbsolute, Count:=4

The following examples are functionally equivalent; they both move the range to the first heading in the document.

VBA Copy code Copy code
ActiveDocument.Range.GoTo What:=wdGoToHeading, Which:=wdGoToFirst
ActiveDocument.Range.GoTo What:=wdGoToHeading, Which:=wdGoToAbsolute, Count:=1

When you use the GoTo method with the wdGoToGrammaticalError, wdGoToProofreadingError, or wdGoToSpellingError constant, the Range that is returned includes any grammar error text or spelling error text.

Example

This example moves the insertion point just before the fifth endnote reference mark in the active document.

VBA Copy code Copy code
If ActiveDocument.Endnotes.Count >= 5 Then
 ActiveDocument.Range.GoTo What:=wdGoToEndnote, _
 Which:=wdGoToAbsolute, Count:=5
End If

This example sets R1 equal to the first footnote reference mark in the active document.

VBA Copy code Copy code
If ActiveDocument.Footnotes.Count >= 1 Then
 Set R1 = ActiveDocument.Range.GoTo(What:=wdGoToFootnote, _
 Which:=wdGoToFirst)
 R1.Expand Unit:=wdCharacter
End If

See also

Concepts

Range Object

Other resources

Range Object Members


Range.GoToEditableRange Method (Word)

 Copy code hover
[image]

Range.GoToEditableRange Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents an area of a document that can be modified by the specified user or group of users.

Syntax

expression .GoToEditableRange(EditorID)

expression Required. A variable that represents a Range object.

Remarks

You can also use the NextRange property of the Editor object to return the next range for which the user has permission to modify.

Example

The following example goes to the next range for which the current user has permission to modify.

VBA Copy code Copy code
Selection.GoToEditableRange wdEditorCurrent

See also

Concepts

Range Object

Other resources

Range Object Members


Range.GoToNext Method (Word)

 Copy code hover
[image]

Range.GoToNext Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a Range object that refers to the start position of the next item or location specified by the What argument. .

Syntax

expression .GoToNext(What)

expression Required. A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
What | Required | WdGoToItem | The item to where the specified range or selection is to be moved.

Remarks

Note Note

When you use this method with the wdGoToGrammaticalError, wdGoToProofreadingError, or wdGoToSpellingError constant, the Range object that's returned includes any grammar error text or spelling error text.

See also

Concepts

Range Object

Other resources

Range Object Members


Range.GoToPrevious Method (Word)

 Copy code hover
[image]

Range.GoToPrevious Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a Range object that refers to the start position of the previous item or location specified by the What argument.

Syntax

expression .GoToPrevious(What)

expression Required. A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
What | Required | WdGoToItem | The item to where the specified range or selection is to be moved.

Remarks

Note Note

When you use this method with the wdGoToGrammaticalError, wdGoToProofreadingError, or wdGoToSpellingError constant, the Range object that's returned includes any grammar error text or spelling error text.

See also

Concepts

Range Object

Other resources

Range Object Members


Range.ImportFragment Method (Word)

 Copy code hover
[image]

Range.ImportFragment Method (Word)
See also Send feedback

Published: July 16, 2012

Imports a document fragment into the document at the specified range.

Version Information

Version Added: Word 2007

Syntax

expression .ImportFragment(FileName, MatchDestination)

expression An expression that returns a Range object.

Parameters

Name | Required/Optional | Data Type | Description
FileName | Required | String | Specifies the path and file name where the document fragment is stored.
MatchDestination | Optional | Boolean | Specifies whether to match the destination formatting. If False, the imported document fragment retains the formatting in the original document. Default value is False.

Return Value

Nothing

Remarks

This method replaces the contents of a range. To stop this from occurring, use the Collapse method before using this method.

See also

Concepts

Range Object

Other resources

Range Object Members


Range.InRange Method (Word)

 Copy code hover
[image]

Range.InRange Method (Word)
See also Send feedback

Published: July 16, 2012

Returns True if the range to which the method is applied is contained in the range specified by the Range argument.

Syntax

expression .InRange(Range)

expression Required. A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
Range | Required | Range | Specifies the range that this method uses to determine if it is contained within the specified Range object.

Return Value

Boolean

Remarks

This method determines whether the range returned by expression is contained in the specified Range by comparing the starting and ending character positions and the story type.

Example

This example sets myRange equal to the first word in the active document. If myRange is not contained in the selected range, myRange is selected.

VBA Copy code Copy code
Set myRange = ActiveDocument.Words(1)
If myRange.InRange(Selection.Range) = False Then myRange.Select

See also

Concepts

Range Object

Other resources

Range Object Members


Range.InsertAfter Method (Word)

 Copy code hover
[image]

Range.InsertAfter Method (Word)
See also Send feedback

Published: July 16, 2012

Inserts the specified text at the end of a range.

Syntax

expression .InsertAfter(Text)

expression Required. A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
Text | Required | String | The text to be inserted.

Remarks

After this method is applied, the range expands to include the new text.

You can insert characters such as quotation marks, tab characters, and nonbreaking hyphens by using the Visual Basic Chr function with the InsertAfter method. You can also use the following Visual Basic constants: vbCr, vbLf, vbCrLf and vbTab.

If you use this method with a range that refers to an entire paragraph, the text is inserted after the ending paragraph mark (the text will appear at the beginning of the next paragraph). To insert text at the end of a paragraph, determine the ending point and subtract 1 from this location (the paragraph mark is one character), as shown in the following example.

VBA Copy code Copy code
Set doc = ActiveDocument
Set rngRange = _
 doc.Range(doc.Paragraphs(1).Start, _
 doc.Paragraphs(1).End - 1)
rngRange.InsertAfter _
 " This is now the last sentence in paragraph one."

However, if the range ends with a paragraph mark that also happens to be the end of the document, Microsoft Word inserts the text before the final paragraph mark rather than creating a new paragraph at the end of the document.

Also, if the range is a bookmark, Word inserts the specified text but does not extend the range or the bookmark to include the new text.

Example

This example inserts text at the end of the active document. The Content property returns a Range object.

VBA Copy code Copy code
ActiveDocument.Content.InsertAfter "end of document"

This example inserts text from an input box as the second paragraph in the active document.

VBA Copy code Copy code
response = InputBox("Type some text")
With ActiveDocument.Paragraphs(1).Range
 .InsertAfter "1." & Chr(9) & response
 .InsertParagraphAfter
End With

See also

Concepts

Range Object

Other resources

Range Object Members


Range.InsertAlignmentTab Method (Word)

 Copy code hover
[image]

Range.InsertAlignmentTab Method (Word)
See also Send feedback

Published: July 16, 2012

Inserts an absolute tab that is always positioned in the same spot, relative to either the margins or indents.

Syntax

expression .InsertAlignmentTab(Alignment, RelativeTo)

expression An expression that returns a Range object.

Parameters

Name | Required/Optional | Data Type | Description
Alignment | Required | Long | Indicates the type of alignment—left, center, or right—for the tab stop. Can be one of the WdAlignmentTabAlignment constants.
RelativeTo | Optional | Long | Indicates whether the tab stop is relative to the margins or to the paragraph indents. Can be one of the WdAlignmentTabRelative constants.

Example

The following example inserts an alignment tab at the Insertion Point.

VBA Copy code Copy code
Selection.Range.InsertAlignmentTab 1, 1

See also

Concepts

Range Object

Other resources

Range Object Members


Range.InsertAutoText Method (Word)

 Copy code hover
[image]

Range.InsertAutoText Method (Word)
See also Send feedback

Published: July 16, 2012

Attempts to match the text in the specified range or the text surrounding the range with an existing AutoText entry name.

Syntax

expression .InsertAutoText

expression Required. A variable that represents a Range object.

Remarks

If Word finds a match, InsertAutoText inserts the AutoText entry to replace that text. If Word cannot find a match, an error occurs.

You can use the Insert method with an AutoTextEntry object to insert a specific AutoText entry.

Example

This example inserts an AutoText entry that matches the text around a selection.

VBA Copy code Copy code
Documents.Add
Selection.TypeText "Best w"
Selection.Range.InsertAutoText

This example inserts an AutoText entry with a name that matches the first word in the active document.

VBA Copy code Copy code
Documents.Add
Selection.TypeText "In "
Set myRange = ActiveDocument.Words(1)
myRange.InsertAutoText

See also

Concepts

Range Object

Other resources

Range Object Members


Range.InsertBefore Method (Word)

 Copy code hover
[image]

Range.InsertBefore Method (Word)
See also Send feedback

Published: July 16, 2012

Inserts the specified text before the specified range.

Syntax

expression .InsertBefore(Text)

expression Required. A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
Text | Required | String | The text to be inserted.

Remarks

After the text is inserted, the range is expanded to include the new text. If the range is a bookmark, the bookmark is also expanded to include the next text.

You can insert characters such as quotation marks, tab characters, and nonbreaking hyphens by using the Visual Basic Chr function with the InsertBefore method. You can also use the following Visual Basic constants: vbCr, vbLf, vbCrLf and vbTab.

Example

This example inserts the text "Introduction" as a separate paragraph at the beginning of the active document.

VBA Copy code Copy code
With ActiveDocument.Content
 .InsertParagraphBefore
 .InsertBefore "Introduction"
End With

See also

Concepts

Range Object

Other resources

Range Object Members


Range.InsertBreak Method (Word)

 Copy code hover
[image]

Range.InsertBreak Method (Word)
See also Send feedback

Published: July 16, 2012

Inserts a page, column, or section break.

Syntax

expression .InsertBreak(Type)

expression Required. A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
Type | Optional | Variant | The type of break to be inserted.Can be one of the WdBreakType constants. If omitted, the default value is wdPageBreak.

Remarks

When you insert a page or column break, the range is replaced by the break. If you don't want to replace the range, use the Collapse method before using the InsertBreak method. When you insert a section break, the break is inserted immediately preceding the Range.

Some of the constants listed above may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.

Example

This example inserts a page break immediately following the second paragraph in the active document.

VBA Copy code Copy code
Set myRange = ActiveDocument.Paragraphs(2).Range
With myRange
 .Collapse Direction:=wdCollapseEnd
 .InsertBreak Type:=wdPageBreak
End With

See also

Concepts

Range Object

Other resources

Range Object Members


Range.InsertCaption Method (Word)

 Copy code hover
[image]

Range.InsertCaption Method (Word)
See also Send feedback

Published: July 16, 2012

Inserts a caption immediately preceding or following the specified range.

Syntax

expression .InsertCaption(Label, Title, TitleAutoText, Position, ExcludeLabel)

expression Required. A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
Label | Required | Variant | The caption label to be inserted. Can be a String or one of the WdCaptionLabelID constants. If the label has not yet been defined, an error occurs. Use the Add method with the CaptionLabels object to define new caption labels.
Title | Optional | Variant | The string to be inserted immediately following the label in the caption (ignored if TitleAutoText is specified).
TitleAutoText | Optional | Variant | The AutoText entry whose contents you want to insert immediately following the label in the caption (overrides any text specified by Title).
Position | Optional | Variant | Specifies whether the caption will be inserted above or below the range. Can be either one of the WdCaptionPosition constants.
ExcludeLabel | Optional | Variant | True does not include the text label, as defined in the Label parameter. False includes the specified label.

Example

This example inserts a caption below the first table in the active document.

VBA Copy code Copy code
ActiveDocument.Tables(1).Range.InsertCaption _
 Label:=wdCaptionTable, _
 Position:=wdCaptionPositionBelow

See also

Concepts

Range Object

Other resources

Range Object Members


Range.InsertCrossReference Method (Word)

 Copy code hover
[image]

Range.InsertCrossReference Method (Word)
See also Send feedback

Published: July 16, 2012

Inserts a cross-reference to a heading, bookmark, footnote, or endnote, or to an item for which a caption label is defined (for example, an equation, figure, or table).

Syntax

expression .InsertCrossReference(ReferenceType, ReferenceKind, ReferenceItem, InsertAsHyperlink, IncludePosition, SeparateNumbers, SeparatorString)

expression Required. A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
ReferenceType | Required | Variant | The type of item for which a cross-reference is to be inserted. Can be any WdReferenceType or WdCaptionLabelID constant or a user defined caption label.
ReferenceKind | Required | WdReferenceKind | The information to be included in the cross-reference.
ReferenceItem | Required | Variant | If ReferenceType is wdRefTypeBookmark, this argument specifies a bookmark name. For all other ReferenceType values, this argument specifies the item number or name in the Reference type option in the Cross-reference dialog box. Use the GetCrossReferenceItems method to return a list of item names that can be used with this argument.
InsertAsHyperlink | Optional | Variant | True to insert the cross-reference as a hyperlink to the referenced item.
IncludePosition | Optional | Variant | True to insert "above" or "below," depending on the location of the reference item in relation to the cross-reference.
IncludePosition | Optional | Variant | True to use a separator to separate the numbers from the associated text. (Use only if the ReferenceType parameter is set to wdRefTypeNumberedItem and the ReferenceKind parameter is set to wdNumberFullContext.)
IncludePosition | Optional | Variant | Specifies the string to use as a separator if the SeparateNumbers parameter is set to True.

Remarks

If you specify wdPageNumber for the value of ReferenceKind, you may need to repaginate the document to see the correct cross-reference information.

Example

This example inserts at the beginning of the active document a cross-reference to the page that includes the first bookmark in the document.

VBA Copy code Copy code
Set myRange = ActiveDocument.Range(Start:=0, End:=0)
myBookmarks = ActiveDocument _
 .GetCrossReferenceItems(wdRefTypeBookmark)
With myRange
 .InsertBefore "Page "
 .Collapse Direction:=wdCollapseEnd
 .InsertCrossReference ReferenceType:=wdRefTypeBookmark, _
 ReferenceKind:=wdPageNumber, ReferenceItem:=myBookmarks(1)
End With

See also

Concepts

Range Object

Other resources

Range Object Members


Range.InsertDatabase Method (Word)

 Copy code hover
[image]

Range.InsertDatabase Method (Word)
See also Send feedback

Published: July 16, 2012

Retrieves data from a data source (for example, a separate Microsoft Word document, a Microsoft Excel worksheet, or a Microsoft Access database) and inserts the data as a table in place of the specified range.

Syntax

expression .InsertDatabase(Format, Style, LinkToSource, Connection, SQLStatement, SQLStatement1, PasswordDocument, PasswordTemplate, WritePasswordDocument, WritePasswordTemplate, DataSource, From, To, IncludeFields)

expression Required. A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
Format | Optional | Variant | A format listed in the Formats box in the Table AutoFormat dialog box (Table menu). Can be any of the WdTableFormat constants. A border is applied to the cells in the table by default.
Style | Optional | Variant | The attributes of the AutoFormat specified by Format that are applied to the table.
LinkToSource | Optional | Variant | True to establish a link between the new table and the data source.
Connection | Optional | Variant | A range within which to perform the query specified by SQLStatement.
SQLStatement | Optional | String | An optional query string that retrieves a subset of the data in a primary data source to be inserted into the document.
SQLStatement1 | Optional | String | If the query string is longer than 255 characters, SQLStatement denotes the first portion of the string and SQLStatement1 denotes the second portion.
PasswordDocument | Optional | Variant | The password (if any) required to open the data source. (See Remarks below.)
PasswordTemplate | Optional | Variant | If the data source is a Word document, this argument is the password (if any) required to open the attached template. (See Remarks below.)
WritePasswordDocument | Optional | Variant | The password required to save changes to the document. (See Remarks below.)
WritePasswordTemplate | Optional | Variant | The password required to save changes to the template. (See Remarks below.)
DataSource | Optional | Variant | The path and file name of the data source.
From | Optional | Variant | The number of the first record in the range of records to be inserted.
To | Optional | Variant | The number of the last record in the range of records to be inserted.
IncludeFields | Optional | Variant | True to include field names from the data source in the first row of the new table.

Security

Avoid using hard-coded passwords in your applications. If a password is required in a procedure, request the password from the user, store it in a variable, and then use the variable in your code. For recommended best practices on how to do this, see Security Notes for Microsoft Office Solution Developers.

Security note Security Note
Avoid using the built-in system administrator ( sa ) logon account. Instead, make system administrators members of the sysadmin fixed server role, and have them use their own accounts to log on. Use sa only when there is no other way to log on. To prevent unauthorized access through the sa logon account, you should assign that account a strong, unique password.

Security note Security Note
When possible, use Windows Authentication (also referred to as a trusted connection), which uses a Windows user account to connect to SQL Server. When a user connects through a Windows user account, SQL Server uses information in the Windows operating system to validate the account name and password. Before you can use Windows Authentication, a server administrator must configure SQL Server to use this mode of authentication. If Windows Authentication is not available, avoid saving users' logon information. It is more secure for users to enter their logon information each time they log on.

Remarks

The value of the Style argument can be the sum of any combination of the following values:

Value | Meaning
0 (zero) | None
1 | Borders
2 | Shading
4 | Font
8 | Color
16 | Auto Fit
32 | Heading Rows
64 | Last Row
128 | First Column
256 | Last Column

How you specify the Connection argument depends on how data is retrieved. For example:

  • When retrieving data through Open Database Connectivity (ODBC), you specify a connection string.

  • When retrieving data from Excel by using dynamic data exchange (DDE), you specify a named range or "Entire Spreadsheet."

    Security note Security Note
    Dynamic data exchange (DDE) is an older technology that is not secure. If possible, use a more secure alternative to DDE, such as object linking and embedding (OLE).

  • When retrieving data from Access, you specify the word "Table" or "Query" followed by the name of a table or query.

Example

This example inserts an Excel spreadsheet named "Data.xls" after the selection. The Style value (191) is a combination of the numbers 1, 2, 4, 8, 16, 32, and 128.

VBA Copy code Copy code
With Selection
    .Collapse Direction:=wdCollapseEnd
    .Range.InsertDatabase _
        Format:=wdTableFormatSimple2, Style:=191, _
        LinkToSource:=False, Connection:="Entire Spreadsheet", _
        DataSource:="C:\MSOffice\Excel\Data.xls"
End With

See also

Concepts

Range Object

Other resources

Range Object Members


Range.InsertDateTime Method (Word)

 Copy code hover
[image]

Range.InsertDateTime Method (Word)
See also Send feedback

Published: July 16, 2012

Inserts the current date or time, or both, either as text or as a TIME field.

Syntax

expression .InsertDateTime(DateTimeFormat, InsertAsField, InsertAsFullWidth, DateLanguage, CalendarType)

expression Required. A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
DateTimeFormat | Optional | Variant | The format to be used for displaying the date or time, or both. If this argument is omitted, Microsoft Word uses the short-date style from the Windows Control Panel (Regional Settings icon).
InsertAsField | Optional | Variant | True to insert the specified information as a TIME field. The default value is True.
InsertAsFullWidth | Optional | Variant | True to insert the specified information as double-byte digits. This argument may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.
DateLanguage | Optional | Variant | Sets the language in which to display the date or time. Can be either of the WdDateLanguage constants. This argument may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.
CalendarType | Optional | Variant | Sets the calendar type to use when displaying the date or time. Can be either of the WdCalendarTypeBi constants. This argument may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.

Example

This example inserts the current date at the end of the active document. A possible result might be "01/12/99."

VBA Copy code Copy code
With ActiveDocument.Content
 .Collapse Direction:=wdCollapseEnd
 .InsertDateTime DateTimeFormat:="MM/dd/yy", _
 InsertAsField:=False
End With

This example inserts a TIME field for the current date in the footer for the active document.

VBA Copy code Copy code
ActiveDocument.Sections(1).Footers(wdHeaderFooterPrimary).Range _
 .InsertDateTime DateTimeFormat:="MMMM dd, yyyy", _
 InsertAsField:=True

See also

Concepts

Range Object

Other resources

Range Object Members


Range.InsertFile Method (Word)

 Copy code hover
[image]

Range.InsertFile Method (Word)
See also Send feedback

Published: July 16, 2012

Inserts all or part of the specified file.

Syntax

expression .InsertFile(FileName, Range, ConfirmConversions, Link, Attachment)

expression Required. A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
FileName | Required | String | The path and file name of the file to be inserted. If you don't specify a path, Word assumes the file is in the current folder.
Range | Optional | Variant | If the specified file is a Word document, this parameter refers to a bookmark. If the file is another type (for example, a Microsoft Excel worksheet), this parameter refers to a named range or a cell range (for example, R1C1:R3C4).
ConfirmConversions | Optional | Variant | True to have Word prompt you to confirm conversion when inserting files in formats other than the Word Document format.
Link | Optional | Variant | True to insert the file by using an INCLUDETEXT field.
Attachment | Optional | Variant | True to insert the file as an attachment to an e-mail message.

Example

This example uses an INCLUDETEXT field to insert the TEST.DOC file at the end of the current document.

VBA Copy code Copy code
ActiveDocument.Range.Collapse Direction:=wdCollapseEnd
ActiveDocument.Range.InsertFile FileName:="C:\TEST.DOC", Link:=True

See also

Concepts

Range Object

Other resources

Range Object Members


Range.InsertParagraph Method (Word)

 Copy code hover
[image]

Range.InsertParagraph Method (Word)
See also Send feedback

Published: July 16, 2012

Replaces the specified range with a new paragraph.

Syntax

expression .InsertParagraph

expression Required. A variable that represents a Range object.

Remarks

After this method has been used, the range is the new paragraph.

If you don't want to replace the range, use the Collapse method before using this method. The InsertParagraphAfter method inserts a new paragraph following a Range object.

Example

This example inserts a new paragraph at the beginning of the active document.

VBA Copy code Copy code
Set myRange = ActiveDocument.Range(0, 0)
With myRange
 .InsertParagraph
 .InsertBefore "Dear Sirs,"
End With

See also

Concepts

Range Object

Other resources

Range Object Members


Range.InsertParagraphAfter Method (Word)

 Copy code hover
[image]

Range.InsertParagraphAfter Method (Word)
See also Send feedback

Published: July 16, 2012

Inserts a paragraph mark after a range.

Syntax

expression .InsertParagraphAfter

expression Required. A variable that represents a Range object.

Remarks

After this method is applied, the range expands to include the new paragraph.

Example

This example inserts text as a new paragraph at the beginning of the active document.

VBA Copy code Copy code
Set myRange = ActiveDocument.Range(0, 0)
With myRange
 .InsertBefore "Title"
 .ParagraphFormat.Alignment = wdAlignParagraphCenter
 .InsertParagraphAfter
End With

This example inserts a paragraph at the end of the active document. The Content property returns a Range object.

VBA Copy code Copy code
ActiveDocument.Content.InsertParagraphAfter

See also

Concepts

Range Object

Other resources

Range Object Members


Range.InsertParagraphBefore Method (Word)

 Copy code hover
[image]

Range.InsertParagraphBefore Method (Word)
See also Send feedback

Published: July 16, 2012

Inserts a new paragraph before the specified range.

Syntax

expression .InsertParagraphBefore

expression Required. A variable that represents a Range object.

Remarks

After this method is applied, the range expands to include the new paragraph.

Example

This example inserts a new paragraph at the beginning of the active document.

VBA Copy code Copy code
ActiveDocument.Range.InsertParagraphBefore

See also

Concepts

Range Object

Other resources

Range Object Members


Range.InsertSymbol Method (Word)

 Copy code hover
[image]

Range.InsertSymbol Method (Word)
See also Send feedback

Published: July 16, 2012

Inserts a symbol in place of the specified range.

Syntax

expression .InsertSymbol(CharacterNumber, Font, Unicode, Bias)

expression Required. A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
CharacterNumber | Required | Long | The character number for the specified symbol. This value will always be the sum of 31 and the number that corresponds to the position of the symbol in the table of symbols (counting from left to right). For example, to specify a delta character at position 37 in the table of symbols in the Symbol font, set CharacterNumber to 68.
Font | Optional | Variant | The name of the font that contains the symbol.
Unicode | Optional | Variant | True to insert the unicode character specified by CharacterNumber; False to insert the ANSI character specified by CharacterNumber. The default value is False.
Bias | Optional | Variant | Sets the font bias for symbols. This argument is useful for setting the correct font bias for East Asian characters. Can be one of the WdFontBias constants. This argument may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.

Remarks

If you don't want to replace the range, use the Collapse method before you use this method.

Example

This example inserts a double-headed arrow at the end of the document.

VBA Copy code Copy code
With ActiveDocument.Range
 .Collapse Direction:=wdCollapseStart
 .InsertSymbol CharacterNumber:=171, _
 Font:="Symbol", Unicode:=False
End With

See also

Concepts

Range Object

Other resources

Range Object Members


Range.InsertXML Method (Word)

 Copy code hover
[image]

Range.InsertXML Method (Word)
See also Send feedback

Published: July 16, 2012

Inserts the specified XML into the document at the specified range, replacing any text contained within the range.

Syntax

expression .InsertXML(XML, Transform)

expression An expression that returns a Range object.

Parameters

Name | Required/Optional | Data Type | Description
XML | Required | String | Specifies the XML to insert. This can be any valid custom XML.
Transform | Optional | Variant | Specifies the XML Transformation (XSLT) used to transform the XML. If omitted, the XML is inserted as custom XML without applying a transform.

Return Value

Nothing

Example

The following example inserts the specified XML string into the document at the fifth paragraph. This replaces any text contained within the fifth paragraph.

VBA Copy code Copy code
Dim strXML As String

strXML = "<?xml version=""1.0""?><abc:books xmlns:abc=""urn:books"" " & _
 "xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" " & _
 "xsi:schemaLocation=""urn:books books.xsd""><book>" & _
 "<author>Matt Hink</author><title>Migration Paths of the Red " & _
 "Breasted Robin</title><genre>non-fiction</genre>" & _
 "<price>29.95</price><pub_date>2006-05-01</pub_date>" & _
 "<abstract>You see them in the spring outside your windows. " & _
 "You hear their lovely songs wafting in the warm spring air. " & _
 "Now follow their path as they migrate to warmer climes in the fall, " & _
 "and then back to your back yard in the spring.</abstract></book></abc:books>"

ActiveDocument.Paragraphs(5).Range.InsertXML strXML

See also

Concepts

Range Object

Other resources

Range Object Members


Range.InStory Method (Word)

 Copy code hover
[image]

Range.InStory Method (Word)
See also Send feedback

Published: July 16, 2012

True if the range to which this method is applied is in the same story as the range specified by the Range argument.

Syntax

expression .InStory(Range)

expression Required. A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
Range | Required | Range | Specifies the range that this method uses to determine if it is contained within the specified Range object.

Return Value

Boolean

Remarks

A range can belong to only one story.

Example

This example determines whether Range1 and Range2 are in the same story. If they are, bold formatting is applied to Range1.

VBA Copy code Copy code
Set Range1 = Selection.Words(1)
Set Range2 = ActiveDocument.Range(Start:=20, End:=100)
If Range1.InStory(Range:=Range2) = True Then
 Range1.Font.Bold = True
End If

See also

Concepts

Range Object

Other resources

Range Object Members


Range.IsEqual Method (Word)

 Copy code hover
[image]

Range.IsEqual Method (Word)
See also Send feedback

Published: July 16, 2012

True if the range to which this method is applied is equal to the range specified by the Range argument.

Syntax

expression .IsEqual(Range)

expression Required. A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
Range | Required | Range | The range to compare with the Range object defined by expression.

Return Value

Boolean

Remarks

This method compares the starting and ending character positions and the story type. If all three of these items are the same for both objects, the objects are equal.

Example

This example compares Range1 with Range2 to determine whether they're equal. If the two ranges are equal, the content of Range1 is deleted.

VBA Copy code Copy code
Set Range1 = Selection.Words(1)
Set Range2 = ActiveDocument.Words(3)
If Range1.IsEqual(Range:=Range2) = True Then
 Range1.Delete
End If

See also

Concepts

Range Object

Other resources

Range Object Members


Range.LookupNameProperties Method (Word)

 Copy code hover
[image]

Range.LookupNameProperties Method (Word)
See also Send feedback

Published: July 16, 2012

Looks up a name in the global address book list and displays the Properties dialog box, which includes information about the specified name.

Syntax

expression .LookupNameProperties

expression Required. A variable that represents a Range object.

Remarks

If this method finds more than one match, it displays the Check Names dialog box.

Example

This example looks up the selected name in the address book and displays the Properties dialog box for that person.

VBA Copy code Copy code
Selection.Range.LookupNameProperties

See also

Concepts

Range Object

Other resources

Range Object Members


Range.ModifyEnclosure Method (Word)

 Copy code hover
[image]

Range.ModifyEnclosure Method (Word)
See also Send feedback

Published: July 16, 2012

Adds, modifies, or removes an enclosure around the specified character or characters.

Syntax

expression .ModifyEnclosure(Style, Symbol, EnclosedText)

expression Required. A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
Style | Required | Variant | The style of the enclosure. Can be any WdEncloseStyle constant.
Symbol | Optional | Variant | The symbol in which to enclose the specified range. Can be any WdEnclosureType constant.
EnclosedText | Optional | Variant | The characters that you want to enclose. If you include this argument, Microsoft Word replaces the specified range with the enclosed characters. If you don't specify text to enclose, Microsoft Word encloses all text in the specified range.

Example

This example replaces the current selection with the number 25 enclosed in a circle.

VBA Copy code Copy code
Selection.Range.ModifyEnclosure wdEncloseStyleLarge, _
 wdEnclosureCircle, "25"

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Move Method (Word)

 Copy code hover
[image]

Range.Move Method (Word)
See also Send feedback

Published: July 16, 2012

Collapses the specified range to its start or end position and then moves the collapsed object by the specified number of units.

Syntax

expression .Move(Unit, Count)

expression Required. A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
Unit | Optional | WdUnits | The unit by which to move the range.
Count | Optional | Variant | The number of units by which the specified range is to be moved. If Count is a positive number, the object is collapsed to its end position and moved backward in the document by the specified number of units. If Count is a negative number, the object is collapsed to its start position and moved forward by the specified number of units. The default value is 1. You can also control the collapse direction by using the Collapse method before using the Move method. If the range is in the middle of a unit or isn't collapsed, moving it to the beginning or end of the unit counts as moving it one full unit.

Return Value

Long

Remarks

This method returns a Long value that indicates the number of units by which the object was actually moved, or it returns 0 (zero) if the move was unsuccessful.

The start and end positions of a collapsed range are equal.

Applying the Move method to a range doesn't rearrange text in the document. Instead, it redefines the range to refer to a new location in the document.

Example

This example sets Range1 to the first paragraph in the active document and then moves the range forward three paragraphs. After this macro is run, the insertion point is positioned at the beginning of the fourth paragraph.

VBA Copy code Copy code
Set Range1 = ActiveDocument.Paragraphs(1).Range
With Range1
 .Collapse Direction:=wdCollapseStart
 .Move Unit:=wdParagraph, Count:=3
 .Select
End With

See also

Concepts

Range Object

Other resources

Range Object Members


Range.MoveEnd Method (Word)

 Copy code hover
[image]

Range.MoveEnd Method (Word)
See also Send feedback

Published: July 16, 2012

Moves the ending character position of a range. .

Syntax

expression .MoveEnd(Unit, Count)

expression Required. A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
Unit | Optional | WdUnits | The unit by which to move the ending character position.
Count | Optional | Variant | The number of units to move. If this number is positive, the ending character position is moved forward in the document. If this number is negative, the end is moved backward. If the ending position overtakes the starting position, the range collapses and both character positions move together. The default value is 1.

Remarks

This method returns an integer that indicates the number of units the range actually moved, or it returns 0 (zero) if the move was unsuccessful.

Example

This example sets myRange to be equal to the second word in the active document. The MoveEnd method is used to move the ending position of myRange (a range object) forward one word. After this macro is run, the second and third words in the document are selected.

VBA Copy code Copy code
If ActiveDocument.Words.Count >= 3 Then
 Set myRange = ActiveDocument.Words(2)
 With myRange
 .MoveEnd Unit:=wdWord, Count:=1
 .Select
 End With
End If

See also

Concepts

Range Object

Other resources

Range Object Members


Range.MoveEndUntil Method (Word)

 Copy code hover
[image]

Range.MoveEndUntil Method (Word)
See also Send feedback

Published: July 16, 2012

Moves the end position of the specified range until any of the specified characters are found in the document. If the movement is forward in the document, the range is expanded.

Syntax

expression .MoveEndUntil(Cset, Count)

expression Required. A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
Cset | Required | Variant | One or more characters. This argument is case sensitive.
Count | Optional | Variant | The maximum number of characters by which the specified range is to be moved. Can be a number or either the wdForward or wdBackward constant. If Count is a positive number, the range is moved forward in the document. If it is a negative number, the range is moved backward. The default value is wdForward.

Remarks

This method returns the number of characters by which the end position of the specified range was moved, as a Long value. If Count is greater than 0 (zero), this method returns the number of characters moved plus 1. If Count is less than 0 (zero), this method returns the number of characters moved minus 1. If no Cset characters are found, the range isn't changed and the method returns 0 (zero). If the end position is moved backward to a point that precedes the original start position, the start position is set to the new ending position.

Example

This example extends the selected text forward in the document until the letter "a" is found. The example then expands the selection by one character to include the letter "a".

VBA Copy code Copy code
With Selection.Range
 .MoveEndUntil Cset:="a", Count:=wdForward
 .MoveRight Unit:=wdCharacter, Count:=1, Extend:=wdExtend
End With

See also

Concepts

Range Object

Other resources

Range Object Members


Range.MoveEndWhile Method (Word)

 Copy code hover
[image]

Range.MoveEndWhile Method (Word)
See also Send feedback

Published: July 16, 2012

Moves the ending character position of a range while any of the specified characters are found in the document.

Syntax

expression .MoveEndWhile(Cset, Count)

expression Required. A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
Cset | Required | Variant | One or more characters. This argument is case sensitive.
Count | Optional | Variant | The maximum number of characters by which the range is to be moved. Can be a number or either the wdForward or wdBackward constant. If Count is a positive number, the range is moved forward in the document. If it is a negative number, the range is moved backward. The default value is wdForward.

Remarks

While any character in Cset is found, the end position of the specified range is moved. This method returns the number of characters that the end position of the range moved as a Long value. If no Cset characters are found, the range isn't changed and the method returns 0 (zero). If the end position is moved backward to a point that precedes the original start position, the start position is set to the new end position.

Example

This example moves the end position of the selected range forward while the space character is found.

VBA Copy code Copy code
Selection.Range.MoveEndWhile Cset:=" ", Count:=wdForward

This example moves the end position of the selected range forward while Count is less than or equal to 10 and any letter from "a" through "h" is found.

VBA Copy code Copy code
Selection.Range.MoveEndWhile Cset:="abcdefgh", Count:=10

See also

Concepts

Range Object

Other resources

Range Object Members


Range.MoveStart Method (Word)

 Copy code hover
[image]

Range.MoveStart Method (Word)
See also Send feedback

Published: July 16, 2012

Moves the start position of the specified range.

Syntax

expression .MoveStart(Unit, Count)

expression Required. A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
Unit | Optional | WdUnits | The unit by which start position of the specified range is to be moved.
Count | Optional | Variant | The maximum number of units by which the specified range is to be moved. If Count is a positive number, the start position of the range is moved forward in the document. If it is a negative number, the start position is moved backward. If the start position is moved forward to a position beyond the end position, the range is collapsed and both the start and end positions are moved together. The default value is 1.

Return Value

Integer

Remarks

This method returns an integer that indicates the number of units by which the start position or the range actually moved, or it returns 0 (zero) if the move was unsuccessful.

Example

This example sets myRange to be equal to the second word in the active document. The example uses the MoveStart method to move the start position of myRange (a Range object) backward one word. After this macro is run, the first and second words in the document are selected.

VBA Copy code Copy code
If ActiveDocument.Words.Count >= 2 Then
 Set myRange = ActiveDocument.Words(2)
 With myRange
 .MoveStart Unit:=wdWord, Count:=-1
 .Select
 End With
End If

See also

Concepts

Range Object

Other resources

Range Object Members


Range.MoveStartUntil Method (Word)

 Copy code hover
[image]

Range.MoveStartUntil Method (Word)
See also Send feedback

Published: July 16, 2012

Moves the start position of the specified range until one of the specified characters is found in the document.

Syntax

expression .MoveStartUntil(Cset, Count)

expression Required. A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
Cset | Required | Variant | One or more characters. This argument is case sensitive.
Count | Optional | Variant | The maximum number of characters by which the specified range is to be moved. Can be a number or either the wdForward or wdBackward constant. If Count is a positive number, the range is moved forward in the document. If it is a negative number, the range is moved backward. The default value is wdForward.

Remarks

If the movement is backward through the document, the range is expanded.

This method returns the number of characters by which the start position of the specified range moved, as a Long value. If Count is greater than 0 (zero), this method returns the number of characters moved plus 1. If Count is less than 0 (zero), this method returns the number of characters moved minus 1. If no Cset characters are found, the specified range isn't changed and the method returns 0 (zero). If the start position is moved forward to a point beyond the end position, the range is collapsed and both the start and end positions are moved together.

Example

If there is a dollar sign character ($) in the first paragraph in the selected text, this example moves myRange just before the dollar sign.

VBA Copy code Copy code
Set myRange = Selection.Paragraphs(1).Range
leng = myRange.End - myRange.Start
myRange.Collapse Direction:=wdCollapseStart
myRange.MoveStartUntil Cset:="$", Count:=leng

See also

Concepts

Range Object

Other resources

Range Object Members


Range.MoveStartWhile Method (Word)

 Copy code hover
[image]

Range.MoveStartWhile Method (Word)
See also Send feedback

Published: July 16, 2012

Moves the start position of the specified range while any of the specified characters are found in the document.

Syntax

expression .MoveStartWhile(Cset, Count)

expression Required. A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
Cset | Required | Variant | One or more characters. This argument is case sensitive.
Count | Optional | Variant | The maximum number of characters by which the specified range is to be moved. Can be a number or either the wdForward or wdBackward constant. If Count is a positive number, the range is moved forward in the document. If it is a negative number, the range is moved backward. The default value is wdForward.

Remarks

While any character in Cset is found, the start position of the range is moved. This method returns the number of characters that the start position of the range moved as a Long value. If not Cset characters are found, the range isn't changed and the method returns 0 (zero). If the start position is moved forward to a position beyond the original end position, the end position is set to the new start position.

Example

This example moves the start position of the selected range backward through the document while the space character is found.

VBA Copy code Copy code
Selection.Range.MoveStartWhile Cset:=" ", Count:=wdBackward

This example moves the start position of the selected range backward through the document while Count is less than or equal to 10 and any letter from "a" through "h" is found.

VBA Copy code Copy code
Selection.Range.MoveStartWhile Cset:="abcdefgh", Count:=-10

See also

Concepts

Range Object

Other resources

Range Object Members


Range.MoveUntil Method (Word)

 Copy code hover
[image]

Range.MoveUntil Method (Word)
See also Send feedback

Published: July 16, 2012

Moves the specified range until one of the specified characters is found in the document.

Syntax

expression .MoveUntil(Cset, Count)

expression Required. A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
Cset | Required | Variant | One or more characters. If any character in Cset is found before the Count value expires, the specified range is positioned as an insertion point immediately before that character. This argument is case sensitive.
Count | Optional | Variant | The maximum number of characters by which the specified range is to be moved. Can be a number or either the wdForward or wdBackward constant. If Count is a positive number, the range is moved forward in the document, beginning at the end position. If it is a negative number, the range is moved backward, beginning at the start position. The default value is wdForward.

Remarks

This method returns the number of characters by which the specified range was moved, as a Long value. If Count is greater than 0 (zero), this method returns the number of characters moved plus one. If Count is less than 0 (zero), this method returns the number of characters moved minus one. If no Cset characters are found, the range isn't not changed and the method returns 0 (zero).

Example

This example moves myRange forward through the next 100 characters in the document until the character "t" is found.

VBA Copy code Copy code
Set myRange = ActiveDocument.Words(1)
myRange.MoveUntil Cset:="t", Count:=100

See also

Concepts

Range Object

Other resources

Range Object Members


Range.MoveWhile Method (Word)

 Copy code hover
[image]

Range.MoveWhile Method (Word)
See also Send feedback

Published: July 16, 2012

Moves the specified range while any of the specified characters are found in the document.

Syntax

expression .MoveWhile(Cset, Count)

expression Required. A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
Cset | Required | Variant | One or more characters. This argument is case sensitive.
Count | Optional | Variant | The maximum number of characters by which the specified range is to be moved. Can be a number or either the wdForward or wdBackward constant. If Count is a positive number, the specified range is moved forward in the document, beginning at the end position. If it is a negative number, the range is moved backward, beginning at the start position. The default value is wdForward.

Remarks

While any character in Cset is found, the specified range is moved. The resulting Range object is positioned as an insertion point after whatever Cset characters were found. This method returns the number of characters by which the specified range was moved, as a Long value. If no Cset characters are found, the range isn't changed and the method returns 0 (zero).

Example

This example moves aRange while any of the following (uppercase or lowercase) letters are found: "a", "t", or "i".

VBA Copy code Copy code
Dim aRange As Range
Set aRange = ActiveDocument.Characters(1)
aRange.MoveWhile Cset:="atiATI", Count:=wdForward

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Next Method (Word)

 Copy code hover
[image]

Range.Next Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the specified unit relative to the specified range.

Syntax

expression .Next(Unit, Count)

expression Required. A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
Unit | Optional | Variant | The type of units by which to count. Can be any WdUnits constant.
Count | Optional | Variant | The number of units by which you want to move ahead. The default value is one.

Return Value

Range

Remarks

If the range is just before the specified Unit, the range is moved to the following unit. For example, if the range is just before a word, the following instruction moves the selected text forward to the following word.

VBA Copy code Copy code
Selection.Range.Next(Unit:=wdWord, Count:=1).Select

See also

Concepts

Range Object

Other resources

Range Object Members


Range.NextSubdocument Method (Word)

 Copy code hover
[image]

Range.NextSubdocument Method (Word)
See also Send feedback

Published: July 16, 2012

Moves the range to the next subdocument.

Syntax

expression .NextSubdocument

expression Required. A variable that represents a Range object.

Remarks

If there isn't another subdocument, an error occurs.

Example

This example switches the active document to master document view and selects the first subdocument.

VBA Copy code Copy code
If ActiveDocument.Subdocuments.Count >= 1 Then
 ActiveDocument.ActiveWindow.View.Type = wdMasterView
 Selection.HomeKey unit:=wdStory, Extend:=wdMove
 Selection.Range.NextSubdocument
End If

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Paste Method (Word)

 Copy code hover
[image]

Range.Paste Method (Word)
See also Send feedback

Published: July 16, 2012

Inserts the contents of the Clipboard at the specified range.

Syntax

expression .Paste

expression Required. A variable that represents a Range object.

Remarks

If you don't want to replace the contents of the range, use the Collapse method before using this method.

When you use this method with a Range object, the range expands to include the contents of the Clipboard.

Example

This example copies and pastes the first table in the active document into a new document.

VBA Copy code Copy code
If ActiveDocument.Tables.Count >= 1 Then
 ActiveDocument.Tables(1).Range.Copy
 Documents.Add.Content.Paste
End If

This example copies the selection and pastes it at the end of the document.

VBA Copy code Copy code
If Selection.Type <> wdSelectionIP Then
 Selection.Copy
 Set Range2 = ActiveDocument.Content
 Range2.Collapse Direction:=wdCollapseEnd
 Range2.Paste
End If

See also

Concepts

Range Object

Other resources

Range Object Members


Range.PasteAndFormat Method (Word)

 Copy code hover
[image]

Range.PasteAndFormat Method (Word)
See also Send feedback

Published: July 16, 2012

Pastes the selected table cells and formats them as specified.

Syntax

expression .PasteAndFormat(Type)

expression Required. A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
Type | Required | WdRecoveryType | The type of formatting to use when pasting the selected table cells.

Example

This example pastes a selected Microsoft Excel chart as a picture. This example assumes that the Clipboard contains an Excel chart.

VBA Copy code Copy code
Sub PasteChart()
 Selection.PasteAndFormat Type:=wdChartPicture
End Sub

See also

Concepts

Range Object

Other resources

Range Object Members


Range.PasteAppendTable Method (Word)

 Copy code hover
[image]

Range.PasteAppendTable Method (Word)
See also Send feedback

Published: July 16, 2012

Merges pasted cells into an existing table by inserting the pasted rows between the selected rows. No cells are overwritten.

Syntax

expression .PasteAppendTable

expression Required. A variable that represents a Range object.

Example

This example pastes table cells by inserting rows into the current table at the insertion point. This example assumes that the Clipboard contains a collection of table cells.

VBA Copy code Copy code
Sub PasteAppend
 Selection.PasteAppendTable
End Sub

See also

Concepts

Range Object

Other resources

Range Object Members


Range.PasteAsNestedTable Method (Word)

 Copy code hover
[image]

Range.PasteAsNestedTable Method (Word)
See also Send feedback

Published: July 16, 2012

Pastes a cell or group of cells as a nested table into the selected range.

Syntax

expression .PasteAsNestedTable

expression Required. A variable that represents a Range object.

Remarks

You can use PasteAsNestedTable only if the Clipboard contains a cell or group of cells and the selected range is a cell or group of cells in the current document.

Example

This example pastes the contents of the Clipboard into the third cell of the first table in the active document.

VBA Copy code Copy code
ActiveDocument.Tables(1).Rows(1).Cells(3).Range _
 .PasteAsNestedTable

See also

Concepts

Range Object

Other resources

Range Object Members


Range.PasteExcelTable Method (Word)

 Copy code hover
[image]

Range.PasteExcelTable Method (Word)
See also Send feedback

Published: July 16, 2012

Pastes and formats a Microsoft Excel table.

Syntax

expression .PasteExcelTable(LinkedToExcel, WordFormatting, RTF)

expression Required. A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
LinkedToExcel | Required | Boolean | True links the pasted table to the original Excel file so that changes made to the Excel file are reflected in Microsoft Word.
WordFormatting | Required | Boolean | True formats the table using the formatting in the Word document. False formats the table according to the original Excel file.
RTF | Required | Boolean | True pastes the Excel table using Rich Text Format (RTF). False pastes the Excel table as HTML.

Example

This example pastes an Excel table into the active document. The parameters specify that the pasted table is linked to the Excel file, retains the original Excel formatting, and is pasted as RTF. This example assumes that the Clipboard contains an Excel table.

VBA Copy code Copy code
Sub PasteExcelFormatted()
 Selection.PasteExcelTable _
 LinkedToExcel:=True, _
 WordFormatting:=False, _
 RTF:=True
End Sub

See also

Concepts

Range Object

Other resources

Range Object Members


Range.PasteSpecial Method (Word)

 Copy code hover
[image]

Range.PasteSpecial Method (Word)
See also Send feedback

Published: July 16, 2012

Inserts the contents of the Clipboard. .

Syntax

expression .PasteSpecial(IconIndex, Link, Placement, DisplayAsIcon, DataType, IconFileName, IconLabel)

expression Required. A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
IconIndex | Optional | Variant | If DisplayAsIcon is True, this argument is a number that corresponds to the icon you want to use in the program file specified by IconFilename. Icons appear in the Change Icon dialog box: 0 (zero) corresponds to the first icon, 1 corresponds to the second icon, and so on. If this argument is omitted, the first (default) icon is used.
Link | Optional | Variant | True to create a link to the source file of the Clipboard contents. The default value is False.
Placement | Optional | Variant | Can be either of the following WdOLEPlacement constants: wdFloatOverText or wdInLine. The default value is wdInLine.
DisplayAsIcon | Optional | Variant | True to display the link as an icon. The default value is False.
DataType | Optional | Variant | A format for the Clipboard contents when they're inserted into the document. Can be any WdPasteDataType constant.
IconFileName | Optional | Variant | If DisplayAsIcon is True, this argument is the path and file name for the file in which the icon to be displayed is stored.
IconLabel | Optional | Variant | If DisplayAsIcon is True, this argument is the text that appears below the icon.

Example

This example inserts the Clipboard contents at the insertion point as unformatted text.

VBA Copy code Copy code
Selection.Collapse Direction:=wdCollapseStart
Selection.Range.PasteSpecial DataType:=wdPasteText

This example copies the selected text and pastes it into a new document as a hyperlink. The source document must first be saved for this example to work.

VBA Copy code Copy code
If Selection.Type = wdSelectionNormal Then
 Selection.Copy
 Documents.Add.Content.PasteSpecial Link:=True, _
 DataType:=wdPasteHyperlink
End If

See also

Concepts

Range Object

Other resources

Range Object Members


Range.PhoneticGuide Method (Word)

 Copy code hover
[image]

Range.PhoneticGuide Method (Word)
See also Send feedback

Published: July 16, 2012

Adds phonetic guides to the specified range.

Syntax

expression .PhoneticGuide(Text, Alignment, Raise, FontSize, FontName)

expression Required. A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
Text | Required | String | The phonetic text to add.
Alignment | Optional | WdPhoneticGuideAlignmentType | The alignment of the added phonetic text.
Raise | Optional | Long | The distance (in points) from the top of the text in the specified range to the top of the phonetic text. If no value is specified, Microsoft Word automatically sets the phonetic text at an optimum distance above the specified range.
FontSize | Optional | Long | The font size to use for the phonetic text. If no value is specified, Word uses a font size 50 percent smaller than the text in the specified range.
FontName | Optional | String | The name of the font to use for the phonetic text. If no value is specified, Word uses the same font as the text in the specified range.

Remarks

For more information on using Word with East Asian languages, see Word features for East Asian languages.

Example

This example adds a phonetic guide to the selected phrase "tres chic."

VBA Copy code Copy code
Selection.Range.PhoneticGuide Text:="tray sheek", _
 Alignment:=wdPhoneticGuideAlignmentCenter, _
 Raise:=11, FontSize:=7

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Previous Method (Word)

 Copy code hover
[image]

Range.Previous Method (Word)
See also Send feedback

Published: July 16, 2012

Returns the previous range a relative to the specified range.

Syntax

expression .Previous(Unit, Count)

expression Required. A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
Unit | Optional | Variant | The type of units by which to count. Can be any WdUnits constant.
Count | Optional | Variant | The number of units by which you want to move back. The default value is 1.

Return Value

Range

Remarks

If the Range object is just after the specified Unit, the Range object is moved to the previous unit. For example, if the Range object is just after a word (before the trailing space), the following instruction moves the Range object backward to the previous word.

VBA Copy code Copy code
ActiveDocument.Words(2).Previous(Unit:=wdWord, Count:=1).Select

Example

This example applies bold formatting to the first word in the active document.

VBA Copy code Copy code
ActiveDocument.Words(2) _
 .Previous(Unit:=wdWord, Count:=1).Bold = True

See also

Concepts

Range Object

Other resources

Range Object Members


Range.PreviousSubdocument Method (Word)

 Copy code hover
[image]

Range.PreviousSubdocument Method (Word)
See also Send feedback

Published: July 16, 2012

Moves the range to the previous subdocument.

Syntax

expression .PreviousSubdocument

expression Required. A variable that represents a Range object.

Remarks

If there isn't another subdocument, an error occurs.

Example

This example switches the active document to master document view and selects the previous subdocument.

VBA Copy code Copy code
If ActiveDocument.Subdocuments.Count >= 1 Then
 ActiveDocument.ActiveWindow.View.Type = wdMasterView
 Selection.EndKey Unit:=wdStory, Extend:=wdMove
 Selection.PreviousSubdocument
End If

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Relocate Method (Word)

 Copy code hover
[image]

Range.Relocate Method (Word)
See also Send feedback

Published: July 16, 2012

In outline view, moves the paragraphs within the specified range after the next visible paragraph or before the previous visible paragraph.

Syntax

expression .Relocate(Direction)

expression Required. A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
Direction | Required | WdRelocate | The direction of the move.

Remarks

Body text moves with a heading only if the body text is collapsed in outline view or if it is part of the range.

Example

This example moves the third, fourth, and fifth paragraphs in the active document below the next (sixth) paragraph.

VBA Copy code Copy code
theStart = ActiveDocument.Paragraphs(3).Range.Start
theEnd = ActiveDocument.Paragraphs(5).Range.End
Set myRange = ActiveDocument.Range(Start:=theStart, End:=theEnd)
ActiveDocument.ActiveWindow.View.Type = wdOutlineView
myRange.Relocate Direction:=wdRelocateDown

This example moves the first paragraph in the selection above the previous paragraph.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.View.Type = wdOutlineView
Selection.Paragraphs(1).Range.Relocate Direction:=wdRelocateUp

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Select Method (Word)

 Copy code hover
[image]

Range.Select Method (Word)
See also Send feedback

Published: July 16, 2012

Selects the specified range.

Syntax

expression .Select

expression Required. A variable that represents a Range object.

Example

This example selects the first paragraph in the active document.

VBA Copy code Copy code
Sub SelectParagraph()
 ActiveDocument.Paragraphs(1).Range.Select
 Selection.Font.Bold = True
End Sub

See also

Concepts

Range Object

Other resources

Range Object Members


Range.SetListLevel Method (Word)

 Copy code hover
[image]

Range.SetListLevel Method (Word)
See also Send feedback

Published: July 16, 2012

Sets the list level for one or more items in a numbered list.

Syntax

expression .SetListLevel(Level)

expression An expression that returns a Range object.

Parameters

Name | Required/Optional | Data Type | Description
Level | Required | Integer | A number that indicates the new list level.

See also

Concepts

Range Object

Other resources

Range Object Members


Range.SetRange Method (Word)

 Copy code hover
[image]

Range.SetRange Method (Word)
See also Send feedback

Published: July 16, 2012

Sets the starting and ending character positions for an existing range.

Syntax

expression .SetRange(Start, End)

expression Required. A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
Start | Required | Long | The starting character position of the range.
End | Required | Long | The ending character position of the range.

Remarks

Character position values start at the beginning of the story, with the first value being 0 (zero). All characters are counted, including nonprinting characters. Hidden characters are counted even if they're not displayed.

The SetRange method redefines the starting and ending positions of an existing Range object. This method differs from the Range method, which is used to create a range, given a starting and ending position.

Example

This example uses SetRange to redefine myRange to refer to the first three paragraphs in the active document.

VBA Copy code Copy code
Set myRange = ActiveDocument.Paragraphs(1).Range
myRange.SetRange Start:=myRange.Start, _
 End:=ActiveDocument.Paragraphs(3).Range.End

This example uses SetRange to redefine myRange to refer to the area starting at the beginning of the document and ending at the end of the current selection.

VBA Copy code Copy code
Set myRange = ActiveDocument.Range(Start:=0, End:=0)
myRange.InsertAfter "Hello "
myRange.SetRange Start:=myRange.Start, End:=Selection.End

See also

Concepts

Range Object

Other resources

Range Object Members


Range.Sort Method (Word)

 Copy code hover
[image]

Range.Sort Method (Word)
See also Send feedback

Published: July 16, 2012

Sorts the paragraphs in the specified range.

Syntax

expression .Sort(ExcludeHeader, FieldNumber, SortFieldType, SortOrder, FieldNumber2, SortFieldType2, SortOrder2, FieldNumber3, SortFieldType3, SortOrder3, SortColumn, Separator, CaseSensitive, BidiSort, IgnoreThe, IgnoreKashida, IgnoreDiacritics, IgnoreHe, LanguageID)

expression Required. A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
ExcludeHeader | Optional | Variant | True to exclude the first row or paragraph header from the sort operation. The default value is False.
FieldNumber | Optional | Variant | The fields by which to sort. Microsoft Word sorts by FieldNumber, then by FieldNumber2, and then by FieldNumber3.
SortFieldType | Optional | Variant | The respective sort types for FieldNumber. Can be one of the WdSortFieldType constants. The default value is wdSortFieldAlphanumeric. Some of these constants may not be available to you, depending on the language support (U.S. English, for example) that you have selected or installed.
SortOrder | Optional | Variant | The sorting order to use when sorting FieldNumber. Can be any WdSortOrder constant.
FieldNumber2 | Optional | Variant | The fields by which to sort.
SortFieldType2 | Optional | Variant | The respective sort types for FieldNumber2. Can be one of the WdSortFieldType constants. The default value is wdSortFieldAlphanumeric. Some of these constants may not be available to you, depending on the language support (U.S. English, for example) that you have selected or installed.
SortOrder2 | Optional | Variant | The sorting order to use when sorting FieldNumber2. Can be any WdSortOrder constant.
FieldNumber3 | Optional | Variant | The fields by which to sort.
SortFieldType3 | Required |  | Some of these constants may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed. The default value is wdSortFieldAlphanumeric. Some of these constants may not be available to you, depending on the language support (U.S. English, for example) that you have selected or installed.
SortOrder3 | Optional | Variant | The sorting order to use when sorting FieldNumber3. Can be any WdSortOrder constant.
SortColumn | Optional | Variant | True to sort only the column specified by the Range object.
Separator | Optional | Variant | The type of field separator. Can be one of the WdSortSeparator constants.
CaseSensitive | Optional | Variant | True to sort with case sensitivity. The default value is False.
BidiSort | Optional | Variant | True to sort based on right-to-left language rules. This argument may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.
IgnoreThe | Optional | Variant | True to ignore the Arabic character alef lam when sorting right-to-left language text. This argument may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.
IgnoreKashida | Optional | Variant | True to ignore kashidas when sorting right-to-left language text. This argument may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.
IgnoreDiacritics | Optional | Variant | True to ignore bidirectional control characters when sorting right-to-left language text. This argument may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.
IgnoreHe | Optional | Variant | True to ignore the Hebrew character he when sorting right-to-left language text. This argument may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.
LanguageID | Optional | Variant | Specifies the sorting language. Can be one of the WdLanguageID constants. Refer to the Object Browser for a list of the WdLanguageID constants.

Example

This example inserts three lines of text into a new document and then sorts the lines in ascending alphanumeric order

VBA Copy code Copy code
Sub NewParagraphSort()
 Dim newDoc As Document
 Set newDoc = Documents.Add
 newDoc.Content.InsertAfter "pear" & Chr(13) _
 & "zucchini" & Chr(13) & "apple" & Chr(13)
 newDoc.Content.Sort SortOrder:=wdSortOrderAscending
End Sub

See also

Concepts

Range Object

Other resources

Range Object Members


Range.SortAscending Method (Word)

 Copy code hover
[image]

Range.SortAscending Method (Word)
See also Send feedback

Published: July 16, 2012

Sorts paragraphs or table rows in ascending alphanumeric order.

Syntax

expression .SortAscending

expression Required. A variable that represents a Range object.

Remarks

The first paragraph or table row is considered a header record and isn't included in the sort. Use the Sort method to include the header record in a sort.This method offers a simplified form of sorting intended for mail merge data sources that contain columns of data. For most sorting tasks, use the Sort method.

See also

Concepts

Range Object

Other resources

Range Object Members


Range.SortByHeadings Method (Word)

 Copy code hover
[image]

Range.SortByHeadings Method (Word)
See also Send feedback

Published: July 16, 2012

Sorts the headings in the specified range.

Version information

Version Added: Word 2013

Syntax

expression .SortByHeadings(SortFieldType,SortOrder,CaseSensitive,BidiSort,IgnoreThe,IgnoreKashida,IgnoreDiacritics,IgnoreHe,LanguageID)

expression A variable that represents a Range object.

Parameters

Name | Required/Optional | Data type | Description
SortFieldType | Optional | VARIANT | The sort field type to use. Can be one of the WdSortFieldType constants. The default value is wdSortFieldAlphanumeric. Depending on the language support (U.S. English, for example) that you have selected or installed, some of these constants may not be available to you.
SortOrder | Optional | VARIANT | The sorting order to use. Can be one of the WdSortOrder constants.
CaseSensitive | Optional | VARIANT | True to sort with case sensitivity. The default value is False.
BidiSort | Optional | VARIANT | True to sort based on right-to-left language rules. Depending on the language support (U.S. English, for example) that you have selected or installed, this parameter may not be available to you.
IgnoreThe | Optional | VARIANT | True to ignore the Arabic character alef lam when sorting right-to-left language text. Depending on the language support (U.S. English, for example) that you have selected or installed, this parameter may not be available to you.
IgnoreKashida | Optional | VARIANT | True to ignore kashidas when sorting right-to-left language text. Depending on the language support (U.S. English, for example) that you have selected or installed, this parameter may not be available to you.
IgnoreDiacritics | Optional | VARIANT | True to ignore bidirectional control characters when sorting right-to-left language text. Depending on the language support (U.S. English, for example) that you have selected or installed, this parameter may not be available to you.
IgnoreHe | Optional | VARIANT | True to ignore the Hebrew character he when sorting right-to-left language text. Depending on the language support (U.S. English, for example) that you have selected or installed, this parameter may not be available to you.
LanguageID | Optional | VARIANT | Specifies the sorting language. Can be one of the WdLanguageID constants.

Return value

VOID

See also

Concepts

Range Object

Other resources

Range Members


Range.SortDescending Method (Word)

 Copy code hover
[image]

Range.SortDescending Method (Word)
See also Send feedback

Published: July 16, 2012

Sorts paragraphs in descending alphanumeric order.

Syntax

expression .SortDescending

expression Required. A variable that represents a Range object.

Remarks

The first paragraph or table row is considered a header record and isn't included in the sort. Use the Sort method to include the header record in a sort.This method offers a simplified form of sorting intended for mail-merge data sources that contain columns of data. For most sorting tasks, use the Sort method.

See also

Concepts

Range Object

Other resources

Range Object Members


Range.StartOf Method (Word)

 Copy code hover
[image]

Range.StartOf Method (Word)
See also Send feedback

Published: July 16, 2012

Moves or extends the start position of the specified range or selection to the beginning of the nearest specified text unit. This method returns a Long that indicates the number of characters by which the range or selection was moved or extended. The method returns a negative number if the movement is backward through the document.

Syntax

expression .StartOf(Unit, Extend)

expression Required. A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
Unit | Optional | WdUnits | The unit by which the start position of the specified range or selection is to be moved. Can be any WdUnits constant except wdLine. The default value is wdWord.
Extend | Optional | WdMovement | Specifies whether to move or extend the start of the range. If you use wdMove, both ends of the range or selection are moved to the beginning of the specified unit. If you use wdExtend, the beginning of the range or selection is extended to the beginning of the specified unit. The default value is wdMove.

Remarks

If the beginning of the specified range or selection is already at the beginning of the specified unit, this method doesn't move or extend the range or selection. For example, if the selection is at the beginning of a line, the following example returns 0 (zero) and doesn't change the selection.

VBA Copy code Copy code
char = Selection.StartOf(Unit:=wdLine, Extend:=wdMove)

Example

This example selects the text from the insertion point to the beginning of the line. The number of characters selected is stored in charmoved.

VBA Copy code Copy code
Selection.Collapse Direction:=wdCollapseStart charmoved = Selection.StartOf(Unit:=wdLine, Extend:=wdExtend)

This example moves the selection to the beginning of the paragraph.

VBA Copy code Copy code
Selection.StartOf Unit:=wdParagraph, Extend:=wdMove

This example moves myRange to the beginning of the second sentence in the document (myRange is collapsed and positioned at the beginning of the second sentence). The example uses the Select method to show the location of myRange.

VBA Copy code Copy code
Set myRange = ActiveDocument.Sentences(2)
myRange.StartOf Unit:=wdSentence, Extend:=wdMove
myRange.Select

See also

Concepts

Range Object

Other resources

Range Object Members


Range.TCSCConverter Method (Word)

 Copy code hover
[image]

Range.TCSCConverter Method (Word)
See also Send feedback

Published: July 16, 2012

Converts the specified range from Traditional Chinese to Simplified Chinese or vice versa.

Syntax

expression .TCSCConverter(WdTCSCConverterDirection, CommonTerms, UseVariants)

expression Required. A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
WdTCSCConverterDirection | Optional | WdTCSCConverterDirection | Specifies the direction in which text is converted. If omitted, the default value is wdTCSCConverterDirectionAuto, which converts in the appropriate direction based on the detected language of the specified range.
UseVariants | Optional | Boolean | True if Word uses Taiwan, Hong Kong SAR, and Macao SAR character variants. Can only be used if translating from Simplified Chinese to Traditional Chinese.

Example

This example converts the current selection from Simplified Chinese to Traditional Chinese. It converts common expressions intact and uses regional character variants.

VBA Copy code Copy code
Selection.Range.TCSCConverter _
 wdTCSCConverterDirectionSCTC, True, True

See also

Concepts

Range Object

Other resources

Range Object Members


Range.WholeStory Method (Word)

 Copy code hover
[image]

Range.WholeStory Method (Word)
See also Send feedback

Published: July 16, 2012

Expands a range to include the entire story.

Syntax

expression .WholeStory

expression Required. A variable that represents a Range object.

Remarks

The following instructions, where myRange is a valid Range object, are functionally equivalent:

VBA Copy code Copy code
myRange.WholeStory
myRange.Expand Unit:=wdStory

Example

This example expands myRange to include the entire story and then applies the Arial font to the range.

VBA Copy code Copy code
Set myRange = Selection.Range
myRange.WholeStory
myRange.Font.Name = "Arial"

This example expands myRange to include the entire comments story (wdCommentsStory) and then copies the comments into a new document.

VBA Copy code Copy code
If ActiveDocument.Comments.Count >= 1 Then
 Set myRange = Activedocument.Comments(1).Range
 myRange.WholeStory
 myRange.Copy
 Documents.Add.Content.Paste
End If

See also

Concepts

Range Object

Other resources

Range Object Members


ReadabilityStatistic Object (Word)

 Copy code hover
[image]

ReadabilityStatistic Object (Word)
See also Send feedback

Published: July 16, 2012

Represents one of the readability statistics for a document or range. The ReadabilityStatistic object is a member of the ReadabilityStatistics collection.

Remarks

Use ReadabilityStatistics(Index), where Index is the index number, to return a single ReadabilityStatistic object. The statistics are ordered as follows: Words, Characters, Paragraphs, Sentences, Sentences per Paragraph, Words per Sentence, Characters per Word, Passive Sentences, Flesch Reading Ease, and Flesch-Kincaid Grade Level. The following example returns the character count for the active document.

VBA Copy code Copy code
Msgbox ActiveDocument.Content.ReadabilityStatistics(2).Value

See also

Concepts

Word Object Model Reference

Other resources

ReadabilityStatistic Object Members


ReadabilityStatistic Members (Word)

 Copy code hover
[image]

ReadabilityStatistic Members (Word)
Send feedback

Published: July 16, 2012

Represents one of the readability statistics for a document or range. The ReadabilityStatistic object is a member of the ReadabilityStatistics collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Name | Returns the name of the specified object. Read-only String.
Parent | Returns an Object that represents the parent object of the specified ReadabilityStatistic object.
Value | Returns the value of the grammar statistic. Read-only Long.


ReadabilityStatistic Properties (Word)

 Copy code hover
[image]

ReadabilityStatistic Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Name | Returns the name of the specified object. Read-only String.
Parent | Returns an Object that represents the parent object of the specified ReadabilityStatistic object.
Value | Returns the value of the grammar statistic. Read-only Long.


ReadabilityStatistic.Application Property (Word)

 Copy code hover
[image]

ReadabilityStatistic.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a ReadabilityStatistic object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

ReadabilityStatistic Object

Other resources

ReadabilityStatistic Object Members


ReadabilityStatistic.Creator Property (Word)

 Copy code hover
[image]

ReadabilityStatistic.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a ReadabilityStatistic object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

ReadabilityStatistic Object

Other resources

ReadabilityStatistic Object Members


ReadabilityStatistic.Name Property (Word)

 Copy code hover
[image]

ReadabilityStatistic.Name Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the name of the specified object. Read-only String.

Syntax

expression .Name

expression Required. A variable that represents a ReadabilityStatistic object.

See also

Concepts

ReadabilityStatistic Object

Other resources

ReadabilityStatistic Object Members


ReadabilityStatistic.Parent Property (Word)

 Copy code hover
[image]

ReadabilityStatistic.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified ReadabilityStatistic object.

Syntax

expression .Parent

expression Required. A variable that represents a ReadabilityStatistic object.

See also

Concepts

ReadabilityStatistic Object

Other resources

ReadabilityStatistic Object Members


ReadabilityStatistic.Value Property (Word)

 Copy code hover
[image]

ReadabilityStatistic.Value Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the value of the grammar statistic. Read-only Long.

Syntax

expression .Value

expression Required. A variable that represents a ReadabilityStatistic object.

Example

This example checks the grammar in the active document and then displays the Flesch reading-ease index.

VBA Copy code Copy code
ActiveDocument.CheckGrammar
MsgBox ActiveDocument.ReadabilityStatistics( _
 "Flesch Reading Ease").Value

See also

Concepts

ReadabilityStatistic Object

Other resources

ReadabilityStatistic Object Members


ReadabilityStatistics Object (Word)

 Copy code hover
[image]

ReadabilityStatistics Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of ReadabilityStatistic objects for a document or range.

Remarks

Use the ReadabilityStatistics property to return the ReadabilityStatistics collection. The following example enumerates the readability statistics for the selection and displays each one in a message box.

VBA Copy code Copy code
For each rs in Selection.Range.ReadabilityStatistics
 Msgbox rs.Name & " - " & rs.Value
Next rs

Use ReadabilityStatistics(Index), where Index is the index number, to return a single ReadabilityStatistic object. The statistics are ordered as follows: Words, Characters, Paragraphs, Sentences, Sentences per Paragraph, Words per Sentence, Characters per Word, Passive Sentences, Flesch Reading Ease, and Flesch-Kincaid Grade Level. The following example returns the word count for the active document.

VBA Copy code Copy code
Set myRange = ActiveDocument.Content
wordval = myRange.ReadabilityStatistics(1).Value
Msgbox wordval

See also

Concepts

Word Object Model Reference

Other resources

ReadabilityStatistics Object Members


ReadabilityStatistics Members (Word)

 Copy code hover
[image]

ReadabilityStatistics Members (Word)
Send feedback

Published: July 16, 2012

A collection of ReadabilityStatistic objects for a document or range.

Methods

Name | Description
Item | Returns an individual ReadabilityStatistic object in a collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of readability statistics in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified ReadabilityStatistics object.


ReadabilityStatistics Properties (Word)

 Copy code hover
[image]

ReadabilityStatistics Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of readability statistics in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified ReadabilityStatistics object.


ReadabilityStatistics.Application Property (Word)

 Copy code hover
[image]

ReadabilityStatistics.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a ReadabilityStatistics collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

ReadabilityStatistics Collection Object

Other resources

ReadabilityStatistics Object Members


ReadabilityStatistics.Count Property (Word)

 Copy code hover
[image]

ReadabilityStatistics.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of readability statistics in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents a ReadabilityStatistics collection.

See also

Concepts

ReadabilityStatistics Collection Object

Other resources

ReadabilityStatistics Object Members


ReadabilityStatistics.Creator Property (Word)

 Copy code hover
[image]

ReadabilityStatistics.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a ReadabilityStatistics collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

ReadabilityStatistics Collection Object

Other resources

ReadabilityStatistics Object Members


ReadabilityStatistics.Parent Property (Word)

 Copy code hover
[image]

ReadabilityStatistics.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified ReadabilityStatistics object.

Syntax

expression .Parent

expression Required. A variable that represents a ReadabilityStatistics collection.

See also

Concepts

ReadabilityStatistics Collection Object

Other resources

ReadabilityStatistics Object Members


ReadabilityStatistics Methods (Word)

 Copy code hover
[image]

ReadabilityStatistics Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Item | Returns an individual ReadabilityStatistic object in a collection.


ReadabilityStatistics.Item Method (Word)

 Copy code hover
[image]

ReadabilityStatistics.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual ReadabilityStatistic object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents a ReadabilityStatistics collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The individual object to be returned. Can be a Long indicating the ordinal position or a String representing the name of the individual object.

Return Value

ReadabilityStatistic

See also

Concepts

ReadabilityStatistics Collection Object

Other resources

ReadabilityStatistics Object Members


RecentFile Object (Word)

 Copy code hover
[image]

RecentFile Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a recently used file. The RecentFile object is a member of the RecentFiles collection.

Remarks

The RecentFiles collection includes all the files that have been used recently. The items in the RecentFiles collection are displayed at the bottom of the File menu.

Use RecentFiles(Index), where Index is the index number, to return a single RecentFile object. The index number represents the position of the file on the File menu. The following example opens the first document in the RecentFiles collection.

VBA Copy code Copy code
If RecentFiles.Count >= 1 Then RecentFiles(1).Open

Use the Add method to add a file to the RecentFiles collection. The following example adds the active document to the list of recently-used files.

VBA Copy code Copy code
If ActiveDocument.Saved = True Then
 RecentFiles.Add Document:=ActiveDocument.FullName, _
 ReadOnly:=True
End If

The SaveAs and Open methods include an AddToRecentFiles argument that controls whether or not a file is added to the recently-used-files list when the file is opened or saved.

See also

Concepts

Word Object Model Reference

Other resources

RecentFile Object Members


RecentFile Members (Word)

 Copy code hover
[image]

RecentFile Members (Word)
Send feedback

Published: July 16, 2012

Represents a recently used file. The RecentFile object is a member of the RecentFiles collection.

Methods

Name | Description
Delete | Deletes the specified file on the list of recent files.
Open | Opens the specified object. Returns a Document object representing the opened document.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Index | Returns a Long that represents the position of an item in a collection. Read-only.
Name | Returns the name of the specified object. Read-only String.
Parent | Returns an Object that represents the parent object of the specified RecentFile object.
Path | Returns the disk or Web path to the specified object. Read-only String.
ReadOnly | True if changes to the document cannot be saved to the original document. Read/write Boolean.


RecentFile Properties (Word)

 Copy code hover
[image]

RecentFile Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Index | Returns a Long that represents the position of an item in a collection. Read-only.
Name | Returns the name of the specified object. Read-only String.
Parent | Returns an Object that represents the parent object of the specified RecentFile object.
Path | Returns the disk or Web path to the specified object. Read-only String.
ReadOnly | True if changes to the document cannot be saved to the original document. Read/write Boolean.


RecentFile.Application Property (Word)

 Copy code hover
[image]

RecentFile.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a RecentFile object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

RecentFile Object

Other resources

RecentFile Object Members


RecentFile.Creator Property (Word)

 Copy code hover
[image]

RecentFile.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a RecentFile object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

RecentFile Object

Other resources

RecentFile Object Members


RecentFile.Index Property (Word)

 Copy code hover
[image]

RecentFile.Index Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the position of an item in a collection. Read-only.

Syntax

expression .Index

expression Required. A variable that represents a RecentFile object.

See also

Concepts

RecentFile Object

Other resources

RecentFile Object Members


RecentFile.Name Property (Word)

 Copy code hover
[image]

RecentFile.Name Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the name of the specified object. Read-only String.

Syntax

expression .Name

expression Required. A variable that represents a RecentFile object.

See also

Concepts

RecentFile Object

Other resources

RecentFile Object Members


RecentFile.Parent Property (Word)

 Copy code hover
[image]

RecentFile.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified RecentFile object.

Syntax

expression .Parent

expression Required. A variable that represents a RecentFile object.

See also

Concepts

RecentFile Object

Other resources

RecentFile Object Members


RecentFile.Path Property (Word)

 Copy code hover
[image]

RecentFile.Path Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the disk or Web path to the specified object. Read-only String.

Syntax

expression .Path

expression Required. A variable that represents a RecentFile object.

Remarks

The path doesn't include a trailing character — for example, "C:\MSOffice" or "http://MyServer". Use the PathSeparator property to add the character that separates folders and drive letters. Use the Name property to return the file name without the path.

See also

Concepts

RecentFile Object

Other resources

RecentFile Object Members


RecentFile.ReadOnly Property (Word)

 Copy code hover
[image]

RecentFile.ReadOnly Property (Word)
See also Send feedback

Published: July 16, 2012

True if changes to the document cannot be saved to the original document. Read/write Boolean.

Syntax

expression .ReadOnly

expression Required. A variable that represents a RecentFile object.

Example

This example opens the most recently used file as a read-only document.

VBA Copy code Copy code
With RecentFiles(1)
 .ReadOnly = True
 .Open
End With

See also

Concepts

RecentFile Object

Other resources

RecentFile Object Members


RecentFile Methods (Word)

 Copy code hover
[image]

RecentFile Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the specified file on the list of recent files.
Open | Opens the specified object. Returns a Document object representing the opened document.


RecentFile.Delete Method (Word)

 Copy code hover
[image]

RecentFile.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the specified file on the list of recent files.

Syntax

expression .Delete

expression Required. A variable that represents a RecentFile object.

See also

Concepts

RecentFile Object

Other resources

RecentFile Object Members


RecentFile.Open Method (Word)

 Copy code hover
[image]

RecentFile.Open Method (Word)
See also Send feedback

Published: July 16, 2012

Opens the specified object. Returns a Document object representing the opened document.

Syntax

expression .Open

expression Required. A variable that represents a RecentFile object.

Return Value

Document

Example

This example opens each document in the RecentFiles collection.

VBA Copy code Copy code
Sub OpenRecentFiles()
 Dim rFile As RecentFile
 For Each rFile In RecentFiles
 rFile.Open
 Next rFile
End Sub

See also

Concepts

RecentFile Object

Other resources

RecentFile Object Members


RecentFiles Object (Word)

 Copy code hover
[image]

RecentFiles Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of RecentFile objects that represents the files that have been used recently. The items in the RecentFiles collection are displayed at the bottom of the File menu.

Remarks

Use the RecentFiles property to return the RecentFiles collection. The following example sets five as the maximum number of files that the RecentFiles collection can contain.

VBA Copy code Copy code
RecentFiles.Maximum = 5

Use the Add method to add a file to the RecentFiles collection. The following example adds the active document to the list of recently-used files.

VBA Copy code Copy code
If ActiveDocument.Saved = True Then
 RecentFiles.Add Document:=ActiveDocument.FullName, _
 ReadOnly:=True
End If

Use RecentFiles(Index), where Index is the index number, to return a single RecentFile object. The index number represents the position of the file on the File menu. The following example opens the first document in the RecentFiles collection.

VBA Copy code Copy code
If RecentFiles.Count >= 1 Then RecentFiles(1).Open

The SaveAs and Open methods include an AddToRecentFiles argument that controls whether or not a file is added to the recently-used-files list when the file is opened or saved.

See also

Concepts

Word Object Model Reference

Other resources

RecentFiles Object Members


RecentFiles Members (Word)

 Copy code hover
[image]

RecentFiles Members (Word)
Send feedback

Published: July 16, 2012

A collection of RecentFile objects that represents the files that have been used recently. The items in the RecentFiles collection are displayed at the bottom of the File menu.

Methods

Name | Description
Add | Returns a RecentFile object that represents a file added to the list of recently used files.
Item | Returns an individual RecentFile object in a collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of recent files in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Maximum | Returns or sets the maximum number of recently used files that can appear on the File menu. Can be a number from 0 (zero) through 9. Read/write Long.
Parent | Returns an Object that represents the parent object of the specified RecentFiles object.


RecentFiles Properties (Word)

 Copy code hover
[image]

RecentFiles Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of recent files in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Maximum | Returns or sets the maximum number of recently used files that can appear on the File menu. Can be a number from 0 (zero) through 9. Read/write Long.
Parent | Returns an Object that represents the parent object of the specified RecentFiles object.


RecentFiles.Application Property (Word)

 Copy code hover
[image]

RecentFiles.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a RecentFiles collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

RecentFiles Collection Object

Other resources

RecentFiles Object Members


RecentFiles.Count Property (Word)

 Copy code hover
[image]

RecentFiles.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of recent files in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents a RecentFiles collection.

See also

Concepts

RecentFiles Collection Object

Other resources

RecentFiles Object Members


RecentFiles.Creator Property (Word)

 Copy code hover
[image]

RecentFiles.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a RecentFiles collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

RecentFiles Collection Object

Other resources

RecentFiles Object Members


RecentFiles.Maximum Property (Word)

 Copy code hover
[image]

RecentFiles.Maximum Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the maximum number of recently used files that can appear on the File menu. Can be a number from 0 (zero) through 9. Read/write Long.

Syntax

expression .Maximum

expression Required. A variable that represents a RecentFiles collection.

Example

This example disables the list of most recently used files.

VBA Copy code Copy code
RecentFiles.Maximum = 0

This example increases the number of items on the list of most recently used files by 1.

VBA Copy code Copy code
num = RecentFiles.Maximum
If num <> 9 Then RecentFiles.Maximum = num + 1

See also

Concepts

RecentFiles Collection Object

Other resources

RecentFiles Object Members


RecentFiles.Parent Property (Word)

 Copy code hover
[image]

RecentFiles.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified RecentFiles object.

Syntax

expression .Parent

expression Required. A variable that represents a RecentFiles collection.

See also

Concepts

RecentFiles Collection Object

Other resources

RecentFiles Object Members


RecentFiles Methods (Word)

 Copy code hover
[image]

RecentFiles Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Returns a RecentFile object that represents a file added to the list of recently used files.
Item | Returns an individual RecentFile object in a collection.


RecentFiles.Add Method (Word)

 Copy code hover
[image]

RecentFiles.Add Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a RecentFile object that represents a file added to the list of recently used files.

Syntax

expression .Add(Document, ReadOnly)

expression Required. A variable that represents a RecentFiles collection.

Parameters

Name | Required/Optional | Data Type | Description
Document | Required | Variant | The document you want to add to the list of recently used files. You can specify this argument by using either the string name for the document or a Document object.
ReadOnly | Optional | Variant | True to make the document read-only.

Return Value

RecentFile

Example

This example adds the active document to the list of recently used files.

VBA Copy code Copy code
If ActiveDocument.Saved = True Then
 RecentFiles.Add Document:=ActiveDocument.Name
End If

See also

Concepts

RecentFiles Collection Object

Other resources

RecentFiles Object Members


RecentFiles.Item Method (Word)

 Copy code hover
[image]

RecentFiles.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual RecentFile object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents a RecentFiles collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The individual object to be returned. Can be a Long indicating the ordinal position of the individual object.

Return Value

RecentFile

See also

Concepts

RecentFiles Collection Object

Other resources

RecentFiles Object Members


Rectangle Object (Word)

 Copy code hover
[image]

Rectangle Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a portion of text or a graphic in a page. Use the Rectangle object and related methods and properties for programmatically defining page layout in a document.

Remarks

Use the Item method to return a specific Rectangle object. The following example accesses the first rectangle in the first page of the active document.

VBA Copy code Copy code
Dim objRectangle As Rectangle

Set objRectangle = ActiveDocument.ActiveWindow _
 .Panes(1).Pages(1).Rectangles.Item(1)

Use the RectangleType property to determine the type of rectangle. The following example creates a ShapeRange object if the specified rectangle is a shape.

Copy code Copy code
Dim objRectangle As Rectangle
Dim objShape As ShapeRange

Set objRectangle = ActiveDocument.ActiveWindow _
 .Panes(1).Pages(1).Rectangles.Item(1)

If objRectangle.RectangleType = wdShapeRectangle Then
 Set objShape = objRectangle.Range.ShapeRange
End If

See also

Concepts

Word Object Model Reference

Other resources

Rectangle Object Members


Rectangle Members (Word)

 Copy code hover
[image]

Rectangle Members (Word)
Send feedback

Published: July 16, 2012

Represents a portion of text or a graphic in a page. Use the Rectangle object and related methods and properties for programmatically defining page layout in a document.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Height | Returns a Long that represents the height of a rectangle, in pixels.
Left | Returns a Long that represents the number of pixels from the left edge of the page to the left edge of a rectangle.
Lines | Returns a Lines collection that represents the lines in a specified portion of text in a page.
Parent | Returns an Object that represents the parent object of the specified Rectangle object.
Range | Returns a Range object that represents the portion of a document that is contained within a rectangle.
RectangleType | Returns a WdRectangleType constant that represents the type for the specified rectangle.
Top | Returns a Long that represents the number of pixels from the top of the page to the top of a rectangle.
Width | Returns or sets a Long that represents the width, in points, of a rectangle. Read/write Long.


Rectangle Properties (Word)

 Copy code hover
[image]

Rectangle Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Height | Returns a Long that represents the height of a rectangle, in pixels.
Left | Returns a Long that represents the number of pixels from the left edge of the page to the left edge of a rectangle.
Lines | Returns a Lines collection that represents the lines in a specified portion of text in a page.
Parent | Returns an Object that represents the parent object of the specified Rectangle object.
Range | Returns a Range object that represents the portion of a document that is contained within a rectangle.
RectangleType | Returns a WdRectangleType constant that represents the type for the specified rectangle.
Top | Returns a Long that represents the number of pixels from the top of the page to the top of a rectangle.
Width | Returns or sets a Long that represents the width, in points, of a rectangle. Read/write Long.


Rectangle.Application Property (Word)

 Copy code hover
[image]

Rectangle.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a Rectangle object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

Rectangle Object

Other resources

Rectangle Object Members


Rectangle.Creator Property (Word)

 Copy code hover
[image]

Rectangle.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a Rectangle object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Rectangle Object

Other resources

Rectangle Object Members


Rectangle.Height Property (Word)

 Copy code hover
[image]

Rectangle.Height Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the height of a rectangle, in pixels.

Syntax

expression .Top

expression An expression that represents a Rectangle object.

See also

Concepts

Rectangle Object

Other resources

Rectangle Object Members


Rectangle.Left Property (Word)

 Copy code hover
[image]

Rectangle.Left Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of pixels from the left edge of the page to the left edge of a rectangle.

Syntax

expression .Left

expression An expression that represents a Rectangle object.

See also

Concepts

Rectangle Object

Other resources

Rectangle Object Members


Rectangle.Lines Property (Word)

 Copy code hover
[image]

Rectangle.Lines Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Lines collection that represents the lines in a specified portion of text in a page.

Syntax

expression .Lines

expression An expression that returns a Rectangle object.

Remarks

Use the Lines collection and related objects and properties to programmatically define page layout in a document.

Example

The following example accesses the collection of lines in the first rectangle in the first page of the active document if the specified rectangle contains text.

VBA Copy code Copy code
Dim objRectangle As Rectangle
Dim objLines As Lines

Set objRectangle = ActiveDocument.ActiveWindow _
 .Panes(1).Pages(1).Rectangles(1)

If objRectangle.RectangleType = wdTextRectangle Then _
 Set objLines = objRectangle.Lines

See also

Concepts

Rectangle Object

Other resources

Rectangle Object Members


Rectangle.Parent Property (Word)

 Copy code hover
[image]

Rectangle.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Rectangle object.

Syntax

expression .Parent

expression Required. A variable that represents a Rectangle object.

See also

Concepts

Rectangle Object

Other resources

Rectangle Object Members


Rectangle.Range Property (Word)

 Copy code hover
[image]

Rectangle.Range Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the portion of a document that is contained within a rectangle.

Syntax

expression .Range

expression Required. A variable that represents a Rectangle object.

See also

Concepts

Rectangle Object

Other resources

Rectangle Object Members


Rectangle.RectangleType Property (Word)

 Copy code hover
[image]

Rectangle.RectangleType Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a WdRectangleType constant that represents the type for the specified rectangle.

Syntax

expression .RectangleType

expression Required. A variable that represents a Rectangle object.

Remarks

Rectangles in Microsoft Word are sections within a page in a document that contain specific types of information. Some sections are portions of text; others are shapes. The purpose of rectangles is to allow more control over programmatic page layout.

Example

The following example accesses the first rectangle on the first page in the active document, and if it is a text rectangle, checks the spelling.

VBA Copy code Copy code
Dim objRectangle As Rectangle

Set objRectangle = ActiveDocument.ActiveWindow _
 .Panes(1).Pages(1).Rectangles(1)

If objRectangle.RectangleType = wdTextRectangle Then
 objRectangle.Range.CheckSpelling
End If

See also

Concepts

Rectangle Object

Other resources

Rectangle Object Members


Rectangle.Top Property (Word)

 Copy code hover
[image]

Rectangle.Top Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of pixels from the top of the page to the top of a rectangle.

Syntax

expression .Top

expression An expression that represents a Rectangle object.

See also

Concepts

Rectangle Object

Other resources

Rectangle Object Members


Rectangle.Width Property (Word)

 Copy code hover
[image]

Rectangle.Width Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Long that represents the width, in points, of a rectangle. Read/write Long.

Syntax

expression .Width

expression A variable that represents a Rectangle object.

See also

Concepts

Rectangle Object

Other resources

Rectangle Object Members


Rectangles Object (Word)

 Copy code hover
[image]

Rectangles Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of Rectangle objects in a page that represent portions of text and graphics. Use the Rectangles collection and related objects and properties for programmatically defining page layout in a document.

Remarks

Use the Rectangles property to return a Rectangles collection. The following example returns the Rectangles collection for the first page in the active document.

VBA Copy code Copy code
Dim objRectangles As Rectangles

Set objRectangles = ActiveDocument.ActiveWindow _
 .Panes(1).Pages(1).Rectangles

See also

Concepts

Word Object Model Reference

Other resources

Rectangles Object Members


Rectangles Members (Word)

 Copy code hover
[image]

Rectangles Members (Word)
Send feedback

Published: July 16, 2012

A collection of Rectangle objects in a page that represent portions of text and graphics. Use the Rectangles collection and related objects and properties for programmatically defining page layout in a document.

Methods

Name | Description
Item | Returns an individual Rectangle object in a collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of rectangles in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified Rectangles object.


Rectangles Properties (Word)

 Copy code hover
[image]

Rectangles Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of rectangles in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified Rectangles object.


Rectangles.Application Property (Word)

 Copy code hover
[image]

Rectangles.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a Rectangles collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

Rectangles Collection

Other resources

Rectangles Object Members


Rectangles.Count Property (Word)

 Copy code hover
[image]

Rectangles.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of rectangles in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents a Rectangles collection.

See also

Concepts

Rectangles Collection

Other resources

Rectangles Object Members


Rectangles.Creator Property (Word)

 Copy code hover
[image]

Rectangles.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a Rectangles collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Rectangles Collection

Other resources

Rectangles Object Members


Rectangles.Parent Property (Word)

 Copy code hover
[image]

Rectangles.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Rectangles object.

Syntax

expression .Parent

expression Required. A variable that represents a Rectangles collection.

See also

Concepts

Rectangles Collection

Other resources

Rectangles Object Members


Rectangles Methods (Word)

 Copy code hover
[image]

Rectangles Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Item | Returns an individual Rectangle object in a collection.


Rectangles.Item Method (Word)

 Copy code hover
[image]

Rectangles.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual Rectangle object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents a Rectangles collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The individual object to be returned. Can be a Long indicating the ordinal position of the individual object.

Return Value

Rectangle

See also

Concepts

Rectangles Collection

Other resources

Rectangles Object Members


ReflectionFormat Object (Word)

 Copy code hover
[image]

ReflectionFormat Object (Word)
See also Send feedback

Published: July 16, 2012

Represents the reflection formatting for a shape or range of shapes.

Version Information

Version Added: Word 2007

See also

Concepts

Word Object Model Reference

Other resources

ReflectionFormat Object Members


ReflectionFormat Members (Word)

 Copy code hover
[image]

ReflectionFormat Members (Word)
Send feedback

Published: July 16, 2012

Represents the reflection formatting for a shape or range of shapes.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application. Read-only.
Blur | Returns or sets a Single that specifies the degree of blur effect applied to the specified object. Read/write.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Offset | Returns or sets the amount of separation, in points, of the reflected image from the shape. Read/write.
Parent | Returns an Object that represents the parent object of the specified ReflectionFormat object.
Size | Returns or sets the size of the reflection as a percentage of the reflected shape from 0 to 100. Read/write.
Transparency | Returns or sets the degree of transparency for the reflection effect as a value between 0.0 (opaque) and 1.0 (clear). Read/write Single.
Type | Returns or sets an MsoLightRigType constant that represents the type and direction of the lighting for a shape reflection. Read/write.


ReflectionFormat Properties (Word)

 Copy code hover
[image]

ReflectionFormat Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application. Read-only.
Blur | Returns or sets a Single that specifies the degree of blur effect applied to the specified object. Read/write.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Offset | Returns or sets the amount of separation, in points, of the reflected image from the shape. Read/write.
Parent | Returns an Object that represents the parent object of the specified ReflectionFormat object.
Size | Returns or sets the size of the reflection as a percentage of the reflected shape from 0 to 100. Read/write.
Transparency | Returns or sets the degree of transparency for the reflection effect as a value between 0.0 (opaque) and 1.0 (clear). Read/write Single.
Type | Returns or sets an MsoLightRigType constant that represents the type and direction of the lighting for a shape reflection. Read/write.


ReflectionFormat.Application Property (Word)

 Copy code hover
[image]

ReflectionFormat.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .Application

expression An expression that returns a ReflectionFormat object.

See also

Concepts

ReflectionFormat Object

Other resources

ReflectionFormat Object Members


ReflectionFormat.Blur Property (Word)

 Copy code hover
[image]

ReflectionFormat.Blur Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Single that specifies the degree of blur effect applied to the specified object. Read/write.

Version Information

Version Added: Word 2010

Syntax

expression .Blur

expression A variable that represents a ReflectionFormat object.

See also

Concepts

ReflectionFormat Object

Other resources

ReflectionFormat Object Members


ReflectionFormat.Creator Property (Word)

 Copy code hover
[image]

ReflectionFormat.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version Information

Version Added: Word 2010

Syntax

expression .Creator

expression An expression that returns a ReflectionFormat object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD". This property was primarily designed to be used on the Apple Macintosh, where each application has a four-character creator code. For example, Word has the creator code MSWD. For more information about this property, see the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

ReflectionFormat Object

Other resources

ReflectionFormat Object Members


ReflectionFormat.Offset Property (Word)

 Copy code hover
[image]

ReflectionFormat.Offset Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the amount of separation, in points, of the reflected image from the shape. Read/write.

Version Information

Version Added: Word 2010

Syntax

expression .Offset

expression An expression that returns a ReflectionFormat object.

Return Value

Single

See also

Concepts

ReflectionFormat Object

Other resources

ReflectionFormat Object Members


ReflectionFormat.Parent Property (Word)

 Copy code hover
[image]

ReflectionFormat.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified ReflectionFormat object.

Version Information

Version Added: Word 2010

Syntax

expression .Parent

expression An expression that returns a ReflectionFormat object.

See also

Concepts

ReflectionFormat Object

Other resources

ReflectionFormat Object Members


ReflectionFormat.Size Property (Word)

 Copy code hover
[image]

ReflectionFormat.Size Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the size of the reflection as a percentage of the reflected shape from 0 to 100. Read/write.

Version Information

Version Added: Word 2010

Syntax

expression .Size

expression An expression that returns a ReflectionFormat object.

See also

Concepts

ReflectionFormat Object

Other resources

ReflectionFormat Object Members


ReflectionFormat.Transparency Property (Word)

 Copy code hover
[image]

ReflectionFormat.Transparency Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the degree of transparency for the reflection effect as a value between 0.0 (opaque) and 1.0 (clear). Read/write Single.

Version Information

Version Added: Word 2010

Syntax

expression .Transparency

expression An expression that returns a ReflectionFormat object.

See also

Concepts

ReflectionFormat Object

Other resources

ReflectionFormat Object Members


ReflectionFormat.Type Property (Word)

 Copy code hover
[image]

ReflectionFormat.Type Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets an MsoLightRigType constant that represents the type and direction of the lighting for a shape reflection. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .Type

expression An expression that returns a ReflectionFormat object.

See also

Concepts

ReflectionFormat Object

Other resources

ReflectionFormat Object Members


RepeatingSectionItem Object (Word)

 Copy code hover
[image]

RepeatingSectionItem Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a repeating section item in a content control.

Version information

Version Added: Word 2013

Remarks

To get a RepeatingSectionItem object, use the Item method of the RepeatingSectionItemColl collection.

You can insert additional repeating section items before or after the specified repeating section item by using the InsertItemBefore or InsertItemAfter methods. To delete the specified repeating section item, use the Delete method. To get the range of the specified repeating section item, use the Range property.

See also

Other resources

RepeatingSectionItem Members


RepeatingSectionItem Members (Word)

 Copy code hover
[image]

RepeatingSectionItem Members (Word)
Send feedback

Published: July 16, 2012

Represents a repeating section item in a content control.

Methods

Name | Description
Delete | Deletes the specified repeating section item.
InsertItemAfter | Adds a repeating section item after the specified item and returns the new item.
InsertItemBefore | Adds a repeating section item before the specified item and returns the new item.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified RepeatingSectionItem object.
Range | Returns the range of the specified repeating section item, excluding the start and end tags. Read-only.


RepeatingSectionItem Properties (Word)

 Copy code hover
[image]

RepeatingSectionItem Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified RepeatingSectionItem object.
Range | Returns the range of the specified repeating section item, excluding the start and end tags. Read-only.


RepeatingSectionItem.Application Property (Word)

 Copy code hover
[image]

RepeatingSectionItem.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Version information

Version Added: Word 2013

Syntax

expression .Application

expression A variable that represents a RepeatingSectionItem object.

Property value

APPLICATION

See also

Other resources

RepeatingSectionItem Object Members


RepeatingSectionItem.Creator Property (Word)

 Copy code hover
[image]

RepeatingSectionItem.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version information

Version Added: Word 2013

Syntax

expression .Creator

expression A variable that represents a RepeatingSectionItem object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

Property value

INT32

See also

Other resources

RepeatingSectionItem Object
RepeatingSectionItem Object Members


RepeatingSectionItem.Parent Property (Word)

 Copy code hover
[image]

RepeatingSectionItem.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified RepeatingSectionItem object.

Version information

Version Added: Word 2013

Syntax

expression .Parent

expression A variable that represents a RepeatingSectionItem object.

Property value

OBJECT

See also

Other resources

RepeatingSectionItem Object
RepeatingSectionItem Object Members


RepeatingSectionItem.Range Property (Word)

 Copy code hover
[image]

RepeatingSectionItem.Range Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the range of the specified repeating section item, excluding the start and end tags. Read-only.

Version information

Version Added: Word 2013

Syntax

expression .Range

expression A variable that represents a RepeatingSectionItem object.

Property value

RANGE

See also

Other resources

RepeatingSectionItem Object
RepeatingSectionItem Object Members


RepeatingSectionItem Methods (Word)

 Copy code hover
[image]

RepeatingSectionItem Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the specified repeating section item.
InsertItemAfter | Adds a repeating section item after the specified item and returns the new item.
InsertItemBefore | Adds a repeating section item before the specified item and returns the new item.


RepeatingSectionItem.Delete Method (Word)

 Copy code hover
[image]

RepeatingSectionItem.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the specified repeating section item.

Version information

Version Added: Word 2013

Syntax

expression .Delete

expression A variable that represents a RepeatingSectionItem object.

Return value

VOID

See also

Other resources

RepeatingSectionItem Object
RepeatingSectionItem Object Members


RepeatingSectionItem.InsertItemAfter Method (Word)

 Copy code hover
[image]

RepeatingSectionItem.InsertItemAfter Method (Word)
See also Send feedback

Published: July 16, 2012

Adds a repeating section item after the specified item and returns the new item.

Version information

Version Added: Word 2013

Syntax

expression .InsertItemAfter

expression A variable that represents a RepeatingSectionItem object.

Return value

REPEATINGSECTIONITEM

Remarks

You can call this method on repeating section item content controls only.

If the ContentControl.AllowInsertDeleteSection property is set to False, this method will return an error.

See also

Other resources

RepeatingSectionItem Object
RepeatingSectionItem Object Members


RepeatingSectionItem.InsertItemBefore Method (Word)

 Copy code hover
[image]

RepeatingSectionItem.InsertItemBefore Method (Word)
See also Send feedback

Published: July 16, 2012

Adds a repeating section item before the specified item and returns the new item.

Version information

Version Added: Word 2013

Syntax

expression .InsertItemBefore

expression A variable that represents a RepeatingSectionItem object.

Return value

REPEATINGSECTIONITEM

Remarks

You can call this method on repeating section item content controls only.

If the ContentControl.AllowInsertDeleteSection property is set to False, this method will return an error.

See also

Other resources

RepeatingSectionItem Object
RepeatingSectionItem Object Members


RepeatingSectionItemColl Object (Word)

 Copy code hover
[image]

RepeatingSectionItemColl Object (Word)
See also Send feedback

Published: July 16, 2012

Represents the collection of RepeatingSectionItem objects.

Version information

Version Added: Word 2013

See also

Other resources

RepeatingSectionItemColl Members


RepeatingSectionItemColl Members (Word)

 Copy code hover
[image]

RepeatingSectionItemColl Members (Word)
Send feedback

Published: July 16, 2012

Represents the collection of RepeatingSectionItem objects.

Methods

Name | Description
Item | Returns an individual repeating section item.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of repeating section items in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified RepeatingSectionItemColl object.


RepeatingSectionItemColl Properties (Word)

 Copy code hover
[image]

RepeatingSectionItemColl Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of repeating section items in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified RepeatingSectionItemColl object.


RepeatingSectionItemColl.Application Property (Word)

 Copy code hover
[image]

RepeatingSectionItemColl.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Version information

Version Added: Word 2013

Syntax

expression .Application

expression A variable that represents a RepeatingSectionItemColl object.

Property value

APPLICATION

See also

Other resources

RepeatingSectionItemColl Object Members


RepeatingSectionItemColl.Count Property (Word)

 Copy code hover
[image]

RepeatingSectionItemColl.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of repeating section items in the collection. Read-only.

Version information

Version Added: Word 2013

Syntax

expression .Count

expression A variable that represents a RepeatingSectionItemColl object.

Property value

INT32

See also

Other resources

RepeatingSectionItemColl Object Members


RepeatingSectionItemColl.Creator Property (Word)

 Copy code hover
[image]

RepeatingSectionItemColl.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version information

Version Added: Word 2013

Syntax

expression .Creator

expression A variable that represents a RepeatingSectionItemColl object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

Property value

INT32

See also

Other resources

RepeatingSectionItemColl Object
RepeatingSectionItemColl Object Members


RepeatingSectionItemColl.Parent Property (Word)

 Copy code hover
[image]

RepeatingSectionItemColl.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified RepeatingSectionItemColl object.

Version information

Version Added: Word 2013

Syntax

expression .Parent

expression A variable that represents a RepeatingSectionItemColl object.

Property value

OBJECT

See also

Other resources

RepeatingSectionItemColl Object
RepeatingSectionItemColl Object Members


RepeatingSectionItemColl Methods (Word)

 Copy code hover
[image]

RepeatingSectionItemColl Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Item | Returns an individual repeating section item.


RepeatingSectionItemColl.Item Method (Word)

 Copy code hover
[image]

RepeatingSectionItemColl.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual repeating section item.

Version information

Version Added: Word 2013

Syntax

expression .Item(Index)

expression A variable that represents a RepeatingSectionItemColl object.

Parameters

Name | Required/Optional | Data type | Description
Index | Required | INT32 | The index number of the item in the collection.

Return value

REPEATINGSECTIONITEM

See also

Other resources

RepeatingSectionItemColl Object
RepeatingSectionItemColl Members


Replacement Object (Word)

 Copy code hover
[image]

Replacement Object (Word)
See also Send feedback

Published: July 16, 2012

Represents the replace criteria for a find-and-replace operation. The properties and methods of the Replacement object correspond to the options in the Find and Replace dialog box.

Remarks

Use the Replacement property to return a Replacement object. The following example replaces the next occurrence of the word "hi" with the word "hello."

VBA Copy code Copy code
With Selection.Find
 .Text = "hi"
 .ClearFormatting
 .Replacement.Text = "hello"
 .Replacement.ClearFormatting
 .Execute Replace:=wdReplaceOne, Forward:=True
End With

To find and replace formatting, set both the find text and the replace text to empty strings ("") and set the Format argument of the Execute method to True. The following example removes all the bold formatting in the active document. The Bold property is True for the Find object and False for the Replacement object.

VBA Copy code Copy code
With ActiveDocument.Content.Find
 .ClearFormatting
 .Font.Bold = True
 .Text = ""
 With .Replacement
 .ClearFormatting
 .Font.Bold = False
 .Text = ""
 End With
 .Execute Format:=True, Replace:=wdReplaceAll
End With

See also

Concepts

Word Object Model Reference

Other resources

Replacement Object Members


Replacement Members (Word)

 Copy code hover
[image]

Replacement Members (Word)
Send feedback

Published: July 16, 2012

Represents the replace criteria for a find-and-replace operation. The properties and methods of the Replacement object correspond to the options in the Find and Replace dialog box.

Methods

Name | Description
ClearFormatting | Removes text and paragraph formatting from the text specified in a replace operation.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Font | Returns or sets a Font object that represents the character formatting of the specified object. Read/write Font.
Frame | Returns a Frame object that represents the frame formatting for the specified style or find-and-replace operation. Read-only.
Highlight | True if highlight formatting is applied to the replacement text. Read/write Long.
LanguageID | Returns or sets a WdLanguageID constant that represents the language for the specified range. Read/write.
LanguageIDFarEast | Returns or sets an East Asian language for the specified replacement. Read/write WdLanguageID.
NoProofing | True if Microsoft Word replaces text that the spelling and grammar checker ignores. Read/write Long.
ParagraphFormat | Returns or sets a ParagraphFormat object that represents the paragraph settings for the specified replacement operation. Read/write.
Parent | Returns an Object that represents the parent object of the specified Replacement object.
Style | Returns or sets the style for the specified object. To set this property, specify the local name of the style, an integer, a WdBuiltinStyle constant, or an object that represents the style. Read/write Variant.
Text | Returns or sets the text to replace. Read/write String.


Replacement Properties (Word)

 Copy code hover
[image]

Replacement Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Font | Returns or sets a Font object that represents the character formatting of the specified object. Read/write Font.
Frame | Returns a Frame object that represents the frame formatting for the specified style or find-and-replace operation. Read-only.
Highlight | True if highlight formatting is applied to the replacement text. Read/write Long.
LanguageID | Returns or sets a WdLanguageID constant that represents the language for the specified range. Read/write.
LanguageIDFarEast | Returns or sets an East Asian language for the specified replacement. Read/write WdLanguageID.
NoProofing | True if Microsoft Word replaces text that the spelling and grammar checker ignores. Read/write Long.
ParagraphFormat | Returns or sets a ParagraphFormat object that represents the paragraph settings for the specified replacement operation. Read/write.
Parent | Returns an Object that represents the parent object of the specified Replacement object.
Style | Returns or sets the style for the specified object. To set this property, specify the local name of the style, an integer, a WdBuiltinStyle constant, or an object that represents the style. Read/write Variant.
Text | Returns or sets the text to replace. Read/write String.


Replacement.Application Property (Word)

 Copy code hover
[image]

Replacement.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a Replacement object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

Replacement Object

Other resources

Replacement Object Members


Replacement.Creator Property (Word)

 Copy code hover
[image]

Replacement.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a Replacement object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Replacement Object

Other resources

Replacement Object Members


Replacement.Font Property (Word)

 Copy code hover
[image]

Replacement.Font Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Font object that represents the character formatting of the specified object. Read/write Font.

Syntax

expression .Font

expression A variable that represents a Replacement object.

Remarks

To set this property, specify an expression that returns a Font object.

See also

Concepts

Replacement Object

Other resources

Replacement Object Members


Replacement.Frame Property (Word)

 Copy code hover
[image]

Replacement.Frame Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Frame object that represents the frame formatting for the specified style or find-and-replace operation. Read-only.

Syntax

expression .Frame

expression A variable that represents a Replacement object.

See also

Concepts

Replacement Object

Other resources

Replacement Object Members


Replacement.Highlight Property (Word)

 Copy code hover
[image]

Replacement.Highlight Property (Word)
See also Send feedback

Published: July 16, 2012

True if highlight formatting is applied to the replacement text. Read/write Long.

Syntax

expression .Highlight

expression A variable that represents a Replacement object.

Remarks

Can return or be set to True, False, or wdUndefined.

Example

This example finds all instances of highlighted text in the active document and removes the highlight formatting by setting the Highlight property of the Replacement object to False.

VBA Copy code Copy code
Dim rngTemp As Range

Set rngTemp = ActiveDocument.Range(Start:=0, End:=0)
With rngTemp.Find
 .ClearFormatting
 .Highlight = True
 With .Replacement
 .ClearFormatting
 .Highlight = False
 End With
 .Execute Replace:=wdReplaceAll, Forward:=True, FindText:="", _
 ReplaceWith:="", Format:=True
End With

See also

Concepts

Replacement Object

Other resources

Replacement Object Members


Replacement.LanguageID Property (Word)

 Copy code hover
[image]

Replacement.LanguageID Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a WdLanguageID constant that represents the language for the specified range. Read/write.

Syntax

expression .LanguageID

expression An expression that represents a Replacement object.

Remarks

Some of the WdLanguageID constants may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.

See also

Concepts

Replacement Object

Other resources

Replacement Object Members


Replacement.LanguageIDFarEast Property (Word)

 Copy code hover
[image]

Replacement.LanguageIDFarEast Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets an East Asian language for the specified replacement. Read/write WdLanguageID.

Syntax

expression .LanguageIDFarEast

expression Required. A variable that represents a Replacement object.

Remarks

This is the recommended way to return or set the language of East Asian text in a document created in an East Asian version of Microsoft Word.

Example

This example sets the language of the selection to Korean.

VBA Copy code Copy code
Selection.LanguageIDFarEast = wdKorean

See also

Concepts

Replacement Object

Other resources

Replacement Object Members


Replacement.NoProofing Property (Word)

 Copy code hover
[image]

Replacement.NoProofing Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word replaces text that the spelling and grammar checker ignores. Read/write Long.

Syntax

expression .NoProofing

expression A variable that represents a Replacement object.

See also

Concepts

Replacement Object

Other resources

Replacement Object Members


Replacement.ParagraphFormat Property (Word)

 Copy code hover
[image]

Replacement.ParagraphFormat Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a ParagraphFormat object that represents the paragraph settings for the specified replacement operation. Read/write.

Syntax

expression .ParagraphFormat

expression A variable that represents a Replacement object.

Example

This example finds all double-spaced paragraphs in the active document and replaces the formatting with 1.5-line spacing.

VBA Copy code Copy code
With ActiveDocument.Content.Find
 .ClearFormatting
 .ParagraphFormat.Space2
 .Replacement.ClearFormatting
 .Replacement.ParagraphFormat.Space15
 .Execute FindText:="", ReplaceWith:="", _
 Replace:=wdReplaceAll
End With

See also

Concepts

Replacement Object

Other resources

Replacement Object Members


Replacement.Parent Property (Word)

 Copy code hover
[image]

Replacement.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Replacement object.

Syntax

expression .Parent

expression Required. A variable that represents a Replacement object.

See also

Concepts

Replacement Object

Other resources

Replacement Object Members


Replacement.Style Property (Word)

 Copy code hover
[image]

Replacement.Style Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the style for the specified object. To set this property, specify the local name of the style, an integer, a WdBuiltinStyle constant, or an object that represents the style. Read/write Variant.

Syntax

expression .Style

expression Required. A variable that represents a Replacement object.

Remarks

When you return the style for a range that includes more than one style, only the first character or paragraph style is returned.

See also

Concepts

Replacement Object

Other resources

Replacement Object Members


Replacement.Text Property (Word)

 Copy code hover
[image]

Replacement.Text Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the text to replace. Read/write String.

Syntax

expression .Text

expression A variable that represents a Replacement object.

Example

This example replaces "Hello" with "Goodbye" in the active document.

VBA Copy code Copy code
Set myRange = ActiveDocument.Content
With myRange.Find
 .ClearFormatting
 .Replacement.ClearFormatting
 .Text = "Hello"
 .Replacement.Text = "Goodbye"
 .Execute Replace:=wdReplaceAll
End With

See also

Concepts

Replacement Object

Other resources

Replacement Object Members


Replacement Methods (Word)

 Copy code hover
[image]

Replacement Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
ClearFormatting | Removes text and paragraph formatting from the text specified in a replace operation.


Replacement.ClearFormatting Method (Word)

 Copy code hover
[image]

Replacement.ClearFormatting Method (Word)
See also Send feedback

Published: July 16, 2012

Removes text and paragraph formatting from the text specified in a replace operation.

Syntax

expression .ClearFormatting

expression A variable that represents a Replacement object.

Example

This example clears formatting from the find or replace criteria before replacing the word "Inc." with "incorporated" throughout the active document.

VBA Copy code Copy code
Sub ClrFmtgReplace()
 Dim rngTemp As Range
 Set rngTemp = ActiveDocument.Content
 With rngTemp.Find
 .ClearFormatting
 .Replacement.ClearFormatting
 .MatchWholeWord = True
 .Execute FindText:="Inc.", ReplaceWith:="incorporated", _
 Replace:=wdReplaceAll
 End With
End Sub

See also

Concepts

Replacement Object

Other resources

Replacement Object Members


Research Object (Word)

 Copy code hover
[image]

Research Object (Word)
See also Send feedback

Published: July 16, 2012

Provides access to the research service feature of Microsoft Word.

Version Information

Version Added: Word 2007

See also

Concepts

Word Object Model Reference

Other resources

Research Object Members


Research Members (Word)

 Copy code hover
[image]

Research Members (Word)
Send feedback

Published: July 16, 2012

Provides access to the research service feature of Microsoft Word.

Methods

Name | Description
IsResearchService | Indicates whether the GUID specified in the ServiceID parameter corresponds to a currently configured service.
Query | Specifies a research query.
SetLanguagePair | Sets the languages for the translation service.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
FavoriteService | Returns or sets a String that specifies the favorite research service.
Parent | Returns an Object that represents the parent object of the specified Research object.


Research Properties (Word)

 Copy code hover
[image]

Research Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
FavoriteService | Returns or sets a String that specifies the favorite research service.
Parent | Returns an Object that represents the parent object of the specified Research object.


Research.Application Property (Word)

 Copy code hover
[image]

Research.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a Research object.

See also

Concepts

Research Object

Other resources

Research Object Members


Research.Creator Property (Word)

 Copy code hover
[image]

Research.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.

Syntax

expression .Creator

expression An expression that returns an Research object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

Research Object

Other resources

Research Object Members


Research.FavoriteService Property (Word)

 Copy code hover
[image]

Research.FavoriteService Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a String that specifies the favorite research service.

Version Information

Version Added: Word 2010

Syntax

expression .FavoriteService

expression An expression that returns a Research object.

Remarks

The String that is set or returned for this property specifies the GUID of the favorite research service.

Setting this property has the same effect as choosing a favorite research service through the Research Options dialog in Word 2010.

Note Note

The GUIDs for all installed research services can be located in the HKCU\Software\Microsoft\Office\14.0\Common\Research\Sources registry key.

Example

The following code example changes the favorite research service to "Encarta Dictionary: English (North America)".

VBA Copy code Copy code
Dim objResearch As Research

Sub MyFunction()

Set objResearch = Research

'Set the favorite service
objResearch.FavoriteService = "FEF89077-4F4D-4803-A8BF-228083F70EAA"

End Sub

See also

Concepts

Research Object

Other resources

Research Object Members


Research.Parent Property (Word)

 Copy code hover
[image]

Research.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Research object.

Syntax

expression .Parent

expression A variable that represents a Research object.

See also

Concepts

Research Object

Other resources

Research Object Members


Research Methods (Word)

 Copy code hover
[image]

Research Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
IsResearchService | Indicates whether the GUID specified in the ServiceID parameter corresponds to a currently configured service.
Query | Specifies a research query.
SetLanguagePair | Sets the languages for the translation service.


Research.IsResearchService Method (Word)

 Copy code hover
[image]

Research.IsResearchService Method (Word)
See also Send feedback

Published: July 16, 2012

Indicates whether the GUID specified in the ServiceID parameter corresponds to a currently configured service.

Syntax

expression .IsResearchService(ServiceID)

expression An expression that returns a Research object.

Parameters

Name | Required/Optional | Data Type | Description
ServiceID | Required | String | Specifies a GUID that identifies the research service.

Return Value

Boolean

See also

Concepts

Research Object

Other resources

Research Object Members


Research.Query Method (Word)

 Copy code hover
[image]

Research.Query Method (Word)
See also Send feedback

Published: July 16, 2012

Specifies a research query.

Syntax

expression .Query(ServiceID, QueryString, QueryLanguage, UseSelection, RequeryContextXML, NewQueryContextXML, LaunchQuery)

expression An expression that returns a Research object.

Parameters

Name | Required/Optional | Data Type | Description
ServiceID | Required | String | Specifies a GUID that identifies the research service.
QueryString | Optional | String | Specifies the query string.
QueryLanguage | Optional | WdLanguageID | Specifies the query language of the query string.
UseSelection | Optional | Boolean | True to use the current selection as the query string. This overrides the QueryString parameter if set. Default value is False.
LaunchQuery | Optional | Boolean | True launches the query. False displays the Research task pane scoped to search the specified research service.

Return Value

Variant

See also

Concepts

Research Object

Other resources

Research Object Members


Research.SetLanguagePair Method (Word)

 Copy code hover
[image]

Research.SetLanguagePair Method (Word)
See also Send feedback

Published: July 16, 2012

Sets the languages for the translation service.

Syntax

expression .SetLanguagePair(LanguageFrom, LanguageTo)

expression An expression that returns a Research object.

Parameters

Name | Required/Optional | Data Type | Description
LanguageFrom | Required | WdLanguageID | Specifies the language to translate from.
LanguageTo | Required | WdLanguageID | Specifies the langauge to translate to.

Return Value

Variant

See also

Concepts

Research Object

Other resources

Research Object Members


Reviewer Object (Word)

 Copy code hover
[image]

Reviewer Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a single reviewer of a document in which changes have been tracked. The Reviewer object is a member of the Reviewers collection.

Remarks

Use Reviewers(Index), where Index is the name or number of the reviewer, to return a Reviewer object. Use the Visible property to display or hide individual reviewers in a document. The following code example hides the reviewer named "Jeff Smith" and displays the reviewer named "Judy Lew." This assumes that "Jeff Smith" and "Judy Lew" are members of the Reviewers collection. If they are not, you will receive an error.

VBA Copy code Copy code
Sub ShowHide()
 With ActiveWindow.View
 .Reviewers("Jeff Smith").Visible = False
 .Reviewers("Judy Lew").Visible = True
 End With
End Sub

See also

Concepts

Word Object Model Reference

Other resources

Reviewer Object Members


Reviewer Members (Word)

 Copy code hover
[image]

Reviewer Members (Word)
Send feedback

Published: July 16, 2012

Represents a single reviewer of a document in which changes have been tracked. The Reviewer object is a member of the Reviewers collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified Reviewer object.
Visible | True if the specified object is visible. Read/write Boolean.


Reviewer Properties (Word)

 Copy code hover
[image]

Reviewer Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified Reviewer object.
Visible | True if the specified object is visible. Read/write Boolean.


Reviewer.Application Property (Word)

 Copy code hover
[image]

Reviewer.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .Application

expression An expression that returns a Reviewer object.

See also

Concepts

Reviewer Object

Other resources

Reviewer Object Members


Reviewer.Creator Property (Word)

 Copy code hover
[image]

Reviewer.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version Information

Version Added: Word 2010

Syntax

expression .Creator

expression An expression that returns a Reviewer object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD". This property was primarily designed to be used on the Apple Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For more information about this property, see the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

Reviewer Object

Other resources

Reviewer Object Members


Reviewer.Parent Property (Word)

 Copy code hover
[image]

Reviewer.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Reviewer object.

Version Information

Version Added: Word 2010

Syntax

expression .Parent

expression An expression that returns a Reviewer object.

See also

Concepts

Reviewer Object

Other resources

Reviewer Object Members


Reviewer.Visible Property (Word)

 Copy code hover
[image]

Reviewer.Visible Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified object is visible. Read/write Boolean.

Syntax

expression .Visible

expression Required. A variable that represents a Reviewer object.

Remarks

Some methods and properties may be unavailable if the Visible property is False.

See also

Concepts

Reviewer Object

Other resources

Reviewer Object Members


Reviewers Object (Word)

 Copy code hover
[image]

Reviewers Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of Reviewer objects that represents the reviewers of one or more documents. The Reviewers collection contains the names of all reviewers who have reviewed documents opened or edited on a computer.

Remarks

Use Reviewers(Index), where Index is the name or index number of the reviewer, to return a single reviewer in the Reviewers collection. This example hides revisions made by the first reviewer in the Reviewers collection.

VBA Copy code Copy code
Sub HideAuthorRevisions(blnRev As Boolean)
 ActiveWindow.View.Reviewers(Index:=1) _
 .Visible = False
End Sub

See also

Concepts

Word Object Model Reference

Other resources

Reviewers Object Members


Reviewers Members (Word)

 Copy code hover
[image]

Reviewers Members (Word)
Send feedback

Published: July 16, 2012

A collection of Reviewer objects that represents the reviewers of one or more documents. The Reviewers collection contains the names of all reviewers who have reviewed documents opened or edited on a computer.

Methods

Name | Description
Item | Returns an individual Reviewer object in a collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of reviewers in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified Reviewers object.


Reviewers Properties (Word)

 Copy code hover
[image]

Reviewers Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of reviewers in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified Reviewers object.


Reviewers.Application Property (Word)

 Copy code hover
[image]

Reviewers.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a Reviewers collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

Reviewers Collection

Other resources

Reviewers Object Members


Reviewers.Count Property (Word)

 Copy code hover
[image]

Reviewers.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of reviewers in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents a Reviewers collection.

See also

Concepts

Reviewers Collection

Other resources

Reviewers Object Members


Reviewers.Creator Property (Word)

 Copy code hover
[image]

Reviewers.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a Reviewers collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Reviewers Collection

Other resources

Reviewers Object Members


Reviewers.Parent Property (Word)

 Copy code hover
[image]

Reviewers.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Reviewers object.

Syntax

expression .Parent

expression Required. A variable that represents a Reviewers collection.

See also

Concepts

Reviewers Collection

Other resources

Reviewers Object Members


Reviewers Methods (Word)

 Copy code hover
[image]

Reviewers Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Item | Returns an individual Reviewer object in a collection.


Reviewers.Item Method (Word)

 Copy code hover
[image]

Reviewers.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual Reviewer object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents a Reviewers collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The individual object to be returned. Can be a Long indicating the ordinal position or a String representing the name of the individual object.

Return Value

Reviewer

See also

Concepts

Reviewers Collection

Other resources

Reviewers Object Members


Revision Object (Word)

 Copy code hover
[image]

Revision Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a change marked with a revision mark. The Revision object is a member of the Revisions collection. The Revisions collection includes all the revision marks in a range or document.

Remarks

Use Revisions(Index), where Index is the index number, to return a single Revision object. The index number represents the position of the revision in the range or document. The following example displays the author name for the first revision in section one of the active document.

VBA Copy code Copy code
MsgBox ActiveDocument.Sections(1).Range.Revisions(1).Author

The Add method isn't available for the Revisions collection. Revision objects are added when change tracking is enabled. Set the TrackRevisions property to True to track revisions made to the document text. The following example enables revision tracking and then inserts "Action " before the selection.

VBA Copy code Copy code
ActiveDocument.TrackRevisions = True
Selection.InsertBefore "Action "

See also

Concepts

Word Object Model Reference

Other resources

Revision Object Members


Revision Members (Word)

 Copy code hover
[image]

Revision Members (Word)
Send feedback

Published: July 16, 2012

Represents a change marked with a revision mark. The Revision object is a member of the Revisions collection. The Revisions collection includes all the revision marks in a range or document.

Methods

Name | Description
Accept | Accepts the specified tracked change, removes the revision mark, and incorporates the change into the document.
Reject | Rejects the specified tracked change. The revision marks are removed, leaving the original text intact.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Author | Returns the name of the user who made the specified tracked change. Read-only String.
Cells | Returns a Cells collection that represents the table cells that have been marked with revision marks. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Date | The date and time that the tracked change was made. Read-only Date.
FormatDescription | Returns a String representing a description of tracked formatting changes in a revision. Read-only.
Index | Returns a Long that represents the position of an item in a collection. Read-only.
MovedRange | Returns a Range object that represents a range of text that was moved from one place to another in a document with tracked changes. Read-only.
Parent | Returns an Object that represents the parent object of the specified Revision object.
Range | Returns a Range object that represents the portion of a document that's contained within a revision mark.
Style | Returns a Style object that represents the style associated with a revision mark.
Type | Returns the revision type. Read-only WdRevisionType.


Revision Properties (Word)

 Copy code hover
[image]

Revision Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Author | Returns the name of the user who made the specified tracked change. Read-only String.
Cells | Returns a Cells collection that represents the table cells that have been marked with revision marks. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Date | The date and time that the tracked change was made. Read-only Date.
FormatDescription | Returns a String representing a description of tracked formatting changes in a revision. Read-only.
Index | Returns a Long that represents the position of an item in a collection. Read-only.
MovedRange | Returns a Range object that represents a range of text that was moved from one place to another in a document with tracked changes. Read-only.
Parent | Returns an Object that represents the parent object of the specified Revision object.
Range | Returns a Range object that represents the portion of a document that's contained within a revision mark.
Style | Returns a Style object that represents the style associated with a revision mark.
Type | Returns the revision type. Read-only WdRevisionType.


Revision.Application Property (Word)

 Copy code hover
[image]

Revision.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a Revision object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

Revision Object

Other resources

Revision Object Members


Revision.Author Property (Word)

 Copy code hover
[image]

Revision.Author Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the name of the user who made the specified tracked change. Read-only String.

Syntax

expression .Author

expression Required. A variable that represents a Revision object.

Example

This example displays the author name for the first tracked change in the first selected section.

VBA Copy code Copy code
Dim rngSection as Range

Set rngSection = Selection.Sections(1).Range
MsgBox "Revisions made by " & rngSection.Revisions(1).Author

See also

Concepts

Revision Object

Other resources

Revision Object Members


Revision.Cells Property (Word)

 Copy code hover
[image]

Revision.Cells Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Cells collection that represents the table cells that have been marked with revision marks. Read-only.

Syntax

expression .Cells

expression A variable that represents a Revision object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

See also

Concepts

Revision Object

Other resources

Revision Object Members


Revision.Creator Property (Word)

 Copy code hover
[image]

Revision.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a Revision object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Revision Object

Other resources

Revision Object Members


Revision.Date Property (Word)

 Copy code hover
[image]

Revision.Date Property (Word)
See also Send feedback

Published: July 16, 2012

The date and time that the tracked change was made. Read-only Date.

Syntax

expression .Date

expression A variable that represents a Revision object.

Example

This example displays the date and time of the next tracked change found in the active document.

VBA Copy code Copy code
Dim revTemp As Revision

If ActiveDocument.Revisions.Count >= 1 Then
 Set revTemp = Selection.NextRevision
 If Not (revTemp Is Nothing) Then MsgBox revTemp.Date
End If

See also

Concepts

Revision Object

Other resources

Revision Object Members


Revision.FormatDescription Property (Word)

 Copy code hover
[image]

Revision.FormatDescription Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a String representing a description of tracked formatting changes in a revision. Read-only.

Syntax

expression .FormatDescription

expression An expression that returns a Revision object.

Example

This example displays a description for each of the formatting changes made in a document with tracked changes.

VBA Copy code Copy code
Sub FmtChanges()
 Dim revFmtRev As Revision

 For Each revFmtRev In ActiveDocument.Revisions
 If revFmtRev.FormatDescription <> "" Then
 MsgBox "Format changes made : " & revFmtRev.FormatDescription
 End If
 Next
End Sub

See also

Concepts

Revision Object

Other resources

Revision Object Members


Revision.Index Property (Word)

 Copy code hover
[image]

Revision.Index Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the position of an item in a collection. Read-only.

Syntax

expression .Index

expression Required. A variable that represents a Revision object.

See also

Concepts

Revision Object

Other resources

Revision Object Members


Revision.MovedRange Property (Word)

 Copy code hover
[image]

Revision.MovedRange Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents a range of text that was moved from one place to another in a document with tracked changes. Read-only.

Syntax

expression .MovedRange

expression An expression that returns a Revision object.

See also

Concepts

Revision Object

Other resources

Revision Object Members


Revision.Parent Property (Word)

 Copy code hover
[image]

Revision.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Revision object.

Syntax

expression .Parent

expression Required. A variable that represents a Revision object.

See also

Concepts

Revision Object

Other resources

Revision Object Members


Revision.Range Property (Word)

 Copy code hover
[image]

Revision.Range Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the portion of a document that's contained within a revision mark.

Syntax

expression .Range

expression Required. A variable that represents a Revision object.

See also

Concepts

Revision Object

Other resources

Revision Object Members


Revision.Style Property (Word)

 Copy code hover
[image]

Revision.Style Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Style object that represents the style associated with a revision mark.

Syntax

expression .Style

expression Required. A variable that represents a Revision object.

See also

Concepts

Revision Object

Other resources

Revision Object Members


Revision.Type Property (Word)

 Copy code hover
[image]

Revision.Type Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the revision type. Read-only WdRevisionType.

Syntax

expression .Type

expression Required. A variable that represents a Revision object.

Example

This example accepts the next revision in the active document if the revision type is inserted text.

VBA Copy code Copy code
Set myRev = Selection.NextRevision
If Not (myRev Is Nothing) Then
 If myRev.Type = wdRevisionInsert Then myRev.Accept
End If

See also

Concepts

Revision Object

Other resources

Revision Object Members


Revision Methods (Word)

 Copy code hover
[image]

Revision Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Accept | Accepts the specified tracked change, removes the revision mark, and incorporates the change into the document.
Reject | Rejects the specified tracked change. The revision marks are removed, leaving the original text intact.


Revision.Accept Method (Word)

 Copy code hover
[image]

Revision.Accept Method (Word)
See also Send feedback

Published: July 16, 2012

Accepts the specified tracked change, removes the revision mark, and incorporates the change into the document.

Syntax

expression .Accept

expression Required. A variable that represents a Revision object.

Example

This example accepts the next tracked change found if the change type is inserted text.

VBA Copy code Copy code
Set revNext = Selection.NextRevision(Wrap:=True)

If Not (revNext Is Nothing) Then
 If revNext.Type = wdRevisionInsert Then revNext.Accept
End If

This example accepts all the tracked changes in the selection.

VBA Copy code Copy code
Dim revLoop As Revision
Dim rngSelection As Range

Set rngSelection = Selection.Range
For Each revLoop In rngSelection.Revisions
 revLoop.Accept
Next revLoop

See also

Concepts

Revision Object

Other resources

Revision Object Members


Revision.Reject Method (Word)

 Copy code hover
[image]

Revision.Reject Method (Word)
See also Send feedback

Published: July 16, 2012

Rejects the specified tracked change. The revision marks are removed, leaving the original text intact.

Syntax

expression .Reject

expression Required. A variable that represents a Revision object.

Remarks

Formatting changes cannot be rejected.

Example

This example rejects the next tracked change found in the active document.

VBA Copy code Copy code
Dim revNext As Revision

If ActiveDocument.Revisions.Count >= 1 Then
 Set revNext = Selection.NextRevision
 If Not (revNext Is Nothing) Then revNext.Reject
End If

This example rejects the tracked changes in the first paragraph.

VBA Copy code Copy code
Dim rngTemp As Range
Dim revLoop As Revision

Set rngTemp = ActiveDocument.Paragraphs(1).Range
For Each revLoop In rngTemp.Revisions
 revLoop.Reject
Next revLoop

This example rejects the first tracked change in the selection.

VBA Copy code Copy code
Dim rngTemp As Range

Set rngTemp = Selection.Range
If rngTemp.Revisions.Count >= 1 Then _
 rngTemp.Revisions(1).Reject

See also

Concepts

Revision Object

Other resources

Revision Object Members


Revisions Object (Word)

 Copy code hover
[image]

Revisions Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of Revision objects that represent the changes marked with revision marks in a range or document.

Remarks

Use the Revisions property to return the Revisions collection. The following code example displays the number of revisions in the main text story.

VBA Copy code Copy code
MsgBox ActiveDocument.Revisions.Count

The following code example accepts all the revisions in the selection.

VBA Copy code Copy code
For Each myRev In Selection.Range.Revisions
 myRev.Accept
Next myRev

The following code example accepts all the revisions in the first paragraph in the selection.

VBA Copy code Copy code
Set myRange = Selection.Paragraphs(1).Range
myRange.Revisions.AcceptAll

The Add method is not available for the Revisions collection. Revision objects are added when change tracking is enabled. Set the TrackRevisions property to True to track revisions made to the document text. The following code example enables revision tracking in the active document and then inserts "The " before the selection.

VBA Copy code Copy code
ActiveDocument.TrackRevisions = True
Selection.InsertBefore "The "

Use Revisions(Index), where Index is the index number, to return a single Revision object. The index number represents the position of the revision in the range or document. The following code example displays the author name for the first revision in the first section.

VBA Copy code Copy code
MsgBox ActiveDocument.Sections(1).Range.Revisions(1).Author

The Count property for this collection in a document returns the number of items in the main story only. To count items in other stories use the collection with the Range object.

See also

Concepts

Word Object Model Reference

Other resources

Revisions Object Members


Revisions Members (Word)

 Copy code hover
[image]

Revisions Members (Word)
Send feedback

Published: July 16, 2012

A collection of Revision objects that represent the changes marked with revision marks in a range or document.

Methods

Name | Description
AcceptAll | Accepts all the tracked changes in a document or range, removes all revision marks, and incorporates the changes into the document.
Item | Returns an individual Revisions object in a collection.
RejectAll |

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application. Read-only.
Count | Returns a Long that represents the number of revisions in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified Revisions object.


Revisions Properties (Word)

 Copy code hover
[image]

Revisions Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application. Read-only.
Count | Returns a Long that represents the number of revisions in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified Revisions object.


Revisions.Application Property (Word)

 Copy code hover
[image]

Revisions.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .Application

expression An expression that returns a Revisions object.

See also

Concepts

Revisions Collection Object

Other resources

Revisions Object Members


Revisions.Count Property (Word)

 Copy code hover
[image]

Revisions.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of revisions in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents a Revisions collection.

See also

Concepts

Revisions Collection Object

Other resources

Revisions Object Members


Revisions.Creator Property (Word)

 Copy code hover
[image]

Revisions.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version Information

Version Added: Word 2010

Syntax

expression .Creator

expression An expression that returns a Revisions object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD". This property was primarily designed to be used on the Apple Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For more information about this property, see the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

Revisions Collection Object

Other resources

Revisions Object Members


Revisions.Parent Property (Word)

 Copy code hover
[image]

Revisions.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Revisions object.

Version Information

Version Added: Word 2010

Syntax

expression .Parent

expression An expression that returns a Revisions object.

See also

Concepts

Revisions Collection Object

Other resources

Revisions Object Members


Revisions Methods (Word)

 Copy code hover
[image]

Revisions Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
AcceptAll | Accepts all the tracked changes in a document or range, removes all revision marks, and incorporates the changes into the document.
Item | Returns an individual Revisions object in a collection.
RejectAll |


Revisions.AcceptAll Method (Word)

 Copy code hover
[image]

Revisions.AcceptAll Method (Word)
See also Send feedback

Published: July 16, 2012

Accepts all the tracked changes in a document or range, removes all revision marks, and incorporates the changes into the document.

Syntax

expression .AcceptAll

expression Required. A variable that represents a Revisions collection.

Remarks

Use the AcceptAllRevisions method to accept all revisions in a document.

Example

The following code example accepts all the tracked changes in the active document.

VBA Copy code Copy code
If ActiveDocument.Revisions.Count >= 1 Then _
 ActiveDocument.Revisions.AcceptAll

The following code example accepts all the tracked changes in the selection.

VBA Copy code Copy code
Selection.Range.Revisions.AcceptAll

See also

Concepts

Revisions Collection Object

Other resources

Revisions Object Members


Revisions.Item Method (Word)

 Copy code hover
[image]

Revisions.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual Revisions object in a collection.

Version Information

Version Added: Word 2010

Syntax

expression .Item(Index)

expression An expression that returns a Revisions object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The individual object to be returned.

Return Value

Revision

See also

Concepts

Revisions Collection Object

Other resources

Revisions Object Members


Revisions.RejectAll Method (Word)

 Copy code hover
[image]

Revisions.RejectAll Method (Word)
See also Send feedback

Published: July 16, 2012

Syntax

expression .RejectAll

expression An expression that returns a Revisions object.

Return Value

Nothing

See also

Concepts

Revisions Collection Object

Other resources

Revisions Object Members


RevisionsFilter Object (Word)

 Copy code hover
[image]

RevisionsFilter Object (Word)
See also Send feedback

Published: July 16, 2012

Represents the current settings related to display of reviewers' comments and revision marks in the document.

Version information

Version Added: Word 2013

Remarks

Use the View.RevisionsFilter property to return a RevisionsFilter object.

See also

Other resources

RevisionsFilter Members


RevisionsFilter Members (Word)

 Copy code hover
[image]

RevisionsFilter Members (Word)
Send feedback

Published: July 16, 2012

Represents the current settings related to display of reviewers' comments and revision marks in the document.

Methods

Name | Description
ToggleShowAllReviewers | Shows or hides all revisions in a document that contains comments and tracked changes.

Properties

Name | Description
Markup | Returns or sets a WdRevisionsMarkup constant that specifies the extent of reviewer markup displayed in the document. Read/write.
Reviewers | Returns a Reviewers object that represents the collection of reviewers of one or more documents.
View | Sets or returns a WdRevisionsView constant that represents the global option that specifies whether Microsoft Word 2013 displays the original version of a document or the final version, which might have revisions and formatting changes applied. Read/write.


RevisionsFilter Properties (Word)

 Copy code hover
[image]

RevisionsFilter Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Markup | Returns or sets a WdRevisionsMarkup constant that specifies the extent of reviewer markup displayed in the document. Read/write.
Reviewers | Returns a Reviewers object that represents the collection of reviewers of one or more documents.
View | Sets or returns a WdRevisionsView constant that represents the global option that specifies whether Microsoft Word 2013 displays the original version of a document or the final version, which might have revisions and formatting changes applied. Read/write.


RevisionsFilter.Markup Property (Word)

 Copy code hover
[image]

RevisionsFilter.Markup Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a WdRevisionsMarkup constant that specifies the extent of reviewer markup displayed in the document. Read/write.

Version information

Version Added: Word 2013

Syntax

expression .Markup

expression A variable that represents a RevisionsFilter object.

Example

This example shows how to display all revisions and markup in the document in the active window. This example assumes that the document in the active window contains revisions made by one or more reviewers.

VBA Copy code Copy code
Public Sub Markup_Example()

    ActiveWindow.View.RevisionsFilter.Markup = wdRevisionsMarkupAll

End Sub

Property value

WDREVISIONSMARKUP

See also

Other resources

RevisionsFilter Object
RevisionsFilter Members


RevisionsFilter.Reviewers Property (Word)

 Copy code hover
[image]

RevisionsFilter.Reviewers Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Reviewers object that represents the collection of reviewers of one or more documents.

Version information

Version Added: Word 2013

Syntax

expression .Reviewers

expression A variable that represents a RevisionsFilter object.

Remarks

The Reviewers collection returned by Reviewers contains the names of all reviewers who have reviewed documents opened or edited on a computer.

Note Note

The Reviewers property replaces the View.Reviewers property found in previous versions of Microsoft Word, which is now deprecated.

Example

This example shows how to get the count of all reviewers in the document in the active window. This example assumes that the document in the active window contains revisions made by one or more reviewers.

VBA Copy code Copy code
Public Sub Reviewers_Example()

   Debug.Print ActiveWindow.View.RevisionsFilter.Reviewers.Count

End Sub

Property value

REVIEWERS

See also

Other resources

RevisionsFilter Object
RevisionsFilter Members


RevisionsFilter.View Property (Word)

 Copy code hover
[image]

RevisionsFilter.View Property (Word)
See also Send feedback

Published: July 16, 2012

Sets or returns a WdRevisionsView constant that represents the global option that specifies whether Microsoft Word 2013 displays the original version of a document or the final version, which might have revisions and formatting changes applied. Read/write.

Version information

Version Added: Word 2013

Syntax

expression .View

expression A variable that represents a RevisionsFilter object.

Remarks

The RevisionsFilter.View property replaces the View.RevisionsView property that was in previous version of Word.

Example

This example toggles between displaying the original and the final version of the document. This example assumes that the document in the active window contains revisions made by one or more reviewers.

VBA Copy code Copy code
Sub RevisionsFilter_View_Example()

    With ActiveWindow.View

       If .RevisionsFilter.View = wdRevisionsViewFinal Then
                .RevisionsFilter.View = wdRevisionsViewOriginal
            Else
                .RevisionsFilter.View = wdRevisionsViewFinal
       End If
    End With
End Sub

Property value

WDREVISIONSVIEW

See also

Other resources

RevisionsFilter Object
RevisionsFilter Members


RevisionsFilter Methods (Word)

 Copy code hover
[image]

RevisionsFilter Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
ToggleShowAllReviewers | Shows or hides all revisions in a document that contains comments and tracked changes.


RevisionsFilter.ToggleShowAllReviewers Method (Word)

 Copy code hover
[image]

RevisionsFilter.ToggleShowAllReviewers Method (Word)
See also Send feedback

Published: July 16, 2012

Shows or hides all revisions in a document that contains comments and tracked changes.

Version information

Version Added: Word 2013

Syntax

expression .ToggleShowAllReviewers

expression A variable that represents a RevisionsFilter object.

Return value

VOID

Remarks

In previous versions of Microsoft Word, the ToggleShowAllReviewers method was on the Window object. As of Microsoft Word 2013, that method is hidden.

See also

Other resources

RevisionsFilter Object
RevisionsFilter Members


Row Object (Word)

 Copy code hover
[image]

Row Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a row in a table. The Row object is a member of the Rows collection. The Rows collection includes all the rows in the specified selection, range, or table.

Remarks

Use Rows(Index), where Index is the index number, to return a single Row object. The index number represents the position of the row in the selection, range, or table. The following example deletes the first row in the first table in the active document.

VBA Copy code Copy code
ActiveDocument.Tables(1).Rows(1).Delete

Use the Add method to add a row to a table. The following example inserts a row before the first row in the selection.

VBA Copy code Copy code
If Selection.Information(wdWithInTable) = True Then
 Selection.Rows.Add BeforeRow:=Selection.Rows(1)
End If

Use the Cells property to modify the individual cells in a Row object. The following example adds a table to the selection and then inserts numbers into each cell in the second row of the table.

VBA Copy code Copy code
Selection.Collapse Direction:=wdCollapseEnd
If Selection.Information(wdWithInTable) = False Then
 Set myTable = _
 ActiveDocument.Tables.Add(Range:=Selection.Range, _
 NumRows:=3, NumColumns:=5)
 For Each aCell In myTable.Rows(2).Cells
 i = i + 1
 aCell.Range.Text = i
 Next aCell
End If

See also

Concepts

Word Object Model Reference

Other resources

Row Object Members


Row Members (Word)

 Copy code hover
[image]

Row Members (Word)
Send feedback

Published: July 16, 2012

Represents a row in a table. The Row object is a member of the Rows collection. The Rows collection includes all the rows in the specified selection, range, or table.

Methods

Name | Description
ConvertToText | Converts a table to text and returns a Range object that represents the delimited text.
Delete | Deletes the specified table row.
Select | Selects the specified table row.
SetHeight | Sets the height of a table row.
SetLeftIndent | Sets the indentation for a row in a table.

Properties

Name | Description
Alignment | Returns or sets a WdRowAlignment constant that represents the alignment for the specified rows. Read/write.
AllowBreakAcrossPages | True if the text in a table row or rows are allowed to split across a page break. Read/write Long.
Application | Returns an Application object that represents the Microsoft Word application.
Borders | Returns a Borders collection that represents all the borders for the specified object.
Cells | Returns a Cells collection that represents the table cells in a column, row, selection, or range. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
HeadingFormat | True if the specified row or rows are formatted as a table heading. Rows formatted as table headings are repeated when a table spans more than one page. Can be True, False or wdUndefined. Read/write Long.
Height | Returns or sets the height of the specified row in a table. Read/write Single.
HeightRule | Returns or sets the rule for determining the height of the specified cells or rows. Read/write WdRowHeightRule.
ID | Returns or sets the identifying label for the specified table row when the document is saved as a Web page. Read/write String.
Index | Returns a Long that represents the position of an item in a collection. Read-only.
IsFirst | True if the specified row is the first one in the table. Read-only Boolean.
IsLast | True if the specified row is the last one in the table. Read-only Boolean.
LeftIndent | Returns or sets a Single that represents the left indent value (in points) for the specified table row. Read/write.
NestingLevel | Returns the nesting level of the specified table row. Read-only Long.
Next | Returns a Row object that represents the table row that is next in the collection of rows in a table. Read-only.
Parent | Returns an Object that represents the parent object of the specified Row object.
Previous | Returns a Row object that represents the table row that is previous to the specified row. Read-only.
Range | Returns a Range object that represents the portion of a document that is contained within the specified table row.
Shading | Returns a Shading object that refers to the shading formatting for the specified object.
SpaceBetweenColumns | Returns or sets the distance (in points) between text in adjacent columns of the specified row or rows. Read/write Single.


Row Properties (Word)

 Copy code hover
[image]

Row Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Alignment | Returns or sets a WdRowAlignment constant that represents the alignment for the specified rows. Read/write.
AllowBreakAcrossPages | True if the text in a table row or rows are allowed to split across a page break. Read/write Long.
Application | Returns an Application object that represents the Microsoft Word application.
Borders | Returns a Borders collection that represents all the borders for the specified object.
Cells | Returns a Cells collection that represents the table cells in a column, row, selection, or range. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
HeadingFormat | True if the specified row or rows are formatted as a table heading. Rows formatted as table headings are repeated when a table spans more than one page. Can be True, False or wdUndefined. Read/write Long.
Height | Returns or sets the height of the specified row in a table. Read/write Single.
HeightRule | Returns or sets the rule for determining the height of the specified cells or rows. Read/write WdRowHeightRule.
ID | Returns or sets the identifying label for the specified table row when the document is saved as a Web page. Read/write String.
Index | Returns a Long that represents the position of an item in a collection. Read-only.
IsFirst | True if the specified row is the first one in the table. Read-only Boolean.
IsLast | True if the specified row is the last one in the table. Read-only Boolean.
LeftIndent | Returns or sets a Single that represents the left indent value (in points) for the specified table row. Read/write.
NestingLevel | Returns the nesting level of the specified table row. Read-only Long.
Next | Returns a Row object that represents the table row that is next in the collection of rows in a table. Read-only.
Parent | Returns an Object that represents the parent object of the specified Row object.
Previous | Returns a Row object that represents the table row that is previous to the specified row. Read-only.
Range | Returns a Range object that represents the portion of a document that is contained within the specified table row.
Shading | Returns a Shading object that refers to the shading formatting for the specified object.
SpaceBetweenColumns | Returns or sets the distance (in points) between text in adjacent columns of the specified row or rows. Read/write Single.


Row.Alignment Property (Word)

 Copy code hover
[image]

Row.Alignment Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a WdRowAlignment constant that represents the alignment for the specified rows. Read/write.

Syntax

expression .Alignment

expression Required. A variable that represents a Row object.

Example

This example centers all the cells of the first row in the first table of the active document.

VBA Copy code Copy code
Sub CenterRows()
 ActiveDocument.Tables(1).Rows(1) _
 .Alignment = wdAlignRowCenter
End Sub

See also

Concepts

Row Object

Other resources

Row Object Members


Row.AllowBreakAcrossPages Property (Word)

 Copy code hover
[image]

Row.AllowBreakAcrossPages Property (Word)
See also Send feedback

Published: July 16, 2012

True if the text in a table row or rows are allowed to split across a page break. Read/write Long.

Syntax

expression .AllowBreakAcrossPages

expression Required. A variable that represents a Row object.

Remarks

This property can be True, False or wdUndefined (only some of the specified text is allowed to split).

Example

This example creates a new document with a 5x5 table and prevents the third row of the table from being split during pagination.

VBA Copy code Copy code
Dim docNew As Document
Dim tableNew As Table

Set docNew = Documents.Add
Set tableNew = docNew.Tables.Add(Range:=Selection.Range, _
 NumRows:=5, NumColumns:=5)

tableNew.Rows(3).AllowBreakAcrossPages = False

This example determines whether the rows in the current table can be split across pages. If the insertion point isn't in a table, a message box is displayed.

VBA Copy code Copy code
Dim lngAllowBreak as Long

Selection.Collapse Direction:=wdCollapseStart
If Selection.Tables.Count = 0 Then
 MsgBox "The insertion point is not in a table."
Else
 lngAllowBreak = Selection.Rows.AllowBreakAcrossPages
End If

See also

Concepts

Row Object

Other resources

Row Object Members


Row.Application Property (Word)

 Copy code hover
[image]

Row.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a Row object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

Row Object

Other resources

Row Object Members


Row.Borders Property (Word)

 Copy code hover
[image]

Row.Borders Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Borders collection that represents all the borders for the specified object.

Syntax

expression .Borders

expression Required. A variable that represents a Row object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection .

See also

Concepts

Row Object

Other resources

Row Object Members


Row.Cells Property (Word)

 Copy code hover
[image]

Row.Cells Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Cells collection that represents the table cells in a column, row, selection, or range. Read-only.

Syntax

expression .Cells

expression A variable that represents a Row object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

See also

Concepts

Row Object

Other resources

Row Object Members


Row.Creator Property (Word)

 Copy code hover
[image]

Row.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a Row object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Row Object

Other resources

Row Object Members


Row.HeadingFormat Property (Word)

 Copy code hover
[image]

Row.HeadingFormat Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified row or rows are formatted as a table heading. Rows formatted as table headings are repeated when a table spans more than one page. Can be True, False or wdUndefined. Read/write Long.

Syntax

expression .HeadingFormat

expression A variable that represents a Row object.

Example

This example creates a 5x5 table at the beginning of the active document and then adds the table heading format to the first table row.

VBA Copy code Copy code
Dim rngTemp As Range
Dim tableNew As Table

Set rngTemp = ActiveDocument.Range(0, 0)
Set tableNewe = ActiveDocument.Tables.Add(rngTemp, 5, 5)

tableNew.Rows(1).HeadingFormat = True

This example determines whether the row that contains the insertion point is formatted as a table heading.

VBA Copy code Copy code
If Selection.Information(wdWithInTable) = True Then
 If Selection.Rows(1).HeadingFormat = True Then _
 MsgBox "The current row is a table heading"
Else
 MsgBox "The insertion point is not in a table."
End If

See also

Concepts

Row Object

Other resources

Row Object Members


Row.Height Property (Word)

 Copy code hover
[image]

Row.Height Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the height of the specified row in a table. Read/write Single.

Syntax

expression .Height

expression A variable that represents a Row object.

Remarks

If the HeightRule property of the specified row is wdRowHeightAuto, Height returns wdUndefined; setting the Height property sets HeightRule to wdRowHeightAtLeast.

Example

This example sets the height of the rows in the first table in the active document to at least 20 points.

VBA Copy code Copy code
ActiveDocument.Tables(1).Rows.Height = 20

See also

Concepts

Row Object

Other resources

Row Object Members


Row.HeightRule Property (Word)

 Copy code hover
[image]

Row.HeightRule Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the rule for determining the height of the specified cells or rows. Read/write WdRowHeightRule.

Syntax

expression .HeightRule

expression Required. A variable that represents a Row object.

Example

This example creates a 3x3 table in a new document and then sets a minimum row height of 24 points for the second row.

VBA Copy code Copy code
Set newDoc = Documents.Add
Set myTable = newDoc.Tables.Add(Range:=Selection.Range, _
 NumRows:=3, NumColumns:=3)
With myTable.Rows(2)
 .Height = 24
 .HeightRule = wdRowHeightAtLeast
End With

See also

Concepts

Row Object

Other resources

Row Object Members


Row.ID Property (Word)

 Copy code hover
[image]

Row.ID Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the identifying label for the specified table row when the document is saved as a Web page. Read/write String.

Syntax

expression .ID

expression Required. A variable that represents a Row object.

Remarks

You can use a label as a hyperlink reference from other Web pages or from within the current document.

See also

Concepts

Row Object

Other resources

Row Object Members


Row.Index Property (Word)

 Copy code hover
[image]

Row.Index Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the position of an item in a collection. Read-only.

Syntax

expression .Index

expression Required. A variable that represents a Row object.

See also

Concepts

Row Object

Other resources

Row Object Members


Row.IsFirst Property (Word)

 Copy code hover
[image]

Row.IsFirst Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified row is the first one in the table. Read-only Boolean.

Syntax

expression .IsFirst

expression Required. A variable that represents a Row object.

Example

This example determines whether the first row in the selection is the first row in the table.

VBA Copy code Copy code
MsgBox Selection.Rows(1).IsFirst

See also

Concepts

Row Object

Other resources

Row Object Members


Row.IsLast Property (Word)

 Copy code hover
[image]

Row.IsLast Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified row is the last one in the table. Read-only Boolean.

Syntax

expression .IsLast

expression Required. A variable that represents a Row object.

Example

This example determines whether the second row is the last row in the table.

VBA Copy code Copy code
MsgBox ActiveDocument.Tables(1).Rows(2).IsLast

See also

Concepts

Row Object

Other resources

Row Object Members


Row.LeftIndent Property (Word)

 Copy code hover
[image]

Row.LeftIndent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Single that represents the left indent value (in points) for the specified table row. Read/write.

Syntax

expression .LeftIndent

expression A variable that represents a Row object.

Example

This example sets the left indent for the first row in the first table in the active document.

VBA Copy code Copy code
ActiveDocument.Tables(1).Rows(1).LeftIndent = InchesToPoints(1)

See also

Concepts

Row Object

Other resources

Row Object Members


Row.NestingLevel Property (Word)

 Copy code hover
[image]

Row.NestingLevel Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the nesting level of the specified table row. Read-only Long.

Syntax

expression .NestingLevel

expression Required. A variable that represents a Row object.

Remarks

The outermost table has a nesting level of 1. The nesting level of each successively nested table is one higher than the previous table.

See also

Concepts

Row Object

Other resources

Row Object Members


Row.Next Property (Word)

 Copy code hover
[image]

Row.Next Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Row object that represents the table row that is next in the collection of rows in a table. Read-only.

Syntax

expression .Next

expression A variable that represents a Row object.

Example

If the selection is in a table, this example selects the contents of the next table row.

VBA Copy code Copy code
If Selection.Information(wdWithInTable) = True Then
 Selection.Row(1).Next.Select
End If

See also

Concepts

Row Object

Other resources

Row Object Members


Row.Parent Property (Word)

 Copy code hover
[image]

Row.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Row object.

Syntax

expression .Parent

expression Required. A variable that represents a Row object.

See also

Concepts

Row Object

Other resources

Row Object Members


Row.Previous Property (Word)

 Copy code hover
[image]

Row.Previous Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Row object that represents the table row that is previous to the specified row. Read-only.

Syntax

expression .Previous

expression A variable that represents a Row object.

Example

If the selection is in a table, this example selects the contents of the previous row.

VBA Copy code Copy code
If Selection.Information(wdWithInTable) = True Then
 Selection.Rows(1).Previous.Select
End If

See also

Concepts

Row Object

Other resources

Row Object Members


Row.Range Property (Word)

 Copy code hover
[image]

Row.Range Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the portion of a document that is contained within the specified table row.

Syntax

expression .Range

expression Required. A variable that represents a Row object.

Example

This example copies the first row in table one.

VBA Copy code Copy code
If ActiveDocument.Tables.Count >= 1 Then _
 ActiveDocument.Tables(1).Rows(1).Range.Copy

See also

Concepts

Row Object

Other resources

Row Object Members


Row.Shading Property (Word)

 Copy code hover
[image]

Row.Shading Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Shading object that refers to the shading formatting for the specified object.

Syntax

expression .Shading

expression Required. A variable that represents a Row object.

Example

This example applies horizontal line texture to the first row in table one.

VBA Copy code Copy code
If ActiveDocument.Tables.Count >= 1 Then
 With ActiveDocument.Tables(1).Rows(1).Shading
 .Texture = wdTextureHorizontal
 End With
End If

See also

Concepts

Row Object

Other resources

Row Object Members


Row.SpaceBetweenColumns Property (Word)

 Copy code hover
[image]

Row.SpaceBetweenColumns Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the distance (in points) between text in adjacent columns of the specified row or rows. Read/write Single.

Syntax

expression .SpaceBetweenColumns

expression Required. A variable that represents a Row object.

Example

This example creates a 3x3 table in a new document and then sets the distance between columns in the first row to 0.5 inches.

VBA Copy code Copy code
Set newDoc = Documents.Add
Set myTable = newDoc.Tables.Add(Selection.Range, 3, 3)
myTable.Rows(1).SpaceBetweenColumns = InchesToPoints(0.5)

See also

Concepts

Row Object

Other resources

Row Object Members


Row Methods (Word)

 Copy code hover
[image]

Row Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
ConvertToText | Converts a table to text and returns a Range object that represents the delimited text.
Delete | Deletes the specified table row.
Select | Selects the specified table row.
SetHeight | Sets the height of a table row.
SetLeftIndent | Sets the indentation for a row in a table.


Row.ConvertToText Method (Word)

 Copy code hover
[image]

Row.ConvertToText Method (Word)
See also Send feedback

Published: July 16, 2012

Converts a table to text and returns a Range object that represents the delimited text.

Syntax

expression .ConvertToText(Separator, NestedTables)

expression Required. A variable that represents a Row object.

Parameters

Name | Required/Optional | Data Type | Description
Separator | Optional | Variant | The character that delimits the converted columns (paragraph marks delimit the converted rows). Can be any following WdTableFieldSeparator constants: wdSeparateByCommas, wdSeparateByDefaultListSeparator, wdSeparateByParagraphs, or wdSeparateByTabs (Default).
NestedTables | Optional | Variant | True if nested tables are converted to text. This argument is ignored if Separator is not wdSeparateByParagraphs. The default value is True.

See also

Concepts

Row Object

Other resources

Row Object Members


Row.Delete Method (Word)

 Copy code hover
[image]

Row.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the specified table row.

Syntax

expression .Delete

expression Required. A variable that represents a Row object.

See also

Concepts

Row Object

Other resources

Row Object Members


Row.Select Method (Word)

 Copy code hover
[image]

Row.Select Method (Word)
See also Send feedback

Published: July 16, 2012

Selects the specified table row.

Syntax

expression .Select

expression Required. A variable that represents a Row object.

Remarks

After using this method, use the Selection object to work with the selected row. For more information, see Working with the Selection Object.

Example

This example selects row one in table one of Report.doc.

VBA Copy code Copy code
Documents("Report.doc").Tables(1).Rows(1).Select

See also

Concepts

Row Object

Other resources

Row Object Members


Row.SetHeight Method (Word)

 Copy code hover
[image]

Row.SetHeight Method (Word)
See also Send feedback

Published: July 16, 2012

Sets the height of a table row.

Syntax

expression .SetHeight(RowHeight, HeightRule)

expression Required. A variable that represents a Row object.

Parameters

Name | Required/Optional | Data Type | Description
RowHeight | Required | Single | The height of the row, in points.
HeightRule | Required | WdRowHeightRule | The rule for determining the height of the specified rows.

Example

This example creates a table and then sets a fixed row height of 0.5 inch (36 points) for the first row.

VBA Copy code Copy code
Set newDoc = Documents.Add
Set aTable = _
 newDoc.Tables.Add(Range:=Selection.Range, NumRows:=3, _
 NumColumns:=3)
aTable.Rows(1).SetHeight RowHeight:=InchesToPoints(0.5), _
 HeightRule:=wdRowHeightExactly

See also

Concepts

Row Object

Other resources

Row Object Members


Row.SetLeftIndent Method (Word)

 Copy code hover
[image]

Row.SetLeftIndent Method (Word)
See also Send feedback

Published: July 16, 2012

Sets the indentation for a row in a table.

Syntax

expression .SetLeftIndent(LeftIndent, RulerStyle)

expression Required. A variable that represents a Row object.

Parameters

Name | Required/Optional | Data Type | Description
LeftIndent | Required | Single | The distance (in points) between the current left edge of the specified row or rows and the desired left edge.
RulerStyle | Required | WdRulerStyle | Controls the way Word adjusts the table when the left indent is changed.

Remarks

The WdRulerStyle behavior described above applies to left-aligned tables. The WdRulerStyle behavior for center- and right-aligned tables can be unexpected; in these cases, use the SetLeftIndent method with care.

Example

This example creates a table in a new document and indents the first row 0.5 inch (36 points). When you change the left indent, the cell widths are adjusted to preserve the right edge of the table.

VBA Copy code Copy code
Dim docNew As Document
Dim tableNew As Table

Set docNew = Documents.Add
Set tableNew = docNew.Tables.Add(Range:=Selection.Range, _
 NumRows:=3, NumColumns:=3)

tableNew.Rows(1).SetLeftIndent LeftIndent:=InchesToPoints(0.5), _
 RulerStyle:=wdAdjustSameWidth

See also

Concepts

Row Object

Other resources

Row Object Members


Rows Object (Word)

 Copy code hover
[image]

Rows Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of Row objects that represent the table rows in the specified selection, range, or table.

Remarks

Use the Rows property to return the Rows collection. The following example centers rows in the first table in the active document between the left and right margins.

VBA Copy code Copy code
ActiveDocument.Tables(1).Rows.Alignment = wdAlignRowCenter

Use the Add method to add a row to a table. The following example inserts a row before the first row in the selection.

VBA Copy code Copy code
If Selection.Information(wdWithInTable) = True Then
 Selection.Rows.Add BeforeRow:=Selection.Rows(1)
End If

Use Rows(Index), where Index is the index number, to return a single Row object. The index number represents the position of the row in the selection, range, or table. The following example deletes the first row in the first table in the active document.

VBA Copy code Copy code
ActiveDocument.Tables(1).Rows(1).Delete

See also

Concepts

Word Object Model Reference

Other resources

Rows Object Members


Rows Members (Word)

 Copy code hover
[image]

Rows Members (Word)
Send feedback

Published: July 16, 2012

A collection of Row objects that represent the table rows in the specified selection, range, or table.

Methods

Name | Description
Add | Returns a Row object that represents a row added to a table.
ConvertToText | Converts rows in a table to text and returns a Range object that represents the delimited text.
Delete | Deletes the specified table rows.
DistributeHeight | Adjusts the height of the specified rows or cells so that they're equal.
Item | Returns an individual Row object in a collection.
Select | Selects a collection of rows in a table.
SetHeight | Sets the height of table rows.
SetLeftIndent | Sets the indentation for a row or rows in a table.

Properties

Name | Description
Alignment | Returns or sets a WdRowAlignment constant that represents the alignment for the specified rows. Read/write.
AllowBreakAcrossPages | True if the text in a table row or rows are allowed to split across a page break. Read/write Long.
AllowOverlap | Returns or sets a value that specifies whether the specified rows can overlap other rows.
Application | Returns an Application object that represents the Microsoft Word application.
Borders | Returns a Borders collection that represents all the borders for the specified object.
Count | Returns a Long that represents the number of rows in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
DistanceBottom | Returns or sets the distance (in points) between the document text and the bottom edge of the specified table. Read/write Single.
DistanceLeft | Returns or sets the distance (in points) between the document text and the left edge of the specified table. Read/write Single.
DistanceRight | Returns or sets the distance (in points) between the document text and the right edge of the specified table. Read/write Single.
DistanceTop | Returns or sets the distance (in points) between the document text and the top edge of the specified table. Read/write Single.
First | Returns a Row object that represents the first item in the Rows collection.
HeadingFormat | True if the specified row or rows are formatted as a table heading. Read/write Long.
Height | Returns or sets the height of the specified rows in a table. Read/write Single.
HeightRule | Returns or sets the rule for determining the height of the specified cells or rows. Read/write WdRowHeightRule.
HorizontalPosition | Returns or sets the horizontal distance between the edge of the rows and the item specified by the RelativeHorizontalPosition property. Read/write Single.
Last | Returns the last item in the Rows collection as a Row object.
LeftIndent | Returns or sets a Single that represents the left indent value (in points) for the specified table rows. Read/write.
NestingLevel | Returns the nesting level of the specified table rows. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified Rows object.
RelativeHorizontalPosition | Specifies the relative horizontal position of a group of rows. Read/write WdRelativeHorizontalPosition.
RelativeVerticalPosition | Specifies the relative vertical position of a group of rows. Read/write WdRelativeVerticalPosition.
Shading | Returns a Shading object that refers to the shading formatting for the specified object.
SpaceBetweenColumns | Returns or sets the distance (in points) between text in adjacent columns of the specified row or rows. Read/write Single.
TableDirection | Returns or sets the direction in which Microsoft Word orders cells in the specified table or row. Read/write WdTableDirection.
VerticalPosition | Returns or sets the vertical distance between the edge of the rows and the item specified by the RelativeVerticalPosition property. Read/write Single.
WrapAroundText | Returns or sets whether text should wrap around the specified rows. Read/write Long.


Rows Properties (Word)

 Copy code hover
[image]

Rows Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Alignment | Returns or sets a WdRowAlignment constant that represents the alignment for the specified rows. Read/write.
AllowBreakAcrossPages | True if the text in a table row or rows are allowed to split across a page break. Read/write Long.
AllowOverlap | Returns or sets a value that specifies whether the specified rows can overlap other rows.
Application | Returns an Application object that represents the Microsoft Word application.
Borders | Returns a Borders collection that represents all the borders for the specified object.
Count | Returns a Long that represents the number of rows in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
DistanceBottom | Returns or sets the distance (in points) between the document text and the bottom edge of the specified table. Read/write Single.
DistanceLeft | Returns or sets the distance (in points) between the document text and the left edge of the specified table. Read/write Single.
DistanceRight | Returns or sets the distance (in points) between the document text and the right edge of the specified table. Read/write Single.
DistanceTop | Returns or sets the distance (in points) between the document text and the top edge of the specified table. Read/write Single.
First | Returns a Row object that represents the first item in the Rows collection.
HeadingFormat | True if the specified row or rows are formatted as a table heading. Read/write Long.
Height | Returns or sets the height of the specified rows in a table. Read/write Single.
HeightRule | Returns or sets the rule for determining the height of the specified cells or rows. Read/write WdRowHeightRule.
HorizontalPosition | Returns or sets the horizontal distance between the edge of the rows and the item specified by the RelativeHorizontalPosition property. Read/write Single.
Last | Returns the last item in the Rows collection as a Row object.
LeftIndent | Returns or sets a Single that represents the left indent value (in points) for the specified table rows. Read/write.
NestingLevel | Returns the nesting level of the specified table rows. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified Rows object.
RelativeHorizontalPosition | Specifies the relative horizontal position of a group of rows. Read/write WdRelativeHorizontalPosition.
RelativeVerticalPosition | Specifies the relative vertical position of a group of rows. Read/write WdRelativeVerticalPosition.
Shading | Returns a Shading object that refers to the shading formatting for the specified object.
SpaceBetweenColumns | Returns or sets the distance (in points) between text in adjacent columns of the specified row or rows. Read/write Single.
TableDirection | Returns or sets the direction in which Microsoft Word orders cells in the specified table or row. Read/write WdTableDirection.
VerticalPosition | Returns or sets the vertical distance between the edge of the rows and the item specified by the RelativeVerticalPosition property. Read/write Single.
WrapAroundText | Returns or sets whether text should wrap around the specified rows. Read/write Long.


Rows.Alignment Property (Word)

 Copy code hover
[image]

Rows.Alignment Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a WdRowAlignment constant that represents the alignment for the specified rows. Read/write.

Syntax

expression .Alignment

expression Required. A variable that represents a Rows collection.

Example

This example centers all the rows in the first table of the active document.

VBA Copy code Copy code
Sub CenterRows()
 ActiveDocument.Tables(1).Rows _
 .Alignment = wdAlignRowCenter
End Sub

See also

Concepts

Rows Collection Object

Other resources

Rows Object Members


Rows.AllowBreakAcrossPages Property (Word)

 Copy code hover
[image]

Rows.AllowBreakAcrossPages Property (Word)
See also Send feedback

Published: July 16, 2012

True if the text in a table row or rows are allowed to split across a page break. Read/write Long.

Syntax

expression .AllowBreakAcrossPages

expression Required. A variable that represents a Rows collection.

Remarks

This property can be True, False or wdUndefined (only some of the specified text is allowed to split).

Example

This example creates a new document with a 5x5 table and prevents the third row of the table from being split during pagination.

VBA Copy code Copy code
Dim docNew As Document
Dim tableNew As Table

Set docNew = Documents.Add
Set tableNew = docNew.Tables.Add(Range:=Selection.Range, _
 NumRows:=5, NumColumns:=5)

tableNew.Rows(3).AllowBreakAcrossPages = False

This example determines whether the rows in the current table can be split across pages. If the insertion point isn't in a table, a message box is displayed.

VBA Copy code Copy code
Dim lngAllowBreak as Long

Selection.Collapse Direction:=wdCollapseStart
If Selection.Tables.Count = 0 Then
 MsgBox "The insertion point is not in a table."
Else
 lngAllowBreak = Selection.Rows.AllowBreakAcrossPages
End If

See also

Concepts

Rows Collection Object

Other resources

Rows Object Members


Rows.AllowOverlap Property (Word)

 Copy code hover
[image]

Rows.AllowOverlap Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a value that specifies whether the specified rows can overlap other rows.

Syntax

expression .AllowOverlap

expression A variable that represents a Rows collection.

Remarks

This property returns wdUndefined if the specified rows include both overlapping rows and nonoverlapping rows. Can be set to either True or False. Read/write Long. Setting AllowOverlap to True also sets WrapAroundText to True, and setting WrapAroundText to False also sets AllowOverlap to False.

Because HTML doesn't support overlapping tables or shapes, AllowOverlap is ignored in Web layout view.

Example

This example specifies that text wraps around the selected table and that the table doesn't overlap any other wrapped tables.

VBA Copy code Copy code
Selection.Rows.WrapAroundText = True
Selection.Rows.AllowOverlap = False

This example specifies that the first shape in the active document can overlap other shapes.

VBA Copy code Copy code
ActiveDocument.Shapes(1).WrapFormat.AllowOverlap = True

See also

Concepts

Rows Collection Object

Other resources

Rows Object Members


Rows.Application Property (Word)

 Copy code hover
[image]

Rows.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a Rows collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

Rows Collection Object

Other resources

Rows Object Members


Rows.Borders Property (Word)

 Copy code hover
[image]

Rows.Borders Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Borders collection that represents all the borders for the specified object.

Syntax

expression .Borders

expression Required. A variable that represents a Rows collection.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example applies inside and outside borders to the rows in the first table in the active document.

VBA Copy code Copy code
Set myTable = ActiveDocument.Tables(1)
With myTable.Rows.Borders
 .InsideLineStyle = wdLineStyleSingle
 .OutsideLineStyle = wdLineStyleDouble
End With

See also

Concepts

Rows Collection Object

Other resources

Rows Object Members


Rows.Count Property (Word)

 Copy code hover
[image]

Rows.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of rows in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents a Rows collection.

See also

Concepts

Rows Collection Object

Other resources

Rows Object Members


Rows.Creator Property (Word)

 Copy code hover
[image]

Rows.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a Rows collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Rows Collection Object

Other resources

Rows Object Members


Rows.DistanceBottom Property (Word)

 Copy code hover
[image]

Rows.DistanceBottom Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the distance (in points) between the document text and the bottom edge of the specified table. Read/write Single.

Syntax

expression .DistanceBottom

expression A variable that represents a Rows collection.

Remarks

This property doesn't have any effect if WrapAroundText is False.

Example

This example sets text to wrap around the first table in the active document and sets the distance for wrapped text to 20 points on all sides of the table.

VBA Copy code Copy code
With ActiveDocument.Tables(1).Rows
 .WrapAroundText = True
 .DistanceLeft = 20
 .DistanceRight = 20
 .DistanceTop = 20
 .DistanceBottom = 20
End With

See also

Concepts

Rows Collection Object

Other resources

Rows Object Members


Rows.DistanceLeft Property (Word)

 Copy code hover
[image]

Rows.DistanceLeft Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the distance (in points) between the document text and the left edge of the specified table. Read/write Single.

Syntax

expression .DistanceLeft

expression A variable that represents a Rows collection.

Remarks

This property doesn't have any effect if WrapAroundText is False.

Example

This example sets text to wrap around the first table in the active document and sets the distance for wrapped text to 20 points on all sides of the table.

VBA Copy code Copy code
With ActiveDocument.Tables(1).Rows
 .WrapAroundText = True
 .DistanceLeft = 20
 .DistanceRight = 20
 .DistanceTop = 20
 .DistanceBottom = 20
End With

See also

Concepts

Rows Collection Object

Other resources

Rows Object Members


Rows.DistanceRight Property (Word)

 Copy code hover
[image]

Rows.DistanceRight Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the distance (in points) between the document text and the right edge of the specified table. Read/write Single.

Syntax

expression .DistanceRight

expression A variable that represents a Rows collection.

Remarks

This property doesn't have any effect if WrapAroundText is False.

Example

This example sets text to wrap around the first table in the active document and sets the distance for wrapped text to 20 points on all sides of the table.

VBA Copy code Copy code
With ActiveDocument.Tables(1).Rows
 .WrapAroundText = True
 .DistanceLeft = 20
 .DistanceRight = 20
 .DistanceTop = 20
 .DistanceBottom = 20
End With

See also

Concepts

Rows Collection Object

Other resources

Rows Object Members


Rows.DistanceTop Property (Word)

 Copy code hover
[image]

Rows.DistanceTop Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the distance (in points) between the document text and the top edge of the specified table. Read/write Single.

Syntax

expression .DistanceTop

expression A variable that represents a Rows collection.

Remarks

This property doesn't have any effect if WrapAroundText is False.

Example

This example sets text to wrap around the first table in the active document and sets the distance for wrapped text to 20 points on all sides of the table.

VBA Copy code Copy code
With ActiveDocument.Tables(1).Rows
 .WrapAroundText = True
 .DistanceLeft = 20
 .DistanceRight = 20
 .DistanceTop = 20
 .DistanceBottom = 20
End With

See also

Concepts

Rows Collection Object

Other resources

Rows Object Members


Rows.First Property (Word)

 Copy code hover
[image]

Rows.First Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Row object that represents the first item in the Rows collection.

Syntax

expression .First

expression Required. A variable that represents a Rows collection.

Example

This example applies shading and a bottom border to the first row in the first table of the active document.

VBA Copy code Copy code
ActiveDocument.Tables(1).Borders.Enable = False
With ActiveDocument.Tables(1).Rows.First
 .Shading.Texture = wdTexture10Percent
 .Borders(wdBorderBottom).LineStyle = wdLineStyleSingle
End With

See also

Concepts

Rows Collection Object

Other resources

Rows Object Members


Rows.HeadingFormat Property (Word)

 Copy code hover
[image]

Rows.HeadingFormat Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified row or rows are formatted as a table heading. Read/write Long.

Syntax

expression .HeadingFormat

expression A variable that represents a Rows collection.

Remarks

Rows formatted as table headings are repeated when a table spans more than one page. Can be True, False or wdUndefined.

Example

This example creates a 5x5 table at the beginning of the active document and then adds the table heading format to the first table row.

VBA Copy code Copy code
Dim rngTemp As Range
Dim tableNew As Table

Set rngTemp = ActiveDocument.Range(0, 0)
Set tableNewe = ActiveDocument.Tables.Add(rngTemp, 5, 5)

tableNew.Rows.HeadingFormat = True

This example determines whether the row that contains the insertion point is formatted as a table heading.

VBA Copy code Copy code
If Selection.Information(wdWithInTable) = True Then
 If Selection.Rows.HeadingFormat = True Then _
 MsgBox "The current row is a table heading"
Else
 MsgBox "The insertion point is not in a table."
End If

See also

Concepts

Rows Collection Object

Other resources

Rows Object Members


Rows.Height Property (Word)

 Copy code hover
[image]

Rows.Height Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the height of the specified rows in a table. Read/write Single.

Syntax

expression .Height

expression A variable that represents a Rows collection.

Remarks

If the HeightRule property of the specified row is wdRowHeightAuto, Height returns wdUndefined; setting the Height property sets HeightRule to wdRowHeightAtLeast.

Example

This example sets the height of the rows in the first table in the active document to at least 20 points.

VBA Copy code Copy code
ActiveDocument.Tables(1).Rows.Height = 20

See also

Concepts

Rows Collection Object

Other resources

Rows Object Members


Rows.HeightRule Property (Word)

 Copy code hover
[image]

Rows.HeightRule Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the rule for determining the height of the specified cells or rows. Read/write WdRowHeightRule.

Syntax

expression .HeightRule

expression Required. A variable that represents a Rows collection.

Example

This example sets the height rule for the selected rows to automatically adjust to the tallest cell in the row.

VBA Copy code Copy code
If Selection.Information(wdWithInTable) = True Then
 Selection.Rows.HeightRule = wdRowHeightAuto
Else
 MsgBox "The insertion point is not in a table."
End If

See also

Concepts

Rows Collection Object

Other resources

Rows Object Members


Rows.HorizontalPosition Property (Word)

 Copy code hover
[image]

Rows.HorizontalPosition Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the horizontal distance between the edge of the rows and the item specified by the RelativeHorizontalPosition property. Read/write Single.

Syntax

expression .HorizontalPosition

expression A variable that represents a Rows collection.

Remarks

This property can be a number that indicates a measurement in points, or can be one of the WdTablePosition constants. This property doesn't have any effect if the WrapAroundText property is False.

Example

This example aligns the first table in the active document horizontally with the right margin.

VBA Copy code Copy code
If ActiveDocument.Tables.Count >= 1 Then
 With ActiveDocument.Tables(1).Rows
 .RelativeHorizontalPosition = _
 wdRelativeHorizontalPositionMargin
 .HorizontalPosition = wdTableRight
 End With
End If

See also

Concepts

Rows Collection Object

Other resources

Rows Object Members


Rows.Last Property (Word)

 Copy code hover
[image]

Rows.Last Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the last item in the Rows collection as a Row object.

Syntax

expression .Last

expression Required. A variable that represents a Rows collection.

Example

This example deletes the last row in the first table in the active document.

VBA Copy code Copy code
ActiveDocument.Tables(1).Rows.Last.Cells.Delete

See also

Concepts

Rows Collection Object

Other resources

Rows Object Members


Rows.LeftIndent Property (Word)

 Copy code hover
[image]

Rows.LeftIndent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Single that represents the left indent value (in points) for the specified table rows. Read/write.

Syntax

expression .LeftIndent

expression A variable that represents a Rows collection.

Example

This example sets the left indent for all rows in the first table in the active document.

VBA Copy code Copy code
ActiveDocument.Tables(1).Rows.LeftIndent = InchesToPoints(1)

See also

Concepts

Rows Collection Object

Other resources

Rows Object Members


Rows.NestingLevel Property (Word)

 Copy code hover
[image]

Rows.NestingLevel Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the nesting level of the specified table rows. Read-only Long.

Syntax

expression .NestingLevel

expression Required. A variable that represents a Rows collection.

Remarks

The outermost table has a nesting level of 1. The nesting level of each successively nested table is one higher than the previous table.

Example

This example creates a new document, creates a nested table with three levels, and then fills the first cell of each table with its nesting level.

VBA Copy code Copy code
Documents.Add
ActiveDocument.Tables.Add Selection.Range, _
 3, 3, wdWord9TableBehavior, wdAutoFitContent
With ActiveDocument.Tables(1).Range
 .Copy
 .Cells(1).Range.Text = .Cells(1).NestingLevel
 .Cells(5).Range.PasteAsNestedTable
 With .Cells(5).Tables(1).Range
 .Cells(1).Range.Text = .Cells(1).NestingLevel
 .Cells(5).Range.PasteAsNestedTable
 With .Cells(5).Tables(1).Range
 .Cells(1).Range.Text = _
 .Cells(1).NestingLevel
 End With
 End With
End With

See also

Concepts

Rows Collection Object

Other resources

Rows Object Members


Rows.Parent Property (Word)

 Copy code hover
[image]

Rows.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Rows object.

Syntax

expression .Parent

expression Required. A variable that represents a Rows collection.

See also

Concepts

Rows Collection Object

Other resources

Rows Object Members


Rows.RelativeHorizontalPosition Property (Word)

 Copy code hover
[image]

Rows.RelativeHorizontalPosition Property (Word)
See also Send feedback

Published: July 16, 2012

Specifies the relative horizontal position of a group of rows. Read/write WdRelativeHorizontalPosition.

Syntax

expression .RelativeHorizontalPosition

expression An expression that represents a Rows object.

See also

Concepts

Rows Collection Object

Other resources

Rows Object Members


Rows.RelativeVerticalPosition Property (Word)

 Copy code hover
[image]

Rows.RelativeVerticalPosition Property (Word)
See also Send feedback

Published: July 16, 2012

Specifies the relative vertical position of a group of rows. Read/write WdRelativeVerticalPosition.

Syntax

expression .RelativeVerticalPosition

expression An expression that represents a Rows object.

See also

Concepts

Rows Collection Object

Other resources

Rows Object Members


Rows.Shading Property (Word)

 Copy code hover
[image]

Rows.Shading Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Shading object that refers to the shading formatting for the specified object.

Syntax

expression .Shading

expression Required. A variable that represents a Rows collection.

Example

This example applies yellow shading to the first paragraph in the selection.

VBA Copy code Copy code
With Selection.Paragraphs(1).Shading
 .Texture = wdTexture12Pt5Percent
 .BackgroundPatternColorIndex = wdYellow
 .ForegroundPatternColorIndex = wdBlack
End With

This example applies horizontal line texture to the first row in table one.

VBA Copy code Copy code
If ActiveDocument.Tables.Count >= 1 Then
 With ActiveDocument.Tables(1).Rows(1).Shading
 .Texture = wdTextureHorizontal
 End With
End If

This example applies 10 percent shading to the first word in the active document.

VBA Copy code Copy code
ActiveDocument.Words(1).Shading.Texture = wdTexture10Percent

See also

Concepts

Rows Collection Object

Other resources

Rows Object Members


Rows.SpaceBetweenColumns Property (Word)

 Copy code hover
[image]

Rows.SpaceBetweenColumns Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the distance (in points) between text in adjacent columns of the specified row or rows. Read/write Single.

Syntax

expression .SpaceBetweenColumns

expression Required. A variable that represents a Rows collection.

Example

This example returns the distance (in points) between columns in the selected table rows.

VBA Copy code Copy code
If Selection.Information(wdWithInTable) = True Then
 MsgBox Selection.Rows.SpaceBetweenColumns
End If

See also

Concepts

Rows Collection Object

Other resources

Rows Object Members


Rows.TableDirection Property (Word)

 Copy code hover
[image]

Rows.TableDirection Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the direction in which Microsoft Word orders cells in the specified table or row. Read/write WdTableDirection.

Syntax

expression .TableDirection

expression Required. A variable that represents a Rows collection.

Remarks

If the TableDirection property is set to wdTableDirectionLtr, the selected rows are arranged with the first column in the leftmost position. If the TableDirection property is set to wdTableDirectionRtl, the selected rows are arranged with the first column in the rightmost position.

Example

This example sets Microsoft Word to order cells in the selected row from right to left.

VBA Copy code Copy code
Selection.Rows.TableDirection = _
 wdTableDirectionRtl

See also

Concepts

Rows Collection Object

Other resources

Rows Object Members


Rows.VerticalPosition Property (Word)

 Copy code hover
[image]

Rows.VerticalPosition Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the vertical distance between the edge of the rows and the item specified by the RelativeVerticalPosition property. Read/write Single.

Syntax

expression .VerticalPosition

expression Required. A variable that represents a Rows collection.

Remarks

This property can be a number that indicates a measurement in points, or can be any valid WdFramePosition constant.

Example

This example vertically aligns the first table in the active document with the top of the page.

VBA Copy code Copy code
Set myTable = ActiveDocument.Tables(1).Rows
With myTable
 .RelativeVerticalPosition = wdRelativeVerticalPositionPage
 .VerticalPosition = wdTableTop
End With

See also

Concepts

Rows Collection Object

Other resources

Rows Object Members


Rows.WrapAroundText Property (Word)

 Copy code hover
[image]

Rows.WrapAroundText Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets whether text should wrap around the specified rows. Read/write Long.

Syntax

expression .WrapAroundText

expression An expression that returns a Rows object.

Remarks

Returns wdUndefined if only some of the specified rows have wrapping enabled. Can be set to True or False. Setting the WrapAroundText property to False also sets the AllowOverlap property to False. Setting the AllowOverlap property to True also sets the WrapAroundText property to True.

Example

This example sets Microsoft Word to wrap text around the first table in the document.

VBA Copy code Copy code
ActiveDocument.Tables(1).Rows.WrapAroundText = True

See also

Concepts

Rows Collection Object

Other resources

Rows Object Members


Rows Methods (Word)

 Copy code hover
[image]

Rows Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Returns a Row object that represents a row added to a table.
ConvertToText | Converts rows in a table to text and returns a Range object that represents the delimited text.
Delete | Deletes the specified table rows.
DistributeHeight | Adjusts the height of the specified rows or cells so that they're equal.
Item | Returns an individual Row object in a collection.
Select | Selects a collection of rows in a table.
SetHeight | Sets the height of table rows.
SetLeftIndent | Sets the indentation for a row or rows in a table.


Rows.Add Method (Word)

 Copy code hover
[image]

Rows.Add Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a Row object that represents a row added to a table.

Syntax

expression .Add(BeforeRow)

expression Required. A variable that represents a Rows collection.

Parameters

Name | Required/Optional | Data Type | Description
BeforeRow | Optional | Variant | A Row object that represents the row that will appear immediately below the new row.

Return Value

Row

Example

This example inserts a new row before the first row in the selection.

VBA Copy code Copy code
Sub AddARow()
 If Selection.Information(wdWithInTable) = True Then
 Selection.Rows.Add BeforeRow:=Selection.Rows(1)
 End If
End Sub

This example adds a row to the first table and then inserts the text Cell into this row.

VBA Copy code Copy code
Sub CountCells()
 Dim tblNew As Table
 Dim rowNew As Row
 Dim celTable As Cell
 Dim intCount As Integer

 intCount = 1
 Set tblNew = ActiveDocument.Tables(1)
 Set rowNew = tblNew.Rows.Add(BeforeRow:=tblNew.Rows(1))
 For Each celTable In rowNew.Cells
 celTable.Range.InsertAfter Text:="Cell " & intCount
 intCount = intCount + 1
 Next celTable
End Sub

See also

Concepts

Rows Collection Object

Other resources

Rows Object Members


Rows.ConvertToText Method (Word)

 Copy code hover
[image]

Rows.ConvertToText Method (Word)
See also Send feedback

Published: July 16, 2012

Converts rows in a table to text and returns a Range object that represents the delimited text.

Syntax

expression .ConvertToText(Separator, NestedTables)

expression Required. A variable that represents a Rows collection.

Parameters

Name | Required/Optional | Data Type | Description
Separator | Optional | Variant | The character that delimits the converted columns (paragraph marks delimit the converted rows). Can be any following WdTableFieldSeparator constants: wdSeparateByCommas, wdSeparateByDefaultListSeparator, wdSeparateByParagraphs, or wdSeparateByTabs (Default).
NestedTables | Optional | Variant | True if nested tables are converted to text. This argument is ignored if Separator is not wdSeparateByParagraphs. The default value is True.

See also

Concepts

Rows Collection Object

Other resources

Rows Object Members


Rows.Delete Method (Word)

 Copy code hover
[image]

Rows.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the specified table rows.

Syntax

expression .Delete

expression Required. A variable that represents a Rows collection.

See also

Concepts

Rows Collection Object

Other resources

Rows Object Members


Rows.DistributeHeight Method (Word)

 Copy code hover
[image]

Rows.DistributeHeight Method (Word)
See also Send feedback

Published: July 16, 2012

Adjusts the height of the specified rows or cells so that they're equal.

Syntax

expression .DistributeHeight

expression Required. A variable that represents a Rows collection.

Example

This example adjusts the height of the rows in the first table in the active document so that they're equal.

VBA Copy code Copy code
ActiveDocument.Tables(1).Rows.DistributeHeight

This example adjusts the height of the first three rows in the first table so that they're equal.

VBA Copy code Copy code
Dim rngTemp As Range

If ActiveDocument.Tables.Count >= 1 Then
 Set rngTemp = ActiveDocument.Range(Start:=ActiveDocument _
 .Tables(1).Rows(1).Range.Start, _
 End:=ActiveDocument.Tables(1).Rows(3).Range.End)
 rngTemp.Rows.DistributeHeight
End If

See also

Concepts

Rows Collection Object

Other resources

Rows Object Members


Rows.Item Method (Word)

 Copy code hover
[image]

Rows.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual Row object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents a Rows collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The individual object to be returned. Can be a Long indicating the ordinal position of the individual object.

Return Value

Row

See also

Concepts

Rows Collection Object

Other resources

Rows Object Members


Rows.Select Method (Word)

 Copy code hover
[image]

Rows.Select Method (Word)
See also Send feedback

Published: July 16, 2012

Selects a collection of rows in a table.

Syntax

expression .Select

expression Required. A variable that represents a Rows collection.

Remarks

After using this method, use the Selection object to work with the selected items. For more information, see Working with the Selection Object.

See also

Concepts

Rows Collection Object

Other resources

Rows Object Members


Rows.SetHeight Method (Word)

 Copy code hover
[image]

Rows.SetHeight Method (Word)
See also Send feedback

Published: July 16, 2012

Sets the height of table rows.

Syntax

expression .SetHeight(RowHeight, HeightRule)

expression Required. A variable that represents a Rows collection.

Parameters

Name | Required/Optional | Data Type | Description
RowHeight | Required | Single | The height of the row or rows, in points.
HeightRule | Required | WdRowHeightRule | The rule for determining the height of the specified rows.

Example

This example creates a table and then sets the row height to 0.5 inch (36 points) for all rows in the table.

VBA Copy code Copy code
Set newDoc = Documents.Add
Set aTable = _
 newDoc.Tables.Add(Range:=Selection.Range, NumRows:=3, _
 NumColumns:=3)
aTable.Rows.SetHeight RowHeight:=InchesToPoints(0.5), _
 HeightRule:=wdRowHeightExactly

See also

Concepts

Rows Collection Object

Other resources

Rows Object Members


Rows.SetLeftIndent Method (Word)

 Copy code hover
[image]

Rows.SetLeftIndent Method (Word)
See also Send feedback

Published: July 16, 2012

Sets the indentation for a row or rows in a table.

Syntax

expression .SetLeftIndent(LeftIndent, RulerStyle)

expression Required. A variable that represents a Rows collection.

Parameters

Name | Required/Optional | Data Type | Description
LeftIndent | Required | Single | The distance (in points) between the current left edge of the specified row or rows and the desired left edge.
RulerStyle | Required | WdRulerStyle | Controls the way Microsoft Word adjusts the table when the left indent is changed. The WdRulerStyle behavior applies to left-aligned tables. The WdRulerStyle behavior for center- and right-aligned tables can be unexpected; in these cases, use the SetLeftIndent method with care.

Example

This example creates a table in a new document and indents all rows in the table 0.5 inch (36 points). When you change the left indent, the cell widths are adjusted to preserve the right edge of the table.

VBA Copy code Copy code
Dim docNew As Document
Dim tableNew As Table

Set docNew = Documents.Add
Set tableNew = docNew.Tables.Add(Range:=Selection.Range, _
 NumRows:=3, NumColumns:=3)

tableNew.Rows.SetLeftIndent LeftIndent:=InchesToPoints(0.5), _
 RulerStyle:=wdAdjustSameWidth

This example indents the first row in table one in the active document 18 points, and it narrows the width of the first column to preserve the position of the right edge of the table.

VBA Copy code Copy code
If ActiveDocument.Tables.Count >= 1 Then
 ActiveDocument.Tables(1).Rows.SetLeftIndent LeftIndent:=18, _
 RulerStyle:=wdAdjustFirstColumn
End If

See also

Concepts

Rows Collection Object

Other resources

Rows Object Members


Section Object (Word)

 Copy code hover
[image]

Section Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a single section in a selection, range, or document. The Section object is a member of the Sections collection. The Sections collection includes all the sections in a selection, range, or document.

Remarks

Use Sections(Index), where Index is the index number, to return a single Section object. The following example changes the left and right page margins for the first section in the active document.

VBA Copy code Copy code
With ActiveDocument.Sections(1).PageSetup
 .LeftMargin = InchesToPoints(0.5)
 .RightMargin = InchesToPoints(0.5)
End With

Use the Add method or the InsertBreak method to add a new section to a document. The following example adds a new section at the beginning of the active document.

VBA Copy code Copy code
Set myRange = ActiveDocument.Range(Start:=0, End:=0)
ActiveDocument.Sections.Add Range:=myRange
myRange.InsertParagraphAfter

The following example adds a section break above the first paragraph in the selection.

VBA Copy code Copy code
Selection.Paragraphs(1).Range.InsertBreak _
 Type:=wdSectionBreakContinuous
Note Note

The Headers and Footers properties of the specified Section object return a HeadersFooters object.

See also

Concepts

Word Object Model Reference

Other resources

Section Object Members


Section Members (Word)

 Copy code hover
[image]

Section Members (Word)
Send feedback

Published: July 16, 2012

Represents a single section in a selection, range, or document. The Section object is a member of the Sections collection. The Sections collection includes all the sections in a selection, range, or document.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Borders | Returns a Borders collection that represents all the borders in the section.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Footers | Returns a HeadersFooters collection that represents the footers in the specified section. Read-only.
Headers | Returns a HeadersFooters collection that represents the headers for the specified section. Read-only.
Index | Returns a Long that represents the position of an item in a collection. Read-only.
PageSetup | Returns a PageSetup object that is associated with the specified section.
Parent | Returns an Object that represents the parent object of the specified Section object.
ProtectedForForms | True if the specified section is protected for forms. Read/write Boolean.
Range | Returns a Range object that represents the portion of a document that's contained in the specified object.


Section Properties (Word)

 Copy code hover
[image]

Section Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Borders | Returns a Borders collection that represents all the borders in the section.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Footers | Returns a HeadersFooters collection that represents the footers in the specified section. Read-only.
Headers | Returns a HeadersFooters collection that represents the headers for the specified section. Read-only.
Index | Returns a Long that represents the position of an item in a collection. Read-only.
PageSetup | Returns a PageSetup object that is associated with the specified section.
Parent | Returns an Object that represents the parent object of the specified Section object.
ProtectedForForms | True if the specified section is protected for forms. Read/write Boolean.
Range | Returns a Range object that represents the portion of a document that's contained in the specified object.


Section.Application Property (Word)

 Copy code hover
[image]

Section.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a Section object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

Section Object

Other resources

Section Object Members


Section.Borders Property (Word)

 Copy code hover
[image]

Section.Borders Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Borders collection that represents all the borders in the section.

Syntax

expression .Borders

expression Required. A variable that represents a Section object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection .

See also

Concepts

Section Object

Other resources

Section Object Members


Section.Creator Property (Word)

 Copy code hover
[image]

Section.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a Section object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Section Object

Other resources

Section Object Members


Section.Footers Property (Word)

 Copy code hover
[image]

Section.Footers Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a HeadersFooters collection that represents the footers in the specified section. Read-only.

Syntax

expression .Footers

expression A variable that represents a Section object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection. To return a HeadersFooters collection that represents the headers for the specified section, use the Headers property.

Example

This example adds a right-aligned page number to the primary footer in the first section in the active document.

VBA Copy code Copy code
With ActiveDocument.Sections(1).Footers(wdHeaderFooterPrimary)
 .PageNumbers.Add PageNumberAlignment:=wdAlignPageNumberRight
End With

See also

Concepts

Section Object

Other resources

Section Object Members


Section.Headers Property (Word)

 Copy code hover
[image]

Section.Headers Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a HeadersFooters collection that represents the headers for the specified section. Read-only.

Syntax

expression .Headers

expression A variable that represents a Section object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection. To return a HeadersFooters collection that represents the footers for the specified section, use the Footers property.

Example

This example adds centered page numbers to every page in the active document except the first. (A separate header is created for the first page.)

VBA Copy code Copy code
With ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary)
 .PageNumbers.Add _
 PageNumberAlignment:=wdAlignPageNumberCenter, _
 FirstPage:=False
End With

This example adds text to the first-page header in the active document.

VBA Copy code Copy code
ActiveDocument.PageSetup.DifferentFirstPageHeaderFooter = True
With ActiveDocument.Sections(1).Headers(wdHeaderFooterFirstPage)
 .Range.InsertAfter("First Page Text")
 .Range.Paragraphs.Alignment = wdAlignParagraphRight
End With

See also

Concepts

Section Object

Other resources

Section Object Members


Section.Index Property (Word)

 Copy code hover
[image]

Section.Index Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the position of an item in a collection. Read-only.

Syntax

expression .Index

expression Required. A variable that represents a Section object.

See also

Concepts

Section Object

Other resources

Section Object Members


Section.PageSetup Property (Word)

 Copy code hover
[image]

Section.PageSetup Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a PageSetup object that is associated with the specified section.

Syntax

expression .PageSetup

expression A variable that represents a Section object.

Example

This example sets the gutter for the first section in Summary.doc to 36 points (0.5 inch).

VBA Copy code Copy code
Documents("Summary.doc").Sections(1).PageSetup.Gutter = 36

See also

Concepts

Section Object

Other resources

Section Object Members


Section.Parent Property (Word)

 Copy code hover
[image]

Section.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Section object.

Syntax

expression .Parent

expression Required. A variable that represents a Section object.

See also

Concepts

Section Object

Other resources

Section Object Members


Section.ProtectedForForms Property (Word)

 Copy code hover
[image]

Section.ProtectedForForms Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified section is protected for forms. Read/write Boolean.

Syntax

expression .ProtectedForForms

expression An expression that returns a Section object.

Remarks

When a section is protected for forms, you can select and modify text only in form fields. To protect an entire document, use the Protect method of the Document object.

Example

This example turns on form protection for the second section in the active document.

VBA Copy code Copy code
If ActiveDocument.Sections.Count >= 2 Then _
 ActiveDocument.Sections(2).ProtectedForForms = True

This example unprotects the first section in the selection.

VBA Copy code Copy code
Selection.Sections(1).ProtectedForForms = False

This example toggles the protection for the first section in the selection.

VBA Copy code Copy code
Selection.Sections(1).ProtectedForForms = Not _
 Selection.Sections(1).ProtectedForForms

See also

Concepts

Section Object

Other resources

Section Object Members


Section.Range Property (Word)

 Copy code hover
[image]

Section.Range Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the portion of a document that's contained in the specified object.

Syntax

expression .Range

expression Required. A variable that represents a Section object.

Example

This example inserts text at the end of section one.

VBA Copy code Copy code
Set myRange = ActiveDocument.Sections(1).Range
With myRange
 .MoveEnd Unit:=wdCharacter, Count:=-1
 .Collapse Direction:=wdCollapseEnd
 .InsertParagraphAfter
 .InsertAfter "End of section"
End With

See also

Concepts

Section Object

Other resources

Section Object Members


Sections Object (Word)

 Copy code hover
[image]

Sections Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of Section objects in a selection, range, or document.

Remarks

Use the Sections property to return the Sections collection. The following example inserts text at the end of the last section in the active document.

VBA Copy code Copy code
With ActiveDocument.Sections.Last.Range
 .Collapse Direction:=wdCollapseEnd
 .InsertAfter "end of document"
End With

Use the Add method or the InsertBreak method to add a new section to a document. The following example adds a new section at the beginning of the active document.

VBA Copy code Copy code
Set myRange = ActiveDocument.Range(Start:=0, End:=0)
ActiveDocument.Sections.Add Range:=myRange
myRange.InsertParagraphAfter

The following example displays the number of sections in the active document, adds a section break above the first paragraph in the selection, and then displays the number of sections again.

VBA Copy code Copy code
MsgBox ActiveDocument.Sections.Count & " sections"
Selection.Paragraphs(1).Range.InsertBreak _
 Type:=wdSectionBreakContinuous
MsgBox ActiveDocument.Sections.Count & " sections"

Use Sections(index), where index is the index number, to return a single Section object. The following example changes the left and right page margins for the first section in the active document.

VBA Copy code Copy code
With ActiveDocument.Sections(1).PageSetup
 .LeftMargin = InchesToPoints(0.5)
 .RightMargin = InchesToPoints(0.5)
End With

See also

Concepts

Word Object Model Reference

Other resources

Sections Object Members


Sections Members (Word)

 Copy code hover
[image]

Sections Members (Word)
Send feedback

Published: July 16, 2012

A collection of Section objects in a selection, range, or document.

Methods

Name | Description
Add | Returns a Section object that represents a new section added to a document.
Item | Returns an individual Section object in a collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of sections in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
First | Returns a Section object that represents the first item in the Sections collection.
Last | Returns the last item in the Sections collection as a Section object.
PageSetup | Returns a PageSetup object that's associated with the specified document, range, section, sections, or selection.
Parent | Returns an Object that represents the parent object of the specified Sections object.


Sections Properties (Word)

 Copy code hover
[image]

Sections Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of sections in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
First | Returns a Section object that represents the first item in the Sections collection.
Last | Returns the last item in the Sections collection as a Section object.
PageSetup | Returns a PageSetup object that's associated with the specified document, range, section, sections, or selection.
Parent | Returns an Object that represents the parent object of the specified Sections object.


Sections.Application Property (Word)

 Copy code hover
[image]

Sections.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a Sections collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

Sections Collection Object

Other resources

Sections Object Members


Sections.Count Property (Word)

 Copy code hover
[image]

Sections.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of sections in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents a Sections collection.

See also

Concepts

Sections Collection Object

Other resources

Sections Object Members


Sections.Creator Property (Word)

 Copy code hover
[image]

Sections.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a Sections collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Sections Collection Object

Other resources

Sections Object Members


Sections.First Property (Word)

 Copy code hover
[image]

Sections.First Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Section object that represents the first item in the Sections collection.

Syntax

expression .First

expression Required. A variable that represents a Sections collection.

See also

Concepts

Sections Collection Object

Other resources

Sections Object Members


Sections.Last Property (Word)

 Copy code hover
[image]

Sections.Last Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the last item in the Sections collection as a Section object.

Syntax

expression .Last

expression Required. A variable that represents a Sections collection.

See also

Concepts

Sections Collection Object

Other resources

Sections Object Members


Sections.PageSetup Property (Word)

 Copy code hover
[image]

Sections.PageSetup Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a PageSetup object that's associated with the specified document, range, section, sections, or selection.

Syntax

expression .PageSetup

expression A variable that represents a Sections collection.

Example

This example sets the gutter for the first section in Summary.doc to 36 points (0.5 inch).

VBA Copy code Copy code
Documents("Summary.doc").Sections(1).PageSetup.Gutter = 36

See also

Concepts

Sections Collection Object

Other resources

Sections Object Members


Sections.Parent Property (Word)

 Copy code hover
[image]

Sections.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Sections object.

Syntax

expression .Parent

expression Required. A variable that represents a Sections collection.

See also

Concepts

Sections Collection Object

Other resources

Sections Object Members


Sections Methods (Word)

 Copy code hover
[image]

Sections Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Returns a Section object that represents a new section added to a document.
Item | Returns an individual Section object in a collection.


Sections.Add Method (Word)

 Copy code hover
[image]

Sections.Add Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a Section object that represents a new section added to a document.

Syntax

expression .Add(Range, Start)

expression Required. A variable that represents a Sections collection.

Parameters

Name | Required/Optional | Data Type | Description
Range | Optional | Variant | The range before which you want to insert the section break. If this argument is omitted, the section break is inserted at the end of the document.
Start | Optional | Variant | The type of section break you want to add. Can be one of the WdSectionStart constants. If this argument is omitted, a Next Page section break is added.

Example

This example adds a Next Page section break before the third paragraph in the active document.

VBA Copy code Copy code
Set myRange = ActiveDocument.Paragraphs(3).Range
ActiveDocument.Sections.Add Range:=myRange

This example adds a Continuous section break at the selection.

VBA Copy code Copy code
Set myRange = Selection.Range
ActiveDocument.Sections.Add Range:=myRange, _
 Start:=wdSectionContinuous

This example adds a Next Page section break at the end of the active document.

VBA Copy code Copy code
ActiveDocument.Sections.Add

See also

Concepts

Sections Collection Object

Other resources

Sections Object Members


Sections.Item Method (Word)

 Copy code hover
[image]

Sections.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual Section object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents a Sections collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The individual object to be returned. Can be a Long indicating the ordinal position of the individual object.

Return Value

Section

See also

Concepts

Sections Collection Object

Other resources

Sections Object Members


Selection Object (Word)

 Copy code hover
[image]

Selection Object (Word)
See also Send feedback

Represents the current selection in a window or pane. A selection represents either a selected (or highlighted) area in the document, or it represents the insertion point if nothing in the document is selected. There can be only one Selection object per document window pane, and only one Selection object in the entire application can be active.

Remarks

Use the Selection property to return the Selection object. If no object qualifier is used with the Selection property, Microsoft Word returns the selection from the active pane of the active document window. The following example copies the current selection from the active document.

VBA Copy code Copy code
Selection.Copy

The following example deletes the selection from the third document in the Documents collection. The document does not have to be active to access its current selection.

VBA Copy code Copy code
Documents(3).ActiveWindow.Selection.Cut

The following example copies the selection from the first pane of the active document and pastes it into the second pane.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.Panes(1).Selection.Copy
ActiveDocument.ActiveWindow.Panes(2).Selection.Paste

The Text property is the default property of the Selection object. Use this property to set or return the text in the current selection. The following example assigns the text in the current selection to the variable strTemp, removing the last character if it is a paragraph mark.

VBA Copy code Copy code
Dim strTemp as String

strTemp = Selection.Text
If Right(strTemp, 1) = vbCr Then _
 strTemp = Left(strTemp, Len(strTemp) - 1)

The Selection object has various methods and properties with which you can collapse, expand, or otherwise change the current selection. The following example moves the insertion point to the end of the document and selects the last three lines.

VBA Copy code Copy code
Selection.EndOf Unit:=wdStory, Extend:=wdMove
Selection.HomeKey Unit:=wdLine, Extend:=wdExtend
Selection.MoveUp Unit:=wdLine, Count:=2, Extend:=wdExtend

The Selection object has various methods and properties with which you can edit selected text in a document. The following example selects the first sentence in the active document and replaces it with a new paragraph.

VBA Copy code Copy code
Options.ReplaceSelection = True
ActiveDocument.Sentences(1).Select
Selection.TypeText "Material below is confidential."
Selection.TypeParagraph

The following example deletes the last paragraph of the first document in the Documents collection and pastes it at the beginning of the second document.

VBA Copy code Copy code
With Documents(1)
 .Paragraphs.Last.Range.Select
 .ActiveWindow.Selection.Cut
End With

With Documents(2).ActiveWindow.Selection
 .StartOf Unit:=wdStory, Extend:=wdMove
 .Paste
End With

The Selection object has various methods and properties with which you can change the formatting of the current selection. The following example changes the font of the current selection from Times New Roman to Tahoma.

VBA Copy code Copy code
If Selection.Font.Name = "Times New Roman" Then _
 Selection.Font.Name = "Tahoma"

Use properties like Flags, Information, and Type to return information about the current selection. You can use the following example in a procedure to determine whether there is anything selected in the active document; if there is not, the rest of the procedure is skipped.

VBA Copy code Copy code
If Selection.Type = wdSelectionIP Then
 MsgBox Prompt:="You have not selected any text! Exiting procedure..."
 Exit Sub
End If

Even when a selection is collapsed to an insertion point, it is not necessarily empty. For example, the Text property will still return the character to the right of the insertion point; this character also appears in the Characters collection of the Selection object. However, calling methods like Cut or Copy from a collapsed selection causes an error.

It is possible for the user to select a region in a document that does not represent contiguous text (for example, when using the ALT key with the mouse). Because the behavior of such a selection can be unpredictable, you may want to include a step in your code that checks the Type property of a selection before performing any operations on it (Selection.Type = wdSelectionBlock). Similarly, selections that include table cells can also lead to unpredictable behavior. The Information property will tell you if a selection is inside a table (Selection.Information(wdWithinTable) = True). The following example determines if a selection is normal (for example, it is not a row or column in a table, it is not a vertical block of text); you could use it to test the current selection before performing any operations on it.

VBA Copy code Copy code
If Selection.Type <> wdSelectionNormal Then
 MsgBox Prompt:="Not a valid selection! Exiting procedure..."
 Exit Sub
End If

Because Range objects share many of the same methods and properties as Selection objects, using Range objects is preferable for manipulating a document when there is not a reason to physically change the current selection. For more information about Selection and Range objects, see Working with the Selection object and Working with Range objects.

See also

Concepts

Word Object Model Reference

Other resources

Selection Object Members


Selection Members (Word)

 Copy code hover
[image]

Selection Members (Word)
Send feedback

Represents the current selection in a window or pane. A selection represents either a selected (or highlighted) area in the document, or it represents the insertion point if nothing in the document is selected. There can be only one Selection object per document window pane, and only one Selection object in the entire application can be active.

Methods

Name | Description
BoldRun | Adds the bold character format to or removes it from the current run.
Calculate | Calculates a mathematical expression within a selection. Returns the result as a Single.
ClearCharacterAllFormatting | Removes all character formatting (formatting applied either through character styles or manually applied formatting) from the selected text.
ClearCharacterDirectFormatting | Removes character formatting (formatting that has been applied manually using the buttons on the ribbon or through the dialog boxes) from the selected text.
ClearCharacterStyle | Removes character formatting that has been applied through character styles from the selected text.
ClearFormatting | Removes text and paragraph formatting from a selection.
ClearParagraphAllFormatting | Removes all paragraph formatting (formatting applied either through paragraph styles or manually applied formatting) from the selected text.
ClearParagraphDirectFormatting | Removes paragraph formatting that has been applied manually (using the buttons on the ribbon or through the dialog boxes) from the selected text.
ClearParagraphStyle | Removes paragraph formatting that has been applied through paragraph styles from the selected text.
Collapse | Collapses a selection to the starting or ending position. After a selection is collapsed, the starting and ending points are equal.
ConvertToTable | Converts text within a range to a table. Returns the table as a Table object.
Copy | Copies the specified selection to the Clipboard.
CopyAsPicture | The CopyAsPicture method works the same way as the Copy method.
CopyFormat | Copies the character formatting of the first character in the selected text.
CreateAutoTextEntry | Adds a new AutoTextEntry object to the AutoTextEntries collection, based on the current selection.
CreateTextbox | Adds a default-size text box around the selection.
Cut | Removes the specified object from the document and moves it to the Clipboard.
Delete | Deletes the specified number of characters or words.
DetectLanguage | Analyzes the specified text to determine the language that it is written in.
EndKey | Moves or extends the selection to the end of the specified unit.
EndOf | Moves or extends the ending character position of a range or selection to the end of the nearest specified text unit.
EscapeKey | Cancels a mode such as extend or column select (equivalent to pressing the ESC key).
Expand | Expands the specified range or selection. Returns the number of characters added to the range or selection. Long.
ExportAsFixedFormat | Saves the current selection as PDF or XPS format. .
Extend | Turns on extend mode, or if extend mode is already on, extends the selection to the next larger unit of text.
GoTo | Moves the insertion point to the character position immediately preceding the specified item, and returns a Range object (except for the wdGoToGrammaticalError, wdGoToProofreadingError, or wdGoToSpellingError constant).
GoToEditableRange | Returns a Range object that represents an area of a document that can be modified by the specified user or group of users.
GoToNext | Returns a Range object that refers to the start position of the next item or location specified by the What argument. If you apply this method to the Selection object, the method moves the selection to the specified item (except for the wdGoToGrammaticalError, wdGoToProofreadingError, and wdGoToSpellingError constants).
GoToPrevious | Returns a Range object that refers to the start position of the previous item or location specified by the What argument. If applied to a Selection object, GoToPrevious moves the selection to the specified item. Range object.
HomeKey | Moves or extends the selection to the beginning of the specified unit. This method returns an integer that indicates the number of characters the selection was actually moved, or it returns 0 (zero) if the move was unsuccessful.This method corresponds to functionality of the HOME key.
InRange | True if the selection to which the method is applied is contained within the range specified by the Range argument.
InsertAfter | Inserts the specified text at the end of a range or selection.
InsertBefore | Inserts the specified text before the specified selection. .
InsertBreak | Inserts a page, column, or section break.
InsertCaption | Inserts a caption immediately preceding or following the specified selection.
InsertCells | Adds cells to an existing table.
InsertColumns | Inserts columns to the left of the column that contains the selection.
InsertColumnsRight | Inserts columns to the right of the current selection.
InsertCrossReference | Inserts a cross-reference to a heading, bookmark, footnote, or endnote, or to an item for which a caption label is defined (for example, an equation, figure, or table).
InsertDateTime | Inserts the current date or time, or both, either as text or as a TIME field.
InsertFile | Inserts all or part of the specified file.
InsertFormula | Inserts an = (Formula) field that contains a formula at the selection.
InsertNewPage | Inserts a new page at the position of the Insertion Point.
InsertParagraph | Replaces the specified selection with a new paragraph.
InsertParagraphAfter | Inserts a paragraph mark after a selection.
InsertParagraphBefore | Inserts a new paragraph before the specified selection or range.
InsertRows | Inserts the specified number of new rows above the row that contains the selection. If the selection isn't in a table, an error occurs.
InsertRowsAbove | Inserts rows above the current selection.
InsertRowsBelow | Inserts rows below the current selection.
InsertStyleSeparator | Inserts a special hidden paragraph mark that allows Microsoft Word to join paragraphs formatted using different paragraph styles, so lead-in headings can be inserted into a table of contents.
InsertSymbol | Inserts a symbol in place of the specified selection.
InsertXML | Inserts the specified XML into the document at the cursor, replacing any selected text.
InStory | True if the selection to which this method is applied is in the same story as the range specified by the Range argument.
IsEqual | True if the selection to which this method is applied is equal to the range specified by the Range argument.
ItalicRun | Adds the italic character format to or removes it from the current run.
LtrPara | Sets the reading order and alignment of the specified paragraphs to left-to-right.
LtrRun | Sets the reading order and alignment of the specified run to left-to-right.
Move | Collapses the specified selection to its start or end position and then moves the collapsed object by the specified number of units. This method returns a Long value that represents the number of units by which the selection was moved, or it returns 0 (zero) if the move was unsuccessful.
MoveDown | Moves the selection down and returns the number of units it has been moved.
MoveEnd | Moves the ending character position of a range or selection.
MoveEndUntil | Moves the end position of the specified selection until any of the specified characters are found in the document.
MoveEndWhile | Moves the ending character position of a selection while any of the specified characters are found in the document.
MoveLeft | Moves the selection to the left and returns the number of units it has been moved.
MoveRight | Moves the selection to the right and returns the number of units it has been moved.
MoveStart | Moves the start position of the specified selection.
MoveStartUntil | Moves the start position of the specified selection until one of the specified characters is found in the document. If the movement is backward through the document, the selection is expanded.
MoveStartWhile | Moves the start position of the specified selection while any of the specified characters are found in the document.
MoveUntil | Moves the specified selection until one of the specified characters is found in the document.
MoveUp | Moves the selection up and returns the number of units that it has been moved.
MoveWhile | Moves the specified selection while any of the specified characters are found in the document.
Next | Returns a Range object that represents the next unit relative to the specified selection.
NextField | Selects the next field.
NextRevision | Locates and returns the next tracked change as a Revision object.
NextSubdocument | Moves the selection to the next subdocument.
Paste | Inserts the contents of the Clipboard at the specified selection.
PasteAndFormat | Pastes the selected table cells and formats them as specified.
PasteAppendTable | Merges pasted cells into an existing table by inserting the pasted rows between the selected rows. No cells are overwritten.
PasteAsNestedTable | Pastes a cell or group of cells as a nested table into the selection.
PasteExcelTable | Pastes and formats a Microsoft Excel table.
PasteFormat | Applies formatting copied with the CopyFormat method to the selection.
PasteSpecial | Inserts the contents of the Clipboard.
Previous | Moves the selected text by the specified number of units, and returns a Range object relative to the collapsed selection.
PreviousField | Selects and returns the previous field.
PreviousRevision | Locates and returns the previous tracked change as a Revision object.
PreviousSubdocument | Moves the selection to the previous subdocument.
ReadingModeGrowFont | Increases the size of the displayed text one point size when the document is displayed in Reading mode.
ReadingModeShrinkFont | Decreases the size of the displayed text one point size when the document is displayed in Reading mode.
RtlPara | Sets the reading order and alignment of the specified paragraphs to right-to-left.
RtlRun | Sets the reading order and alignment of the specified run to right-to-left.
Select | Selects the specified text.
SelectCell | Selects the entire cell containing the current selection.
SelectColumn | Selects the column that contains the insertion point, or selects all columns that contain the selection.
SelectCurrentAlignment | Extends the selection forward until text with a different paragraph alignment is encountered.
SelectCurrentColor | Extends the selection forward until text with a different color is encountered.
SelectCurrentFont | Extends the selection forward until text in a different font or font size is encountered.
SelectCurrentIndent | Extends the selection forward until text with different left or right paragraph indents is encountered.
SelectCurrentSpacing | Extends the selection forward until a paragraph with different line spacing is encountered.
SelectCurrentTabs | Extends the selection forward until a paragraph with different tab stops is encountered.
SelectRow | Selects the row that contains the insertion point, or selects all rows that contain the selection.
SetRange | Sets the starting and ending character positions for the selection.
Shrink | Shrinks the selection to the next smaller unit of text.
ShrinkDiscontiguousSelection | Cancels the selection of all but the most recently selected text when a selection contains multiple, unconnected selections.
Sort | Sorts the paragraphs in the specified selection.
SortAscending | Sorts paragraphs or table rows in ascending alphanumeric order.
SortByHeadings | Sorts the headings in the specified selection.
SortDescending | Sorts paragraphs or table rows within the selection in descending alphanumeric order.
SplitTable | Inserts an empty paragraph above the first row in the selection. .
StartOf | Moves or extends the start position of the specified range or selection to the beginning of the nearest specified text unit. This method returns a Long that indicates the number of characters by which the range or selection was moved or extended. The method returns a negative number if the movement is backward through the document.
ToggleCharacterCode | Switches a selection between a Unicode character and its corresponding hexadecimal value.
TypeBackspace | Deletes the character preceding a collapsed selection (an insertion point).
TypeParagraph | Inserts a new, blank paragraph.
TypeText | Inserts the specified text.
WholeStory | Expands a selection to include the entire story.

Properties

Name | Description
Active | True if the selection in the specified window or pane is active. Read-only Boolean.
Application | Returns an Application object that represents the Microsoft Word application.
BookmarkID | Returns the number of the bookmark that encloses the beginning of the specified selection. Read-only Long.
Bookmarks | Returns a Bookmarks collection that represents all the bookmarks in a document, range, or selection. Read-only.
Borders | Returns a Borders collection that represents all the borders for the specified object.
Cells | Returns a Cells collection that represents the table cells in a selection. Read-only.
Characters | Returns a Characters collection that represents the characters in a document, range, or selection. Read-only.
ChildShapeRange | Returns a ShapeRange collection representing the child shapes contained within a selection.
Columns | Returns a Columns collection that represents all the table columns in a selection. Read-only.
ColumnSelectMode | True if column selection mode is active. Read/write Boolean.
Comments | Returns a Comments collection that represents all the comments in the specified. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Document | Returns a Document object associated with the specified selection. Read-only.
Editors | Returns an Editors object that represents all the users authorized to modify a selection within a document.
End | Returns or sets the ending character position of a selection. Read/write Long.
EndnoteOptions | Returns an EndnoteOptions object that represents the endnotes in a selection.
Endnotes | Returns an Endnotes collection that represents all the endnotes conatined within a selection. Read-only.
EnhMetaFileBits | Returns a Variant that represents a picture representation of how a selection or range of text appears.
ExtendMode | True if Extend mode is active. Read/write Boolean.
Fields | Returns a read-only Fields collection that represents all the fields in the selection.
Find | Returns a Find object that contains the criteria for a find operation. Read-only.
FitTextWidth | Returns or sets the width (in the current measurement units) in which Microsoft Word fits the text in the current selection. Read/write Single.
Flags | Returns or sets properties of the selection. Read/write WdSelectionFlags.
Font | Returns or sets a Font object that represents the character formatting of the specified object. Read/write.
FootnoteOptions | Returns FootnoteOptions object that represents the footnotes in a selection.
Footnotes | Returns a Footnotes collection that represents all the footnotes in a range, selection, or document. Read-only.
FormattedText | Returns or sets a Range object that includes the formatted text in the specified range or selection. Read/write.
FormFields | Returns a FormFields collection that represents all the form fields in the selection. Read-only.
Frames | Returns a Frames collection that represents all the frames in a selection. Read-only.
HasChildShapeRange | True if the selection contains child shapes. Read-only Boolean.
HeaderFooter | Returns a HeaderFooter object for the specified selection. Read-only.
HTMLDivisions | Returns an HTMLDivisions object that represents an HTML division in a Web document.
Hyperlinks | Returns a Hyperlinks collection that represents all the hyperlinks in the specified selection. Read-only.
Information | Returns information about the specified selection. Read-only Variant.
InlineShapes | Returns an InlineShapes collection that represents all the InlineShape objects in a selection. Read-only.
IPAtEndOfLine | True if the insertion point is at the end of a line that wraps to the next line. Read-only Boolean.
IsEndOfRowMark | True if the specified selection or range is collapsed and is located at the end-of-row mark in a table. Read-only Boolean.
LanguageDetected | Returns or sets a Boolean that specifies whether Microsoft Word has detected the language of the selected text.
LanguageID | Returns or sets the language for the specified object. Read/write .
LanguageIDFarEast | Returns or sets an East Asian language for the specified object. Read/write WdLanguageID.
LanguageIDOther | Returns or sets the language for the specified object. Read/write WdLanguageID.
NoProofing | True if the spelling and grammar checker ignores the specified text. Returns wdUndefined if the NoProofing property is set to True for only some of the specified text. Read/write Long.
OMaths | Returns an OMaths collection that represents the OMath objects within the current selection. Read-only.
Orientation | Returns or sets the orientation of text in a selection when the Text Direction feature is enabled. Read/write WdTextOrientation.
PageSetup | Returns a PageSetup object that's associated with the specified selection.
ParagraphFormat | Returns or sets a ParagraphFormat object that represents the paragraph settings for the specified selection. Read/write.
Paragraphs | Returns a Paragraphs collection that represents all the paragraphs in the specified selection. Read-only.
Parent | Returns an Object that represents the parent object of the specified Selection object.
PreviousBookmarkID | Returns the number of the last bookmark that starts before or at the same place as the specified selection or range; returns 0 (zero) if there is no corresponding bookmark. Read-only Long.
Range | Returns a Range object that represents the portion of a document that's contained in the specified object.
Rows | Returns a Rows collection that represents all the table rows in a range, selection, or table. Read-only.
Sections | Returns a Sections collection that represents the sections in the specified selection. Read-only.
Sentences | Returns a Sentences collection that represents all the sentences in the selection. Read-only.
Shading | Returns a Shading object that refers to the shading formatting for the specified selection.
ShapeRange | Returns a ShapeRange collection that represents all the Shape objects in the selection. Read-only.
Start | Returns or sets the starting character position of a selection. Read/write Long.
StartIsActive | True if the beginning of the selection is active. Read/write Boolean.
StoryLength | Returns the number of characters in the story that contains the specified selection. Read-only Long.
StoryType | Returns the story type for the specified selection. Read-only WdStoryType.
Style | Returns or sets the style for the specified object. To set this property, specify the local name of the style, an integer, a WdBuiltinStyle constant, or an object that represents the style. For a list of valid constants, consult the Microsoft Visual Basic Object Browser. Read/write Variant.
Tables | Returns a Tables collection that represents all the tables in the specified selection. Read-only.
Text | Returns or sets the text in the specified selection. Read/write String.
TopLevelTables | Returns a Tables collection that represents the tables at the outermost nesting level in the current selection. Read-only.
Type | Returns the selection type. Read-only WdSelectionType.
WordOpenXML | Returns a String that represents the XML contained within the selection in the Microsoft Word Open XML format. Read-only.
Words | Returns a Words collection that represents all the words in a selection. Read-only.
XML | Returns a String that represents the XML text in the specified object. .


Selection Properties (Word)

 Copy code hover
[image]

Selection Properties (Word)
Send feedback

This object has the following properties:

Properties

Name | Description
Active | True if the selection in the specified window or pane is active. Read-only Boolean.
Application | Returns an Application object that represents the Microsoft Word application.
BookmarkID | Returns the number of the bookmark that encloses the beginning of the specified selection. Read-only Long.
Bookmarks | Returns a Bookmarks collection that represents all the bookmarks in a document, range, or selection. Read-only.
Borders | Returns a Borders collection that represents all the borders for the specified object.
Cells | Returns a Cells collection that represents the table cells in a selection. Read-only.
Characters | Returns a Characters collection that represents the characters in a document, range, or selection. Read-only.
ChildShapeRange | Returns a ShapeRange collection representing the child shapes contained within a selection.
Columns | Returns a Columns collection that represents all the table columns in a selection. Read-only.
ColumnSelectMode | True if column selection mode is active. Read/write Boolean.
Comments | Returns a Comments collection that represents all the comments in the specified. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Document | Returns a Document object associated with the specified selection. Read-only.
Editors | Returns an Editors object that represents all the users authorized to modify a selection within a document.
End | Returns or sets the ending character position of a selection. Read/write Long.
EndnoteOptions | Returns an EndnoteOptions object that represents the endnotes in a selection.
Endnotes | Returns an Endnotes collection that represents all the endnotes conatined within a selection. Read-only.
EnhMetaFileBits | Returns a Variant that represents a picture representation of how a selection or range of text appears.
ExtendMode | True if Extend mode is active. Read/write Boolean.
Fields | Returns a read-only Fields collection that represents all the fields in the selection.
Find | Returns a Find object that contains the criteria for a find operation. Read-only.
FitTextWidth | Returns or sets the width (in the current measurement units) in which Microsoft Word fits the text in the current selection. Read/write Single.
Flags | Returns or sets properties of the selection. Read/write WdSelectionFlags.
Font | Returns or sets a Font object that represents the character formatting of the specified object. Read/write.
FootnoteOptions | Returns FootnoteOptions object that represents the footnotes in a selection.
Footnotes | Returns a Footnotes collection that represents all the footnotes in a range, selection, or document. Read-only.
FormattedText | Returns or sets a Range object that includes the formatted text in the specified range or selection. Read/write.
FormFields | Returns a FormFields collection that represents all the form fields in the selection. Read-only.
Frames | Returns a Frames collection that represents all the frames in a selection. Read-only.
HasChildShapeRange | True if the selection contains child shapes. Read-only Boolean.
HeaderFooter | Returns a HeaderFooter object for the specified selection. Read-only.
HTMLDivisions | Returns an HTMLDivisions object that represents an HTML division in a Web document.
Hyperlinks | Returns a Hyperlinks collection that represents all the hyperlinks in the specified selection. Read-only.
Information | Returns information about the specified selection. Read-only Variant.
InlineShapes | Returns an InlineShapes collection that represents all the InlineShape objects in a selection. Read-only.
IPAtEndOfLine | True if the insertion point is at the end of a line that wraps to the next line. Read-only Boolean.
IsEndOfRowMark | True if the specified selection or range is collapsed and is located at the end-of-row mark in a table. Read-only Boolean.
LanguageDetected | Returns or sets a Boolean that specifies whether Microsoft Word has detected the language of the selected text.
LanguageID | Returns or sets the language for the specified object. Read/write .
LanguageIDFarEast | Returns or sets an East Asian language for the specified object. Read/write WdLanguageID.
LanguageIDOther | Returns or sets the language for the specified object. Read/write WdLanguageID.
NoProofing | True if the spelling and grammar checker ignores the specified text. Returns wdUndefined if the NoProofing property is set to True for only some of the specified text. Read/write Long.
OMaths | Returns an OMaths collection that represents the OMath objects within the current selection. Read-only.
Orientation | Returns or sets the orientation of text in a selection when the Text Direction feature is enabled. Read/write WdTextOrientation.
PageSetup | Returns a PageSetup object that's associated with the specified selection.
ParagraphFormat | Returns or sets a ParagraphFormat object that represents the paragraph settings for the specified selection. Read/write.
Paragraphs | Returns a Paragraphs collection that represents all the paragraphs in the specified selection. Read-only.
Parent | Returns an Object that represents the parent object of the specified Selection object.
PreviousBookmarkID | Returns the number of the last bookmark that starts before or at the same place as the specified selection or range; returns 0 (zero) if there is no corresponding bookmark. Read-only Long.
Range | Returns a Range object that represents the portion of a document that's contained in the specified object.
Rows | Returns a Rows collection that represents all the table rows in a range, selection, or table. Read-only.
Sections | Returns a Sections collection that represents the sections in the specified selection. Read-only.
Sentences | Returns a Sentences collection that represents all the sentences in the selection. Read-only.
Shading | Returns a Shading object that refers to the shading formatting for the specified selection.
ShapeRange | Returns a ShapeRange collection that represents all the Shape objects in the selection. Read-only.
Start | Returns or sets the starting character position of a selection. Read/write Long.
StartIsActive | True if the beginning of the selection is active. Read/write Boolean.
StoryLength | Returns the number of characters in the story that contains the specified selection. Read-only Long.
StoryType | Returns the story type for the specified selection. Read-only WdStoryType.
Style | Returns or sets the style for the specified object. To set this property, specify the local name of the style, an integer, a WdBuiltinStyle constant, or an object that represents the style. For a list of valid constants, consult the Microsoft Visual Basic Object Browser. Read/write Variant.
Tables | Returns a Tables collection that represents all the tables in the specified selection. Read-only.
Text | Returns or sets the text in the specified selection. Read/write String.
TopLevelTables | Returns a Tables collection that represents the tables at the outermost nesting level in the current selection. Read-only.
Type | Returns the selection type. Read-only WdSelectionType.
WordOpenXML | Returns a String that represents the XML contained within the selection in the Microsoft Word Open XML format. Read-only.
Words | Returns a Words collection that represents all the words in a selection. Read-only.
XML | Returns a String that represents the XML text in the specified object. .


Selection.Active Property (Word)

 Copy code hover
[image]

Selection.Active Property (Word)
See also Send feedback

Published: July 16, 2012

True if the selection in the specified window or pane is active. Read-only Boolean.

Syntax

expression .Active

expression Required. A variable that represents a Selection object.

Example

This example splits the active window into two panes and activates the selection in the first pane, if it isn't already active.

VBA Copy code Copy code
Sub SplitWindow()
 ActiveDocument.ActiveWindow.Split = True
 If ActiveDocument.ActiveWindow.Panes(1).Selection _
 .Active = False Then
 ActiveDocument.ActiveWindow.Panes(1).Activate
 End If
End Sub

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.Application Property (Word)

 Copy code hover
[image]

Selection.Application Property (Word)
See also Send feedback

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression A variable that represents a Selection object.

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.BookmarkID Property (Word)

 Copy code hover
[image]

Selection.BookmarkID Property (Word)
See also Send feedback

Returns the number of the bookmark that encloses the beginning of the specified selection. Read-only Long.

Syntax

expression .BookmarkID

expression A variable that represents a Selection object.

Remarks

Returns 0 (zero) if there is no corresponding bookmark. The number corresponds to the position of the bookmark in the document—1 for the first bookmark, 2 for the second one, and so on.

Example

This example displays the number of the bookmark that encloses the beginning of the selection.

VBA Copy code Copy code
MsgBox "Bookmark " & Selection.BookmarkID

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.Bookmarks Property (Word)

 Copy code hover
[image]

Selection.Bookmarks Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Bookmarks collection that represents all the bookmarks in a document, range, or selection. Read-only.

Syntax

expression .Bookmarks

expression A variable that represents a Selection object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example applies bold formatting to the first range of bookmarked text in the selection.

VBA Copy code Copy code
If Selection.Bookmarks.Count >= 1 Then
 Selection.Bookmarks(1).Range.Bold = True
End If

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.Borders Property (Word)

 Copy code hover
[image]

Selection.Borders Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Borders collection that represents all the borders for the specified object.

Syntax

expression .Borders

expression A variable that represents a Selection object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.Cells Property (Word)

 Copy code hover
[image]

Selection.Cells Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Cells collection that represents the table cells in a selection. Read-only.

Syntax

expression .Cells

expression A variable that represents a Selection object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example sets the current cell's background color to red.

VBA Copy code Copy code
If Selection.Information(wdWithInTable) = True Then
 Selection.Cells(1).Shading.BackgroundPatternColorIndex = wdRed
Else
 MsgBox "The insertion point is not in a table."
End If

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.Characters Property (Word)

 Copy code hover
[image]

Selection.Characters Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Characters collection that represents the characters in a document, range, or selection. Read-only.

Syntax

expression .Characters

expression A variable that represents a Selection object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example displays the first character in the selection. If nothing is selected, the character immediately after the insertion point is displayed.

VBA Copy code Copy code
char = Selection.Characters(1).Text
MsgBox "The first character is... " & char

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.ChildShapeRange Property (Word)

 Copy code hover
[image]

Selection.ChildShapeRange Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a ShapeRange collection representing the child shapes contained within a selection.

Syntax

expression .ChildShapeRange

expression An expression that returns a Selection object.

Example

This example creates a new document with a drawing canvas, populates the drawing canvas with shapes, and then, after checking that the shapes selected are child shapes, fills the child shapes with a pattern.

VBA Copy code Copy code
Sub ChildShapes()
 Dim docNew As Document
 Dim shpCanvas As Shape

 'Create a new document with a drawing canvas and shapes
 Set docNew = Documents.Add
 Set shpCanvas = docNew.Shapes.AddCanvas( _
 Left:=100, Top:=100, Width:=200, Height:=200)
 shpCanvas.CanvasItems.AddShape msoShapeRectangle, _
 Left:=0, Top:=0, Width:=100, Height:=100
 shpCanvas.CanvasItems.AddShape msoShapeOval, _
 Left:=0, Top:=50, Width:=100, Height:=100
 shpCanvas.CanvasItems.AddShape msoShapeDiamond, _
 Left:=0, Top:=100, Width:=100, Height:=100

 'Select all shapes in the canvas
 shpCanvas.CanvasItems.SelectAll

 'Fill canvas child shapes with a pattern
 If Selection.HasChildShapeRange = True Then
 Selection.ChildShapeRange.Fill.Patterned msoPatternDivot
 Else
 MsgBox "This is not a range of child shapes."
 End If

End Sub

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.Columns Property (Word)

 Copy code hover
[image]

Selection.Columns Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Columns collection that represents all the table columns in a selection. Read-only.

Syntax

expression .Columns

expression An expression that returns a Selection object.

Example

This example sets the width of the current column to 1 inch.

VBA Copy code Copy code
If Selection.Information(wdWithInTable) = True Then
 Selection.Columns.SetWidth ColumnWidth:=InchesToPoints(1), _
 RulerStyle:=wdAdjustProportional
End If

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.ColumnSelectMode Property (Word)

 Copy code hover
[image]

Selection.ColumnSelectMode Property (Word)
See also Send feedback

Published: July 16, 2012

True if column selection mode is active. Read/write Boolean.

Syntax

expression .ColumnSelectMode

expression A variable that represents a Selection object.

Remarks

When this mode is active, the letters "COL" appear on the status bar.

Example

This example selects a column of text that's two words across and three lines deep. The example copies the selection to the Clipboard and cancels column selection mode.

VBA Copy code Copy code
With Selection
 .Collapse Direction:=wdCollapseStart
 .ColumnSelectMode = True
 .MoveRight Unit:=wdWord, Count:=2, Extend:=wdExtend
 .MoveDown Unit:=wdLine, Count:=2, Extend:=wdExtend
 .Copy
 .ColumnSelectMode = False
End With

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.Comments Property (Word)

 Copy code hover
[image]

Selection.Comments Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Comments collection that represents all the comments in the specified. Read-only.

Syntax

expression .Comments

expression A variable that represents a Selection object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example adds a comment to the selected text.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.View.ShowHiddenText = True
Selection.Comments.Add Range:=Selection.Range, Text:="Approved"

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.Creator Property (Word)

 Copy code hover
[image]

Selection.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression A variable that represents a Selection object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.Document Property (Word)

 Copy code hover
[image]

Selection.Document Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Document object associated with the specified selection. Read-only.

Syntax

expression .Document

expression A variable that represents a Selection object.

Example

This example displays the document name and path for the selection.

VBA Copy code Copy code
Msgbox Selection.Document.FullName

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.Editors Property (Word)

 Copy code hover
[image]

Selection.Editors Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Editors object that represents all the users authorized to modify a selection within a document.

Syntax

expression .Editors

expression A variable that represents a Selection object.

Example

The following example gives the current user editing permission to modify the active selection.

VBA Copy code Copy code
Dim objEditor As Editor

Set objEditor = Selection.Editors.Add(wdEditorCurrent)

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.End Property (Word)

 Copy code hover
[image]

Selection.End Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the ending character position of a selection. Read/write Long.

Syntax

expression .End

expression A variable that represents a Selection object.

Remarks

If this property is set to a value smaller than the Start property, the Start property is set to the same value (that is, the Start and End property are equal).

The Selection object has a starting position and an ending position. The ending position is the point farthest away from the beginning of the story. This property returns the ending character position relative to the beginning of the story. The main document story (wdMainTextStory) begins with character position 0 (zero). You can change the size of a selection by setting this property.

Example

This example retrieves the ending position of the selection. This value is used to create a range so that a field can be inserted after the selection.

VBA Copy code Copy code
pos = Selection.End
Set myRange = ActiveDocument.Range(Start:=pos, End:=pos)
ActiveDocument.Fields.Add Range:=myRange, Type:=wdFieldAuthor

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.EndnoteOptions Property (Word)

 Copy code hover
[image]

Selection.EndnoteOptions Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an EndnoteOptions object that represents the endnotes in a selection.

Syntax

expression .EndnoteOptions

expression A variable that represents a Selection object.

Example

This example sets the starting number for endnotes in the selected text.

VBA Copy code Copy code
Sub SetEndnoteOptionsRange()
 With Selection.EndnoteOptions
 If .StartingNumber <> 1 Then
 .StartingNumber = 1
 End If
 End With
End Sub

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.Endnotes Property (Word)

 Copy code hover
[image]

Selection.Endnotes Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Endnotes collection that represents all the endnotes conatined within a selection. Read-only.

Syntax

expression .Endnotes

expression A variable that represents a Selection object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example positions the endnotes in the selection at the end of the document and formats the endnote reference marks as lowercase roman numerals.

VBA Copy code Copy code
With Selection.Endnotes
 .Location = wdEndOfDocument
 .NumberStyle = wdNoteNumberStyleLowercaseRoman
End With

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.EnhMetaFileBits Property (Word)

 Copy code hover
[image]

Selection.EnhMetaFileBits Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Variant that represents a picture representation of how a selection or range of text appears.

Syntax

expression .EnhMetaFileBits

expression A variable that represents a Selection object.

Remarks

The EnhMetaFileBits property returns an array of bytes, which can be used with the Microsoft Windows 32 Application Programming Interface from within the Microsoft Visual Basic or Microsoft C++ development environment.

Example

The following example returns the EnhMetaFileBits property.

VBA Copy code Copy code
Dim bytSelection() As Byte

bytSelection = Selection.EnhMetaFileBits

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.ExtendMode Property (Word)

 Copy code hover
[image]

Selection.ExtendMode Property (Word)
See also Send feedback

Published: July 16, 2012

True if Extend mode is active. Read/write Boolean.

Syntax

expression .ExtendMode

expression An expression that returns a Selection object.

Remarks

When Extend mode is active, the Extend argument of the following methods is True by default: EndKey, HomeKey, MoveDown, MoveLeft, MoveRight, and MoveUp. Also, the letters "EXT" appear on the status bar.

This property can only be set during run time; attempts to set it in Immediate mode are ignored. The Extend arguments of the EndOf and StartOf methods are not affected by this property.

Example

This example moves to the beginning of the paragraph and selects the paragraph plus the next two sentences.

VBA Copy code Copy code
With Selection
 .MoveUp Unit:=wdParagraph
 .ExtendMode = True
 .MoveDown Unit:=wdParagraph
 .MoveRight Unit:=wdSentence, Count:=2
End With

This example collapses the current selection, turns on Extend mode, and selects the current sentence.

VBA Copy code Copy code
With Selection
 .Collapse
 .ExtendMode = True
 ' Select current word.
 .Extend
 ' Select current sentence.
 .Extend
End With

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.Fields Property (Word)

 Copy code hover
[image]

Selection.Fields Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a read-only Fields collection that represents all the fields in the selection.

Syntax

expression .Fields

expression Required. A variable that represents a Selection object.

Example

This example adds a DATE field at the insertion point.

VBA Copy code Copy code
With Selection
 .Collapse Direction:=wdCollapseStart
 .Fields.Add Range:=Selection.Range, Type:=wdFieldDate
End With

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.Find Property (Word)

 Copy code hover
[image]

Selection.Find Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Find object that contains the criteria for a find operation. Read-only.

Syntax

expression .Find

expression A variable that represents a Selection object.

Remarks

The selection is changed if the find operation is successful.

Example

The following example searches forward through the document for the word "Microsoft." If the word is found, it is automatically selected.

VBA Copy code Copy code
With Selection.Find
 .Forward = True
 .ClearFormatting
 .MatchWholeWord = True
 .MatchCase = False
 .Wrap = wdFindContinue
 .Execute FindText:="Microsoft"
End With

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.FitTextWidth Property (Word)

 Copy code hover
[image]

Selection.FitTextWidth Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the width (in the current measurement units) in which Microsoft Word fits the text in the current selection. Read/write Single.

Syntax

expression .FitTextWidth

expression A variable that represents a Selection object.

Example

This example fits the current selection into a space five centimeters wide.

VBA Copy code Copy code
Selection.FitTextWidth = CentimetersToPoints(5)

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.Flags Property (Word)

 Copy code hover
[image]

Selection.Flags Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets properties of the selection. Read/write WdSelectionFlags.

Syntax

expression .Flags

expression Required. An expression that returns a Selection object.

Example

This example selects the first word in the active document. The first message box displays "False" because the end of the selection is active. The Flags property makes the beginning of the selection active, and the second message box displays "True."

VBA Copy code Copy code
ActiveDocument.Words(1).Select
MsgBox Selection.StartIsActive
Selection.Flags = wdSelStartActive
MsgBox Selection.StartIsActive

This example turns on overtype mode for the selection.

VBA Copy code Copy code
Selection.Flags = wdSelStartActive

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.Font Property (Word)

 Copy code hover
[image]

Selection.Font Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Font object that represents the character formatting of the specified object. Read/write.

Syntax

expression .Font

expression A variable that represents a Selection object.

Remarks

To set the Font property, specify an expression that returns a Font object.

Example

This example displays the font of the selected text.

VBA Copy code Copy code
MsgBox Selection.Font.Name

This example applies the character formatting of the selected text to the first paragraph in the active document.

VBA Copy code Copy code
Set myFont = Selection.Font.Duplicate
ActiveDocument.Paragraphs(1).Range.Font = myFont

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.FootnoteOptions Property (Word)

 Copy code hover
[image]

Selection.FootnoteOptions Property (Word)
See also Send feedback

Published: July 16, 2012

Returns FootnoteOptions object that represents the footnotes in a selection.

Syntax

expression .FootnoteOptions

expression A variable that represents a Selection object.

Example

This example sets the numbering rule in the selection to restart at the beginning of the new section.

VBA Copy code Copy code
Sub SetFootnoteOptionsRange()
 Selection.FootnoteOptions.NumberingRule = wdRestartSection
End Sub

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.Footnotes Property (Word)

 Copy code hover
[image]

Selection.Footnotes Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Footnotes collection that represents all the footnotes in a range, selection, or document. Read-only.

Syntax

expression .Footnotes

expression A variable that represents a Selection object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example inserts an automatically numbered footnote at the insertion point.

VBA Copy code Copy code
Selection.Collapse Direction:=wdCollapseStart
Selection.Footnotes.Add Range:=Selection.Range, _
 Text:="(Lone Creek Press, 1995)"

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.FormattedText Property (Word)

 Copy code hover
[image]

Selection.FormattedText Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Range object that includes the formatted text in the specified range or selection. Read/write.

Syntax

expression .FormattedText

expression A variable that represents a Selection object.

Remarks

This property returns a Range object with the character formatting and text from the specified range or selection. Paragraph formatting is included in the Range object if there is a paragraph mark in the range or selection.

When you set this property, the text in the range is replaced with formatted text. If you don't want to replace the existing text, use the Collapse method before using this property (see the first example).

Example

This example copies the first paragraph in the document, including its formatting, and inserts the formatted text at the insertion point.

VBA Copy code Copy code
Selection.Collapse Direction:=wdCollapseStart
Selection.FormattedText = ActiveDocument.Paragraphs(1).Range

This example copies the text and formatting from the selection into a new document.

VBA Copy code Copy code
Set myRange = Selection.FormattedText
Documents.Add.Content.FormattedText = myRange

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.FormFields Property (Word)

 Copy code hover
[image]

Selection.FormFields Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a FormFields collection that represents all the form fields in the selection. Read-only.

Syntax

expression .FormFields

expression A variable that represents a Selection object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example displays the name of the first form field in the selection.

VBA Copy code Copy code
If Selection.FormFields.Count > 0 Then
 MsgBox Selection.FormFields(1).Name
End If

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.Frames Property (Word)

 Copy code hover
[image]

Selection.Frames Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Frames collection that represents all the frames in a selection. Read-only.

Syntax

expression .Frames

expression A variable that represents a Selection object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example causes text to wrap around frames in the first section in the active document.

VBA Copy code Copy code
For Each aFrame In ActiveDocument.Sections(1).Range.Frames
 aFrame.TextWrap = True
Next aFrame

This example adds a frame around the selection and returns a frame object to the myFrame variable.

VBA Copy code Copy code
Set myFrame = ActiveDocument.Frames.Add(Range:=Selection.Range)

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.HasChildShapeRange Property (Word)

 Copy code hover
[image]

Selection.HasChildShapeRange Property (Word)
See also Send feedback

Published: July 16, 2012

True if the selection contains child shapes. Read-only Boolean.

Syntax

expression .HasChildShapeRange

expression An expression that returns a Selection object.

Example

This example creates a new document with a drawing canvas, populates the drawing canvas with shapes, and then, after checking that the shapes are child shapes, fills the child shapes with a pattern.

VBA Copy code Copy code
Sub ChildShapes()
 Dim docNew As Document
 Dim shpCanvas As Shape

 'Create a new document with a drawing canvas and shapes
 Set docNew = Documents.Add
 Set shpCanvas = docNew.Shapes.AddCanvas( _
 Left:=100, Top:=100, Width:=200, Height:=200)
 shpCanvas.CanvasItems.AddShape msoShapeRectangle, _
 Left:=0, Top:=0, Width:=100, Height:=100
 shpCanvas.CanvasItems.AddShape msoShapeOval, _
 Left:=0, Top:=50, Width:=100, Height:=100
 shpCanvas.CanvasItems.AddShape msoShapeDiamond, _
 Left:=0, Top:=100, Width:=100, Height:=100

 'Select all shapes in the canvas
 shpCanvas.CanvasItems.SelectAll

 'Fill canvas child shapes with a pattern
 If Selection.HasChildShapeRange = True Then
 Selection.ChildShapeRange.Fill.Patterned msoPatternDivot
 Else
 MsgBox "This is not a range of child shapes."
 End If

End Sub

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.HeaderFooter Property (Word)

 Copy code hover
[image]

Selection.HeaderFooter Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a HeaderFooter object for the specified selection. Read-only.

Syntax

expression .HeaderFooter

expression A variable that represents a Selection object.

Remarks

An error occurs if the selection isn't located within a header or footer.

Example

This example adds a centered page number to the current page footer.

VBA Copy code Copy code
With ActiveDocument.ActiveWindow.View
 .Type = wdPrintView
 .SeekView = wdSeekCurrentPageFooter
End With
Selection.HeaderFooter.PageNumbers.Add _
 PageNumberAlignment:=wdAlignPageNumberCenter

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.HTMLDivisions Property (Word)

 Copy code hover
[image]

Selection.HTMLDivisions Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an HTMLDivisions object that represents an HTML division in a Web document.

Syntax

expression .HTMLDivisions

expression Required. A variable that represents a Selection object.

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.Hyperlinks Property (Word)

 Copy code hover
[image]

Selection.Hyperlinks Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Hyperlinks collection that represents all the hyperlinks in the specified selection. Read-only.

Syntax

expression .Hyperlinks

expression A variable that represents a Selection object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example jumps to the address of the first hyperlink in the selection.

VBA Copy code Copy code
If Selection.Hyperlinks.Count >= 1 Then
 Selection.Hyperlinks(1).Follow
End If

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.Information Property (Word)

 Copy code hover
[image]

Selection.Information Property (Word)
See also Send feedback

Published: July 16, 2012

Returns information about the specified selection. Read-only Variant.

Syntax

expression .Information(Type)

expression Required. A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
Type | Required | WdInformation | The information type.

Example

This example displays the current page number and the total number of pages in the active document.

VBA Copy code Copy code
MsgBox "The selection is on page " & _
 Selection.Information(wdActiveEndPageNumber) & " of page " _
 & Selection.Information(wdNumberOfPagesInDocument)

If the selection is in a table, this example selects the table.

VBA Copy code Copy code
If Selection.Information(wdWithInTable) Then _
 Selection.Tables(1).Select

This example displays a message that indicates the current section number.

VBA Copy code Copy code
Selection.Collapse Direction:=wdCollapseStart
MsgBox "The insertion point is in section " & _
 Selection.Information(wdActiveEndSectionNumber)

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.InlineShapes Property (Word)

 Copy code hover
[image]

Selection.InlineShapes Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an InlineShapes collection that represents all the InlineShape objects in a selection. Read-only.

Syntax

expression .InlineShapes

expression A variable that represents a Selection object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example displays the number of shapes and inline shapes in the active document.

VBA Copy code Copy code
Set doc = ActiveDocument
Msgbox "InlineShape = " & doc.InlineShapes.Count & _
 vbCr & "Shapes = " & doc.Shapes.Count

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.IPAtEndOfLine Property (Word)

 Copy code hover
[image]

Selection.IPAtEndOfLine Property (Word)
See also Send feedback

Published: July 16, 2012

True if the insertion point is at the end of a line that wraps to the next line. Read-only Boolean.

Syntax

expression .IPAtEndOfLine

expression A variable that represents a Selection object.

Remarks

False if the selection isn't collapsed, if the insertion point isn't at the end of a line, or if the insertion point is positioned before a paragraph mark.

Example

If the insertion point isn't already at the end of the line, this example moves it there.

VBA Copy code Copy code
Selection.Collapse Direction:=wdCollapseEnd
If Selection.IPAtEndOfLine = False Then
 Selection.EndKey Unit:=wdLine, Extend:=wdMove
End If

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.IsEndOfRowMark Property (Word)

 Copy code hover
[image]

Selection.IsEndOfRowMark Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified selection or range is collapsed and is located at the end-of-row mark in a table. Read-only Boolean.

Syntax

expression .IsEndOfRowMark

expression A variable that represents a Selection object.

Remarks

This property is the equivalent of the following expression:

VBA Copy code Copy code
Selection.Information(wdAtEndOfRowMarker)

Example

This example collapses the selection and selects the current row if the insertion point is at the end of the row (just before the end-of-row mark).

VBA Copy code Copy code
Selection.Collapse Direction:=wdCollapseEnd
If Selection.IsEndOfRowMark = True Then
 Selection.Rows(1).Select
End If

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.LanguageDetected Property (Word)

 Copy code hover
[image]

Selection.LanguageDetected Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that specifies whether Microsoft Word has detected the language of the selected text.

Syntax

expression .LanguageDetected

expression Required. A variable that represents a Selection object.

Remarks

Check the LanguageID property for the results of any previous language detection.

The LanguageDetected property is set to True when the DetectLanguage method is called. To reevaluate the language of the specified text, you must first set the LanguageDetected property to False.

Example

This example checks the active document to determine the language it's written in and then displays the result.

VBA Copy code Copy code
With Selection
 If .LanguageDetected = True Then
 x = MsgBox("This document has already " _
 & "been checked. Do you want to check " _
 & "it again?", vbYesNo)
 If x = vbYes Then
 .LanguageDetected = False
 .DetectLanguage
 End If
 Else
 .DetectLanguage
 End If
 If .Range.LanguageID = wdEnglishUS Then
 MsgBox "This is a U.S. English document."
 Else
 MsgBox "This is not a U.S. English document."
 End If
End With

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.LanguageID Property (Word)

 Copy code hover
[image]

Selection.LanguageID Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the language for the specified object. Read/write .

Syntax

expression .LanguageID

expression Required. A variable that represents a Selection object.

Remarks

For a custom dictionary, you must first set the LanguageSpecific property to True before specifying the LanguageID property. Custom dictionaries that are language-specific check only text that is formatted for that language.

Some of the constants listed above may not be available to you, depending on the language support (U.S. English, for example) that you have selected or installed.

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.LanguageIDFarEast Property (Word)

 Copy code hover
[image]

Selection.LanguageIDFarEast Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets an East Asian language for the specified object. Read/write WdLanguageID.

Syntax

expression .LanguageIDFarEast

expression Required. A variable that represents a Selection object.

Remarks

This is the recommended way to return or set the language of East Asian text in a document created in an East Asian version of Microsoft Word.

Example

This example sets the language of the selection to Korean.

VBA Copy code Copy code
Selection.LanguageIDFarEast = wdKorean

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.LanguageIDOther Property (Word)

 Copy code hover
[image]

Selection.LanguageIDOther Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the language for the specified object. Read/write WdLanguageID.

Syntax

expression .LanguageIDOther

expression Required. A variable that represents a Selection object.

Remarks

This is the recommended way to return or set the language of Latin text in a document created in a right-to-left language version of Microsoft Word.

Example

This example sets the language of the selection to French.

VBA Copy code Copy code
Selection.LanguageIDOther = wdFrench

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.NoProofing Property (Word)

 Copy code hover
[image]

Selection.NoProofing Property (Word)
See also Send feedback

Published: July 16, 2012

True if the spelling and grammar checker ignores the specified text. Returns wdUndefined if the NoProofing property is set to True for only some of the specified text. Read/write Long.

Syntax

expression .NoProofing

expression A variable that represents a Selection object.

Example

This example marks the current selection to be ignored by the spelling and grammar checker.

VBA Copy code Copy code
Selection.NoProofing = True

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.OMaths Property (Word)

 Copy code hover
[image]

Selection.OMaths Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an OMaths collection that represents the OMath objects within the current selection. Read-only.

Syntax

expression .OMaths

expression An expression that returns a Selection object.

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.Orientation Property (Word)

 Copy code hover
[image]

Selection.Orientation Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the orientation of text in a selection when the Text Direction feature is enabled. Read/write WdTextOrientation.

Syntax

expression .Orientation

expression Required. A variable that represents a Selection object.

Remarks

Some of the WdTextOrientation constants may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.

You can set the orientation for a text frame or for a selection that happens to occur inside a text frame. For information about the difference between a text frame and a text box, see the TextFrame object.

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.PageSetup Property (Word)

 Copy code hover
[image]

Selection.PageSetup Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a PageSetup object that's associated with the specified selection.

Syntax

expression .PageSetup

expression A variable that represents a Selection object.

Example

This example sets the header and footer distance to 18 points (0.25 inch) from the top and bottom of the page, respectively. This formatting change is applied to the section that contains the selection.

VBA Copy code Copy code
With Selection.PageSetup
 .FooterDistance = 18
 .HeaderDistance = 18
End With

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.ParagraphFormat Property (Word)

 Copy code hover
[image]

Selection.ParagraphFormat Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a ParagraphFormat object that represents the paragraph settings for the specified selection. Read/write.

Syntax

expression .ParagraphFormat

expression A variable that represents a Selection object.

Example

This example sets the paragraph formatting for the current selection to be right-aligned.

VBA Copy code Copy code
Selection.ParagraphFormat.Alignment = wdAlignParagraphRight

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.Paragraphs Property (Word)

 Copy code hover
[image]

Selection.Paragraphs Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Paragraphs collection that represents all the paragraphs in the specified selection. Read-only.

Syntax

expression .Paragraphs

expression A variable that represents a Selection object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example sets the line spacing to double for the first paragraph in the selection.

VBA Copy code Copy code
Selection.Paragraphs(1).LineSpacingRule = wdLineSpaceDouble

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.Parent Property (Word)

 Copy code hover
[image]

Selection.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Selection object.

Syntax

expression .Parent

expression A variable that represents a Selection object.

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.PreviousBookmarkID Property (Word)

 Copy code hover
[image]

Selection.PreviousBookmarkID Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the number of the last bookmark that starts before or at the same place as the specified selection or range; returns 0 (zero) if there is no corresponding bookmark. Read-only Long.

Syntax

expression .PreviousBookmarkID

expression A variable that represents a Selection object.

Example

This example selects the previous bookmark in the active document.

VBA Copy code Copy code
num = Selection.PreviousBookmarkID
If num <> 0 Then ActiveDocument.Content.Bookmarks(num).Select

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.Range Property (Word)

 Copy code hover
[image]

Selection.Range Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the portion of a document that's contained in the specified object.

Syntax

expression .Range

expression Required. A variable that represents a Selection object.

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.Rows Property (Word)

 Copy code hover
[image]

Selection.Rows Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Rows collection that represents all the table rows in a range, selection, or table. Read-only.

Syntax

expression .Rows

expression A variable that represents a Selection object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example places a border around the cells in the row that contains the insertion point.

VBA Copy code Copy code
Selection.Collapse Direction:=wdCollapseStart
If Selection.Information(wdWithInTable) = True Then
 Selection.Rows(1).Borders.OutsideLineStyle = wdLineStyleSingle
Else
 MsgBox "The insertion point is not in a table."
End If

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.Sections Property (Word)

 Copy code hover
[image]

Selection.Sections Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Sections collection that represents the sections in the specified selection. Read-only.

Syntax

expression .Sections

expression A variable that represents a Selection object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.Sentences Property (Word)

 Copy code hover
[image]

Selection.Sentences Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Sentences collection that represents all the sentences in the selection. Read-only.

Syntax

expression .Sentences

expression A variable that represents a Selection object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.Shading Property (Word)

 Copy code hover
[image]

Selection.Shading Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Shading object that refers to the shading formatting for the specified selection.

Syntax

expression .Shading

expression Required. A variable that represents a Selection object.

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.ShapeRange Property (Word)

 Copy code hover
[image]

Selection.ShapeRange Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a ShapeRange collection that represents all the Shape objects in the selection. Read-only.

Syntax

expression .ShapeRange

expression A variable that represents a Selection object.

Remarks

The shape range can contain drawings, shapes, pictures, OLE objects, ActiveX controls, text objects, and callouts.

Example

The following example applies shadow formatting to all the shapes in the selection.

VBA Copy code Copy code
Selection.ShapeRange.Shadow.Type = msoShadow6

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.Start Property (Word)

 Copy code hover
[image]

Selection.Start Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the starting character position of a selection. Read/write Long.

Syntax

expression .Start

expression A variable that represents a Selection object.

Remarks

Selection objects have starting and ending character positions. The starting position refers to the character position closest to the beginning of the story. If this property is set to a value larger than that of the End property, the End property is set to the same value as that of Start property.

This property returns the starting character position relative to the beginning of the story. The main text story (wdMainTextStory) begins with character position 0 (zero). You can change the size of a selection, range, or bookmark by setting this property.

Example

This example determines the length of the selection by comparing the starting and ending character positions.

VBA Copy code Copy code
SelLength = Selection.End - Selection.Start

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.StartIsActive Property (Word)

 Copy code hover
[image]

Selection.StartIsActive Property (Word)
See also Send feedback

Published: July 16, 2012

True if the beginning of the selection is active. Read/write Boolean.

Syntax

expression .StartIsActive

expression An expression that returns a Selection object.

Remarks

If the selection is not collapsed to an insertion point, either the beginning or the end of the selection is active. The active end of the selection moves when you call the following methods: EndKey , Extend (with the Characters argument), HomeKey , MoveDown , MoveLeft , MoveRight , and MoveUp.

This property is equivalent to using the Flags property with the wdSelStartActive constant. However, using the Flags property requires binary operations, which are more complicated than using the StartIsActive property.

Example

This example extends the current selection through the next two words. To make sure that any currently selected text stays selected during the extension, the end of the selection is made active first. (For example, if the first three words of this paragraph were selected but the start of the selection were active, the MoveRight method call would cancel the selection of the first two words.)

VBA Copy code Copy code
With Selection
 .StartIsActive = False
 .MoveRight Unit:=wdWord, Count:=2, Extend:=wdExtend
End With

Here is the same example using the Flags property. This solution is problematic because you can only deactivate a Flags property setting by overwriting it with an unrelated value.

VBA Copy code Copy code
With Selection
 If (.Flags And wdSelStartActive) = wdSelStartActive Then _
 .Flags = wdSelReplace
 .MoveRight Unit:=wdWord, Count:=2, Extend:=wdExtend
End With

Here is the same example using the MoveEnd method, which eliminates the need to check which end of the selection is active.

VBA Copy code Copy code
With Selection
 .MoveEnd Unit:=wdWord, Count:=2
End With

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.StoryLength Property (Word)

 Copy code hover
[image]

Selection.StoryLength Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the number of characters in the story that contains the specified selection. Read-only Long.

Syntax

expression .StoryLength

expression A variable that represents a Selection object.

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.StoryType Property (Word)

 Copy code hover
[image]

Selection.StoryType Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the story type for the specified selection. Read-only WdStoryType.

Syntax

expression .StoryType

expression Required. A variable that represents a Selection object.

Example

This example returns the story type of the selection.

VBA Copy code Copy code
story = Selection.StoryType

This example closes the footnote pane if the selection is contained in the footnote story.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.View.Type = wdNormalView
If Selection.StoryType = wdFootnotesStory Then _
 ActiveDocument.ActiveWindow.ActivePane.Close

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.Style Property (Word)

 Copy code hover
[image]

Selection.Style Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the style for the specified object. To set this property, specify the local name of the style, an integer, a WdBuiltinStyle constant, or an object that represents the style. For a list of valid constants, consult the Microsoft Visual Basic Object Browser. Read/write Variant.

Syntax

expression .Style

expression Required. A variable that represents a Selection object.

Remarks

When you return the style for a selection that includes more than one style, only the first character or paragraph style is returned.

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.Tables Property (Word)

 Copy code hover
[image]

Selection.Tables Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Tables collection that represents all the tables in the specified selection. Read-only.

Syntax

expression .Tables

expression A variable that represents a Selection object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.Text Property (Word)

 Copy code hover
[image]

Selection.Text Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the text in the specified selection. Read/write String.

Syntax

expression .Text

expression A variable that represents a Selection object.

Remarks

The Text property returns the plain, unformatted text of the selection. When you set this property, the text of the range or selection is replaced.

Example

This example displays the text in the selection. If nothing is selected, the character following the insertion point is displayed.

VBA Copy code Copy code
MsgBox Selection.Text

This example inserts 10 lines of text into a new document.

VBA Copy code Copy code
Documents.Add
For i = 1 To 10
 Selection.Text = "Line" & Str(i) & Chr(13)
 Selection.MoveDown Unit:=wdParagraph, Count:=1
Next i

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.TopLevelTables Property (Word)

 Copy code hover
[image]

Selection.TopLevelTables Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Tables collection that represents the tables at the outermost nesting level in the current selection. Read-only.

Syntax

expression .TopLevelTables

expression A variable that represents a Selection object.

Remarks

This method returns a collection containing only those tables at the outermost nesting level within the context of the current selection. These tables may not be at the outermost nesting level within the entire set of nested tables.

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example creates a new document, creates a nested table with three levels, and then fills the first cell of each table with its nesting level. The example selects the second column of the second-level table and then selects the first of the top-level tables in this selection. The innermost table is selected, even though it isn't a top-level table within the context of the entire set of nested tables.

VBA Copy code Copy code
Documents.Add
ActiveDocument.Tables.Add Selection.Range, _
 3, 3, wdWord9TableBehavior, wdAutoFitContent
With ActiveDocument.Tables(1).Range
 .Copy
 .Cells(1).Range.Text = .Cells(1).NestingLevel
 .Cells(5).Range.PasteAsNestedTable
 With .Cells(5).Tables(1).Range
 .Cells(1).Range.Text = .Cells(1).NestingLevel
 .Cells(5).Range.PasteAsNestedTable
 With .Cells(5).Tables(1).Range
 .Cells(1).Range.Text = _
 .Cells(1).NestingLevel
 End With
 .Columns(2).Select
 Selection.TopLevelTables(1).Select
 End With
End With

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.Type Property (Word)

 Copy code hover
[image]

Selection.Type Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the selection type. Read-only WdSelectionType.

Syntax

expression .Type

expression An expression that returns a Selection object.

Example

This example formats the selection as engraved if the selection is not an insertion point.

VBA Copy code Copy code
If Selection.Type <> wdSelectionIP Then
 Selection.Font.Engrave = True
Else
 MsgBox "You need to select some text."
End If

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.WordOpenXML Property (Word)

 Copy code hover
[image]

Selection.WordOpenXML Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a String that represents the XML contained within the selection in the Microsoft Word Open XML format. Read-only.

Syntax

expression .WordOpenXML

expression An expression that returns a Selection object.

Remarks

This property returns only the XML in the document that is needed to represent the specified selection.

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.Words Property (Word)

 Copy code hover
[image]

Selection.Words Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Words collection that represents all the words in a selection. Read-only.

Syntax

expression .Words

expression A variable that represents a Selection object.

Remarks

Punctuation and paragraph marks in a document are included in the Words collection. For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example displays the number of words in the selection. Paragraphs marks, partial words, and punctuation are included in the count.

VBA Copy code Copy code
MsgBox "There are " & Selection.Words.Count & " words."

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.XML Property (Word)

 Copy code hover
[image]

Selection.XML Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a String that represents the XML text in the specified object. .

Syntax

expression .XML(DataOnly)

expression An expression that returns a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
DataOnly | Optional | Boolean | True returns the text of the XML without the Word XML markup. The default setting is False.

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection Methods (Word)

 Copy code hover
[image]

Selection Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
BoldRun | Adds the bold character format to or removes it from the current run.
Calculate | Calculates a mathematical expression within a selection. Returns the result as a Single.
ClearCharacterAllFormatting | Removes all character formatting (formatting applied either through character styles or manually applied formatting) from the selected text.
ClearCharacterDirectFormatting | Removes character formatting (formatting that has been applied manually using the buttons on the ribbon or through the dialog boxes) from the selected text.
ClearCharacterStyle | Removes character formatting that has been applied through character styles from the selected text.
ClearFormatting | Removes text and paragraph formatting from a selection.
ClearParagraphAllFormatting | Removes all paragraph formatting (formatting applied either through paragraph styles or manually applied formatting) from the selected text.
ClearParagraphDirectFormatting | Removes paragraph formatting that has been applied manually (using the buttons on the ribbon or through the dialog boxes) from the selected text.
ClearParagraphStyle | Removes paragraph formatting that has been applied through paragraph styles from the selected text.
Collapse | Collapses a selection to the starting or ending position. After a selection is collapsed, the starting and ending points are equal.
ConvertToTable | Converts text within a range to a table. Returns the table as a Table object.
Copy | Copies the specified selection to the Clipboard.
CopyAsPicture | The CopyAsPicture method works the same way as the Copy method.
CopyFormat | Copies the character formatting of the first character in the selected text.
CreateAutoTextEntry | Adds a new AutoTextEntry object to the AutoTextEntries collection, based on the current selection.
CreateTextbox | Adds a default-size text box around the selection.
Cut | Removes the specified object from the document and moves it to the Clipboard.
Delete | Deletes the specified number of characters or words.
DetectLanguage | Analyzes the specified text to determine the language that it is written in.
EndKey | Moves or extends the selection to the end of the specified unit.
EndOf | Moves or extends the ending character position of a range or selection to the end of the nearest specified text unit.
EscapeKey | Cancels a mode such as extend or column select (equivalent to pressing the ESC key).
Expand | Expands the specified range or selection. Returns the number of characters added to the range or selection. Long.
ExportAsFixedFormat | Saves the current selection as PDF or XPS format. .
Extend | Turns on extend mode, or if extend mode is already on, extends the selection to the next larger unit of text.
GoTo | Moves the insertion point to the character position immediately preceding the specified item, and returns a Range object (except for the wdGoToGrammaticalError, wdGoToProofreadingError, or wdGoToSpellingError constant).
GoToEditableRange | Returns a Range object that represents an area of a document that can be modified by the specified user or group of users.
GoToNext | Returns a Range object that refers to the start position of the next item or location specified by the What argument. If you apply this method to the Selection object, the method moves the selection to the specified item (except for the wdGoToGrammaticalError, wdGoToProofreadingError, and wdGoToSpellingError constants).
GoToPrevious | Returns a Range object that refers to the start position of the previous item or location specified by the What argument. If applied to a Selection object, GoToPrevious moves the selection to the specified item. Range object.
HomeKey | Moves or extends the selection to the beginning of the specified unit. This method returns an integer that indicates the number of characters the selection was actually moved, or it returns 0 (zero) if the move was unsuccessful.This method corresponds to functionality of the HOME key.
InRange | True if the selection to which the method is applied is contained within the range specified by the Range argument.
InsertAfter | Inserts the specified text at the end of a range or selection.
InsertBefore | Inserts the specified text before the specified selection. .
InsertBreak | Inserts a page, column, or section break.
InsertCaption | Inserts a caption immediately preceding or following the specified selection.
InsertCells | Adds cells to an existing table.
InsertColumns | Inserts columns to the left of the column that contains the selection.
InsertColumnsRight | Inserts columns to the right of the current selection.
InsertCrossReference | Inserts a cross-reference to a heading, bookmark, footnote, or endnote, or to an item for which a caption label is defined (for example, an equation, figure, or table).
InsertDateTime | Inserts the current date or time, or both, either as text or as a TIME field.
InsertFile | Inserts all or part of the specified file.
InsertFormula | Inserts an = (Formula) field that contains a formula at the selection.
InsertNewPage | Inserts a new page at the position of the Insertion Point.
InsertParagraph | Replaces the specified selection with a new paragraph.
InsertParagraphAfter | Inserts a paragraph mark after a selection.
InsertParagraphBefore | Inserts a new paragraph before the specified selection or range.
InsertRows | Inserts the specified number of new rows above the row that contains the selection. If the selection isn't in a table, an error occurs.
InsertRowsAbove | Inserts rows above the current selection.
InsertRowsBelow | Inserts rows below the current selection.
InsertStyleSeparator | Inserts a special hidden paragraph mark that allows Microsoft Word to join paragraphs formatted using different paragraph styles, so lead-in headings can be inserted into a table of contents.
InsertSymbol | Inserts a symbol in place of the specified selection.
InsertXML | Inserts the specified XML into the document at the cursor, replacing any selected text.
InStory | True if the selection to which this method is applied is in the same story as the range specified by the Range argument.
IsEqual | True if the selection to which this method is applied is equal to the range specified by the Range argument.
ItalicRun | Adds the italic character format to or removes it from the current run.
LtrPara | Sets the reading order and alignment of the specified paragraphs to left-to-right.
LtrRun | Sets the reading order and alignment of the specified run to left-to-right.
Move | Collapses the specified selection to its start or end position and then moves the collapsed object by the specified number of units. This method returns a Long value that represents the number of units by which the selection was moved, or it returns 0 (zero) if the move was unsuccessful.
MoveDown | Moves the selection down and returns the number of units it has been moved.
MoveEnd | Moves the ending character position of a range or selection.
MoveEndUntil | Moves the end position of the specified selection until any of the specified characters are found in the document.
MoveEndWhile | Moves the ending character position of a selection while any of the specified characters are found in the document.
MoveLeft | Moves the selection to the left and returns the number of units it has been moved.
MoveRight | Moves the selection to the right and returns the number of units it has been moved.
MoveStart | Moves the start position of the specified selection.
MoveStartUntil | Moves the start position of the specified selection until one of the specified characters is found in the document. If the movement is backward through the document, the selection is expanded.
MoveStartWhile | Moves the start position of the specified selection while any of the specified characters are found in the document.
MoveUntil | Moves the specified selection until one of the specified characters is found in the document.
MoveUp | Moves the selection up and returns the number of units that it has been moved.
MoveWhile | Moves the specified selection while any of the specified characters are found in the document.
Next | Returns a Range object that represents the next unit relative to the specified selection.
NextField | Selects the next field.
NextRevision | Locates and returns the next tracked change as a Revision object.
NextSubdocument | Moves the selection to the next subdocument.
Paste | Inserts the contents of the Clipboard at the specified selection.
PasteAndFormat | Pastes the selected table cells and formats them as specified.
PasteAppendTable | Merges pasted cells into an existing table by inserting the pasted rows between the selected rows. No cells are overwritten.
PasteAsNestedTable | Pastes a cell or group of cells as a nested table into the selection.
PasteExcelTable | Pastes and formats a Microsoft Excel table.
PasteFormat | Applies formatting copied with the CopyFormat method to the selection.
PasteSpecial | Inserts the contents of the Clipboard.
Previous | Moves the selected text by the specified number of units, and returns a Range object relative to the collapsed selection.
PreviousField | Selects and returns the previous field.
PreviousRevision | Locates and returns the previous tracked change as a Revision object.
PreviousSubdocument | Moves the selection to the previous subdocument.
ReadingModeGrowFont | Increases the size of the displayed text one point size when the document is displayed in Reading mode.
ReadingModeShrinkFont | Decreases the size of the displayed text one point size when the document is displayed in Reading mode.
RtlPara | Sets the reading order and alignment of the specified paragraphs to right-to-left.
RtlRun | Sets the reading order and alignment of the specified run to right-to-left.
Select | Selects the specified text.
SelectCell | Selects the entire cell containing the current selection.
SelectColumn | Selects the column that contains the insertion point, or selects all columns that contain the selection.
SelectCurrentAlignment | Extends the selection forward until text with a different paragraph alignment is encountered.
SelectCurrentColor | Extends the selection forward until text with a different color is encountered.
SelectCurrentFont | Extends the selection forward until text in a different font or font size is encountered.
SelectCurrentIndent | Extends the selection forward until text with different left or right paragraph indents is encountered.
SelectCurrentSpacing | Extends the selection forward until a paragraph with different line spacing is encountered.
SelectCurrentTabs | Extends the selection forward until a paragraph with different tab stops is encountered.
SelectRow | Selects the row that contains the insertion point, or selects all rows that contain the selection.
SetRange | Sets the starting and ending character positions for the selection.
Shrink | Shrinks the selection to the next smaller unit of text.
ShrinkDiscontiguousSelection | Cancels the selection of all but the most recently selected text when a selection contains multiple, unconnected selections.
Sort | Sorts the paragraphs in the specified selection.
SortAscending | Sorts paragraphs or table rows in ascending alphanumeric order.
SortByHeadings | Sorts the headings in the specified selection.
SortDescending | Sorts paragraphs or table rows within the selection in descending alphanumeric order.
SplitTable | Inserts an empty paragraph above the first row in the selection. .
StartOf | Moves or extends the start position of the specified range or selection to the beginning of the nearest specified text unit. This method returns a Long that indicates the number of characters by which the range or selection was moved or extended. The method returns a negative number if the movement is backward through the document.
ToggleCharacterCode | Switches a selection between a Unicode character and its corresponding hexadecimal value.
TypeBackspace | Deletes the character preceding a collapsed selection (an insertion point).
TypeParagraph | Inserts a new, blank paragraph.
TypeText | Inserts the specified text.
WholeStory | Expands a selection to include the entire story.


Selection.BoldRun Method (Word)

 Copy code hover
[image]

Selection.BoldRun Method (Word)
See also Send feedback

Adds the bold character format to or removes it from the current run.

Syntax

expression .BoldRun

expression Required. A variable that represents a Selection object.

Remarks

If the run contains a mix of bold and non-bold text, this method adds the bold character format to the entire run.

Example

This example toggles the bold formatting for the current selection.

VBA Copy code Copy code
Selection.BoldRun

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.Calculate Method (Word)

 Copy code hover
[image]

Selection.Calculate Method (Word)
See also Send feedback

Published: July 16, 2012

Calculates a mathematical expression within a selection. Returns the result as a Single.

Syntax

expression .Calculate

expression Required. A variable that represents a Selection object.

Example

This example calculates the selected mathematical expression and displays the result.

VBA Copy code Copy code
MsgBox "And the answer is... " & Selection.Calculate

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.ClearCharacterAllFormatting Method (Word)

 Copy code hover
[image]

Selection.ClearCharacterAllFormatting Method (Word)
See also Send feedback

Published: July 16, 2012

Removes all character formatting (formatting applied either through character styles or manually applied formatting) from the selected text.

Syntax

expression .ClearCharacterAllFormatting

expression An expression that returns a Selection object.

Remarks

This method removes all character formatting. If you need to removed formatting applied through character styles, use the ClearCharacterStyle method. To remove character formatting that the user has manually applied using Microsoft Word character formatting features, use the ClearCharacterDirectFormatting method.

Note Note

To remove paragraph formatting, see the ClearParagraphAllFormatting, ClearParagraphDirectFormatting, or ClearParagraphStyle method.

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.ClearCharacterDirectFormatting Method (Word)

 Copy code hover
[image]

Selection.ClearCharacterDirectFormatting Method (Word)
See also Send feedback

Published: July 16, 2012

Removes character formatting (formatting that has been applied manually using the buttons on the ribbon or through the dialog boxes) from the selected text.

Syntax

expression .ClearCharacterDirectFormatting

expression An expression that returns a Selection object.

Remarks

This method does not remove character formatting that has been applied by using a character style. To remove character formatting that the user has applied by using character styles, use the ClearCharacterStyle method. To remove all character formatting, regardless of whether the user has applied it by using character styles or manually through the formatting features in Microsoft Word, use the ClearCharacterAllFormatting method.

Note Note

For more information about how to remove paragraph formatting, see the ClearParagraphAllFormatting, ClearParagraphDirectFormatting, or ClearParagraphStyle method.

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.ClearCharacterStyle Method (Word)

 Copy code hover
[image]

Selection.ClearCharacterStyle Method (Word)
See also Send feedback

Published: July 16, 2012

Removes character formatting that has been applied through character styles from the selected text.

Syntax

expression .ClearCharacterStyle

expression An expression that returns a Selection object.

Remarks

This method does not remove character formatting that a user has applied manually. To remove manually applied character formatting, use the ClearCharacterDirectFormatting method. To remove all character formatting, both style and manual formatting, use the ClearCharacterAllFormatting method.

Note Note

To remove paragraph formatting, see the ClearParagraphAllFormatting, ClearParagraphDirectFormatting, or ClearParagraphStyle method.

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.ClearFormatting Method (Word)

 Copy code hover
[image]

Selection.ClearFormatting Method (Word)
See also Send feedback

Published: July 16, 2012

Removes text and paragraph formatting from a selection.

Syntax

expression .ClearFormatting

expression A variable that represents a Selection object.

Example

This example removes all text and paragraph formatting from the active document.

VBA Copy code Copy code
Sub ClrFmtg()
 ActiveDocument.Select
 Selection.ClearFormatting
End Sub

This example removes all text and paragraph formatting from the second through the fourth paragraphs of the active document.

VBA Copy code Copy code
Sub ClrFmtg2()
 ActiveDocument.Range(Start:=ActiveDocument.Paragraphs(2).Range.Start, _
 End:=ActiveDocument.Paragraphs(4).Range.End).Select
 Selection.ClearFormatting
End Sub

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.ClearParagraphAllFormatting Method (Word)

 Copy code hover
[image]

Selection.ClearParagraphAllFormatting Method (Word)
See also Send feedback

Published: July 16, 2012

Removes all paragraph formatting (formatting applied either through paragraph styles or manually applied formatting) from the selected text.

Syntax

expression .ClearParagraphAllFormatting

expression An expression that returns a Selection object.

Remarks

This method removes all paragraph formatting. If you need to remove paragraph formatting applied through paragraph styles, use the ClearParagraphStyle method. To remove paragraph formatting that the user has manually applied using Microsoft Word paragraph formatting features, use the ClearParagraphDirectFormatting method.

Note Note

To remove character formatting, see the ClearCharacterAllFormatting, ClearCharacterDirectFormatting, or ClearCharacterStyle method.

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.ClearParagraphDirectFormatting Method (Word)

 Copy code hover
[image]

Selection.ClearParagraphDirectFormatting Method (Word)
See also Send feedback

Published: July 16, 2012

Removes paragraph formatting that has been applied manually (using the buttons on the ribbon or through the dialog boxes) from the selected text.

Syntax

expression .ClearParagraphDirectFormatting

expression An expression that returns a Selection object.

Remarks

This method does not remove paragraph formatting that has been applied by using a paragraph style. To remove paragraph formatting that the user has applied by using paragraph styles, use the ClearParagraphStyle method. To remove all paragraph formatting, both style and manual formatting, use the ClearParagraphAllFormatting method.

Note Note

For more information about how to remove character formatting, see the ClearCharacterAllFormatting, ClearCharacterDirectFormatting, or ClearCharacterStyle method.

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.ClearParagraphStyle Method (Word)

 Copy code hover
[image]

Selection.ClearParagraphStyle Method (Word)
See also Send feedback

Published: July 16, 2012

Removes paragraph formatting that has been applied through paragraph styles from the selected text.

Syntax

expression .ClearParagraphStyle

expression An expression that returns a Selection object.

Remarks

This method does not remove paragraph formatting that a user has applied manually. To remove manually applied paragraph formatting, use the ClearParagraphDirectFormatting method. To remove all paragraph formatting, both style and manual formatting, use the ClearParagraphAllFormatting method.

Note Note

To remove character formatting, see the ClearCharacterAllFormatting, ClearCharacterDirectFormatting, or ClearCharacterStyle method.

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.Collapse Method (Word)

 Copy code hover
[image]

Selection.Collapse Method (Word)
See also Send feedback

Published: July 16, 2012

Collapses a selection to the starting or ending position. After a selection is collapsed, the starting and ending points are equal.

Syntax

expression .Collapse(Direction)

expression Required. A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
Direction | Optional | Variant | The direction in which to collapse the range or selection. Can be either of the following WdCollapseDirection constants: wdCollapseEnd or wdCollapseStart. The default value is wdCollapseStart.

Example

This example collapses the selection to an insertion point at the beginning of the previous selection.

VBA Copy code Copy code
Selection.Collapse Direction:=wdCollapseStart

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.ConvertToTable Method (Word)

 Copy code hover
[image]

Selection.ConvertToTable Method (Word)
See also Send feedback

Published: July 16, 2012

Converts text within a range to a table. Returns the table as a Table object.

Syntax

expression .ConvertToTable(Separator, NumRows, NumColumns, InitialColumnWidth, Format, ApplyBorders, ApplyShading, ApplyFont, ApplyColor, ApplyHeadingRows, ApplyLastRow, ApplyFirstColumn, ApplyLastColumn, AutoFit, AutoFitBehavior, DefaultTableBehavior)

expression A variable that represents a Range object.

Parameters

Name | Required/Optional | Data Type | Description
Separator | Optional | Variant | Specifies the character used to separate text into cells. Can be a character or one of the following WdTableFieldSeparator constant. If this argument is omitted, the value of the DefaultTableSeparator property is used.
NumRows | Optional | Variant | The number of rows in the table. If this argument is omitted, Microsoft Word sets the number of rows, based on the contents of the range.
NumColumns | Optional | Variant | The number of columns in the table. If this argument is omitted, Word sets the number of columns, based on the contents of the range.
InitialColumnWidth | Optional | Variant | The initial width of each column, in points. If this argument is omitted, Word calculates and adjusts the column width so that the table stretches from margin to margin.
Format | Optional | Variant | Specifies one of the predefined formats listed in the Table AutoFormat dialog box. Can be one of the WdTableFormat constants.
ApplyBorders | Optional | Variant | True to apply the border properties of the specified format.
ApplyShading | Optional | Variant | True to apply the shading properties of the specified format.
ApplyFont | Optional | Variant | True to apply the font properties of the specified format.
ApplyColor | Optional | Variant | True to apply the color properties of the specified format.
ApplyHeadingRows | Optional | Variant | True to apply the heading-row properties of the specified format.
ApplyLastRow | Optional | Variant | True to apply the last-row properties of the specified format.
ApplyFirstColumn | Optional | Variant | True to apply the first-column properties of the specified format.
ApplyLastColumn | Optional | Variant | True to apply the last-column properties of the specified format.
AutoFit | Optional | Variant | True to decrease the width of the table columns as much as possible without changing the way text wraps in the cells.
AutoFitBehavior | Optional | Variant | Sets the AutoFit rules for how Word sizes a table. Can be one of the following WdAutoFitBehavior constant. If DefaultTableBehavior is wdWord8TableBehavior, this argument is ignored.
DefaultTableBehavior | Optional | Variant | Sets a value that specifies whether Microsoft Word automatically resizes cells in a table to fit the contents (AutoFit). Can be one of the WdDefaultTableBehavior constant.

Return Value

Table

Example

This example inserts text at the insertion point and then converts the comma-delimited text to a table with formatting.

VBA Copy code Copy code
With Selection
 .Collapse
 .InsertBefore "one, two, three"
 .InsertParagraphAfter
 .InsertAfter "one, two, three"
 .InsertParagraphAfter
End With
Set myTable = Selection.ConvertToTable( _
 Separator:=wdSeparateByCommas, _
 Format:=wdTableFormatList8)

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.Copy Method (Word)

 Copy code hover
[image]

Selection.Copy Method (Word)
See also Send feedback

Published: July 16, 2012

Copies the specified selection to the Clipboard.

Syntax

expression .Copy

expression Required. A variable that represents a Selection object.

Example

This example copies the contents of the selection into a new document.

VBA Copy code Copy code
If Selection.Type = wdSelectionNormal Then
 Selection.Copy
 Documents.Add.Content.Paste
End If

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.CopyAsPicture Method (Word)

 Copy code hover
[image]

Selection.CopyAsPicture Method (Word)
See also Send feedback

Published: July 16, 2012

The CopyAsPicture method works the same way as the Copy method.

Syntax

expression .CopyAsPicture

expression Required. A variable that represents a Selection object.

Example

This example copies the contents of the active document as a picture and pastes it as a picture at the end of the document.

VBA Copy code Copy code
Sub CopyPasteAsPicture()
 ActiveDocument.Content.Select
 With Selection
 .CopyAsPicture
 .Collapse Direction:=wdCollapseEnd
 .PasteSpecial DataType:=wdPasteMetafilePicture
 End With
End Sub

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.CopyFormat Method (Word)

 Copy code hover
[image]

Selection.CopyFormat Method (Word)
See also Send feedback

Published: July 16, 2012

Copies the character formatting of the first character in the selected text.

Syntax

expression .CopyFormat

expression Required. A variable that represents a Selection object.

Remarks

If a paragraph mark is selected, Word copies paragraph formatting in addition to character formatting. You can apply the copied formatting to another selection by using the PasteFormat method.

Example

This example copies the formatting of the first paragraph to the second paragraph in the active document.

VBA Copy code Copy code
ActiveDocument.Paragraphs(1).Range.Select
Selection.CopyFormat
ActiveDocument.Paragraphs(2).Range.Select
Selection.PasteFormat

This example collapses the selection and copies its character formatting to the next word.

VBA Copy code Copy code
With Selection
 .Collapse Direction:=wdCollapseStart
 .CopyFormat
 .Next(Unit:=wdWord, Count:=1).Select
 .PasteFormat
End With

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.CreateAutoTextEntry Method (Word)

 Copy code hover
[image]

Selection.CreateAutoTextEntry Method (Word)
See also Send feedback

Published: July 16, 2012

Adds a new AutoTextEntry object to the AutoTextEntries collection, based on the current selection.

Syntax

expression .CreateAutoTextEntry(Name, StyleName)

expression Required. A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
Name | Required | String | The text the user must type to call the new AutoText entry.
StyleName | Required | String | The category in which the new AutoText entry will be listed on the AutoText menu.

Example

This example creates a new AutoText entry named "handdel" under the category "Mailing Instructions," given "HAND DELIVERY" as the currently selected text.

VBA Copy code Copy code
Selection.CreateAutoTextEntry "handdel", _
 "Mailing Instructions"

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.CreateTextbox Method (Word)

 Copy code hover
[image]

Selection.CreateTextbox Method (Word)
See also Send feedback

Published: July 16, 2012

Adds a default-size text box around the selection.

Syntax

expression .CreateTextbox

expression Required. A variable that represents a Selection object.

Remarks

If the selection is an insertion point, this method changes the pointer to a cross-hair pointer so that the user can draw a text box.

Using this method is equivalent to clicking the Text Box button on the Drawing toolbar. A text box is a rectangle with an associated text frame.

Example

This example adds a text box around the selection and then changes the text box's line style.

VBA Copy code Copy code
If Selection.Type = wdSelectionNormal Then
 Selection.CreateTextbox
 Selection.ShapeRange(1).Line.DashStyle =msoLineDashDot
End If

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.Cut Method (Word)

 Copy code hover
[image]

Selection.Cut Method (Word)
See also Send feedback

Published: July 16, 2012

Removes the specified object from the document and moves it to the Clipboard.

Syntax

expression .Cut

expression Required. A variable that represents a Selection object.

Remarks

The contents of the selection are moved to the Clipboard but a collapsed selection remains in the document.

Example

This example deletes the contents of the selection and pastes them into a new document.

VBA Copy code Copy code
If Selection.Type = wdSelectionNormal Then
 Selection.Cut
 Documents.Add.Content.Paste
End If

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.Delete Method (Word)

 Copy code hover
[image]

Selection.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the specified number of characters or words.

Syntax

expression .Delete(Unit, Count)

expression Required. A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
Unit | Optional | Variant | The unit by which the collapsed selection is to be deleted. Can be one of the WdUnits constants.
Count | Optional | Variant | The number of units to be deleted. To delete units after the selection, collapse the selection and use a positive number. To delete units before the selection, collapse the selection and use a negative number.

Return Value

Long

Remarks

This method returns a Long value that indicates the number of items deleted, or it returns 0 (zero) if the deletion was unsuccessful.

Example

This example selects and deletes the contents of the active document.

VBA Copy code Copy code
Sub DeleteSelection()
 Dim intResponse As Integer

 intResponse = MsgBox("Are you sure you want to " & _
 "delete the contents of the document?", vbYesNo)

 If intResponse = vbYes Then
 ActiveDocument.Content.Select
 Selection.Delete
 End If
End Sub

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.DetectLanguage Method (Word)

 Copy code hover
[image]

Selection.DetectLanguage Method (Word)
See also Send feedback

Published: July 16, 2012

Analyzes the specified text to determine the language that it is written in.

Syntax

expression .DetectLanguage

expression Required. A variable that represents a Selection object.

Remarks

The results of the DetectLanguage method are stored in the LanguageID property on a character-by-character basis. To read the LanguageID property, you must first specify a selection or range of text.

If a selection contains a partial sentence, the selection is extended to the end of the sentence.

If the DetectLanguage method has already been applied to the specified text, the LanguageDetected property is set to True. To reevaulate the language of the specified text, you must first set the LanguageDetected property to False.

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.EndKey Method (Word)

 Copy code hover
[image]

Selection.EndKey Method (Word)
See also Send feedback

Published: July 16, 2012

Moves or extends the selection to the end of the specified unit.

Syntax

expression .EndKey(Unit, Extend)

expression Required. A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
Unit | Optional | Variant | The unit by which the selection is to be moved or extended. Can be a WdUnits constant. The default value is wdLine.
Extend | Optional | Variant | Specifies the way the selection is moved. Can be any WdMovementType constant. If the value of this argument is wdMove, the selection is collapsed to an insertion point and moved to the end of the specified unit. If it is wdExtend, the end of the selection is extended to the end of the specified unit. The default value is wdMove.

Remarks

This method returns an integer that indicates the number of characters the selection or active end was actually moved, or it returns 0 (zero) if the move was unsuccessful. This method corresponds to functionality of the END key.

Example

This example moves the selection to the end of the current line and assigns the number of characters moved to the pos variable.

VBA Copy code Copy code
pos = Selection.EndKey(Unit:=wdLine, Extend:=wdMove)

This example moves the selection to the beginning of the current table column and then extends the selection to the end of the column.

VBA Copy code Copy code
If Selection.Information(wdWithInTable) = True Then
 Selection.HomeKey Unit:=wdColumn, Extend:=wdMove
 Selection.EndKey Unit:=wdColumn, Extend:=wdExtend
End If

This example moves the selection to the end of the current story. If the selection is in the main text story, the example moves the selection to the end of the document.

VBA Copy code Copy code
Selection.EndKey Unit:=wdStory, Extend:=wdMove

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.EndOf Method (Word)

 Copy code hover
[image]

Selection.EndOf Method (Word)
See also Send feedback

Published: July 16, 2012

Moves or extends the ending character position of a range or selection to the end of the nearest specified text unit.

Syntax

expression .EndOf(Unit, Extend)

expression Required. A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
Unit | Optional | Variant | The unit by which to move the ending character position. WdUnits.
Extend | Optional | Variant | Can be either of the WdMovementType constants. If wdMove, both ends of the range or selection object are moved to the end of the specified unit. If wdExtend is used, the end of the range or selection is extended to the end of the specified unit. The default value is wdMove.

Remarks

This method returns a value that indicates the number of character positions the range or selection was moved or extended (movement is forward in the document).

If the both the starting and ending positions for the range or selection are already at the end of the specified unit, this method doesn't move or extend the range or selection. For example, if the selection is at the end of a word and the trailing space, the following instruction doesn't change the selection (char equals 0 (zero)).

VBA Copy code Copy code
char = Selection.EndOf(Unit:=wdWord, Extend:=wdMove)

Example

This example extends the selection to the end of the paragraph.

VBA Copy code Copy code
charmoved = Selection.EndOf(Unit:=wdParagraph, Extend:=wdExtend)
If charmoved = 0 Then MsgBox "Selection unchanged"

This example moves myRange to the end of the first word in the selection (after the trailing space).

VBA Copy code Copy code
Set myRange = Selection.Characters(1)
myRange.EndOf Unit:=wdWord, Extend:=wdMove

This example adds a table, selects the first cell in row two, and then extends the selection to the end of the column.

VBA Copy code Copy code
Set myRange = ActiveDocument.Range(0, 0)
Set myTable = ActiveDocument.Tables.Add(Range:=myRange, _
 NumRows:=5, NumColumns:=3)
myTable.Cell(2, 1).Select
Selection.EndOf Unit:=wdColumn, Extend:=wdExtend

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.EscapeKey Method (Word)

 Copy code hover
[image]

Selection.EscapeKey Method (Word)
See also Send feedback

Published: July 16, 2012

Cancels a mode such as extend or column select (equivalent to pressing the ESC key).

Syntax

expression .EscapeKey

expression Required. A variable that represents a Selection object.

Example

This example turns on and then cancels extend mode.

VBA Copy code Copy code
With Selection
 .ExtendMode = True
 .EscapeKey
End With

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.Expand Method (Word)

 Copy code hover
[image]

Selection.Expand Method (Word)
See also Send feedback

Published: July 16, 2012

Expands the specified range or selection. Returns the number of characters added to the range or selection. Long.

Syntax

expression .Expand(Unit)

expression Required. A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
Unit | Optional | Variant | A WdUnits constant that represents the unit by which to expand the range. The default value is wdWord.

Example

This example capitalizes the first character in the selection and then expands the selection to include the entire sentence.

VBA Copy code Copy code
With Selection
 .Characters(1).Case = wdTitleSentence
 .Expand Unit:=wdSentence
End With

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.ExportAsFixedFormat Method (Word)

 Copy code hover
[image]

Selection.ExportAsFixedFormat Method (Word)
See also Send feedback

Published: July 16, 2012

Saves the current selection as PDF or XPS format. .

Version Information

Version Added: Word 2007

Syntax

expression .ExportAsFixedFormat(OutputFileName, ExportFormat, OpenAfterExport, OptimizeFor, ExportCurrentPage, Item, IncludeDocProps, KeepIRM, CreateBookmarks, DocStructureTags, BitmapMissingFonts, UseISO19005_1, FixedFormatExtClassPtr)

expression An expression that returns a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
OutputFileName | Required | String | The path and file name of the new PDF or XPS file.
ExportFormat | Required | WdExportFormat | Specifies either PDF or XPS format.
OpenAfterExport | Optional | Boolean | Opens the new file after exporting the contents.
OptimizeFor | Optional | WdExportOptimizeFor | Specifies whether to optimize for screen or print.
ExportCurrentPage | Optional | Boolean | Specifies whether to export the current page. True exports the entire page. False exports only the current selection.
Item | Optional | WdExportItem | Specifies whether the export process includes text only or includes text with markup.
IncludeDocProps | Optional | Boolean | Specifies whether to include document properties in the newly exported file.
KeepIRM | Optional | Boolean | Specifies whether to copy IRM permissions to an XPS document if the source document has IRM protections. Default value is True.
CreateBookmarks | Optional | WdExportCreateBookmarks | Specifies whether to export bookmarks and the type of bookmarks to export.
DocStructureTags | Optional | Boolean | Specifies whether to include extra data to help screen readers, for example information about the flow and logical organization of the content. Default value is True.
BitmapMissingFonts | Optional | Boolean | Specifies whether to include a bitmap of the text. Set this parameter to True when font licenses do not permit a font to be embedded in the PDF file. If False, the font is referenced, and the viewer's computer substitutes an appropriate font if the authored one is not available. Default value is True.
UseISO19005_1 | Optional | Boolean | Specifies whether to limit PDF usage to the PDF subset standardized as ISO 19005-1. If True, the resulting files are more reliably self-contained but may be larger or show more visual artifacts due to the restrictions of the format. Default value is False.
FixedFormatExtClassPtr | Optional | Variant | Specifies a pointer to an add-in that allows calls to an alternate implementation of code. The alternate implementation of code interprets the EMF and EMF+ page descriptions that are generated by the applications to make their own PDF or XPS. For more information, see "Extending the Office (2007) Fixed-Format Export Feature" on MSDN.

Remarks

You can save as a PDF or XPS file from a 2007 Microsoft Office system program only after you install an add-in. For more information, search for "Enable support for other file formats, such as PDF and XPS" on the Office Web site.

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.Extend Method (Word)

 Copy code hover
[image]

Selection.Extend Method (Word)
See also Send feedback

Published: July 16, 2012

Turns on extend mode, or if extend mode is already on, extends the selection to the next larger unit of text.

Syntax

expression .Extend(Character)

expression Required. A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
Character | Optional | Variant | The character through which the selection is extended. This argument is case sensitive and must evaluate to a String or an error occurs. Also, if the value of this argument is longer than a single character, Microsoft Word ignores the command entirely.

Remarks

Using this method sets the ExtendMode property to True if it is not already.

The progression of selected units of text is as follows: word, sentence, paragraph, section, entire document. If Character is specified, this method extends the selection forward through the next instance of the specified character. The selection is extended by moving the active end of the selection.

Example

This example collapses the current selection to an insertion point and then selects the current sentence.

VBA Copy code Copy code
With Selection
 ' Collapse current selection to insertion point.
 .Collapse
 ' Turn extend mode on.
 .Extend
 ' Extend selection to word.
 .Extend
 ' Extend selection to sentence.
 .Extend
End With

Here is an example that accomplishes the same task without the Extend method.

VBA Copy code Copy code
With Selection
 ' Collapse current selection.
 .Collapse
 ' Expand selection to current sentence.
 .Expand Unit:=wdSentence
End With

This example makes the end of the selection active and extends the selection through the next instance of a capital "R".

VBA Copy code Copy code
With Selection
 .StartIsActive = False
 .Extend Character:="R"
End Wit

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.GoTo Method (Word)

 Copy code hover
[image]

Selection.GoTo Method (Word)
See also Send feedback

Published: July 16, 2012

Moves the insertion point to the character position immediately preceding the specified item, and returns a Range object (except for the wdGoToGrammaticalError, wdGoToProofreadingError, or wdGoToSpellingError constant).

Syntax

expression .GoTo(What, Which, Count, Name)

expression Required. A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
What | Optional | Variant | The kind of item to which the range or selection is moved. Can be one of the WdGoToItem constants.
Which | Optional | Variant | The item to which the range or selection is moved. Can be one of the WdGoToDirection constants.
Count | Optional | Variant | The number of the item in the document. The default value is 1. Only positive values are valid. To specify an item that precedes the range or selection, use wdGoToPrevious as the Which argument and specify a Count value.
Name | Optional | Variant | If the What argument is wdGoToBookmark, wdGoToComment, wdGoToField, or wdGoToObject, this argument specifies a name.

Return Value

Range

Remarks

When you use the GoTo method with the wdGoToGrammaticalError, wdGoToProofreadingError, or wdGoToSpellingError constant, the Range object that is returned includes any grammar error text or spelling error text.

The following examples are functionally equivalent; they both move the selection to the first heading in the document.

VBA Copy code Copy code
Selection.GoTo What:=wdGoToHeading, Which:=wdGoToFirst
Selection.GoTo What:=wdGoToHeading, Which:=wdGoToAbsolute, Count:=1

The following example moves the selection to the fourth line in the document.

VBA Copy code Copy code
Selection.GoTo What:=wdGoToLine, Which:=wdGoToAbsolute, Count:=4

The following example moves the selection up two lines.

VBA Copy code Copy code
Selection.GoTo What:=wdGoToLine, Which:=wdGoToPrevious, Count:=2

The following example moves to the next DATE field.

VBA Copy code Copy code
Selection.GoTo What:=wdGoToField, Name:="Date"

Example

This example moves the selection to the first cell in the next table.

VBA Copy code Copy code
Selection.GoTo What:=wdGoToTable, Which:=wdGoToNext

This example moves the insertion point just before the fifth endnote reference mark in the active document.

VBA Copy code Copy code
If ActiveDocument.Endnotes.Count >= 5 Then
 Selection.GoTo What:=wdGoToEndnote, _
 Which:=wdGoToAbsolute, Count:=5
End If

This example moves the selection down four lines.

VBA Copy code Copy code
Selection.GoTo What:=wdGoToLine, Which:=wdGoToRelative, Count:=4

This example moves the selection back two pages.

VBA Copy code Copy code
Selection.GoTo What:=wdGoToPage, Which:=wdGoToPrevious, Count:=2

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.GoToEditableRange Method (Word)

 Copy code hover
[image]

Selection.GoToEditableRange Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents an area of a document that can be modified by the specified user or group of users.

Syntax

expression .GoToEditableRange(EditorID)

expression Required. A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
EditorID | Optional | Variant | Can be either a String that represents the user's e-mail alias (if in the same domain), an e-mail address, or a WdEditorType constant that represents a group of users. If omitted, selects all ranges for which all users have permissions to edit.

Return Value

Range

Remarks

You can also use the NextRange property of the Editor object to return the next range for which the user has permission to modify.

Example

The following example goes to the next range for which the current user has permission to modify.

VBA Copy code Copy code
Selection.GoToEditableRange wdEditorCurrent

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.GoToNext Method (Word)

 Copy code hover
[image]

Selection.GoToNext Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a Range object that refers to the start position of the next item or location specified by the What argument. If you apply this method to the Selection object, the method moves the selection to the specified item (except for the wdGoToGrammaticalError, wdGoToProofreadingError, and wdGoToSpellingError constants).

Syntax

expression .GoToNext(What)

expression Required. A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
What | Required | WdGoToItem | The item where the specified range or selection is to be moved.

Remarks

Note Note

When you use this method with the wdGoToGrammaticalError, wdGoToProofreadingError, or wdGoToSpellingError constant, the Range object that's returned includes any grammar error text or spelling error text.

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.GoToPrevious Method (Word)

 Copy code hover
[image]

Selection.GoToPrevious Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a Range object that refers to the start position of the previous item or location specified by the What argument. If applied to a Selection object, GoToPrevious moves the selection to the specified item. Range object.

Syntax

expression .GoToPrevious(What)

expression Required. A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
What | Required | WdGoToItem | The item where the specified range or selection is to be moved.

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.HomeKey Method (Word)

 Copy code hover
[image]

Selection.HomeKey Method (Word)
See also Send feedback

Published: July 16, 2012

Moves or extends the selection to the beginning of the specified unit. This method returns an integer that indicates the number of characters the selection was actually moved, or it returns 0 (zero) if the move was unsuccessful.This method corresponds to functionality of the HOME key.

Syntax

expression .HomeKey(Unit, Extend)

expression A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
Unit | Optional | Variant | The unit by which the selection is to be moved or extended. The default value is wdLine.
Extend | Optional | Variant | Specifies the way the selection is moved. Can be one of the WdMovementType constants. If the value of this argument is wdMove, the selection is collapsed to an insertion point and moved to the beginning of the specified unit. If it is wdExtend, the beginning of the selection is extended to the beginning of the specified unit. The default value is wdMove.

Example

This example moves the selection to the beginning of the current story. If the selection is in the main text story, the selection is moved to the beginning of the document.

VBA Copy code Copy code
Selection.HomeKey Unit:=wdStory, Extend:=wdMove

This example moves the selection to the beginning of the current line and assigns the number of characters moved to the pos variable.

VBA Copy code Copy code
pos = Selection.HomeKey(Unit:=wdLine, Extend:=wdMove)
If pos = 0 Then StatusBar = "Selection was not moved"

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.InRange Method (Word)

 Copy code hover
[image]

Selection.InRange Method (Word)
See also Send feedback

Published: July 16, 2012

True if the selection to which the method is applied is contained within the range specified by the Range argument.

Syntax

expression .InRange(Range)

expression Required. A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
Range | Required | Optional | The Range to which you want to compare the selection.

Return Value

Boolean

Remarks

This method determines whether the range or selection returned by expression is contained in the specified Range by comparing the starting and ending character positions and the story type.

Example

This example determines whether the selection is contained in the first paragraph in the active document.

VBA Copy code Copy code
status = Selection.InRange(ActiveDocument.Paragraphs(1).Range)

This example displays a message if the selection is in the footnote story.

VBA Copy code Copy code
If Selection.InRange(ActiveDocument _
 .StoryRanges(wdFootnotesStory)) Then
 MsgBox "Selection in footnotes"
End If

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.InsertAfter Method (Word)

 Copy code hover
[image]

Selection.InsertAfter Method (Word)
See also Send feedback

Published: July 16, 2012

Inserts the specified text at the end of a range or selection.

Syntax

expression .InsertAfter(Text)

expression Required. A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
Text | Required | String | The text to be inserted.

Remarks

After using this method, the selection expands to include the new text.

You can insert characters such as quotation marks, tab characters, and nonbreaking hyphens by using the Visual Basic Chr function with the InsertAfter method. You can also use the following Visual Basic constants: vbCr, vbLf, vbCrLf and vbTab.

If you use this method with a selection that refers to an entire paragraph, the text is inserted after the ending paragraph mark (the text will appear at the beginning of the next paragraph). To insert text at the end of a paragraph, determine the ending point and subtract 1 from this location (the paragraph mark is one character), as shown in the following example.

VBA Copy code Copy code
ActiveDocument.Range( _
 ActiveDocument.Paragraphs(1).Range.Start, _
 ActiveDocument.Paragraphs(1).Range.End - 1) _
 .Select

Selection.InsertAfter _
 " This is now the last sentence in paragraph one."

However, if the selection ends with a paragraph mark that also happens to be the end of the document, Microsoft Word inserts the text before the final paragraph mark rather than creating a new paragraph at the end of the document. Also, if the selection is a bookmark, Word inserts the specified text but does not extend the selection or the bookmark to include the new text.

Example

This example inserts text at the end of the selection and then collapses the selection to an insertion point.

VBA Copy code Copy code
With Selection
 .InsertAfter "appended text"
 .Collapse Direction:=wdCollapseEnd
End With

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.InsertBefore Method (Word)

 Copy code hover
[image]

Selection.InsertBefore Method (Word)
See also Send feedback

Published: July 16, 2012

Inserts the specified text before the specified selection. .

Syntax

expression .InsertBefore(Text)

expression Required. A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
Text | Required | String | The text to be inserted.

Remarks

After using this method to insert text, the selection is expanded to include the new text. If the selection is a bookmark, the bookmark is also expanded to include the next text.

You can insert characters such as quotation marks, tab characters, and nonbreaking hyphens by using the Visual Basic Chr function with the InsertBefore method. You can also use the following Visual Basic constants: vbCr, vbLf, vbCrLf and vbTab.

Example

This example inserts the text "Hamlet" (enclosed in quotation marks) before the selection and then collapses the selection.

VBA Copy code Copy code
With Selection
 .InsertBefore Chr(34) & "Hamlet" & Chr(34) & Chr(32)
 .Collapse Direction:=wdCollapseEnd
End With

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.InsertBreak Method (Word)

 Copy code hover
[image]

Selection.InsertBreak Method (Word)
See also Send feedback

Published: July 16, 2012

Inserts a page, column, or section break.

Syntax

expression .InsertBreak(Type)

expression Required. A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
Type | Required | WdBreakType | the type of break to insert. The default value is wdPageBreak. Some of the WdBreakType constants may not be available to you, depending on the language support (U.S. English, for example) that you have selected or installed.

Remarks

When you insert a page or column break, the break replaces the selection. If you don't want to replace the selection, use the Collapse method before using the InsertBreak method.

Note Note

When you insert a section break, the break is inserted immediately preceding the selection.

Example

This example inserts a continuous section break immediately preceding the selection.

VBA Copy code Copy code
Selection.InsertBreak Type:=wdSectionBreakContinuous

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.InsertCaption Method (Word)

 Copy code hover
[image]

Selection.InsertCaption Method (Word)
See also Send feedback

Published: July 16, 2012

Inserts a caption immediately preceding or following the specified selection.

Syntax

expression .InsertCaption(Label, Title, TitleAutoText, Position, ExcludeLabel)

expression Required. A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
Label | Required | Variant | The caption label to be inserted. Can be a String or one of the WdCaptionLabelID constants. If the label has not yet been defined, an error occurs. Use the Add method with the CaptionLabels object to define new caption labels.
Title | Optional | Variant | The string to be inserted immediately following the label in the caption (ignored if TitleAutoText is specified).
TitleAutoText | Optional | Variant | The AutoText entry whose contents you want to insert immediately following the label in the caption (overrides any text specified by Title).
Position | Optional | Variant | Specifies whether the caption will be inserted above or below the selection. Can be one of the WdCaptionPosition constants.
ExcludeLabel | Optional | Variant | True does not include the text label, as defined in the Label parameter. False includes the specified label.

Example

This example inserts a Figure caption at the insertion point.

VBA Copy code Copy code
Selection.Collapse Direction:=wdCollapseStart
Selection.InsertCaption Label:="Figure", _
 Title:=": Sales Results", Position:=wdCaptionPositionBelow

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.InsertCells Method (Word)

 Copy code hover
[image]

Selection.InsertCells Method (Word)
See also Send feedback

Published: July 16, 2012

Adds cells to an existing table.

Syntax

expression .InsertCells(ShiftCells)

expression Required. A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
ShiftCells | Optional | WdInsertCells | Specifies how to insert the cells into the existing columns and rows of the tabel.

Remarks

The number of cells inserted is equal to the number of cells in the selection. You can also insert cells by using the Add method of the Cells object.

Example

This example inserts new cells to the left of the selected cells, and then it surrounds the selected cells with a red, single-line border.

VBA Copy code Copy code
If Selection.Cells.Count >= 1 Then
 Selection.InsertCells ShiftCells:=wdInsertCellsShiftRight
 For Each aBorder In Selection.Borders
 aBorder.LineStyle = wdLineStyleSingle
 aBorder.ColorIndex = wdRed
 Next aBorder
End If

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.InsertColumns Method (Word)

 Copy code hover
[image]

Selection.InsertColumns Method (Word)
See also Send feedback

Published: July 16, 2012

Inserts columns to the left of the column that contains the selection.

Syntax

expression .InsertColumns

expression Required. A variable that represents a Selection object.

Remarks

The number of columns inserted is equal to the number of columns selected. You can also insert columns by using the Add method of the Columns object.

If the selection isn't in a table, an error occurs.

Example

This example inserts new columns to the left of the column that contains the selection. The number of columns inserted is equal to the number of columns selected.

VBA Copy code Copy code
If Selection.Information(wdWithInTable) = True Then
 With Selection
 .InsertColumns
 .Shading.Texture = wdTexture10Percent
 End With
End If

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.InsertColumnsRight Method (Word)

 Copy code hover
[image]

Selection.InsertColumnsRight Method (Word)
See also Send feedback

Published: July 16, 2012

Inserts columns to the right of the current selection.

Syntax

expression .InsertColumnsRight

expression Required. A variable that represents a Selection object.

Remarks

Microsoft Word inserts as many columns as there are in the current selection.

To use this method, the current selection must be in a table.

Example

This example selects the second column in the first table and inserts a new column to the right of it.

VBA Copy code Copy code
ActiveDocument.Tables(1).Columns(2).Select
Selection.InsertColumnsRight

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.InsertCrossReference Method (Word)

 Copy code hover
[image]

Selection.InsertCrossReference Method (Word)
See also Send feedback

Published: July 16, 2012

Inserts a cross-reference to a heading, bookmark, footnote, or endnote, or to an item for which a caption label is defined (for example, an equation, figure, or table).

Syntax

expression .InsertCrossReference(ReferenceType, ReferenceKind, ReferenceItem, InsertAsHyperlink, IncludePosition, SeparateNumbers, SeparatorString)

expression Required. A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
ReferenceType | Required | Variant | The type of item for which a cross-reference is to be inserted. Can be any WdReferenceType or WdCaptionLabelID constant or a user defined caption label.
ReferenceKind | Required | WdReferenceKind | The information to be included in the cross-reference.
ReferenceItem | Required | Variant | If ReferenceType is wdRefTypeBookmark, this argument specifies a bookmark name. For all other ReferenceType values, this argument specifies the item number or name in the Reference type box in the Cross-reference dialog box. Use the GetCrossReferenceItems method to return a list of item names that can be used with this argument.
InsertAsHyperlink | Optional | Variant | True to insert the cross-reference as a hyperlink.
IncludePosition | Optional | Variant | True to insert "above" or "below," depending on the location of the reference item in relation to the cross-reference.
SeparateNumbers | Optional | Variant | True to use a separator to separate the numbers from the associated text. (Use only if the ReferenceType parameter is set to wdRefTypeNumberedItem and the ReferenceKind parameter is set to wdNumberFullContext.)
SeparatorString | Optional | Variant | Specifies the string to use as a separator if the SeparateNumbers parameter is set to True.

Remarks

If you specify wdPageNumber for the value of ReferenceKind, you may need to repaginate the document to see the correct cross-reference information.

Example

This example inserts a sentence that contains two cross-references: one cross-reference to heading text, and another one to the page where the heading text appears.

VBA Copy code Copy code
With Selection
 .Collapse Direction:=wdCollapseStart
 .InsertBefore "For more information, see "
 .Collapse Direction:=wdCollapseEnd
 .InsertCrossReference ReferenceType:=wdRefTypeHeading, _
 ReferenceKind:=wdContentText, ReferenceItem:=1
 .InsertAfter " on page "
 .Collapse Direction:=wdCollapseEnd
 .InsertCrossReference ReferenceType:=wdRefTypeHeading, _
 ReferenceKind:=wdPageNumber, ReferenceItem:=1
 .InsertAfter "."
End With

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.InsertDateTime Method (Word)

 Copy code hover
[image]

Selection.InsertDateTime Method (Word)
See also Send feedback

Published: July 16, 2012

Inserts the current date or time, or both, either as text or as a TIME field.

Syntax

expression .InsertDateTime(DateTimeFormat, InsertAsField, InsertAsFullWidth, DateLanguage, CalendarType)

expression Required. A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
DateTimeFormat | Optional | Variant | The format to be used for displaying the date or time, or both. If this argument is omitted, Microsoft Word uses the short-date style from the Windows Control Panel (Regional Settings icon).
InsertAsField | Optional | Variant | True to insert the specified information as a TIME field. The default value is True.
InsertAsFullWidth | Optional | Variant | True to insert the specified information as double-byte digits. This argument may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.
DateLanguage | Optional | Variant | Sets the language in which to display the date or time. Can be either of the WdDateLanguage constants. This argument may not be available to you, depending on the language support (U.S. English, for example) that you have selected or installed.
CalendarType | Optional | Variant | Sets the calendar type to use when displaying the date or time. Can be either of the WdCalendarTypeBi constants. This argument may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.

Remarks

Using this method replaces the current selection. To avoid this, use the Collapse method before using this method.

Example

This example inserts a TIME field for the current date. A possible result might be "November 18, 1999."

VBA Copy code Copy code
Selection.InsertDateTime DateTimeFormat:="MMMM dd, yyyy", _
 InsertAsField:=True

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.InsertFile Method (Word)

 Copy code hover
[image]

Selection.InsertFile Method (Word)
See also Send feedback

Published: July 16, 2012

Inserts all or part of the specified file.

Syntax

expression .InsertFile(FileName, Range, ConfirmConversions, Link, Attachment)

expression Required. A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
FileName | Required | String | The path and file name of the file to be inserted. If you don't specify a path, Word assumes the file is in the current folder.
Range | Optional | Variant | If the specified file is a Word document, this parameter refers to a bookmark. If the file is another type (for example, a Microsoft Excel worksheet), this parameter refers to a named range or a cell range (for example, R1C1:R3C4).
ConfirmConversions | Optional | Variant | True to have Word prompt you to confirm conversion when inserting files in formats other than the Word Document format.
Link | Optional | Variant | True to insert the file by using an INCLUDETEXT field.
Attachment | Optional | Variant | True to insert the file as an attachment to an e-mail message.

Example

This example uses an INCLUDETEXT field to insert the TEST.DOC file at the insertion point.

VBA Copy code Copy code
Selection.Collapse Direction:=wdCollapseEnd
Selection.InsertFile FileName:="C:\TEST.DOC", Link:=True

This example creates a new document and then inserts the contents of each text file in the C:\TMP folder into the new document.

VBA Copy code Copy code
Documents.Add
ChDir "C:\TMP"
myName = Dir("*.TXT")
While myName <> ""
 With Selection
 .InsertFile FileName:=myName, ConfirmConversions:=False
 .InsertParagraphAfter
 .InsertBreak Type:=wdSectionBreakNextPage
 .Collapse Direction:=wdCollapseEnd
 End With
 myName = Dir()
Wend

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.InsertFormula Method (Word)

 Copy code hover
[image]

Selection.InsertFormula Method (Word)
See also Send feedback

Published: July 16, 2012

Inserts an = (Formula) field that contains a formula at the selection.

Syntax

expression .Formula(Formula, NumberFormat)

expression Required. A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
Formula | Optional | Variant | The mathematical formula you want the = (Formula) field to evaluate. Spreadsheet-type references to table cells are valid. For example, "=SUM(A4:C4)" specifies the first three values in the fourth row. For more information about the = (Formula) field, see Field codes:= (Formula) field.
NumberFormat | Optional | Variant | A format for the result of the = (Formula) field. For information about the types of formats you can apply, see Numeric Picture (\#) field switch.

Remarks

The formula replaces the selection, if the selection is not collapsed.

If you are using a spreadsheet application, such as Microsoft Office Excel, embedding all or part of a worksheet in a document is often easier than using the = (Formula) field in a table.

The Formula argument is optional only if the selection is in a cell and there is at least one cell that contains a value above or to the left of the cell that contains the insertion point. If the cells above the insertion point contain values, the inserted field is {=SUM(ABOVE)}; if the cells to the left of the insertion point contain values, the inserted field is {=SUM(LEFT)}. If both the cells above the insertion point and the cells to the left of it contain values, Microsoft Word uses the following rules to determine which SUM function to insert:

  • If the cell immediately above the insertion point contains a value, Word inserts {=SUM(ABOVE)}.

  • If the cell immediately above the insertion point does not contain a value but the cell immediately to the left of the insertion point does, Word inserts {=SUM(LEFT)}.

  • If neither cell immediately above the insertion point nor the cell immediately below it contains a value, Word inserts {=SUM(ABOVE)}.

  • If you don't specify Formula and all the cells above and to the left of the insertion point are empty, using the = (Formula) field causes an error.

Example

This example creates a table with three rows and three columns at the beginning of the active document and then calculates the average of all the numbers in the first column.

VBA Copy code Copy code
Set MyRange = ActiveDocument.Range(0, 0)
Set myTable = ActiveDocument.Tables.Add(MyRange, 3, 3)
With myTable
 .Cell(1, 1).Range.InsertAfter "100"
 .Cell(2, 1).Range.InsertAfter "50"
 .Cell(3, 1).Select
End With
Selection.InsertFormula Formula:="=Average(Above)"

The example inserts a formula field that is subtracted from a value represented by the bookmark named "GrossSales." The result is formatted with a dollar sign.

VBA Copy code Copy code
Selection.Collapse Direction:=wdCollapseStart
Selection.InsertFormula Formula:= "=GrossSales-45,000.00", _
 NumberFormat:="$#,##0.00"

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.InsertNewPage Method (Word)

 Copy code hover
[image]

Selection.InsertNewPage Method (Word)
See also Send feedback

Published: July 16, 2012

Inserts a new page at the position of the Insertion Point.

Syntax

expression .InsertNewPage

expression An expression that returns a Selection object.

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.InsertParagraph Method (Word)

 Copy code hover
[image]

Selection.InsertParagraph Method (Word)
See also Send feedback

Published: July 16, 2012

Replaces the specified selection with a new paragraph.

Syntax

expression .InsertParagraph

expression Required. A variable that represents a Selection object.

Remarks

After using method, the selection contains the new paragraph. If you don't want to replace the current selection, use the Collapse method before using this method. You can also use the InsertParagraphBefore or InsertParagraphAfter method to insert a new paragraph before or after a selection.

Example

This example collapses the selection and then inserts a paragraph mark at the insertion point.

VBA Copy code Copy code
With Selection
 .Collapse Direction:=wdCollapseStart
 .InsertParagraph
 .Collapse Direction:=wdCollapseEnd
End With

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.InsertParagraphAfter Method (Word)

 Copy code hover
[image]

Selection.InsertParagraphAfter Method (Word)
See also Send feedback

Published: July 16, 2012

Inserts a paragraph mark after a selection.

Syntax

expression .InsertParagraphAfter

expression Required. A variable that represents a Selection object.

Remarks

After using this method, the selection expands to include the new paragraph.

Example

This example inserts a new paragraph after the current paragraph.

VBA Copy code Copy code
With Selection
 .Move Unit:=wdParagraph
 .InsertParagraphAfter
 .Collapse Direction:=wdCollapseStart
End With

This example inserts a paragraph at the end of the active document. The Content property returns a Range object.

VBA Copy code Copy code
ActiveDocument.Content.InsertParagraphAfter

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.InsertParagraphBefore Method (Word)

 Copy code hover
[image]

Selection.InsertParagraphBefore Method (Word)
See also Send feedback

Published: July 16, 2012

Inserts a new paragraph before the specified selection or range.

Syntax

expression .InsertParagraphBefore

expression Required. A variable that represents a Selection object.

Remarks

After using this method, the selection expands to include the new paragraph.

Example

This example inserts the text "Hello" as a new paragraph before the selection.

VBA Copy code Copy code
With Selection
 .InsertParagraphBefore
 .InsertBefore "Hello"
End With

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.InsertRows Method (Word)

 Copy code hover
[image]

Selection.InsertRows Method (Word)
See also Send feedback

Published: July 16, 2012

Inserts the specified number of new rows above the row that contains the selection. If the selection isn't in a table, an error occurs.

Syntax

expression .InsertRows(NumRows)

expression Required. A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
NumRows | Optional | Variant | The number of rows to be added.

Remarks

You can also insert rows by using the Add method of the Rows object.

Example

This example inserts two new rows above the row that contains the selection, and then it removes the borders from the new rows.

VBA Copy code Copy code
If Selection.Information(wdWithInTable) = True Then
 Selection.InsertRows NumRows:=2
 Selection.Borders.Enable =False
End If

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.InsertRowsAbove Method (Word)

 Copy code hover
[image]

Selection.InsertRowsAbove Method (Word)
See also Send feedback

Published: July 16, 2012

Inserts rows above the current selection.

Syntax

expression .InsertRowsAbove

expression Required. A variable that represents a Selection object.

Remarks

Microsoft Word inserts as many rows as there are in the current selection.

To use this method, the current selection must be in a table.

Example

This example selects the second row in the first table and inserts a new row above it.

VBA Copy code Copy code
ActiveDocument.Tables(1).Rows(2).Select
Selection.InsertRowsAbove

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.InsertRowsBelow Method (Word)

 Copy code hover
[image]

Selection.InsertRowsBelow Method (Word)
See also Send feedback

Published: July 16, 2012

Inserts rows below the current selection.

Syntax

expression .InsertRowsBelow

expression Required. A variable that represents a Selection object.

Remarks

Microsoft Word inserts as many rows as there are in the current selection.

To use this method, the current selection must be in a table.

Example

This example selects the second row in the first table and inserts a new row below it.

VBA Copy code Copy code
ActiveDocument.Tables(1).Rows(2).Select
Selection.InsertRowsBelow

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.InsertStyleSeparator Method (Word)

 Copy code hover
[image]

Selection.InsertStyleSeparator Method (Word)
See also Send feedback

Published: July 16, 2012

Inserts a special hidden paragraph mark that allows Microsoft Word to join paragraphs formatted using different paragraph styles, so lead-in headings can be inserted into a table of contents.

Syntax

expression .InsertStyleSeparator

expression Required. A variable that represents a Selection object.

Example

This example inserts a style separator after every paragraph formatted with the built-in "Heading 4" style.

Note Note

The paragraph count is inside the Do...Loop because when Word inserts the style separator, the two paragraphs become one paragraph, so the paragraph count for the document changes as the procedure runs.

VBA Copy code Copy code
Sub InlineHeading()
 Dim intCount As Integer
 Dim intParaCount As Integer

 intCount = 1

 With ActiveDocument
 Do
 'Look for all paragraphs formatted with "Heading 4" style
 If .Paragraphs(Index:=intCount).Style = "Heading 4" Then
 .Paragraphs(Index:=intCount).Range.Select

 'Insert a style separator if paragraph
 'is formatted with a "Heading 4" style
 Selection.InsertStyleSeparator
 End If
 intCount = intCount + 1
 intParaCount = .Paragraphs.Count
 Loop Until intCount = intParaCount

 End With
End Sub

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.InsertSymbol Method (Word)

 Copy code hover
[image]

Selection.InsertSymbol Method (Word)
See also Send feedback

Published: July 16, 2012

Inserts a symbol in place of the specified selection.

Syntax

expression .InsertSymbol(CharacterNumber, Font, Unicode, Bias)

expression Required. A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
CharacterNumber | Required | Long | The character number for the specified symbol. This value will always be the sum of 31 and the number that corresponds to the position of the symbol in the table of symbols (counting from left to right). For example, to specify a delta character at position 37 in the table of symbols in the Symbol font, set CharacterNumber to 68.
Font | Optional | Variant | The name of the font that contains the symbol.
Unicode | Optional | Variant | True to insert the unicode character specified by CharacterNumber; False to insert the ANSI character specified by CharacterNumber. The default value is False.
Bias | Optional | Variant | Sets the font bias for symbols. This argument is useful for setting the correct font bias for East Asian characters. Can be one of the WdFontBias constants. This argument may not be available to you, depending on the language support (U.S. English, for example) that you have selected or installed.

Remarks

If you don't want to replace the selection, use the Collapse method before you use this method.

Example

This example inserts a double-headed arrow at the insertion point.

VBA Copy code Copy code
With Selection
 .Collapse Direction:=wdCollapseStart
 .InsertSymbol CharacterNumber:=171, _
 Font:="Symbol", Unicode:=False
End With

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.InsertXML Method (Word)

 Copy code hover
[image]

Selection.InsertXML Method (Word)
See also Send feedback

Published: July 16, 2012

Inserts the specified XML into the document at the cursor, replacing any selected text.

Syntax

expression .InsertXML(XML, Transform)

expression An expression that returns a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
XML | Required | String | Specifies the XML to insert. This can be any valid custom XML.
Transform | Optional | Variant | Specifies the XML Transformation (XSLT) used to transform the XML. If omitted, the XML is inserted as custom XML without applying a transform.

Return Value

Nothing

Example

The following example inserts the specified XML string into the document at the cursor, or replacing the active selection.

VBA Copy code Copy code
Dim strXML As String

strXML = "<?xml version=""1.0""?><abc:books xmlns:abc=""urn:books"" " & _
 "xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" " & _
 "xsi:schemaLocation=""urn:books books.xsd""><book>" & _
 "<author>Matt Hink</author><title>Migration Paths of the Red " & _
 "Breasted Robin</title><genre>non-fiction</genre>" & _
 "<price>29.95</price><pub_date>2006-05-01</pub_date>" & _
 "<abstract>You see them in the spring outside your windows. " & _
 "You hear their lovely songs wafting in the warm spring air. " & _
 "Now follow their path as they migrate to warmer climes in the fall, " & _
 "and then back to your back yard in the spring.</abstract></book></abc:books>"

Selection.InsertXML strXML

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.InStory Method (Word)

 Copy code hover
[image]

Selection.InStory Method (Word)
See also Send feedback

Published: July 16, 2012

True if the selection to which this method is applied is in the same story as the range specified by the Range argument.

Syntax

expression .InStory(Range)

expression Required. A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
Range | Required | Range | The range whose story is compared with the story of the current selection.

Return Value

Boolean

Remarks

A range can belong to only one story.

Example

This example determines whether the selection is in the same story as the first paragraph in the active document. The message box displays "False" because the selection is in the primary header story and the first paragraph is in the main text story.

VBA Copy code Copy code
With ActiveDocument.ActiveWindow.View
 .Type = wdPrintView
 .SeekView = wdSeekCurrentPageHeader
End With
same = Selection.InStory(ActiveDocument.Paragraphs(1).Range)
MsgBox same

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.IsEqual Method (Word)

 Copy code hover
[image]

Selection.IsEqual Method (Word)
See also Send feedback

Published: July 16, 2012

True if the selection to which this method is applied is equal to the range specified by the Range argument.

Syntax

expression .IsEqual(Range)

expression Required. A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
Range | Required | Range | The range to compare with the current selection.

Return Value

Boolean

Remarks

This method compares the starting and ending character positions and the story type. If all three of these items are the same for both the selection and the object specified by the Range argument, the objects are equal.

Example

This example compares the selection with the second paragraph in the active document. If the selection isn't equal to the second paragraph, the second paragraph is selected.

VBA Copy code Copy code
If Selection.IsEqual(ActiveDocument _
 .Paragraphs(2).Range) = False Then
 ActiveDocument.Paragraphs(2).Range.Select
End If

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.ItalicRun Method (Word)

 Copy code hover
[image]

Selection.ItalicRun Method (Word)
See also Send feedback

Published: July 16, 2012

Adds the italic character format to or removes it from the current run.

Syntax

expression .ItalicRun

expression Required. A variable that represents a Selection object.

Remarks

If the run contains a mix of italic and non-italic text, this method adds the italic character format to the entire run.

Example

This example toggles the italic formatting for the current selection.

VBA Copy code Copy code
Selection.ItalicRun

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.LtrPara Method (Word)

 Copy code hover
[image]

Selection.LtrPara Method (Word)
See also Send feedback

Published: July 16, 2012

Sets the reading order and alignment of the specified paragraphs to left-to-right.

Syntax

expression .LtrPara

expression Required. A variable that represents a Selection object.

Remarks

For all selected paragraphs, this method sets the reading order to left-to-right. If a paragraph with a right-to-left reading order is also right-aligned, this method reverses its reading order and sets its paragraph alignment to left-aligned.

Use the ReadingOrder property to change the reading order without affecting paragraph alignment.

Example

This example sets the reading order and alignment of the current selection to left-to-right if the selection is styled as "Normal."

VBA Copy code Copy code
If Selection.Style = "Normal" Then _
 Selection.LtrPara

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.LtrRun Method (Word)

 Copy code hover
[image]

Selection.LtrRun Method (Word)
See also Send feedback

Published: July 16, 2012

Sets the reading order and alignment of the specified run to left-to-right.

Syntax

expression .LtrRun

expression Required. A variable that represents a Selection object.

Remarks

For the specified run, this method sets the reading order to left-to-right. If a paragraph in the run with a right-to-left reading order is also right-aligned, this method reverses its reading order and sets its paragraph alignment to left-aligned.

Use the ReadingOrder property to change the reading order without affecting paragraph alignment.

Example

This example sets the reading order and alignment of the specified run to left-to-right if the selection is styled as "Normal."

VBA Copy code Copy code
If Selection.Style = "Normal" Then _
 Selection.LtrRun

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.Move Method (Word)

 Copy code hover
[image]

Selection.Move Method (Word)
See also Send feedback

Published: July 16, 2012

Collapses the specified selection to its start or end position and then moves the collapsed object by the specified number of units. This method returns a Long value that represents the number of units by which the selection was moved, or it returns 0 (zero) if the move was unsuccessful.

Syntax

expression .Move(Unit, Count)

expression Required. A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
Unit | Optional | WdUnits | The unit by which to move the ending character position.
Count | Optional | Variant | The number of units by which the specified range or selection is to be moved. If Count is a positive number, the object is collapsed to its end position and moved backward in the document by the specified number of units. If Count is a negative number, the object is collapsed to its start position and moved forward by the specified number of units. The default value is 1. You can also control the collapse direction by using the Collapse method before using the Move method. If the range or selection is in the middle of a unit or isn't collapsed, moving it to the beginning or end of the unit counts as moving it one full unit.

Return Value

Long

Remarks

The start and end positions of a collapsed range or selection are equal.

Applying the Move method to a range doesn't rearrange text in the document. Instead, it redefines the range to refer to a new location in the document.

If you apply the Move method to any range other than a Range object variable (for example, Selection.Paragraphs(3).Range.Move), the method has no effect.

Moving a Selection object collapses the selection and moves the insertion point either forward or backward in the document.

Example

This example moves the selection two words to the right and positions the insertion point after the second word's trailing space. If the move is unsuccessful, a message box indicates that the selection is at the end of the document.

VBA Copy code Copy code
If Selection.StoryType = wdMainTextStory Then
 wUnits = Selection.Move(Unit:=wdWord, Count:=2)
 If wUnits < 2 Then _
 MsgBox "Selection is at the end of the document"
End If

This example moves the selection forward three cells in the table.

VBA Copy code Copy code
If Selection.Information(wdWithInTable) = True Then
 Selection.Move Unit:=wdCell, Count:=3
End If

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.MoveDown Method (Word)

 Copy code hover
[image]

Selection.MoveDown Method (Word)
See also Send feedback

Published: July 16, 2012

Moves the selection down and returns the number of units it has been moved.

Syntax

expression .MoveDown(Unit, Count, Extend)

expression Required. A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
Unit | Optional | WdUnits | The unit by which the selection is to be moved.The default value is wdLine.
Count | Optional | Variant | The number of units the selection is to be moved. The default value is 1.
Extend | Optional | Variant | Can be either wdMove or wdExtend. If wdMove is used, the selection is collapsed to the endpoint and moved down. If wdExtend is used, the selection is extended down. The default value is wdMove.

Example

This example extends the selection down one line.

VBA Copy code Copy code
Selection.MoveDown Unit:=wdLine, Count:=1, Extend:=wdExtend

This example moves the selection down three paragraphs. If the move is successful, "Company" is inserted at the insertion point.

VBA Copy code Copy code
unitsMoved = Selection.MoveDown(Unit:=wdParagraph, _
 Count:=3, Extend:=wdMove)
If unitsMoved = 3 Then Selection.Text = "Company"

This example displays the current line number, moves the selection down three lines, and displays the current line number again.

VBA Copy code Copy code
MsgBox "Line " & Selection.Information(wdFirstCharacterLineNumber)
Selection.MoveDown Unit:=wdLine, Count:=3, Extend:=wdMove
MsgBox "Line " & Selection.Information(wdFirstCharacterLineNumber)

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.MoveEnd Method (Word)

 Copy code hover
[image]

Selection.MoveEnd Method (Word)
See also Send feedback

Published: July 16, 2012

Moves the ending character position of a range or selection.

Syntax

expression .MoveEnd(Unit, Count)

expression Required. A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
Unit | Optional | WdUnits | The unit by which to move the ending character position. The default value is wdCharacter.
Count | Optional | Variant | The number of units to move. If this number is positive, the ending character position is moved forward in the document. If this number is negative, the end is moved backward. If the ending position overtakes the starting position, the range collapses and both character positions move together. The default value is 1.

Return Value

Integer

Remarks

This method returns an integer that indicates the number of units the range or selection actually moved, or it returns 0 (zero) if the move was unsuccessful.

Example

This example moves the end of the selection one character backward (the selection size is reduced by one character). A space is considered a character.

VBA Copy code Copy code
Selection.MoveEnd Unit:=wdCharacter, Count:=-1

This example moves the end of the selection to the end of the line (the selection is extended to the end of the line).

VBA Copy code Copy code
Selection.MoveEnd Unit:=wdLine, Count:=1

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.MoveEndUntil Method (Word)

 Copy code hover
[image]

Selection.MoveEndUntil Method (Word)
See also Send feedback

Published: July 16, 2012

Moves the end position of the specified selection until any of the specified characters are found in the document.

Syntax

expression .MoveEndUntil(Cset, Count)

expression Required. A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
Cset | Required | Variant | One or more characters. This argument is case sensitive.
Count | Optional | Variant | The maximum number of characters by which the specified selection is to be moved. Can be a number or either wdForward or wdBackward. If Count is a positive number, the selection is moved forward in the document. If it is a negative number, the selection is moved backward. The default value is wdForward.

Return Value

Long

Remarks

This method returns a Long that represents the number of characters by which the end position of the specified selection was moved. If Count is greater than 0 (zero), this method returns the number of characters moved plus 1. If Count is less than 0 (zero), this method returns the number of characters moved minus 1. If no Cset characters are found, the selection isn't changed and the method returns 0 (zero). If the end position is moved backward to a point that precedes the original start position, the start position is set to the new ending position.

If the movement is forward in the document, the selection is expanded.

Example

This example extends the selection forward in the document until the letter "a" is found. The example then expands the selection by one character to include the letter "a".

VBA Copy code Copy code
With Selection
 .MoveEndUntil Cset:="a", Count:=wdForward
 .MoveRight Unit:=wdCharacter, Count:=1, Extend:=wdExtend
End With

This example extends the selection forward in the document until a tab is found. If a tab character isn't found in the next 100 characters, the selection isn't moved.

VBA Copy code Copy code
char = Selection.MoveEndUntil(Cset:=vbTab, Count:=100)
If char = 0 Then StatusBar = "Selection not moved"

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.MoveEndWhile Method (Word)

 Copy code hover
[image]

Selection.MoveEndWhile Method (Word)
See also Send feedback

Published: July 16, 2012

Moves the ending character position of a selection while any of the specified characters are found in the document.

Syntax

expression .MoveEndWhile(Cset, Count)

expression Required. A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
Cset | Required | Variant | One or more characters. This argument is case sensitive.
Count | Optional | Variant | The maximum number of characters by which the selection is to be moved. Can be a number or either wdForward or wdBackward. If Count is a positive number, the selection is moved forward in the document. If it is a negative number, the selection is moved backward. The default value is wdForward.

Remarks

While any character in Cset is found, the end position of the specified selection is moved. This method returns the number of characters that the end position of the selection moved as a Long value. If no Cset characters are found, the selection isn't changed and the method returns 0 (zero). If the end position is moved backward to a point that precedes the original start position, the start position is set to the new end position.

Example

This example moves the end position of the selection forward while the space character is found.

VBA Copy code Copy code
Selection.MoveEndWhile Cset:=" ", Count:=wdForward

This example moves the end position of the selection forward while Count is less than or equal to 10 and any letter from "a" through "h" is found.

VBA Copy code Copy code
Selection.MoveEndWhile Cset:="abcdefgh", Count:=10

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.MoveLeft Method (Word)

 Copy code hover
[image]

Selection.MoveLeft Method (Word)
See also Send feedback

Published: July 16, 2012

Moves the selection to the left and returns the number of units it has been moved.

Syntax

expression .MoveLeft(Unit, Count, Extend)

expression Required. A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
Unit | Optional | WdUnits | The unit by which the selection is to be moved.The default value is wdCharacter.
Count | Optional | Variant | The number of units the selection is to be moved. The default value is 1.
Extend | Optional | Variant | Can be either wdMove or wdExtend. If wdMove is used, the selection is collapsed to the endpoint and moved to the left. If wdExtend is used, the selection is extended to the left. The default value is wdMove.

Remarks

When the Unit is wdCell, the Extend argument will only be wdMove.

Example

This example moves the selection one character to the left. If the move is successful, MoveLeft returns 1.

VBA Copy code Copy code
If Selection.MoveLeft = 1 Then MsgBox "Move was successful"

This example enables field shading for the selected field, inserts a DATE field, and then moves the selection left to select the field.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.View.FieldShading = _
 wdFieldShadingWhenSelected
With Selection
 .Fields.Add Range:=Selection.Range, Type:=wdFieldDate
 .MoveLeft Unit:=wdWord, Count:=1
End With

This example moves the selection to the previous table cell.

VBA Copy code Copy code
If Selection.Information(wdWithInTable) = True Then
 Selection.MoveLeft Unit:=wdCell, Count:=1, Extend:=wdMove
End If

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.MoveRight Method (Word)

 Copy code hover
[image]

Selection.MoveRight Method (Word)
See also Send feedback

Published: July 16, 2012

Moves the selection to the right and returns the number of units it has been moved.

Syntax

expression .MoveRight(Unit, Count, Extend)

expression Required. A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
Unit | Optional | WdUnits | The unit by which the selection is to be moved.The default value is wdCharacter.
Count | Optional | Variant | The number of units the selection is to be moved. The default value is 1.
Extend | Optional | Variant | Can be either wdMove or wdExtend. If wdMove is used, the selection is collapsed to the endpoint and moved to the right. If wdExtend is used, the selection is extended to the right. The default value is wdMove.

Return Value

Long

Remarks

When the Unit is wdCell, the Extend argument can only be wdMove.

Example

This example moves the selection before the previous field and then selects the field.

VBA Copy code Copy code
With Selection
 Set MyRange = .GoTo(wdGoToField, wdGoToPrevious)
 .MoveRight Unit:=wdWord, Count:=1, Extend:=wdExtend
 If Selection.Fields.Count = 1 Then Selection.Fields(1).Update
End With

This example moves the selection one character to the right. If the move is successful, MoveRight returns 1.

VBA Copy code Copy code
If Selection.MoveRight = 1 Then MsgBox "Move was successful"

This example moves the selection to the next table cell.

VBA Copy code Copy code
If Selection.Information(wdWithInTable) = True Then
 Selection.MoveRight Unit:=wdCell, Count:=1, Extend:=wdMove
End If

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.MoveStart Method (Word)

 Copy code hover
[image]

Selection.MoveStart Method (Word)
See also Send feedback

Published: July 16, 2012

Moves the start position of the specified selection.

Syntax

expression .MoveStart(Unit, Count)

expression Required. A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
Unit | Optional | WdUnits | The unit by which start position of the specified selection is to be moved. Can be one of the WdUnits constants. The default value is wdCharacter.
Count | Optional | Variant | The maximum number of units by which the specified selection is to be moved. If Count is a positive number, the start position of the selection is moved forward in the document. If it is a negative number, the start position is moved backward. If the start position is moved forward to a position beyond the end position, the selection is collapsed and both the start and end positions are moved together. The default value is 1.

Return Value

Integer

Remarks

This method returns an integer that indicates the number of units by which the start position or the selection actually moved, or it returns 0 (zero) if the move was unsuccessful.

Example

This example moves the start position of the selection one character forward (the selection size is reduced by one character). Note that a space is considered a character.

VBA Copy code Copy code
Selection.MoveStart Unit:=wdCharacter, Count:=1

This example moves the start position of the selection to the beginning of the line (the selection is extended to the start of the line).

VBA Copy code Copy code
Selection.MoveStart Unit:=wdLine, Count:=-1

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.MoveStartUntil Method (Word)

 Copy code hover
[image]

Selection.MoveStartUntil Method (Word)
See also Send feedback

Published: July 16, 2012

Moves the start position of the specified selection until one of the specified characters is found in the document. If the movement is backward through the document, the selection is expanded.

Syntax

expression .MoveStartUntil(Cset, Count)

expression Required. A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
Cset | Required | Variant | One or more characters. This argument is case sensitive.
Count | Optional | Variant | The maximum number of characters by which the specified selection is to be moved. Can be a number or either the wdForward or wdBackward constant. If Count is a positive number, the selection is moved forward in the document. If it is a negative number, the selection is moved backward. The default value is wdForward.

Remarks

This method returns the number of characters by which the start position of the specified selection moved, as a Long value. If Count is greater than 0 (zero), this method returns the number of characters moved plus 1. If Count is less than 0 (zero), this method returns the number of characters moved minus 1. If no Cset characters are found, the specified selection isn't changed and the method returns 0 (zero). If the start position is moved forward to a point beyond the end position, the selection is collapsed and both the start and end positions are moved together.

Example

This example extends the selection backward until a capital "I" is found.

VBA Copy code Copy code
Selection.MoveStartUntil Cset:="I", Count:=wdBackward

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.MoveStartWhile Method (Word)

 Copy code hover
[image]

Selection.MoveStartWhile Method (Word)
See also Send feedback

Published: July 16, 2012

Moves the start position of the specified selection while any of the specified characters are found in the document.

Syntax

expression .MoveStartWhile(Cset, Count)

expression Required. A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
Cset | Required | Variant | One or more characters. This argument is case sensitive.
Count | Optional | Variant | The maximum number of characters by which the specified selection is to be moved. Can be a number or either the wdForward or wdBackward constant. If Count is a positive number, the selection is moved forward in the document. If it is a negative number, the selection is moved backward. The default value is wdForward.

Remarks

While any character in Cset is found, the start position of the selection is moved. This method returns the number of characters that the start position of the selection moved as a Long value. If not Cset characters are found, the selection isn't changed and the method returns 0 (zero). If the start position is moved forward to a position beyond the original end position, the end position is set to the new start position.

Example

This example moves the start position of the selection backward through the document while the space character is found.

VBA Copy code Copy code
Selection.MoveStartWhile Cset:=" ", Count:=wdBackward

This example moves the start position of the selection backward through the document while Count is less than or equal to 10 and any letter from "a" through "h" is found.

VBA Copy code Copy code
Selection.MoveStartWhile Cset:="abcdefgh", Count:=-10

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.MoveUntil Method (Word)

 Copy code hover
[image]

Selection.MoveUntil Method (Word)
See also Send feedback

Published: July 16, 2012

Moves the specified selection until one of the specified characters is found in the document.

Syntax

expression .MoveUntil(Cset, Count)

expression Required. A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
Cset | Required | Variant | One or more characters. If any character in Cset is found before the Count value expires, the specified selection is positioned as an insertion point immediately before that character. This argument is case sensitive.
Count | Optional | Variant | The maximum number of characters by which the specified selection is to be moved. Can be a number or either the wdForward or wdBackward constant. If Count is a positive number, the selection is moved forward in the document, beginning at the end position. If it is a negative number, the selection is moved backward, beginning at the start position. The default value is wdForward.

Remarks

This method returns the number of characters by which the specified selection was moved, as a Long value. If Count is greater than 0 (zero), this method returns the number of characters moved plus one. If Count is less than 0 (zero), this method returns the number of characters moved minus one. If no Cset characters are found, the selection isn't not changed and the method returns 0 (zero).

Example

This example moves the selection forward to the end of the active paragraph and then displays the number of characters by which the selection was moved.

VBA Copy code Copy code
x = Selection.MoveUntil(Cset:=Chr$(13), Count:=wdForward)
MsgBox x-1 & " character positions were moved"

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.MoveUp Method (Word)

 Copy code hover
[image]

Selection.MoveUp Method (Word)
See also Send feedback

Published: July 16, 2012

Moves the selection up and returns the number of units that it has been moved.

Syntax

expression .MoveUp(Unit, Count, Extend)

expression Required. A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
Unit | Optional | Variant | The unit by which to move the selection. Can be one of the following WdUnits constants: wdLine, wdParagraph, wdWindow or wdScreen. The default value is wdLine. You can use the wdWindow constant for the Unit argument to move to the top or bottom of the active window. Regardless of the value of Count (greater than 1 or less than - 1), the wdWindow constant moves only one unit. Use the wdScreen constant to move more than one screen.
Count | Optional | Variant | The number of units the selection is to be moved. The default value is 1.
Extend | Optional | Variant | Specifies whether the selection is moved or extended. Can be either wdMove or wdExtend. If wdMove is used, the selection is collapsed to the endpoint and moved up. If wdExtend is used, the selection is extended up. The default value is wdMove.

Return Value

Long

Example

This example moves the selection to the beginning of the previous paragraph.

VBA Copy code Copy code
Selection.MoveRight
Selection.MoveUp Unit:=wdParagraph, Count:=2, Extend:=wdMove

This example displays the current line number, moves the selection up three lines, and displays the current line number again.

VBA Copy code Copy code
MsgBox "Line " & Selection.Information(wdFirstCharacterLineNumber)
Selection.MoveUp Unit:=wdLine, Count:=3, Extend:=wdMove
MsgBox "Line " & Selection.Information(wdFirstCharacterLineNumber)

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.MoveWhile Method (Word)

 Copy code hover
[image]

Selection.MoveWhile Method (Word)
See also Send feedback

Published: July 16, 2012

Moves the specified selection while any of the specified characters are found in the document.

Syntax

expression .MoveWhile(Cset, Count)

expression Required. A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
Cset | Required | Variant | One or more characters. This argument is case sensitive.
Count | Optional | Variant | The maximum number of characters by which the specified selection is to be moved. Can be a number or either the wdForward or wdBackward constant. If Count is a positive number, the specified selection is moved forward in the document, beginning at the end position. If it is a negative number, the selection is moved backward, beginning at the start position. The default value is wdForward.

Remarks

While any character in Cset is found, the specified selection is moved. The resulting Selection object is positioned as an insertion point after whatever Cset characters were found. This method returns the number of characters by which the specified selection was moved, as a Long value. If no Cset characters are found, the selection isn't changed and the method returns 0 (zero).

Example

This example moves the selection after consecutive tabs.

VBA Copy code Copy code
Selection.MoveWhile Cset:=vbTab, Count:=wdForward

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.Next Method (Word)

 Copy code hover
[image]

Selection.Next Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the next unit relative to the specified selection.

Syntax

expression .Next(Unit, Count)

expression Required. A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
Unit | Optional | Variant | The type of units by which to count. Can be any WdUnits constant.
Count | Optional | Variant | The number of units by which you want to move ahead. The default value is one.

Return Value

Range

Remarks

If the selection is just before the specified Unit, the selection is moved to the following unit. For example, if the selection is just before a word, the following instruction moves the selection forward to the word that follows.

VBA Copy code Copy code
Selection.Next(Unit:=wdWord, Count:=1).Select

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.NextField Method (Word)

 Copy code hover
[image]

Selection.NextField Method (Word)
See also Send feedback

Published: July 16, 2012

Selects the next field.

Syntax

expression .NextField

expression Required. A variable that represents a Selection object.

Return Value

Field

Remarks

If this method finds a field, it returns a Field object; if not, it returns Nothing.

Example

This example updates the next field in the selection.

VBA Copy code Copy code
If Not (Selection.NextField Is Nothing) Then
 Selection.Fields.Update
End If

This example selects the next field in the selection, and if a field is found, displays a message in the status bar.

VBA Copy code Copy code
Set myField = Selection.NextField
If Not (myField Is Nothing) Then StatusBar = "Field found"

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.NextRevision Method (Word)

 Copy code hover
[image]

Selection.NextRevision Method (Word)
See also Send feedback

Published: July 16, 2012

Locates and returns the next tracked change as a Revision object.

Syntax

expression .NextRevision(Wrap)

expression Required. A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
Wrap | Optional | Variant | True to continue searching for a revision at the beginning of the document when the end of the document is reached. The default value is False.

Return Value

Revision

Remarks

The changed text becomes the current selection. Use the properties of the resulting Revision object to see what type of change it is, who made it, and so forth. Use the methods of the Revision object to accept or reject the change.

If there are no tracked changes to be found, the current selection remains unchanged.

Example

This example rejects the next tracked change found after the fifth paragraph in the active document. The revTempvariable is set to Nothing if a change is not found.

VBA Copy code Copy code
Dim rngTemp as Range
Dim revTemp as Revision

If ActiveDocument.Paragraphs.Count >= 5 Then
 Set rngTemp = ActiveDocument.Paragraphs(5).Range
 rngTemp.Select
 Set revTemp = Selection.NextRevision(Wrap:=False)
 If Not (revTemp Is Nothing) Then revTemp.Reject
End If

This example accepts the next tracked change found if the change type is inserted text.

VBA Copy code Copy code
Dim revTemp as Revision

Set revTemp = Selection.NextRevision(Wrap:=True)
If Not (revTemp Is Nothing) Then
 If revTemp.Type = wdRevisionInsert Then revTemp.Accept
End If

This example finds the next revision after the current selection made by the author of the document.

VBA Copy code Copy code
Dim revTemp as Revision
Dim strAuthor as String

strAuthor = ActiveDocument.BuiltInDocumentProperties(wdPropertyAuthor)

Do While True
 Set revTemp = Selection.NextRevision(Wrap:=False)
 If Not (revTemp Is Nothing) Then
 If revTemp.Author = strAuthor Then
 MsgBox Prompt:="Another revision by " & strAuthor & "!"
 Exit Do
 End If
 Else
 MsgBox Prompt:="No more revisions!"
 Exit Do
 End If
Loop

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.NextSubdocument Method (Word)

 Copy code hover
[image]

Selection.NextSubdocument Method (Word)
See also Send feedback

Published: July 16, 2012

Moves the selection to the next subdocument.

Syntax

expression .NextSubdocument

expression Required. A variable that represents a Selection object.

Remarks

If there isn't another subdocument, an error occurs.

Example

This example switches the active document to master document view and selects the first subdocument.

VBA Copy code Copy code
If ActiveDocument.Subdocuments.Count >= 1 Then
 ActiveDocument.ActiveWindow.View.Type = wdMasterView
 Selection.HomeKey unit:=wdStory, Extend:=wdMove
 Selection.NextSubdocument
End If

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.Paste Method (Word)

 Copy code hover
[image]

Selection.Paste Method (Word)
See also Send feedback

Published: July 16, 2012

Inserts the contents of the Clipboard at the specified selection.

Syntax

expression .Paste

expression Required. A variable that represents a Selection object.

Remarks

Using this method replaces the contents of the current selection. If you don't want to replace the contents of the selection, use the Collapse method before using this method.

When you use this method with a Range object, the range expands to include the contents of the Clipboard. When you use this method with a Selection object, the selection does not expand to include the Clipboard contents; instead, the selection is positioned after the pasted Clipboard contents.

Example

This example copies the first paragraph in the document and pastes it at the insertion point.

VBA Copy code Copy code
ActiveDocument.Paragraphs(1).Range.Copy
Selection.Collapse Direction:=wdCollapseStart
Selection.Paste

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.PasteAndFormat Method (Word)

 Copy code hover
[image]

Selection.PasteAndFormat Method (Word)
See also Send feedback

Published: July 16, 2012

Pastes the selected table cells and formats them as specified.

Syntax

expression .PasteAndFormat(Type)

expression Required. A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
Type | Required | WdRecoveryType | The type of formatting to use when pasting the selected table cells.

Example

This example pastes a selected Microsoft Excel chart as a picture. This example assumes that the Clipboard contains an Excel chart.

VBA Copy code Copy code
Sub PasteChart()
 Selection.PasteAndFormat Type:=wdChartPicture
End Sub

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.PasteAppendTable Method (Word)

 Copy code hover
[image]

Selection.PasteAppendTable Method (Word)
See also Send feedback

Published: July 16, 2012

Merges pasted cells into an existing table by inserting the pasted rows between the selected rows. No cells are overwritten.

Syntax

expression .PasteAppendTable

expression Required. A variable that represents a Selection object.

Example

This example pastes table cells by inserting rows into the current table at the insertion point. This example assumes that the Clipboard contains a collection of table cells.

VBA Copy code Copy code
Sub PasteAppend
 Selection.PasteAppendTable
End Sub

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.PasteAsNestedTable Method (Word)

 Copy code hover
[image]

Selection.PasteAsNestedTable Method (Word)
See also Send feedback

Published: July 16, 2012

Pastes a cell or group of cells as a nested table into the selection.

Syntax

expression .PasteAsNestedTable

expression Required. A variable that represents a Selection object.

Remarks

You can use PasteAsNestedTable only if the Clipboard contains a cell or group of cells and the selected range is a cell or group of cells in the current document.

Example

This example pastes the contents of the Clipboard into the third cell of the first table in the active document.

VBA Copy code Copy code
ActiveDocument.Tables(1).Rows(1).Cells(3).Range _
 .PasteAsNestedTable

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.PasteExcelTable Method (Word)

 Copy code hover
[image]

Selection.PasteExcelTable Method (Word)
See also Send feedback

Published: July 16, 2012

Pastes and formats a Microsoft Excel table.

Syntax

expression .PasteExcelTable(LinkedToExcel, WordFormatting, RTF)

expression Required. A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
LinkedToExcel | Required | Boolean | True links the pasted table to the original Excel file so that changes made to the Excel file are reflected in Microsoft Word.
WordFormatting | Required | Boolean | True formats the table using the formatting in the Word document. False formats the table according to the original Excel file.
RTF | Required | Boolean | True pastes the Excel table using Rich Text Format (RTF). False pastes the Excel table as HTML.

Example

This example pastes an Excel table into the active document. The parameters specify that the pasted table is linked to the Excel file, retains the original Excel formatting, and is pasted as RTF. This example assumes that the Clipboard contains an Excel table.

VBA Copy code Copy code
Sub PasteExcelFormatted()
 Selection.PasteExcelTable _
 LinkedToExcel:=True, _
 WordFormatting:=False, _
 RTF:=True
End Sub

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.PasteFormat Method (Word)

 Copy code hover
[image]

Selection.PasteFormat Method (Word)
See also Send feedback

Published: July 16, 2012

Applies formatting copied with the CopyFormat method to the selection.

Syntax

expression .PasteFormat

expression Required. A variable that represents a Selection object.

Remarks

If a paragraph mark was selected when the CopyFormat method was used, Word applies paragraph formatting in addition to character formatting.

Example

This example copies the paragraph and character formatting from the first paragraph in the selection to the next paragraph in the selection.

VBA Copy code Copy code
With Selection
 .Paragraphs(1).Range.Select
 .CopyFormat
 .Paragraphs(1).Next.Range.Select
 .PasteFormat
End With

This example collapses the selection and copies the character formatting to the next word.

VBA Copy code Copy code
With Selection
 .Collapse Direction:=wdCollapseStart
 .CopyFormat
 .Next(Unit:=wdWord, Count:=1).Select
 .PasteFormat
End With

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.PasteSpecial Method (Word)

 Copy code hover
[image]

Selection.PasteSpecial Method (Word)
See also Send feedback

Published: July 16, 2012

Inserts the contents of the Clipboard.

Syntax

expression .PasteSpecial(IconIndex, Link, Placement, DisplayAsIcon, DataType, IconFileName, IconLabel)

expression Required. A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
IconIndex | Optional | Variant | If DisplayAsIcon is True, this argument is a number that corresponds to the icon you want to use in the program file specified by IconFilename. If this argument is omitted, this method uses the first (default) icon.
Link | Optional | Variant | True to create a link to the source file of the Clipboard contents. The default value is False.
Placement | Optional | Variant | Can be either of the WdOLEPlacement constants.
DisplayAsIcon | Optional | Variant | True to display the link as an icon. The default value is False.
DataType | Optional | Variant | A format for the Clipboard contents when they are inserted into the document. WdPasteDataType.
IconFileName | Optional | Variant | If DisplayAsIcon is True, this argument is the path and file name for the file in which the icon to be displayed is stored.
IconLabel | Optional | Variant | If DisplayAsIcon is True, this argument is the text that appears below the icon.

Remarks

Unlike with the Paste method, with PasteSpecial you can control the format of the pasted information and (optionally) establish a link to the source file (for example, a Microsoft Excel worksheet). If you do not want to replace the contents of the specified selection, use the Collapse method before you use this method. When you use this method, the selection does not expand to include the contents of the Clipboard.

Example

This example inserts the Clipboard contents at the insertion point as unformatted text.

VBA Copy code Copy code
Selection.Collapse Direction:=wdCollapseStart
Selection.PasteSpecial DataType:=wdPasteText

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.Previous Method (Word)

 Copy code hover
[image]

Selection.Previous Method (Word)
See also Send feedback

Published: July 16, 2012

Moves the selected text by the specified number of units, and returns a Range object relative to the collapsed selection.

Syntax

expression .Previous(Unit, Count)

expression Required. A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
Unit | Optional | Variant | Specifies the type of unit by which to move the selection. Can be one of the WdUnits constants.
Count | Optional | Variant | The number of units by which you want to move. The default value is 1.

Return Value

Range

Remarks

If the selection is just after the specified Unit, the selection is moved to the previous unit. For example, if the selection is just after a word (before the trailing space), the following instruction moves the selection backward to the previous word.

VBA Copy code Copy code
Selection.Previous(Unit:=wdWord, Count:=1).Select

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.PreviousField Method (Word)

 Copy code hover
[image]

Selection.PreviousField Method (Word)
See also Send feedback

Published: July 16, 2012

Selects and returns the previous field.

Syntax

expression .PreviousField

expression Required. A variable that represents a Selection object.

Return Value

Field

Remarks

If this method finds a field, it returns a Field object; if not, it returns Nothing.

Example

This example updates the previous field (the field immediately preceding the selection).

VBA Copy code Copy code
If Not (Selection.PreviousField Is Nothing) Then
 Selection.Fields.Update
End If

This example selects the previous field, and if a field is found, displays a message in the status bar.

VBA Copy code Copy code
Set myField = Selection.PreviousField
If Not (myField Is Nothing) Then StatusBar = "Field found"

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.PreviousRevision Method (Word)

 Copy code hover
[image]

Selection.PreviousRevision Method (Word)
See also Send feedback

Published: July 16, 2012

Locates and returns the previous tracked change as a Revision object.

Syntax

expression .PreviousRevision(Wrap)

expression Required. A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
Wrap | Optional | Variant | True to continue searching for a revision at the end of the document when the beginning of the document is reached. The default value is False.

Return Value

Revision

Example

This example selects the last tracked change in the first section in the active document and displays the date and time of the change.

VBA Copy code Copy code
Selection.EndOf Unit:=wdStory, Extend:=wdMove
Set myRev = Selection.PreviousRevision
If Not (myRev Is Nothing) Then MsgBox myRev.Date

This example rejects the previous tracked change found if the change type is deleted or inserted text. If the tracked change is a style change, the change is accepted.

VBA Copy code Copy code
Set myRev = Selection.PreviousRevision(Wrap:=True)
If Not (myRev Is Nothing) Then
 Select Case myRev.Type
 Case wdRevisionDelete
 myRev.Reject
 Case wdRevisionInsert
 myRev.Reject
 Case wdRevisionStyle
 myRev.Accept
 End Select
End If

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.PreviousSubdocument Method (Word)

 Copy code hover
[image]

Selection.PreviousSubdocument Method (Word)
See also Send feedback

Published: July 16, 2012

Moves the selection to the previous subdocument.

Syntax

expression .PreviousSubdocument

expression Required. A variable that represents a Selection object.

Remarks

If there isn't another subdocument, an error occurs.

Example

This example switches the active document to master document view and selects the previous subdocument.

VBA Copy code Copy code
If ActiveDocument.Subdocuments.Count >= 1 Then
 ActiveDocument.ActiveWindow.View.Type = wdMasterView
 Selection.EndKey Unit:=wdStory, Extend:=wdMove
 Selection.PreviousSubdocument
End If

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.ReadingModeGrowFont Method (Word)

 Copy code hover
[image]

Selection.ReadingModeGrowFont Method (Word)
See also Send feedback

Published: July 16, 2012

Increases the size of the displayed text one point size when the document is displayed in Reading mode.

Version Information

Version Added: Word 2007

Syntax

expression .ReadingModeGrowFont

expression An expression that returns a Selection object.

Return Value

Nothing

Remarks

Use the ReadingModeShrinkFont method to decrease the size of the text. This does not affect the size of the font in the document, only the size of the text while viewing the document in Reading mode.

Note Note

Text does not need to be selected for this method to affect the text displayed in Reading mode. Text size for all text displayed in Reading mode is affected.

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.ReadingModeShrinkFont Method (Word)

 Copy code hover
[image]

Selection.ReadingModeShrinkFont Method (Word)
See also Send feedback

Published: July 16, 2012

Decreases the size of the displayed text one point size when the document is displayed in Reading mode.

Version Information

Version Added: Word 2007

Syntax

expression .ReadingModeShrinkFont

expression An expression that returns a Selection object.

Return Value

Nothing

Remarks

Use the ReadingModeGrowFont method to increase the size of the text. This does not affect the size of the font in the document, only the size of the text while viewing the document in Reading mode.

Note Note

Text does not need to be selected for this method to affect the text displayed in Reading mode. Text size for all text displayed in Reading mode is affected.

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.RtlPara Method (Word)

 Copy code hover
[image]

Selection.RtlPara Method (Word)
See also Send feedback

Published: July 16, 2012

Sets the reading order and alignment of the specified paragraphs to right-to-left.

Syntax

expression .RtlPara

expression Required. A variable that represents a Selection object.

Remarks

For all selected paragraphs, this method sets the reading order to right-to-left. If a paragraph with a left-to-right reading order is also left-aligned, this method reverses its reading order and sets its paragraph alignment to right-aligned.

Use the ReadingOrder property to change the reading order without affecting paragraph alignment.

Example

This example sets the reading order and alignment of the current selection to right-to-left if the selection isn't styled as "Normal."

VBA Copy code Copy code
If Selection.Style <> "Normal" Then _
 Selection.RtlPara

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.RtlRun Method (Word)

 Copy code hover
[image]

Selection.RtlRun Method (Word)
See also Send feedback

Published: July 16, 2012

Sets the reading order and alignment of the specified run to right-to-left.

Syntax

expression .RtlRun

expression Required. A variable that represents a Selection object.

Remarks

For the specified run, this method sets the reading order to right-to-left. If a paragraph in the run with a left-to-right reading order is also left-aligned, this method reverses its reading order and sets its paragraph alignment to right-aligned.

Use the ReadingOrder property to change the reading order without affecting paragraph alignment.

Example

This example sets the reading order and alignment of the specified run to right-to-left if the selection isn't styled as "Normal."

VBA Copy code Copy code
If Selection.Style <> "Normal" Then _
 Selection.RtlRun

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.Select Method (Word)

 Copy code hover
[image]

Selection.Select Method (Word)
See also Send feedback

Published: July 16, 2012

Selects the specified text.

Syntax

expression .Select

expression Required. A variable that represents a Selection object.

Remarks

After using this method, use the Selection object to work with the selected items. For more information, see Working with the Selection Object.

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.SelectCell Method (Word)

 Copy code hover
[image]

Selection.SelectCell Method (Word)
See also Send feedback

Published: July 16, 2012

Selects the entire cell containing the current selection.

Syntax

expression .SelectCell

expression Required. A variable that represents a Selection object.

Remarks

To use this method, the current selection must be contained within a single cell.

Example

This example selects the entire cell containing the current selection.

VBA Copy code Copy code
Selection.SelectCell

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.SelectColumn Method (Word)

 Copy code hover
[image]

Selection.SelectColumn Method (Word)
See also Send feedback

Published: July 16, 2012

Selects the column that contains the insertion point, or selects all columns that contain the selection.

Syntax

expression .SelectColumn

expression Required. A variable that represents a Selection object.

Remarks

If the selection isn't in a table, an error occurs.

Example

This example collapses the selection to the ending point and then selects the column that contains the insertion point.

VBA Copy code Copy code
Selection.Collapse Direction:=wdCollapseEnd
If Selection.Information(wdWithInTable) = True Then
 Selection.SelectColumn
End If

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.SelectCurrentAlignment Method (Word)

 Copy code hover
[image]

Selection.SelectCurrentAlignment Method (Word)
See also Send feedback

Published: July 16, 2012

Extends the selection forward until text with a different paragraph alignment is encountered.

Syntax

expression .SelectCurrentAlignment

expression Required. A variable that represents a Selection object.

Remarks

There are four types of paragraph alignment: left, centered, right, and justified.

Example

This example positions the insertion point at the beginning of the first paragraph after the current paragraph that doesn't have the same alignment as the current paragraph. If the alignment is the same from the selection to the end of the document, the example moves the selection to the end of the document and displays a message.

VBA Copy code Copy code
Selection.SelectCurrentAlignment
Selection.Collapse Direction:=wdCollapseEnd
If Selection.End = ActiveDocument.Content.End - 1 Then
 MsgBox "No change in alignment found."
End If

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.SelectCurrentColor Method (Word)

 Copy code hover
[image]

Selection.SelectCurrentColor Method (Word)
See also Send feedback

Published: July 16, 2012

Extends the selection forward until text with a different color is encountered.

Syntax

expression .SelectCurrentColor

expression Required. A variable that represents a Selection object.

Example

This example extends the selection from the beginning of the document to the first character formatted with a different color and then displays the number of characters in the resulting selection.

VBA Copy code Copy code
Selection.HomeKey Unit:=wdStory, Extend:=wdMove
Selection.SelectCurrentColor
n = Len(Selection.Text)
MsgBox "Contiguous characters with the same color: " & n

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.SelectCurrentFont Method (Word)

 Copy code hover
[image]

Selection.SelectCurrentFont Method (Word)
See also Send feedback

Published: July 16, 2012

Extends the selection forward until text in a different font or font size is encountered.

Syntax

expression .SelectCurrentFont

expression Required. A variable that represents a Selection object.

Example

This example extends the selection until text in a different font or font size is encountered. The example uses the Grow method to increase the size of the selected text to the next available font size.

VBA Copy code Copy code
With Selection
 .SelectCurrentFont
 .Font.Grow
End With

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.SelectCurrentIndent Method (Word)

 Copy code hover
[image]

Selection.SelectCurrentIndent Method (Word)
See also Send feedback

Published: July 16, 2012

Extends the selection forward until text with different left or right paragraph indents is encountered.

Syntax

expression .SelectCurrentIndent

expression Required. A variable that represents a Selection object.

Example

This example jumps to the beginning of the first paragraph in the document that has different indents than the first paragraph in the active document.

VBA Copy code Copy code
With Selection
 .HomeKey Unit:=wdStory, Extend:=wdMove
 .SelectCurrentIndent
 .Collapse Direction:=wdCollapseEnd
End With

This example determines whether all the paragraphs in the active document are formatted with the same left and right indents and then displays a message box indicating the result.

VBA Copy code Copy code
With Selection
 .HomeKey Unit:=wdStory, Extend:=wdMove
 .SelectCurrentIndent
 .Collapse Direction:=wdCollapseEnd
End With
If Selection.End = ActiveDocument.Content.End - 1 Then
 MsgBox "All paragraphs share the same left " _
 & "and right indents."
Else
 MsgBox "Not all paragraphs share the same left " _
 & "and right indents."
End If

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.SelectCurrentSpacing Method (Word)

 Copy code hover
[image]

Selection.SelectCurrentSpacing Method (Word)
See also Send feedback

Published: July 16, 2012

Extends the selection forward until a paragraph with different line spacing is encountered.

Syntax

expression .SelectCurrentSpacing

expression Required. A variable that represents a Selection object.

Example

This example selects all consecutive paragraphs that have the same line spacing and changes the line spacing to single spacing.

VBA Copy code Copy code
With Selection
 .SelectCurrentSpacing
 .ParagraphFormat.Space1
End With

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.SelectCurrentTabs Method (Word)

 Copy code hover
[image]

Selection.SelectCurrentTabs Method (Word)
See also Send feedback

Published: July 16, 2012

Extends the selection forward until a paragraph with different tab stops is encountered.

Syntax

expression .SelectCurrentTabs

expression Required. A variable that represents a Selection object.

Example

This example selects the second paragraph in the active document and then extends the selection to include all other paragraphs that have the same tab stops.

VBA Copy code Copy code
Set myRange = ActiveDocument.Paragraphs(2).Range
myRange.Select
Selection.SelectCurrentTabs

This example selects paragraphs that have the same tab stops and retrieves the position of the first tab stop. The example moves the selection to the next range of paragraphs that have the same tab stops. The example then adds the tab stop setting from the first group of paragraphs to the current selection.

VBA Copy code Copy code
With Selection
 .SelectCurrentTabs
 pos = .Paragraphs.TabStops(1).Position
 .Collapse Direction:=wdCollapseEnd
 .SelectCurrentTabs
 .Paragraphs.TabStops.Add Position:=pos
End With

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.SelectRow Method (Word)

 Copy code hover
[image]

Selection.SelectRow Method (Word)
See also Send feedback

Published: July 16, 2012

Selects the row that contains the insertion point, or selects all rows that contain the selection.

Syntax

expression .SelectRow

expression Required. A variable that represents a Selection object.

Remarks

If the selection isn't in a table, an error occurs.

Example

This example collapses the selection to the starting point and then selects the column that contains the insertion point.

VBA Copy code Copy code
Selection.Collapse Direction:=wdCollapseStart
If Selection.Information(wdWithInTable) = True Then
 Selection.SelectRow
End If

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.SetRange Method (Word)

 Copy code hover
[image]

Selection.SetRange Method (Word)
See also Send feedback

Published: July 16, 2012

Sets the starting and ending character positions for the selection.

Syntax

expression .SetRange(Start, End)

expression Required. A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
Start | Required | Long | The starting character position of the selection.
End | Required | Long | The ending character position of the selection.

Remarks

Character position values start at the beginning of the story, with the first value being 0 (zero). All characters are counted, including nonprinting characters. Hidden characters are counted even if they're not displayed.

The SetRange method redefines the starting and ending positions of an existing Selection object. This method differs from the Range method, which is used to create a Range object, given a starting and ending position.

Example

This example selects the first 10 characters in the document.

VBA Copy code Copy code
Selection.SetRange Start:=0, End:=10

This example extends the selection to the end of the document.

VBA Copy code Copy code
Selection.SetRange Start:=Selection.Start, _
 End:=ActiveDocument.Content.End

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.Shrink Method (Word)

 Copy code hover
[image]

Selection.Shrink Method (Word)
See also Send feedback

Published: July 16, 2012

Shrinks the selection to the next smaller unit of text.

Syntax

expression .Shrink

expression A variable that represents a Selection object.

Remarks

The unit progression for this method is as follows: entire document, section, paragraph, sentence, word, insertion point.

Example

This example collapses the selected text to the next smaller unit of text.

VBA Copy code Copy code
If Selection.Type = wdSelectionNormal Then
 Selection.Shrink
Else
 MsgBox "You need to select some text."
End If

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.ShrinkDiscontiguousSelection Method (Word)

 Copy code hover
[image]

Selection.ShrinkDiscontiguousSelection Method (Word)
See also Send feedback

Published: July 16, 2012

Cancels the selection of all but the most recently selected text when a selection contains multiple, unconnected selections.

Syntax

expression .ShrinkDiscontiguousSelection

expression Required. A variable that represents a Selection object.

Example

This example cancels the selection of all but the most recently selected text and formats with bold and small caps the text remaining in the selection. This example assumes there are multiple selections in the document.

VBA Copy code Copy code
Sub ShrinkMultipleSelection()
 With Selection
 .ShrinkDiscontiguousSelection
 .Font.Bold = True
 .Font.SmallCaps = True
 End With
End Sub

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.Sort Method (Word)

 Copy code hover
[image]

Selection.Sort Method (Word)
See also Send feedback

Published: July 16, 2012

Sorts the paragraphs in the specified selection.

Syntax

expression .Sort(ExcludeHeader, FieldNumber, SortFieldType, SortOrder, FieldNumber2, SortFieldType2, SortOrder2, FieldNumber3, SortFieldType3, SortOrder3, SortColumn, Separator, CaseSensitive, BidiSort, IgnoreThe, IgnoreKashida, IgnoreDiacritics, IgnoreHe, LanguageID, SubFieldNumber, SubFieldNumber2, SubFieldNumber3)

expression Required. A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
ExcludeHeader | Optional | Variant | True to exclude the first row or paragraph header from the sort operation. The default value is False.
FieldNumber | Optional | Variant | The first field by which to sort.
SortFieldType | Optional | Variant | The sort type for FieldNumber. Can be one of the WdSortFieldType constants. The default value is wdSortFieldAlphanumeric. Some of the WdSortFieldType constants may not be available to you, depending on the language support (U.S. English, for example) that you have selected or installed.
SortOrder | Optional | Variant | The sorting order to use when sorting FieldNumber. Can be one WdSortOrder constant.The default value is wdSortOrderAscending.
FieldNumber2 | Optional | Variant | The second field by which to sort.
SortFieldType2 | Optional | Variant | The sort type for FieldNumber2. Can be one of the WdSortFieldType constants. The default value is wdSortFieldAlphanumeric. Some of the WdSortFieldType constants may not be available to you, depending on the language support (U.S. English, for example) that you have selected or installed.
SortOrder | Optional | Variant | The sorting order to use when sorting FieldNumber2. Can be one WdSortOrder constant.The default value is wdSortOrderAscending.
SortColumn2 | Optional | Variant | True to sort only the column specified by the Selection object.
Separator | Optional | Variant | The type of field separator.
FieldNumber3 | Optional | Variant | The third field by which to sort.
SortFieldType3 | Optional | Variant | The sort type for FieldNumber3. Can be one of the WdSortFieldType constants. The default value is wdSortFieldAlphanumeric. Some of the WdSortFieldType constants may not be available to you, depending on the language support (U.S. English, for example) that you have selected or installed.
SortOrder3 | Optional | Variant | The sorting order to use when sorting FieldNumber3. Can be one WdSortOrder constant.The default value is wdSortOrderAscending.
CaseSensitive | Optional | Variant | True to sort with case sensitivity. The default value is False.
BidiSort | Optional | Variant | True to sort based on right-to-left language rules. This argument may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.
IgnoreThe | Optional | Variant | True to ignore the Arabic character alef lam when sorting right-to-left language text. This argument may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.
IgnoreKashida | Optional | Variant | True to ignore kashidas when sorting right-to-left language text. This argument may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.
IgnoreDiacritics | Optional | Variant | True to ignore bidirectional control characters when sorting right-to-left language text. This argument may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.
IgnoreHe | Optional | Variant | True to ignore the Hebrew character he when sorting right-to-left language text. This argument may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.
LanguageID | Optional | Variant | Specifies the sorting language. Can be one of the WdLanguageID constants.
SubFieldNumber | Optional | Variant | A secondary field number by which to sort.
SubFieldNumber2 | Optional | Variant | A secondary field number by which to sort.
SubFieldNumber3 | Optional | Variant | A secondary field number by which to sort.

Example

This example inserts three lines of text into a new document and then sorts the lines in ascending alphanumeric order

VBA Copy code Copy code
Sub NewParagraphSort()
 Dim newDoc As Document
 Set newDoc = Documents.Add
 newDoc.Content.InsertAfter "pear" & Chr(13) _
 & "zucchini" & Chr(13) & "apple" & Chr(13)
 newDoc.Content.Sort SortOrder:=wdSortOrderAscending
End Sub

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.SortAscending Method (Word)

 Copy code hover
[image]

Selection.SortAscending Method (Word)
See also Send feedback

Published: July 16, 2012

Sorts paragraphs or table rows in ascending alphanumeric order.

Syntax

expression .SortAscending

expression Required. A variable that represents a Selection object.

Remarks

This method offers a simplified form of sorting intended for mail merge data sources that contain columns of data. For most sorting tasks, use the Sort method.

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.SortByHeadings Method (Word)

 Copy code hover
[image]

Selection.SortByHeadings Method (Word)
See also Send feedback

Published: July 16, 2012

Sorts the headings in the specified selection.

Version information

Version Added: Word 2013

Syntax

expression .SortByHeadings(SortFieldType,SortOrder,CaseSensitive,BidiSort,IgnoreThe,IgnoreKashida,IgnoreDiacritics,IgnoreHe,LanguageID)

expression A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data type | Description
SortFieldType | Optional | VARIANT | The sort field type to use. Can be one of the WdSortFieldType constants. The default value is wdSortFieldAlphanumeric. Depending on the language support (U.S. English, for example) that you have selected or installed, some of these constants may not be available to you.
SortOrder | Optional | VARIANT | The sorting order to use. Can be one of the WdSortOrder constants.
CaseSensitive | Optional | VARIANT | True to sort with case sensitivity. The default value is False.
BidiSort | Optional | VARIANT | True to sort based on right-to-left language rules. Depending on the language support (U.S. English, for example) that you have selected or installed, this parameter may not be available to you.
IgnoreThe | Optional | VARIANT | True to ignore the Arabic character alef lam when sorting right-to-left language text. Depending on the language support (U.S. English, for example) that you have selected or installed, this parameter may not be available to you.
IgnoreKashida | Optional | VARIANT | True to ignore kashidas when sorting right-to-left language text. Depending on the language support (U.S. English, for example) that you have selected or installed, this parameter may not be available to you.
IgnoreDiacritics | Optional | VARIANT | True to ignore bidirectional control characters when sorting right-to-left language text. Depending on the language support (U.S. English, for example) that you have selected or installed, this parameter may not be available to you.
IgnoreHe | Optional | VARIANT | True to ignore the Hebrew character he when sorting right-to-left language text. Depending on the language support (U.S. English, for example) that you have selected or installed, this parameter may not be available to you.
LanguageID | Optional | VARIANT | Specifies the sorting language. Can be one of the WdLanguageID constants.

Return value

VOID

See also

Concepts

Selection Object

Other resources

Selection Members


Selection.SortDescending Method (Word)

 Copy code hover
[image]

Selection.SortDescending Method (Word)
See also Send feedback

Published: July 16, 2012

Sorts paragraphs or table rows within the selection in descending alphanumeric order.

Syntax

expression .SortDescending

expression Required. A variable that represents a Selection object.

Remarks

This method offers a simplified form of sorting intended for mail-merge data sources that contain columns of data. For most sorting tasks, use the Sort method.

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.SplitTable Method (Word)

 Copy code hover
[image]

Selection.SplitTable Method (Word)
See also Send feedback

Published: July 16, 2012

Inserts an empty paragraph above the first row in the selection. .

Syntax

expression .SplitTable

expression Required. A variable that represents a Selection object.

Remarks

If the selection isn't in the first row of the table, the table is split into two tables. If the selection isn't in a table, an error occurs.

Example

If the selection is in a table, this example splits the table.

VBA Copy code Copy code
If Selection.Information(wdWithInTable) = True Then
 Selection.SplitTable
End If

This example splits the first table in the active document between the first and second rows.

VBA Copy code Copy code
ActiveDocument.Tables(1).Rows(2).Select
Selection.SplitTable

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.StartOf Method (Word)

 Copy code hover
[image]

Selection.StartOf Method (Word)
See also Send feedback

Published: July 16, 2012

Moves or extends the start position of the specified range or selection to the beginning of the nearest specified text unit. This method returns a Long that indicates the number of characters by which the range or selection was moved or extended. The method returns a negative number if the movement is backward through the document.

Syntax

expression .StartOf(Unit, Extend)

expression Required. A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
Unit | Optional | WdUnits | The unit by which the start position of the specified range or selection is to be moved. If a value is omitted, the default value is wdWord.
Extend | Optional | WdMovement | If you use wdMove, both ends of the range or selection are moved to the beginning of the specified unit. If you use wdExtend, the beginning of the range or selection is extended to the beginning of the specified unit. The default value is wdMove.

Remarks

If the beginning of the specified range or selection is already at the beginning of the specified unit, this method doesn't move or extend the range or selection. For example, if the selection is at the beginning of a line, the following example returns 0 (zero) and doesn't change the selection.

VBA Copy code Copy code
char = Selection.StartOf(Unit:=wdLine, Extend:=wdMove)

Example

This example selects the text from the insertion point to the beginning of the line. The number of characters selected is stored in charmoved.

VBA Copy code Copy code
Selection.Collapse Direction:=wdCollapseStart charmoved = Selection.StartOf(Unit:=wdLine, Extend:=wdExtend)

This example moves the selection to the beginning of the paragraph.

VBA Copy code Copy code
Selection.StartOf Unit:=wdParagraph, Extend:=wdMove

This example moves myRange to the beginning of the second sentence in the document (myRange is collapsed and positioned at the beginning of the second sentence). The example uses the Select method to show the location of myRange.

VBA Copy code Copy code
Set myRange = ActiveDocument.Sentences(2)
myRange.StartOf Unit:=wdSentence, Extend:=wdMove
myRange.Select

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.ToggleCharacterCode Method (Word)

 Copy code hover
[image]

Selection.ToggleCharacterCode Method (Word)
See also Send feedback

Published: July 16, 2012

Switches a selection between a Unicode character and its corresponding hexadecimal value.

Syntax

expression .ToggleCharacterCode

expression Required. A variable that represents a Selection object.

Example

This example enters the hexadecimal value "20ac" at the cursor position and switches that value to its corresponding Unicode character.

VBA Copy code Copy code
Sub ToggleCharCase()
 Selection.TypeText Text:="20ac"
 Selection.ToggleCharacterCode
End Sub

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.TypeBackspace Method (Word)

 Copy code hover
[image]

Selection.TypeBackspace Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the character preceding a collapsed selection (an insertion point).

Syntax

expression .TypeBackspace

expression Required. A variable that represents a Selection object.

Remarks

This method corresponds to functionality of the BACKSPACE key. If the selection isn't collapsed to an insertion point, the selection is deleted.

Example

This example deletes the character preceding the insertion point (the collapsed selection).

VBA Copy code Copy code
With Selection
 .Collapse Direction:=wdCollapseEnd
 .TypeBackspace
End With

This example extends the selection to the end of the current paragraph (including the paragraph mark) and then deletes the selection.

VBA Copy code Copy code
With Selection
 .EndOf Unit:=wdParagraph, Extend:=wdExtend
 .TypeBackspace
End With

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.TypeParagraph Method (Word)

 Copy code hover
[image]

Selection.TypeParagraph Method (Word)
See also Send feedback

Published: July 16, 2012

Inserts a new, blank paragraph.

Syntax

expression .TypeParagraph

expression Required. A variable that represents a Selection object.

Remarks

This method corresponds to the functionality of the ENTER key. If the selection isn't collapsed to an insertion point, the new paragraph replaces the selection.

Use the InsertParagraphAfter or InsertParagraphBefore method to insert a new paragraph without deleting the contents of the selection.

Example

This example collapses the selection to its end and then inserts a new paragraph following it.

VBA Copy code Copy code
With Selection
 .Collapse Direction:=wdCollapseEnd
 .TypeParagraph
End With

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.TypeText Method (Word)

 Copy code hover
[image]

Selection.TypeText Method (Word)
See also Send feedback

Published: July 16, 2012

Inserts the specified text.

Syntax

expression .TypeText(Text)

expression Required. A variable that represents a Selection object.

Parameters

Name | Required/Optional | Data Type | Description
Text | Required | String | The text to be inserted.

Remarks

If the ReplaceSelection property is True, the selection is replaced by the specified text. If ReplaceSelection is False, the specified text is inserted before the selection.

Example

If Word is set so that typing replaces selected text, this example collapses the selection before inserting "Hello." This technique prevents existing document text from being replaced.

VBA Copy code Copy code
If Options.ReplaceSelection = True Then
 Selection.Collapse Direction:=wdCollapseStart
 Selection.TypeText Text:="Hello"
End If

This example inserts "Title" followed by a new paragraph.

VBA Copy code Copy code
Options.ReplaceSelection = False
With Selection
 .TypeText Text:="Title"
 .TypeParagraph
End With

See also

Concepts

Selection Object

Other resources

Selection Object Members


Selection.WholeStory Method (Word)

 Copy code hover
[image]

Selection.WholeStory Method (Word)
See also Send feedback

Published: July 16, 2012

Expands a selection to include the entire story.

Syntax

expression .WholeStory

expression Required. A variable that represents a Selection object.

Remarks

The following instructions, where objSel is a valid Selection object, are functionally equivalent:

VBA Copy code Copy code
objSel.WholeStory
objSel.Expand Unit:=wdStory

See also

Concepts

Selection Object

Other resources

Selection Object Members


Sentences Object (Word)

 Copy code hover
[image]

Sentences Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of Range objects that represent all the sentences in a selection, range, or document. There is no Sentence object.

Remarks

Use the Sentences property to return the Sentences collection. The following example displays the number of sentences selected.

VBA Copy code Copy code
MsgBox Selection.Sentences.Count & " sentences are selected"

Use Sentences(Index), where Index is the index number, to return a Range object that represents a sentence. The index number represents the position of a sentence in the Sentences collection. The following example formats the first sentence in the active document.

VBA Copy code Copy code
With ActiveDocument.Sentences(1)
 .Bold = True
 .Font.Size = 24
End With

The Count property for this collection in a document returns the number of items in the main story only. To count items in other stories use the collection with the Range object.

The Add method isn't available for the Sentences collection. Instead, use the InsertAfter or InsertBefore method to add a sentence to a Range object. The following example inserts a sentence after the first paragraph in the active document.

VBA Copy code Copy code
With ActiveDocument
 MsgBox .Sentences.Count & " sentences"
 .Paragraphs(1).Range.InsertParagraphAfter
 .Paragraphs(2).Range.InsertBefore "The house is blue."
 MsgBox .Sentences.Count & " sentences"
End With

See also

Concepts

Word Object Model Reference

Other resources

Sentences Object Members


Sentences Members (Word)

 Copy code hover
[image]

Sentences Members (Word)
Send feedback

Published: July 16, 2012

A collection of Range objects that represent all the sentences in a selection, range, or document. There is no Sentence object.

Methods

Name | Description
Item | Returns an individual Range object in a collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of sentences in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
First | Returns a Range object that represents the first sentence in a collection of sentences within a document, range, or selection.
Last | Returns a Range object that represents the last sentence in a document, selection, or range.
Parent | Returns an Object that represents the parent object of the specified Sentences object.


Sentences Properties (Word)

 Copy code hover
[image]

Sentences Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of sentences in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
First | Returns a Range object that represents the first sentence in a collection of sentences within a document, range, or selection.
Last | Returns a Range object that represents the last sentence in a document, selection, or range.
Parent | Returns an Object that represents the parent object of the specified Sentences object.


Sentences.Application Property (Word)

 Copy code hover
[image]

Sentences.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a Sentences collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

Sentences Collection Object

Other resources

Sentences Object Members


Sentences.Count Property (Word)

 Copy code hover
[image]

Sentences.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of sentences in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents a Sentences collection.

See also

Concepts

Sentences Collection Object

Other resources

Sentences Object Members


Sentences.Creator Property (Word)

 Copy code hover
[image]

Sentences.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a Sentences collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Sentences Collection Object

Other resources

Sentences Object Members


Sentences.First Property (Word)

 Copy code hover
[image]

Sentences.First Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the first sentence in a collection of sentences within a document, range, or selection.

Syntax

expression .First

expression Required. A variable that represents a Sentences collection.

See also

Concepts

Sentences Collection Object

Other resources

Sentences Object Members


Sentences.Last Property (Word)

 Copy code hover
[image]

Sentences.Last Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the last sentence in a document, selection, or range.

Syntax

expression .Last

expression Required. A variable that represents a Sentences collection.

See also

Concepts

Sentences Collection Object

Other resources

Sentences Object Members


Sentences.Parent Property (Word)

 Copy code hover
[image]

Sentences.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Sentences object.

Syntax

expression .Parent

expression Required. A variable that represents a Sentences collection.

See also

Concepts

Sentences Collection Object

Other resources

Sentences Object Members


Sentences Methods (Word)

 Copy code hover
[image]

Sentences Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Item | Returns an individual Range object in a collection.


Sentences.Item Method (Word)

 Copy code hover
[image]

Sentences.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual Range object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents a Sentences collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The individual object to be returned. Can be a Long indicating the ordinal position of the individual object.

Return Value

Range

See also

Concepts

Sentences Collection Object

Other resources

Sentences Object Members


Series Object (Word)

 Copy code hover
[image]

Series Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a series in a chart.

Version Information

Version Added: Word 2007

Remarks

The Series object is a member of the SeriesCollection collection.

Example

Use SeriesCollection(Index), where Index is the series index number or name, to return a single Series object. The following example sets the color of the interior for the first series of the first chart in the active document.

The series index number indicates the order in which the series were added to the chart. SeriesCollection(1) is the first series added to the chart, and SeriesCollection(SeriesCollection.Count) is the last one added.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.SeriesCollection(1).Interior.Color = RGB(255, 0, 0)
 End If
End With

See also

Concepts

Word Object Model Reference

Other resources

Series Object Members


Series Members (Word)

 Copy code hover
[image]

Series Members (Word)
Send feedback

Published: July 16, 2012

Represents a series in a chart.

Methods

Name | Description
ApplyDataLabels | Applies data labels to a series.
ClearFormats | Clears the formatting of the object.
Copy | If the series has a picture fill, copies the picture to the Clipboard.
DataLabels | Returns an object that represents either a single data label (a DataLabel object) or a collection of all the data labels for the series (a DataLabels collection).
Delete | Deletes the object.
ErrorBar | Applies error bars to the series.
Paste | Pastes a picture from the Clipboard as the marker on the selected series.
Points | Returns a collection of all the points in the series.
Select | Selects the object.
Trendlines | Returns a collection of all the trendlines for the series.

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
ApplyPictToEnd | True if a picture is applied to the end of the point or all points in the series. Read/write Boolean.
ApplyPictToFront | True if a picture is applied to the front of the point or all points in the series. Read/write Boolean.
ApplyPictToSides | True if a picture is applied to the sides of the point or all points in the series. Read/write Boolean.
AxisGroup | Returns the type of axis group. Read/write XlAxisGroup.
BarShape | Returns or sets the shape used for a single series in a 3-D bar or column chart. Read/write XlBarShape.
Border | Returns the border of the object. Read-only ChartBorder.
BubbleSizes | Returns or sets a string that refers to the worksheet cells that contain the x-value, y-value, and size data for the bubble chart. Read/write Variant.
ChartType | Returns or sets the chart type. Read/write XlChartType.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
ErrorBars | Returns the error bars for the series. Read-only ErrorBars.
Explosion | Returns or sets the explosion value for a pie-chart or doughnut-chart slice. Read/write Long.
Format | Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.
Formula | Returns or sets the object's formula in A1-style notation and in the language of the macro. Read/write String.
FormulaLocal | Returns or sets the formula for the object, using A1-style references in the language of the user. Read/write String.
FormulaR1C1 | Returns or sets the formula for the object, using R1C1-style notation in the language of the macro. Read/write String.
FormulaR1C1Local | Returns or sets the formula for the object, using R1C1-style notation in the language of the user. Read/write String.
Has3DEffect | True if the series has a three-dimensional appearance. Read/write Boolean.
HasDataLabels | True if the series has data labels. Read/write Boolean.
HasErrorBars | True if the series has error bars. Read/write Boolean.
HasLeaderLines | True if the series has leader lines. Read/write Boolean.
InvertColor | Returns or sets the fill color for negative data points in a series. Read/write.
InvertColorIndex | Returns or sets the fill color for negative data points in a series. Read/write.
InvertIfNegative | True if Microsoft Word inverts the pattern in the object when it corresponds to a negative number. Read/write Variant.
IsFiltered | Returns or sets a Boolean that determines whether the specified chart series is filtered out from the chart. Read-write.
LeaderLines | Returns the leader lines for the series. Read-only LeaderLines.
MarkerBackgroundColor | Sets the marker background color as an RGB value or returns the corresponding color index value. Read/write Long.
MarkerBackgroundColorIndex | Returns or sets the marker background color as an index into the current color palette, or as one of the following XlColorIndex constants: xlColorIndexAutomatic or xlColorIndexNone. Read/write Long.
MarkerForegroundColor | Sets the marker foreground color as an RGB value or returns the corresponding color index value. Read/write Long.
MarkerForegroundColorIndex | Returns or sets the marker foreground color as an index into the current color palette, or as one of the following XlColorIndex constants: xlColorIndexAutomatic or xlColorIndexNone. Read/write Long.
MarkerSize | Returns or sets the data-marker size, in points. Read/write Long.
MarkerStyle | Returns or sets the marker style for a point or series in a line chart, scatter chart, or radar chart. Read/write XlMarkerStyle.
Name | Returns or sets the name of the object. Read/write String.
Parent | Returns the parent for the specified object. Read-only Object.
PictureType | Returns or sets a value that specifies how pictures are displayed on a column or bar picture chart. Read/write XlChartPictureType.
PictureUnit2 | Returns or sets the unit for each picture on the chart if the PictureType property is set to xlStackScale; otherwise, this property is ignored. Read/write Double.
PlotColorIndex | Returns an index value that is used internally to associate series formatting with chart elements. Read-only.
PlotOrder | Returns or sets the plot order for the selected series within the chart group. Read/write Long.
Shadow | Returns or sets a value that indicates whether the object has a shadow. Read/write Boolean.
Smooth | True if curve smoothing is enabled for the line chart or scatter chart. Read/write Boolean.
Type | Returns or sets the series type. Read/write Long.
Values | Returns or sets a collection of all the values in the series. Read/write Variant.
XValues | Returns or sets an array of x values for a chart series. Read/write Variant.


Series Properties (Word)

 Copy code hover
[image]

Series Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
ApplyPictToEnd | True if a picture is applied to the end of the point or all points in the series. Read/write Boolean.
ApplyPictToFront | True if a picture is applied to the front of the point or all points in the series. Read/write Boolean.
ApplyPictToSides | True if a picture is applied to the sides of the point or all points in the series. Read/write Boolean.
AxisGroup | Returns the type of axis group. Read/write XlAxisGroup.
BarShape | Returns or sets the shape used for a single series in a 3-D bar or column chart. Read/write XlBarShape.
Border | Returns the border of the object. Read-only ChartBorder.
BubbleSizes | Returns or sets a string that refers to the worksheet cells that contain the x-value, y-value, and size data for the bubble chart. Read/write Variant.
ChartType | Returns or sets the chart type. Read/write XlChartType.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
ErrorBars | Returns the error bars for the series. Read-only ErrorBars.
Explosion | Returns or sets the explosion value for a pie-chart or doughnut-chart slice. Read/write Long.
Format | Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.
Formula | Returns or sets the object's formula in A1-style notation and in the language of the macro. Read/write String.
FormulaLocal | Returns or sets the formula for the object, using A1-style references in the language of the user. Read/write String.
FormulaR1C1 | Returns or sets the formula for the object, using R1C1-style notation in the language of the macro. Read/write String.
FormulaR1C1Local | Returns or sets the formula for the object, using R1C1-style notation in the language of the user. Read/write String.
Has3DEffect | True if the series has a three-dimensional appearance. Read/write Boolean.
HasDataLabels | True if the series has data labels. Read/write Boolean.
HasErrorBars | True if the series has error bars. Read/write Boolean.
HasLeaderLines | True if the series has leader lines. Read/write Boolean.
InvertColor | Returns or sets the fill color for negative data points in a series. Read/write.
InvertColorIndex | Returns or sets the fill color for negative data points in a series. Read/write.
InvertIfNegative | True if Microsoft Word inverts the pattern in the object when it corresponds to a negative number. Read/write Variant.
IsFiltered | Returns or sets a Boolean that determines whether the specified chart series is filtered out from the chart. Read-write.
LeaderLines | Returns the leader lines for the series. Read-only LeaderLines.
MarkerBackgroundColor | Sets the marker background color as an RGB value or returns the corresponding color index value. Read/write Long.
MarkerBackgroundColorIndex | Returns or sets the marker background color as an index into the current color palette, or as one of the following XlColorIndex constants: xlColorIndexAutomatic or xlColorIndexNone. Read/write Long.
MarkerForegroundColor | Sets the marker foreground color as an RGB value or returns the corresponding color index value. Read/write Long.
MarkerForegroundColorIndex | Returns or sets the marker foreground color as an index into the current color palette, or as one of the following XlColorIndex constants: xlColorIndexAutomatic or xlColorIndexNone. Read/write Long.
MarkerSize | Returns or sets the data-marker size, in points. Read/write Long.
MarkerStyle | Returns or sets the marker style for a point or series in a line chart, scatter chart, or radar chart. Read/write XlMarkerStyle.
Name | Returns or sets the name of the object. Read/write String.
Parent | Returns the parent for the specified object. Read-only Object.
PictureType | Returns or sets a value that specifies how pictures are displayed on a column or bar picture chart. Read/write XlChartPictureType.
PictureUnit2 | Returns or sets the unit for each picture on the chart if the PictureType property is set to xlStackScale; otherwise, this property is ignored. Read/write Double.
PlotColorIndex | Returns an index value that is used internally to associate series formatting with chart elements. Read-only.
PlotOrder | Returns or sets the plot order for the selected series within the chart group. Read/write Long.
Shadow | Returns or sets a value that indicates whether the object has a shadow. Read/write Boolean.
Smooth | True if curve smoothing is enabled for the line chart or scatter chart. Read/write Boolean.
Type | Returns or sets the series type. Read/write Long.
Values | Returns or sets a collection of all the values in the series. Read/write Variant.
XValues | Returns or sets an array of x values for a chart series. Read/write Variant.


Series.Application Property (Word)

 Copy code hover
[image]

Series.Application Property (Word)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Application

expression A variable that represents a Series object.

Example

The following example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveDocument
If myObject.Application.Value = "Microsoft Word" Then
 MsgBox "This is a Word Application object."
Else
 MsgBox "This is not a Word Application object."
End If

See also

Concepts

Series Object

Other resources

Series Object Members


Series.ApplyPictToEnd Property (Word)

 Copy code hover
[image]

Series.ApplyPictToEnd Property (Word)
See also Send feedback

Published: July 16, 2012

True if a picture is applied to the end of the point or all points in the series. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .ApplyPictToEnd

expression A variable that represents a Series object.

Example

The following example applies pictures to the end of all points in the first series of the first chart in the active document. The series must already have pictures applied to it (setting this property changes the picture orientation).

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.SeriesCollection(1).ApplyPictToEnd = True
 End If
End With

See also

Concepts

Series Object

Other resources

Series Object Members


Series.ApplyPictToFront Property (Word)

 Copy code hover
[image]

Series.ApplyPictToFront Property (Word)
See also Send feedback

Published: July 16, 2012

True if a picture is applied to the front of the point or all points in the series. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .ApplyPictToFront

expression A variable that represents a Series object.

Example

The following example applies pictures to the front of all points in the first series of the first chart in the active document. The series must already have pictures applied to it (setting this property changes the picture orientation).

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.SeriesCollection(1).ApplyPictToFront = True
 End If
End With

See also

Concepts

Series Object

Other resources

Series Object Members


Series.ApplyPictToSides Property (Word)

 Copy code hover
[image]

Series.ApplyPictToSides Property (Word)
See also Send feedback

Published: July 16, 2012

True if a picture is applied to the sides of the point or all points in the series. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .ApplyPictToSides

expression A variable that represents a Series object.

Example

The following example applies pictures to the sides of all points in the first series of the first chart in the active document. The series must already have pictures applied to it (setting this property changes the picture orientation).

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.SeriesCollection(1).ApplyPictToSides = True
 End If
End With

See also

Concepts

Series Object

Other resources

Series Object Members


Series.AxisGroup Property (Word)

 Copy code hover
[image]

Series.AxisGroup Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the type of axis group. Read/write XlAxisGroup.

Version Information

Version Added: Word 2007

Syntax

expression .AxisGroup

expression A variable that represents a Series object.

See also

Concepts

Series Object

Other resources

Series Object Members


Series.BarShape Property (Word)

 Copy code hover
[image]

Series.BarShape Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the shape used for a single series in a 3-D bar or column chart. Read/write XlBarShape.

Version Information

Version Added: Word 2007

Syntax

expression .BarShape

expression A variable that represents a Series object.

Example

The following example sets the shape used for the first series of the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.SeriesCollection(1).BarShape = xlConeToPoint
 End If
End With

See also

Concepts

Series Object

Other resources

Series Object Members


Series.Border Property (Word)

 Copy code hover
[image]

Series.Border Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the border of the object. Read-only ChartBorder.

Version Information

Version Added: Word 2007

Syntax

expression .Border

expression A variable that represents a Series object.

See also

Concepts

Series Object

Other resources

Series Object Members


Series.BubbleSizes Property (Word)

 Copy code hover
[image]

Series.BubbleSizes Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a string that refers to the worksheet cells that contain the x-value, y-value, and size data for the bubble chart. Read/write Variant.

Version Information

Version Added: Word 2007

Syntax

expression .BubbleSizes

expression A variable that represents a Series object.

Remarks

When you return the cell reference, it will return a string that describes the cells in A1-style notation. To set the size data for the bubble chart, you must use R1C1-style notation.

Note Note

This property applies only to bubble charts.

Example

The following example displays the cell reference for the cells that contain the bubble chart x-value, y-value, and size data for the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 MsgBox .Chart.SeriesCollection(1).BubbleSizes
 End If
End With

This example shows how to set this property using R1C1-style notation.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(3)
 If .HasChart Then
 .Chart.SeriesCollection(1). _
 BubbleSizes = "Sheet1!r2c3:r5c3"
 End If
End With

See also

Concepts

Series Object

Other resources

Series Object Members


Series.ChartType Property (Word)

 Copy code hover
[image]

Series.ChartType Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the chart type. Read/write XlChartType.

Version Information

Version Added: Word 2007

Syntax

expression .ChartType

expression A variable that represents a Series object.

Remarks

Some chart types are not available for PivotChart reports.

See also

Concepts

Series Object

Other resources

Series Object Members


Series.Creator Property (Word)

 Copy code hover
[image]

Series.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version Information

Version Added: Word 2007

Syntax

expression .Creator

expression A variable that represents a Series object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD". This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Word has the creator code MSWD. For more information about this property, consult the language reference Help included with Microsoft Office for Mac.

See also

Concepts

Series Object

Other resources

Series Object Members


Series.ErrorBars Property (Word)

 Copy code hover
[image]

Series.ErrorBars Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the error bars for the series. Read-only ErrorBars.

Version Information

Version Added: Word 2007

Syntax

expression .ErrorBars

expression A variable that represents a Series object.

Example

The following example sets the error bar color for series one of the first chart in the active document. You should run the example on a 2-D line chart that has error bars for series one.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.SeriesCollection(1)
 .ErrorBars.Border.ColorIndex = 8
 End With
 End If
End With

See also

Concepts

Series Object

Other resources

Series Object Members


Series.Explosion Property (Word)

 Copy code hover
[image]

Series.Explosion Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the explosion value for a pie-chart or doughnut-chart slice. Read/write Long.

Version Information

Version Added: Word 2007

Syntax

expression .Explosion

expression A variable that represents a Series object.

Remarks

This property returns 0 (zero) if there is no explosion (the tip of the slice is in the center of the pie).

See also

Concepts

Series Object

Other resources

Series Object Members


Series.Format Property (Word)

 Copy code hover
[image]

Series.Format Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.

Version Information

Version Added: Word 2007

Syntax

expression .Format

expression A variable that represents a Series object.

See also

Concepts

Series Object

Other resources

Series Object Members


Series.Formula Property (Word)

 Copy code hover
[image]

Series.Formula Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the object's formula in A1-style notation and in the language of the macro. Read/write String.

Version Information

Version Added: Word 2007

Syntax

expression .Formula

expression A variable that represents a Series object.

Remarks

This property is not available for OLAP data sources.

If the object contains a constant, this property returns the constant. If the object is empty, this property returns an empty string. If the object contains a formula, this property returns the formula as a string in the same format that would be displayed in the formula bar (including the equal sign).

If the range is a one- or two-dimensional range, you can set the formula to a Visual Basic array of the same dimensions. Similarly, you can put the formula into a Visual Basic array.

See also

Concepts

Series Object

Other resources

Series Object Members


Series.FormulaLocal Property (Word)

 Copy code hover
[image]

Series.FormulaLocal Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the formula for the object, using A1-style references in the language of the user. Read/write String.

Version Information

Version Added: Word 2007

Syntax

expression .FormulaLocal

expression A variable that represents a Series object.

Remarks

If the cell contains a constant, this property returns that constant. If the cell is empty, the property returns an empty string. If the cell contains a formula, the property returns the formula as a string, in the same format in which it would be displayed in the formula bar (including the equal sign).

If you set the value or formula of a cell to a date, Microsoft Word verifies whether that cell is already formatted with one of the date or time number formats. If not, the number format is changed to the default short date number format.

If the range is a one- or two-dimensional range, you can set the formula to a Visual Basic array of the same dimensions. Similarly, you can put the formula into a Visual Basic array.

Setting the formula of a multiple-cell range fills all cells in the range with the formula.

See also

Concepts

Series Object

Other resources

Series Object Members


Series.FormulaR1C1 Property (Word)

 Copy code hover
[image]

Series.FormulaR1C1 Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the formula for the object, using R1C1-style notation in the language of the macro. Read/write String.

Version Information

Version Added: Word 2007

Syntax

expression .FormulaR1C1

expression A variable that represents a Series object.

Remarks

If the cell contains a constant, this property returns the constant. If the cell is empty, the property returns an empty string. If the cell contains a formula, the property returns the formula as a string, in the same format in which it would be displayed in the formula bar (including the equal sign).

If you set the value or formula of a cell to a date, Microsoft Word verifies whether that cell is already formatted with one of the date or time number formats. If not, the number format is changed to the default short date number format.

If the range is a one- or two-dimensional range, you can set the formula to a Visual Basic array of the same dimensions. Similarly, you can put the formula into a Visual Basic array.

Setting the formula of a multiple-cell range fills all cells in the range with the formula.

See also

Concepts

Series Object

Other resources

Series Object Members


Series.FormulaR1C1Local Property (Word)

 Copy code hover
[image]

Series.FormulaR1C1Local Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the formula for the object, using R1C1-style notation in the language of the user. Read/write String.

Version Information

Version Added: Word 2007

Syntax

expression .FormulaR1C1Local

expression A variable that represents a Series object.

Remarks

If the cell contains a constant, this property returns that constant. If the cell is empty, the property returns an empty string. If the cell contains a formula, the property returns the formula as a string, in the same format in which it would be displayed in the formula bar (including the equal sign).

If you set the value or formula of a cell to a date, Microsoft Word verifies whether that cell is already formatted with one of the date or time number formats. If not, the number format is changed to the default short date number format.

If the range is a one- or two-dimensional range, you can set the formula to a Visual Basic array of the same dimensions. Similarly, you can put the formula into a Visual Basic array.

Setting the formula of a multiple-cell range fills all cells in the range with the formula.

See also

Concepts

Series Object

Other resources

Series Object Members


Series.Has3DEffect Property (Word)

 Copy code hover
[image]

Series.Has3DEffect Property (Word)
See also Send feedback

Published: July 16, 2012

True if the series has a three-dimensional appearance. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .Has3DEffect

expression A variable that represents a Series object.

Remarks

This property applies only to bubble charts.

See also

Concepts

Series Object

Other resources

Series Object Members


Series.HasDataLabels Property (Word)

 Copy code hover
[image]

Series.HasDataLabels Property (Word)
See also Send feedback

Published: July 16, 2012

True if the series has data labels. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .HasDataLabels

expression A variable that represents a Series object.

Example

The following example enables data labels for series three of the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.SeriesCollection(3)
 .HasDataLabels = True
 .ApplyDataLabels Type:=xlValue
 End With
 End If
End With

See also

Concepts

Series Object

Other resources

Series Object Members


Series.HasErrorBars Property (Word)

 Copy code hover
[image]

Series.HasErrorBars Property (Word)
See also Send feedback

Published: July 16, 2012

True if the series has error bars. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .HasErrorBars

expression A variable that represents a Series object.

Remarks

This property is not available for 3-D charts.

Example

The following example removes error bars from series one for the first chart in the active document. You should run the example on a 2-D line chart that has error bars for series one.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.SeriesCollection(1).HasErrorBars = False
 End If
End With

See also

Concepts

Series Object

Other resources

Series Object Members


Series.HasLeaderLines Property (Word)

 Copy code hover
[image]

Series.HasLeaderLines Property (Word)
See also Send feedback

Published: July 16, 2012

True if the series has leader lines. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .HasLeaderLines

expression A variable that represents a Series object.

Remarks

This property applies only to pie charts.

Example

The following example adds data labels and blue leader lines to series one on the pie chart. If no leader lines are visible, this example code will fail. In this situation, you can manually drag one of the data labels away from the pie chart to make a leader line show up.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.SeriesCollection(1)
 .HasDataLabels = True
 .DataLabels.Position = xlLabelPositionBestFit
 .HasLeaderLines = True
 .LeaderLines.Border.ColorIndex = 5
 End With
 End If
End With

See also

Concepts

Series Object

Other resources

Series Object Members


Series.InvertColor Property (Word)

 Copy code hover
[image]

Series.InvertColor Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the fill color for negative data points in a series. Read/write.

Version Information

Version Added: Word 2010

Syntax

expression .InvertColor

expression A variable that represents a Series object.

Return Value

Integer

Remarks

The InvertColor property enables you to set the fill color for negative data points as a specific numeric, hexadecimal, octal, or RGB color value. To set the value as an RBG value, use the Visual Basic RGB function. Instead of using the InvertColor property, you can use the InvertColorIndex property, which uses a simplier set of integer values from the current color palette. For the InvertColor property to have an effect, the InvertIfNegative property of the Series object must also be set to True.

See also

Concepts

Series Object

Other resources

Series Object Members


Series.InvertColorIndex Property (Word)

 Copy code hover
[image]

Series.InvertColorIndex Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the fill color for negative data points in a series. Read/write.

Version Information

Version Added: Word 2010

Syntax

expression .InvertColorIndex

expression A variable that represents a Series object.

Return Value

Integer

Remarks

The InvertColorIndex property enables you to set the fill color for negative data points as a color index value from 0 to 56. Instead of using the InvertColorIndex property, you can use the InvertColor property, which enables you to set the color as a specific numeric, hexadecimal, octal, or RGB color value.

See also

Concepts

Series Object

Other resources

Series Object Members


Series.InvertIfNegative Property (Word)

 Copy code hover
[image]

Series.InvertIfNegative Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word inverts the pattern in the object when it corresponds to a negative number. Read/write Variant.

Version Information

Version Added: Word 2007

Syntax

expression .InvertIfNegative

expression A variable that represents a Series object.

See also

Concepts

Series Object

Other resources

Series Object Members


Series.IsFiltered Property (Word)

 Copy code hover
[image]

Series.IsFiltered Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that determines whether the specified chart series is filtered out from the chart. Read-write.

Version information

Version Added: Word 2013

Syntax

expression .IsFiltered

expression A variable that represents a Series object.

Property value

BOOL

See also

Concepts

Series Object

Other resources

Series Members


Series.LeaderLines Property (Word)

 Copy code hover
[image]

Series.LeaderLines Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the leader lines for the series. Read-only LeaderLines.

Version Information

Version Added: Word 2007

Syntax

expression .LeaderLines

expression A variable that represents a Series object.

Remarks

This property applies only to pie charts.

Example

The following example adds data labels and blue leader lines to series one on the first pie chart in the active document. If no leader lines are visible, this example code will fail. In this situation, you can manually drag one of the data labels away from the pie chart to make a leader line show up.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.SeriesCollection(1)
 .HasDataLabels = True
 .DataLabels.Position = xlLabelPositionBestFit
 .HasLeaderLines = True
 .LeaderLines.Border.ColorIndex = 5
 End With
 End If
End With

See also

Concepts

Series Object

Other resources

Series Object Members


Series.MarkerBackgroundColor Property (Word)

 Copy code hover
[image]

Series.MarkerBackgroundColor Property (Word)
See also Send feedback

Published: July 16, 2012

Sets the marker background color as an RGB value or returns the corresponding color index value. Read/write Long.

Version Information

Version Added: Word 2007

Syntax

expression .MarkerBackgroundColor

expression A variable that represents a Series object.

Remarks

This property applies only to line, scatter, and radar charts.

See also

Concepts

Series Object

Other resources

Series Object Members


Series.MarkerBackgroundColorIndex Property (Word)

 Copy code hover
[image]

Series.MarkerBackgroundColorIndex Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the marker background color as an index into the current color palette, or as one of the following XlColorIndex constants: xlColorIndexAutomatic or xlColorIndexNone. Read/write Long.

Version Information

Version Added: Word 2007

Syntax

expression .MarkerBackgroundColorIndex

expression A variable that represents a Series object.

Remarks

This property applies only to line, scatter, and radar charts.

See also

Concepts

Series Object

Other resources

Series Object Members


Series.MarkerForegroundColor Property (Word)

 Copy code hover
[image]

Series.MarkerForegroundColor Property (Word)
See also Send feedback

Published: July 16, 2012

Sets the marker foreground color as an RGB value or returns the corresponding color index value. Read/write Long.

Version Information

Version Added: Word 2007

Syntax

expression .MarkerForegroundColor

expression A variable that represents a Series object.

Remarks

This property applies only to line, scatter, and radar charts.

See also

Concepts

Series Object

Other resources

Series Object Members


Series.MarkerForegroundColorIndex Property (Word)

 Copy code hover
[image]

Series.MarkerForegroundColorIndex Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the marker foreground color as an index into the current color palette, or as one of the following XlColorIndex constants: xlColorIndexAutomatic or xlColorIndexNone. Read/write Long.

Version Information

Version Added: Word 2007

Syntax

expression .MarkerForegroundColorIndex

expression A variable that represents a Series object.

Remarks

This property applies only to line, scatter, and radar charts.

See also

Concepts

Series Object

Other resources

Series Object Members


Series.MarkerSize Property (Word)

 Copy code hover
[image]

Series.MarkerSize Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the data-marker size, in points. Read/write Long.

Version Information

Version Added: Word 2007

Syntax

expression .MarkerSize

expression A variable that represents a Series object.

Remarks

This property can have a value from 2 through 72.

Example

The following example sets the data-marker size for all data markers on series one for the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.SeriesCollection(1).MarkerSize = 10
 End If
End With

See also

Concepts

Series Object

Other resources

Series Object Members


Series.MarkerStyle Property (Word)

 Copy code hover
[image]

Series.MarkerStyle Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the marker style for a point or series in a line chart, scatter chart, or radar chart. Read/write XlMarkerStyle.

Version Information

Version Added: Word 2007

Syntax

expression .MarkerStyle

expression A variable that represents a Series object.

Remarks

MarkerStyle can be one of the following XlMarkerStyle constants:

  • xlMarkerStyleAutomatic—Automatic markers.

  • xlMarkerStyleCircle—Circular markers.

  • xlMarkerStyleDash—Long bar markers.

  • xlMarkerStyleDiamond—Diamond-shaped markers.

  • xlMarkerStyleDot—Short bar markers.

  • xlMarkerStyleNone—No markers.

  • xlMarkerStylePicture—Picture markers.

  • xlMarkerStylePlus—Square markers with a plus sign.

  • xlMarkerStyleSquare—Square markers.

  • xlMarkerStyleStar—Square markers with an asterisk.

  • xlMarkerStyleTriangle—Triangular markers.

  • xlMarkerStyleX—Square markers with an X.

Example

The following example sets the marker style for series one for the first chart in the active document. You should run the example on a 2-D line chart.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.SeriesCollection(1).MarkerStyle = xlMarkerStyleCircle
 End If
End With

See also

Concepts

Series Object

Other resources

Series Object Members


Series.Name Property (Word)

 Copy code hover
[image]

Series.Name Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the name of the object. Read/write String.

Version Information

Version Added: Word 2007

Syntax

expression .Name

expression A variable that represents a Series object.

See also

Concepts

Series Object

Other resources

Series Object Members


Series.Parent Property (Word)

 Copy code hover
[image]

Series.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the parent for the specified object. Read-only Object.

Version Information

Version Added: Word 2007

Syntax

expression .Parent

expression A variable that represents a Series object.

See also

Concepts

Series Object

Other resources

Series Object Members


Series.PictureType Property (Word)

 Copy code hover
[image]

Series.PictureType Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a value that specifies how pictures are displayed on a column or bar picture chart. Read/write XlChartPictureType.

Version Information

Version Added: Word 2007

Syntax

expression .PictureType

expression A variable that represents a Series object.

Example

The following example sets series one of the first chart in the active document to stretch pictures. You should run the example on a 2-D column chart that has picture data markers.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.SeriesCollection(1).PictureType = xlStretch
 End If
End With

See also

Concepts

Series Object

Other resources

Series Object Members


Series.PictureUnit2 Property (Word)

 Copy code hover
[image]

Series.PictureUnit2 Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the unit for each picture on the chart if the PictureType property is set to xlStackScale; otherwise, this property is ignored. Read/write Double.

Version Information

Version Added: Word 2007

Syntax

expression .PictureUnit2

expression A variable that represents a Series object.

Example

The following example sets series one for the first chart in the active document to stack pictures and uses each picture to represent five units. You should run the example on a 2-D column chart that has picture data markers.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.SeriesCollection(1)
 .PictureType = xlScale
 .PictureUnit2 = 5
 End With
 End If
End With

See also

Concepts

Series Object

Other resources

Series Object Members


Series.PlotColorIndex Property (Word)

 Copy code hover
[image]

Series.PlotColorIndex Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an index value that is used internally to associate series formatting with chart elements. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .PlotColorIndex

expression A variable that represents a Series object.

Return Value

Integer

Remarks

This property is used internally by Excel and is not intended to be called from your code.

See also

Concepts

Series Object

Other resources

Series Object Members


Series.PlotOrder Property (Word)

 Copy code hover
[image]

Series.PlotOrder Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the plot order for the selected series within the chart group. Read/write Long.

Version Information

Version Added: Word 2007

Syntax

expression .PlotOrder

expression A variable that represents a Chart object.

Remarks

You can set plot order only within a chart group (you cannot set the plot order for the entire chart if you have more than one chart type). A chart group is a collection of series with the same chart type.

Changing the plot order of one series will cause the plot orders of the other series in the chart group to be adjusted, as necessary.

Example

The following example makes series two for the first chart in the active document appear third in the plot order. You should run the example on a 2-D column chart that contains three or more series.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.ChartGroups(1).SeriesCollection(2).PlotOrder = 3
 End If
End With

See also

Concepts

Series Object

Other resources

Series Object Members


Series.Shadow Property (Word)

 Copy code hover
[image]

Series.Shadow Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a value that indicates whether the object has a shadow. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .Shadow

expression A variable that represents a Series object.

See also

Concepts

Series Object

Other resources

Series Object Members


Series.Smooth Property (Word)

 Copy code hover
[image]

Series.Smooth Property (Word)
See also Send feedback

Published: July 16, 2012

True if curve smoothing is enabled for the line chart or scatter chart. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .Smooth

expression A variable that represents a Series object.

Remarks

This property applies only to line and scatter charts.

Example

The following example enables curve smoothing for series one for the first chart in the active document. You should run the example on a 2-D line chart.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.SeriesCollection(1).Smooth = True
 End If
End With

See also

Concepts

Series Object

Other resources

Series Object Members


Series.Type Property (Word)

 Copy code hover
[image]

Series.Type Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the series type. Read/write Long.

Version Information

Version Added: Word 2007

Syntax

expression .Type

expression A variable that represents a Series object.

Remarks

You can use the following XlConstants constants for this property:

  • xlColumn

  • xlBar

  • xl3DBar

  • xlLine

  • xlPie

  • xlXYScatter

  • xlArea

  • xl3DArea

  • xlDoughnut

  • xlRadar

  • xl3DSurface

  • xl3DColumn

  • xl3DBar

See also

Concepts

Series Object

Other resources

Series Object Members


Series.Values Property (Word)

 Copy code hover
[image]

Series.Values Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a collection of all the values in the series. Read/write Variant.

Version Information

Version Added: Word 2007

Syntax

expression .Values

expression A variable that represents a Series object.

Remarks

The value of this property can be either the address of a range on the chart's worksheet or an array of constant values, but not a combination of both. See the examples for details.

Example

The following example sets the series values from a range address.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.SeriesCollection(1).Values = "=Sheet1!B2:B5"
 End If
End With

To assign a constant value to each individual data point, you must use an array, as shown in the following example.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.SeriesCollection(1).Values = _
 Array(1, 3, 5, 7, 11, 13, 17, 19)
 End If
End With

See also

Concepts

Series Object

Other resources

Series Object Members


Series.XValues Property (Word)

 Copy code hover
[image]

Series.XValues Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets an array of x values for a chart series. Read/write Variant.

Version Information

Version Added: Word 2007

Syntax

expression .XValues

expression A variable that represents a Series object.

Remarks

You can set the XValues property to a range on a worksheet or to an array of values, but not to a combination of both.

For PivotChart reports, this property is read-only.

Example

The following example sets the values from a range address.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.SeriesCollection(1).XValues = "=Sheet1!B1:B5"
 End If
End With

To assign a constant value to each individual data point, you must use an array, as shown in the following example.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.SeriesCollection(1).XValues = _
 Array(5.0, 6.3, 12.6, 28, 50)
 End If
End With

See also

Concepts

Series Object

Other resources

Series Object Members


Series Methods (Word)

 Copy code hover
[image]

Series Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
ApplyDataLabels | Applies data labels to a series.
ClearFormats | Clears the formatting of the object.
Copy | If the series has a picture fill, copies the picture to the Clipboard.
DataLabels | Returns an object that represents either a single data label (a DataLabel object) or a collection of all the data labels for the series (a DataLabels collection).
Delete | Deletes the object.
ErrorBar | Applies error bars to the series.
Paste | Pastes a picture from the Clipboard as the marker on the selected series.
Points | Returns a collection of all the points in the series.
Select | Selects the object.
Trendlines | Returns a collection of all the trendlines for the series.


Series.ApplyDataLabels Method (Word)

 Copy code hover
[image]

Series.ApplyDataLabels Method (Word)
See also Send feedback

Published: July 16, 2012

Applies data labels to a series.

Version Information

Version Added: Word 2007

Syntax

expression .ApplyDataLabels(Type, LegendKey, AutoText, HasLeaderLines, ShowSeriesName, ShowCategoryName, ShowValue, ShowPercentage, ShowBubbleSize, Separator)

expression A variable that represents a Series object.

Parameters

Name | Required/Optional | Data Type | Description
Type | Optional | XlDataLabelsType | The type of data label to apply.
LegendKey | Optional | Variant | True to show the legend key next to the point. The default is False.
AutoText | Optional | Variant | True if the object automatically generates appropriate text based on content.
HasLeaderLines | Optional | Variant | For the Chart and Series objects, True if the series has leader lines.
ShowSeriesName | Optional | Variant | True to enable the series name for the data label; otherwise, False.
ShowCategoryName | Optional | Variant | True to enable the category name for the data label; otherwise, False.
ShowValue | Optional | Variant | True to enable the value for the data label; otherwise, False.
ShowPercentage | Optional | Variant | True to enable the percentage for the data label; otherwise, False.
ShowBubbleSize | Optional | Variant | True to enable the bubble size for the data label; otherwise, False.
Separator | Optional | Variant | The separator for the data label.

Remarks

The Type parameter can be one of the following XlDataLabelsType constants:

  • xlDataLabelsShowBubbleSizes—The bubble size for the data label.

  • xlDataLabelsShowLabelAndPercent—The percentage of the total, and the category for the point. Available only for pie charts and doughnut charts.

  • xlDataLabelsShowPercent—The percentage of the total. Available only for pie charts and doughnut charts.

  • xlDataLabelsShowLabel—The category for the point.

  • xlDataLabelsShowNone—No data labels.

  • xlDataLabelsShowValue—(Default) The value for the point (assumed if this argument is not specified).

Example

The following example applies category labels to series one of the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.SeriesCollection(1). _
 ApplyDataLabels Type:=xlDataLabelsShowLabel
 End If
End With

See also

Concepts

Series Object

Other resources

Series Object Members


Series.ClearFormats Method (Word)

 Copy code hover
[image]

Series.ClearFormats Method (Word)
See also Send feedback

Published: July 16, 2012

Clears the formatting of the object.

Version Information

Version Added: Word 2007

Syntax

expression .ClearFormats

expression A variable that represents a Series object.

See also

Concepts

Series Object

Other resources

Series Object Members


Series.Copy Method (Word)

 Copy code hover
[image]

Series.Copy Method (Word)
See also Send feedback

Published: July 16, 2012

If the series has a picture fill, copies the picture to the Clipboard.

Version Information

Version Added: Word 2007

Syntax

expression .Copy

expression A variable that represents a Series object.

See also

Concepts

Series Object

Other resources

Series Object Members


Series.DataLabels Method (Word)

 Copy code hover
[image]

Series.DataLabels Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an object that represents either a single data label (a DataLabel object) or a collection of all the data labels for the series (a DataLabels collection).

Version Information

Version Added: Word 2007

Syntax

expression .DataLabels(Index)

expression A variable that represents a Series object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Optional | Variant | The number of the data label.

Return Value

An object that represents either a single data label (a DataLabel object) or a collection of all the data labels for the series (a DataLabels collection).

Remarks

If the series has the Show Value option turned on for the data labels, the returned collection can contain up to one label for each point. Data labels can be turned on or off for individual points in the series.

If the series is on an area chart and has the Show Label option turned on for the data labels, the returned collection contains only a single label, which is the label for the area series.

Example

The following example sets the data labels for series one for the first chart in the active document to show their key, assuming that their values are visible when the example runs.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.SeriesCollection(1)
 .HasDataLabels = True
 With .DataLabels
 .ShowLegendKey = True
 .Type = xlValue
 End With
 End With
 End If
End With

See also

Concepts

Series Object

Other resources

Series Object Members


Series.Delete Method (Word)

 Copy code hover
[image]

Series.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Version Information

Version Added: Word 2007

Syntax

expression .Delete

expression A variable that represents a Series object.

See also

Concepts

Series Object

Other resources

Series Object Members


Series.ErrorBar Method (Word)

 Copy code hover
[image]

Series.ErrorBar Method (Word)
See also Send feedback

Published: July 16, 2012

Applies error bars to the series.

Version Information

Version Added: Word 2007

Syntax

expression .ErrorBar(Direction, Include, Type, Amount, MinusValues)

expression A variable that represents a Series object.

Parameters

Name | Required/Optional | Data Type | Description
Direction | Required | XlErrorBarDirection | One of the enumeration values that specifies the error bar direction.
Include | Required | XlErrorBarInclude | One of the enumeration values that specifies the error bar parts to include.
Type | Required | XlErrorBarType | One of the enumeration values that specifies the error bar type.
Amount | Optional | Variant | The error amount. Used for only the positive error amount when Type is xlErrorBarTypeCustom.
MinusValues | Optional | Variant | The negative error amount when Type is xlErrorBarTypeCustom.

Example

The following example applies standard error bars along the y-axis for series one of the first chart in the active document. The error bars are applied in the positive and negative directions. The example should be run on a 2-D line chart.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.SeriesCollection(1).ErrorBar _
 Direction:=xlY, Include:=xlErrorBarIncludeBoth, _
 Type:=xlErrorBarTypeStError
 End If
End With

See also

Concepts

Series Object

Other resources

Series Object Members


Series.Paste Method (Word)

 Copy code hover
[image]

Series.Paste Method (Word)
See also Send feedback

Published: July 16, 2012

Pastes a picture from the Clipboard as the marker on the selected series.

Version Information

Version Added: Word 2007

Syntax

expression .Paste

expression A variable that represents a Series object.

Remarks

You can use this method on column, bar, line, or radar charts, and it sets the MarkerStyle property to xlMarkerStylePicture.

Example

The following example pastes a picture from the Clipboard into series one for the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.SeriesCollection(1).Paste
 End If
End With

See also

Concepts

Series Object

Other resources

Series Object Members


Series.Points Method (Word)

 Copy code hover
[image]

Series.Points Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a collection of all the points in the series.

Version Information

Version Added: Word 2007

Syntax

expression .Points(Index)

expression A variable that represents a Series object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Optional | Variant | The name or number of the point.

Return Value

A Points object that represents all the points in the series.

Example

The following example applies a data label to point one in series one of the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.SeriesCollection(1).Points(1).ApplyDataLabels
 End If
End With

See also

Concepts

Series Object

Other resources

Series Object Members


Series.Select Method (Word)

 Copy code hover
[image]

Series.Select Method (Word)
See also Send feedback

Published: July 16, 2012

Selects the object.

Version Information

Version Added: Word 2007

Syntax

expression .Select

expression A variable that represents a Series object.

See also

Concepts

Series Object

Other resources

Series Object Members


Series.Trendlines Method (Word)

 Copy code hover
[image]

Series.Trendlines Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a collection of all the trendlines for the series.

Version Information

Version Added: Word 2007

Syntax

expression .Trendlines(Index)

expression A variable that represents a Series object.

Return Value

A Trendlines object that represents all the treadlines for the series.

Example

The following example adds a linear trendline to series one for the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.SeriesCollection(1).Trendlines.Add Type:=xlLinear
 End If
End With

See also

Concepts

Series Object

Other resources

Series Object Members


SeriesCollection Object (Word)

 Copy code hover
[image]

SeriesCollection Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a collection of all the Series objects in the specified chart or chart group.

Version Information

Version Added: Word 2007

Remarks

Use the SeriesCollection method to return the SeriesCollection collection.

Example

Use the Extend method to extend an existing series. The following example adds the data in cells C6:C10 in the chart's worksheet to an existing series in the series collection of the chart.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.SeriesCollection.Extend "='Sheet1'!$C$6:$C$10"
 End If
End With

Use the Add method to create a new series and add it to the chart. The following example adds the data from cells D1:D5 in the chart's worksheet as a new series to the chart.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.SeriesCollection.Add "='Sheet1'!$D$1:$D$5"
 End If
End With

Use SeriesCollection(Index), where Index is the series index number or name, to return a single Series object. The following example sets the color of the interior for the first series in embedded chart one on Sheet1.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.SeriesCollection(1).Interior.Color = RGB(255, 0, 0)
 End If
End With

See also

Concepts

Word Object Model Reference

Other resources

SeriesCollection Object Members


SeriesCollection Members (Word)

 Copy code hover
[image]

SeriesCollection Members (Word)
Send feedback

Published: July 16, 2012

Represents a collection of all the Series objects in the specified chart or chart group.

Methods

Name | Description
Add | Adds one or more new series to the collection.
Extend | Adds new data points to an existing series collection.
Item | Returns a single object from a collection.
NewSeries | Creates a new series.

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
Count | Returns the number of objects in the collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns the parent for the specified object. Read-only Object.


SeriesCollection Properties (Word)

 Copy code hover
[image]

SeriesCollection Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
Count | Returns the number of objects in the collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns the parent for the specified object. Read-only Object.


SeriesCollection.Application Property (Word)

 Copy code hover
[image]

SeriesCollection.Application Property (Word)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Application

expression A variable that represents a SeriesCollection object.

Example

The following example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveDocument
If myObject.Application.Value = "Microsoft Word" Then
 MsgBox "This is a Word Application object."
Else
 MsgBox "This is not a Word Application object."
End If

See also

Concepts

SeriesCollection Object

Other resources

SeriesCollection Object Members


SeriesCollection.Count Property (Word)

 Copy code hover
[image]

SeriesCollection.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the number of objects in the collection. Read-only Long.

Version Information

Version Added: Word 2007

Syntax

expression .Count

expression A variable that represents a SeriesCollection object.

See also

Concepts

SeriesCollection Object

Other resources

SeriesCollection Object Members


SeriesCollection.Creator Property (Word)

 Copy code hover
[image]

SeriesCollection.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version Information

Version Added: Word 2007

Syntax

expression .Creator

expression A variable that represents a SeriesCollection object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD". This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Word has the creator code MSWD. For more information about this property, consult the language reference Help included with Microsoft Office for Mac.

See also

Concepts

SeriesCollection Object

Other resources

SeriesCollection Object Members


SeriesCollection.Parent Property (Word)

 Copy code hover
[image]

SeriesCollection.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the parent for the specified object. Read-only Object.

Version Information

Version Added: Word 2007

Syntax

expression .Parent

expression A variable that represents a SeriesCollection object.

See also

Concepts

SeriesCollection Object

Other resources

SeriesCollection Object Members


SeriesCollection Methods (Word)

 Copy code hover
[image]

SeriesCollection Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Adds one or more new series to the collection.
Extend | Adds new data points to an existing series collection.
Item | Returns a single object from a collection.
NewSeries | Creates a new series.


SeriesCollection.Add Method (Word)

 Copy code hover
[image]

SeriesCollection.Add Method (Word)
See also Send feedback

Published: July 16, 2012

Adds one or more new series to the collection.

Version Information

Version Added: Word 2007

Syntax

expression .Add(Source, Rowcol, SeriesLabels, CategoryLabels, Replace)

expression A variable that represents a SeriesCollection object.

Parameters

Name | Required/Optional | Data Type | Description
Source | Required | Variant | The new data as a string representation of a range contained in the Workbook property of the ChartData object for the chart.
Rowcol | Optional | XlRowCol | One of the enumeration values that specifies whether the new values are in the rows or columns of the specified range.
SeriesLabels | Optional | Variant | True if the first row or column contains the name of the data series. False if the first row or column contains the first data point of the series. If this argument is omitted, Microsoft Word attempts to determine the location of the series name from the contents of the first row or column.
CategoryLabels | Optional | Variant | True if the first row or column contains the name of the category labels. False if the first row or column contains the first data point of the series. If this argument is omitted, Word attempts to determine the location of the category label from the contents of the first row or column.
Replace | Optional | Variant | If CategoryLabels is True and Replace is True, the specified categories replace the categories that currently exist for the series. If Replace is False, the existing categories will not be replaced. The default is False.

Return Value

A Series object that represents the new series.

Remarks

This method does not actually return a Series object as stated in the Object Browser.

Example

The following example creates a new series for the first chart in the active document. The data source for the new series is range B1:B10 on the workbook associated with the chart.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.SeriesCollection.Add _
 Source:="Sheet1!B1:B10"
 End If
End With

See also

Concepts

SeriesCollection Object

Other resources

SeriesCollection Object Members


SeriesCollection.Extend Method (Word)

 Copy code hover
[image]

SeriesCollection.Extend Method (Word)
See also Send feedback

Published: July 16, 2012

Adds new data points to an existing series collection.

Version Information

Version Added: Word 2007

Syntax

expression .Extend(Source, Rowcol, CategoryLabels)

expression A variable that represents a SeriesCollection object.

Parameters

Name | Required/Optional | Data Type | Description
Source | Required | Variant | The new data to be added to the SeriesCollection object, represented as an A1-style range reference.
Rowcol | Optional | Variant | One of the XlRowCol enumeration values that specifies whether the new values are in the rows or columns of the given range source. If this argument is omitted, Microsoft Word attempts to determine where the values are by the size and orientation of the selected range or by the dimensions of the array.
CategoryLabels | Optional | Variant | True to have the first row or column contain the name of the category labels. False to have the first row or column contain the first data point of the series. If this argument is omitted, Word attempts to determine the location of the category label from the contents of the first row or column.

Remarks

This method is not available for PivotChart reports.

Example

The following example extends the series on the first chart in the active document by adding the data in cells B1:B6 from the linked workbook.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.SeriesCollection.Extend _
 Source:="B1:B6"
 End If
End With

See also

Concepts

SeriesCollection Object

Other resources

SeriesCollection Object Members


SeriesCollection.Item Method (Word)

 Copy code hover
[image]

SeriesCollection.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a single object from a collection.

Version Information

Version Added: Word 2007

Syntax

expression .Item(Index)

expression A variable that represents a SeriesCollection object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The name or index number for the object.

Return Value

A Series object contained by the collection.

Example

The following example sets the number of units that the trendline on the first chart in the active document extends forward and backward. The example should be run on a 2-D column chart that contains a single series with a trendline.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.SeriesCollection.Item(1).Trendlines.Item(1)
 .Forward = 5
 .Backward = .5
 End With
 End If
End With

See also

Concepts

SeriesCollection Object

Other resources

SeriesCollection Object Members


SeriesCollection.NewSeries Method (Word)

 Copy code hover
[image]

SeriesCollection.NewSeries Method (Word)
See also Send feedback

Published: July 16, 2012

Creates a new series.

Version Information

Version Added: Word 2007

Syntax

expression .NewSeries

expression A variable that represents a SeriesCollection object.

Return Value

A Series object that represents the new series.

Remarks

This method is not available for PivotChart charts.

Example

The following example adds a new series to the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 Set ns = .Chart.SeriesCollection.NewSeries
 End If
End With

See also

Concepts

SeriesCollection Object

Other resources

SeriesCollection Object Members


SeriesLines Object (Word)

 Copy code hover
[image]

SeriesLines Object (Word)
See also Send feedback

Published: July 16, 2012

Represents series lines in a chart group.

Version Information

Version Added: Word 2007

Remarks

Series lines connect the data values from each series. Only 2-D stacked bar, 2-D stacked column, pie-of-pie, or bar-of-pie charts can have series lines. This object is not a collection. There is no object that represents a single series line; you either enable series lines for all points in a chart group or you disable them.

If the HasSeriesLines property is False, most properties of the SeriesLines object are disabled.

Example

Use the SeriesLines property to return a SeriesLines object. The following example adds series lines to chart group one in embedded chart one on worksheet one (the chart must be a 2-D stacked bar or column chart).

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.ChartGroups(1)
 .HasSeriesLines = True
 .SeriesLines.Border.Color = RGB(0, 0, 255)
 End With
 End If
End With

See also

Concepts

Word Object Model Reference

Other resources

SeriesLines Object Members


SeriesLines Members (Word)

 Copy code hover
[image]

SeriesLines Members (Word)
Send feedback

Published: July 16, 2012

Represents series lines in a chart group.

Methods

Name | Description
Delete | Deletes the object.
Select | Selects the object.

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
Border | Returns the border of the object. Read-only ChartBorder.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Format | Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.
Name | Returns the name of the object. Read-only String.
Parent | Returns the parent for the specified object. Read-only Object.


SeriesLines Properties (Word)

 Copy code hover
[image]

SeriesLines Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
Border | Returns the border of the object. Read-only ChartBorder.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Format | Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.
Name | Returns the name of the object. Read-only String.
Parent | Returns the parent for the specified object. Read-only Object.


SeriesLines.Application Property (Word)

 Copy code hover
[image]

SeriesLines.Application Property (Word)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Application

expression A variable that represents a SeriesLines object.

Example

The following example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveDocument
If myObject.Application.Value = "Microsoft Word" Then
 MsgBox "This is a Word Application object."
Else
 MsgBox "This is not a Word Application object."
End If

See also

Concepts

SeriesLines Object

Other resources

SeriesLines Object Members


SeriesLines.Border Property (Word)

 Copy code hover
[image]

SeriesLines.Border Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the border of the object. Read-only ChartBorder.

Version Information

Version Added: Word 2007

Syntax

expression .Border

expression A variable that represents a SeriesLines object.

See also

Concepts

SeriesLines Object

Other resources

SeriesLines Object Members


SeriesLines.Creator Property (Word)

 Copy code hover
[image]

SeriesLines.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version Information

Version Added: Word 2007

Syntax

expression .Creator

expression A variable that represents a SeriesLines object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD". This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Word has the creator code MSWD. For more information about this property, consult the language reference Help included with Microsoft Office for Mac.

See also

Concepts

SeriesLines Object

Other resources

SeriesLines Object Members


SeriesLines.Format Property (Word)

 Copy code hover
[image]

SeriesLines.Format Property (Word)
See also Send feedback

Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.

Version Information

Version Added: Word 2007

Syntax

expression .Format

expression A variable that represents a SeriesLines object.

See also

Concepts

SeriesLines Object

Other resources

SeriesLines Object Members


SeriesLines.Name Property (Word)

 Copy code hover
[image]

SeriesLines.Name Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the name of the object. Read-only String.

Version Information

Version Added: Word 2007

Syntax

expression .Name

expression A variable that represents a SeriesLines object.

See also

Concepts

SeriesLines Object

Other resources

SeriesLines Object Members


SeriesLines.Parent Property (Word)

 Copy code hover
[image]

SeriesLines.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the parent for the specified object. Read-only Object.

Version Information

Version Added: Word 2007

Syntax

expression .Parent

expression A variable that represents a SeriesLines object.

See also

Concepts

SeriesLines Object

Other resources

SeriesLines Object Members


SeriesLines Methods (Word)

 Copy code hover
[image]

SeriesLines Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the object.
Select | Selects the object.


SeriesLines.Delete Method (Word)

 Copy code hover
[image]

SeriesLines.Delete Method (Word)
See also Send feedback

Deletes the object.

Version Information

Version Added: Word 2007

Syntax

expression .Delete

expression A variable that represents a SeriesLines object.

See also

Concepts

SeriesLines Object

Other resources

SeriesLines Object Members


SeriesLines.Select Method (Word)

 Copy code hover
[image]

SeriesLines.Select Method (Word)
See also Send feedback

Published: July 16, 2012

Selects the object.

Version Information

Version Added: Word 2007

Syntax

expression .Select

expression A variable that represents a SeriesLines object.

See also

Concepts

SeriesLines Object

Other resources

SeriesLines Object Members


Shading Object (Word)

 Copy code hover
[image]

Shading Object (Word)
See also Send feedback

Published: July 16, 2012

Contains shading attributes for an object.

Remarks

Use the Shading property to return the Shading object. The following example applies fine gray shading to the first paragraph in the active document.

VBA Copy code Copy code
ActiveDocument.Paragraphs(1).Shading.Texture = wdTexture10Percent

The following example applies shading with different foreground and background colors to the selection.

VBA Copy code Copy code
With Selection.Shading
 .Texture = wdTexture20Percent
 .ForegroundPatternColorIndex = wdBlue
 .BackgroundPatternColorIndex = wdYellow
End With

The following example applies a vertical line texture to the first row in the first table in the active document.

VBA Copy code Copy code
ActiveDocument.Tables(1).Rows(1).Shading.Texture = _
 wdTextureVertical

See also

Concepts

Word Object Model Reference

Other resources

Shading Object Members


Shading Members (Word)

 Copy code hover
[image]

Shading Members (Word)
Send feedback

Published: July 16, 2012

Contains shading attributes for an object.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
BackgroundPatternColor | Returns or sets the 24-bit color that's applied to the background of the Shading object. Read/write.
BackgroundPatternColorIndex | Returns or sets the color that's applied to the background of the Shading object. Read/write WdColorIndex.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
ForegroundPatternColor | Returns or sets the 24-bit color that's applied to the foreground of the Shading object. This color is applied to the dots and lines in the shading pattern. Read/write.
ForegroundPatternColorIndex | Returns or sets the color that's applied to the foreground of the Shading object. This color is applied to the dots and lines in the shading pattern. Read/write WdColorIndex.
Parent | Returns an Object that represents the parent object of the specified Shading object.
Texture | Returns or sets the shading texture for the specified object. Read/write WdTextureIndex.


Shading Properties (Word)

 Copy code hover
[image]

Shading Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
BackgroundPatternColor | Returns or sets the 24-bit color that's applied to the background of the Shading object. Read/write.
BackgroundPatternColorIndex | Returns or sets the color that's applied to the background of the Shading object. Read/write WdColorIndex.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
ForegroundPatternColor | Returns or sets the 24-bit color that's applied to the foreground of the Shading object. This color is applied to the dots and lines in the shading pattern. Read/write.
ForegroundPatternColorIndex | Returns or sets the color that's applied to the foreground of the Shading object. This color is applied to the dots and lines in the shading pattern. Read/write WdColorIndex.
Parent | Returns an Object that represents the parent object of the specified Shading object.
Texture | Returns or sets the shading texture for the specified object. Read/write WdTextureIndex.


Shading.Application Property (Word)

 Copy code hover
[image]

Shading.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a Shading object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

Shading Object

Other resources

Shading Object Members


Shading.BackgroundPatternColor Property (Word)

 Copy code hover
[image]

Shading.BackgroundPatternColor Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the 24-bit color that's applied to the background of the Shading object. Read/write.

Syntax

expression .BackgroundPatternColor

expression Required. A variable that represents a Shading object.

Remarks

This property can be any valid WdColor constant or a value returned by Visual Basic's RGB function.

Example

This example applies turquoise background shading to the first paragraph in the active document.

VBA Copy code Copy code
Set myRange = ActiveDocument.Paragraphs(1).Range
myRange.Shading.BackgroundPatternColor = _
 wdColorTurquoise

This example adds a table at the insertion point and then applies light gray background shading to the first cell.

VBA Copy code Copy code
Selection.Collapse Direction:=wdCollapseStart
Set myTable = _
 ActiveDocument.Tables.Add(Range:=Selection.Range, _
 NumRows:=2, NumColumns:=2)
myTable.Cell(1, 1).Shading.BackgroundPatternColor = _
 wdColorGray25

See also

Concepts

Shading Object

Other resources

Shading Object Members


Shading.BackgroundPatternColorIndex Property (Word)

 Copy code hover
[image]

Shading.BackgroundPatternColorIndex Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the color that's applied to the background of the Shading object. Read/write WdColorIndex.

Syntax

expression .BackgroundPatternColorIndex

expression Required. A variable that represents a Shading object.

Example

This example applies cyan background shading to the first paragraph in the active document.

VBA Copy code Copy code
Dim rngTemp As Range

Set rngTemp = ActiveDocument.Paragraphs(1).Range
rngTemp.Shading.BackgroundPatternColorIndex = wdTurquoise

This example adds a table at the insertion point and then applies light gray background shading to the first cell.

VBA Copy code Copy code
Dim tableNew As Table

Selection.Collapse Direction:=wdCollapseStart
Set tableNew = ActiveDocument.Tables.Add(Range:=Selection.Range, _
 NumRows:=2, NumColumns:=2)
tableNew.Cell(1, 1).Shading.BackgroundPatternColorIndex = _
 wdGray25

See also

Concepts

Shading Object

Other resources

Shading Object Members


Shading.Creator Property (Word)

 Copy code hover
[image]

Shading.Creator Property (Word)
See also Send feedback

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a Shading object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Shading Object

Other resources

Shading Object Members


Shading.ForegroundPatternColor Property (Word)

 Copy code hover
[image]

Shading.ForegroundPatternColor Property (Word)
See also Send feedback

Returns or sets the 24-bit color that's applied to the foreground of the Shading object. This color is applied to the dots and lines in the shading pattern. Read/write.

Syntax

expression .ForegroundPatternColor

expression Required. A variable that represents a Shading object.

Remarks

This property can be any valid WdColor constant or a value returned by Visual Basic's RGB function.

Example

This example applies shading with teal dots on a dark red background to the selection.

VBA Copy code Copy code
With Selection.Shading
 .Texture = wdTexture30Percent
 .ForegroundPatternColor = wdColorTeal
 .BackgroundPatternColor = wdColorDarkRed
End With

See also

Concepts

Shading Object

Other resources

Shading Object Members


Shading.ForegroundPatternColorIndex Property (Word)

 Copy code hover
[image]

Shading.ForegroundPatternColorIndex Property (Word)
See also Send feedback

Returns or sets the color that's applied to the foreground of the Shading object. This color is applied to the dots and lines in the shading pattern. Read/write WdColorIndex.

Syntax

expression .ForegroundPatternColorIndex

expression Required. A variable that represents a Shading object.

Example

This example applies shading with different foreground and background colors to the selection.

VBA Copy code Copy code
With Selection.Shading
 .Texture = wdTexture30Percent
 .ForegroundPatternColorIndex = wdBlue
 .BackgroundPatternColorIndex = wdYellow
End With

See also

Concepts

Shading Object

Other resources

Shading Object Members


Shading.Parent Property (Word)

 Copy code hover
[image]

Shading.Parent Property (Word)
See also Send feedback

Returns an Object that represents the parent object of the specified Shading object.

Syntax

expression .Parent

expression Required. A variable that represents a Shading object.

See also

Concepts

Shading Object

Other resources

Shading Object Members


Shading.Texture Property (Word)

 Copy code hover
[image]

Shading.Texture Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the shading texture for the specified object. Read/write WdTextureIndex.

Syntax

expression .Texture

expression Required. A variable that represents a Shading object.

Example

This example sets a range that references the first paragraph in the active document and then applies a grid texture to that range.

VBA Copy code Copy code
Set myRange = ActiveDocument.Paragraphs(1).Range
myRange.Shading.Texture = wdTextureCross

This example adds a table at the insertion point and then applies a vertical line texture to the first row in the table.

VBA Copy code Copy code
Selection.Collapse Direction:=wdCollapseStart
Set myTable = ActiveDocument.Tables.Add(Range:=Selection.Range, _
 NumRows:=2, NumColumns:=2)
myTable.Rows(1).Shading.Texture = wdTextureVertical

This example applies 10 percent shading to the first word in the active document.

VBA Copy code Copy code
ActiveDocument.Words(1).Shading.Texture = wdTexture10Percent

See also

Concepts

Shading Object

Other resources

Shading Object Members


ShadowFormat Object (Word)

 Copy code hover
[image]

ShadowFormat Object (Word)
See also Send feedback

Published: July 16, 2012

Represents shadow formatting for a shape.

Remarks

Use the Shadow property to return a ShadowFormat object. The following example adds a shadowed rectangle to the active document. The semitransparent, blue shadow is offset 5 points to the right of the rectangle and 3 points above it.

VBA Copy code Copy code
With ActiveDocument.Shapes _
 .AddShape(msoShapeRectangle, 50, 50, 100, 200).Shadow
 .ForeColor.RGB = RGB(0, 0, 128)
 .OffsetX = 5
 .OffsetY = -3
 .Transparency = 0.5
 .Visible = True
End With

See also

Concepts

Word Object Model Reference

Other resources

ShadowFormat Object Members


ShadowFormat Members (Word)

 Copy code hover
[image]

ShadowFormat Members (Word)
Send feedback

Published: July 16, 2012

Represents shadow formatting for a shape.

Methods

Name | Description
IncrementOffsetX | Changes the horizontal offset of the shadow by the specified number of points.
IncrementOffsetY | Changes the vertical offset of the shadow by the specified number of points.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Blur | Returns or sets a Single that represents the blur level for a shadow format. Read/write.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
ForeColor | Returns or sets a ColorFormat object that represents the foreground color for the fill, line, or shadow. Read/write.
Obscured | MsoTrue if the shadow of the specified shape appears filled in and is obscured by the shape, even if the shape has no fill. MsoFalse if the shadow has no fill and the outline of the shadow is visible through the shape if the shape has no fill. Read/write MsoTriState.
OffsetX | Returns or sets the horizontal offset (in points) of the shadow from the specified shape. A positive value offsets the shadow to the right of the shape; a negative value offsets it to the left. Read/write Single.
OffsetY | Returns or sets the vertical offset (in points) of the shadow from the specified shape. Read/write Single.
Parent | Returns an Object that represents the parent object of the specified ShadowFormat object.
RotateWithShape | Returns or sets an MsoTriState that represents whether to rotate the shadow when rotating the shape. Read/write.
Size | Returns or sets a Single that represents the width of the shadow. Read/write.
Style | Returns or sets a MsoShadowType that represents the type of shadow formatting to apply to a shape. Read/write.
Transparency | Returns or sets the degree of transparency of the specified shadow as a value between 0.0 (opaque) and 1.0 (clear). Read/write Single.
Type | Returns or sets the shape shadow type. Read/write MsoShadowType.
Visible | True if the specified object, or the formatting applied to it, is visible. Read/write MsoTriState.


ShadowFormat Properties (Word)

 Copy code hover
[image]

ShadowFormat Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Blur | Returns or sets a Single that represents the blur level for a shadow format. Read/write.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
ForeColor | Returns or sets a ColorFormat object that represents the foreground color for the fill, line, or shadow. Read/write.
Obscured | MsoTrue if the shadow of the specified shape appears filled in and is obscured by the shape, even if the shape has no fill. MsoFalse if the shadow has no fill and the outline of the shadow is visible through the shape if the shape has no fill. Read/write MsoTriState.
OffsetX | Returns or sets the horizontal offset (in points) of the shadow from the specified shape. A positive value offsets the shadow to the right of the shape; a negative value offsets it to the left. Read/write Single.
OffsetY | Returns or sets the vertical offset (in points) of the shadow from the specified shape. Read/write Single.
Parent | Returns an Object that represents the parent object of the specified ShadowFormat object.
RotateWithShape | Returns or sets an MsoTriState that represents whether to rotate the shadow when rotating the shape. Read/write.
Size | Returns or sets a Single that represents the width of the shadow. Read/write.
Style | Returns or sets a MsoShadowType that represents the type of shadow formatting to apply to a shape. Read/write.
Transparency | Returns or sets the degree of transparency of the specified shadow as a value between 0.0 (opaque) and 1.0 (clear). Read/write Single.
Type | Returns or sets the shape shadow type. Read/write MsoShadowType.
Visible | True if the specified object, or the formatting applied to it, is visible. Read/write MsoTriState.


ShadowFormat.Application Property (Word)

 Copy code hover
[image]

ShadowFormat.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a ShadowFormat object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

ShadowFormat Object

Other resources

ShadowFormat Object Members


ShadowFormat.Blur Property (Word)

 Copy code hover
[image]

ShadowFormat.Blur Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Single that represents the blur level for a shadow format. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .Blur

expression An expression that returns a ShadowFormat object.

See also

Concepts

ShadowFormat Object

Other resources

ShadowFormat Object Members


ShadowFormat.Creator Property (Word)

 Copy code hover
[image]

ShadowFormat.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a ShadowFormat object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

ShadowFormat Object

Other resources

ShadowFormat Object Members


ShadowFormat.ForeColor Property (Word)

 Copy code hover
[image]

ShadowFormat.ForeColor Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a ColorFormat object that represents the foreground color for the fill, line, or shadow. Read/write.

Syntax

expression .ForeColor

expression A variable that represents a ShadowFormat object.

See also

Concepts

ShadowFormat Object

Other resources

ShadowFormat Object Members


ShadowFormat.Obscured Property (Word)

 Copy code hover
[image]

ShadowFormat.Obscured Property (Word)
See also Send feedback

Published: July 16, 2012

MsoTrue if the shadow of the specified shape appears filled in and is obscured by the shape, even if the shape has no fill. MsoFalse if the shadow has no fill and the outline of the shadow is visible through the shape if the shape has no fill. Read/write MsoTriState.

Syntax

expression .Obscured

expression Required. A variable that represents a ShadowFormat object.

Example

This example sets the horizontal and vertical offsets for the shadow of shape three on myDocument. The shadow is offset 5 points to the right of the shape and 3 points above it. If the shape doesn't already have a shadow, this example adds one to it. The shadow will be filled in and obscured by the shape, even if the shape has no fill.

VBA Copy code Copy code
Set myDocument = ActiveDocument
With myDocument.Shapes(3).Shadow
 .Visible = True
 .OffsetX = 5
 .OffsetY = -3
 .Obscured = msoTrue
End With

See also

Concepts

ShadowFormat Object

Other resources

ShadowFormat Object Members


ShadowFormat.OffsetX Property (Word)

 Copy code hover
[image]

ShadowFormat.OffsetX Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the horizontal offset (in points) of the shadow from the specified shape. A positive value offsets the shadow to the right of the shape; a negative value offsets it to the left. Read/write Single.

Syntax

expression .OffsetX

expression An expression that returns a ShadowFormat object.

Remarks

If you want to nudge a shadow horizontally or vertically from its current position without having to specify an absolute position, use the IncrementOffsetX or IncrementOffsetY method.

Example

This example sets the horizontal and vertical offsets for the shadow of shape three on myDocument. The shadow is offset 5 points to the right of the shape and 3 points above it. If the shape doesn't already have a shadow, this example adds one to it.

VBA Copy code Copy code
Set myDocument = ActiveDocument
With myDocument.Shapes(3).Shadow
 .Visible = True
 .OffsetX = 5
 .OffsetY = -3
End With

See also

Concepts

ShadowFormat Object

Other resources

ShadowFormat Object Members


ShadowFormat.OffsetY Property (Word)

 Copy code hover
[image]

ShadowFormat.OffsetY Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the vertical offset (in points) of the shadow from the specified shape. Read/write Single.

Syntax

expression .OffsetY

expression An expression that returns a ShadowFormat object.

Remarks

A positive value offsets the shadow below the shape; a negative value offsets it above the shape. If you want to nudge a shadow horizontally or vertically from its current position without having to specify an absolute position, use the IncrementOffsetX or IncrementOffsetY method.

Example

This example sets the horizontal and vertical offsets for the shadow of shape three in myDocument. The shadow is offset 5 points to the right of the shape and 3 points above it. If the shape doesn't already have a shadow, this example adds one to it.

VBA Copy code Copy code
Set myDocument = ActiveDocument
With myDocument.Shapes(3).Shadow
 .Visible = True
 .OffsetX = 5
 .OffsetY = -3
End With

See also

Concepts

ShadowFormat Object

Other resources

ShadowFormat Object Members


ShadowFormat.Parent Property (Word)

 Copy code hover
[image]

ShadowFormat.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified ShadowFormat object.

Syntax

expression .Parent

expression Required. A variable that represents a ShadowFormat object.

See also

Concepts

ShadowFormat Object

Other resources

ShadowFormat Object Members


ShadowFormat.RotateWithShape Property (Word)

 Copy code hover
[image]

ShadowFormat.RotateWithShape Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets an MsoTriState that represents whether to rotate the shadow when rotating the shape. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .RotateWithShape

expression An expression that returns a ShadowFormat object.

See also

Concepts

ShadowFormat Object

Other resources

ShadowFormat Object Members


ShadowFormat.Size Property (Word)

 Copy code hover
[image]

ShadowFormat.Size Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Single that represents the width of the shadow. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .Size

expression An expression that returns a ShadowFormat object.

See also

Concepts

ShadowFormat Object

Other resources

ShadowFormat Object Members


ShadowFormat.Style Property (Word)

 Copy code hover
[image]

ShadowFormat.Style Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a MsoShadowType that represents the type of shadow formatting to apply to a shape. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .Style

expression An expression that returns a ShadowFormat object.

See also

Concepts

ShadowFormat Object

Other resources

ShadowFormat Object Members


ShadowFormat.Transparency Property (Word)

 Copy code hover
[image]

ShadowFormat.Transparency Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the degree of transparency of the specified shadow as a value between 0.0 (opaque) and 1.0 (clear). Read/write Single.

Syntax

expression .Transparency

expression Required. A variable that represents a ShadowFormat object.

Example

This example sets the shadow of shape three in the active document to semitransparent red. If the shape doesn't already have a shadow, this example adds one to it.

VBA Copy code Copy code
With ActiveDocument.Shapes(3).Shadow
 .Visible = True
 .ForeColor.RGB = RGB(255, 0, 0)
 .Transparency = 0.5
End With

See also

Concepts

ShadowFormat Object

Other resources

ShadowFormat Object Members


ShadowFormat.Type Property (Word)

 Copy code hover
[image]

ShadowFormat.Type Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the shape shadow type. Read/write MsoShadowType.

Syntax

expression .Type

expression Required. A variable that represents a ShadowFormat object.

See also

Concepts

ShadowFormat Object

Other resources

ShadowFormat Object Members


ShadowFormat.Visible Property (Word)

 Copy code hover
[image]

ShadowFormat.Visible Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified object, or the formatting applied to it, is visible. Read/write MsoTriState.

Syntax

expression .Visible

expression Required. A variable that represents a ShadowFormat object.

Remarks

Some methods and properties may be unavailable if the Visible property is False.

See also

Concepts

ShadowFormat Object

Other resources

ShadowFormat Object Members


ShadowFormat Methods (Word)

 Copy code hover
[image]

ShadowFormat Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
IncrementOffsetX | Changes the horizontal offset of the shadow by the specified number of points.
IncrementOffsetY | Changes the vertical offset of the shadow by the specified number of points.


ShadowFormat.IncrementOffsetX Method (Word)

 Copy code hover
[image]

ShadowFormat.IncrementOffsetX Method (Word)
See also Send feedback

Published: July 16, 2012

Changes the horizontal offset of the shadow by the specified number of points.

Syntax

expression .IncrementOffsetX(Increment)

expression Required. A variable that represents a ShadowFormat object.

Parameters

Name | Required/Optional | Data Type | Description
Increment | Required | Single | Specifies how far the shadow offset is to be moved horizontally, in points. A positive value moves the shadow to the right; a negative value moves it to the left.

Remarks

Use the OffsetX property to set the absolute horizontal shadow offset.

Example

This example moves the shadow on the third shape in the active document to the left by 3 points.

VBA Copy code Copy code
ActiveDocument.Shapes(3).Shadow.IncrementOffsetX -3

See also

Concepts

ShadowFormat Object

Other resources

ShadowFormat Object Members


ShadowFormat.IncrementOffsetY Method (Word)

 Copy code hover
[image]

ShadowFormat.IncrementOffsetY Method (Word)
See also Send feedback

Published: July 16, 2012

Changes the vertical offset of the shadow by the specified number of points.

Syntax

expression .IncrementOffsetY(Increment)

expression Required. A variable that represents a ShadowFormat object.

Parameters

Name | Required/Optional | Data Type | Description
Increment | Required | Single | Specifies how far the shadow offset is to be moved vertically, in points. A positive value moves the shadow down; a negative value moves it up.

Remarks

Use the OffsetY property to set the absolute vertical shadow offset.

Example

This example moves the shadow on the third shape in the active document up by 3 points.

VBA Copy code Copy code
ActiveDocument.Shapes(3).Shadow.IncrementOffsetY -3

See also

Concepts

ShadowFormat Object

Other resources

ShadowFormat Object Members


Shape Object (Word)

 Copy code hover
[image]

Shape Object (Word)
See also Send feedback

Published: July 16, 2012

Represents an object in the drawing layer, such as an AutoShape, freeform, OLE object, ActiveX control, or picture. The Shape object is a member of the Shapes collection, which includes all the shapes in the main story of a document or in all the headers and footers of a document.

Remarks

A shape is always attached to an anchoring range. You can position the shape anywhere on the page that contains the anchor.There are three objects that represent shapes: the Shapes collection, which represents all the shapes on a document; the ShapeRange object, which represents a specified subset of the shapes on a document (for example, a ShapeRange object could represent shapes one and four on the document, or it could represent all the selected shapes on the document); the Shape object, which represents a single shape on a document. If you want to work with several shape at the same time or with shapes within the selection, use a ShapeRange collection.

Use Shapes(Index), where Index is the name or the index number, to return a single Shape object. The following example horizontally flips shape one on the active document.

VBA Copy code Copy code
ActiveDocument.Shapes(1).Flip msoFlipHorizontal

The following example horizontally flips the shape named "Rectangle 1" on the active document.

VBA Copy code Copy code
ActiveDocument.Shapes("Rectangle 1").Flip msoFlipHorizontal

Each shape is assigned a default name when it is created. For example, if you add three different shapes to a document, they might be named "Rectangle 2," "TextBox 3," and "Oval 4." To give a shape a more meaningful name, set the Name property.

Use ShapeRange(Index), where Index is the name or the index number, to return a Shape object that represents a shape within a selection. The following example sets the fill for the first shape in the selection, assuming that the selection contains at least one shape.

VBA Copy code Copy code
Selection.ShapeRange(1).Fill.ForeColor.RGB = RGB(255, 0, 0)

The following example sets the fill for all the shapes in the selection, assuming that the selection contains at least one shape.

VBA Copy code Copy code
Selection.ShapeRange.Fill.ForeColor.RGB = RGB(255, 0, 0)

To add a Shape object to the collection of shapes for the specified document and return a Shape object that represents the newly created shape, use one of the following methods of the Shapes collection: AddCallout, AddCurve, AddLabel, AddLine, AddOleControl, AddOleObject, AddPolyline, AddShape, AddTextbox, AddTextEffect, or BuildFreeForm. The following example adds a rectangle to the active document.

VBA Copy code Copy code
ActiveDocument.Shapes.AddShape msoShapeRectangle, 50, 50, 100, 200

Use GroupItems(Index), where Index is the shape name or the index number within the group, to return a Shape object that represents a single shape in a grouped shape.

Use the Group or Regroup method to group a range of shapes and return a single Shape object that represents the newly formed group. After a group has been formed, you can work with the group the same way you work with any other shape.

Every Shape object is anchored to a range of text. A shape is anchored to the beginning of the first paragraph that contains the anchoring range. The shape will always remain on the same page as its anchor.

You can view the anchor itself by setting the ShowObjectAnchors property to True. The shape's Top and Left properties determine its vertical and horizontal positions. The shape's RelativeHorizontalPosition and RelativeVerticalPosition properties determine whether the position is measured from the anchoring paragraph, the column that contains the anchoring paragraph, the margin, or the edge of the page.

If the LockAnchor property for the shape is set to True, you cannot drag the anchor from its position on the page.

Use the Fill property to return the FillFormat object, which contains all the properties and methods for formatting the fill of a closed shape. The Shadow property returns the ShadowFormat object, which you use to format a shadow. Use the Line property to return the LineFormat object, which contains properties and methods for formatting lines and arrows. The TextEffect property returns the TextEffectFormat object, which you use to format WordArt. The Callout property returns the CalloutFormat object, which you use to format line callouts. The WrapFormat property returns the WrapFormat object, which you use to define how text wraps around shapes. The ThreeD property returns the ThreeDFormat object, which you use to create 3-D shapes. You can use the PickUp and Apply methods to transfer formatting from one shape to another.

Use the SetShapesDefaultProperties method for a Shape object to set the formatting for the default shape for the document. New shapes inherit many of their attributes from the default shape.

Use the Type property to specify the type of shape: freeform, AutoShape, OLE object, callout, or linked picture, for instance. Use the AutoShapeType property to specify the type of AutoShape: oval, rectangle, or balloon, for instance.

Use the Width and Height properties to specify the size of the shape.

The TextFrame property returns the TextFrame object, which contains all the properties and methods for attaching text to shapes and linking the text between text frames.

Shape objects are anchored to a range of text but are free-floating and can be positioned anywhere on the page. InlineShape objects are treated like characters and are positioned as characters within a line of text. You can use the ConvertToInlineShape method and the ConvertToShape method to convert shapes from one type to the other. You can convert only pictures, OLE objects, and ActiveX controls to inline shapes.

See also

Concepts

Word Object Model Reference

Other resources

Shape Object Members


Shape Members (Word)

 Copy code hover
[image]

Shape Members (Word)
Send feedback

Published: July 16, 2012

Represents an object in the drawing layer, such as an AutoShape, freeform, OLE object, ActiveX control, or picture. The Shape object is a member of the Shapes collection, which includes all the shapes in the main story of a document or in all the headers and footers of a document.

Methods

Name | Description
Apply | Applies to the specified shape formatting that has been copied using the PickUp method.
CanvasCropBottom | Crops a percentage of the height of a drawing canvas from the bottom of the canvas.
CanvasCropLeft | Crops a percentage of the width of a drawing canvas from the left side of the canvas.
CanvasCropRight | Crops a percentage of the width of a drawing canvas from the right side of the canvas.
CanvasCropTop | Crops a percentage of the height of a drawing canvas from the top of the canvas.
ConvertToInlineShape | Converts the specified shape in the drawing layer of a document to an inline shape in the text layer. You can convert only shapes that represent pictures, OLE objects, or ActiveX controls. This method returns an InlineShape object that represents the picture or OLE object.
Delete | Deletes the specified shape node.
Duplicate | Creates a duplicate of the specified Shape object, adds the new shape to the Shapes collection at a standard offset from the original shapes, and then returns the new Shape object.
Flip | Flips a shape horizontally or vertically.
IncrementLeft | Moves the specified shape horizontally by the specified number of points.
IncrementRotation | Changes the rotation of the specified shape around the z-axis by the specified number of degrees.
IncrementTop | Moves the specified shape vertically by the specified number of points.
PickUp | Copies the formatting of the specified shape.
ScaleHeight | Scales the height of the shape by a specified factor.
ScaleWidth | Scales the width of the shape by a specified factor.
Select | Selects the specified shape.
SetShapesDefaultProperties | Applies the formatting of the default shape for a document to the specified shape.
Ungroup | Ungroups any grouped shapes in the specified shape.
ZOrder | Moves the specified shape in front of or behind other shapes in the collection (that is, changes the shape's position in the z-order).

Properties

Name | Description
Adjustments | Returns an Adjustments object that contains adjustment values for all the adjustments in the specified Shape object that represents an AutoShape or WordArt. Read-only.
AlternativeText | Returns or sets the alternative text associated with a shape in a Web page. Read/write String.
Anchor | Returns a Range object that represents the anchoring range for the specified shape or shape range. Read-only.
Application | Returns an Application object that represents the Microsoft Word application.
AutoShapeType | Returns or sets the shape type for the specified Shape object, which must represent an AutoShape other than a line or freeform drawing. Read/write MsoAutoShapeType.
BackgroundStyle | Sets or returns the background style of the specified shape. Read/write MsoBackgroundStyleIndex.
Callout | Returns a CalloutFormat object that contains callout formatting properties for the specified shape. Read-only.
CanvasItems | Returns a CanvasShapes object that represents a collection of shapes in a drawing canvas.
Chart | Returns a Chart object that represents a chart within the collection of shapes in a document. Read-only.
Child | True if the shape is a child shape or if all shapes in a shape range are child shapes of the same parent. Read-only MsoTriState.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Fill | Returns a FillFormat object that contains fill formatting properties for the specified shape. Read-only.
Glow | Returns a GlowFormat object that represents the glow formatting for a shape. Read-only.
GroupItems | Returns a GroupShapes object that represents the individual shapes in the specified group. Read-only.
HasChart | True if the specified shape has a chart. Read-only.
HasSmartArt | Returns True if there is a SmartArt diagram present on the shape. Read-only.
Height | Returns or sets the height of the specified shape. Read/write Single.
HeightRelative | Returns or sets a Single that represents the percentage of the relative height of a shape. Read/write.
HorizontalFlip | Indicates that a shape has been flipped horizontally. Read-only MsoTriState.
Hyperlink | Returns a Hyperlink object that represents the hyperlink associated with a Shape object. Read-only.
ID | Returns the identification type for the specified shape. Read-only Long.
LayoutInCell | Returns a Long that represents whether a shape in a table is displayed inside or outside the table.
Left | Returns or sets a Single that represents the horizontal position, measured in points, of the specified shape or shape range. Can also be any valid WdShapePosition constant. Read/write.
LeftRelative | Returns or sets a Single that represents the relative left position of a shape. Read/write.
Line | Returns a LineFormat object that contains line formatting properties for the specified shape. Read-only.
LinkFormat | Returns a LinkFormat object that represents the link options of a shape that is linked to a file. Read/only.
LockAnchor | True if the anchor of a Shape object is locked to the anchoring range. Read/write Long.
LockAspectRatio | MsoTrue if the specified shape retains its original proportions when you resize it. MsoFalse if you can change the height and width of the shape independently of one another when you resize it. Read/write MsoTriState.
Name | Returns or sets the name of the specified object. Read/write String.
Nodes | Returns a ShapeNodes collection that represents the geometric description of the specified shape.
OLEFormat | Returns an OLEFormat object that represents the OLE characteristics (other than linking) for the specified shape, inline shape, or field. Read-only.
Parent | Returns an Object that represents the parent object of the specified Shape object.
ParentGroup | Returns a Shape object that represents the common parent shape of a child shape or a range of child shapes.
PictureFormat | Returns a PictureFormat object that contains picture formatting properties for the specified object. Read-only.
Reflection | Returns a ReflectionFormat object that represents the reflection formatting for a shape. Read-only.
RelativeHorizontalPosition | Specifies to the relative horizontal position of a shape. Read/write WdRelativeHorizontalPosition.
RelativeHorizontalSize | Returns or sets a WdRelativeVerticalSize constant that represents the object to which a range of shapes is relative. Read/write.
RelativeVerticalPosition | Specifies the relative vertical position of a shape. Read/write WdRelativeVerticalPosition.
RelativeVerticalSize | Returns or sets a WdRelativeVerticalSize constant that represents the relative vertical size of a shape. Read/write.
Rotation | Returns or sets the number of degrees the specified shape is rotated around the z-axis. A positive value indicates clockwise rotation; a negative value indicates counterclockwise rotation. Read/write Single.
Script | Returns a Script object, which represents a block of script or code for an image on a Web page.
Shadow | Returns a ShadowFormat object that represents the shadow formatting for the specified shape.
ShapeStyle | Returns or sets the shape style for the specified shape. Read/write MsoShapeStyleIndex.
SmartArt | Returns a SmartArt object that provides a way to work with the SmartArt associated with the specified shape. Read-only.
SoftEdge | Returns a SoftEdgeFormat object that represents the soft edge formatting for a shape. Read-only.
TextEffect | Returns a TextEffectFormat object that contains text-effect formatting properties for the specified shape. Read-only.
TextFrame | Returns a TextFrame object that contains the text for the specified shape.
TextFrame2 | Returns a TextFrame2 object that contains the text for the specified shape. Read-only.
ThreeD | Returns a ThreeDFormat object that contains 3-D formatting properties for the specified shape. Read-only.
Title | Returns or sets a String that contains a title for the specified shape. Read/write.
Top | Returns or sets the vertical position of the specified shape or shape range in points. Read/write Single.
TopRelative | Returns or sets a Single that represents the relative top position of a shape. Read/write.
Type | Returns the type of inline shape. Read-only MsoShapeType.
VerticalFlip | True if the specified shape is flipped around the vertical axis. Read-only MsoTriState.
Vertices | Returns the coordinates of the specified freeform drawing's vertices (and control points for Bézier curves) as a series of coordinate pairs. Read-only Variant.
Visible | True if the specified object, or the formatting applied to it, is visible. Read/write MsoTriState.
Width | Returns or sets the width, in points, of the specified shape. Read/write Long.
WidthRelative | Returns or sets a Single that represents the relative width of a shape. Read/write.
WrapFormat | Returns a WrapFormat object that contains the properties for wrapping text around the specified shape. Read-only.
ZOrderPosition | Returns a Long that represents the position of the specified shape in the z-order. Read-only.


Shape Properties (Word)

 Copy code hover
[image]

Shape Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Adjustments | Returns an Adjustments object that contains adjustment values for all the adjustments in the specified Shape object that represents an AutoShape or WordArt. Read-only.
AlternativeText | Returns or sets the alternative text associated with a shape in a Web page. Read/write String.
Anchor | Returns a Range object that represents the anchoring range for the specified shape or shape range. Read-only.
Application | Returns an Application object that represents the Microsoft Word application.
AutoShapeType | Returns or sets the shape type for the specified Shape object, which must represent an AutoShape other than a line or freeform drawing. Read/write MsoAutoShapeType.
BackgroundStyle | Sets or returns the background style of the specified shape. Read/write MsoBackgroundStyleIndex.
Callout | Returns a CalloutFormat object that contains callout formatting properties for the specified shape. Read-only.
CanvasItems | Returns a CanvasShapes object that represents a collection of shapes in a drawing canvas.
Chart | Returns a Chart object that represents a chart within the collection of shapes in a document. Read-only.
Child | True if the shape is a child shape or if all shapes in a shape range are child shapes of the same parent. Read-only MsoTriState.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Fill | Returns a FillFormat object that contains fill formatting properties for the specified shape. Read-only.
Glow | Returns a GlowFormat object that represents the glow formatting for a shape. Read-only.
GroupItems | Returns a GroupShapes object that represents the individual shapes in the specified group. Read-only.
HasChart | True if the specified shape has a chart. Read-only.
HasSmartArt | Returns True if there is a SmartArt diagram present on the shape. Read-only.
Height | Returns or sets the height of the specified shape. Read/write Single.
HeightRelative | Returns or sets a Single that represents the percentage of the relative height of a shape. Read/write.
HorizontalFlip | Indicates that a shape has been flipped horizontally. Read-only MsoTriState.
Hyperlink | Returns a Hyperlink object that represents the hyperlink associated with a Shape object. Read-only.
ID | Returns the identification type for the specified shape. Read-only Long.
LayoutInCell | Returns a Long that represents whether a shape in a table is displayed inside or outside the table.
Left | Returns or sets a Single that represents the horizontal position, measured in points, of the specified shape or shape range. Can also be any valid WdShapePosition constant. Read/write.
LeftRelative | Returns or sets a Single that represents the relative left position of a shape. Read/write.
Line | Returns a LineFormat object that contains line formatting properties for the specified shape. Read-only.
LinkFormat | Returns a LinkFormat object that represents the link options of a shape that is linked to a file. Read/only.
LockAnchor | True if the anchor of a Shape object is locked to the anchoring range. Read/write Long.
LockAspectRatio | MsoTrue if the specified shape retains its original proportions when you resize it. MsoFalse if you can change the height and width of the shape independently of one another when you resize it. Read/write MsoTriState.
Name | Returns or sets the name of the specified object. Read/write String.
Nodes | Returns a ShapeNodes collection that represents the geometric description of the specified shape.
OLEFormat | Returns an OLEFormat object that represents the OLE characteristics (other than linking) for the specified shape, inline shape, or field. Read-only.
Parent | Returns an Object that represents the parent object of the specified Shape object.
ParentGroup | Returns a Shape object that represents the common parent shape of a child shape or a range of child shapes.
PictureFormat | Returns a PictureFormat object that contains picture formatting properties for the specified object. Read-only.
Reflection | Returns a ReflectionFormat object that represents the reflection formatting for a shape. Read-only.
RelativeHorizontalPosition | Specifies to the relative horizontal position of a shape. Read/write WdRelativeHorizontalPosition.
RelativeHorizontalSize | Returns or sets a WdRelativeVerticalSize constant that represents the object to which a range of shapes is relative. Read/write.
RelativeVerticalPosition | Specifies the relative vertical position of a shape. Read/write WdRelativeVerticalPosition.
RelativeVerticalSize | Returns or sets a WdRelativeVerticalSize constant that represents the relative vertical size of a shape. Read/write.
Rotation | Returns or sets the number of degrees the specified shape is rotated around the z-axis. A positive value indicates clockwise rotation; a negative value indicates counterclockwise rotation. Read/write Single.
Script | Returns a Script object, which represents a block of script or code for an image on a Web page.
Shadow | Returns a ShadowFormat object that represents the shadow formatting for the specified shape.
ShapeStyle | Returns or sets the shape style for the specified shape. Read/write MsoShapeStyleIndex.
SmartArt | Returns a SmartArt object that provides a way to work with the SmartArt associated with the specified shape. Read-only.
SoftEdge | Returns a SoftEdgeFormat object that represents the soft edge formatting for a shape. Read-only.
TextEffect | Returns a TextEffectFormat object that contains text-effect formatting properties for the specified shape. Read-only.
TextFrame | Returns a TextFrame object that contains the text for the specified shape.
TextFrame2 | Returns a TextFrame2 object that contains the text for the specified shape. Read-only.
ThreeD | Returns a ThreeDFormat object that contains 3-D formatting properties for the specified shape. Read-only.
Title | Returns or sets a String that contains a title for the specified shape. Read/write.
Top | Returns or sets the vertical position of the specified shape or shape range in points. Read/write Single.
TopRelative | Returns or sets a Single that represents the relative top position of a shape. Read/write.
Type | Returns the type of inline shape. Read-only MsoShapeType.
VerticalFlip | True if the specified shape is flipped around the vertical axis. Read-only MsoTriState.
Vertices | Returns the coordinates of the specified freeform drawing's vertices (and control points for Bézier curves) as a series of coordinate pairs. Read-only Variant.
Visible | True if the specified object, or the formatting applied to it, is visible. Read/write MsoTriState.
Width | Returns or sets the width, in points, of the specified shape. Read/write Long.
WidthRelative | Returns or sets a Single that represents the relative width of a shape. Read/write.
WrapFormat | Returns a WrapFormat object that contains the properties for wrapping text around the specified shape. Read-only.
ZOrderPosition | Returns a Long that represents the position of the specified shape in the z-order. Read-only.


Shape.Adjustments Property (Word)

 Copy code hover
[image]

Shape.Adjustments Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Adjustments object that contains adjustment values for all the adjustments in the specified Shape object that represents an AutoShape or WordArt. Read-only.

Syntax

expression .Adjustments

expression A variable that represents a Shape object.

Example

This example sets to 0.25 the value of adjustment one on shape three on myDocument.

VBA Copy code Copy code
Set myDocument = ActiveDocument
myDocument.Shapes(3).Adjustments(1) = 0.25

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.AlternativeText Property (Word)

 Copy code hover
[image]

Shape.AlternativeText Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the alternative text associated with a shape in a Web page. Read/write String.

Syntax

expression .AlternativeText

expression A variable that represents a Shape object.

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.Anchor Property (Word)

 Copy code hover
[image]

Shape.Anchor Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the anchoring range for the specified shape or shape range. Read-only.

Syntax

expression .Anchor

expression A variable that represents a Shape object.

Remarks

All Shape objects are anchored to a range of text but can be positioned anywhere on the page that contains the anchor. If you specify the anchoring range when you create a shape, the anchor is positioned at the beginning of the first paragraph that contains the anchoring range. If you don't specify the anchoring range, the anchoring range is selected automatically and the shape is positioned relative to the top and left edges of the page.

The shape will always remain on the same page as its anchor. If the LockAnchor property for the shape is set to True, you cannot drag the anchor from its position on the page.

Example

This example selects the paragraph that the first shape in the active document is anchored to.

VBA Copy code Copy code
ActiveDocument.Shapes(1).Anchor.Paragraphs(1).Range.Select

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.Application Property (Word)

 Copy code hover
[image]

Shape.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a Shape object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.AutoShapeType Property (Word)

 Copy code hover
[image]

Shape.AutoShapeType Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the shape type for the specified Shape object, which must represent an AutoShape other than a line or freeform drawing. Read/write MsoAutoShapeType.

Syntax

expression .AutoShapeType

expression Required. A variable that represents a Shape object.

Remarks

When you change the type of a shape, the shape retains its size, color, and other attributes.

Example

This example replaces all 16-point stars with 32-point stars in the active document.

VBA Copy code Copy code
Sub ReplaceAutoShape()
 Dim docNew As Document
 Dim shpStar As Shape
 Set docNew = ActiveDocument
 For Each shpStar In docNew.Shapes
 If shpStar.AutoShapeType = msoShape16pointStar Then
 shpStar.AutoShapeType = msoShape32pointStar
 End If
 Next
End Sub

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.BackgroundStyle Property (Word)

 Copy code hover
[image]

Shape.BackgroundStyle Property (Word)
See also Send feedback

Published: July 16, 2012

Sets or returns the background style of the specified shape. Read/write MsoBackgroundStyleIndex.

Version Information

Version Added: Word 2010

Syntax

expression .BackgroundStyle

expression A variable that represents a Shape object.

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.Callout Property (Word)

 Copy code hover
[image]

Shape.Callout Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a CalloutFormat object that contains callout formatting properties for the specified shape. Read-only.

Syntax

expression .Callout

expression A variable that represents a Shape object.

Remarks

This property applies to Shape objects that represent callouts.

Example

This example adds to myDocument an oval and a callout that points to the oval. The callout text won't have a border, but it will have a vertical accent bar that separates the text from the callout line.

VBA Copy code Copy code
Set myDocument = ActiveDocument
With myDocument.Shapes
 .AddShape msoShapeOval, 180, 200, 280, 130
 With .AddCallout(msoCalloutTwo, 420, 170, 170, 40)
 .TextFrame.TextRange.Text = "My oval"
 With .Callout
 .Accent = True
 .Border = False
 End With
 End With
End With

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.CanvasItems Property (Word)

 Copy code hover
[image]

Shape.CanvasItems Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a CanvasShapes object that represents a collection of shapes in a drawing canvas.

Syntax

expression .CanvasItems

expression Required. A variable that represents a Shape object.

Example

This example creates a new drawing canvas in the active document and adds a circle to the canvas.

VBA Copy code Copy code
Sub NewCanvasShape()
 Dim shpCanvas As Shape
 Set shpCanvas = ActiveDocument.Shapes.AddCanvas( _
 Left:=100, Top:=75, Width:=150, Height:=200)
 shpCanvas.CanvasItems.AddShape _
 Type:=msoShapeOval, Top:=25, _
 Left:=25, Width:=150, Height:=150
End Sub

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.Chart Property (Word)

 Copy code hover
[image]

Shape.Chart Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Chart object that represents a chart within the collection of shapes in a document. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Chart

expression An expression that returns a Shape object.

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.Child Property (Word)

 Copy code hover
[image]

Shape.Child Property (Word)
See also Send feedback

Published: July 16, 2012

True if the shape is a child shape or if all shapes in a shape range are child shapes of the same parent. Read-only MsoTriState.

Syntax

expression .Child

expression Required. A variable that represents a Shape object.

Example

This example selects the first shape in the canvas and, if the selected shape is a child shape, fills the shape with the specified color. This example assumes that the first shape in the active document is a drawing canvas that contains multiple shapes.

VBA Copy code Copy code
Sub FillChildShape()

 Dim shpCanvasItem As Shape

 'Select the first shape in the drawing canvas
 Set shpCanvasItem = ActiveDocument.Shapes(1).CanvasItems(1)

 'Fill selected shape if it is a child shape
 With shpCanvasItem
 If .Child = msoTrue Then
 .Fill.ForeColor.RGB = RGB(100, 0, 200)
 Else
 MsgBox "This shape is not a child shape."
 End If
 End With

End Sub

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.Creator Property (Word)

 Copy code hover
[image]

Shape.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a Shape object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.Fill Property (Word)

 Copy code hover
[image]

Shape.Fill Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a FillFormat object that contains fill formatting properties for the specified shape. Read-only.

Syntax

expression .Fill

expression A variable that represents a Shape object.

Example

This example adds a rectangle to myDocument and then sets the foreground color, background color, and gradient for the rectangle's fill.

VBA Copy code Copy code
Set myDocument = Documents(1)
With myDocument.Shapes.AddShape(msoShapeRectangle, _
 90, 90, 90, 50).Fill
 .ForeColor.RGB = RGB(128, 0, 0)
 .BackColor.RGB = RGB(170, 170, 170)
 .TwoColorGradient msoGradientHorizontal, 1
End With

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.Glow Property (Word)

 Copy code hover
[image]

Shape.Glow Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a GlowFormat object that represents the glow formatting for a shape. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Glow

expression An expression that returns a Shape object.

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.GroupItems Property (Word)

 Copy code hover
[image]

Shape.GroupItems Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a GroupShapes object that represents the individual shapes in the specified group. Read-only.

Syntax

expression .GroupItems

expression A variable that represents a Shape object.

Remarks

This property applies to Shape object that represent grouped shapes. Use the Item method of the GroupShapes object to return a single shape from the group.

Example

This example adds three triangles to myDocument, groups them, sets a color for the entire group, and then changes the color for the second triangle only.

VBA Copy code Copy code
Set myDocument = ActiveDocument
With myDocument.Shapes
 .AddShape(msoShapeIsoscelesTriangle, _
 10, 10, 100, 100).Name = "shpOne"
 .AddShape(msoShapeIsoscelesTriangle, _
 150, 10, 100, 100).Name = "shpTwo"
 .AddShape(msoShapeIsoscelesTriangle, _
 300, 10, 100, 100).Name = "shpThree"
 With .Range(Array("shpOne", "shpTwo", "shpThree")).Group
 .Fill.PresetTextured msoTextureBlueTissuePaper
 .GroupItems(2).Fill.PresetTextured msoTextureGreenMarble
 End With
End With

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.HasChart Property (Word)

 Copy code hover
[image]

Shape.HasChart Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified shape has a chart. Read-only.

Syntax

expression .HasChart

expression An expression that returns a Shape object.

Remarks

This property always returns false for OLE charts. For OLE charts, use InlineShape.OLEFormat.ProgID and check for the following possible values: "Excel.Chart.8", "MSGraph.Chart.8", "Excel.Sheet.8", "Excel.Chart.5", "MSGraph.Chart.5", or "Excel.Sheet.5".

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.HasSmartArt Property (Word)

 Copy code hover
[image]

Shape.HasSmartArt Property (Word)
See also Send feedback

Published: July 16, 2012

Returns True if there is a SmartArt diagram present on the shape. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .HasSmartArt

expression A variable that represents a Shape object.

Example

The following code example displays whether or not the first shape in the active document contains SmartArt.

VBA Copy code Copy code
Dim myShape As Shape

Set myShape = ActiveDocument.Shapes(1)

If myShape.HasSmartArt Then
 MsgBox "The first shape contains SmartArt."
Else
 MsgBox "The first shape contains no SmartArt."
End If

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.Height Property (Word)

 Copy code hover
[image]

Shape.Height Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the height of the specified shape. Read/write Single.

Syntax

expression .Height

expression A variable that represents a Shape object.

Example

This example inserts a picture as an inline shape and changes the height and width of the image.

VBA Copy code Copy code
Dim aInLine As Shape

Set aInLine = ActiveDocument.InlineShapes.AddPicture( _
 FileName:="C:\Windows\Bubbles.bmp", Range:=Selection.Range)

With aInLine
 .Height = 100
 .Width = 200
End With

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.HeightRelative Property (Word)

 Copy code hover
[image]

Shape.HeightRelative Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Single that represents the percentage of the relative height of a shape. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .HeightRelative

expression An expression that returns a Shape object.

Remarks

Use this property with the RelativeVerticalSize property. When set to wdShapeSizeRelativeNone (-999999) (see the WdShapeSizeRelative enumeration), this property should be ignored because the shape does not use percent sizing. The height is solely determined by the Height property.

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.HorizontalFlip Property (Word)

 Copy code hover
[image]

Shape.HorizontalFlip Property (Word)
See also Send feedback

Published: July 16, 2012

Indicates that a shape has been flipped horizontally. Read-only MsoTriState.

Syntax

expression .HorizontalFlip

expression Required. A variable that represents a Shape object.

Example

This example restores each shape in the active document to its original state if it has been flipped horizontally or vertically.

VBA Copy code Copy code
Sub FlipShape()
 Dim shpFlip As Shape
 For Each shpFlip In ActiveDocument.Shapes
 If shpFlip.HorizontalFlip Then shpFlip.Flip msoFlipHorizontal
 If shpFlip.VerticalFlip Then shpFlip.Flip msoFlipVertical
 Next
End Sub

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.Hyperlink Property (Word)

 Copy code hover
[image]

Shape.Hyperlink Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Hyperlink object that represents the hyperlink associated with a Shape object. Read-only.

Syntax

expression .Hyperlink

expression A variable that represents a Shape object.

Remarks

If there is no hyperlink associated with the specified shape, an error occurs. In this case, use the Add method for the Hyperlinks collection to add a hyperlink to the specified shape. The following example shows how to do this.

VBA Copy code Copy code
ActiveDocument.Hyperlinks.Add Selection.Shapes(1), "http://www.microsoft.com"

Example

This example displays the address for the hyperlink for the first shape in the active document.

VBA Copy code Copy code
MsgBox ActiveDocument.Shapes(1).Hyperlink.Address

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.ID Property (Word)

 Copy code hover
[image]

Shape.ID Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the identification type for the specified shape. Read-only Long.

Syntax

expression .ID

expression Required. A variable that represents a Shape object.

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.LayoutInCell Property (Word)

 Copy code hover
[image]

Shape.LayoutInCell Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents whether a shape in a table is displayed inside or outside the table.

Syntax

expression .LayoutInCell

expression Required. A variable that represents a Shape object.

Remarks

True indicates that a specified picture is displayed inside the table. False indicates that a specified picture is displayed outside the table.

The LayoutInCell property corresponds to the Layout in table cell option in the Advanced Layout dialog box for picture formatting.

Note Note

Setting the LayoutInCell property will take effect only if the Type property of the WrapFormat object is set to something other than wdWrapTypeInline or wdWrapTypeNone.

Example

The following example disables the Layout in table cell option for the first shape in the active document. This example assumes that the specified shape is within a table and is not an inline shape.

VBA Copy code Copy code
ActiveDocument.Shapes(1).LayoutInCell = False

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.Left Property (Word)

 Copy code hover
[image]

Shape.Left Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Single that represents the horizontal position, measured in points, of the specified shape or shape range. Can also be any valid WdShapePosition constant. Read/write.

Syntax

expression .Left

expression Required. A variable that represents a Shape object.

Remarks

The position of a shape is measured from the upper-left corner of the shape's bounding box to the shape's anchor. The RelativeHorizontalPosition property controls whether the anchor is positioned alongside a character, column, margin, or the edge of the page.

Example

This example sets the horizontal position of the first shape in the active document to 1 inch from the left edge of the page.

VBA Copy code Copy code
With ActiveDocument.Shapes(1)
 .RelativeHorizontalPosition = _
 wdRelativeHorizontalPositionPage
 .Left = InchesToPoints(1)
End With

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.LeftRelative Property (Word)

 Copy code hover
[image]

Shape.LeftRelative Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Single that represents the relative left position of a shape. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .LeftRelative

expression An expression that returns a Shape object.

Remarks

Use this property with the RelativeHorizontalPosition property. When set to wdShapePositionRelativeNone (-999999) (see the WdShapePositionRelative enumeration), this property should be ignored because the shape does not use percent positioning. The horizontal position is solely determined by the Left property.

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.Line Property (Word)

 Copy code hover
[image]

Shape.Line Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a LineFormat object that contains line formatting properties for the specified shape. Read-only.

Syntax

expression .Line

expression A variable that represents a Shape object.

Remarks

For a line, the LineFormat object represents the line itself; for a shape with a border, the LineFormat object represents the border.

Example

This example adds a blue dashed line to myDocument.

VBA Copy code Copy code
Set myDocument = ActiveDocument
With myDocument.Shapes.AddLine(10, 10, 250, 250).Line
 .DashStyle = msoLineDashDotDot
 .ForeColor.RGB = RGB(50, 0, 128)
End With

This example adds a cross to myDocument and then sets its border to be 8 points thick and red.

VBA Copy code Copy code
Set myDocument = ActiveDocument
With myDocument.Shapes.AddShape(msoShapeCross, 10, 10, 50, 70).Line
 .Weight = 8
 .ForeColor.RGB = RGB(255, 0, 0)
End With

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.LinkFormat Property (Word)

 Copy code hover
[image]

Shape.LinkFormat Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a LinkFormat object that represents the link options of a shape that is linked to a file. Read/only.

Syntax

expression .LinkFormat

expression A variable that represents a Shape object.

Example

This example inserts a graphic as an inline shape (using an INCLUDEPICTURE field) and then displays the source name (Tiles.bmp).

VBA Copy code Copy code
Set iShape = ActiveDocument.InlineShapes _
 .AddPicture(FileName:="C:\windows\Tiles.bmp", _
 LinkToFile:=True, SaveWithDocument:=False, _
 Range:=Selection.Range)
MsgBox iShape.LinkFormat.SourceName

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.LockAnchor Property (Word)

 Copy code hover
[image]

Shape.LockAnchor Property (Word)
See also Send feedback

Published: July 16, 2012

True if the anchor of a Shape object is locked to the anchoring range. Read/write Long.

Syntax

expression .LockAnchor

expression Required. A variable that represents a Shape object.

Remarks

When a shape has a locked anchor, you cannot move the shape's anchor by dragging it. The anchor does not move as the shape is moved. A Shape object is anchored to a range of text, but you can position it anywhere on the page. The shape is anchored to the beginning of the first paragraph that contains the anchoring range. A shape will always remain on the same page as its anchor.

Example

This example creates a new document, adds a shape to it, and then locks the shape's anchor.

VBA Copy code Copy code
Set myDoc = Documents.Add
Set myShape = myDoc.Shapes.AddShape(msoShapeBalloon, _
 100, 100, 140, 70)
myShape.LockAnchor = True
ActiveDocument.ActiveWindow.View.ShowObjectAnchors = True

This example returns a message that states the lock status for each shape in the active document.

VBA Copy code Copy code
For x = 1 to ActiveDocument.Shapes.Count
 Msgbox "Shape " & x & " is locked - " _
 & ActiveDocument.Shapes(x).LockAnchor
Next x

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.LockAspectRatio Property (Word)

 Copy code hover
[image]

Shape.LockAspectRatio Property (Word)
See also Send feedback

Published: July 16, 2012

MsoTrue if the specified shape retains its original proportions when you resize it. MsoFalse if you can change the height and width of the shape independently of one another when you resize it. Read/write MsoTriState.

Syntax

expression .LockAspectRatio

expression Required. A variable that represents a Shape object.

Example

This example adds a cube to myDocument. The cube can be moved and resized but not reproportioned.

VBA Copy code Copy code
Set myDocument = ActiveDocument
myDocument.Shapes.AddShape(msoShapeCube, _
 50, 50, 100, 200).LockAspectRatio = msoTrue

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.Name Property (Word)

 Copy code hover
[image]

Shape.Name Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the name of the specified object. Read/write String.

Syntax

expression .Name

expression Required. A variable that represents a Shape object.

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.Nodes Property (Word)

 Copy code hover
[image]

Shape.Nodes Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a ShapeNodes collection that represents the geometric description of the specified shape.

Syntax

expression .Nodes

expression Required. A variable that represents a Shape object.

Example

This example adds a smooth node with a curved segment after node four in shape three in the active document. Shape three must be a freeform drawing with at least four nodes.

VBA Copy code Copy code
With ActiveDocument.Shapes(3).Nodes
 .Insert Index:=4, SegmentType:=msoSegmentCurve, _
 EditingType:=msoEditingSmooth, X1:=210, Y1:=100
End With

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.OLEFormat Property (Word)

 Copy code hover
[image]

Shape.OLEFormat Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an OLEFormat object that represents the OLE characteristics (other than linking) for the specified shape, inline shape, or field. Read-only.

Syntax

expression .OLEFormat

expression A variable that represents a Shape object.

Example

This example loops through all the floating shapes on the active document and sets all linked Microsoft Excel worksheets to be updated automatically.

VBA Copy code Copy code
For Each s In ActiveDocument.Shapes
 If s.Type = msoLinkedOLEObject Then
 If s.OLEFormat.ProgID = "Excel.Sheet" Then
 s.LinkFormat.AutoUpdate = True
 End If
 End If
Next

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.Parent Property (Word)

 Copy code hover
[image]

Shape.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Shape object.

Syntax

expression .Parent

expression Required. A variable that represents a Shape object.

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.ParentGroup Property (Word)

 Copy code hover
[image]

Shape.ParentGroup Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Shape object that represents the common parent shape of a child shape or a range of child shapes.

Syntax

expression .ParentGroup

expression Required. A variable that represents a Shape object.

Example

This example creates two shapes in the active document and groups those shapes. Then using one shape in the group, it accesses the parent group and fills all shapes in the parent group with the same fill color. This example assumes that the active document does not currently contain any shapes. If it does, an error may occur.

VBA Copy code Copy code
Sub ParentGroupShape()
 Dim pgShape As Shape

 'Add two shapes to active document and group
 With ActiveDocument.Shapes
 .AddShape Type:=msoShapeOval, Left:=72, _
 Top:=72, Width:=100, Height:=100
 .AddShape Type:=msoShapeHeart, Left:=110, _
 Top:=120, Width:=100, Height:=100
 .Range(Array(1, 2)).Group
 End With

 Set pgShape = ActiveDocument.Shapes(1) _
 .GroupItems(1).ParentGroup
 pgShape.Fill.ForeColor.RGB = RGB(Red:=100, Green:=0, Blue:=255)

End Sub

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.PictureFormat Property (Word)

 Copy code hover
[image]

Shape.PictureFormat Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a PictureFormat object that contains picture formatting properties for the specified object. Read-only.

Syntax

expression .PictureFormat

expression A variable that represents a Shape object.

Remarks

This property applies to Shape objects that represent pictures or OLE objects.

Example

This example sets the brightness and contrast for shape one on myDocument. Shape one must be a picture or an OLE object.

VBA Copy code Copy code
Set myDocument = ActiveDocument
With myDocument.Shapes(1).PictureFormat
 .Brightness = 0.3
 .Contrast = .75
End With

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.Reflection Property (Word)

 Copy code hover
[image]

Shape.Reflection Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a ReflectionFormat object that represents the reflection formatting for a shape. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Reflection

expression An expression that returns a Shape object.

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.RelativeHorizontalPosition Property (Word)

 Copy code hover
[image]

Shape.RelativeHorizontalPosition Property (Word)
See also Send feedback

Published: July 16, 2012

Specifies to the relative horizontal position of a shape. Read/write WdRelativeHorizontalPosition.

Syntax

expression .RelativeHorizontalPosition

expression An expression that represents a Shape object.

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.RelativeHorizontalSize Property (Word)

 Copy code hover
[image]

Shape.RelativeHorizontalSize Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a WdRelativeVerticalSize constant that represents the object to which a range of shapes is relative. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .RelativeHorizontalSize

expression An expression that returns a Shape object.

Remarks

Use this property with the WidthRelative property.

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.RelativeVerticalPosition Property (Word)

 Copy code hover
[image]

Shape.RelativeVerticalPosition Property (Word)
See also Send feedback

Published: July 16, 2012

Specifies the relative vertical position of a shape. Read/write WdRelativeVerticalPosition.

Syntax

expression .RelativeVerticalPosition

expression A variable that represents a Shape object.

Example

This example repositions the first shape object in the active document.

VBA Copy code Copy code
With ActiveDocument.Shapes(1)
 .Left = InchesToPoints(0.6)
 .RelativeHorizontalPosition = wdRelativeHorizontalPositionPage
 .Top = InchesToPoints(1)
 .RelativeVerticalPosition = wdRelativeVerticalPositionParagraph
End With

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.RelativeVerticalSize Property (Word)

 Copy code hover
[image]

Shape.RelativeVerticalSize Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a WdRelativeVerticalSize constant that represents the relative vertical size of a shape. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .RelativeVerticalSize

expression An expression that returns a Shape object.

Remarks

Use this property with the HeightRelative property.

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.Rotation Property (Word)

 Copy code hover
[image]

Shape.Rotation Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the number of degrees the specified shape is rotated around the z-axis. A positive value indicates clockwise rotation; a negative value indicates counterclockwise rotation. Read/write Single.

Syntax

expression .Rotation

expression A variable that represents a Shape object.

Remarks

To set the rotation of a three-dimensional shape around the x-axis or the y-axis, use the RotationX property or the RotationY property of the ThreeDFormat object.

Example

This example matches the rotation of all shapes on myDocument to the rotation of shape one.

VBA Copy code Copy code
Set myDocument = ActiveDocument
With myDocument.Shapes
 sh1Rotation = .Item(1).Rotation
 For o = 1 To .Count
 .Item(o).Rotation = sh1Rotation
 Next
End With

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.Script Property (Word)

 Copy code hover
[image]

Shape.Script Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Script object, which represents a block of script or code for an image on a Web page.

Syntax

expression .Script

expression Required. A variable that represents a Shape object.

Remarks

If the Web page contains no script, nothing is returned.

Example

This example displays the type of scripting language used in the first shape in the active document.

VBA Copy code Copy code
Set objScr = ActiveDocument.Shapes(1).Script
If Not (objScr Is Nothing) Then
 Select Case objScr.Language
 Case msoScriptLanguageVisualBasic
 MsgBox "VBScript"
 Case msoScriptLanguageJava
 MsgBox "JavaScript"
 Case msoScriptLanguageASP
 MsgBox "Active Server Pages"
 Case Else
 Msgbox "Other scripting language"
 End Select
End If

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.Shadow Property (Word)

 Copy code hover
[image]

Shape.Shadow Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a ShadowFormat object that represents the shadow formatting for the specified shape.

Syntax

expression .Shadow

expression Required. A variable that represents a Shape object.

Example

This example adds an arrow with shadow formatting to the active document.

VBA Copy code Copy code
Set myShape = ActiveDocument.Shapes _
 .AddShape(Type:=msoShapeRightArrow, _
 Left:=90, Top:=79, Width:=64, Height:=43)
myShape.Shadow.Type = msoShadow5

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.ShapeStyle Property (Word)

 Copy code hover
[image]

Shape.ShapeStyle Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the shape style for the specified shape. Read/write MsoShapeStyleIndex.

Version Information

Version Added: Word 2010

Syntax

expression .ShapeStyle

expression A variable that represents a Shape object.

Example

The following code example changes the shape style for the first shape in the active document.

VBA Copy code Copy code
Dim myShape As Shape

Set myShape = ActiveDocument.Shapes(1)

myShape.ShapeStyle = msoLineStylePreset12

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.SmartArt Property (Word)

 Copy code hover
[image]

Shape.SmartArt Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a SmartArt object that provides a way to work with the SmartArt associated with the specified shape. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .SmartArt

expression A variable that represents a Shape object.

Remarks

The SmartArt property provides an entry point for interacting with a SmartArt graphic associated with the shape.

Example

The following code example adds a SmartArt graphic to the active document.

VBA Copy code Copy code
Dim myShape As Shape
Dim mySmartArt As SmartArt

Set myShape = ActiveDocument.Shapes.AddSmartArt(Application.SmartArtLayouts(1), 100, 100, 400, 400)
Set mySmartArt = myShape.SmartArt

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.SoftEdge Property (Word)

 Copy code hover
[image]

Shape.SoftEdge Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a SoftEdgeFormat object that represents the soft edge formatting for a shape. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .SoftEdge

expression An expression that returns a Shape object.

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.TextEffect Property (Word)

 Copy code hover
[image]

Shape.TextEffect Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a TextEffectFormat object that contains text-effect formatting properties for the specified shape. Read-only.

Syntax

expression .TextEffect

expression A variable that represents a Shape object.

Remarks

This property applies to Shape objects that represent WordArt.

Example

This example sets the font style to bold for shape three on myDocument if the shape is WordArt.

VBA Copy code Copy code
Set myDocument = ActiveDocument
With myDocument.Shapes(3)
 If .Type = msoTextEffect Then
 .TextEffect.FontBold = True
 End If
End With

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.TextFrame Property (Word)

 Copy code hover
[image]

Shape.TextFrame Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a TextFrame object that contains the text for the specified shape.

Syntax

expression .TextFrame

expression A variable that represents a Shape object.

Example

This example adds a rectangle to myDocument, adds text to the rectangle, and sets the margins for the text frame.

VBA Copy code Copy code
Set myDocument = ActiveDocument
With myDocument.Shapes.AddShape(msoShapeRectangle, _
 0, 0, 250, 140).TextFrame
 .TextRange.Text = "Here is some test text"
 .MarginBottom = 0
 .MarginLeft = 100
 .MarginRight = 0
 .MarginTop = 20
End With

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.TextFrame2 Property (Word)

 Copy code hover
[image]

Shape.TextFrame2 Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a TextFrame2 object that contains the text for the specified shape. Read-only.

Syntax

expression .TextFrame2

expression An expression that returns a Shape object.

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.ThreeD Property (Word)

 Copy code hover
[image]

Shape.ThreeD Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a ThreeDFormat object that contains 3-D formatting properties for the specified shape. Read-only.

Syntax

expression .ThreeD

expression A variable that represents a Shape object.

Example

This example sets the depth, extrusion color, extrusion direction, and lighting direction for the 3-D effects applied to shape one on myDocument.

VBA Copy code Copy code
Set myDocument = ActiveDocument
With myDocument.Shapes(1).ThreeD
 .Visible = True
 .Depth = 50
 ' RGB value for purple
 .ExtrusionColor.RGB = RGB(255, 100, 255)
 .SetExtrusionDirection msoExtrusionTop
 .PresetLightingDirection = msoLightingLeft
End With

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.Title Property (Word)

 Copy code hover
[image]

Shape.Title Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a String that contains a title for the specified shape. Read/write.

Version Information

Version Added: Word 2010

Syntax

expression .Title

expression A variable that represents a Shape object.

Remarks

Use the Title property to provide an alternative text title for a shape. This property adds title text to the Title text box on the Alt Text pane of the Format Shape dialog in Word 2010.

Note Note

Web browsers display alternative text while tables are loading or if they are missing. Web search engines use the alternative text to help find Web pages. Alternative text is also used to assist disabilities.

Example

The following code example adds an alternative text title to the second shape in the active document.

VBA Copy code Copy code
ActiveDocument.Shapes(2).Title = "Shape 2."

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.Top Property (Word)

 Copy code hover
[image]

Shape.Top Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the vertical position of the specified shape or shape range in points. Read/write Single.

Syntax

expression .Top

expression Required. A variable that represents a Shape object.

Remarks

The position of a shape is measured from the upper-left corner of the shape's bounding box to the shape's anchor. The RelativeVerticalPosition property controls whether the shape's anchor is positioned alongside the line, the paragraph, the margin, or the edge of the page.

For a ShapeRange object that contains more than one shape, the Top property sets the vertical position of each shape.

Example

This example sets the vertical position of the first shape in the active document to 1 inch from the top of the page.

VBA Copy code Copy code
With ActiveDocument.Shapes(1)
 .RelativeVerticalPosition = wdRelativeVerticalPositionPage
 .Top = InchesToPoints(1)
End With

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.TopRelative Property (Word)

 Copy code hover
[image]

Shape.TopRelative Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Single that represents the relative top position of a shape. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .TopRelative

expression An expression that returns a Shape object.

Remarks

Use this property with the RelativeHorizontalPosition property. When set to wdShapePositionRelativeNone (-999999) (see the WdShapePositionRelative enumeration), this property should be ignored because the shape does not use percent positioning. The vertical position is solely determined by the Top property.

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.Type Property (Word)

 Copy code hover
[image]

Shape.Type Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the type of inline shape. Read-only MsoShapeType.

Syntax

expression .Type

expression Required. A variable that represents a Shape object.

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.VerticalFlip Property (Word)

 Copy code hover
[image]

Shape.VerticalFlip Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified shape is flipped around the vertical axis. Read-only MsoTriState.

Syntax

expression .VerticalFlip

expression Required. A variable that represents a Shape object.

Example

This example restores each shape on myDocument to its original state if it has been flipped horizontally or vertically.

VBA Copy code Copy code
For Each s In ActiveDocument.Shapes
 If s.HorizontalFlip Then s.Flip msoFlipHorizontal
 If s.VerticalFlip Then s.Flip msoFlipVertical
Next

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.Vertices Property (Word)

 Copy code hover
[image]

Shape.Vertices Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the coordinates of the specified freeform drawing's vertices (and control points for Bézier curves) as a series of coordinate pairs. Read-only Variant.

Syntax

expression .Vertices

expression Required. A variable that represents a Shape object.

Remarks

You can use the array returned by this property as an argument for the AddCurve or AddPolyLine method.

The following table shows how the Vertices property associates values in the array vertArray() with the coordinates of a triangle's vertices.

vertArray element | Contains
vertArray(1, 1) | The horizontal distance from the first vertex to the left side of the document.
vertArray(1, 2) | The vertical distance from the first vertex to the top of the document.
vertArray(2, 1) | The horizontal distance from the second vertex to the left side of the document.
vertArray(2, 2) | The vertical distance from the second vertex to the top of the document.
vertArray(3, 1) | The horizontal distance from the third vertex to the left side of the document.
vertArray(3, 2) | The vertical distance from the third vertex to the top of the document.

Example

This example assigns the vertex coordinates for shape one in the active document to an array variable and displays the coordinates for the first vertex. Shape one must be a freeform drawing.

VBA Copy code Copy code
With ActiveDocument.Shapes(1)
    vertArray = .Vertices
    x1 = vertArray(1, 1)
    y1 = vertArray(1, 2)
    MsgBox "First vertex coordinates: " & x1 & ", " & y1
End With

This example creates a curve that has the same geometric description as shape one in the active document. This example assumes that the first shape is a Bézier curve containing 3n+1 vertices, where n is the number of curve segments.

VBA Copy code Copy code
With ActiveDocument.Shapes
    .AddCurve .Item(1).Vertices, Selection.Range
End With

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.Visible Property (Word)

 Copy code hover
[image]

Shape.Visible Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified object, or the formatting applied to it, is visible. Read/write MsoTriState.

Syntax

expression .Visible

expression Required. A variable that represents a Shape object.

Remarks

FSome methods and properties may be unavailable if the Visible property is False.

Example

This example creates a new document and then adds text and a rectangle to it. The example also sets Word to hide the rectangle while the document is being printed and then to make it visible again after printing is completed.

VBA Copy code Copy code
Set myDoc = Documents.Add
Selection.TypeText Text:="This is some sample text."
With myDoc
 .Shapes.AddShape msoShapeRectangle, 200, 70, 150, 60
 .Shapes(1).Visible = False
 .PrintOut
 .Shapes(1).Visible = True
End With

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.Width Property (Word)

 Copy code hover
[image]

Shape.Width Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the width, in points, of the specified shape. Read/write Long.

Syntax

expression .Width

expression A variable that represents a Shape object.

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.WidthRelative Property (Word)

 Copy code hover
[image]

Shape.WidthRelative Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Single that represents the relative width of a shape. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .WidthRelative

expression An expression that returns a Shape object.

Remarks

Use this property with the RelativeVerticalSize property. When set to wdShapeSizeRelativeNone (-999999) (see the WdShapeSizeRelative enumeration), this property should be ignored because the shape does not use percent sizing. The width is solely determined by the Width property.

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.WrapFormat Property (Word)

 Copy code hover
[image]

Shape.WrapFormat Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a WrapFormat object that contains the properties for wrapping text around the specified shape. Read-only.

Syntax

expression .WrapFormat

expression A variable that represents a Shape object.

Example

This example adds an oval to the active document and specifies that the document text wrap around the left and right sides of the square that circumscribes the oval. The example sets a 0.1-inch margin between the document text and the top, bottom, left side, and right side of the square.

VBA Copy code Copy code
Set myOval = _
 ActiveDocument.Shapes.AddShape(msoShapeOval, 36, 36, 90, 50)
With myOval.WrapFormat
 .Type = wdWrapSquare
 .Side = wdWrapBoth
 .DistanceTop = InchesToPoints(0.1)
 .DistanceBottom = InchesToPoints(0.1)
 .DistanceLeft = InchesToPoints(0.1)
 .DistanceRight = InchesToPoints(0.1)
End With

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.ZOrderPosition Property (Word)

 Copy code hover
[image]

Shape.ZOrderPosition Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the position of the specified shape in the z-order. Read-only.

Syntax

expression .ZOrderPosition

expression An expression that returns a Shape object.

Remarks

Shapes(1) returns the shape at the back of the z-order, and Shapes(Shapes.Count) returns the shape at the front of the z-order. This property is read-only. To set the shape's position in the z-order, use the ZOrder method.

A shape's position in the z-order corresponds to the shape's index number in the Shapes collection. For example, if there are four shapes on myDocument, the expression myDocument.Shapes(1) returns the shape at the back of the z-order, and the expression myDocument.Shapes(4) returns the shape at the front of the z-order.

Whenever you add a new shape to a collection, it is added to the front of the z-order by default.

Example

This example adds an oval to myDocument and then places the oval second from the back in the z-order if there is at least one other shape on the document.

VBA Copy code Copy code
Set myDocument = ActiveDocument
With myDocument.Shapes.AddShape(msoShapeOval, 100, 100, 100, 300)
 While .ZOrderPosition > 2
 .ZOrder msoSendBackward
 Wend
End With

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape Methods (Word)

 Copy code hover
[image]

Shape Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Apply | Applies to the specified shape formatting that has been copied using the PickUp method.
CanvasCropBottom | Crops a percentage of the height of a drawing canvas from the bottom of the canvas.
CanvasCropLeft | Crops a percentage of the width of a drawing canvas from the left side of the canvas.
CanvasCropRight | Crops a percentage of the width of a drawing canvas from the right side of the canvas.
CanvasCropTop | Crops a percentage of the height of a drawing canvas from the top of the canvas.
ConvertToInlineShape | Converts the specified shape in the drawing layer of a document to an inline shape in the text layer. You can convert only shapes that represent pictures, OLE objects, or ActiveX controls. This method returns an InlineShape object that represents the picture or OLE object.
Delete | Deletes the specified shape node.
Duplicate | Creates a duplicate of the specified Shape object, adds the new shape to the Shapes collection at a standard offset from the original shapes, and then returns the new Shape object.
Flip | Flips a shape horizontally or vertically.
IncrementLeft | Moves the specified shape horizontally by the specified number of points.
IncrementRotation | Changes the rotation of the specified shape around the z-axis by the specified number of degrees.
IncrementTop | Moves the specified shape vertically by the specified number of points.
PickUp | Copies the formatting of the specified shape.
ScaleHeight | Scales the height of the shape by a specified factor.
ScaleWidth | Scales the width of the shape by a specified factor.
Select | Selects the specified shape.
SetShapesDefaultProperties | Applies the formatting of the default shape for a document to the specified shape.
Ungroup | Ungroups any grouped shapes in the specified shape.
ZOrder | Moves the specified shape in front of or behind other shapes in the collection (that is, changes the shape's position in the z-order).


Shape.Apply Method (Word)

 Copy code hover
[image]

Shape.Apply Method (Word)
See also Send feedback

Published: July 16, 2012

Applies to the specified shape formatting that has been copied using the PickUp method.

Syntax

expression .Apply

expression Required. A variable that represents a Shape object.

Remarks

If formatting for the Shape object has not previously been copied using the PickUp method, using the Apply method generates an error.

Example

This example copies the formatting of shape one on the active document and applies the copied formatting to shape two on the same document.

VBA Copy code Copy code
With ActiveDocument
 .Shapes(1).PickUp
 .Shapes(2).Apply
End With

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.CanvasCropBottom Method (Word)

 Copy code hover
[image]

Shape.CanvasCropBottom Method (Word)
See also Send feedback

Published: July 16, 2012

Crops a percentage of the height of a drawing canvas from the bottom of the canvas.

Syntax

expression .CanvasCropBottom(Increment)

expression Required. A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Increment | Required | Single | The amount in percentage points of a drawing canvas's height that you want remaining after the canvas is cropped. Entering 0.9 as the increment crops ten percent of the canvas's height from the bottom. Entering 0.1 crops ninety percent of the canvas's height from the bottom.

Example

This example crops twenty-five percent of the drawing canvas's height from the bottom of the first canvas in the active document, assuming the first shape in the active document is a drawing canvas. If not, you will need to add a drawing canvas to the document using the AddCanvas method.

VBA Copy code Copy code
Sub CropCanvasBottom()
 Dim shpCanvas As Shape

 Set shpCanvas = ActiveDocument.Shapes(1)
 shpCanvas.CanvasCropBottom Increment:=0.75
End Sub

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.CanvasCropLeft Method (Word)

 Copy code hover
[image]

Shape.CanvasCropLeft Method (Word)
See also Send feedback

Published: July 16, 2012

Crops a percentage of the width of a drawing canvas from the left side of the canvas.

Syntax

expression .CanvasCropBottom(Increment)

expression Required. A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Increment | Required | Single | The amount in percentage points of the drawing canvas's width that you want remaining after the canvas is cropped. Entering 0.9 as the increment crops ten percent of the canvas's width from the left. Entering 0.1 crops ninety percent of the canvas's width from the left.

Example

This example crops twenty-five percent of the drawing canvas's width from the left side of the first canvas in the active document, assuming the first shape in the active document is a drawing canvas. If not, you will need to add a drawing canvas to the document using the AddCanvas method.

VBA Copy code Copy code
Sub CropCanvasLeft()
 Dim shpCanvas As Shape

 Set shpCanvas = ActiveDocument.Shapes(1)
 shpCanvas.CanvasCropLeft Increment:=0.75
End Sub

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.CanvasCropRight Method (Word)

 Copy code hover
[image]

Shape.CanvasCropRight Method (Word)
See also Send feedback

Published: July 16, 2012

Crops a percentage of the width of a drawing canvas from the right side of the canvas.

Syntax

expression .CanvasCropBottom(Increment)

expression Required. A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Increment | Required | Single | The amount in percentage points of the canvas's width that you want remaining after the canvas is cropped. Entering 0.9 as the increment crops ten percent of the canvas's width from the right. Entering 0.1 crops ninety percent of the canvas's width from the right.

Example

This example crops twenty-five percent of the drawing canvas's width from the right side of the first canvas in the active document, assuming the first shape in the active document is a drawing canvas. If not, you will need to add a drawing canvas to the document using the AddCanvas method.

VBA Copy code Copy code
Sub CropCanvasRight()
 Dim shpCanvas As Shape

 Set shpCanvas = ActiveDocument.Shapes(1)
 shpCanvas.CanvasCropRight Increment:=0.75
End Sub

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.CanvasCropTop Method (Word)

 Copy code hover
[image]

Shape.CanvasCropTop Method (Word)
See also Send feedback

Published: July 16, 2012

Crops a percentage of the height of a drawing canvas from the top of the canvas.

Syntax

expression .CanvasCropBottom(Increment)

expression Required. A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Increment | Required | Single | The amount in percentage points of a canvas's height that you want remaining after the canvas is cropped. Entering 0.9 as the increment crops ten percent of the canvas's height from the top. Entering 0.1 crops ninety percent of the canvas's height from the top.

Example

This example crops twenty-five percent of the drawing canvas's height from the top of the first canvas in the active document, assuming the first shape in the active document is a drawing canvas. If not, you will need to add a drawing canvas to the document using the AddCanvas method.

VBA Copy code Copy code
Sub CropCanvasTop()
 Dim shpCanvas As Shape

 Set shpCanvas = ActiveDocument.Shapes(1)
 shpCanvas.CanvasCropTop Increment:=0.75
End Sub

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.ConvertToInlineShape Method (Word)

 Copy code hover
[image]

Shape.ConvertToInlineShape Method (Word)
See also Send feedback

Published: July 16, 2012

Converts the specified shape in the drawing layer of a document to an inline shape in the text layer. You can convert only shapes that represent pictures, OLE objects, or ActiveX controls. This method returns an InlineShape object that represents the picture or OLE object.

Syntax

expression .ConvertToInlineShape

expression Required. A variable that represents a Shape object.

Remarks

Shapes that support attached text cannot be converted to inline shapes. For these shapes, use the ConvertToFrame method.

If you use this method on a ShapeRange object that contains more than one shape, an error occurs.

Example

This example converts each picture in MyDoc.doc to an inline shape.

VBA Copy code Copy code
For Each s In Documents("MyDoc.doc").Shapes
 If s.Type = msoPicture Then
 s.ConvertToInlineShape
 End If
Next s

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.Delete Method (Word)

 Copy code hover
[image]

Shape.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the specified shape node.

Syntax

expression .Delete(Index)

expression Required. A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The number of the shape node to delete.

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.Duplicate Method (Word)

 Copy code hover
[image]

Shape.Duplicate Method (Word)
See also Send feedback

Published: July 16, 2012

Creates a duplicate of the specified Shape object, adds the new shape to the Shapes collection at a standard offset from the original shapes, and then returns the new Shape object.

Syntax

expression .Duplicate

expression Required. A variable that represents a Shape object.

Example

This example creates a duplicate of shape one on the active document and then changes the fill for the new shape.

VBA Copy code Copy code
Set newShape = ActiveDocument.Shapes(1).Duplicate
With newShape
 .Fill.PresetGradient msoGradientVertical, 1, msoGradientGold
End With

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.Flip Method (Word)

 Copy code hover
[image]

Shape.Flip Method (Word)
See also Send feedback

Published: July 16, 2012

Flips a shape horizontally or vertically.

Syntax

expression .Flip(FlipCmd)

expression Required. A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
FlipCmd | Required | MsoFlipCmd | The flip orientation.

Example

This example adds a triangle to the active document, duplicates the triangle, and then flips the duplicate triangle vertically and makes it red.

VBA Copy code Copy code
Sub FlipShape()
 With ActiveDocument.Shapes.AddShape( _
 Type:=msoShapeRightTriangle, Left:=150, _
 Top:=150, Width:=50, Height:=50).Duplicate
 .Fill.ForeColor.RGB = RGB(Red:=255, Green:=0, Blue:=0)
 .Flip msoFlipVertical
 End With
End Sub

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.IncrementLeft Method (Word)

 Copy code hover
[image]

Shape.IncrementLeft Method (Word)
See also Send feedback

Published: July 16, 2012

Moves the specified shape horizontally by the specified number of points.

Syntax

expression .IncrementLeft(Increment)

expression Required. A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Increment | Required | Single | Specifies how far the shape is to be moved horizontally, in points. A positive value moves the shape to the right; a negative value moves it to the left.

Example

This example duplicates shape one on myDocument, sets the fill for the duplicate, moves it 70 points to the right and 50 points up, and rotates it 30 degrees clockwise.

VBA Copy code Copy code
Set myDocument = ActiveDocument
With myDocument.Shapes(1).Duplicate
 .Fill.PresetTextured msoTextureGranite
 .IncrementLeft 70
 .IncrementTop -50
 .IncrementRotation 30
End With

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.IncrementRotation Method (Word)

 Copy code hover
[image]

Shape.IncrementRotation Method (Word)
See also Send feedback

Published: July 16, 2012

Changes the rotation of the specified shape around the z-axis by the specified number of degrees.

Syntax

expression .IncrementRotation(Increment)

expression Required. A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Increment | Required | Single | Specifies how far the shape is to be rotated horizontally, in degrees. A positive value rotates the shape clockwise; a negative value rotates it counterclockwise.

Remarks

Use the Rotation property to set the absolute rotation of the shape. To rotate a three-dimensional shape around the x-axis or the y-axis, use the IncrementRotationX or IncrementRotationY method of the ThreeDFormat object.

Example

This example duplicates shape one on myDocument, sets the fill for the duplicate, moves it 70 points to the right and 50 points up, and rotates it 30 degrees clockwise.

VBA Copy code Copy code
Set myDocument = ActiveDocument
With myDocument.Shapes(1).Duplicate
 .Fill.PresetTextured msoTextureGranite
 .IncrementLeft 70
 .IncrementTop -50
 .IncrementRotation 30
End With

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.IncrementTop Method (Word)

 Copy code hover
[image]

Shape.IncrementTop Method (Word)
See also Send feedback

Published: July 16, 2012

Moves the specified shape vertically by the specified number of points.

Syntax

expression .IncrementTop(Increment)

expression Required. A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Increment | Required | Single | Specifies how far the shape object is to be moved vertically, in points. A positive value moves the shape down; a negative value moves it up.

Example

This example duplicates shape one on myDocument, sets the fill for the duplicate, moves it 70 points to the right and 50 points up, and rotates it 30 degrees clockwise.

VBA Copy code Copy code
Set myDocument = ActiveDocument
With myDocument.Shapes(1).Duplicate
 .Fill.PresetTextured msoTextureGranite
 .IncrementLeft 70
 .IncrementTop -50
 .IncrementRotation 30
End With

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.PickUp Method (Word)

 Copy code hover
[image]

Shape.PickUp Method (Word)
See also Send feedback

Published: July 16, 2012

Copies the formatting of the specified shape.

Syntax

expression .PickUp

expression Required. A variable that represents a Shape object.

Remarks

Use the Apply method to apply the copied formatting to another shape.

Example

This example copies the formatting of shape one on myDocument and then applies the copied formatting to shape two.

VBA Copy code Copy code
Set myDocument = ActiveDocument
With myDocument
 .Shapes(1).PickUp
 .Shapes(2).Apply
End With

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.ScaleHeight Method (Word)

 Copy code hover
[image]

Shape.ScaleHeight Method (Word)
See also Send feedback

Published: July 16, 2012

Scales the height of the shape by a specified factor.

Syntax

expression .ScaleHeight(Factor, RelativeToOriginalSize, Scale)

expression Required. A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Factor | Required | Single | Specifies the ratio between the height of the shape after you resize it and the current or original height. For example, to make a rectangle 50 percent larger, specify 1.5 for this argument.
RelativeToOriginalSize | Required | MsoTriState | True to scale the shape relative to its original size. False to scale it relative to its current size. You can specify True for this argument only if the specified shape is a picture or an OLE object.
Scale | Optional | MsoScaleFrom | The part of the shape that retains its position when the shape is scaled.

Remarks

For pictures and OLE objects, you can indicate whether you want to scale the shape relative to the original size or relative to the current size. Shapes other than pictures and OLE objects are always scaled relative to their current height.

Example

This example scales all pictures and OLE objects on myDocument to 175 percent of their original height and width, and it scales all other shapes to 175 percent of their current height and width.

VBA Copy code Copy code
Set myDocument = ActiveDocument
For Each s In myDocument.Shapes
 Select Case s.Type
 Case msoEmbeddedOLEObject, msoLinkedOLEObject, _
 msoOLEControlObject, _
 msoLinkedPicture, msoPicture
 s.ScaleHeight 1.75, True
 s.ScaleWidth 1.75, True
 Case Else
 s.ScaleHeight 1.75, False
 s.ScaleWidth 1.75, False
 End Select
Next

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.ScaleWidth Method (Word)

 Copy code hover
[image]

Shape.ScaleWidth Method (Word)
See also Send feedback

Published: July 16, 2012

Scales the width of the shape by a specified factor.

Syntax

expression .ScaleWidth(Factor, RelativeToOriginalSize, Scale)

expression Required. A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Factor | Required | Single | Specifies the ratio between the width of the shape after you resize it and the current or original width. For example, to make a rectangle 50 percent larger, specify 1.5 for this argument.
RelativeToOriginalSize | Required | MsoTriState | True to scale the shape relative to its original size. False to scale it relative to its current size. You can specify True for this argument only if the specified shape is a picture or an OLE object.
Scale | Optional | MsoScaleFrom | The part of the shape that retains its position when the shape is scaled.

Remarks

For pictures and OLE objects, you can indicate whether you want to scale the shape relative to the original size or relative to the current size. Shapes other than pictures and OLE objects are always scaled relative to their current width.

Example

This example scales all pictures and OLE objects on myDocument to 175 percent of their original height and width, and it scales all other shapes to 175 percent of their current height and width.

VBA Copy code Copy code
Set myDocument = ActiveDocument
For Each s In myDocument.Shapes
 Select Case s.Type
 Case msoEmbeddedOLEObject, msoLinkedOLEObject, _
 msoOLEControlObject, _
 msoLinkedPicture, msoPicture
 s.ScaleHeight 1.75, True
 s.ScaleWidth 1.75, True
 Case Else
 s.ScaleHeight 1.75, False
 s.ScaleWidth 1.75, False
 End Select
Next

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.Select Method (Word)

 Copy code hover
[image]

Shape.Select Method (Word)
See also Send feedback

Published: July 16, 2012

Selects the specified shape.

Syntax

expression .Select(Replace)

expression Required. A variable that represents a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
Replace | Optional | Variant | If adding a shape, True replaces the selection. False adds the new shape to the selection.

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.SetShapesDefaultProperties Method (Word)

 Copy code hover
[image]

Shape.SetShapesDefaultProperties Method (Word)
See also Send feedback

Published: July 16, 2012

Applies the formatting of the default shape for a document to the specified shape.

Syntax

expression .SetShapesDefaultProperties

expression Required. A variable that represents a Shape object.

Remarks

New shapes inherit many of their attributes from the default shape.

Example

This example adds a rectangle to myDocument, formats the rectangle's fill, applies the rectangle's formatting to the default shape, and then adds another (smaller) rectangle to the document. The second rectangle has the same fill as the first one.

VBA Copy code Copy code
Set mydocument = ActiveDocument
With mydocument.Shapes
 With .AddShape(msoShapeRectangle, 5, 5, 80, 60)
 With .Fill
 .ForeColor.RGB = RGB(0, 0, 255)
 .BackColor.RGB = RGB(0, 204, 255)
 .Patterned msoPatternHorizontalBrick
 End With
 ' Sets formatting for default shapes
 .SetShapesDefaultProperties
 End With
 ' New shape has default formatting
 .AddShape msoShapeRectangle, 90, 90, 40, 30
End With

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.Ungroup Method (Word)

 Copy code hover
[image]

Shape.Ungroup Method (Word)
See also Send feedback

Published: July 16, 2012

Ungroups any grouped shapes in the specified shape.

Syntax

expression .Ungroup

expression Required. A variable that represents a Shape object.

Return Value

ShapeRange

Remarks

This method sisassembles pictures and OLE objects within the specified shapeand returns the ungrouped shapes as a single ShapeRange object.

Because a group of shapes is treated as a single object, grouping and ungrouping shapes changes the number of items in the Shapes collection and changes the index numbers of items that come after the affected items in the collection.

Example

This example ungroups any grouped shapes and disassembles any pictures or OLE objects on myDocument.

VBA Copy code Copy code
Set myDocument = ActiveDocument
For Each s In myDocument.Shapes
 s.Ungroup
Next

This example ungroups any grouped shapes on myDocument without disassembling pictures or OLE objects on the document.

VBA Copy code Copy code
Set myDocument = ActiveDocument
For Each s In myDocument.Shapes
 If s.Type = msoGroup Then s.Ungroup
Next

See also

Concepts

Shape Object

Other resources

Shape Object Members


Shape.ZOrder Method (Word)

 Copy code hover
[image]

Shape.ZOrder Method (Word)
See also Send feedback

Published: July 16, 2012

Moves the specified shape in front of or behind other shapes in the collection (that is, changes the shape's position in the z-order).

Syntax

expression .ZOrder(ZOrderCmd)

expression An expression that returns a Shape object.

Parameters

Name | Required/Optional | Data Type | Description
ZOrderCmd | Required | MsoZOrderCmd | Specifies where to move the specified shape relative to the other shapes.

Return Value

Nothing

Remarks

Use the ZOrderPosition property to determine a shape's current position in the z-order.

Example

This example adds an oval to the active document and then places the oval as second from the back in the z-order if there is at least one other shape on the document.

VBA Copy code Copy code
With ActiveDocument.Shapes.AddShape(Type:=msoShapeOval, Left:=100, _
 Top:=100, Width:=100, Height:=300)
 While .ZOrderPosition > 2
 .ZOrder msoSendBackward
 Wend
End With

See also

Concepts

Shape Object

Other resources

Shape Object Members


ShapeNode Object (Word)

 Copy code hover
[image]

ShapeNode Object (Word)
See also Send feedback

Published: July 16, 2012

Represents the geometry and the geometry-editing properties of the nodes in a user-defined freeform. Nodes include the vertices between the segments of the freeform and the control points for curved segments. The ShapeNode object is a member of the ShapeNodes collection. The ShapeNodes collection contains all the nodes in a freeform.

Remarks

Use Nodes(Index), where Index is the node index number, to return a single ShapeNode object. If node one in shape three on the active document is a corner point, the following example makes it a smooth point. For this example to work, shape three must be a freeform.

VBA Copy code Copy code
With ActiveDocument.Shapes(3)
 If .Nodes(1).EditingType = msoEditingCorner Then
 .Nodes.SetEditingType 1, msoEditingSmooth
 End If
End With

See also

Concepts

Word Object Model Reference

Other resources

ShapeNode Object Members


ShapeNode Members (Word)

 Copy code hover
[image]

ShapeNode Members (Word)
Send feedback

Published: July 16, 2012

Represents the geometry and the geometry-editing properties of the nodes in a user-defined freeform. Nodes include the vertices between the segments of the freeform and the control points for curved segments. The ShapeNode object is a member of the ShapeNodes collection. The ShapeNodes collection contains all the nodes in a freeform.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
EditingType | If the specified node is a vertex, this property returns a value that indicates how changes made to the node affect the two segments connected to the node. Read-only MsoEditingType. .
Parent | Returns an Object that represents the parent object of the specified ShapeNode object.
Points | Returns the position of the specified node as a coordinate pair. Read-only Variant.
SegmentType | Returns a value that indicates whether the segment associated with the specified node is straight or curved. Read-only MsoSegmentType.


ShapeNode Properties (Word)

 Copy code hover
[image]

ShapeNode Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
EditingType | If the specified node is a vertex, this property returns a value that indicates how changes made to the node affect the two segments connected to the node. Read-only MsoEditingType. .
Parent | Returns an Object that represents the parent object of the specified ShapeNode object.
Points | Returns the position of the specified node as a coordinate pair. Read-only Variant.
SegmentType | Returns a value that indicates whether the segment associated with the specified node is straight or curved. Read-only MsoSegmentType.


ShapeNode.Application Property (Word)

 Copy code hover
[image]

ShapeNode.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a ShapeNode object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

ShapeNode Object

Other resources

ShapeNode Object Members


ShapeNode.Creator Property (Word)

 Copy code hover
[image]

ShapeNode.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a ShapeNode object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

ShapeNode Object

Other resources

ShapeNode Object Members


ShapeNode.EditingType Property (Word)

 Copy code hover
[image]

ShapeNode.EditingType Property (Word)
See also Send feedback

Published: July 16, 2012

If the specified node is a vertex, this property returns a value that indicates how changes made to the node affect the two segments connected to the node. Read-only MsoEditingType. .

Syntax

expression .EditingType

expression Required. A variable that represents a ShapeNode object.

Remarks

If the node is a control point for a curved segment, this property returns the editing type of the adjacent vertex. This property is read-only. Use the SetEditingType method to set the value of this property.

Example

This example changes all corner nodes to smooth nodes in the third shape on the active document. The third shape must be a freeform drawing.

VBA Copy code Copy code
Dim docActive As Document
Dim intCount As Integer

Set docActive = ActiveDocument

With docActive.Shapes(3).Nodes
 For intCount = 1 to .Count
 If .Item(intCount).EditingType = msoEditingCorner Then
 .SetEditingType intCount, msoEditingSmooth
 End If
 Next
End With

See also

Concepts

ShapeNode Object

Other resources

ShapeNode Object Members


ShapeNode.Parent Property (Word)

 Copy code hover
[image]

ShapeNode.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified ShapeNode object.

Syntax

expression .Parent

expression Required. A variable that represents a ShapeNode object.

See also

Concepts

ShapeNode Object

Other resources

ShapeNode Object Members


ShapeNode.Points Property (Word)

 Copy code hover
[image]

ShapeNode.Points Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the position of the specified node as a coordinate pair. Read-only Variant.

Syntax

expression .Points

expression A variable that represents a ShapeNode object.

Remarks

Each coordinate is expressed in points. Use the SetPosition method to set the location of the node.

Example

This example moves node two in shape three on myDocument to the right 200 points and down 300 points. Shape three must be a freeform drawing.

VBA Copy code Copy code
Set myDocument = ActiveDocument
With myDocument.Shapes(3).Nodes
 pointsArray = .Item(2).Points
 currXvalue = pointsArray(1, 1)
 currYvalue = pointsArray(1, 2)
 .SetPosition 2, currXvalue + 200, currYvalue + 300
End With

See also

Concepts

ShapeNode Object

Other resources

ShapeNode Object Members


ShapeNode.SegmentType Property (Word)

 Copy code hover
[image]

ShapeNode.SegmentType Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a value that indicates whether the segment associated with the specified node is straight or curved. Read-only MsoSegmentType.

Syntax

expression .SegmentType

expression Required. A variable that represents a ShapeNode object.

Remarks

If the specified node is a control point for a curved segment, this property returns msoSegmentCurve.

Use the SetSegmentType method to set the value of this property.

Example

This example changes all straight segments to curved segments in shape three on myDocument. Shape three must be a freeform drawing.

VBA Copy code Copy code
Set myDocument = ActiveDocument
With myDocument.Shapes(3).Nodes
 n = 1
 While n <= .Count
 If .Item(n).SegmentType = msoSegmentLine Then
 .SetSegmentType n, msoSegmentCurve
 End If
 n = n + 1
 Wend
End With

See also

Concepts

ShapeNode Object

Other resources

ShapeNode Object Members


ShapeNodes Object (Word)

 Copy code hover
[image]

ShapeNodes Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of all the ShapeNode objects in the specified freeform. Each ShapeNode object represents either a node between segments in a freeform or a control point for a curved segment of a freeform.

Remarks

You can create a freeform manually or by using the BuildFreeform and ConvertToShape methods.

Use the Nodes property to return the ShapeNodes collection. The following example deletes node four in shape three on the active document. For this example to work, shape three must be a freeform with at least four nodes.

VBA Copy code Copy code
ActiveDocument.Shapes(3).Nodes.Delete 4

Use the Insert method to create a new node and add it to the ShapeNodes collection. The following example adds a smooth node with a curved segment after node four in shape three on the active document. For this example to work, shape three must be a freeform with at least four nodes.

VBA Copy code Copy code
With ActiveDocument.Shapes(3).Nodes
 .Insert 4, msoSegmentCurve, msoEditingSmooth, 210, 100
End With

Use Nodes(Index), where Index is the node index number, to return a single ShapeNode object. If node one in shape three on the active document is a corner point, the following example makes it a smooth point. For this example to work, shape three must be a freeform.

VBA Copy code Copy code
With ActiveDocument.Shapes(3)
 If .Nodes(1).EditingType = msoEditingCorner Then
 .Nodes.SetEditingType 1, msoEditingSmooth
 End If
End With

See also

Concepts

Word Object Model Reference

Other resources

ShapeNodes Object Members


ShapeNodes Members (Word)

 Copy code hover
[image]

ShapeNodes Members (Word)
Send feedback

Published: July 16, 2012

A collection of all the ShapeNode objects in the specified freeform. Each ShapeNode object represents either a node between segments in a freeform or a control point for a curved segment of a freeform.

Methods

Name | Description
Delete | Deletes the specified shape node.
Insert | Inserts a node into a freeform shape.
Item | Returns an individual ShapeNode object in a collection.
SetEditingType | Sets the editing type of the node specified by Index. .
SetPosition | Sets the location of the node specified by Index.
SetSegmentType | Sets the segment type of the segment that follows the node specified by Index.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of shape nodes in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified ShapeNodes object.


ShapeNodes Properties (Word)

 Copy code hover
[image]

ShapeNodes Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of shape nodes in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified ShapeNodes object.


ShapeNodes.Application Property (Word)

 Copy code hover
[image]

ShapeNodes.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a ShapeNodes collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

ShapeNodes Collection Object

Other resources

ShapeNodes Object Members


ShapeNodes.Count Property (Word)

 Copy code hover
[image]

ShapeNodes.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of shape nodes in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents a ShapeNodes collection.

See also

Concepts

ShapeNodes Collection Object

Other resources

ShapeNodes Object Members


ShapeNodes.Creator Property (Word)

 Copy code hover
[image]

ShapeNodes.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a ShapeNodes collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

ShapeNodes Collection Object

Other resources

ShapeNodes Object Members


ShapeNodes.Parent Property (Word)

 Copy code hover
[image]

ShapeNodes.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified ShapeNodes object.

Syntax

expression .Parent

expression Required. A variable that represents a ShapeNodes collection.

See also

Concepts

ShapeNodes Collection Object

Other resources

ShapeNodes Object Members


ShapeNodes Methods (Word)

 Copy code hover
[image]

ShapeNodes Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the specified shape node.
Insert | Inserts a node into a freeform shape.
Item | Returns an individual ShapeNode object in a collection.
SetEditingType | Sets the editing type of the node specified by Index. .
SetPosition | Sets the location of the node specified by Index.
SetSegmentType | Sets the segment type of the segment that follows the node specified by Index.


ShapeNodes.Delete Method (Word)

 Copy code hover
[image]

ShapeNodes.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the specified shape node.

Syntax

expression .Delete(Index)

expression Required. A variable that represents a ShapeNodes collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The number within the collection of shape nodes of the shape node to delete.

See also

Concepts

ShapeNodes Collection Object

Other resources

ShapeNodes Object Members


ShapeNodes.Insert Method (Word)

 Copy code hover
[image]

ShapeNodes.Insert Method (Word)
See also Send feedback

Published: July 16, 2012

Inserts a node into a freeform shape.

Syntax

expression .Insert(Index, SegmentType, EditingType, X1, Y1, X2, Y2, X3, Y3)

expression Required. A variable that represents a ShapeNodes collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The number of the shape node after which to insert a new node.
SegmentType | Required | MsoSegmentType | The type of line that connects the inserted node to the neighboring nodes.
EditingType | Required | MsoEditingType | The editing property of the inserted node.
X1 | Required | Single | If the EditingType of the new segment is msoEditingAuto, this argument specifies the horizontal distance, measured in points, from the upper-left corner of the document to the starting point of the new segment. If the EditingType of the new node is msoEditingCorner, this argument specifies the horizontal distance, measured in points, from the upper-left corner of the document to the first control point for the new segment.
Y1 | Required | Single | If the EditingType of the new segment is msoEditingAuto, this argument specifies the vertical distance, measured in points, from the upper-left corner of the document to the starting point of the new segment. If the EditingType of the new node is msoEditingCorner, this argument specifies the vertical distance, measured in points, from the upper-left corner of the document to the first control point for the new segment.
X2 | Optional | Single | If the EditingType of the new segment is msoEditingCorner, this argument specifies the horizontal distance, measured in points, from the upper-left corner of the document to the second control point for the new segment. If the EditingType of the new segment is msoEditingAuto, don't specify a value for this argument.
Y2 | Optional | Single | If the EditingType of the new segment is msoEditingCorner, this argument specifies the vertical distance, measured in points, from the upper-left corner of the document to the second control point for the new segment. If the EditingType of the new segment is msoEditingAuto, don't specify a value for this argument.
X3 | Optional | Single | If the EditingType of the new segment is msoEditingCorner, this argument specifies the horizontal distance, measured in points, from the upper-left corner of the document to the ending point of the new segment. If the EditingType of the new segment is msoEditingAuto, don't specify a value for this argument.
Y3 | Optional | Single | If the EditingType of the new segment is msoEditingCorner, this argument specifies the vertical distance, measured in points, from the upper-left corner of the document to the ending point of the new segment. If the EditingType of the new segment is msoEditingAuto, don't specify a value for this argument.

Example

This example selects the third shape in the active document, checks whether the shape is a Freeform object, and if it is, inserts a node.

VBA Copy code Copy code
Sub InsertShapeNode()
 ActiveDocument.Shapes(3).Select
 With Selection.ShapeRange
 If .Type = msoFreeform Then
 .Nodes.Insert _
 Index:=3, SegmentType:=msoSegmentCurve, _
 EditingType:=msoEditingSymmetric, x1:=35, y1:=100
 .Fill.ForeColor.RGB = RGB(0, 0, 200)
 .Fill.Visible = msoTrue
 Else
 MsgBox "This shape is not a Freeform object."
 End If
 End With
End Sub

See also

Concepts

ShapeNodes Collection Object

Other resources

ShapeNodes Object Members


ShapeNodes.Item Method (Word)

 Copy code hover
[image]

ShapeNodes.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual ShapeNode object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents a ShapeNodes collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The individual object to be returned. Can be a Long indicating the ordinal position of the individual object.

Return Value

ShapeNode

See also

Concepts

ShapeNodes Collection Object

Other resources

ShapeNodes Object Members


ShapeNodes.SetEditingType Method (Word)

 Copy code hover
[image]

ShapeNodes.SetEditingType Method (Word)
See also Send feedback

Published: July 16, 2012

Sets the editing type of the node specified by Index. .

Syntax

expression .SetEditingType(Index, EditingType)

expression Required. A variable that represents a ShapeNodes collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The node whose editing type is to be set.
EditingType | Required | MsoEditingType | The editing property of the vertex.

Remarks

If the node is a control point for a curved segment, this method sets the editing type of the node adjacent to it that joins two segments. Depending on the editing type, this method may affect the position of adjacent nodes.

Example

This example changes all corner nodes to smooth nodes in the third shape on the active document. The third shape must be a freeform drawing.

VBA Copy code Copy code
Dim lngLoop As lngLoop

With ActiveDocument.Shapes(3).Nodes
 For lngLoop = 1 to .Count
 If .Item(lngLoop).EditingType = msoEditingCorner Then
 .SetEditingType lngLoop, msoEditingSmooth
 End If
 Next lngLoop
End With

See also

Concepts

ShapeNodes Collection Object

Other resources

ShapeNodes Object Members


ShapeNodes.SetPosition Method (Word)

 Copy code hover
[image]

ShapeNodes.SetPosition Method (Word)
See also Send feedback

Published: July 16, 2012

Sets the location of the node specified by Index.

Syntax

expression .SetPosition(Index, X1, Y1)

expression Required. A variable that represents a ShapeNodes collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The node whose position is to be set.
X1 | Required | Single | The position (in points) of the new node relative to the upper-left corner of the document.

Remarks

Depending on the editing type of the node, this method may affect the position of adjacent nodes.

Example

This example moves node two in the third shape on the active document to the right 200 points and down 300 points. The third shape must be a freeform drawing.

VBA Copy code Copy code
With ActiveDocument.Shapes(3).Nodes
 pointsArray = .Item(2).Points
 currXvalue = pointsArray(1, 1)
 currYvalue = pointsArray(1, 2)
 .SetPosition 2, currXvalue + 200, currYvalue + 300
End With

See also

Concepts

ShapeNodes Collection Object

Other resources

ShapeNodes Object Members


ShapeNodes.SetSegmentType Method (Word)

 Copy code hover
[image]

ShapeNodes.SetSegmentType Method (Word)
See also Send feedback

Published: July 16, 2012

Sets the segment type of the segment that follows the node specified by Index.

Syntax

expression .SetSegmentType(Index, SegmentType)

expression Required. A variable that represents a ShapeNodes collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The node whose segment type is to be set.
SegmentType | Required | MsoSegmentType | Specifies if the segment is straight or curved.

Remarks

If the node is a control point for a curved segment, this method sets the segment type for that curve. Note that this may affect the total number of nodes by inserting or deleting adjacent nodes.

Example

This example changes all straight segments to curved segments in the third shape on the active document. The third shape must be a freeform drawing.

VBA Copy code Copy code
Dim lngLoop As Long

With ActiveDocument.Shapes(3).Nodes
 lngLoop = 1
 While lngLoop <= .Count
 If .Item(lngLoop).SegmentType = msoSegmentLine Then
 .SetSegmentType lngLoop, msoSegmentCurve
 End If
 lngLoop = lngLoop + 1
 Wend
End With

See also

Concepts

ShapeNodes Collection Object

Other resources

ShapeNodes Object Members


ShapeRange Object (Word)

 Copy code hover
[image]

ShapeRange Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a shape range, which is a set of shapes on a document. A shape range can contain as few as one shape or as many as all the shapes in the document.

Remarks

You can include whichever shapes you want — chosen from among all the shapes in the document or all the shapes in the selection — to construct a shape range. For example, you could construct a ShapeRange collection that contains the first three shapes in a document, all the selected shapes in a document, or all the freeform shapes in a document.Most operations that you can do with a Shape object, you can also do with a ShapeRange object that contains only one shape. Some operations, when performed on a ShapeRange object that contains more than one shape, will cause an error.

Use Range(Index), where Index is the name or index number of the shape or an array that contains either names or index numbers of shapes, to return a ShapeRange collection that represents a set of shapes on a document. You can use Visual Basic's Array function to construct an array of names or index numbers. The following example sets the fill pattern for shapes one and three on the active document.

VBA Copy code Copy code
ActiveDocument.Shapes.Range(Array(1, 3)).Fill.Patterned _
 msoPatternHorizontalBrick

The following example selects the shapes named "Oval 4" and "Rectangle 5" on the active document.

VBA Copy code Copy code
ActiveDocument.Shapes.Range(Array("Oval 4", "Rectangle 5")).Select

Although you can use the Range method to return any number of shapes, it is simpler to use the Item method if you want to return only a single member of the collection. For example, Shapes(1)is simpler thanShapes.Range(1).

Use ShapeRange(Index), where Index is the name or the index number, to return a Shape object that represents a shape within a selection. The following example sets the fill for the first shape in the selection, assuming that the selection contains at least one shape.

VBA Copy code Copy code
Selection.ShapeRange(1).Fill.ForeColor.RGB = RGB(255, 0, 0)

This example selects all the shapes in the first section of the active document.

VBA Copy code Copy code
Set myRange = ActiveDocument.Sections(1).Range
myRange.ShapeRange.Select

Use the Align, Distribute, or ZOrder method to position a set of shapes relative to each other or relative to the document.

Use the Group, Regroup, or UnGroup method to create and work with a single shape formed from a shape range. The GroupItems property for a Shape object returns the GroupShapes object, which represents all the shapes that were grouped to form one shape.

The recorder always uses the ShapeRange property when recording shapes.

Note Note

A ShapeRange object doesn't include InlineShape objects.

See also

Concepts

Word Object Model Reference

Other resources

ShapeRange Object Members


ShapeRange Members (Word)

 Copy code hover
[image]

ShapeRange Members (Word)
Send feedback

Published: July 16, 2012

Represents a shape range, which is a set of shapes on a document. A shape range can contain as few as one shape or as many as all the shapes in the document.

Methods

Name | Description
Align | Aligns the shapes in the specified range of shapes.
Apply | Applies to the specified shape formatting that has been copied using the PickUp method.
CanvasCropBottom | Crops a percentage of the height of a drawing canvas from the bottom of the canvas.
CanvasCropLeft | Crops a percentage of the width of a drawing canvas from the left side of the canvas.
CanvasCropRight | Crops a percentage of the width of a drawing canvas from the right side of the canvas.
CanvasCropTop | Crops a percentage of the height of a drawing canvas from the top of the canvas.
ConvertToInlineShape | Converts the specified shape in the drawing layer of a document to an inline shape in the text layer. You can convert only shapes that represent pictures, OLE objects, or ActiveX controls. .
Delete | Deletes the specified range of shapes.
Distribute | Evenly distributes the shapes in the specified range of shapes. .
Duplicate | Creates a duplicate of the specified ShapeRange object, adds the new range of shapes to the Shapes collection at a standard offset from the original shapes, and then returns a Shape object.
Flip | Flips a shape horizontally or vertically.
Group | Groups the shapes in the specified range, and returns the grouped shapes as a single Shape object.
IncrementLeft | Moves the specified shape horizontally by the specified number of points.
IncrementRotation | Changes the rotation of the specified shape around the z-axis by the specified number of degrees. .
IncrementTop | Moves the specified shape vertically by the specified number of points.
Item | Returns an individual Shape object in a collection.
PickUp | Copies the formatting of the specified shape.
ScaleHeight | Scales the height of a range of shapes by a specified factor.
ScaleWidth | Scales the width of a shape by a specified factor.
Select | Selects the specified range of shapes.
SetShapesDefaultProperties | Applies the formatting of a default shape for a document to the specified range of shapes.
Ungroup | Ungroups any grouped shapes in the specified range of shapes, disassembles pictures and OLE objects within the specified shape or range of shapes, and returns the ungrouped shapes as a single ShapeRange object.
ZOrder | Moves the specified shape range in front of or behind other shapes in the collection (that is, changes the shape range's position in the z-order).

Properties

Name | Description
Adjustments | Returns an Adjustments object that contains adjustment values for all the adjustments in the specified ShapeRange object that represents an AutoShape or WordArt. Read-only.
AlternativeText | Returns or sets the alternative text associated with a shape in a Web page. Read/write String.
Anchor | Returns a Range object that represents the anchoring range for the specified shape range. Read-only.
Application | Returns an Application object that represents the Microsoft Word application.
AutoShapeType | Returns or sets the shape type for the specified ShapeRange object, which must represent an AutoShape other than a line or freeform drawing. Read/write MsoAutoShapeType.
BackgroundStyle | Sets or returns the background style of the shapes in the specified shape range. Read/write MsoBackgroundStyleIndex.
Callout | Returns a CalloutFormat object that contains callout formatting properties for the specified shape. Read-only.
CanvasItems | Returns a CanvasShapes object that represents a collection of shapes in a drawing canvas.
Child | True if the shape is a child shape or if all shapes in a shape range are child shapes of the same parent. Read-only MsoTriState.
Count | Returns a Long that represents the number of shapes in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Fill | Returns a FillFormat object that contains fill formatting properties for the specified shape. Read-only.
Glow | Returns a GlowFormat object that represents the glow formatting for a range of shapes. Read-only.
GroupItems | Returns a GroupShapes object that represents the individual shapes in the specified group. Read-only.
Height | Returns or sets the height of the specified shape range. Read/write Single.
HeightRelative | Returns or sets a Single that represents the percentage of the target shape to which the range of shapes is sized. Read/write.
HorizontalFlip | Indicates that a range of shapes has been flipped horizontally. Read-only MsoTriState.
Hyperlink | Returns a Hyperlink object that represents the hyperlink associated with the specified ShapeRange object. Read-only.
ID | Returns the identification type for the range of shapes. Read-only Long.
LayoutInCell | Returns a Long that represents whether a shape in a table is displayed inside the table or outside the table. .
Left | Returns or sets a Single that represents the horizontal position, measured in points, of the specified range of shapes. Can also be any valid WdShapePosition constant. Read/write.
LeftRelative | Returns or sets a Single that represents the relative left position of a range of shapes. Read/write.
Line | Returns a LineFormat object that contains line formatting properties for the specified range of shapes. Read-only.
LockAnchor | True if the anchor for the specified ShapeRange object is locked to the anchoring range. Read/write Long.
LockAspectRatio | MsoTrue if the specified shape retains its original proportions when you resize it. MsoFalse if you can change the height and width of the shape independently of one another when you resize it. Read/write MsoTriState.
Name | Returns or sets the name of the specified object. Read/write String.
Nodes | Returns a ShapeNodes collection that represents the geometric description of the specified shape.
Parent | Returns an Object that represents the parent object of the specified ShapeRange object.
ParentGroup | Returns a Shape object that represents the common parent shape of a range of shapes.
PictureFormat | Returns a PictureFormat object that contains picture formatting properties for the specified range of shapes. Read-only.
Reflection | Returns a ReflectionFormat object that represents the reflection formatting for a range of shapes. Read-only.
RelativeHorizontalPosition | Specifies the relative horizontal position of a range of shapes. Read/write WdRelativeHorizontalPosition.
RelativeHorizontalSize | Returns or sets a WdRelativeHorizontalSize constant that represents the object to which a range of shapes is relative. Read/write.
RelativeVerticalPosition | Specifies the relative vertical position of a range of shapes. Read/write WdRelativeHorizontalPosition.
RelativeVerticalSize | Returns or sets a WdRelativeVerticalSize constant that represents the object to which a range of shapes is relative. Read/write.
Rotation | Returns or sets the number of degrees the specified shape is rotated around the z-axis. Read/write Single.
Shadow | Returns a ShadowFormat object that represents the shadow formatting for the specified shape.
ShapeStyle | Returns or sets the shape style for the shapes in the specified shape range. Read/write MsoShapeStyleIndex.
SoftEdge | Returns a SoftEdgeFormat object that represents the soft edge formatting for a range of shapes. Read-only.
TextEffect | Returns a TextEffectFormat object that contains text-effect formatting properties for the specified shape. Read-only.
TextFrame | Returns a TextFrame object that contains the text for the specified range of shapes.
TextFrame2 | Returns a TextFrame2 object that contains the text for the specified range of shapes. Read-only.
ThreeD | Returns a ThreeDFormat object that contains 3-D formatting properties for the specified range of shapes. Read-only.
Title | Returns or sets a String that contains a title for the shapes in the specified shape range. Read/write.
Top | Returns or sets the vertical position of the specified shape or shape range in points. Read/write Single.
TopRelative | Returns or sets a Single that represents the relative top position of a range of shapes. Read/write.
Type | Returns the shape type. Read-only MsoShapeType.
VerticalFlip | True if the specified shape is flipped around the vertical axis. Read-only MsoTriState.
Vertices | Returns the coordinates of the specified freeform drawing's vertices (and control points for Bézier curves) as a series of coordinate pairs. You can use the array returned by this property as an argument for the AddCurve or AddPolyLine method. Read-only Variant.
Visible | True if the specified object, or the formatting applied to it, is visible. Read/write MsoTriState.
Width | Returns or sets the width, in points, of the shapes within the range. Read/write Long.
WidthRelative | Returns or sets a Single that represents the relative width of a range of shapes. Read/write.
WrapFormat | Returns a WrapFormat object that contains the properties for wrapping text around the specified range of shapes. Read-only.
ZOrderPosition | Returns a Long that represents the position of the specified shape in the z-order. Read-only.


ShapeRange Properties (Word)

 Copy code hover
[image]

ShapeRange Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Adjustments | Returns an Adjustments object that contains adjustment values for all the adjustments in the specified ShapeRange object that represents an AutoShape or WordArt. Read-only.
AlternativeText | Returns or sets the alternative text associated with a shape in a Web page. Read/write String.
Anchor | Returns a Range object that represents the anchoring range for the specified shape range. Read-only.
Application | Returns an Application object that represents the Microsoft Word application.
AutoShapeType | Returns or sets the shape type for the specified ShapeRange object, which must represent an AutoShape other than a line or freeform drawing. Read/write MsoAutoShapeType.
BackgroundStyle | Sets or returns the background style of the shapes in the specified shape range. Read/write MsoBackgroundStyleIndex.
Callout | Returns a CalloutFormat object that contains callout formatting properties for the specified shape. Read-only.
CanvasItems | Returns a CanvasShapes object that represents a collection of shapes in a drawing canvas.
Child | True if the shape is a child shape or if all shapes in a shape range are child shapes of the same parent. Read-only MsoTriState.
Count | Returns a Long that represents the number of shapes in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Fill | Returns a FillFormat object that contains fill formatting properties for the specified shape. Read-only.
Glow | Returns a GlowFormat object that represents the glow formatting for a range of shapes. Read-only.
GroupItems | Returns a GroupShapes object that represents the individual shapes in the specified group. Read-only.
Height | Returns or sets the height of the specified shape range. Read/write Single.
HeightRelative | Returns or sets a Single that represents the percentage of the target shape to which the range of shapes is sized. Read/write.
HorizontalFlip | Indicates that a range of shapes has been flipped horizontally. Read-only MsoTriState.
Hyperlink | Returns a Hyperlink object that represents the hyperlink associated with the specified ShapeRange object. Read-only.
ID | Returns the identification type for the range of shapes. Read-only Long.
LayoutInCell | Returns a Long that represents whether a shape in a table is displayed inside the table or outside the table. .
Left | Returns or sets a Single that represents the horizontal position, measured in points, of the specified range of shapes. Can also be any valid WdShapePosition constant. Read/write.
LeftRelative | Returns or sets a Single that represents the relative left position of a range of shapes. Read/write.
Line | Returns a LineFormat object that contains line formatting properties for the specified range of shapes. Read-only.
LockAnchor | True if the anchor for the specified ShapeRange object is locked to the anchoring range. Read/write Long.
LockAspectRatio | MsoTrue if the specified shape retains its original proportions when you resize it. MsoFalse if you can change the height and width of the shape independently of one another when you resize it. Read/write MsoTriState.
Name | Returns or sets the name of the specified object. Read/write String.
Nodes | Returns a ShapeNodes collection that represents the geometric description of the specified shape.
Parent | Returns an Object that represents the parent object of the specified ShapeRange object.
ParentGroup | Returns a Shape object that represents the common parent shape of a range of shapes.
PictureFormat | Returns a PictureFormat object that contains picture formatting properties for the specified range of shapes. Read-only.
Reflection | Returns a ReflectionFormat object that represents the reflection formatting for a range of shapes. Read-only.
RelativeHorizontalPosition | Specifies the relative horizontal position of a range of shapes. Read/write WdRelativeHorizontalPosition.
RelativeHorizontalSize | Returns or sets a WdRelativeHorizontalSize constant that represents the object to which a range of shapes is relative. Read/write.
RelativeVerticalPosition | Specifies the relative vertical position of a range of shapes. Read/write WdRelativeHorizontalPosition.
RelativeVerticalSize | Returns or sets a WdRelativeVerticalSize constant that represents the object to which a range of shapes is relative. Read/write.
Rotation | Returns or sets the number of degrees the specified shape is rotated around the z-axis. Read/write Single.
Shadow | Returns a ShadowFormat object that represents the shadow formatting for the specified shape.
ShapeStyle | Returns or sets the shape style for the shapes in the specified shape range. Read/write MsoShapeStyleIndex.
SoftEdge | Returns a SoftEdgeFormat object that represents the soft edge formatting for a range of shapes. Read-only.
TextEffect | Returns a TextEffectFormat object that contains text-effect formatting properties for the specified shape. Read-only.
TextFrame | Returns a TextFrame object that contains the text for the specified range of shapes.
TextFrame2 | Returns a TextFrame2 object that contains the text for the specified range of shapes. Read-only.
ThreeD | Returns a ThreeDFormat object that contains 3-D formatting properties for the specified range of shapes. Read-only.
Title | Returns or sets a String that contains a title for the shapes in the specified shape range. Read/write.
Top | Returns or sets the vertical position of the specified shape or shape range in points. Read/write Single.
TopRelative | Returns or sets a Single that represents the relative top position of a range of shapes. Read/write.
Type | Returns the shape type. Read-only MsoShapeType.
VerticalFlip | True if the specified shape is flipped around the vertical axis. Read-only MsoTriState.
Vertices | Returns the coordinates of the specified freeform drawing's vertices (and control points for Bézier curves) as a series of coordinate pairs. You can use the array returned by this property as an argument for the AddCurve or AddPolyLine method. Read-only Variant.
Visible | True if the specified object, or the formatting applied to it, is visible. Read/write MsoTriState.
Width | Returns or sets the width, in points, of the shapes within the range. Read/write Long.
WidthRelative | Returns or sets a Single that represents the relative width of a range of shapes. Read/write.
WrapFormat | Returns a WrapFormat object that contains the properties for wrapping text around the specified range of shapes. Read-only.
ZOrderPosition | Returns a Long that represents the position of the specified shape in the z-order. Read-only.


ShapeRange.Adjustments Property (Word)

 Copy code hover
[image]

ShapeRange.Adjustments Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Adjustments object that contains adjustment values for all the adjustments in the specified ShapeRange object that represents an AutoShape or WordArt. Read-only.

Syntax

expression .Adjustments

expression A variable that represents a ShapeRange object.

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.AlternativeText Property (Word)

 Copy code hover
[image]

ShapeRange.AlternativeText Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the alternative text associated with a shape in a Web page. Read/write String.

Syntax

expression .AlternativeText

expression A variable that represents a ShapeRange object.

Example

The following example sets the alternative text for the selected shape in the active window. The selected shape is a picture of a mallard duck.

VBA Copy code Copy code
ActiveWindow.Selection.ShapeRange _
 .AlternativeText = "This is a mallard duck."

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.Anchor Property (Word)

 Copy code hover
[image]

ShapeRange.Anchor Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the anchoring range for the specified shape range. Read-only.

Syntax

expression .Anchor

expression A variable that represents a ShapeRange object.

Remarks

If you use this property on a ShapeRange object that contains more than one shape, an error occurs.

All Shape objects are anchored to a range of text but can be positioned anywhere on the page that contains the anchor. If you specify the anchoring range when you create a shape, the anchor is positioned at the beginning of the first paragraph that contains the anchoring range. If you don't specify the anchoring range, the anchoring range is selected automatically and the shape is positioned relative to the top and left edges of the page.

The shape will always remain on the same page as its anchor. If the LockAnchor property for the shape is set to True, you cannot drag the anchor from its position on the page.

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.Application Property (Word)

 Copy code hover
[image]

ShapeRange.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a ShapeRange object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.AutoShapeType Property (Word)

 Copy code hover
[image]

ShapeRange.AutoShapeType Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the shape type for the specified ShapeRange object, which must represent an AutoShape other than a line or freeform drawing. Read/write MsoAutoShapeType.

Syntax

expression .AutoShapeType

expression Required. A variable that represents a ShapeRange object.

Remarks

When you change the type of a shape, the shape retains its size, color, and other attributes.

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.BackgroundStyle Property (Word)

 Copy code hover
[image]

ShapeRange.BackgroundStyle Property (Word)
See also Send feedback

Published: July 16, 2012

Sets or returns the background style of the shapes in the specified shape range. Read/write MsoBackgroundStyleIndex.

Version Information

Version Added: Word 2010

Syntax

expression .BackgroundStyle

expression A variable that represents a ShapeRange object.

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.Callout Property (Word)

 Copy code hover
[image]

ShapeRange.Callout Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a CalloutFormat object that contains callout formatting properties for the specified shape. Read-only.

Syntax

expression .Callout

expression A variable that represents a ShapeRange object.

Remarks

This property applies to ShapeRange objects that represent callouts.

Example

This example adds to myDocument an oval and a callout that points to the oval. The callout text won't have a border, but it will have a vertical accent bar that separates the text from the callout line.

VBA Copy code Copy code
Set myDocument = ActiveDocument
With myDocument.Shapes
 .AddShape msoShapeOval, 180, 200, 280, 130
 With .AddCallout(msoCalloutTwo, 420, 170, 170, 40)
 .TextFrame.TextRange.Text = "My oval"
 With .Callout
 .Accent = True
 .Border = False
 End With
 End With
End With

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.CanvasItems Property (Word)

 Copy code hover
[image]

ShapeRange.CanvasItems Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a CanvasShapes object that represents a collection of shapes in a drawing canvas.

Syntax

expression .CanvasItems

expression Required. A variable that represents a ShapeRange object.

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.Child Property (Word)

 Copy code hover
[image]

ShapeRange.Child Property (Word)
See also Send feedback

Published: July 16, 2012

True if the shape is a child shape or if all shapes in a shape range are child shapes of the same parent. Read-only MsoTriState.

Syntax

expression .Child

expression Required. A variable that represents a ShapeRange object.

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.Count Property (Word)

 Copy code hover
[image]

ShapeRange.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of shapes in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents a ShapeRange object.

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.Creator Property (Word)

 Copy code hover
[image]

ShapeRange.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a ShapeRange object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.Fill Property (Word)

 Copy code hover
[image]

ShapeRange.Fill Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a FillFormat object that contains fill formatting properties for the specified shape. Read-only.

Syntax

expression .Fill

expression A variable that represents a ShapeRange object.

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.Glow Property (Word)

 Copy code hover
[image]

ShapeRange.Glow Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a GlowFormat object that represents the glow formatting for a range of shapes. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Glow

expression An expression that returns a ShapeRange object.

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.GroupItems Property (Word)

 Copy code hover
[image]

ShapeRange.GroupItems Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a GroupShapes object that represents the individual shapes in the specified group. Read-only.

Syntax

expression .GroupItems

expression A variable that represents a ShapeRange object.

Remarks

This property applies to ShapeRange objects that represent grouped shapes. Use the Item method of the GroupShapes object to return a single shape from the group.

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.Height Property (Word)

 Copy code hover
[image]

ShapeRange.Height Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the height of the specified shape range. Read/write Single.

Syntax

expression .Height

expression A variable that represents a ShapeRange object.

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.HeightRelative Property (Word)

 Copy code hover
[image]

ShapeRange.HeightRelative Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Single that represents the percentage of the target shape to which the range of shapes is sized. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .HeightRelative

expression An expression that returns a ShapeRange object.

Remarks

Use this property with the RelativeVerticalSize property. When set to wdShapeSizeRelativeNone (-999999) (see the WdShapeSizeRelative enumeration), this property should be ignored because the shape does not use percent sizing. The height is solely determined by the Height property.

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.HorizontalFlip Property (Word)

 Copy code hover
[image]

ShapeRange.HorizontalFlip Property (Word)
See also Send feedback

Published: July 16, 2012

Indicates that a range of shapes has been flipped horizontally. Read-only MsoTriState.

Syntax

expression .HorizontalFlip

expression Required. A variable that represents a ShapeRange object.

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.Hyperlink Property (Word)

 Copy code hover
[image]

ShapeRange.Hyperlink Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Hyperlink object that represents the hyperlink associated with the specified ShapeRange object. Read-only.

Syntax

expression .Hyperlink

expression A variable that represents a ShapeRange object.

Remarks

If there is no hyperlink associated with the specified range of shapes, an error occurs. In this case, use the Add method for the Hyperlinks collection to add a hyperlink to the specified range of shapes. The following example shows how to do this.

VBA Copy code Copy code
ActiveDocument.Hyperlinks.Add Selection.ShapeRange(1), "http://www.microsoft.com"

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.ID Property (Word)

 Copy code hover
[image]

ShapeRange.ID Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the identification type for the range of shapes. Read-only Long.

Syntax

expression .ID

expression Required. A variable that represents a ShapeRange object.

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.LayoutInCell Property (Word)

 Copy code hover
[image]

ShapeRange.LayoutInCell Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents whether a shape in a table is displayed inside the table or outside the table. .

Syntax

expression .LayoutInCell

expression Required. A variable that represents a ShapeRange object.

Remarks

The LayoutInCell property corresponds to the Layout in table cell option in the Advanced Layout dialog box for picture formatting. True indicates that a specified picture is displayed within the table. False indicates that a specified picture is displayed outside the table.

Note Note

Setting the LayoutInCell property will take effect only if the Type property of the WrapFormat object is set to something other than wdWrapTypeInline or wdWrapTypeNone.

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.Left Property (Word)

 Copy code hover
[image]

ShapeRange.Left Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Single that represents the horizontal position, measured in points, of the specified range of shapes. Can also be any valid WdShapePosition constant. Read/write.

Syntax

expression .Left

expression Required. A variable that represents a ShapeRange object.

Remarks

The position of a shape is measured from the upper-left corner of the shape's bounding box to the shape's anchor. The RelativeHorizontalPosition property controls whether the anchor is positioned alongside a character, column, margin, or the edge of the page.

For a ShapeRange object that contains more than one shape, the Left property sets the horizontal position of each shape.

Example

This example sets the horizontal position of the first and second shapes in the active document to 1 inch from the left edge of the column.

VBA Copy code Copy code
With ActiveDocument.Shapes.Range(Array(1, 2))
 .RelativeHorizontalPosition = _
 wdRelativeHorizontalPositionColumn
 .Left = InchesToPoints(1)
End With

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.LeftRelative Property (Word)

 Copy code hover
[image]

ShapeRange.LeftRelative Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Single that represents the relative left position of a range of shapes. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .LeftRelative

expression An expression that returns a ShapeRange object.

Remarks

Use this property with the RelativeHorizontalPosition property. When set to wdShapePositionRelativeNone (-999999) (see the WdShapePositionRelative enumeration), this property should be ignored because the shape does not use percent positioning. The horizontal position is solely determined by the Left property.

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.Line Property (Word)

 Copy code hover
[image]

ShapeRange.Line Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a LineFormat object that contains line formatting properties for the specified range of shapes. Read-only.

Syntax

expression .Line

expression A variable that represents a ShapeRange object.

Remarks

For a line, the LineFormat object represents the line itself; for a range of shapes with a border, the LineFormat object represents the border.

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.LockAnchor Property (Word)

 Copy code hover
[image]

ShapeRange.LockAnchor Property (Word)
See also Send feedback

Published: July 16, 2012

True if the anchor for the specified ShapeRange object is locked to the anchoring range. Read/write Long.

Syntax

expression .LockAnchor

expression Required. A variable that represents a ShapeRange object.

Remarks

When a range of shapes has a locked anchor, you cannot move the shapes' anchor by dragging it. The anchor does not move as the shape is moved.

A ShapeRange object is anchored to a range of text, but you can position it anywhere on the page. If the range of shapes is anchored to the beginning of the first paragraph that contains the anchoring range, the shapes always remain on the same page as the anchor.

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.LockAspectRatio Property (Word)

 Copy code hover
[image]

ShapeRange.LockAspectRatio Property (Word)
See also Send feedback

Published: July 16, 2012

MsoTrue if the specified shape retains its original proportions when you resize it. MsoFalse if you can change the height and width of the shape independently of one another when you resize it. Read/write MsoTriState.

Syntax

expression .LockAspectRatio

expression Required. A variable that represents a ShapeRange object.

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.Name Property (Word)

 Copy code hover
[image]

ShapeRange.Name Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the name of the specified object. Read/write String.

Syntax

expression .Name

expression Required. A variable that represents a ShapeRange object.

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.Nodes Property (Word)

 Copy code hover
[image]

ShapeRange.Nodes Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a ShapeNodes collection that represents the geometric description of the specified shape.

Syntax

expression .Nodes

expression Required. A variable that represents a ShapeRange object.

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.Parent Property (Word)

 Copy code hover
[image]

ShapeRange.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified ShapeRange object.

Syntax

expression .Parent

expression Required. A variable that represents a ShapeRange object.

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.ParentGroup Property (Word)

 Copy code hover
[image]

ShapeRange.ParentGroup Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Shape object that represents the common parent shape of a range of shapes.

Syntax

expression .ParentGroup

expression Required. A variable that represents a ShapeRange object.

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.PictureFormat Property (Word)

 Copy code hover
[image]

ShapeRange.PictureFormat Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a PictureFormat object that contains picture formatting properties for the specified range of shapes. Read-only.

Syntax

expression .PictureFormat

expression A variable that represents a ShapeRange object.

Remarks

Applies to ShapeRange objects that represent pictures or OLE objects.

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.Reflection Property (Word)

 Copy code hover
[image]

ShapeRange.Reflection Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a ReflectionFormat object that represents the reflection formatting for a range of shapes. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Reflection

expression An expression that returns a ShapeRange object.

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.RelativeHorizontalPosition Property (Word)

 Copy code hover
[image]

ShapeRange.RelativeHorizontalPosition Property (Word)
See also Send feedback

Published: July 16, 2012

Specifies the relative horizontal position of a range of shapes. Read/write WdRelativeHorizontalPosition.

Syntax

expression .RelativeHorizontalPosition

expression An expression that represents a ShapeRange object.

Example

This example repositions the selected shape object.

VBA Copy code Copy code
With Selection.ShapeRange
 .Left = InchesToPoints(0.6)
 .RelativeHorizontalPosition = wdRelativeHorizontalPositionPage
 .Top = InchesToPoints(1)
 .RelativeVerticalPosition = wdRelativeVerticalPositionParagraph
End With

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.RelativeHorizontalSize Property (Word)

 Copy code hover
[image]

ShapeRange.RelativeHorizontalSize Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a WdRelativeHorizontalSize constant that represents the object to which a range of shapes is relative. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .RelativeHorizontalSize

expression An expression that returns a ShapeRange object.

Remarks

Use this property with the WidthRelative property.

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.RelativeVerticalPosition Property (Word)

 Copy code hover
[image]

ShapeRange.RelativeVerticalPosition Property (Word)
See also Send feedback

Published: July 16, 2012

Specifies the relative vertical position of a range of shapes. Read/write WdRelativeHorizontalPosition.

Syntax

expression .RelativeVerticalPosition

expression An expression that represents a ShapeRange object.

Example

This example repositions the selected shape object.

VBA Copy code Copy code
With Selection.ShapeRange
 .Left = InchesToPoints(0.6)
 .RelativeHorizontalPosition = wdRelativeHorizontalPositionPage
 .Top = InchesToPoints(1)
 .RelativeVerticalPosition = wdRelativeVerticalPositionParagraph
End With

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.RelativeVerticalSize Property (Word)

 Copy code hover
[image]

ShapeRange.RelativeVerticalSize Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a WdRelativeVerticalSize constant that represents the object to which a range of shapes is relative. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .RelativeVerticalSize

expression An expression that returns a ShapeRange object.

Remarks

Use this property with the HeightRelative property.

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.Rotation Property (Word)

 Copy code hover
[image]

ShapeRange.Rotation Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the number of degrees the specified shape is rotated around the z-axis. Read/write Single.

Syntax

expression .Rotation

expression A variable that represents a ShapeRange object.

Remarks

A positive value indicates clockwise rotation; a negative value indicates counterclockwise rotation. To set the rotation of a three-dimensional shape around the x-axis or the y-axis, use the RotationX property or the RotationY property of the ThreeDFormat object.

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.Shadow Property (Word)

 Copy code hover
[image]

ShapeRange.Shadow Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a ShadowFormat object that represents the shadow formatting for the specified shape.

Syntax

expression .Shadow

expression Required. A variable that represents a ShapeRange object.

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.ShapeStyle Property (Word)

 Copy code hover
[image]

ShapeRange.ShapeStyle Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the shape style for the shapes in the specified shape range. Read/write MsoShapeStyleIndex.

Version Information

Version Added: Word 2010

Syntax

expression .ShapeStyle

expression A variable that represents a ShapeRange object.

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.SoftEdge Property (Word)

 Copy code hover
[image]

ShapeRange.SoftEdge Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a SoftEdgeFormat object that represents the soft edge formatting for a range of shapes. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .SoftEdge

expression An expression that returns a ShapeRange object.

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.TextEffect Property (Word)

 Copy code hover
[image]

ShapeRange.TextEffect Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a TextEffectFormat object that contains text-effect formatting properties for the specified shape. Read-only.

Syntax

expression .TextEffect

expression A variable that represents a ShapeRange object.

Remarks

Applies to ShapeRange objects that represent WordArt.

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.TextFrame Property (Word)

 Copy code hover
[image]

ShapeRange.TextFrame Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a TextFrame object that contains the text for the specified range of shapes.

Syntax

expression .TextFrame

expression A variable that represents a ShapeRange object.

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.TextFrame2 Property (Word)

 Copy code hover
[image]

ShapeRange.TextFrame2 Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a TextFrame2 object that contains the text for the specified range of shapes. Read-only.

Syntax

expression .TextFrame2

expression An expression that returns a ShapeRange object.

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.ThreeD Property (Word)

 Copy code hover
[image]

ShapeRange.ThreeD Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a ThreeDFormat object that contains 3-D formatting properties for the specified range of shapes. Read-only.

Syntax

expression .ThreeD

expression A variable that represents a ShapeRange object.

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.Title Property (Word)

 Copy code hover
[image]

ShapeRange.Title Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a String that contains a title for the shapes in the specified shape range. Read/write.

Version Information

Version Added: Word 2010

Syntax

expression .Title

expression A variable that represents a ShapeRange object.

Remarks

Use the Title property to provide an alternative text title for a shape. This property adds title text to the Title text box on the Alt Text pane of the Format Shape dialog in Word 2010.

Note Note

Web browsers display alternative text while tables are loading or if they are missing. Web search engines use the alternative text to help find Web pages. Alternative text is also used to assist disabilities.

Example

The following code example adds an alternative text title to the first and third shapes in the active document.

VBA Copy code Copy code
ActiveDocument.Shapes.Range(Array(1, 3)).Title = "Part of a shape array."

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.Top Property (Word)

 Copy code hover
[image]

ShapeRange.Top Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the vertical position of the specified shape or shape range in points. Read/write Single.

Syntax

expression .Top

expression Required. A variable that represents a ShapeRange object.

Remarks

The position of a shape is measured from the upper-left corner of the shape's bounding box to the shape's anchor. The RelativeVerticalPosition property controls whether the shape's anchor is positioned alongside the line, the paragraph, the margin, or the edge of the page.

For a ShapeRange object that contains more than one shape, the Top property sets the vertical position of each shape.

Example

This example sets the vertical position of the first and second shapes in the active document to 1 inch from the top of the page.

VBA Copy code Copy code
With ActiveDocument.Shapes.Range(Array(1, 2))
 .RelativeVerticalPosition = wdRelativeVerticalPositionPage
 .Top = InchesToPoints(1)
End With

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.TopRelative Property (Word)

 Copy code hover
[image]

ShapeRange.TopRelative Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Single that represents the relative top position of a range of shapes. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .TopRelative

expression An expression that returns a ShapeRange object.

Remarks

Use this property with the RelativeVerticalPosition property. When set to wdShapePositionRelativeNone (-999999) (see the WdShapePositionRelative enumeration), this property should be ignored because the shape does not use percent positioning. The vertical position is solely determined by the Top property.

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.Type Property (Word)

 Copy code hover
[image]

ShapeRange.Type Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the shape type. Read-only MsoShapeType.

Syntax

expression .Type

expression Required. A variable that represents a ShapeRange object.

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.VerticalFlip Property (Word)

 Copy code hover
[image]

ShapeRange.VerticalFlip Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified shape is flipped around the vertical axis. Read-only MsoTriState.

Syntax

expression .VerticalFlip

expression Required. A variable that represents a ShapeRange object.

Example

This example restores each shape on myDocument to its original state if it has been flipped horizontally or vertically.

VBA Copy code Copy code
For Each s In ActiveDocument.Range.ShapeRange
 If s.HorizontalFlip Then s.Flip msoFlipHorizontal
 If s.VerticalFlip Then s.Flip msoFlipVertical
Next

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.Vertices Property (Word)

 Copy code hover
[image]

ShapeRange.Vertices Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the coordinates of the specified freeform drawing's vertices (and control points for Bézier curves) as a series of coordinate pairs. You can use the array returned by this property as an argument for the AddCurve or AddPolyLine method. Read-only Variant.

Syntax

expression .Vertices

expression Required. A variable that represents a ShapeRange object.

Remarks

The following table shows how the Vertices property associates values in the array vertArray() with the coordinates of a triangle's vertices.

vertArray element

Contains

VBA Copy code Copy code
vertArray(1, 1)

The horizontal distance from the first vertex to the left side of the document.

VBA Copy code Copy code
vertArray(1, 2)

The vertical distance from the first vertex to the top of the document.

VBA Copy code Copy code
vertArray(2, 1)

The horizontal distance from the second vertex to the left side of the document.

VBA Copy code Copy code
vertArray(2, 2)

The vertical distance from the second vertex to the top of the document.

VBA Copy code Copy code
vertArray(3, 1)

The horizontal distance from the third vertex to the left side of the document.

VBA Copy code Copy code
vertArray(3, 2)

The vertical distance from the third vertex to the top of the document.

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.Visible Property (Word)

 Copy code hover
[image]

ShapeRange.Visible Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified object, or the formatting applied to it, is visible. Read/write MsoTriState.

Syntax

expression .Visible

expression Required. A variable that represents a ShapeRange object.

Remarks

Some methods and properties may be unavailable if the Visible property is False.

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.Width Property (Word)

 Copy code hover
[image]

ShapeRange.Width Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the width, in points, of the shapes within the range. Read/write Long.

Syntax

expression .Width

expression A variable that represents a ShapeRange object.

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.WidthRelative Property (Word)

 Copy code hover
[image]

ShapeRange.WidthRelative Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Single that represents the relative width of a range of shapes. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .WidthRelative

expression An expression that returns a ShapeRange object.

Remarks

Use this property with the RelativeHorizontalSize property. When set to wdShapeSizeRelativeNone (-999999) (see the WdShapeSizeRelative enumeration), this property should be ignored because the shape does not use percent sizing. The width is solely determined by the Width property.

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.WrapFormat Property (Word)

 Copy code hover
[image]

ShapeRange.WrapFormat Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a WrapFormat object that contains the properties for wrapping text around the specified range of shapes. Read-only.

Syntax

expression .WrapFormat

expression A variable that represents a ShapeRange object.

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.ZOrderPosition Property (Word)

 Copy code hover
[image]

ShapeRange.ZOrderPosition Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the position of the specified shape in the z-order. Read-only.

Syntax

expression .ZOrderPosition

expression An expression that returns a ShapeRange object.

Remarks

Shapes(1) returns the shape at the back of the z-order, and Shapes(Shapes.Count) returns the shape at the front of the z-order. This property is read-only. To set the shape's position in the z-order, use the ZOrder method.

A shape's position in the z-order corresponds to the shape's index number in the Shapes collection. For example, if there are four shapes on myDocument, the expression myDocument.Shapes(1) returns the shape at the back of the z-order, and the expression myDocument.Shapes(4) returns the shape at the front of the z-order.

Whenever you add a new shape to a collection, it is added to the front of the z-order by default.

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange Methods (Word)

 Copy code hover
[image]

ShapeRange Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Align | Aligns the shapes in the specified range of shapes.
Apply | Applies to the specified shape formatting that has been copied using the PickUp method.
CanvasCropBottom | Crops a percentage of the height of a drawing canvas from the bottom of the canvas.
CanvasCropLeft | Crops a percentage of the width of a drawing canvas from the left side of the canvas.
CanvasCropRight | Crops a percentage of the width of a drawing canvas from the right side of the canvas.
CanvasCropTop | Crops a percentage of the height of a drawing canvas from the top of the canvas.
ConvertToInlineShape | Converts the specified shape in the drawing layer of a document to an inline shape in the text layer. You can convert only shapes that represent pictures, OLE objects, or ActiveX controls. .
Delete | Deletes the specified range of shapes.
Distribute | Evenly distributes the shapes in the specified range of shapes. .
Duplicate | Creates a duplicate of the specified ShapeRange object, adds the new range of shapes to the Shapes collection at a standard offset from the original shapes, and then returns a Shape object.
Flip | Flips a shape horizontally or vertically.
Group | Groups the shapes in the specified range, and returns the grouped shapes as a single Shape object.
IncrementLeft | Moves the specified shape horizontally by the specified number of points.
IncrementRotation | Changes the rotation of the specified shape around the z-axis by the specified number of degrees. .
IncrementTop | Moves the specified shape vertically by the specified number of points.
Item | Returns an individual Shape object in a collection.
PickUp | Copies the formatting of the specified shape.
ScaleHeight | Scales the height of a range of shapes by a specified factor.
ScaleWidth | Scales the width of a shape by a specified factor.
Select | Selects the specified range of shapes.
SetShapesDefaultProperties | Applies the formatting of a default shape for a document to the specified range of shapes.
Ungroup | Ungroups any grouped shapes in the specified range of shapes, disassembles pictures and OLE objects within the specified shape or range of shapes, and returns the ungrouped shapes as a single ShapeRange object.
ZOrder | Moves the specified shape range in front of or behind other shapes in the collection (that is, changes the shape range's position in the z-order).


ShapeRange.Align Method (Word)

 Copy code hover
[image]

ShapeRange.Align Method (Word)
See also Send feedback

Published: July 16, 2012

Aligns the shapes in the specified range of shapes.

Syntax

expression .Align(Align, RelativeTo)

expression Required. A variable that represents a ShapeRange object.

Parameters

Name | Required/Optional | Data Type | Description
Align | Required | MsoAlignCmd | Specifies the way the shapes in the specified shape range are to be aligned.
RelativeTo | Required | Long | True to align shapes relative to the edge of the document. False to align shapes relative to one another.

Example

This example aligns the left edges of all the shapes in the selection of shapes in the active document with the left edge of the leftmost shape in the range.

VBA Copy code Copy code
Set myShapeRange = Selection.ShapeRange
myShapeRange.Align msoAlignLefts, False

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.Apply Method (Word)

 Copy code hover
[image]

ShapeRange.Apply Method (Word)
See also Send feedback

Published: July 16, 2012

Applies to the specified shape formatting that has been copied using the PickUp method.

Syntax

expression .Apply

expression Required. A variable that represents a ShapeRange object.

Remarks

If formatting for the ShapeRange object has not previously been copied using the PickUp method, using the Apply method generates an error.

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.CanvasCropBottom Method (Word)

 Copy code hover
[image]

ShapeRange.CanvasCropBottom Method (Word)
See also Send feedback

Published: July 16, 2012

Crops a percentage of the height of a drawing canvas from the bottom of the canvas.

Syntax

expression .CanvasCropBottom(Increment)

expression Required. A variable that represents a ShapeRange object.

Parameters

Name | Required/Optional | Data Type | Description
Increment | Required | Single | The amount in percentage points of a drawing canvas's height that you want remaining after the canvas is cropped. Entering 0.9 as the increment crops ten percent of the canvas's height from the bottom. Entering 0.1 crops ninety percent of the canvas's height from the bottom.

Example

This example crops twenty-five percent of the drawing canvas's height from the bottom of the first canvas in the active document, assuming the first shape in the active document is a drawing canvas. If not, you will need to add a drawing canvas to the document using the AddCanvas method.

VBA Copy code Copy code
Sub CropCanvasBottom()
 Dim shpCanvas As Shape

 Set shpCanvas = ActiveDocument.Shapes(1)
 shpCanvas.CanvasCropBottom Increment:=0.75
End Sub

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.CanvasCropLeft Method (Word)

 Copy code hover
[image]

ShapeRange.CanvasCropLeft Method (Word)
See also Send feedback

Published: July 16, 2012

Crops a percentage of the width of a drawing canvas from the left side of the canvas.

Syntax

expression .CanvasCropBottom(Increment)

expression Required. A variable that represents a ShapeRange object.

Parameters

Name | Required/Optional | Data Type | Description
Increment | Required | Single | The amount in percentage points of the drawing canvas's width that you want remaining after the canvas is cropped. Entering 0.9 as the increment crops ten percent of the canvas's width from the left. Entering 0.1 crops ninety percent of the canvas's width from the left.

Example

This example crops twenty-five percent of the drawing canvas's width from the left side of the first canvas in the active document, assuming the first shape in the active document is a drawing canvas. If not, you will need to add a drawing canvas to the document using the AddCanvas method.

VBA Copy code Copy code
Sub CropCanvasLeft()
 Dim shpCanvas As Shape

 Set shpCanvas = ActiveDocument.Shapes(1)
 shpCanvas.CanvasCropLeft Increment:=0.75
End Sub

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.CanvasCropRight Method (Word)

 Copy code hover
[image]

ShapeRange.CanvasCropRight Method (Word)
See also Send feedback

Published: July 16, 2012

Crops a percentage of the width of a drawing canvas from the right side of the canvas.

Syntax

expression .CanvasCropBottom(Increment)

expression Required. A variable that represents a ShapeRange object.

Parameters

Name | Required/Optional | Data Type | Description
Increment | Required | Single | The amount in percentage points of the canvas's width that you want remaining after the canvas is cropped. Entering 0.9 as the increment crops ten percent of the canvas's width from the right. Entering 0.1 crops ninety percent of the canvas's width from the right.

Example

This example crops twenty-five percent of the drawing canvas's width from the right side of the first canvas in the active document, assuming the first shape in the active document is a drawing canvas. If not, you will need to add a drawing canvas to the document using the AddCanvas method.

VBA Copy code Copy code
Sub CropCanvasRight()
 Dim shpCanvas As Shape

 Set shpCanvas = ActiveDocument.Shapes(1)
 shpCanvas.CanvasCropRight Increment:=0.75
End Sub

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.CanvasCropTop Method (Word)

 Copy code hover
[image]

ShapeRange.CanvasCropTop Method (Word)
See also Send feedback

Published: July 16, 2012

Crops a percentage of the height of a drawing canvas from the top of the canvas.

Syntax

expression .CanvasCropBottom(Increment)

expression Required. A variable that represents a ShapeRange object.

Parameters

Name | Required/Optional | Data Type | Description
Increment | Required | Single | The amount in percentage points of a canvas's height that you want remaining after the canvas is cropped. Entering 0.9 as the increment crops ten percent of the canvas's height from the top. Entering 0.1 crops ninety percent of the canvas's height from the top.

Example

This example crops twenty-five percent of the drawing canvas's height from the top of the first canvas in the active document, assuming the first shape in the active document is a drawing canvas. If not, you will need to add a drawing canvas to the document using the AddCanvas method.

VBA Copy code Copy code
Sub CropCanvasTop()
 Dim shpCanvas As Shape

 Set shpCanvas = ActiveDocument.Shapes(1)
 shpCanvas.CanvasCropTop Increment:=0.75
End Sub

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.ConvertToInlineShape Method (Word)

 Copy code hover
[image]

ShapeRange.ConvertToInlineShape Method (Word)
See also Send feedback

Published: July 16, 2012

Converts the specified shape in the drawing layer of a document to an inline shape in the text layer. You can convert only shapes that represent pictures, OLE objects, or ActiveX controls. .

Syntax

expression .ConvertToInlineShape

expression Required. A variable that represents a ShapeRange object.

Return Value

InlineShape

Remarks

Shapes that support attached text cannot be converted to inline shapes. For these shapes, use the ConvertToFrame method.

If you use this method on a ShapeRange object that contains more than one shape, an error occurs.

Example

This example converts each picture in MyDoc.doc to an inline shape.

VBA Copy code Copy code
For Each s In Documents("MyDoc.doc").Shapes
 If s.Type = msoPicture Then
 s.ConvertToInlineShape
 End If
Next s

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.Delete Method (Word)

 Copy code hover
[image]

ShapeRange.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the specified range of shapes.

Syntax

expression .Delete

expression Required. A variable that represents a ShapeRange object.

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.Distribute Method (Word)

 Copy code hover
[image]

ShapeRange.Distribute Method (Word)
See also Send feedback

Published: July 16, 2012

Evenly distributes the shapes in the specified range of shapes. .

Syntax

expression .Distribute(Distribute, RelativeTo)

expression Required. A variable that represents a ShapeRange object.

Parameters

Name | Required/Optional | Data Type | Description
Distribute | Required | MsoDistributeCmd | Specifies whether to distribute shapes horizontally or vertically.
RelativeTo | Required | Long | True to distribute the shapes evenly over the entire horizontal or vertical space on the page. False to distribute them within the horizontal or vertical space that the range of shapes originally occupies.

Remarks

You can specify whether you want to distribute the shapes horizontally or vertically and whether you want to distribute them over the entire page or just over the space they originally occupy.

Example

This example defines a shape range that contains all the AutoShapes on the active document and then horizontally distributes the shapes in this range.

VBA Copy code Copy code
With ActiveDocument.Shapes
 numShapes = .Count
 If numShapes > 1 Then
 numAutoShapes = 0
 ReDim autoShpArray(1 To numShapes)
 For i = 1 To numShapes
 If .Item(i).Type = msoAutoShape Then
 numAutoShapes = numAutoShapes + 1
 autoShpArray(numAutoShapes) = .Item(i).Name
 End If
 Next
 If numAutoShapes > 1 Then
 ReDim Preserve autoShpArray(1 To numAutoShapes)
 Set asRange = .Range(autoShpArray)
 asRange.Distribute msoDistributeHorizontally, False
 End If
 End If
End With

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.Duplicate Method (Word)

 Copy code hover
[image]

ShapeRange.Duplicate Method (Word)
See also Send feedback

Published: July 16, 2012

Creates a duplicate of the specified ShapeRange object, adds the new range of shapes to the Shapes collection at a standard offset from the original shapes, and then returns a Shape object.

Syntax

expression .Duplicate

expression Required. A variable that represents a ShapeRange object.

Example

This example creates a duplicate of shape one on the active document and then changes the fill for the new shape.

VBA Copy code Copy code
Set newShape = ActiveDocument.Shapes(1).Duplicate
With newShape
 .Fill.PresetGradient msoGradientVertical, 1, msoGradientGold
End With

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.Flip Method (Word)

 Copy code hover
[image]

ShapeRange.Flip Method (Word)
See also Send feedback

Published: July 16, 2012

Flips a shape horizontally or vertically.

Syntax

expression .Flip(FlipCmd)

expression Required. A variable that represents a ShapeRange object.

Parameters

Name | Required/Optional | Data Type | Description
FlipCmd | Required | MsoFlipCmd | The flip orientation.

Example

This example adds a triangle to the active document, duplicates the triangle, and then flips the duplicate triangle vertically and makes it red.

VBA Copy code Copy code
Sub FlipShape()
 With ActiveDocument.Shapes.AddShape( _
 Type:=msoShapeRightTriangle, Left:=150, _
 Top:=150, Width:=50, Height:=50).Duplicate
 .Fill.ForeColor.RGB = RGB(Red:=255, Green:=0, Blue:=0)
 .Flip msoFlipVertical
 End With
End Sub

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.Group Method (Word)

 Copy code hover
[image]

ShapeRange.Group Method (Word)
See also Send feedback

Published: July 16, 2012

Groups the shapes in the specified range, and returns the grouped shapes as a single Shape object.

Syntax

expression .Group

expression Required. A variable that represents a ShapeRange object.

Remarks

Because a group of shapes is treated as a single shape, grouping and ungrouping shapes changes the number of items in the Shapes collection and changes the index numbers of items that come after the affected items in the collection.

Example

This example adds two shapes to myDocument, groups the two new shapes, sets the fill for the group, rotates the group, and sends the group to the back of the drawing layer.

VBA Copy code Copy code
Set myDocument = ActiveDocument
With myDocument.Shapes
 .AddShape(msoShapeCan, 50, 10, 100, 200).Name = "shpOne"
 .AddShape(msoShapeCube, 150, 250, 100, 200).Name = "shpTwo"
 With .Range(Array("shpOne", "shpTwo")).Group
 .Fill.PresetTextured msoTextureBlueTissuePaper
 .Rotation = 45
 .ZOrder msoSendToBack
 End With
End With

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.IncrementLeft Method (Word)

 Copy code hover
[image]

ShapeRange.IncrementLeft Method (Word)
See also Send feedback

Published: July 16, 2012

Moves the specified shape horizontally by the specified number of points.

Syntax

expression .IncrementLeft(Increment)

expression Required. A variable that represents a ShapeRange object.

Parameters

Name | Required/Optional | Data Type | Description
Increment | Required | Single | Specifies how far the shape is to be moved horizontally, in points. A positive value moves the shape to the right; a negative value moves it to the left.

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.IncrementRotation Method (Word)

 Copy code hover
[image]

ShapeRange.IncrementRotation Method (Word)
See also Send feedback

Published: July 16, 2012

Changes the rotation of the specified shape around the z-axis by the specified number of degrees. .

Syntax

expression .IncrementRotation(Increment)

expression Required. A variable that represents a ShapeRange object.

Parameters

Name | Required/Optional | Data Type | Description
Increment | Required | Single | Specifies how far the shape is to be rotated horizontally, in degrees. A positive value rotates the shape clockwise; a negative value rotates it counterclockwise.

Remarks

Use the Rotation property to set the absolute rotation of the shape. To rotate a three-dimensional shape around the x-axis or the y-axis, use the IncrementRotationX or IncrementRotationY method of the ThreeDFormat.

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.IncrementTop Method (Word)

 Copy code hover
[image]

ShapeRange.IncrementTop Method (Word)
See also Send feedback

Published: July 16, 2012

Moves the specified shape vertically by the specified number of points.

Syntax

expression .IncrementTop(Increment)

expression Required. A variable that represents a ShapeRange object.

Parameters

Name | Required/Optional | Data Type | Description
Increment | Required | Single | Specifies how far the shape object is to be moved vertically, in points. A positive value moves the shape down; a negative value moves it up.

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.Item Method (Word)

 Copy code hover
[image]

ShapeRange.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual Shape object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents a ShapeRange object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The individual object to be returned. Can be a Long indicating the ordinal position or a String representing the name of the individual object.

Return Value

Shape

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.PickUp Method (Word)

 Copy code hover
[image]

ShapeRange.PickUp Method (Word)
See also Send feedback

Published: July 16, 2012

Copies the formatting of the specified shape.

Syntax

expression .PickUp

expression Required. A variable that represents a ShapeRange object.

Remarks

Use the Apply method to apply the copied formatting to another shape.

Example

This example copies the formatting of shape one on myDocument and then applies the copied formatting to shape two.

VBA Copy code Copy code
Set myDocument = ActiveDocument
With myDocument
 .Shapes(1).PickUp
 .Shapes(2).Apply
End With

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.ScaleHeight Method (Word)

 Copy code hover
[image]

ShapeRange.ScaleHeight Method (Word)
See also Send feedback

Published: July 16, 2012

Scales the height of a range of shapes by a specified factor.

Syntax

expression .ScaleHeight(Factor, RelativeToOriginalSize, Scale)

expression Required. A variable that represents a ShapeRange object.

Parameters

Name | Required/Optional | Data Type | Description
Factor | Required | Single | Specifies the ratio between the height of the shape after you resize it and the current or original height. For example, to make a rectangle 50 percent larger, specify 1.5 for this argument.
RelativeToOriginalSize | Required | MsoTriState | True to scale the shape relative to its original size. False to scale it relative to its current size. You can specify True for this argument only if the specified shape is a picture or an OLE object.
Scale | Optional | MsoScaleFrom | The part of the shape that retains its position when the shape is scaled.

Remarks

For pictures and OLE objects, you can indicate whether you want to scale the shape relative to the original size or relative to the current size. Shapes other than pictures and OLE objects are always scaled relative to their current height.

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.ScaleWidth Method (Word)

 Copy code hover
[image]

ShapeRange.ScaleWidth Method (Word)
See also Send feedback

Published: July 16, 2012

Scales the width of a shape by a specified factor.

Syntax

expression .ScaleWidth(Factor, RelativeToOriginalSize, Scale)

expression Required. A variable that represents a ShapeRange object.

Parameters

Name | Required/Optional | Data Type | Description
Factor | Required | Single | Specifies the ratio between the width of the shape after you resize it and the current or original width. For example, to make a rectangle 50 percent larger, specify 1.5 for this argument.
RelativeToOriginalSize | Required | MsoTriState | True to scale the shape relative to its original size. False to scale it relative to its current size. You can specify True for this argument only if the specified shape is a picture or an OLE object.
Scale | Optional | MsoScaleFrom | The part of the shape that retains its position when the shape is scaled.

Remarks

For pictures and OLE objects, you can indicate whether you want to scale the range of shapes relative to the original size or relative to the current size. Shapes other than pictures and OLE objects are always scaled relative to their current width.

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.Select Method (Word)

 Copy code hover
[image]

ShapeRange.Select Method (Word)
See also Send feedback

Published: July 16, 2012

Selects the specified range of shapes.

Syntax

expression .Select(Replace)

expression Required. A variable that represents a ShapeRange object.

Parameters

Name | Required/Optional | Data Type | Description
Replace | Optional | Variant | If adding a shape, True replaces the selection. False adds the new shape to the selection.

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.SetShapesDefaultProperties Method (Word)

 Copy code hover
[image]

ShapeRange.SetShapesDefaultProperties Method (Word)
See also Send feedback

Published: July 16, 2012

Applies the formatting of a default shape for a document to the specified range of shapes.

Syntax

expression .SetShapesDefaultProperties

expression Required. A variable that represents a ShapeRange object.

Remarks

New shapes inherit many of their attributes from the default shape.

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.Ungroup Method (Word)

 Copy code hover
[image]

ShapeRange.Ungroup Method (Word)
See also Send feedback

Published: July 16, 2012

Ungroups any grouped shapes in the specified range of shapes, disassembles pictures and OLE objects within the specified shape or range of shapes, and returns the ungrouped shapes as a single ShapeRange object.

Syntax

expression .Ungroup

expression Required. A variable that represents a ShapeRange object.

Return Value

ShapeRange

Remarks

Because a group of shapes is treated as a single object, grouping and ungrouping shapes changes the number of items in the Shapes collection and changes the index numbers of items that come after the ungrouped shapes in the collection.

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


ShapeRange.ZOrder Method (Word)

 Copy code hover
[image]

ShapeRange.ZOrder Method (Word)
See also Send feedback

Published: July 16, 2012

Moves the specified shape range in front of or behind other shapes in the collection (that is, changes the shape range's position in the z-order).

Syntax

expression .ZOrder(ZOrderCmd)

expression An expression that returns a ShapeRange object.

Parameters

Name | Required/Optional | Data Type | Description
ZOrderCmd | Required | MsoZOrderCmd | Specifies where to move the specified shape range relative to the other shapes.

Return Value

Nothing

Remarks

Use the ZOrderPosition property to determine a shape range's current position in the z-order.

See also

Concepts

ShapeRange Collection Object

Other resources

ShapeRange Object Members


Shapes Object (Word)

 Copy code hover
[image]

Shapes Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of Shape objects that represent all the shapes in a document or all the shapes in all the headers and footers in a document. Each Shape object represents an object in the drawing layer, such as an AutoShape, freeform, OLE object, or picture.

Remarks

If you want to work with a subset of the shapes on a document — for example, to do something to only the AutoShapes on the document or to only the selected shapes — you must construct a ShapeRange collection that contains the shapes you want to work with.

Use the Shapes property to return the Shapes collection. The following example selects all the shapes on the active document.

VBA Copy code Copy code
ActiveDocument.Shapes.SelectAll
Note Note

If you want to do something (like delete or set a property) to all the shapes on a document at the same time, use the Range method to create a ShapeRange object that contains all the shapes in the Shapes collection, and then apply the appropriate property or method to the ShapeRange object.

Use one of the following methods of the Shapes collection: AddCallout, AddCurve, AddLabel, AddLine, AddOleControl, AddOleObject, AddPolyline, AddShape, AddTextbox, AddTextEffect, or BuildFreeForm to add a shape to a document return a Shape object that represents the newly created shape The following example adds a rectangle to the active document.

VBA Copy code Copy code
ActiveDocument.Shapes.AddShape msoShapeRectangle, 50, 50, 100, 200

Use Shapes(Index), where Index is the name or the index number, to return a single Shape object. The following example horizontally flips shape one on the active document.

VBA Copy code Copy code
ActiveDocument.Shapes(1).Flip msoFlipHorizontal

This example horizontally flips the shape named "Rectangle 1" on the active document.

VBA Copy code Copy code
ActiveDocument.Shapes("Rectangle 1").Flip msoFlipHorizontal

Each shape is assigned a default name when it is created. For example, if you add three different shapes to a document, they might be named "Rectangle 2," "TextBox 3," and "Oval 4." To give a shape a more meaningful name, set the Name property.

The Shapes collection does not include InlineShape objects. InlineShape objects are treated like characters and are positioned as characters within a line of text. Shape objects are anchored to a range of text but are free-floating and can be positioned anywhere on the page. You can use the ConvertToInlineShape method and the ConvertToShape method to convert shapes from one type to the other. You can convert only pictures, OLE objects, and ActiveX controls to inline shapes.

The Count property for this collection in a document returns the number of items in the main story only. To count the shapes in all the headers and footers, use the Shapes collection with any HeaderFooter object.

See also

Concepts

Word Object Model Reference

Other resources

Shapes Object Members


Shapes Members (Word)

 Copy code hover
[image]

Shapes Members (Word)
Send feedback

Published: July 16, 2012

A collection of Shape objects that represent all the shapes in a document or all the shapes in all the headers and footers in a document. Each Shape object represents an object in the drawing layer, such as an AutoShape, freeform, OLE object, or picture.

Methods

Name | Description
AddCallout | Adds a borderless line callout to a drawing canvas. .
AddCanvas | Adds a drawing canvas to a document. Returns a Shape object that represents the drawing canvas and adds it to the Shapes collection.
AddChart2 | Adds a chart to the document. Returns a Shape object that represents a chart and adds it to the specified collection.
AddCurve | Returns a Shape object that represents a Bézier curve in a drawing canvas.
AddLabel | Adds a text label to a drawing canvas.
AddLine | Adds a line to a drawing canvas.
AddOLEControl | Creates an ActiveX control (formerly known as an OLE control). Returns the InlineShape object that represents the new ActiveX control.
AddOLEObject | Creates an OLE object. Returns the InlineShape object that represents the new OLE object.
AddPicture | Adds a picture to a drawing canvas. Returns a Shape object that represents the picture and adds it to the CanvasShapes collection.
AddPolyline | Adds an open or closed polygon to a drawing canvas. Returns a Shape object that represents the polygon and adds it to the CanvasShapes collection.
AddShape | Adds an AutoShape to a document. Returns a Shape object that represents the AutoShape and adds it to the Shapes collection.
AddSmartArt | Inserts the specified SmartArt graphic into the active document.
AddTextbox | Adds a text box to a drawing canvas.
AddTextEffect | Adds a WordArt shape to a drawing canvas. Returns a Shape object that represents the WordArt and adds it to the CanvasShapes collection.
AddWebVideo | Adds a new web video to the document.
BuildFreeform | Builds a freeform object.
Item | Returns an individual Shape object in a collection.
Range | Returns a ShapeRange object that represents the shapes within a range.
SelectAll | Selects all the shapes in a collection of shapes.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of shapes in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified Shapes object.


Shapes Properties (Word)

 Copy code hover
[image]

Shapes Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of shapes in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified Shapes object.


Shapes.Application Property (Word)

 Copy code hover
[image]

Shapes.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a Shapes collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

Shapes Collection Object

Other resources

Shapes Object Members


Shapes.Count Property (Word)

 Copy code hover
[image]

Shapes.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of shapes in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents a Shapes collection.

See also

Concepts

Shapes Collection Object

Other resources

Shapes Object Members


Shapes.Creator Property (Word)

 Copy code hover
[image]

Shapes.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a Shapes collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Shapes Collection Object

Other resources

Shapes Object Members


Shapes.Parent Property (Word)

 Copy code hover
[image]

Shapes.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Shapes object.

Syntax

expression .Parent

expression Required. A variable that represents a Shapes collection.

See also

Concepts

Shapes Collection Object

Other resources

Shapes Object Members


Shapes Methods (Word)

 Copy code hover
[image]

Shapes Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
AddCallout | Adds a borderless line callout to a drawing canvas. .
AddCanvas | Adds a drawing canvas to a document. Returns a Shape object that represents the drawing canvas and adds it to the Shapes collection.
AddChart2 | Adds a chart to the document. Returns a Shape object that represents a chart and adds it to the specified collection.
AddCurve | Returns a Shape object that represents a Bézier curve in a drawing canvas.
AddLabel | Adds a text label to a drawing canvas.
AddLine | Adds a line to a drawing canvas.
AddOLEControl | Creates an ActiveX control (formerly known as an OLE control). Returns the InlineShape object that represents the new ActiveX control.
AddOLEObject | Creates an OLE object. Returns the InlineShape object that represents the new OLE object.
AddPicture | Adds a picture to a drawing canvas. Returns a Shape object that represents the picture and adds it to the CanvasShapes collection.
AddPolyline | Adds an open or closed polygon to a drawing canvas. Returns a Shape object that represents the polygon and adds it to the CanvasShapes collection.
AddShape | Adds an AutoShape to a document. Returns a Shape object that represents the AutoShape and adds it to the Shapes collection.
AddSmartArt | Inserts the specified SmartArt graphic into the active document.
AddTextbox | Adds a text box to a drawing canvas.
AddTextEffect | Adds a WordArt shape to a drawing canvas. Returns a Shape object that represents the WordArt and adds it to the CanvasShapes collection.
AddWebVideo | Adds a new web video to the document.
BuildFreeform | Builds a freeform object.
Item | Returns an individual Shape object in a collection.
Range | Returns a ShapeRange object that represents the shapes within a range.
SelectAll | Selects all the shapes in a collection of shapes.


Shapes.AddCallout Method (Word)

 Copy code hover
[image]

Shapes.AddCallout Method (Word)
See also Send feedback

Published: July 16, 2012

Adds a borderless line callout to a drawing canvas. .

Syntax

expression .AddCallout(Type, Left, Top, Width, Height)

expression Required. A variable that represents a Shapes collection.

Parameters

Name | Required/Optional | Data Type | Description
Type | Required | MsoCalloutType | The type of callout.
Left | Required | Single | The position, in points, of the left edge of the callout's bounding box.
Top | Required | Single | The position, in points, of the top edge of the callout's bounding box.
Width | Required | Single | The width, in points, of the callout's bounding box.
Height | Required | Single | The height, in points, of the callout's bounding box.

Return Value

Shape

Remarks

You can insert a greater variety of callouts, such as balloons and clouds, using the AddShape method.

Example

This example adds a callout to a newly created drawing canvas.

VBA Copy code Copy code
Sub NewCanvasCallout()
 Dim shpCanvas As Shape

 'Add drawing canvas to the active document
 Set shpCanvas = ActiveDocument.Shapes.AddCanvas _
 (Left:=150, Top:=150, Width:=200, Height:=300)

 'Add callout to the drawing canvas
 shpCanvas.CanvasItems.AddCallout _
 Type:=msoCalloutTwo, Left:=100, _
 Top:=40, Width:=150, Height:=75
End Sub

See also

Concepts

Shapes Collection Object

Other resources

Shapes Object Members


Shapes.AddCanvas Method (Word)

 Copy code hover
[image]

Shapes.AddCanvas Method (Word)
See also Send feedback

Published: July 16, 2012

Adds a drawing canvas to a document. Returns a Shape object that represents the drawing canvas and adds it to the Shapes collection.

Syntax

expression .AddCanvas(Left, Top, Width, Height, Anchor)

expression Required. A variable that represents a Shapes collection.

Parameters

Name | Required/Optional | Data Type | Description
Left | Required | Single | The position, in points, of the left edge of the drawing canvas, relative to the anchor.
Top | Required | Single | The position, in points, of the top edge of the drawing canvas, relative to the anchor.
Width | Required | Single | The width, in points, of the drawing canvas.
Height | Required | Single | The height, in points, of the drawing canvas.
Anchor | Optional | Variant | A Range object that represents the text to which the canvas is bound. If Anchor is specified, the anchor is positioned at the beginning of the first paragraph in the anchoring range. If this argument is omitted, the anchoring range is selected automatically and the canvas is positioned relative to the top and left edges of the page.

Return Value

Shape

Example

The following example adds a drawing canvas to a new document and formats the drawing canvas so it is inline with the text; then adds two shapes to the canvas, and formats the fill and line properties.

VBA Copy code Copy code
Sub AddInlineCanvas()
 Dim docNew As Document
 Dim shpCanvas As Shape

 Set docNew = Documents.Add

 'Add a drawing canvas to the new document
 Set shpCanvas = docNew.Shapes.AddCanvas( _
 Left:=150, Top:=150, Width:=70, Height:=70)
 shpCanvas.WrapFormat.Type = wdWrapInline

 'Add shapes to drawing canvas
 With shpCanvas.CanvasItems
 .AddShape msoShapeHeart, Left:=10, _
 Top:=10, Width:=50, Height:=60
 .AddLine BeginX:=0, BeginY:=0, _
 EndX:=70, EndY:=70
 End With
 With shpCanvas
 .CanvasItems(1).Fill.ForeColor _
 .RGB = RGB(Red:=255, Green:=0, Blue:=0)
 .CanvasItems(2).Line _
 .EndArrowheadStyle = msoArrowheadTriangle
 End With
End Sub

See also

Concepts

Shapes Collection Object

Other resources

Shapes Object Members


Shapes.AddChart2 Method (Word)

 Copy code hover
[image]

Shapes.AddChart2 Method (Word)
See also Send feedback

Published: July 16, 2012

Adds a chart to the document. Returns a Shape object that represents a chart and adds it to the specified collection.

Version information

Version Added: Word 2013

Syntax

expression .AddChart2(Style,Type,Left,Top,Width,Height,Anchor,NewLayout)

expression A variable that represents a Shapes object.

Parameters

Name | Required/Optional | Data type | Description
Style | Optional | INT32 | The chart style.
Type | Optional | XLCHARTTYPE | The type of chart.
Left | Optional | VARIANT | The position, in points, of the left edge of the chart, relative to the anchor.
Top | Optional | VARIANT | The position, in points, of the top edge of the chart, relative to the anchor.
Width | Optional | VARIANT | The width, in points, of the chart.
Height | Optional | VARIANT | The height, in points, of the chart.
Anchor | Optional | VARIANT | If NewLayout is true, the chart will be inserted by using the new dynamic formatting rules (Title is on, and Legend is on only if there are multiple series).
Type | Optional | XLCHARTTYPE |
Top | Optional | VARIANT |
Width | Optional | VARIANT |
Height | Optional | VARIANT |
Anchor | Optional | VARIANT |
NewLayout | Optional | VARIANT |

Return value

SHAPE

See also

Concepts

Shapes Collection

Other resources

Shapes Members


Shapes.AddCurve Method (Word)

 Copy code hover
[image]

Shapes.AddCurve Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a Shape object that represents a Bézier curve in a drawing canvas.

Syntax

expression .AddCurve(SafeArrayOfPoints)

expression Required. A variable that represents a Shapes collection.

Parameters

Name | Required/Optional | Data Type | Description
SafeArrayOfPoints | Required | Variant | An array of coordinate pairs that specifies the vertices and control points of the curve. The first point you specify is the starting vertex, and the next two points are control points for the first Bézier segment. Then, for each additional segment of the curve, you specify a vertex and two control points. The last point you specify is the ending vertex for the curve. Note that you must always specify 3n + 1 points, where n is the number of segments in the curve.

Return Value

Shape

Example

This example adds a Bézier curve to a new drawing canvas.

VBA Copy code Copy code
Sub CanvasBezier()

 Dim docNew As Document
 Dim shpCanvas As Shape
 Dim sngArray(1 To 7, 1 To 2) As Single

 Set docNew = Documents.Add

 'Create a new drawing canvas
 Set shpCanvas = docNew.Shapes.AddCanvas(Left:=100, _
 Top:=100, Width:=300, Height:=50)

 sngArray(1, 1) = 0
 sngArray(1, 2) = 0
 sngArray(2, 1) = 50
 sngArray(2, 2) = 50
 sngArray(3, 1) = 100
 sngArray(3, 2) = 0
 sngArray(4, 1) = 150
 sngArray(4, 2) = 50
 sngArray(5, 1) = 200
 sngArray(5, 2) = 0
 sngArray(6, 1) = 250
 sngArray(6, 2) = 50
 sngArray(7, 1) = 300
 sngArray(7, 2) = 0

 'Add Bezier curve to drawing canvas
 shpCanvas.CanvasItems.AddCurve _
 SafeArrayOfPoints:=sngArray

End Sub

See also

Concepts

Shapes Collection Object

Other resources

Shapes Object Members


Shapes.AddLabel Method (Word)

 Copy code hover
[image]

Shapes.AddLabel Method (Word)
See also Send feedback

Published: July 16, 2012

Adds a text label to a drawing canvas.

Syntax

expression .AddLabel(Orientation, Left, Top, Width, Height)

expression Required. A variable that represents a Shapes collection.

Parameters

Name | Required/Optional | Data Type | Description
Orientation | Required | MsoTextOrientation | The orientation of the text.
Left | Required | Single | The position, measured in points, of the left edge of the label relative to the left edge of the drawing canvas.
Top | Required | Single | The position, measured in points, of the top edge of the label relative to the top edge of the drawing canvas.
Width | Required | Single | The width of the label, in points.
Height | Required | Single | The height of the label, in points.

Return Value

Shapes

Example

This example adds a blue text label with the text "Hello World" to a new drawing canvas in the active document.

VBA Copy code Copy code
Sub NewCanvasTextLabel()
 Dim shpCanvas As Shape
 Dim shpLabel As Shape

 'Add a drawing canvas to the active document
 Set shpCanvas = ActiveDocument.Shapes.AddCanvas _
 (Left:=100, Top:=75, Width:=150, Height:=200)

 'Add a label to the drawing canvas
 Set
VBA Copy code Copy code
shpLabel = shpCanvas.CanvasItems.AddLabel _
 (Orientation:=msoTextOrientationHorizontal, _
 Left:=15, Top:=15, Width:=100, Height:=100)

 'Fill the label textbox with a color,
 'add text to the label and format it
 With
VBA Copy code Copy code
shpLabel
 With .Fill
 .BackColor.RGB = RGB(Red:=0, Green:=0, Blue:=192)
 'Make the fill visible
 .Visible = msoTrue
 End With
 With .TextFrame.TextRange
 .Text = "Hello World."
 .Bold = True
 .Font.Name = "Tahoma"
 End With
 End With
End Sub

See also

Concepts

Shapes Collection Object

Other resources

Shapes Object Members


Shapes.AddLine Method (Word)

 Copy code hover
[image]

Shapes.AddLine Method (Word)
See also Send feedback

Published: July 16, 2012

Adds a line to a drawing canvas.

Syntax

expression .AddLine(BeginX, BeginY, EndX, EndY)

expression Required. A variable that represents a Shapes collection.

Parameters

Name | Required/Optional | Data Type | Description
BeginX | Required | Single | The horizontal position, measured in points, of the line's starting point, relative to the drawing canvas.
BeginY | Required | Single | The vertical position, measured in points, of the line's starting point, relative to the drawing canvas.
EndX | Required | Single | The horizontal position, measured in points, of the line's endpoint, relative to the drawing canvas.
EndY | Required | Single | The vertical position, measured in points, of the line's endpoint, relative to the drawing canvas.

Return Value

Shape

Remarks

To create an arrow, use the Line property to format a line.

Example

This example adds a purple line with an arrow to a new drawing canvas.

VBA Copy code Copy code
Sub NewCanvasLine()
 Dim shpCanvas As Shape
 Dim shpLine As Shape

 'Add new drawing canvas to the active document
 Set shpCanvas = ActiveDocument.Shapes _
 .AddCanvas(Left:=100, Top:=75, _
 Width:=150, Height:=200)

 'Add a line to the drawing canvas
 Set shpLine = shpCanvas.CanvasItems.AddLine( _
 BeginX:=25, BeginY:=25, EndX:=150, EndY:=150)

 'Add an arrow to the line and sets the color to purple
 With shpLine.Line
 .BeginArrowheadStyle = msoArrowheadDiamond
 .BeginArrowheadWidth = msoArrowheadWide
 .ForeColor.RGB = RGB(Red:=150, Green:=0, Blue:=255)
 End With
End Sub

See also

Concepts

Shapes Collection Object

Other resources

Shapes Object Members


Shapes.AddOLEControl Method (Word)

 Copy code hover
[image]

Shapes.AddOLEControl Method (Word)
See also Send feedback

Published: July 16, 2012

Creates an ActiveX control (formerly known as an OLE control). Returns the InlineShape object that represents the new ActiveX control.

Syntax

expression .AddOLEControl(ClassType, Range)

expression Required. A variable that represents a Shapes collection.

Parameters

Name | Required/Optional | Data Type | Description
ClassType | Optional | Variant | The programmatic identifier for the ActiveX control to be created.
Range | Optional | Variant | The range where the ActiveX control will be placed in the text. The ActiveX control replaces the range, if the range isn't collapsed. If this argument is omitted, the Active X control is placed automatically.

Return Value

InlineShape

Remarks

ActiveX controls are represented as either Shape objects or InlineShape objects in Microsoft Word. To modify the properties for an ActiveX control, you use the Object property of the OLEFormat object for the specified shape or inline shape.

For information about available ActiveX control class types, see OLE Programmatic Identifiers.

See also

Concepts

Shapes Collection Object

Other resources

Shapes Object Members


Shapes.AddOLEObject Method (Word)

 Copy code hover
[image]

Shapes.AddOLEObject Method (Word)
See also Send feedback

Published: July 16, 2012

Creates an OLE object. Returns the InlineShape object that represents the new OLE object.

Syntax

expression .AddOLEObject(ClassType, FileName, LinkToFile, DisplayAsIcon, IconFileName, IconIndex, IconLabel, Range)

expression Required. A variable that represents a Shapes collection.

Parameters

Name | Required/Optional | Data Type | Description
ClassType | Optional | Variant | The name of the application used to activate the specified OLE object.
FileName | Optional | Variant | The file from which the object is to be created. If this argument is omitted, the current folder is used. You must specify either the ClassType or FileName argument for the object, but not both.
LinkToFile | Optional | Variant | True to link the OLE object to the file from which it was created. False to make the OLE object an independent copy of the file. If you specified a value for ClassType, the LinkToFile argument must be False. The default value is False.
DisplayAsIcon | Optional | Variant | True to display the OLE object as an icon. The default value is False.
IconFileName | Optional | Variant | The file that contains the icon to be displayed.
IconIndex | Optional | Variant | The index number of the icon within IconFileName. The order of icons in the specified file corresponds to the order in which the icons appear in the Change Icon dialog box when the Display as icon check box is selected. The first icon in the file has the index number 0 (zero). If an icon with the given index number doesn't exist in IconFileName, the icon with the index number 1 (the second icon in the file) is used. The default value is 0 (zero).
IconLabel | Optional | Variant | A label (caption) to be displayed beneath the icon.
Range | Optional | Variant | The range where the OLE object will be placed in the text. The OLE object replaces the range, unless the range is collapsed. If this argument is omitted, the object is placed automatically.

Return Value

InlineShape

Example

This example adds a new floating bitmap image to the active document. The bitmap is linked to another file.

VBA Copy code Copy code
ActiveDocument.Shapes.AddOLEObject _
 FileName:="c:\my documents\MyDrawing.bmp", _
 LinkToFile:=True

See also

Concepts

Shapes Collection Object

Other resources

Shapes Object Members


Shapes.AddPicture Method (Word)

 Copy code hover
[image]

Shapes.AddPicture Method (Word)
See also Send feedback

Published: July 16, 2012

Adds a picture to a drawing canvas. Returns a Shape object that represents the picture and adds it to the CanvasShapes collection.

Syntax

expression .AddPicture(FileName, LinkToFile, SaveWithDocument, Left, Top, Width, Height)

expression Required. A variable that represents a Shapes collection.

Parameters

Name | Required/Optional | Data Type | Description
FileName | Required | String | The path and file name of the picture.
LinkToFile | Optional | Variant | True to link the picture to the file from which it was created. False to make the picture an independent copy of the file. The default value is False.
SaveWithDocument | Optional | Variant | True to save the linked picture with the document. The default value is False.
Left | Optional | Variant | The position, measured in points, of the left edge of the new picture relative to the drawing canvas.
Top | Optional | Variant | The position, measured in points, of the top edge of the new picture relative to the drawing canvas.
Width | Optional | Variant | The width of the picture, in points.
Height | Optional | Variant | The height of the picture, in points.

Return Value

Shape

Example

This example adds a picture to a newly created drawing canvas in the active document.

VBA Copy code Copy code
Sub NewCanvasPicture()
 Dim shpCanvas As Shape

 'Add a drawing canvas to the active document
 Set shpCanvas = ActiveDocument.Shapes _
 .AddCanvas(Left:=100, Top:=75, _
 Width:=200, Height:=300)

 'Add a graphic to the drawing canvas
 shpCanvas.CanvasItems.AddPicture _
 FileName:="C:\Program Files\Microsoft Office\" & _
 "Office\Bitmaps\Styles\stone.bmp", _
 LinkToFile:=False, SaveWithDocument:=True
End Sub

See also

Concepts

Shapes Collection Object

Other resources

Shapes Object Members


Shapes.AddPolyline Method (Word)

 Copy code hover
[image]

Shapes.AddPolyline Method (Word)
See also Send feedback

Published: July 16, 2012

Adds an open or closed polygon to a drawing canvas. Returns a Shape object that represents the polygon and adds it to the CanvasShapes collection.

Syntax

expression .AddPolyline(SafeArrayOfPoints)

expression Required. A variable that represents a Shapes collection.

Parameters

Name | Required/Optional | Data Type | Description
SafeArrayOfPoints | Required | Variant | An array of coordinate pairs that specifies the polyline drawing's vertices.

Remarks

To form a closed polygon, assign the same coordinates to the first and last vertices in the polyline drawing.

Example

This example creates a V-shaped open polyline in a new drawing canvas.

VBA Copy code Copy code
Sub NewCanvasPolyline()
 Dim docNew As Document
 Dim shpCanvas As Shape
 Dim sngArray(1 To 3, 1 To 2) As Single

 'Creates a new document and adds a drawing canvas
 Set docNew = Documents.Add
 Set shpCanvas = docNew.Shapes.AddCanvas( _
 Left:=100, Top:=75, Width:=200, Height:=300)

 'Sets the coordinates of the array
 sngArray(1, 1) = 100
 sngArray(1, 2) = 75
 sngArray(2, 1) = 150
 sngArray(2, 2) = 100
 sngArray(3, 1) = 100
 sngArray(3, 2) = 125

 'Adds a V-shaped open polyline to the drawing canvas
 shpCanvas.CanvasItems.AddPolyline SafeArrayOfPoints:=sngArray
End Sub

See also

Concepts

Shapes Collection Object

Other resources

Shapes Object Members


Shapes.AddShape Method (Word)

 Copy code hover
[image]

Shapes.AddShape Method (Word)
See also Send feedback

Published: July 16, 2012

Adds an AutoShape to a document. Returns a Shape object that represents the AutoShape and adds it to the Shapes collection.

Syntax

expression .AddShape(Type, Left, Top, Width, Height)

expression Required. A variable that represents a Shapes collection.

Parameters

Name | Required/Optional | Data Type | Description
Type | Required | Long | The type of shape to be returned. Can be any MsoAutoShapeType constant.
Left | Required | Single | The position, measured in points, of the left edge of the AutoShape.
Top | Required | Single | The position, measured in points, of the top edge of the AutoShape.
Width | Required | Single | The width, measured in points, of the AutoShape.
Height | Required | Single | The height, measured in points, of the AutoShape.

Return Value

Shape

Remarks

To change the type of an AutoShape that you've added, set the AutoShapeType property.

See also

Concepts

Shapes Collection Object

Other resources

Shapes Object Members


Shapes.AddSmartArt Method (Word)

 Copy code hover
[image]

Shapes.AddSmartArt Method (Word)
See also Send feedback

Published: July 16, 2012

Inserts the specified SmartArt graphic into the active document.

Version Information

Version Added: Word 2010

Syntax

expression .AddSmartArt(Layout, Left, Top, Width, Height, Anchor)

expression An expression that returns a Shapes object.

Parameters

Name | Required/Optional | Data Type | Description
Layout | Required | [SMARTARTLAYOUT] | A SmartArtLayout object that specifies the layout for the SmartArt graphic.
Left | Optional | Variant | The distance, in points, from the left edge of the slide to the left edge of the SmartArt graphic.
Top | Optional | Variant | The distance, in points, from the top edge of the slide to the top edge of the SmartArt graphic.
Width | Optional | Variant | The width of the SmartArt graphic.
Height | Optional | Variant | The height of the SmartArt graphic.
Anchor | Optional | Variant | A Range object that represents the text to which the SmartArt graphic is bound. If Anchor is specified, the anchor is positioned at the beginning of the first paragraph in the anchoring range. If this argument is omitted, the anchoring range is selected automatically and the SmartArt graphic is positioned relative to the top and left edges of the page.

Return Value

Shape

See also

Concepts

Shapes Collection Object

Other resources

Shapes Object Members


Shapes.AddTextbox Method (Word)

 Copy code hover
[image]

Shapes.AddTextbox Method (Word)
See also Send feedback

Published: July 16, 2012

Adds a text box to a drawing canvas.

Syntax

expression .AddTextbox(Orientation, Left, Top, Width, Height)

expression Required. A variable that represents a Shapes collection.

Parameters

Name | Required/Optional | Data Type | Description
Orientation | Required | MsoTextOrientation | The orientation of the text. Some of these constants may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.
Left | Required | Single | The position, measured in points, of the left edge of the text box.
Top | Required | Single | The position, measured in points, of the top edge of the text box.
Width | Required | Single | The width, measured in points, of the text box.
Height | Required | Single | The height, measured in points, of the text box.

Return Value

Shape

Example

This example add a textbox to a canvas in a new document.

VBA Copy code Copy code
Sub NewCanvasTextbox()
 Dim docNew As Document
 Dim shpCanvas As Shape

 'Create a new document and add a drawing canvas
 Set docNew = Documents.Add
 Set shpCanvas = docNew.Shapes.AddCanvas _
 (Left:=100, Top:=75, Width:=150, Height:=200)

 'Add a text box to the drawing canvas
 shpCanvas.CanvasItems.AddTextbox _
 Orientation:=msoTextOrientationHorizontal, _
 Left:=1, Top:=1, Width:=100, Height:=100
End Sub

See also

Concepts

Shapes Collection Object

Other resources

Shapes Object Members


Shapes.AddTextEffect Method (Word)

 Copy code hover
[image]

Shapes.AddTextEffect Method (Word)
See also Send feedback

Published: July 16, 2012

Adds a WordArt shape to a drawing canvas. Returns a Shape object that represents the WordArt and adds it to the CanvasShapes collection.

Syntax

expression .AddTextEffect(PresetTextEffect, Text, FontName, FontSize, FontBold, FontItalic, Left, Top)

expression Required. A variable that represents a Shapes collection.

Parameters

Name | Required/Optional | Data Type | Description
PresetTextEffect | Required | MsoPresetTextEffect | A preset text effect. The values of the MsoPresetTextEffect constants correspond to the formats listed in the WordArt Gallery dialog box (numbered from left to right and from top to bottom).
Text | Required | String | The text in the WordArt.
FontName | Required | String | The name of the font used in the WordArt.
FontSize | Required | Single | The size (in points) of the font used in the WordArt.
FontBold | Required | MsoTriState | MsoTrue to bold the WordArt font.
FontItalic | Required | MsoTriState | MsoTrue to italicize the WordArt font.
Left | Required | Single | The position, measured in points, of the left edge of the WordArt shape relative to the left edge of the drawing canvas.
Top | Required | Single | The position, measured in points, of the top edge of the WordArt shape relative to the top edge of the drawing canvas.

Remarks

When you add WordArt to a document, the height and width of the WordArt are automatically set based on the size and amount of text you specify.

Example

This example adds a drawing canvas to a new document and inserts a WordArt shape inside the canvas that contains the text "Hello, World."

VBA Copy code Copy code
Sub NewCanvasTextEffect()
 Dim docNew As Document
 Dim shpCanvas As Shape

 'Create a new document and add a drawing canvas
 Set docNew = Documents.Add
 Set shpCanvas = docNew.Shapes.AddCanvas( _
 Left:=100, Top:=100, Width:=150, _
 Height:=50)

 'Add WordArt shape to the drawing canvas
 shpCanvas.CanvasItems.AddTextEffect _
 PresetTextEffect:=msoTextEffect20, _
 Text:="Hello, World", FontName:="Tahoma", _
 FontSize:=15, FontBold:=msoTrue, _
 FontItalic:=msoFalse, _
 Left:=120, Top:=120
End Sub

See also

Concepts

Shapes Collection Object

Other resources

Shapes Object Members


Shapes.AddWebVideo Method (Word)

 Copy code hover
[image]

Shapes.AddWebVideo Method (Word)
See also Send feedback

Published: July 16, 2012

Adds a new web video to the document.

Version information

Version Added: Word 2013

Syntax

expression .AddWebVideo(EmbedCode,VideoWidth,VideoHeight,PosterFrameImage,Url,Left,Top,Width,Height,Anchor)

expression A variable that represents a Shapes object.

Parameters

Name | Required/Optional | Data type | Description
EmbedCode | Required | STRING | The HTML code to embed.
VideoWidth | Required | VARIANT | An integer that represents the width of the web video in pixels.
VideoHeight | Required | VARIANT | An integer that represents the height of the web video in pixels.
PosterFrameImage | Optional | VARIANT | A string that points to the file to use as the poster frame for the web video.
Url | Optional | VARIANT | A string that contains the URL to the web video.
Left | Optional | VARIANT | The position, measured in points, of the left edge of the poster frame from the edge of the document.
Top | Optional | VARIANT | The position, measured in points, of the top edge of the poster frame from the edge of the document.
Width | Optional | VARIANT | The width, measured in points, of the poster frame in the document.
Height | Optional | VARIANT | The height, measured in points, of the poster frame in the document.
Anchor | Optional | VARIANT | A Range object that represents the text to which the web video is bound. If Anchor is specified, the anchor is positioned at the beginning of the first paragraph in the anchoring range. If this argument is omitted, the anchoring range is selected automatically and the video is positioned relative to the top and left edges of the page.

Return value

SHAPE

See also

Concepts

Shapes Collection

Other resources

Shapes Members


Shapes.BuildFreeform Method (Word)

 Copy code hover
[image]

Shapes.BuildFreeform Method (Word)
See also Send feedback

Published: July 16, 2012

Builds a freeform object.

Syntax

expression .BuildFreeform(EditingType, X1, Y1)

expression Required. A variable that represents a Shapes collection.

Parameters

Name | Required/Optional | Data Type | Description
EditingType | Required | MsoEditingType | The editing property of the first node.
X1 | Required | Single | The position (in points) of the first node in the freeform drawing relative to the left edge of the document.
Y1 | Required | Single | The position (in points) of the first node in the freeform drawing relative to the top edge of the document.

Return Value

FreeformBuilder

Remarks

Use the AddNodes method to add segments to the freeform. After you have added at least one segment to the freeform, you can use the ConvertToShape method to convert the FreeformBuilder object into a Shape object that has the geometric description you've defined in the FreeformBuilder object.

Example

This example adds a freeform with five vertices to the active document.

VBA Copy code Copy code
Dim docActive As Document

Set docActive = ActiveDocument
VBA Copy code Copy code
With docActive.Shapes.BuildFreeform(msoEditingCorner, 360, 200)
 .AddNodes msoSegmentCurve, msoEditingCorner, _
 380, 230, 400, 250, 450, 300
 .AddNodes msoSegmentCurve, msoEditingAuto, 480, 200
 .AddNodes msoSegmentLine, msoEditingAuto, 480, 400
 .AddNodes msoSegmentLine, msoEditingAuto, 360, 200
 .ConvertToShape
End With

See also

Concepts

Shapes Collection Object

Other resources

Shapes Object Members


Shapes.Item Method (Word)

 Copy code hover
[image]

Shapes.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual Shape object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents a Shapes collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The individual object to be returned. Can be a Long indicating the ordinal position or a String representing the name of the individual object.

Return Value

Shape

See also

Concepts

Shapes Collection Object

Other resources

Shapes Object Members


Shapes.Range Method (Word)

 Copy code hover
[image]

Shapes.Range Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a ShapeRange object that represents the shapes within a range.

Syntax

expression .Range(Index)

expression Required. A variable that represents a Shapes collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | Specifies which shapes are to be included in the specified range. Can be an integer that specifies the index number of a shape within the Shapes collection, a string that specifies the name of a shape, or a array that contains integers or strings.

Return Value

ShapeRange

Remarks

A Shape object always appears on the same page as the range it is anchored to.

Note Note

Most operations that you can do with a Shape object you can also do with a ShapeRange object that contains a single shape. Some operations, when performed on a ShapeRange object that contains multiple shapes, produce an error.

Example

This example sets the fill foreground color to purple for the first shape in the active document.

VBA Copy code Copy code
Sub ShRange()
 With ActiveDocument.Shapes.Range(1).Fill
 .ForeColor.RGB = RGB(255, 0, 255)
 .Visible = msoTrue
 End With
End Sub

This example applies a shadow to a variable shape in the active document.

VBA Copy code Copy code
Sub ShpRange2(strShpName As String)
 ActiveDocument.Shapes.Range(strShpName).Shadow.Type = msoShadow6
End Sub

To call the preceding subroutine, enter the following code into a standard code module.

VBA Copy code Copy code
Sub CallShpRange2()
 Dim shpArrow As Shape
 Dim strName As String

 Set shpArrow = ActiveDocument.Shapes.AddShape(Type:=msoShapeLeftArrow, _
 Left:=200, Top:=400, Width:=50, Height:=75)

 shpArrow.Name = "myShape"
 strName = shpArrow.Name
 ShpRange2 strShpName:=strName
End Sub

This example selects shapes one and three in the active document.

VBA Copy code Copy code
Sub SelectShapeRange()
 ActiveDocument.Shapes.Range(Array(1, 3)).Select
End Sub

This example selects and deletes the shapes in the first shape in the active document. This example assumes that the first shape is a canvas shape.

VBA Copy code Copy code
Sub CanvasShapeRange()
 Dim rngCanvasShapes As Range
 Set rngCanvasShapes = ActiveDocument.Shapes(1).CanvasItems.Range(1)
 rngCanvasShapes.Select
 rngCanvasShapes.Delete
End Sub

See also

Concepts

Shapes Collection Object

Other resources

Shapes Object Members


Shapes.SelectAll Method (Word)

 Copy code hover
[image]

Shapes.SelectAll Method (Word)
See also Send feedback

Published: July 16, 2012

Selects all the shapes in a collection of shapes.

Syntax

expression .SelectAll

expression Required. A variable that represents a Shapes collection.

Remarks

This method does not select InlineShape objects. You cannot use this method to select more than one canvas.

Example

This example selects all the shapes in the active document.

VBA Copy code Copy code
Sub SelectAllShapes()
 ActiveDocument.Shapes.SelectAll
End Sub

This example selects all the shapes in the headers and footers of the active document and adds a red shadow to each shape.

VBA Copy code Copy code
Sub SelectAllHeaderShapes()
 With ActiveDocument.ActiveWindow
 .View.Type = wdPrintView
 .ActivePane.View.SeekView = wdSeekCurrentPageHeader
 End With

 ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary).Shapes.SelectAll

 With Selection.ShapeRange.Shadow
 .Type = msoShadow10
 .ForeColor.RGB = RGB(220, 0, 0)
 End With
End Sub

See also

Concepts

Shapes Collection Object

Other resources

Shapes Object Members


SoftEdgeFormat Object (Word)

 Copy code hover
[image]

SoftEdgeFormat Object (Word)
See also Send feedback

Published: July 16, 2012

Represents the soft edge formatting for a shape or range of shapes.

Version Information

Version Added: Word 2007

See also

Concepts

Word Object Model Reference

Other resources

SoftEdgeFormat Object Members


SoftEdgeFormat Members (Word)

 Copy code hover
[image]

SoftEdgeFormat Members (Word)
Send feedback

Published: July 16, 2012

Represents the soft edge formatting for a shape or range of shapes.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word 2010 application. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified SoftEdgeFormat object.
Radius | Returns or sets a Single that represents the length of the radius for a soft edge effect. Read/write.
Type | Returns or sets an MsoBevelType constant that represents the bevel type for the edges of images that use soft edge formatting. Read/write.


SoftEdgeFormat Properties (Word)

 Copy code hover
[image]

SoftEdgeFormat Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word 2010 application. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified SoftEdgeFormat object.
Radius | Returns or sets a Single that represents the length of the radius for a soft edge effect. Read/write.
Type | Returns or sets an MsoBevelType constant that represents the bevel type for the edges of images that use soft edge formatting. Read/write.


SoftEdgeFormat.Application Property (Word)

 Copy code hover
[image]

SoftEdgeFormat.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word 2010 application. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .Application

expression A variable that represents a SoftEdgeFormat object.

See also

Concepts

SoftEdgeFormat Object

Other resources

SoftEdgeFormat Object Members


SoftEdgeFormat.Creator Property (Word)

 Copy code hover
[image]

SoftEdgeFormat.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version Information

Version Added: Word 2010

Syntax

expression .Creator

expression An expression that returns a SoftEdgeFormat object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD". This property was primarily designed to be used on the Apple Macintosh, where each application has a four-character creator code. For example, Word has the creator code MSWD. For more information about this property, see the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

SoftEdgeFormat Object

Other resources

SoftEdgeFormat Object Members


SoftEdgeFormat.Parent Property (Word)

 Copy code hover
[image]

SoftEdgeFormat.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified SoftEdgeFormat object.

Version Information

Version Added: Word 2010

Syntax

expression .Parent

expression An expression that returns a SoftEdgeFormat object.

See also

Concepts

SoftEdgeFormat Object

Other resources

SoftEdgeFormat Object Members


SoftEdgeFormat.Radius Property (Word)

 Copy code hover
[image]

SoftEdgeFormat.Radius Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Single that represents the length of the radius for a soft edge effect. Read/write.

Version Information

Version Added: Word 2010

Syntax

expression .Radius

expression A variable that represents a SoftEdgeFormat Object object.

See also

Concepts

SoftEdgeFormat Object

Other resources

SoftEdgeFormat Object Members


SoftEdgeFormat.Type Property (Word)

 Copy code hover
[image]

SoftEdgeFormat.Type Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets an MsoBevelType constant that represents the bevel type for the edges of images that use soft edge formatting. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .Type

expression An expression that returns a SoftEdgeFormat object.

See also

Concepts

SoftEdgeFormat Object

Other resources

SoftEdgeFormat Object Members


Source Object (Word)

 Copy code hover
[image]

Source Object (Word)
See also Send feedback

Published: July 16, 2012

Represents an individual source, such as a book, journal article, or interview.

Version Information

Version Added: Word 2007

Remarks

For more information, see Working with Bibliographies.

See also

Concepts

Word Object Model Reference

Other resources

Source Object Members


Source Members (Word)

 Copy code hover
[image]

Source Members (Word)
Send feedback

Published: July 16, 2012

Represents an individual source, such as a book, journal article, or interview.

Methods

Name | Description
Delete | Deletes the specified source.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Cited | Returns a Boolean that represents whether a source has been cited in a document. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
Field | Returns a String that represents the value of a field in a bibliography source. Read-only.
Parent | Returns an Object that represents the parent object of the specified Source object.
Tag | Returns a String that represents an internal identifying label for a source. Read-only.
XML | Returns a String that represents the XML markup for a Source object. Read-only.


Source Properties (Word)

 Copy code hover
[image]

Source Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Cited | Returns a Boolean that represents whether a source has been cited in a document. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
Field | Returns a String that represents the value of a field in a bibliography source. Read-only.
Parent | Returns an Object that represents the parent object of the specified Source object.
Tag | Returns a String that represents an internal identifying label for a source. Read-only.
XML | Returns a String that represents the XML markup for a Source object. Read-only.


Source.Application Property (Word)

 Copy code hover
[image]

Source.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a Source object.

See also

Concepts

Source Object

Other resources

Source Object Members


Source.Cited Property (Word)

 Copy code hover
[image]

Source.Cited Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Boolean that represents whether a source has been cited in a document. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Cited

expression An expression that returns a Source object.

See also

Concepts

Source Object

Other resources

Source Object Members


Source.Creator Property (Word)

 Copy code hover
[image]

Source.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.

Syntax

expression .Creator

expression An expression that returns an Source object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

Source Object

Other resources

Source Object Members


Source.Field Property (Word)

 Copy code hover
[image]

Source.Field Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a String that represents the value of a field in a bibliography source. Read-only.

Syntax

expression .Field(Name)

expression An expression that returns a Source object.

Parameters

Name | Required/Optional | Data Type | Description
Name | Required | String | Specifies the name of the field for which to retrieve the value.

Remarks

The name of the field corresponds to the name of the corresponding XML element in the resulting XML for a bibliography source. You can use the XML property to return the XML for a bibliography source. For more information, see Working with Bibliographies.

See also

Concepts

Source Object

Other resources

Source Object Members


Source.Parent Property (Word)

 Copy code hover
[image]

Source.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Source object.

Syntax

expression .Parent

expression A variable that represents a Source object.

See also

Concepts

Source Object

Other resources

Source Object Members


Source.Tag Property (Word)

 Copy code hover
[image]

Source.Tag Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a String that represents an internal identifying label for a source. Read-only.

Syntax

expression .Tag

expression An expression that returns a Source object.

See also

Concepts

Source Object

Other resources

Source Object Members


Source.XML Property (Word)

 Copy code hover
[image]

Source.XML Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a String that represents the XML markup for a Source object. Read-only.

Syntax

expression .XML

expression An expression that returns a Source object.

Remarks

The Data parameter of the Add method for the Sources object requires a valid XML string that contains data for the necessary elements. Depending on the type of source that you add, the XML may change. To determine what the correct XML needs to be for a specific type of source, create a source through the Create Source dialog box, and then use the XML property to return the correct XML syntax.

See also

Concepts

Source Object

Other resources

Source Object Members


Source Methods (Word)

 Copy code hover
[image]

Source Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the specified source.


Source.Delete Method (Word)

 Copy code hover
[image]

Source.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the specified source.

Syntax

expression .Delete

expression An expression that returns a Source object.

See also

Concepts

Source Object

Other resources

Source Object Members


Sources Object (Word)

 Copy code hover
[image]

Sources Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a collection of Source objects.

Version Information

Version Added: Word 2007

Remarks

For more information, see Working with Bibliographies.

See also

Concepts

Word Object Model Reference

Other resources

Sources Object Members


Sources Members (Word)

 Copy code hover
[image]

Sources Members (Word)
Send feedback

Published: July 16, 2012

Represents a collection of Source objects.

Methods

Name | Description
Add | Add a new source to the sources listed in the Source Manager dialog box.
Item | Returns a Source object that represents the specified item in the collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns the number of items in the Sources collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified Sources object.


Sources Properties (Word)

 Copy code hover
[image]

Sources Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns the number of items in the Sources collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified Sources object.


Sources.Application Property (Word)

 Copy code hover
[image]

Sources.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a Sources collection.

See also

Concepts

Sources Collection

Other resources

Sources Object Members


Sources.Count Property (Word)

 Copy code hover
[image]

Sources.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the number of items in the Sources collection. Read-only Long.

Syntax

expression .Count

expression A variable that represents a Sources object.

See also

Concepts

Sources Collection

Other resources

Sources Object Members


Sources.Creator Property (Word)

 Copy code hover
[image]

Sources.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.

Syntax

expression .Creator

expression An expression that returns an Sources object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

Sources Collection

Other resources

Sources Object Members


Sources.Parent Property (Word)

 Copy code hover
[image]

Sources.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Sources object.

Syntax

expression .Parent

expression A variable that represents a Sources object.

See also

Concepts

Sources Collection

Other resources

Sources Object Members


Sources Methods (Word)

 Copy code hover
[image]

Sources Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Add a new source to the sources listed in the Source Manager dialog box.
Item | Returns a Source object that represents the specified item in the collection.


Sources.Add Method (Word)

 Copy code hover
[image]

Sources.Add Method (Word)
See also Send feedback

Published: July 16, 2012

Add a new source to the sources listed in the Source Manager dialog box.

Syntax

expression .Add(Data)

expression An expression that returns a Sources object.

Parameters

Name | Required/Optional | Data Type | Description
Data | Required | String | An XML string that represents the field values for the new source.

See also

Concepts

Sources Collection

Other resources

Sources Object Members


Sources.Item Method (Word)

 Copy code hover
[image]

Sources.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a Source object that represents the specified item in the collection.

Syntax

expression .Item(Index)

expression An expression that returns a Sources object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | Specifies the ordinal position of the object within the collection.

Return Value

Source

See also

Concepts

Sources Collection

Other resources

Sources Object Members


SpellingSuggestion Object (Word)

 Copy code hover
[image]

SpellingSuggestion Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a single spelling suggestion for a misspelled word. The SpellingSuggestion object is a member of the SpellingSuggestions collection. The SpellingSuggestions collection includes all the suggestions for a specified word or for the first word in the specified range.

Remarks

Use GetSpellingSuggestions(Index), where Index is the index number, to return a single SpellingSuggestion object. The following example checks to see whether there are any spelling suggestions for the first word in the active document. If there are, the first suggestion is displayed in a message box.

VBA Copy code Copy code
If ActiveDocument.Words(1).GetSpellingSuggestions.Count <> 0 Then
 MsgBox _
 ActiveDocument.Words(1).GetSpellingSuggestions.Item(1).Name
EndIf

The Count property for the SpellingSuggestions object returns 0 (zero) if the word is spelled correctly or if there are no suggestions.

See also

Concepts

Word Object Model Reference

Other resources

SpellingSuggestion Object Members


SpellingSuggestion Members (Word)

 Copy code hover
[image]

SpellingSuggestion Members (Word)
Send feedback

Published: July 16, 2012

Represents a single spelling suggestion for a misspelled word. The SpellingSuggestion object is a member of the SpellingSuggestions collection. The SpellingSuggestions collection includes all the suggestions for a specified word or for the first word in the specified range.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Name | Returns the name of the specified object. Read-only String.
Parent | Returns an Object that represents the parent object of the specified SpellingSuggestion object.


SpellingSuggestion Properties (Word)

 Copy code hover
[image]

SpellingSuggestion Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Name | Returns the name of the specified object. Read-only String.
Parent | Returns an Object that represents the parent object of the specified SpellingSuggestion object.


SpellingSuggestion.Application Property (Word)

 Copy code hover
[image]

SpellingSuggestion.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a SpellingSuggestion object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

SpellingSuggestion Object

Other resources

SpellingSuggestion Object Members


SpellingSuggestion.Creator Property (Word)

 Copy code hover
[image]

SpellingSuggestion.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a SpellingSuggestion object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

SpellingSuggestion Object

Other resources

SpellingSuggestion Object Members


SpellingSuggestion.Name Property (Word)

 Copy code hover
[image]

SpellingSuggestion.Name Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the name of the specified object. Read-only String.

Syntax

expression .Name

expression Required. A variable that represents a SpellingSuggestion object.

See also

Concepts

SpellingSuggestion Object

Other resources

SpellingSuggestion Object Members


SpellingSuggestion.Parent Property (Word)

 Copy code hover
[image]

SpellingSuggestion.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified SpellingSuggestion object.

Syntax

expression .Parent

expression Required. A variable that represents a SpellingSuggestion object.

See also

Concepts

SpellingSuggestion Object

Other resources

SpellingSuggestion Object Members


SpellingSuggestions Object (Word)

 Copy code hover
[image]

SpellingSuggestions Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of SpellingSuggestion objects that represent all the suggestions for a specified word or for the first word in the specified range.

Remarks

Use the GetSpellingSuggestions method to return the SpellingSuggestions collection. The SpellingSuggestions method, when applied to the Application object, must specify the word to be checked. When the GetSpellingSuggestions method is applied to a range, the first word in the range is checked. The following example checks to see whether there are any spelling suggestions for any of the words in the active document. If there are, the suggestions are displayed in message boxes.

VBA Copy code Copy code
For Each wd In ActiveDocument.Words
 Set sugg = wd.GetSpellingSuggestions
 If sugg.Count <> 0 Then
 For Each ss In sugg
 MsgBox ss.Name
 Next ss
 End If
Next wd

You cannot add suggestions to or remove suggestions from the collection of spelling suggestions. Spelling suggestions are derived from main and custom dictionary files.

See also

Concepts

Word Object Model Reference

Other resources

SpellingSuggestions Object Members


SpellingSuggestions Members (Word)

 Copy code hover
[image]

SpellingSuggestions Members (Word)
Send feedback

Published: July 16, 2012

A collection of SpellingSuggestion objects that represent all the suggestions for a specified word or for the first word in the specified range.

Methods

Name | Description
Item | Returns an individual SpellingSuggestion object in a collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of spelling suggestions in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified SpellingSuggestions object.
SpellingErrorType | Returns the spelling error type. Read-only WdSpellingErrorType.


SpellingSuggestions Properties (Word)

 Copy code hover
[image]

SpellingSuggestions Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of spelling suggestions in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified SpellingSuggestions object.
SpellingErrorType | Returns the spelling error type. Read-only WdSpellingErrorType.


SpellingSuggestions.Application Property (Word)

 Copy code hover
[image]

SpellingSuggestions.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a SpellingSuggestions collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

SpellingSuggestions Collection Object

Other resources

SpellingSuggestions Object Members


SpellingSuggestions.Count Property (Word)

 Copy code hover
[image]

SpellingSuggestions.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of spelling suggestions in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents a SpellingSuggestions collection.

See also

Concepts

SpellingSuggestions Collection Object

Other resources

SpellingSuggestions Object Members


SpellingSuggestions.Creator Property (Word)

 Copy code hover
[image]

SpellingSuggestions.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a SpellingSuggestions collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

SpellingSuggestions Collection Object

Other resources

SpellingSuggestions Object Members


SpellingSuggestions.Parent Property (Word)

 Copy code hover
[image]

SpellingSuggestions.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified SpellingSuggestions object.

Syntax

expression .Parent

expression Required. A variable that represents a SpellingSuggestions collection.

See also

Concepts

SpellingSuggestions Collection Object

Other resources

SpellingSuggestions Object Members


SpellingSuggestions.SpellingErrorType Property (Word)

 Copy code hover
[image]

SpellingSuggestions.SpellingErrorType Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the spelling error type. Read-only WdSpellingErrorType.

Syntax

expression .SpellingErrorType

expression Required. A variable that represents a SpellingSuggestions collection.

Remarks

Use the GetSpellingSuggestions method to return a collection of words suggested as spelling replacements. If a word is misspelled, the CheckSpelling method returns True.

Example

If the first word in the active document isn't in the dictionary, this example displays "Unknown word" in the status bar.

VBA Copy code Copy code
Set suggs = ActiveDocument.Content.GetSpellingSuggestions
If suggs.SpellingErrorType = wdSpellingNotInDictionary Then
 StatusBar = "Unknown word"
End If

See also

Concepts

SpellingSuggestions Collection Object

Other resources

SpellingSuggestions Object Members


SpellingSuggestions Methods (Word)

 Copy code hover
[image]

SpellingSuggestions Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Item | Returns an individual SpellingSuggestion object in a collection.


SpellingSuggestions.Item Method (Word)

 Copy code hover
[image]

SpellingSuggestions.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual SpellingSuggestion object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents a SpellingSuggestions collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The individual object to be returned. Can be a Long indicating the ordinal position of the individual object.

Return Value

SpellingSuggestion

See also

Concepts

SpellingSuggestions Collection Object

Other resources

SpellingSuggestions Object Members


StoryRanges Object (Word)

 Copy code hover
[image]

StoryRanges Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of Range objects that represent stories in a document.

Remarks

Use the StoryRanges property to return the StoryRanges collection. The following example removes manual character formatting from the text in all stories other than the main text story in the active document.

VBA Copy code Copy code
For Each aStory In ActiveDocument.StoryRanges
 If aStory.StoryType <> wdMainTextStory Then aStory.Font.Reset
Next aStory

The Add method is not available for the StoryRanges collection. The number of stories in the StoryRanges collection is finite.

Use StoryRanges(Index), where Index is a WdStoryType constant, to return a single story as a Range object. The following example adds text to the primary header story and then displays the text.

VBA Copy code Copy code
ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary).Range _
 .Text = "Header text"
MsgBox ActiveDocument.StoryRanges(wdPrimaryHeaderStory).Text

The following example copies the text of the footnotes from the active document into a new document.

VBA Copy code Copy code
If ActiveDocument.Footnotes.Count >= 1 Then
 ActiveDocument.StoryRanges(wdFootnotesStory).Copy
 Documents.Add.Content.Paste
End If

If you attempt to return a story that is not available in the specified document, an error occurs. The following example determines whether a footnote story is available in the active document.

VBA Copy code Copy code
On Error GoTo errhandler
Set MyRange = ActiveDocument.StoryRanges(wdFootnotesStory)
errhandler:
If Err = 5941 Then MsgBox "The footnotes story is not available."

Use the NextStoryRange property to loop through all stories in a document. The following example searches each story in the active document for the text "Microsoft Word." When the text is found, it is formatted as italic.

VBA Copy code Copy code
For Each myStoryRange In ActiveDocument.StoryRanges
 myStoryRange.Find.Execute _
 FindText:="Microsoft Word", Forward:=True
 While myStoryRange.Find.Found
 myStoryRange.Italic = True
 myStoryRange.Find.Execute _
 FindText:="Microsoft Word", Forward:=True
 Wend
 While Not (myStoryRange.NextStoryRange Is Nothing)
 Set myStoryRange = myStoryRange.NextStoryRange
 myStoryRange.Find.Execute _
 FindText:="Microsoft Word", Forward:=True
 While myStoryRange.Find.Found
 myStoryRange.Italic = True
 myStoryRange.Find.Execute _
 FindText:="Microsoft Word", Forward:=True
 Wend
 Wend
Next myStoryRange

See also

Concepts

Word Object Model Reference

Other resources

StoryRanges Object Members


StoryRanges Members (Word)

 Copy code hover
[image]

StoryRanges Members (Word)
Send feedback

Published: July 16, 2012

A collection of Range objects that represent stories in a document.

Methods

Name | Description
Item | Returns a single story of a range or selection as a Range object.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of story ranges in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified StoryRanges object.


StoryRanges Properties (Word)

 Copy code hover
[image]

StoryRanges Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of story ranges in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified StoryRanges object.


StoryRanges.Application Property (Word)

 Copy code hover
[image]

StoryRanges.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a StoryRanges collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

StoryRanges Collection Object

Other resources

StoryRanges Object Members


StoryRanges.Count Property (Word)

 Copy code hover
[image]

StoryRanges.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of story ranges in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents a StoryRanges collection.

See also

Concepts

StoryRanges Collection Object

Other resources

StoryRanges Object Members


StoryRanges.Creator Property (Word)

 Copy code hover
[image]

StoryRanges.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a StoryRanges collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

StoryRanges Collection Object

Other resources

StoryRanges Object Members


StoryRanges.Parent Property (Word)

 Copy code hover
[image]

StoryRanges.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified StoryRanges object.

Syntax

expression .Parent

expression Required. A variable that represents a StoryRanges collection.

See also

Concepts

StoryRanges Collection Object

Other resources

StoryRanges Object Members


StoryRanges Methods (Word)

 Copy code hover
[image]

StoryRanges Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Item | Returns a single story of a range or selection as a Range object.


StoryRanges.Item Method (Word)

 Copy code hover
[image]

StoryRanges.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a single story of a range or selection as a Range object.

Syntax

expression .Item(Index)

expression Required. A variable that represents a StoryRanges collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | WdStoryType | The specified story type.

Return Value

Range

See also

Concepts

StoryRanges Collection Object

Other resources

StoryRanges Object Members


Style Object (Word)

 Copy code hover
[image]

Style Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a single built-in or user-defined style. The Style object includes style attributes (such as font, font style, and paragraph spacing) as properties of the Style object. The Style object is a member of the Styles collection. The Styles collection includes all the styles in the specified document.

Remarks

Use Styles(Index), where Index is the style name, a WdBuiltinStyle constant or index number, to return a single Style object. You must exactly match the spelling and spacing of the style name, but not necessarily its capitalization. The following example modifies the font name of the user-defined style named "Color" in the active document.

VBA Copy code Copy code
ActiveDocument.Styles("Color").Font.Name = "Arial"

The following example sets the built-in Heading 1 style to not be bold.

VBA Copy code Copy code
ActiveDocument.Styles(wdStyleHeading1).Font.Bold = False

The style index number represents the position of the style in the alphabetically sorted list of style names. Note that Styles(1) is the first style in the alphabetical list. The following example displays the base style and style name of the first style in the Styles collection.

VBA Copy code Copy code
MsgBox "Base style= " _
 & ActiveDocument.Styles(1).BaseStyle & vbCr _
 & "Style name= " & ActiveDocument.Styles(1).NameLocal

To apply a style to a range, paragraph, or multiple paragraphs, set the Style property to a user-defined or built-in style name. The following example applies the Normal style to the first four paragraphs in the active document.

VBA Copy code Copy code
Set myRange = ActiveDocument.Range( _
 Start:=ActiveDocument.Paragraphs(1).Range.Start, _
 End:=ActiveDocument.Paragraphs(4).Range.End)
myRange.Style = wdStyleNormal

The following example applies the Heading 1 style to the first paragraph in the selection.

VBA Copy code Copy code
Selection.Paragraphs(1).Style = wdStyleHeading1

The following example creates a character style named "Bolded" and applies it to the selection.

VBA Copy code Copy code
Set myStyle = ActiveDocument.Styles.Add(Name:="Bolded", _
 Type:=wdStyleTypeCharacter)
myStyle.Font.Bold = True
Selection.Range.Style = "Bolded"

Use the OrganizerCopy method to copy styles between documents and templates. Use the UpdateStyles method to update the styles in the active document to match the style definitions in the attached template. Use the OpenAsDocument method to open a template as a document so that you can modify the template styles.

See also

Concepts

Word Object Model Reference

Other resources

Style Object Members


Style Members (Word)

 Copy code hover
[image]

Style Members (Word)
Send feedback

Published: July 16, 2012

Represents a single built-in or user-defined style. The Style object includes style attributes (such as font, font style, and paragraph spacing) as properties of the Style object. The Style object is a member of the Styles collection. The Styles collection includes all the styles in the specified document.

Methods

Name | Description
Delete | Deletes the specified style.
LinkToListTemplate | Links the specified style to a list template so that the style's formatting can be applied to lists.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
AutomaticallyUpdate | True if the style is automatically redefined based on the selection. Read/write Boolean.
BaseStyle | Returns or sets an existing style on which you can base the formatting of another style. Read/write Variant.
Borders | Returns a Borders collection that represents all the borders for the specified style.
BuiltIn | True if the specified object is one of the built-in styles or caption labels in Word. Read-only Boolean.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Description | Returns the description of the specified style. Read-only String.
Font | Returns or sets a Font object that represents the character formatting of the specified style. Read/write Font.
Frame | Returns a Frame object that represents the frame formatting for the specified style. Read-only.
InUse | True if the specified style is a built-in style that has been modified or applied in the document or a new style that has been created in the document. Read-only Boolean.
LanguageID | Returns or sets a WdLanguageID constant that represents the language for the specified range. Read/write.
LanguageIDFarEast | Returns or sets an East Asian language for the specified object. Read/write WdLanguageID.
Linked | Returns or sets a Boolean that represents whether a style is a linked style that can be used for both paragraph and character formatting. Read-only.
LinkStyle | Sets or returns a Variant that represents a link between a paragraph and a character style. Read/write.
ListLevelNumber | Returns the list level for the specified style. Read-only Long.
ListTemplate | Returns a ListTemplate object that represents the list formatting for the specified Style object.
Locked | True if a style cannot be changed or edited. Read/write Boolean.
NameLocal | Returns the name of a built-in style in the language of the user. Read/write String.
NextParagraphStyle | Returns or sets the style to be applied automatically to a new paragraph that is inserted after a paragraph formatted with the specified style. Read/write Variant.
NoProofing | True if the spelling and grammar checker ignores text formatted with this style. Read/write Long.
NoSpaceBetweenParagraphsOfSameStyle | True for Microsoft Word to remove spacing between paragraphs that are formatted using the same style. Read/write Boolean.
ParagraphFormat | Returns or sets a ParagraphFormat object that represents the paragraph settings for the specified style. Read/write.
Parent | Returns an Object that represents the parent object of the specified Style object.
Priority | Returns or sets a Long that represents the priority for sorting styles in the Styles task pane. Read/write.
QuickStyle | Returns or sets a Boolean that represents whether the style corresponds to an available quick style. Read/write.
Shading | Returns a Shading object that refers to the shading formatting for the specified object.
Table | Returns a TableStyle object representing properties that can be applied to a table using a table style.
Type | Returns the style type. Read-only WdStyleType.
UnhideWhenUsed | True if the specified style is made visible as a recommended style in the Styles and in theStyles task pane in Word 2010 after it is used in the document. Read/write.
Visibility | True if the specified style is visible as a recommended style in the Styles gallery and in theStyles task pane. Read/write.


Style Properties (Word)

 Copy code hover
[image]

Style Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
AutomaticallyUpdate | True if the style is automatically redefined based on the selection. Read/write Boolean.
BaseStyle | Returns or sets an existing style on which you can base the formatting of another style. Read/write Variant.
Borders | Returns a Borders collection that represents all the borders for the specified style.
BuiltIn | True if the specified object is one of the built-in styles or caption labels in Word. Read-only Boolean.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Description | Returns the description of the specified style. Read-only String.
Font | Returns or sets a Font object that represents the character formatting of the specified style. Read/write Font.
Frame | Returns a Frame object that represents the frame formatting for the specified style. Read-only.
InUse | True if the specified style is a built-in style that has been modified or applied in the document or a new style that has been created in the document. Read-only Boolean.
LanguageID | Returns or sets a WdLanguageID constant that represents the language for the specified range. Read/write.
LanguageIDFarEast | Returns or sets an East Asian language for the specified object. Read/write WdLanguageID.
Linked | Returns or sets a Boolean that represents whether a style is a linked style that can be used for both paragraph and character formatting. Read-only.
LinkStyle | Sets or returns a Variant that represents a link between a paragraph and a character style. Read/write.
ListLevelNumber | Returns the list level for the specified style. Read-only Long.
ListTemplate | Returns a ListTemplate object that represents the list formatting for the specified Style object.
Locked | True if a style cannot be changed or edited. Read/write Boolean.
NameLocal | Returns the name of a built-in style in the language of the user. Read/write String.
NextParagraphStyle | Returns or sets the style to be applied automatically to a new paragraph that is inserted after a paragraph formatted with the specified style. Read/write Variant.
NoProofing | True if the spelling and grammar checker ignores text formatted with this style. Read/write Long.
NoSpaceBetweenParagraphsOfSameStyle | True for Microsoft Word to remove spacing between paragraphs that are formatted using the same style. Read/write Boolean.
ParagraphFormat | Returns or sets a ParagraphFormat object that represents the paragraph settings for the specified style. Read/write.
Parent | Returns an Object that represents the parent object of the specified Style object.
Priority | Returns or sets a Long that represents the priority for sorting styles in the Styles task pane. Read/write.
QuickStyle | Returns or sets a Boolean that represents whether the style corresponds to an available quick style. Read/write.
Shading | Returns a Shading object that refers to the shading formatting for the specified object.
Table | Returns a TableStyle object representing properties that can be applied to a table using a table style.
Type | Returns the style type. Read-only WdStyleType.
UnhideWhenUsed | True if the specified style is made visible as a recommended style in the Styles and in theStyles task pane in Word 2010 after it is used in the document. Read/write.
Visibility | True if the specified style is visible as a recommended style in the Styles gallery and in theStyles task pane. Read/write.


Style.Application Property (Word)

 Copy code hover
[image]

Style.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a Style object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

Style Object

Other resources

Style Object Members


Style.AutomaticallyUpdate Property (Word)

 Copy code hover
[image]

Style.AutomaticallyUpdate Property (Word)
See also Send feedback

Published: July 16, 2012

True if the style is automatically redefined based on the selection. Read/write Boolean.

Syntax

expression .AutomaticallyUpdate

expression A variable that represents a Style object.

Remarks

If the AutomaticallyUpdate property is set to False, Microsoft Word prompts for confirmation before redefining the style based on the selection. A style can be redefined when it is applied to a selection that has the same style but different manual formatting.

Example

This example creates a style named "Style1" that can be redefined without the need for confirmation.

VBA Copy code Copy code
Dim docNew as Document
Dim styleNew as Style

Set docNew = Documents.Add
Set styleNew = docNew.Styles.Add("Style1")

With styleNew
 .BaseStyle = docNew.Styles(wdStyleNormal)
 .ParagraphFormat.LineSpacingRule = wdLineSpaceDouble
 .AutomaticallyUpdate = True
End With

See also

Concepts

Style Object

Other resources

Style Object Members


Style.BaseStyle Property (Word)

 Copy code hover
[image]

Style.BaseStyle Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets an existing style on which you can base the formatting of another style. Read/write Variant.

Syntax

expression .BaseStyle

expression A variable that represents a Style object.

Remarks

To set the BaseStyle property, specify either the local name of the base style, an integer or a wdBuiltinStyle constant, or an object that represents the base style. For a list of the wdBuiltinStyle constants, see the Style property for the object that you want to set.

Example

This example creates a new document and then adds a new paragraph style named "myHeading." It assigns Heading 1 as the base style for the new style. A left indent of 1 inch (72 points) is then specified for the new style.

VBA Copy code Copy code
Dim docNew As Document
Dim styleNew As Style

Set docNew = Documents.Add
Set styleNew = docNew.Styles.Add("NewHeading1")
With styleNew
 .BaseStyle = docNew.Styles(wdStyleHeading1)
 .ParagraphFormat.LeftIndent = 72
End With

This example returns the base style that's used for the Body Text paragraph style.

VBA Copy code Copy code
Dim styleBase As Style

styleBase = ActiveDocument.Styles(wdStyleBodyText).BaseStyle
MsgBox styleBase

See also

Concepts

Style Object

Other resources

Style Object Members


Style.Borders Property (Word)

 Copy code hover
[image]

Style.Borders Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Borders collection that represents all the borders for the specified style.

Syntax

expression .Borders

expression Required. A variable that represents a Style object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

See also

Concepts

Style Object

Other resources

Style Object Members


Style.BuiltIn Property (Word)

 Copy code hover
[image]

Style.BuiltIn Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified object is one of the built-in styles or caption labels in Word. Read-only Boolean.

Syntax

expression .BuiltIn

expression A variable that represents a Style object.

Remarks

You can specify built-in styles across all languages by using the WdBuiltinStyle constants or within a language by using the style name for the language version of Word. For example, if you specify U.S. English in your Microsoft Office language settings, the following statements are equivalent:

VBA Copy code Copy code
ActiveDocument.Styles(wdStyleHeading1)
ActiveDocument.Styles("Heading 1")

Example

This example checks all the styles in the active document. When it finds a style that isn't built in, it displays the name of the style.

VBA Copy code Copy code
Dim styleLoop As Style

For Each styleLoop in ActiveDocument.Styles
 If styleLoop.BuiltIn = False Then
 Msgbox styleLoop.NameLocal
 End If
Next styleLoop

See also

Concepts

Style Object

Other resources

Style Object Members


Style.Creator Property (Word)

 Copy code hover
[image]

Style.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a Style object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Style Object

Other resources

Style Object Members


Style.Description Property (Word)

 Copy code hover
[image]

Style.Description Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the description of the specified style. Read-only String.

Syntax

expression .Description

expression A variable that represents a Style object.

Remarks

A typical example of a descirption for a style might be "Normal + Font: Arial, 12 pt, Bold, Italic, Space Before 12 pt After 3 pt, KeepWithNext, Level 2."

Example

This example creates a new document and inserts a tab-delimited list of the active document's styles and their descriptions.

VBA Copy code Copy code
Dim docActive As Document
Dim docNew As Document
Dim styleLoop As Style

Set docActive = ActiveDocument
Set docNew = Documents.Add

For Each styleLoop In docActive.Styles
 With docNew.Range
 .InsertAfter Text:=styleLoop.NameLocal & Chr(9) _
 & styleLoop.Description
 .InsertParagraphAfter
 End With
Next styleLoop

See also

Concepts

Style Object

Other resources

Style Object Members


Style.Font Property (Word)

 Copy code hover
[image]

Style.Font Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Font object that represents the character formatting of the specified style. Read/write Font.

Syntax

expression .Font

expression A variable that represents a Style object.

Remarks

To set this property, specify an expression that returns a Font object.

Example

This example removes bold formatting from the Heading 1 style in the active document.

VBA Copy code Copy code
ActiveDocument.Styles(wdStyleHeading1).Font.Bold = False

See also

Concepts

Style Object

Other resources

Style Object Members


Style.Frame Property (Word)

 Copy code hover
[image]

Style.Frame Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Frame object that represents the frame formatting for the specified style. Read-only.

Syntax

expression .Frame

expression A variable that represents a Style object.

Example

This example creates a style with frame formatting and then applies the style to the first paragraph in the selection.

VBA Copy code Copy code
Dim styleNew As Style

Set styleNew = ActiveDocument.Styles _
 .Add(Name:="frame", Type:=wdStyleTypeParagraph)
With styleNew.Frame
 .RelativeHorizontalPosition = _
 wdRelativeHorizontalPositionMargin
 .HeightRule = wdFrameAuto
 .WidthRule = wdFrameAuto
 .TextWrap = True
End With
Selection.Paragraphs(1).Range.Style = "frame"

See also

Concepts

Style Object

Other resources

Style Object Members


Style.InUse Property (Word)

 Copy code hover
[image]

Style.InUse Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified style is a built-in style that has been modified or applied in the document or a new style that has been created in the document. Read-only Boolean.

Syntax

expression .InUse

expression An expression that returns a Style object.

Remarks

The InUse property doesn't necessarily indicate whether the style is currently applied to any text in the document. For instance, if text that's been formatted with a style is deleted, the InUse property of the style remains True. For built-in styles that have never been used in the document, this property returns False.

Example

This example displays a message box that lists the names of all the styles that are currently being used in the active document.

VBA Copy code Copy code
Dim docActive As Document
Dim strMessage As String
Dim styleLoop As Style

Set docActive = ActiveDocument

strMessage = "Styles in use:" & vbCr

For Each styleLoop In docActive.Styles
 If styleLoop.InUse = True Then
 With docActive
 .Content.Find
 .ClearFormatting
 .Text = ""
 .Style = styleLoop
 .Execute Format:=True
 If .Found = True Then
 strMessage = strMessage & styleLoop.Name & vbCr
 End If
 End With
 End If
Next styleLoop

MsgBox strMessage

See also

Concepts

Style Object

Other resources

Style Object Members


Style.LanguageID Property (Word)

 Copy code hover
[image]

Style.LanguageID Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a WdLanguageID constant that represents the language for the specified range. Read/write.

Syntax

expression .LanguageID

expression An expression that represents a Style object.

Remarks

Some of the WdLanguageID constants may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.

Example

This example redefines the Title style to use the Spanish proofing tools. The new style description is then displayed in a message box.

VBA Copy code Copy code
ActiveDocument.Styles("Title").LanguageID = wdSpanish
MsgBox ActiveDocument.Styles("Title").Description

See also

Concepts

Style Object

Other resources

Style Object Members


Style.LanguageIDFarEast Property (Word)

 Copy code hover
[image]

Style.LanguageIDFarEast Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets an East Asian language for the specified object. Read/write WdLanguageID.

Syntax

expression .LanguageIDFarEast

expression Required. A variable that represents a Style object.

Remarks

This is the recommended way to return or set the language of East Asian text in a document created in an East Asian version of Microsoft Word.

Example

This example sets the language of the selection to Korean.

VBA Copy code Copy code
Selection.LanguageIDFarEast = wdKorean

See also

Concepts

Style Object

Other resources

Style Object Members


Style.Linked Property (Word)

 Copy code hover
[image]

Style.Linked Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents whether a style is a linked style that can be used for both paragraph and character formatting. Read-only.

Syntax

expression .Linked

expression An expression that returns a Style object.

Remarks

True indicates that the Style Type option in the Modify Style dialog box is set to "Linked (paragraph and character)".

See also

Concepts

Style Object

Other resources

Style Object Members


Style.LinkStyle Property (Word)

 Copy code hover
[image]

Style.LinkStyle Property (Word)
See also Send feedback

Published: July 16, 2012

Sets or returns a Variant that represents a link between a paragraph and a character style. Read/write.

Syntax

expression .LinkStyle

expression An expression that returns a Style object.

Remarks

When a character style and a paragraph style are linked, the two styles take on the same character formatting.

Example

This example creates and formats a new character style, and then it links the character style to the built-in heading style "Heading 1" so that the "Heading 1" style takes on the character formatting of the newly added style.

VBA Copy code Copy code
Sub LinkHeadStyle()
 Dim styChar1 As Style

 Set styChar1 = ActiveDocument.Styles.Add _
 (Name:="Heading 1 Characters", Type:=wdStyleTypeCharacter)
 With styChar1
 .Font.Name = "Verdana"
 .Font.Bold = True
 .Font.Shadow = True
 With .Font.Borders(1)
 .LineStyle = wdLineStyleDot
 .LineWidth = wdLineWidth300pt
 .Color = wdColorDarkRed
 End With
 End With
 ActiveDocument.Styles("Heading 1").LinkStyle = _
 ActiveDocument.Styles("Heading 1 Characters")

 With ActiveDocument.Content
 .InsertParagraphAfter
 .InsertAfter "New Linked Style"
 .Select
 End With

 Selection.Collapse Direction:=wdCollapseEnd
 Selection.Style = ActiveDocument.Styles("Heading 1")

End Sub

See also

Concepts

Style Object

Other resources

Style Object Members


Style.ListLevelNumber Property (Word)

 Copy code hover
[image]

Style.ListLevelNumber Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the list level for the specified style. Read-only Long.

Syntax

expression .ListLevelNumber

expression Required. A variable that represents a Style object.

Example

This example displays the list level for the Heading 3 style.

VBA Copy code Copy code
Msgbox ActiveDocument.Styles(wdStyleHeading3).ListLevelNumber

See also

Concepts

Style Object

Other resources

Style Object Members


Style.ListTemplate Property (Word)

 Copy code hover
[image]

Style.ListTemplate Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a ListTemplate object that represents the list formatting for the specified Style object.

Syntax

expression .ListTemplate

expression Required. A variable that represents a Style object.

Remarks

A list template includes all the formatting that defines a particular list. Each of the seven formats (excluding None) found on each of the tabs in the Bullets and Numbering dialog box (Format menu) corresponds to a list template. Documents and templates can also contain collections of list templates.

See also

Concepts

Style Object

Other resources

Style Object Members


Style.Locked Property (Word)

 Copy code hover
[image]

Style.Locked Property (Word)
See also Send feedback

Published: July 16, 2012

True if a style cannot be changed or edited. Read/write Boolean.

Syntax

expression .Locked

expression An expression that represents a Style object.

See also

Concepts

Style Object

Other resources

Style Object Members


Style.NameLocal Property (Word)

 Copy code hover
[image]

Style.NameLocal Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the name of a built-in style in the language of the user. Read/write String.

Syntax

expression .NameLocal

expression Required. A variable that represents a Style object.

Remarks

Setting this property renames a user-defined style or adds an alias to a built-in style.

Example

This example displays the style name (in the language of the user) applied to the selected paragraphs. If more than one style has been applied to the selection, the first style name is displayed.

VBA Copy code Copy code
MsgBox Selection.Paragraphs.Style.NameLocal

This example adds the name "MyH1" as the alias for the Heading 1 style in the active document.

VBA Copy code Copy code
ActiveDocument.Styles("Heading 1").NameLocal = "MyH1"

This example renames the style named "Test" to "Intro."

VBA Copy code Copy code
ActiveDocument.Styles("Test").NameLocal = "Intro"

See also

Concepts

Style Object

Other resources

Style Object Members


Style.NextParagraphStyle Property (Word)

 Copy code hover
[image]

Style.NextParagraphStyle Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the style to be applied automatically to a new paragraph that is inserted after a paragraph formatted with the specified style. Read/write Variant.

Syntax

expression .NextParagraphStyle

expression An expression that returns a Style object.

Remarks

You can set the NextParagraphStyle property by using the local name of the style, an integer or a WdBuiltinStyle constant, or an object that represents the next style. For a list of the WdBuiltinStyle constants, see the Style property for the object that you want to set.

Example

This example sets the Heading 1 style to be followed by the Heading 2 style in the active document.

VBA Copy code Copy code
ActiveDocument.Styles(wdStyleHeading1).NextParagraphStyle = _
 ActiveDocument.Styles(wdStyleHeading2)

This example creates a new document and adds a paragraph style named "MyStyle." The new style is based on the Normal style, is followed by the Heading 3 style, has a left indent of 1 inch (72 points), and is formatted as bold.

VBA Copy code Copy code
Set myDoc = Documents.Add
Set myStyle = myDoc.Styles.Add(Name:= "MyStyle")
 With myStyle
 .BaseStyle = wdStyleNormal
 .NextParagraphStyle = wdStyleHeading3
 .ParagraphFormat.LeftIndent = 72
 .Font.Bold = True
 End With

See also

Concepts

Style Object

Other resources

Style Object Members


Style.NoProofing Property (Word)

 Copy code hover
[image]

Style.NoProofing Property (Word)
See also Send feedback

Published: July 16, 2012

True if the spelling and grammar checker ignores text formatted with this style. Read/write Long.

Syntax

expression .NoProofing

expression A variable that represents a Style object.

Example

This example sets the spelling and grammar checker to ignore any text in the active document formatted with the style named "Test".

VBA Copy code Copy code
ActiveDocument.Styles("Test").NoProofing = True

See also

Concepts

Style Object

Other resources

Style Object Members


Style.NoSpaceBetweenParagraphsOfSameStyle Property (Word)

 Copy code hover
[image]

Style.NoSpaceBetweenParagraphsOfSameStyle Property (Word)
See also Send feedback

Published: July 16, 2012

True for Microsoft Word to remove spacing between paragraphs that are formatted using the same style. Read/write Boolean.

Syntax

expression .NoSpaceBetweenParagraphsOfSameStyle

expression An expression that returns a Style object.

Example

VBA Copy code Copy code
Sub NoSpace()
 ActiveDocument.Styles("List 1") _
 .NoSpaceBetweenParagraphsOfSameStyle = True
End Sub

See also

Concepts

Style Object

Other resources

Style Object Members


Style.ParagraphFormat Property (Word)

 Copy code hover
[image]

Style.ParagraphFormat Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a ParagraphFormat object that represents the paragraph settings for the specified style. Read/write.

Syntax

expression .ParagraphFormat

expression A variable that represents a Style object.

Example

This example modifies the Heading 2 style for the active document. Paragraphs formatted with this style are indented to the first tab stop and double-spaced.

VBA Copy code Copy code
With ActiveDocument.Styles(wdStyleHeading2).ParagraphFormat
 .TabIndent(1)
 .Space2
End With

See also

Concepts

Style Object

Other resources

Style Object Members


Style.Parent Property (Word)

 Copy code hover
[image]

Style.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Style object.

Syntax

expression .Parent

expression Required. A variable that represents a Style object.

See also

Concepts

Style Object

Other resources

Style Object Members


Style.Priority Property (Word)

 Copy code hover
[image]

Style.Priority Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Long that represents the priority for sorting styles in the Styles task pane. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .Priority

expression An expression that returns a Style object.

See also

Concepts

Style Object

Other resources

Style Object Members


Style.QuickStyle Property (Word)

 Copy code hover
[image]

Style.QuickStyle Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents whether the style corresponds to an available quick style. Read/write.

Syntax

expression .QuickStyle

expression An expression that returns a Style object.

See also

Concepts

Style Object

Other resources

Style Object Members


Style.Shading Property (Word)

 Copy code hover
[image]

Style.Shading Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Shading object that refers to the shading formatting for the specified object.

Syntax

expression .Shading

expression Required. A variable that represents a Style object.

See also

Concepts

Style Object

Other resources

Style Object Members


Style.Table Property (Word)

 Copy code hover
[image]

Style.Table Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a TableStyle object representing properties that can be applied to a table using a table style.

Syntax

expression .Table

expression An expression that returns a Style object.

Example

This example creates a new table style that specifies a surrounding border and special borders and shading for only the first and last rows and the last column.

VBA Copy code Copy code
Sub NewTableStyle()
 Dim styTable As Style

 Set styTable = ActiveDocument.Styles.Add( _
 Name:="TableStyle 1", Type:=wdStyleTypeTable)

 With styTable.Table

 'Apply borders around table, a double border to the heading row,
 'a double border to the last column, and shading to last row
 .Borders(wdBorderTop).LineStyle = wdLineStyleSingle
 .Borders(wdBorderBottom).LineStyle = wdLineStyleSingle
 .Borders(wdBorderLeft).LineStyle = wdLineStyleSingle
 .Borders(wdBorderRight).LineStyle = wdLineStyleSingle

 .Condition(wdFirstRow).Borders(wdBorderBottom) _
 .LineStyle = wdLineStyleDouble

 .Condition(wdLastColumn).Borders(wdBorderLeft) _
 .LineStyle = wdLineStyleDouble

 .Condition(wdLastRow).Shading _
 .BackgroundPatternColor = wdColorGray125

 End With
End Sub

See also

Concepts

Style Object

Other resources

Style Object Members


Style.Type Property (Word)

 Copy code hover
[image]

Style.Type Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the style type. Read-only WdStyleType.

Syntax

expression .Type

expression Required. A variable that represents a Style object.

Example

This example displays a message that indicates the style type of the style named "SubTitle" in the active document.

VBA Copy code Copy code
If ActiveDocument.Styles("SubTitle").Type = _
 wdStyleTypeParagraph Then
 MsgBox "Paragraph style"
ElseIf ActiveDocument.Styles("SubTitle").Type = _
 wdStyleTypeCharacter Then
 MsgBox "Character style"
End If

See also

Concepts

Style Object

Other resources

Style Object Members


Style.UnhideWhenUsed Property (Word)

 Copy code hover
[image]

Style.UnhideWhenUsed Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified style is made visible as a recommended style in the Styles and in theStyles task pane in Word 2010 after it is used in the document. Read/write.

Version Information

Version Added: Word 2010

Syntax

expression .UnhideWhenUsed

expression An expression that returns a Style object.

See also

Concepts

Style Object

Other resources

Style Object Members


Style.Visibility Property (Word)

 Copy code hover
[image]

Style.Visibility Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified style is visible as a recommended style in the Styles gallery and in theStyles task pane. Read/write.

Version Information

Version Added: Word 2010

Syntax

expression .Visibility

expression An expression that returns a Style object.

See also

Concepts

Style Object

Other resources

Style Object Members


Style Methods (Word)

 Copy code hover
[image]

Style Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:


Style.Delete Method (Word)

 Copy code hover
[image]

Style.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the specified style.

Syntax

expression .Delete

expression Required. A variable that represents a Style object.

See also

Concepts

Style Object

Other resources

Style Object Members


Style.LinkToListTemplate Method (Word)

 Copy code hover
[image]

Style.LinkToListTemplate Method (Word)
See also Send feedback

Published: July 16, 2012

Links the specified style to a list template so that the style's formatting can be applied to lists.

Syntax

expression .LinkToListTemplate(ListTemplate, ListLevelNumber)

expression Required. A variable that represents a Style object.

Parameters

Name | Required/Optional | Data Type | Description
ListTemplate | Required | ListTemplate object | The list template that the style is to be linked to.
ListLevelNumber | Optional | Variant | An integer corresponding to the list level that the style is to be linked to. If this argument is omitted, then the level of the style is used.

Example

This example creates a new list template and then links heading styles 1 through 9 to levels 1 through 9. The new list template is then applied to the document. Any paragraphs formatted as heading styles will assume the numbering from the list template.

VBA Copy code Copy code
Dim ltTemp As ListTemplate
Dim intLoop As Integer

Set ltTemp = _
 ActiveDocument.ListTemplates.Add(OutlineNumbered:=True)

For intLoop = 1 To 9
 With ltTemp.ListLevels(intLoop)
 .NumberStyle = wdListNumberStyleArabic
 .NumberPosition = InchesToPoints(0.25 * (intLoop - 1))
 .TextPosition = InchesToPoints(0.25 * intLoop)
 .NumberFormat = "%" & intLoop & "."
 End With
 With ActiveDocument.Styles("Heading " & intLoop)
 .LinkToListTemplate ListTemplate:=ltTemp
 End With
Next intLoop

ActiveDocument.Content.ListFormat.ApplyListTemplate _
 ListTemplate:=ltTemp

See also

Concepts

Style Object

Other resources

Style Object Members


Styles Object (Word)

 Copy code hover
[image]

Styles Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of Style objects that represent both the built-in and user-defined styles in a document.

Remarks

Use the Styles property to return the Styles collection. The following example deletes all user-defined styles in the active document.

VBA Copy code Copy code
For Each sty In ActiveDocument.Styles
 If sty.BuiltIn = False Then sty.Delete
Next sty

Use the Add method to create a new user-defined style and add it to the Styles collection. The following example adds a new character style named "Introduction" and makes it 12-point Arial, with bold and italic formatting. The example then applies this new character style to the selection.

VBA Copy code Copy code
Set myStyle = ActiveDocument.Styles.Add(Name:="Introduction", _
 Type:=wdStyleTypeCharacter)
With myStyle.Font
 .Bold = True
 .Italic = True
 .Name = "Arial"
 .Size = 12
End With
Selection.Range.Style = "Introduction"

Use Styles(Index), where Index is the style name, a WdBuiltinStyle constant or index number, to return a single Style object. You must exactly match the spelling and spacing of the style name, but not necessarily its capitalization. The following example modifies the font of the user-defined style named "Color" in the active document.

VBA Copy code Copy code
ActiveDocument.Styles("Color").Font.Name = "Arial"

The following example sets the built-in Heading 1 style to not be bold.

VBA Copy code Copy code
ActiveDocument.Styles(wdStyleHeading1).Font.Bold = False

The style index number represents the position of the style in the alphabetically sorted list of style names. Note that Styles(1) is the first style in the alphabetical list. The following example displays the base style and style name of the first style in the Styles collection.

VBA Copy code Copy code
MsgBox "Base style= " _
 & ActiveDocument.Styles(1).BaseStyle & vbCr _
 & "Style name= " & ActiveDocument.Styles(1).NameLocal

The Styles object is not available from the Template object. However, you can use the OpenAsDocument method to open a template as a document so that you can modify styles in the template. The following example changes the formatting of the Heading 1 style in the template attached to the active document.

VBA Copy code Copy code
Set aDoc = ActiveDocument.AttachedTemplate.OpenAsDocument
With aDoc
 .Styles(wdStyleHeading1).Font.Name = "Arial"
 .Close SaveChanges:=wdSaveChanges
End With

Use the OrganizerCopy method to copy styles between documents and templates. Use the UpdateStyles method to update the styles in the active document to match the style definitions in the attached template.

See also

Concepts

Word Object Model Reference

Other resources

Styles Object Members


Styles Members (Word)

 Copy code hover
[image]

Styles Members (Word)
Send feedback

Published: July 16, 2012

A collection of Style objects that represent both the built-in and user-defined styles in a document.

Methods

Name | Description
Add | Returns a HeadingStyle object that represents a new heading style added to a document.
Item | Returns an individual Style object in a collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of styles in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified Styles object.


Styles Properties (Word)

 Copy code hover
[image]

Styles Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of styles in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified Styles object.


Styles.Application Property (Word)

 Copy code hover
[image]

Styles.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a Styles collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

Styles Collection Object

Other resources

Styles Object Members


Styles.Count Property (Word)

 Copy code hover
[image]

Styles.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of styles in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents a Styles collection.

See also

Concepts

Styles Collection Object

Other resources

Styles Object Members


Styles.Creator Property (Word)

 Copy code hover
[image]

Styles.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a Styles collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Styles Collection Object

Other resources

Styles Object Members


Styles.Parent Property (Word)

 Copy code hover
[image]

Styles.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Styles object.

Syntax

expression .Parent

expression Required. A variable that represents a Styles collection.

See also

Concepts

Styles Collection Object

Other resources

Styles Object Members


Styles Methods (Word)

 Copy code hover
[image]

Styles Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Returns a HeadingStyle object that represents a new heading style added to a document.
Item | Returns an individual Style object in a collection.


Styles.Add Method (Word)

 Copy code hover
[image]

Styles.Add Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a HeadingStyle object that represents a new heading style added to a document.

Syntax

expression .Add(Style, Level)

expression Required. A variable that represents a Styles collection.

Parameters

Name | Required/Optional | Data Type | Description
Style | Required | Variant | The style you want to add. You can specify this argument by using either the string name for the style or a Style object.
Level | Required | Integer | A number that represents the level of the heading.

Return Value

HeadingStyle

Remarks

The new heading style will be included whenever you compile a table of contents or table of figures.

Example

This example adds a table of contents at the beginning of the active document and then adds the Title style to the list of styles used to build a table of contents.

VBA Copy code Copy code
Set myToc = ActiveDocument.TablesOfContents _
 .Add(Range:=ActiveDocument.Range(0, 0), _
 UseHeadingStyles:=True, UpperHeadingLevel:=1, _
 LowerHeadingLevel:=3)
myToc.HeadingStyles.Add Style:="Title", Level:=2

See also

Concepts

Styles Collection Object

Other resources

Styles Object Members


Styles.Item Method (Word)

 Copy code hover
[image]

Styles.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual Style object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents a Styles collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The individual object to be returned. Can be a Long indicating the ordinal position or a String representing the name of the individual object.

Return Value

Style

See also

Concepts

Styles Collection Object

Other resources

Styles Object Members


StyleSheet Object (Word)

 Copy code hover
[image]

StyleSheet Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a single cascading style sheet attached to a Web document. The StyleSheet object is a member of the StyleSheets collection. The StyleSheets collection contains all the cascading style sheets attached to a specified document.

Remarks

Use the Item method or StyleSheets(Index), where Index is the name or number of the style sheet, of the StyleSheets collection to return a StyleSheet object. The following example removes the second style sheet from the StyleSheets collection.

VBA Copy code Copy code
Sub WebStyleSheets()
 ActiveDocument.StyleSheets.Item(2).Delete
End Sub

Use the Index property to determine the precedence of cascading style sheets. The following example creates a table of attached cascading style sheets, ordered and indexed according to which style sheet is most important.

VBA Copy code Copy code
Sub CSSTable()
 Dim styCSS As StyleSheet

 With ActiveDocument.Range(Start:=0, End:=0)
 .InsertAfter "CSS Name" & vbTab & "Index"
 .InsertParagraphAfter
 For Each styCSS In ActiveDocument.StyleSheets
 .InsertAfter styCSS.Name & vbTab & styCSS.Index
 .InsertParagraphAfter
 Next styCSS
 .ConvertToTable
 End With
End Sub

Use the Move method to reorder the precedence of attached style sheets. The following example moves the most important style sheet to the least important of all attached cascading style sheets.

VBA Copy code Copy code
Sub MoveCSS()
 ActiveDocument.StyleSheets(1) _
 .Move wdStyleSheetPrecedenceLowest
End Sub

See also

Concepts

Word Object Model Reference

Other resources

StyleSheet Object Members


StyleSheet Members (Word)

 Copy code hover
[image]

StyleSheet Members (Word)
Send feedback

Published: July 16, 2012

Represents a single cascading style sheet attached to a Web document. The StyleSheet object is a member of the StyleSheets collection. The StyleSheets collection contains all the cascading style sheets attached to a specified document.

Methods

Name | Description
Delete | Deletes the specified cascading style sheet.
Move | Moves a style sheet's order of precedence.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
FullName | Specifies the name of a cascading style sheet, including the drive or Web path. Read-only String.
Index | Returns a Long that represents the position of an item in a collection. Read-only.
Name | Returns the name of the specified object. Read-only String.
Parent | Returns an Object that represents the parent object of the specified StyleSheet object.
Path | Returns the disk or Web path to the specified style sheet. Read-only String.
Title | Returns or sets a String representing the title of a Web style sheet. Read/write.
Type | Returns or sets the style sheet type. Read/write WdStyleSheetLinkType.


StyleSheet Properties (Word)

 Copy code hover
[image]

StyleSheet Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
FullName | Specifies the name of a cascading style sheet, including the drive or Web path. Read-only String.
Index | Returns a Long that represents the position of an item in a collection. Read-only.
Name | Returns the name of the specified object. Read-only String.
Parent | Returns an Object that represents the parent object of the specified StyleSheet object.
Path | Returns the disk or Web path to the specified style sheet. Read-only String.
Title | Returns or sets a String representing the title of a Web style sheet. Read/write.
Type | Returns or sets the style sheet type. Read/write WdStyleSheetLinkType.


StyleSheet.Application Property (Word)

 Copy code hover
[image]

StyleSheet.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a StyleSheet object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

StyleSheet Object

Other resources

StyleSheet Object Members


StyleSheet.Creator Property (Word)

 Copy code hover
[image]

StyleSheet.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a StyleSheet object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

StyleSheet Object

Other resources

StyleSheet Object Members


StyleSheet.FullName Property (Word)

 Copy code hover
[image]

StyleSheet.FullName Property (Word)
See also Send feedback

Published: July 16, 2012

Specifies the name of a cascading style sheet, including the drive or Web path. Read-only String.

Syntax

expression .FullName

expression Required. A variable that represents a StyleSheet object.

Remarks

Using this property is equivalent to using the Path, PathSeparator, and Name properties in sequence.

Example

This example displays the path and file name of the style sheet attached to the active document.

VBA Copy code Copy code
Sub CSSName()
 MsgBox ActiveDocument.StyleSheets(1).FullName
End Sub

See also

Concepts

StyleSheet Object

Other resources

StyleSheet Object Members


StyleSheet.Index Property (Word)

 Copy code hover
[image]

StyleSheet.Index Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the position of an item in a collection. Read-only.

Syntax

expression .Index

expression Required. A variable that represents a StyleSheet object.

See also

Concepts

StyleSheet Object

Other resources

StyleSheet Object Members


StyleSheet.Name Property (Word)

 Copy code hover
[image]

StyleSheet.Name Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the name of the specified object. Read-only String.

Syntax

expression .Name

expression Required. A variable that represents a StyleSheet object.

See also

Concepts

StyleSheet Object

Other resources

StyleSheet Object Members


StyleSheet.Parent Property (Word)

 Copy code hover
[image]

StyleSheet.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified StyleSheet object.

Syntax

expression .Parent

expression Required. A variable that represents a StyleSheet object.

See also

Concepts

StyleSheet Object

Other resources

StyleSheet Object Members


StyleSheet.Path Property (Word)

 Copy code hover
[image]

StyleSheet.Path Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the disk or Web path to the specified style sheet. Read-only String.

Syntax

expression .Path

expression Required. A variable that represents a StyleSheet object.

Remarks

The path doesn't include a trailing character—for example, "C:\MSOffice" or "http://MyServer". Use the PathSeparator property to add the character that separates folders and drive letters, and use the Name property to return the file name without the path.

Note Note

You can use the PathSeparator property to build Web addresses even though they contain forward slashes (/) and the PathSeparator property defaults to a backslash (\).

See also

Concepts

StyleSheet Object

Other resources

StyleSheet Object Members


StyleSheet.Title Property (Word)

 Copy code hover
[image]

StyleSheet.Title Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a String representing the title of a Web style sheet. Read/write.

Syntax

expression .Title

expression Required. A variable that represents a StyleSheet object.

Example

This example assigns titles to the first three Web style sheets attached to the active document. This example assumes that there are three style sheets attached to the active document.

VBA Copy code Copy code
Sub AssignCSSTitle()
 ActiveDocument.StyleSheets.Item(1).Title = "New Look Stylesheet"
 ActiveDocument.StyleSheets.Item(2).Title = "Standard Web Stylesheet"
 ActiveDocument.StyleSheets.Item(3).Title = "Definitions Stylesheets"
End Sub

This example creates a list of Web style sheets attached to the active document and places the list in a new document. This example assumes there are one or more Web style sheets attached to the active document.

VBA Copy code Copy code
Sub CSSTitles()
 Dim docNew As Document
 Dim styCSS As StyleSheet

 Set docNew = Documents.Add

 With docNew.Range(Start:=0, End:=0)
 .InsertAfter "CSS Name : Assigned to " & ActiveDocument.Name _
 & vbTab & "Title"
 .InsertParagraphAfter
 For Each styCSS In ActiveDocument.StyleSheets
 .InsertAfter styCSS.Name & vbTab & styCSS.Title
 .InsertParagraphAfter
 Next styCSS
 .ConvertToTable
 End With
End Sub

See also

Concepts

StyleSheet Object

Other resources

StyleSheet Object Members


StyleSheet.Type Property (Word)

 Copy code hover
[image]

StyleSheet.Type Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the style sheet type. Read/write WdStyleSheetLinkType.

Syntax

expression .Type

expression Required. A variable that represents a StyleSheet object.

See also

Concepts

StyleSheet Object

Other resources

StyleSheet Object Members


StyleSheet Methods (Word)

 Copy code hover
[image]

StyleSheet Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the specified cascading style sheet.
Move | Moves a style sheet's order of precedence.


StyleSheet.Delete Method (Word)

 Copy code hover
[image]

StyleSheet.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the specified cascading style sheet.

Syntax

expression .Delete

expression Required. A variable that represents a StyleSheet object.

See also

Concepts

StyleSheet Object

Other resources

StyleSheet Object Members


StyleSheet.Move Method (Word)

 Copy code hover
[image]

StyleSheet.Move Method (Word)
See also Send feedback

Published: July 16, 2012

Moves a style sheet's order of precedence.

Syntax

expression .Move(Precedence)

expression Required. A variable that represents a StyleSheet object.

Parameters

Name | Required/Optional | Data Type | Description
Precedence | Required | WdStyleSheetPrecedence | The precedence level.

See also

Concepts

StyleSheet Object

Other resources

StyleSheet Object Members


StyleSheets Object (Word)

 Copy code hover
[image]

StyleSheets Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of StyleSheet objects that represents the cascading style sheets attached to a document. The StyleSheets collection includes all cascading style sheets displayed in the Linked CSS Style Sheets dialog box.

Remarks

Use the StyleSheets property to return the StyleSheets collection. Use the Add method to add a style sheet to the StyleSheets collection. The following example adds three cascading style sheets to the active document and sets the third as the highest in precedence.

VBA Copy code Copy code
Sub AddCSS()
 With ActiveDocument.StyleSheets
 .Add FileName:="Web.css", Title:="Web Styles"
 .Add FileName:="New.css", Linktype:=wdStyleSheetLinkTypeImported, _
 Title:="New Styles"
 .Add FileName:="Defs.css", Title:="Definitions", _
 Precedence:=wdStyleSheetPrecedenceHighest
 End With
End Sub

See also

Concepts

Word Object Model Reference

Other resources

StyleSheets Object Members


StyleSheets Members (Word)

 Copy code hover
[image]

StyleSheets Members (Word)
Send feedback

Published: July 16, 2012

A collection of StyleSheet objects that represents the cascading style sheets attached to a document. The StyleSheets collection includes all cascading style sheets displayed in the Linked CSS Style Sheets dialog box.

Methods

Name | Description
Add | Returns a StyleSheet object that represents a new style sheet added to a Web document.
Item | Returns an individual StyleSheet object in a collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of style sheets in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified StyleSheets object.


StyleSheets Properties (Word)

 Copy code hover
[image]

StyleSheets Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of style sheets in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified StyleSheets object.


StyleSheets.Application Property (Word)

 Copy code hover
[image]

StyleSheets.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a StyleSheets collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

StyleSheets Collection

Other resources

StyleSheets Object Members


StyleSheets.Count Property (Word)

 Copy code hover
[image]

StyleSheets.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of style sheets in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents a StyleSheets collection.

See also

Concepts

StyleSheets Collection

Other resources

StyleSheets Object Members


StyleSheets.Creator Property (Word)

 Copy code hover
[image]

StyleSheets.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a StyleSheets collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

StyleSheets Collection

Other resources

StyleSheets Object Members


StyleSheets.Parent Property (Word)

 Copy code hover
[image]

StyleSheets.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified StyleSheets object.

Syntax

expression .Parent

expression Required. A variable that represents a StyleSheets collection.

See also

Concepts

StyleSheets Collection

Other resources

StyleSheets Object Members


StyleSheets Methods (Word)

 Copy code hover
[image]

StyleSheets Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Returns a StyleSheet object that represents a new style sheet added to a Web document.
Item | Returns an individual StyleSheet object in a collection.


StyleSheets.Add Method (Word)

 Copy code hover
[image]

StyleSheets.Add Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a StyleSheet object that represents a new style sheet added to a Web document.

Syntax

expression .Add(FileName, LinkType, Title, Precedence)

expression Required. A variable that represents a StyleSheets collection.

Parameters

Name | Required/Optional | Data Type | Description
FileName | Required | String | The path and file name of the cascading style sheet.
LinkType | Required | WdStyleSheetLinkType | Indicates whether the style sheet should be added as a link or imported into the Web document.
Title | Required | String | The name of the style sheet.
Precedence | Required | WdStyleSheetPrecedence | Indicates the level of importance compared with other cascading style sheets attached to the Web document.

Return Value

StyleSheet

Example

This example adds a style sheet to the active document and places it highest in the list of style sheets attached to the document. This example assumes that you have a style sheet document named Website.css located on your drive C.

VBA Copy code Copy code
Sub NewStylesheet()
 ActiveDocument.StyleSheets.Add _
 FileName:="c:\WebSite.css", _
 Precedence:=wdStyleSheetPrecedenceHighest, _
 LinkType:=wdStyleSheetLinkTypeLinked, _
 Title:="Test Stylesheet"
End Sub

See also

Concepts

StyleSheets Collection

Other resources

StyleSheets Object Members


StyleSheets.Item Method (Word)

 Copy code hover
[image]

StyleSheets.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual StyleSheet object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents a StyleSheets collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The individual object to be returned. Can be a Long indicating the ordinal position or a String representing the name of the individual object.

Return Value

StyleSheet

See also

Concepts

StyleSheets Collection

Other resources

StyleSheets Object Members


Subdocument Object (Word)

 Copy code hover
[image]

Subdocument Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a subdocument within a document or range. The Subdocument object is a member of the Subdocuments collection. The Subdocuments collection includes all the subdocuments in the a range or document.

Remarks

Use Subdocuments(Index), where Index is the index number, to return a single Subdocument object. The following example displays the path and file name of the first subdocument in the active document.

VBA Copy code Copy code
If ActiveDocument.Subdocuments(1).HasFile = True Then
 MsgBox ActiveDocument.Subdocuments(1).Path & _
 Application.PathSeparator & _
 ActiveDocument.Subdocuments(1).Name
End If

Use the AddFromFile or AddFromRange method to add a subdocument to a document. The following example adds a subdocument named "Setup.doc" at the end of the active document.

VBA Copy code Copy code
ActiveDocument.Subdocuments.Expanded = True
Selection.EndKey Unit:=wdStory
Selection.InsertParagraphBefore
ActiveDocument.Subdocuments.AddFromFile Name:="C:\Temp\Setup.doc"

The following example applies the Heading 1 style to the first paragraph in the selection and then creates a subdocument for the contents of the selection.

VBA Copy code Copy code
Selection.Paragraphs(1).Style = wdStyleHeading1
With ActiveDocument.Subdocuments
 .Expanded = True
 .AddFromRange Range:=Selection.Range
End With

See also

Concepts

Word Object Model Reference

Other resources

Subdocument Object Members


Subdocument Members (Word)

 Copy code hover
[image]

Subdocument Members (Word)
Send feedback

Published: July 16, 2012

Represents a subdocument within a document or range. The Subdocument object is a member of the Subdocuments collection. The Subdocuments collection includes all the subdocuments in the a range or document.

Methods

Name | Description
Delete | Deletes the specified subdocument.
Open | Opens the specified subdocument. Returns a Document object that represents the opened subdocument.
Split | Divides an existing subdocument into two subdocuments at the same level in master document view or outline view.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
HasFile | True if the specified subdocument has been saved to a file. Read-only Boolean.
Level | Returns the heading level used to create the subdocument. Read-only Long.
Locked | True if a subdocument in a master document is locked. Read/write Boolean.
Name | Returns the name of the specified object. Read-only String.
Parent | Returns an Object that represents the parent object of the specified Subdocument object.
Path | Returns the disk or Web path to the specified subdocument. Read-only String.
Range | Returns a Range object that represents the portion of a document that's contained within the subdocument.


Subdocument Properties (Word)

 Copy code hover
[image]

Subdocument Properties (Word)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
HasFile | True if the specified subdocument has been saved to a file. Read-only Boolean.
Level | Returns the heading level used to create the subdocument. Read-only Long.
Locked | True if a subdocument in a master document is locked. Read/write Boolean.
Name | Returns the name of the specified object. Read-only String.
Parent | Returns an Object that represents the parent object of the specified Subdocument object.
Path | Returns the disk or Web path to the specified subdocument. Read-only String.
Range | Returns a Range object that represents the portion of a document that's contained within the subdocument.


Subdocument.Application Property (Word)

 Copy code hover
[image]

Subdocument.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a Subdocument object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

Subdocument Object

Other resources

Subdocument Object Members


Subdocument.Creator Property (Word)

 Copy code hover
[image]

Subdocument.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a Subdocument object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Subdocument Object

Other resources

Subdocument Object Members


Subdocument.HasFile Property (Word)

 Copy code hover
[image]

Subdocument.HasFile Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified subdocument has been saved to a file. Read-only Boolean.

Syntax

expression .HasFile

expression A variable that represents a Subdocument object.

Example

This example displays the file name of each subdocument in the active document. The example also displays a message for each subdocument that has not been saved.

VBA Copy code Copy code
Dim subLoop As Subdocument

For Each subLoop In ActiveDocument.Subdocuments
 subLoop.Range.Select
 If subLoop.HasFile = True Then
 MsgBox subLoop.Path & Application.PathSeparator _
 & subLoop.Name
 Else
 MsgBox "This subdocument has not been saved."
 End If
Next subLoop

See also

Concepts

Subdocument Object

Other resources

Subdocument Object Members


Subdocument.Level Property (Word)

 Copy code hover
[image]

Subdocument.Level Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the heading level used to create the subdocument. Read-only Long.

Syntax

expression .Level

expression Required. A variable that represents a Subdocument object.

Example

This example looks through each subdocument in the active document and displays the subdocument's heading level.

VBA Copy code Copy code
i = 1
If ActiveDocument.Subdocuments.Count > = 1 Then
 For each s in ActiveDocument.Subdocuments
 MsgBox "The heading level for SubDoc " & i _
 & " is " & s.Level
 i = i + 1
 Next s
Else
 MsgBox "There are no subdocuments defined."
End If

See also

Concepts

Subdocument Object

Other resources

Subdocument Object Members


Subdocument.Locked Property (Word)

 Copy code hover
[image]

Subdocument.Locked Property (Word)
See also Send feedback

Published: July 16, 2012

True if a subdocument in a master document is locked. Read/write Boolean.

Syntax

expression .Locked

expression Required. A variable that represents a Subdocument object.

Example

This example checks the first subdocument in the specified master document and sets the master document to allow only comments if the subdocument is locked.

VBA Copy code Copy code
If ActiveDocument.Subdocuments(1).Locked = True Then
 ActiveDocument.Protect Type:=wdAllowOnlyComments
End If

See also

Concepts

Subdocument Object

Other resources

Subdocument Object Members


Subdocument.Name Property (Word)

 Copy code hover
[image]

Subdocument.Name Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the name of the specified object. Read-only String.

Syntax

expression .Name

expression Required. A variable that represents a Subdocument object.

See also

Concepts

Subdocument Object

Other resources

Subdocument Object Members


Subdocument.Parent Property (Word)

 Copy code hover
[image]

Subdocument.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Subdocument object.

Syntax

expression .Parent

expression Required. A variable that represents a Subdocument object.

See also

Concepts

Subdocument Object

Other resources

Subdocument Object Members


Subdocument.Path Property (Word)

 Copy code hover
[image]

Subdocument.Path Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the disk or Web path to the specified subdocument. Read-only String.

Syntax

expression .Path

expression Required. A variable that represents a Subdocument object.

Remarks

The path doesn't include a trailing character — for example, "C:\MSOffice" or "http://MyServer". Use the PathSeparator property to add the character that separates folders and drive letters. Use the Name property to return the file name without the path.

Note Note

You can use the PathSeparator property to build Web addresses even though they contain forward slashes (/) and the PathSeparator property defaults to a backslash (\).

See also

Concepts

Subdocument Object

Other resources

Subdocument Object Members


Subdocument.Range Property (Word)

 Copy code hover
[image]

Subdocument.Range Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the portion of a document that's contained within the subdocument.

Syntax

expression .Range

expression Required. A variable that represents a Subdocument object.

Remarks

For information about returning a range from a document, see the Range method.

See also

Concepts

Subdocument Object

Other resources

Subdocument Object Members


Subdocument Methods (Word)

 Copy code hover
[image]

Subdocument Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the specified subdocument.
Open | Opens the specified subdocument. Returns a Document object that represents the opened subdocument.
Split | Divides an existing subdocument into two subdocuments at the same level in master document view or outline view.


Subdocument.Delete Method (Word)

 Copy code hover
[image]

Subdocument.Delete Method (Word)
See also Send feedback

Deletes the specified subdocument.

Syntax

expression .Delete

expression Required. A variable that represents a Subdocument object.

See also

Concepts

Subdocument Object

Other resources

Subdocument Object Members


Subdocument.Open Method (Word)

 Copy code hover
[image]

Subdocument.Open Method (Word)
See also Send feedback

Published: July 16, 2012

Opens the specified subdocument. Returns a Document object that represents the opened subdocument.

Syntax

expression .Open

expression Required. A variable that represents a Subdocument object.

Return Value

Document

See also

Concepts

Subdocument Object

Other resources

Subdocument Object Members


Subdocument.Split Method (Word)

 Copy code hover
[image]

Subdocument.Split Method (Word)
See also Send feedback

Published: July 16, 2012

Divides an existing subdocument into two subdocuments at the same level in master document view or outline view.

Syntax

expression .Split(Range)

expression Required. A variable that represents a Subdocument object.

Parameters

Name | Required/Optional | Data Type | Description
Range | Required | Range object | The range that, when the subdocument is split, becomes a separate subdocument.

Remarks

The division is at the beginning of the specified range. An error occurs if the document isn't in either master document or outline view or if the range isn't at the beginning of a paragraph in a subdocument.

Example

This example splits the selection from an existing subdocument into a separate subdocument.

VBA Copy code Copy code
Selection.Range.Subdocuments(1).Split Range:=Selection.Range

See also

Concepts

Subdocument Object

Other resources

Subdocument Object Members


Subdocuments Object (Word)

 Copy code hover
[image]

Subdocuments Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of Subdocument objects that represent the subdocuments in a range or document.

Remarks

Use the Subdocuments property to return the Subdocuments collection. The following example expands all the subdocuments in the active document.

VBA Copy code Copy code
ActiveDocument.Subdocuments.Expanded = True

Use the AddFromFile or AddFromRange method to add a subdocument to a document. The following example adds a subdocument named "Setup.doc" at the end of the active document.

VBA Copy code Copy code
ActiveDocument.Subdocuments.Expanded = True
Selection.EndKey Unit:=wdStory
Selection.InsertParagraphBefore
ActiveDocument.Subdocuments.AddFromFile Name:="C:\Temp\Setup.doc"

The following example applies the Heading 1 style to the first paragraph in the selection and then creates a subdocument for the contents of the selection.

VBA Copy code Copy code
Selection.Paragraphs(1).Style = wdStyleHeading1
With ActiveDocument.Subdocuments
 .Expanded = True
 .AddFromRange Range:=Selection.Range
End With

Use Subdocuments(Index), where Index is the index number, to return a single Subdocument object. The following example displays the path and file name of the first subdocument in the active document.

VBA Copy code Copy code
If ActiveDocument.Subdocuments(1).HasFile = True Then
 MsgBox ActiveDocument.Subdocuments(1).Path & _
 Application.PathSeparator _
 & ActiveDocument.Subdocuments(1).Name
End If

See also

Concepts

Word Object Model Reference

Other resources

Subdocuments Object Members


Subdocuments Members (Word)

 Copy code hover
[image]

Subdocuments Members (Word)
Send feedback

Published: July 16, 2012

A collection of Subdocument objects that represent the subdocuments in a range or document.

Methods

Name | Description
AddFromFile | Adds the specified subdocument to the master document at the start of the selection and returns a Subdocument object.
AddFromRange | Creates one or more subdocuments from the text in the specified range and returns a SubDocument object.
Delete | Deletes the collection of subdocuments.
Item | Returns an individual Subdocument object in a collection.
Merge | Merges the specified subdocuments of a master document into a single subdocument.
Select | Selects the specified subdocument.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of subdocuments in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Expanded | True if the subdocuments in the specified document are expanded. Read/write Boolean.
Parent | Returns an Object that represents the parent object of the specified Subdocuments object.


Subdocuments Properties (Word)

 Copy code hover
[image]

Subdocuments Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of subdocuments in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Expanded | True if the subdocuments in the specified document are expanded. Read/write Boolean.
Parent | Returns an Object that represents the parent object of the specified Subdocuments object.


Subdocuments.Application Property (Word)

 Copy code hover
[image]

Subdocuments.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a Subdocuments collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

Subdocuments Collection Object

Other resources

Subdocuments Object Members


Subdocuments.Count Property (Word)

 Copy code hover
[image]

Subdocuments.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of subdocuments in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents a Subdocuments collection.

See also

Concepts

Subdocuments Collection Object

Other resources

Subdocuments Object Members


Subdocuments.Creator Property (Word)

 Copy code hover
[image]

Subdocuments.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a Subdocuments collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Subdocuments Collection Object

Other resources

Subdocuments Object Members


Subdocuments.Expanded Property (Word)

 Copy code hover
[image]

Subdocuments.Expanded Property (Word)
See also Send feedback

Published: July 16, 2012

True if the subdocuments in the specified document are expanded. Read/write Boolean.

Syntax

expression .Expanded

expression A variable that represents a Subdocument object.

Example

This example expands all subdocuments in the active master document.

VBA Copy code Copy code
If ActiveDocument.Subdocuments.Count >= 1 Then
 ActiveDocument.Subdocuments.Expanded = True
End If

This example switches the Expanded property between expanding all subdocuments in the active window and collapsing all subdocuments in the active document.

VBA Copy code Copy code
ActiveDocument.Subdocuments.Expanded = _
 Not ActiveDocument.Subdocuments.Expanded

This example determines whether the subdocuments in Report.doc are expanded and then displays a message indicating their status.

VBA Copy code Copy code
If Documents("Report.doc").Subdocuments.Expanded = True Then
 MsgBox "All available information is displayed."
Else
 MsgBox "Expand subdocuments for more information."
End If

See also

Concepts

Subdocuments Collection Object

Other resources

Subdocuments Object Members


Subdocuments.Parent Property (Word)

 Copy code hover
[image]

Subdocuments.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Subdocuments object.

Syntax

expression .Parent

expression Required. A variable that represents a Subdocuments collection.

See also

Concepts

Subdocuments Collection Object

Other resources

Subdocuments Object Members


Subdocuments Methods (Word)

 Copy code hover
[image]

Subdocuments Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
AddFromFile | Adds the specified subdocument to the master document at the start of the selection and returns a Subdocument object.
AddFromRange | Creates one or more subdocuments from the text in the specified range and returns a SubDocument object.
Delete | Deletes the collection of subdocuments.
Item | Returns an individual Subdocument object in a collection.
Merge | Merges the specified subdocuments of a master document into a single subdocument.
Select | Selects the specified subdocument.


Subdocuments.AddFromFile Method (Word)

 Copy code hover
[image]

Subdocuments.AddFromFile Method (Word)
See also Send feedback

Published: July 16, 2012

Adds the specified subdocument to the master document at the start of the selection and returns a Subdocument object.

Syntax

expression .AddFromFile(Name, ConfirmConversions, ReadOnly, PasswordDocument, PasswordTemplate, Revert, WritePasswordDocument, WritePasswordTemplate)

expression Required. A variable that represents a Subdocuments collection.

Parameters

Name | Required/Optional | Data Type | Description
Name | Required | String | The file name of the subdocument to be inserted into the master document.
ConfirmConversions | Optional | Variant | True to confirm file conversion in the Convert File dialog box if the file isn't in Word format.
ReadOnly | Optional | Variant | True to insert the subdocument as a read-only document.
PasswordDocument | Optional | Variant | The password required to open the subdocument if it is password protected.
PasswordTemplate | Optional | Variant | The password required to open the template attached to the subdocument if the template is password protected.
Revert | Optional | Variant | Controls what happens if Name is the file name of an open document. True to insert the saved version of the subdocument. False to insert the open version of the subdocument, which may contain unsaved changes.
WritePasswordDocument | Optional | Variant | The password required to save changes to the document file if it is write-protected.
WritePasswordTemplate | Optional | Variant | The password required to save changes to the template attached to the subdocument if the template is write-protected.

Return Value

Subdocument

Remarks

If the active view isn't either outline view or master document view, an error occurs.

Example

This example adds a subdocument named "Subdoc.doc" to the active document.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.View.Type = wdMasterView
ActiveDocument.Subdocuments.AddFromFile _
 Name:="C:\Subdoc.doc"

This example adds a password-protected subdocument named "Subdoc.doc" to the active document on a read-only basis and sets the PasswordDocument parameter to a String variable.

VBA Copy code Copy code
Selection.Range.Subdocuments.AddFromFile Name:="C:\Subdoc.doc", _
 ReadOnly:=True, PasswordDocument:=strPassword

See also

Concepts

Subdocuments Collection Object

Other resources

Subdocuments Object Members


Subdocuments.AddFromRange Method (Word)

 Copy code hover
[image]

Subdocuments.AddFromRange Method (Word)
See also Send feedback

Published: July 16, 2012

Creates one or more subdocuments from the text in the specified range and returns a SubDocument object.

Syntax

expression .AddFromRange(Range)

expression Required. A variable that represents a Subdocuments collection.

Parameters

Name | Required/Optional | Data Type | Description
Range | Required | Range object | The range used to create one or more subdocuments.

Return Value

SubDocument

Remarks

The Range argument must begin with one of the built-in heading level styles (for example, Heading 1). Subdocuments are created at each paragraph formatted with the same heading format used at the beginning of the range. Subdocument files are saved when the master document is saved and are automatically named using text from the first line in the file.

Example

This example creates one or more subdocuments from the selection.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.View.Type = wdMasterView
ActiveDocument.SubDocuments.AddFromRange Range:=Selection.Range

See also

Concepts

Subdocuments Collection Object

Other resources

Subdocuments Object Members


Subdocuments.Delete Method (Word)

 Copy code hover
[image]

Subdocuments.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the collection of subdocuments.

Syntax

expression .Delete

expression Required. A variable that represents a Subdocuments collection.

See also

Concepts

Subdocuments Collection Object

Other resources

Subdocuments Object Members


Subdocuments.Item Method (Word)

 Copy code hover
[image]

Subdocuments.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual Subdocument object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents a Subdocuments collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The individual object to be returned. Can be a Long indicating the ordinal position of the individual object.

Return Value

Subdocument

See also

Concepts

Subdocuments Collection Object

Other resources

Subdocuments Object Members


Subdocuments.Merge Method (Word)

 Copy code hover
[image]

Subdocuments.Merge Method (Word)
See also Send feedback

Published: July 16, 2012

Merges the specified subdocuments of a master document into a single subdocument.

Syntax

expression .Merge(FirstSubdocument, LastSubdocument)

expression Required. A variable that represents a Subdocuments collection.

Parameters

Name | Required/Optional | Data Type | Description
FirstSubdocument | Optional | Variant | The path and file name of the original document you want to merge revisions with.
LastSubdocument | Optional | Variant | The last subdocument in a range of subdocuments to be merged.

Example

This example merges the first and second subdocuments in the active document into one subdocument.

VBA Copy code Copy code
If ActiveDocument.Subdocuments.Count >= 2 Then
 Set aDoc = ActiveDocument
 aDoc.Subdocuments.Merge _
 FirstSubdocument:=aDoc.Subdocuments(1), _
 LastSubdocument:=aDoc.Subdocuments(2)
End If

See also

Concepts

Subdocuments Collection Object

Other resources

Subdocuments Object Members


Subdocuments.Select Method (Word)

 Copy code hover
[image]

Subdocuments.Select Method (Word)
See also Send feedback

Published: July 16, 2012

Selects the specified subdocument.

Syntax

expression .Select

expression Required. A variable that represents a Subdocuments collection.

Remarks

After using this method, use the Selection object to work with the selected items. For more information, see Working with the Selection Object.

See also

Concepts

Subdocuments Collection Object

Other resources

Subdocuments Object Members


SynonymInfo Object (Word)

 Copy code hover
[image]

SynonymInfo Object (Word)
See also Send feedback

Published: July 16, 2012

Represents the information about synonyms, antonyms, related words, or related expressions for the specified range or a given string.

Remarks

Use the SynonymInfo property to return a SynonymInfo object. The SynonymInfo object can be returned either from a range or from Microsoft Office Word. If it is returned from Word, you specify the lookup word or phrase and a proofing language ID. If it is returned from a range, Word uses the specified range as the lookup word. The following example returns a SynonymInfo object from Word.

VBA Copy code Copy code
temp = SynonymInfo(Word:="meant", LanguageID:=wdEnglishUS).Found

The following example returns a SynonymInfo object from a range.

VBA Copy code Copy code
temp = Selection.Range.SynonymInfo.Found

The Found property, used in the preceding examples, returns True if any information is found in the thesaurus for the specified range or for Word. Note, however, that this property returns True not only if synonyms are found but also if related words, related expressions, or antonyms are found.

Many of the properties of the SynonymInfo object return a Variant that contains an array of strings. When working with these properties, you can assign the returned array to a variable and then index the variable to see the elements in the array. In the following example, Slist is assigned the synonym list for the first meaning of the selected word or phrase. The UBound function finds the upper bound of the array, and then each element is displayed in a message box.

VBA Copy code Copy code
Slist = Selection.Range.SynonymInfo.SynonymList(1)
For i = 1 To UBound(Slist)
 Msgbox Slist(i)
Next i

You can check the value of the MeaningCount property to prevent potential errors in your code. The following example returns a list of synonyms for the second meaning for the word or phrase in the selection and displays these synonyms in the Immediate pane.

VBA Copy code Copy code
Set synInfo = Selection.Range.SynonymInfo
If synInfo.MeaningCount >= 2 Then
 synList = synInfo.SynonymList(2)
 For i = 1 To UBound(synList)
 Debug.Print synList(i)
 Next i
Else
 MsgBox "There is no second meaning for the selection."
End If

See also

Concepts

Word Object Model Reference

Other resources

SynonymInfo Object Members


SynonymInfo Members (Word)

 Copy code hover
[image]

SynonymInfo Members (Word)
Send feedback

Published: July 16, 2012

Represents the information about synonyms, antonyms, related words, or related expressions for the specified range or a given string.

Properties

Name | Description
AntonymList | Returns a list of antonyms for the word or phrase. The list is returned as an array of strings. Read-only Variant.
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Found | True if the thesaurus finds synonyms, antonyms, related words, or related expressions for the word or phrase. Read-only Boolean.
MeaningCount | Returns the number of entries in the list of meanings found in the thesaurus for the word or phrase. Returns 0 (zero) if no meanings were found. Read-only Long.
MeaningList | Returns the list of meanings for the word or phrase. The list is returned as an array of strings. Read-only Variant.
Parent | Returns an Object that represents the parent object of the specified SynonymInfo object.
PartOfSpeechList | Returns a list of the parts of speech corresponding to the meanings found for the word or phrase looked up in the thesaurus. The list is returned as an array of integers. Read-only Variant.
RelatedExpressionList | Returns a list of expressions related to the specified word or phrase. The list is returned as an array of strings. Read-only Variant.
RelatedWordList | Returns a list of words related to the specified word or phrase. The list is returned as an array of strings. Read-only Variant.
SynonymList | Returns a list of synonyms for a specified meaning of a word or phrase. The list is returned as an array of strings. Read-only Variant.
Word | Returns the word or phrase that was looked up by the thesaurus. Read-only String.


SynonymInfo Properties (Word)

 Copy code hover
[image]

SynonymInfo Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
AntonymList | Returns a list of antonyms for the word or phrase. The list is returned as an array of strings. Read-only Variant.
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Found | True if the thesaurus finds synonyms, antonyms, related words, or related expressions for the word or phrase. Read-only Boolean.
MeaningCount | Returns the number of entries in the list of meanings found in the thesaurus for the word or phrase. Returns 0 (zero) if no meanings were found. Read-only Long.
MeaningList | Returns the list of meanings for the word or phrase. The list is returned as an array of strings. Read-only Variant.
Parent | Returns an Object that represents the parent object of the specified SynonymInfo object.
PartOfSpeechList | Returns a list of the parts of speech corresponding to the meanings found for the word or phrase looked up in the thesaurus. The list is returned as an array of integers. Read-only Variant.
RelatedExpressionList | Returns a list of expressions related to the specified word or phrase. The list is returned as an array of strings. Read-only Variant.
RelatedWordList | Returns a list of words related to the specified word or phrase. The list is returned as an array of strings. Read-only Variant.
SynonymList | Returns a list of synonyms for a specified meaning of a word or phrase. The list is returned as an array of strings. Read-only Variant.
Word | Returns the word or phrase that was looked up by the thesaurus. Read-only String.


SynonymInfo.AntonymList Property (Word)

 Copy code hover
[image]

SynonymInfo.AntonymList Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a list of antonyms for the word or phrase. The list is returned as an array of strings. Read-only Variant.

Syntax

expression .AntonymList

expression An expression that returns a SynonymInfo object.

Remarks

The AntonymList property is a property of the SynonymInfo object, which can be returned from either a range or the application. If this object is returned from the application, you specify the word to look up and the language to use. When the object is returned from a range, the range is looked up using the language of the range.

Example

This example returns a list of antonyms for the word "big" in U.S. English.

VBA Copy code Copy code
Dim arrayAntonyms As Variant
Dim intLoop As Integer

arrayAntonyms = SynonymInfo(Word:="big", _
 LanguageID:=wdEnglishUS).AntonymList
For intLoop = 1 To UBound(arrayAntonyms)
 MsgBox arrayAntonyms(intLoop)
Next intLoop

This example returns a list of antonyms for the word or phrase in the selection and displays them in the Immediate window in the Visual Basic Editor.

VBA Copy code Copy code
Dim arrayAntonyms As Variant
Dim intLoop As Integer

arrayAntonyms = Selection.Range.SynonymInfo.AntonymList
If UBound(arrayAntonyms) <> 0 Then
 For intLoop = 1 To UBound(arrayAntonyms)
 Debug.Print arrayAntonyms(intLoop) & Str(intLoop)
 Next intLoop
Else
 MsgBox "No antonyms were found."
End If

This example returns a list of antonyms, if there are any, for the third word in the active document.

VBA Copy code Copy code
Dim rngTemp As Range
Dim arrayAntonyms As Variant
Dim intLoop As Integer

Set rngTemp = ActiveDocument.Words(3)

arrayAntonyms = rngTemp.SynonymInfo.AntonymList
If UBound(arrayAntonyms) = 0 Then
 MsgBox "There are no antonyms for the third word."
Else
 For intLoop = 1 To UBound(arrayAntonyms)
 MsgBox arrayAntonyms(intLoop)
 Next intLoop
End If

See also

Concepts

SynonymInfo Object

Other resources

SynonymInfo Object Members


SynonymInfo.Application Property (Word)

 Copy code hover
[image]

SynonymInfo.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a SynonymInfo object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

SynonymInfo Object

Other resources

SynonymInfo Object Members


SynonymInfo.Creator Property (Word)

 Copy code hover
[image]

SynonymInfo.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a SynonymInfo object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

SynonymInfo Object

Other resources

SynonymInfo Object Members


SynonymInfo.Found Property (Word)

 Copy code hover
[image]

SynonymInfo.Found Property (Word)
See also Send feedback

Published: July 16, 2012

True if the thesaurus finds synonyms, antonyms, related words, or related expressions for the word or phrase. Read-only Boolean.

Syntax

expression .Found

expression A variable that represents a SynonymInfo object.

Example

This example checks to see whether the thesaurus contains any synonym suggestions for the word "authorize."

VBA Copy code Copy code
Dim siTemp As SynonymInfo

Set siTemp = SynonymInfo(Word:="authorize", _
 LanguageID:=wdEnglishUS)
If siTemp.Found = True Then
 Msgbox "The thesaurus has suggestions."
Else
 Msgbox "The thesaurus has no suggestions."
End If

This example checks to see whether the thesaurus contains any synonym suggestions for the selection. If it does, the example displays the Thesaurus dialog box with the synonyms listed.

VBA Copy code Copy code
Dim siTemp As SynonymInfo

Set siTemp = Selection.Range.SynonymInfo
If siTemp.Found = True Then
 Selection.Range.CheckSynonyms
Else
 Msgbox "The thesaurus has no suggestions."
End If

This example removes formatting from the find criteria before searching the selection. If the word "Hello" with bold formatting is found, the entire paragraph is selected and copied to the Clipboard.

VBA Copy code Copy code
With Selection.Find
 .ClearFormatting
 .Font.Bold = True
 .Execute FindText:="Hello", Format:=True, Forward:=True
 If .Found = True Then
 .Parent.Expand Unit:=wdParagraph
 .Parent.Copy
 End If
End With

See also

Concepts

SynonymInfo Object

Other resources

SynonymInfo Object Members


SynonymInfo.MeaningCount Property (Word)

 Copy code hover
[image]

SynonymInfo.MeaningCount Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the number of entries in the list of meanings found in the thesaurus for the word or phrase. Returns 0 (zero) if no meanings were found. Read-only Long.

Syntax

expression .MeaningCount

expression An expression that returns a SynonymInfo object.

Remarks

Each meaning represents a unique list of synonyms for the word or phrase.

The lists of related words, related expressions, and antonyms aren't counted as entries in the list of meanings.

Example

This example checks to see whether any meanings were found for the selection. If any were found, the list of meanings is displayed in the Immediate window of the Visual Basic Editor.

VBA Copy code Copy code
Set mySynInfo = Selection.Range.SynonymInfo
If mySynInfo.MeaningCount <> 0 Then
 myList = mySynInfo.MeaningList
 For i = 1 To Ubound(myList)
 Debug.Print myList(i)
 Next i
Else
 Msgbox "There were no meanings found."
End If

See also

Concepts

SynonymInfo Object

Other resources

SynonymInfo Object Members


SynonymInfo.MeaningList Property (Word)

 Copy code hover
[image]

SynonymInfo.MeaningList Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the list of meanings for the word or phrase. The list is returned as an array of strings. Read-only Variant.

Syntax

expression .MeaningList

expression An expression that returns a SynonymInfo object.

Remarks

The lists of related words, related expressions, and antonyms aren't counted as entries in the list of meanings.

Example

This example checks to see whether any meanings were found for the third word in MyDoc.doc. If so, the meanings are displayed in a series of message boxes.

VBA Copy code Copy code
Set mySyn = Documents("MyDoc.doc").Words(3).SynonymInfo
If mySyn.MeaningCount <> 0 Then
 myList = mySyn.MeaningList
 For i = 1 To UBound(myList)
 Msgbox myList(i)
 Next i
Else
 Msgbox "There were no meanings found."
End If

See also

Concepts

SynonymInfo Object

Other resources

SynonymInfo Object Members


SynonymInfo.Parent Property (Word)

 Copy code hover
[image]

SynonymInfo.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified SynonymInfo object.

Syntax

expression .Parent

expression Required. A variable that represents a SynonymInfo object.

See also

Concepts

SynonymInfo Object

Other resources

SynonymInfo Object Members


SynonymInfo.PartOfSpeechList Property (Word)

 Copy code hover
[image]

SynonymInfo.PartOfSpeechList Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a list of the parts of speech corresponding to the meanings found for the word or phrase looked up in the thesaurus. The list is returned as an array of integers. Read-only Variant.

Syntax

expression .PartOfSpeechList

expression An expression that returns a SynonymInfo object.

Remarks

The list of the parts of speech is returned as an array consisting of the following WdPartOfSpeech constants: wdAdjective, wdAdverb, wdConjunction, wdIdiom, wdInterjection, wdNoun, wdOther, wdPreposition, wdPronoun, and wdVerb. The array elements are ordered to correspond to the elements returned by the MeaningList property.

Example

This example checks to see whether the thesaurus found any meanings for the selection. If so, the meanings and their corresponding parts of speech are displayed in a series of message boxes.

VBA Copy code Copy code
Set mySynInfo = Selection.Range.SynonymInfo
If mySynInfo.MeaningCount <> 0 Then
 myList = mySynInfo.MeaningList
 myPos = mySynInfo.PartOfSpeechList
 For i = 1 To UBound(myPos)
 Select Case myPos(i)
 Case wdAdjective
 pos = "adjective"
 Case wdNoun
 pos = "noun"
 Case wdAdverb
 pos = "adverb"
 Case wdVerb
 pos = "verb"
 Case Else
 pos = "other"
 End Select
 MsgBox myList(i) & " found as " & pos
 Next i
Else
 MsgBox "There were no meanings found."
End If

See also

Concepts

SynonymInfo Object

Other resources

SynonymInfo Object Members


SynonymInfo.RelatedExpressionList Property (Word)

 Copy code hover
[image]

SynonymInfo.RelatedExpressionList Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a list of expressions related to the specified word or phrase. The list is returned as an array of strings. Read-only Variant.

Syntax

expression .RelatedExpressionList

expression An expression that returns a SynonymInfo object.

Remarks

Typically, there are very few related expressions found in the thesaurus.

Example

This example checks to see whether any related expressions were found for the selection. If so, the meanings are displayed in a series of message boxes. If none were found, this is stated in a message box.

VBA Copy code Copy code
Set synInfo = Selection.Range.SynonymInfo
If synInfo.Found = True Then
 relList = synInfo.RelatedExpressionList
 If UBound(relList) <> 0 Then
 For intCount = 1 To UBound(relList)
 Msgbox relList(intCount)
 Next intCount
 Else
 Msgbox "There were no related expressions found."
 End If
End If

See also

Concepts

SynonymInfo Object

Other resources

SynonymInfo Object Members


SynonymInfo.RelatedWordList Property (Word)

 Copy code hover
[image]

SynonymInfo.RelatedWordList Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a list of words related to the specified word or phrase. The list is returned as an array of strings. Read-only Variant.

Syntax

expression .RelatedWordList

expression An expression that returns a SynonymInfo object.

Example

This example checks to see whether any related words were found for the third word in the active document. If so, the meanings are displayed in a series of message boxes. If there are no related words found, this is stated in a message box.

VBA Copy code Copy code
Set synInfo = ActiveDocument.Words(3).SynonymInfo
If synInfo.Found = True Then
 relList = synInfo.RelatedWordList
 If UBound(relList) <> 0 Then
 For intCount = 1 To UBound(relList)
 Msgbox relList(intCount)
 Next intCount
 Else
 Msgbox "There were no related words found."
 End If
End If

See also

Concepts

SynonymInfo Object

Other resources

SynonymInfo Object Members


SynonymInfo.SynonymList Property (Word)

 Copy code hover
[image]

SynonymInfo.SynonymList Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a list of synonyms for a specified meaning of a word or phrase. The list is returned as an array of strings. Read-only Variant.

Syntax

expression .SynonymList(Meaning)

expression An expression that returns a SynonymInfo object.

Example

This example returns a list of synonyms for the word "big," using the meaning "generous" in U.S. English.

VBA Copy code Copy code
Slist = SynonymInfo(Word:="big", LanguageID:=wdEnglishUS) _
 .SynonymList(Meaning:="generous")
For i = 1 To UBound(Slist)
 Msgbox Slist(i)
Next i

This example returns a list of synonyms for the second meaning of the selected word or phrase and displays these synonyms in the Immediate window of the Visual Basic editor. If there is no second meaning or if there are no synonyms, this is stated in a message box.

VBA Copy code Copy code
Set mySi = Selection.Range.SynonymInfo
If mySi.MeaningCount >= 2 Then
 synList = mySi.SynonymList(Meaning:=2)
 For i = 1 To UBound(synList)
 Debug.Print synList(i)
 Next i
Else
 MsgBox "There is no second meaning for this word or phrase."
End If

See also

Concepts

SynonymInfo Object

Other resources

SynonymInfo Object Members


SynonymInfo.Word Property (Word)

 Copy code hover
[image]

SynonymInfo.Word Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the word or phrase that was looked up by the thesaurus. Read-only String.

Syntax

expression .Word

expression An expression that returns a SynonymInfo object.

Remarks

The thesaurus will sometimes look up a shortened version of the string or range used to return the SynonymInfo object. The Word property allows you to see the exact string that was used.

Example

This example returns a list of synonyms for the first meaning of the third word in the active document.

VBA Copy code Copy code
Sub Syn()
 Dim mySynObj As Object
 Dim SList As Variant
 Dim i As Variant

 Set mySynObj = ActiveDocument.Words(3).SynonymInfo
 SList = mySynObj.SynonymList(1)
 For i = 1 To UBound(SList)
 MsgBox "A synonym for " & mySynObj.Word _
 & " is " & SList(i)
 Next i
End Sub

This example checks to make sure that the word or phrase that was looked up isn't empty. If it is not, the example returns a list of synonyms for the first meaning of the word or phrase.

VBA Copy code Copy code
Sub SelectWord()
 Dim mySynObj As Object
 Dim SList As Variant
 Dim i As Variant

 Set mySynObj = Selection.Range.SynonymInfo
 If mySynObj.Word = "" Then
 MsgBox "Please select a word or phrase"
 Else
 SList = mySynObj.SynonymList(1)
 For i = 1 To UBound(SList)
 MsgBox "A synonym for " & mySynObj.Word _
 & " is " & SList(i)
 Next i
 End If
End Sub

See also

Concepts

SynonymInfo Object

Other resources

SynonymInfo Object Members


System Object (Word)

 Copy code hover
[image]

System Object (Word)
See also Send feedback

Contains information about the computer system.

Remarks

Use the System property to return the System object. If the operating system is Windows, the following example makes a network connection to \\Project\Info.

VBA Copy code Copy code
If System.OperatingSystem = "Windows" Then
 System.Connect Path:="\\Project\Info"
End If

The following example displays the current screen resolution (for example, "1024 x 768").

VBA Copy code Copy code
horz = System.HorizontalResolution
vert = System.VerticalResolution
MsgBox "Resolution = " & horz & " x " & vert

See also

Concepts

Word Object Model Reference

Other resources

System Object Members


System Members (Word)

 Copy code hover
[image]

System Members (Word)
Send feedback

Contains information about the computer system.

Methods

Name | Description
Connect | Establishes a connection to a network drive.
MSInfo | Starts the Microsoft System Information application if it is not running, or switches to it if it is already running.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
ComputerType | You have requested Help for a Visual Basic keyword used only on the Macintosh. For information about the ComputerType property of the System object, consult the language reference Help included with Microsoft Office Macintosh Edition. Read-only.
CountryRegion | Returns the country/region designation of the system. Read-only WdCountry.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Cursor | Returns or sets the state (shape) of the pointer. Can be one of the following WdCursorType constants: wdCursorIBeam, wdCursorNormal, wdCursorNorthwestArrow, or wdCursorWait. Read/write Long.
FreeDiskSpace | Returns the available disk space for the current drive, in bytes. Use the ChDrive statement to change the current drive. Read-only Long.
HorizontalResolution | Returns the horizontal display resolution, in pixels. Read-only Long.
LanguageDesignation | Returns the designated language of the system software. Read-only String.
MacintoshName | You have requested Help for a Visual Basic keyword used only on the Macintosh. For information about the MacintoshName property for the System object, consult the language reference Help included with Microsoft Office Macintosh Edition.
MathCoprocessorInstalled | True if a math coprocessor is installed on the system. Read-only Boolean.
OperatingSystem | Returns the name of the current operating system (for example, "Windows" or "Windows NT"). Read-only String.
Parent | Returns an Object that represents the parent object of the specified System object.
PrivateProfileString | Returns or sets a string in a settings file or the Microsoft Windows registry. Read/write String.
ProfileString | Returns or sets a value for an entry in the Windows registry under the following subkey: HKEY_CURRENT_USER\Software\Microsoft\Office\version\Word. Read/write String.
QuickDrawInstalled | You have requested Help for a Visual Basic keyword used only on the Macintosh. For information about the QuickDrawInstalled property for the System object, consult the language reference Help included with Microsoft Office Macintosh Edition.
Version | Returns the version number of the operating system. Read-only String.
VerticalResolution | Returns the vertical screen resolution in pixels. Read-only Long.


System Properties (Word)

 Copy code hover
[image]

System Properties (Word)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
ComputerType | You have requested Help for a Visual Basic keyword used only on the Macintosh. For information about the ComputerType property of the System object, consult the language reference Help included with Microsoft Office Macintosh Edition. Read-only.
CountryRegion | Returns the country/region designation of the system. Read-only WdCountry.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Cursor | Returns or sets the state (shape) of the pointer. Can be one of the following WdCursorType constants: wdCursorIBeam, wdCursorNormal, wdCursorNorthwestArrow, or wdCursorWait. Read/write Long.
FreeDiskSpace | Returns the available disk space for the current drive, in bytes. Use the ChDrive statement to change the current drive. Read-only Long.
HorizontalResolution | Returns the horizontal display resolution, in pixels. Read-only Long.
LanguageDesignation | Returns the designated language of the system software. Read-only String.
MacintoshName | You have requested Help for a Visual Basic keyword used only on the Macintosh. For information about the MacintoshName property for the System object, consult the language reference Help included with Microsoft Office Macintosh Edition.
MathCoprocessorInstalled | True if a math coprocessor is installed on the system. Read-only Boolean.
OperatingSystem | Returns the name of the current operating system (for example, "Windows" or "Windows NT"). Read-only String.
Parent | Returns an Object that represents the parent object of the specified System object.
PrivateProfileString | Returns or sets a string in a settings file or the Microsoft Windows registry. Read/write String.
ProfileString | Returns or sets a value for an entry in the Windows registry under the following subkey: HKEY_CURRENT_USER\Software\Microsoft\Office\version\Word. Read/write String.
QuickDrawInstalled | You have requested Help for a Visual Basic keyword used only on the Macintosh. For information about the QuickDrawInstalled property for the System object, consult the language reference Help included with Microsoft Office Macintosh Edition.
Version | Returns the version number of the operating system. Read-only String.
VerticalResolution | Returns the vertical screen resolution in pixels. Read-only Long.


System.Application Property (Word)

 Copy code hover
[image]

System.Application Property (Word)
See also Send feedback

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a System object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

System Object

Other resources

System Object Members


System.ComputerType Property (Word)

 Copy code hover
[image]

System.ComputerType Property (Word)
See also Send feedback

You have requested Help for a Visual Basic keyword used only on the Macintosh. For information about the ComputerType property of the System object, consult the language reference Help included with Microsoft Office Macintosh Edition. Read-only.

See also

Concepts

System Object

Other resources

System Object Members


System.CountryRegion Property (Word)

 Copy code hover
[image]

System.CountryRegion Property (Word)
See also Send feedback

Returns the country/region designation of the system. Read-only WdCountry.

Syntax

expression .CountryRegion

expression Required. A variable that represents a System object.

Example

If the CountryRegion property returns wdUS, this example converts the top margin value from points to inches.

VBA Copy code Copy code
Dim sngMargin As Single

If System.CountryRegion = wdUS Then
 sngMargin = ActiveDocument.PageSetup.TopMargin
 MsgBox "Top margin is " & PointsToInches(sngMargin)
End If

See also

Concepts

System Object

Other resources

System Object Members


System.Creator Property (Word)

 Copy code hover
[image]

System.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a System object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

System Object

Other resources

System Object Members


System.Cursor Property (Word)

 Copy code hover
[image]

System.Cursor Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the state (shape) of the pointer. Can be one of the following WdCursorType constants: wdCursorIBeam, wdCursorNormal, wdCursorNorthwestArrow, or wdCursorWait. Read/write Long.

Syntax

expression .Cursor

expression A variable that represents a System object.

Example

This example prints a message on the status bar and changes the pointer to a busy pointer.

VBA Copy code Copy code
Dim intWait As Integer

StatusBar = "Please wait..."

For intWait = 1 To 1000
 System.Cursor = wdCursorWait
Next intWait

StatusBar = "Task completed"
System.Cursor = wdCursorNormal

See also

Concepts

System Object

Other resources

System Object Members


System.FreeDiskSpace Property (Word)

 Copy code hover
[image]

System.FreeDiskSpace Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the available disk space for the current drive, in bytes. Use the ChDrive statement to change the current drive. Read-only Long.

Syntax

expression .FreeDiskSpace

expression A variable that represents a System object.

Remarks

There are 1024 bytes in a kilobyte and 1,048,576 bytes in a megabyte. The maximum return value for the FreeDiskSpace property is 2,147,483,647. Therefore, even if you have four gigabytes of free disk space, it returns 2,147,483,647.

Example

This example checks the amount of free disk space. If there is less than 10 megabytes of space available, a message is displayed.

VBA Copy code Copy code
If (System.FreeDiskSpace \ 1048576) < 10 Then _
 MsgBox "Low disk space"

See also

Concepts

System Object

Other resources

System Object Members


System.HorizontalResolution Property (Word)

 Copy code hover
[image]

System.HorizontalResolution Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the horizontal display resolution, in pixels. Read-only Long.

Syntax

expression .HorizontalResolution

expression A variable that represents a System object.

Example

This example displays the current screen resolution (for example, "1024 x 768").

VBA Copy code Copy code
Dim lngHorizontal As Long
Dim lngVertical As Long

lngHorizontal = System.HorizontalResolution
lngVertical = System.VerticalResolution
MsgBox "Resolution = " & lngHorizontal & " x " & lngVertical

See also

Concepts

System Object

Other resources

System Object Members


System.LanguageDesignation Property (Word)

 Copy code hover
[image]

System.LanguageDesignation Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the designated language of the system software. Read-only String.

Syntax

expression .LanguageDesignation

expression An expression that returns a System object.

Example

This example displays "U.S. English" if the LanguageDesignation property returns "English (US)".

VBA Copy code Copy code
If System.LanguageDesignation = "English (US)" Then _
 MsgBox "U.S. English"

See also

Concepts

System Object

Other resources

System Object Members


System.MacintoshName Property (Word)

 Copy code hover
[image]

System.MacintoshName Property (Word)
See also Send feedback

Published: July 16, 2012

You have requested Help for a Visual Basic keyword used only on the Macintosh. For information about the MacintoshName property for the System object, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

System Object

Other resources

System Object Members


System.MathCoprocessorInstalled Property (Word)

 Copy code hover
[image]

System.MathCoprocessorInstalled Property (Word)
See also Send feedback

Published: July 16, 2012

True if a math coprocessor is installed on the system. Read-only Boolean.

Syntax

expression .MathCoprocessorInstalled

expression An expression that returns a System object.

Example

This example displays a message if a math coprocessor is installed on the system.

VBA Copy code Copy code
If System.MathCoprocessorInstalled = True Then
 MsgBox "A math coprocessor is installed."
End If

See also

Concepts

System Object

Other resources

System Object Members


System.OperatingSystem Property (Word)

 Copy code hover
[image]

System.OperatingSystem Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the name of the current operating system (for example, "Windows" or "Windows NT"). Read-only String.

Syntax

expression .OperatingSystem

expression An expression that returns a System object.

Example

This example displays a message that includes the name of the current operating system.

VBA Copy code Copy code
MsgBox "This computer is running " & System.OperatingSystem

See also

Concepts

System Object

Other resources

System Object Members


System.Parent Property (Word)

 Copy code hover
[image]

System.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified System object.

Syntax

expression .Parent

expression Required. A variable that represents a System object.

See also

Concepts

System Object

Other resources

System Object Members


System.PrivateProfileString Property (Word)

 Copy code hover
[image]

System.PrivateProfileString Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a string in a settings file or the Microsoft Windows registry. Read/write String.

Syntax

expression .PrivateProfileString(FileName, Section, Key)

expression An expression that returns a System object.

Parameters

Name | Required/Optional | Data Type | Description
FileName | Required | String | The file name for the settings file. If there is no path specified, the Windows folder is assumed.
Section | Required | String | The name of the section in the settings file that contains Key. In a Windows settings file, the section name appears between brackets before the associated keys (do not include the brackets with Section). If you are returning the value of an entry from the Windows registry, Section should be the complete path to the subkey, including the subtree (for example, "HKEY_CURRENT_USER\Software\Microsoft\Office\version\Word\Options").
Key | Required | String | The key setting or registry entry value you want to retrieve. In a Windows settings file, the key name is followed by an equal sign (=) and the setting. If you are returning the value of an entry from the Windows registry, Key should be the name of an entry in the subkey specified by Section (for example, "STARTUP-PATH").

Remarks

You can write macros that use a settings file to store and retrieve settings. For example, you can store the name of the active document when you exit Microsoft Word so that it can be reopened automatically the next time you start Word. A settings file is a text file with information arranged like the information in the Windows 3.x WIN.INI file.

Example

This example sets the current document name as the LastFile setting under the MacroSettings heading in Settings.txt.

VBA Copy code Copy code
System.PrivateProfileString("C:\Settings.txt", "MacroSettings", _
 "LastFile") = ActiveDocument.FullName

This example returns the LastFile setting from Settings.txt and then opens the document stored in LastFile.

VBA Copy code Copy code
LastFile = System.PrivateProfileString("C:\Settings.Txt", _
 "MacroSettings", "LastFile")
If LastFile <> "" Then Documents.Open FileName:=LastFile

This example displays the value of the EmailName entry from the Windows registry.

VBA Copy code Copy code
aName = System.PrivateProfileString("", _
 "HKEY_CURRENT_USER\Software\Microsoft\" _
 & "Windows\CurrentVersion\Internet Settings", "EmailName")
MsgBox aName

See also

Concepts

System Object

Other resources

System Object Members


System.ProfileString Property (Word)

 Copy code hover
[image]

System.ProfileString Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a value for an entry in the Windows registry under the following subkey: HKEY_CURRENT_USER\Software\Microsoft\Office\version\Word. Read/write String.

Syntax

expression .ProfileString(Section, Key)

expression An expression that returns a System object.

Example

This example retrieves and displays the startup path stored in the Windows registry.

VBA Copy code Copy code
MsgBox System.ProfileString("Options", "STARTUP-PATH")

This example sets and returns the value for an entry in the Windows registry (the SubkeyName subkey is added below HKEY_CURRENT_USER\Software\Microsoft\Office\version\Word).

VBA Copy code Copy code
System.ProfileString("SubkeyName", "EntryName") = "Value"
MsgBox System.ProfileString("SubkeyName", "EntryName")

See also

Concepts

System Object

Other resources

System Object Members


System.QuickDrawInstalled Property (Word)

 Copy code hover
[image]

System.QuickDrawInstalled Property (Word)
See also Send feedback

Published: July 16, 2012

You have requested Help for a Visual Basic keyword used only on the Macintosh. For information about the QuickDrawInstalled property for the System object, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

System Object

Other resources

System Object Members


System.Version Property (Word)

 Copy code hover
[image]

System.Version Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the version number of the operating system. Read-only String.

Syntax

expression .Version

expression A variable that represents a System object.

Example

This example displays the version number of the operating system in a message box.

VBA Copy code Copy code
Msgbox "The system version is " & System.Version

See also

Concepts

System Object

Other resources

System Object Members


System.VerticalResolution Property (Word)

 Copy code hover
[image]

System.VerticalResolution Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the vertical screen resolution in pixels. Read-only Long.

Syntax

expression .VerticalResolution

expression An expression that returns a System object.

Example

This example displays the current screen resolution (for example, "1024 x 768").

VBA Copy code Copy code
horz = System.HorizontalResolution
vert = System.VerticalResolution
MsgBox "Resolution = " & horz & " x " & vert

See also

Concepts

System Object

Other resources

System Object Members


System Methods (Word)

 Copy code hover
[image]

System Methods (Word)
Send feedback

This object has the following methods:

Methods

Name | Description
Connect | Establishes a connection to a network drive.
MSInfo | Starts the Microsoft System Information application if it is not running, or switches to it if it is already running.


System.Connect Method (Word)

 Copy code hover
[image]

System.Connect Method (Word)
See also Send feedback

Establishes a connection to a network drive.

Syntax

expression .Connect(Path, Drive, Password)

expression Required. A variable that represents a System object.

Parameters

Name | Required/Optional | Data Type | Description
Path | Required | String | The path for the network drive (for example, "\\Project\Info").
Drive | Optional | Variant | A number corresponding to the letter you want to assign to the network drive, where 0 (zero) corresponds to the first available drive letter, 1 corresponds to the second available drive letter, and so on. If this argument is omitted, the next available letter is used.
Password | Optional | Variant | The password, if the network drive is protected with a password.

Security

Avoid using hard-coded passwords in your applications. If a password is required in a procedure, request the password from the user, store it in a variable, and then use the variable in your code. For recommended best practices on how to do this, see Security Notes for Microsoft Office Solution Developers.

Remarks

Use the Dialogs property with the wdDialogConnect constant to display the Connect To Network Drive dialog box. The following example displays the Connect To Network Drive dialog box, with a preset path shown.

VBA Copy code Copy code
With Dialogs(wdDialogConnect)
 .Path = "\\Marketing\Public"
 .Show
End With

Example

This example establishes a connection to a network drive (\\Project\Info) protected with the password contained in the String variable, and then assigns the network drive to the next available drive letter.

VBA Copy code Copy code
System.Connect Path:="\\Project\Info", Password:=strPassword

This example establishes a connection to a network drive (\\Team1\Public) and assigns the network drive to the third available drive letter.

VBA Copy code Copy code
System.Connect Path:="\\Team1\Public", Drive:=2

See also

Concepts

System Object

Other resources

System Object Members


System.MSInfo Method (Word)

 Copy code hover
[image]

System.MSInfo Method (Word)
See also Send feedback

Published: July 16, 2012

Starts the Microsoft System Information application if it is not running, or switches to it if it is already running.

Syntax

expression .MSInfo

expression Required. A variable that represents a System object.

Example

This example starts or switches to the Microsoft System Information application.

VBA Copy code Copy code
System.MSInfo

See also

Concepts

System Object

Other resources

System Object Members


Table Object (Word)

 Copy code hover
[image]

Table Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a single table. The Table object is a member of the Tables collection. The Tables collection includes all the tables in the specified selection, range, or document.

Remarks

Use Tables(Index), where Index is the index number, to return a single Table object. The index number represents the position of the table in the selection, range, or document. The following example converts the first table in the active document to text.

VBA Copy code Copy code
ActiveDocument.Tables(1).ConvertToText Separator:=wdSeparateByTabs

Use the Add method to add a table at the specified range. The following example adds a 3x4 table at the beginning of the active document.

VBA Copy code Copy code
Set myRange = ActiveDocument.Range(Start:=0, End:=0)
ActiveDocument.Tables.Add Range:=myRange, NumRows:=3, NumColumns:=4

See also

Concepts

Word Object Model Reference

Other resources

Table Object Members


Table Members (Word)

 Copy code hover
[image]

Table Members (Word)
Send feedback

Published: July 16, 2012

Represents a single table. The Table object is a member of the Tables collection. The Tables collection includes all the tables in the specified selection, range, or document.

Methods

Name | Description
ApplyStyleDirectFormatting | Applies the specified style but maintains any formatting that a user directly applies.
AutoFitBehavior | Determines how Microsoft Word resizes a table when the AutoFit feature is used.
AutoFormat | Applies a predefined look to a table.
Cell | Returns a Cell object that represents a cell in a table.
ConvertToText | Converts a table to text and returns a Range object that represents the delimited text.
Delete | Deletes the specified table.
Select | Selects the specified table.
Sort | Sorts the specified table.
SortAscending | Sorts paragraphs or table rows in ascending alphanumeric order.
SortDescending | Sorts table rows in descending alphanumeric order.
Split | Inserts an empty paragraph immediately above the specified row in the table, and returns a Table object that contains both the specified row and the rows that follow it.
UpdateAutoFormat | Updates the table with the characteristics of a predefined table format.

Properties

Name | Description
AllowAutoFit | Allows Microsoft Word to automatically resize cells in a table to fit their contents. Read/write Boolean.
Application | Returns an Application object that represents the Microsoft Word application.
ApplyStyleColumnBands | Returns or sets a Boolean that represents whether to apply style bands to the columns in a table if an applied preset table style provides style banding for columns. Read/write.
ApplyStyleFirstColumn | True for Microsoft Word to apply first-column formatting to the first column of the specified table. Read/write Boolean.
ApplyStyleHeadingRows | True for Microsoft Word to apply heading-row formatting to the first row of the selected table. Read/write Boolean.
ApplyStyleLastColumn | True for Microsoft Word to apply last-column formatting to the last column of the specified table. Read/write Boolean.
ApplyStyleLastRow | True for Microsoft Word to apply last-row formatting to the last row of the specified table. Read/write Boolean.
ApplyStyleRowBands | Returns or sets a Boolean that represents whether to apply style bands to the rows in a table if an applied preset table style provides style banding for rows. Read/write.
AutoFormatType | Returns the type of automatic formatting that's been applied to the specified table. Read-only Long.
Borders | Returns a Borders collection that represents all the borders for the specified object.
BottomPadding | Returns or sets the amount of space (in points) to add below the contents of a single cell or all the cells in a table. Read/write Single.
Columns | Returns a Columns collection that represents all the table columns in the table. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Descr | Returns or sets a String that contains a description for the specified table. Read/write.
ID | Returns or sets the identifying label for the specified table when the document is saved as a Web page. Read/write String.
LeftPadding | Returns or sets the amount of space (in points) to add to the left of the contents of all the cells in a table. Read/write Single.
NestingLevel | Returns the nesting level of the specified table. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified Table object.
PreferredWidth | Returns or sets the preferred width (in points or as a percentage of the window width) for the specified table. Read/write Single.
PreferredWidthType | Returns or sets the preferred unit of measurement to use for the width of the specified table. Read/write WdPreferredWidthType.
Range | Returns a Range object that represents the portion of a document that is contained within the specified table.
RightPadding | Returns or sets the amount of space (in points) to add to the right of the contents of all the cells in a table. Read/write Single.
Rows | Returns a Rows collection that represents all the table rows within a table. Read-only.
Shading | Returns a Shading object that refers to the shading formatting for the specified object.
Spacing | Returns or sets the spacing (in points) between the cells in a table. Read/write Single.
Style | Returns or sets the style for the specified table. Read/write Variant.
TableDirection | Returns or sets the direction in which Microsoft Word orders cells in the specified table. Read/write WdTableDirection.
Tables | Returns a Tables collection that represents all the tables nested within the specified table. Read-only.
Title | Returns or sets a String that contains a title for the specified table. Read/write.
TopPadding | Returns or sets the amount of space (in points) to add above the contents of all the cells in a table. Read/write Single.
Uniform | True if all the rows in a table have the same number of columns. Read-only Boolean.


Table Properties (Word)

 Copy code hover
[image]

Table Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
AllowAutoFit | Allows Microsoft Word to automatically resize cells in a table to fit their contents. Read/write Boolean.
Application | Returns an Application object that represents the Microsoft Word application.
ApplyStyleColumnBands | Returns or sets a Boolean that represents whether to apply style bands to the columns in a table if an applied preset table style provides style banding for columns. Read/write.
ApplyStyleFirstColumn | True for Microsoft Word to apply first-column formatting to the first column of the specified table. Read/write Boolean.
ApplyStyleHeadingRows | True for Microsoft Word to apply heading-row formatting to the first row of the selected table. Read/write Boolean.
ApplyStyleLastColumn | True for Microsoft Word to apply last-column formatting to the last column of the specified table. Read/write Boolean.
ApplyStyleLastRow | True for Microsoft Word to apply last-row formatting to the last row of the specified table. Read/write Boolean.
ApplyStyleRowBands | Returns or sets a Boolean that represents whether to apply style bands to the rows in a table if an applied preset table style provides style banding for rows. Read/write.
AutoFormatType | Returns the type of automatic formatting that's been applied to the specified table. Read-only Long.
Borders | Returns a Borders collection that represents all the borders for the specified object.
BottomPadding | Returns or sets the amount of space (in points) to add below the contents of a single cell or all the cells in a table. Read/write Single.
Columns | Returns a Columns collection that represents all the table columns in the table. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Descr | Returns or sets a String that contains a description for the specified table. Read/write.
ID | Returns or sets the identifying label for the specified table when the document is saved as a Web page. Read/write String.
LeftPadding | Returns or sets the amount of space (in points) to add to the left of the contents of all the cells in a table. Read/write Single.
NestingLevel | Returns the nesting level of the specified table. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified Table object.
PreferredWidth | Returns or sets the preferred width (in points or as a percentage of the window width) for the specified table. Read/write Single.
PreferredWidthType | Returns or sets the preferred unit of measurement to use for the width of the specified table. Read/write WdPreferredWidthType.
Range | Returns a Range object that represents the portion of a document that is contained within the specified table.
RightPadding | Returns or sets the amount of space (in points) to add to the right of the contents of all the cells in a table. Read/write Single.
Rows | Returns a Rows collection that represents all the table rows within a table. Read-only.
Shading | Returns a Shading object that refers to the shading formatting for the specified object.
Spacing | Returns or sets the spacing (in points) between the cells in a table. Read/write Single.
Style | Returns or sets the style for the specified table. Read/write Variant.
TableDirection | Returns or sets the direction in which Microsoft Word orders cells in the specified table. Read/write WdTableDirection.
Tables | Returns a Tables collection that represents all the tables nested within the specified table. Read-only.
Title | Returns or sets a String that contains a title for the specified table. Read/write.
TopPadding | Returns or sets the amount of space (in points) to add above the contents of all the cells in a table. Read/write Single.
Uniform | True if all the rows in a table have the same number of columns. Read-only Boolean.


Table.AllowAutoFit Property (Word)

 Copy code hover
[image]

Table.AllowAutoFit Property (Word)
See also Send feedback

Published: July 16, 2012

Allows Microsoft Word to automatically resize cells in a table to fit their contents. Read/write Boolean.

Syntax

expression .AllowAutoFit

expression A variable that represents a Table object.

Example

This example sets the first table in the active document to automatically resize based on its contents.

VBA Copy code Copy code
Sub AllowFit()
 ActiveDocument.Tables(1).AllowAutoFit = True
End Sub

See also

Concepts

Table Object

Other resources

Table Object Members


Table.Application Property (Word)

 Copy code hover
[image]

Table.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a Table object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

Table Object

Other resources

Table Object Members


Table.ApplyStyleColumnBands Property (Word)

 Copy code hover
[image]

Table.ApplyStyleColumnBands Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents whether to apply style bands to the columns in a table if an applied preset table style provides style banding for columns. Read/write.

Syntax

expression .ApplyStyleColumnBands

expression An expression that returns a Table object.

See also

Concepts

Table Object

Other resources

Table Object Members


Table.ApplyStyleFirstColumn Property (Word)

 Copy code hover
[image]

Table.ApplyStyleFirstColumn Property (Word)
See also Send feedback

Published: July 16, 2012

True for Microsoft Word to apply first-column formatting to the first column of the specified table. Read/write Boolean.

Syntax

expression .ApplyStyleFirstColumn

expression An expression that returns a Table object.

Remarks

The specified table style must contain first-column formatting to apply this formatting to a table.

Example

This example formats the second table in the active document with the table style "Table Style 1" and removes formatting for the first and last rows and the first and last columns. This example assumes that a table style named "Table Style 1" exists and that it contains first column formatting.

VBA Copy code Copy code
Sub TableStyles()
 With ActiveDocument.Tables(2)
 .Style = "Table Style 1"
 .ApplyStyleFirstColumn = False
 .ApplyStyleHeadingRows = False
 .ApplyStyleLastColumn = False
 .ApplyStyleLastRow = False
 End With
End Sub

See also

Concepts

Table Object

Other resources

Table Object Members


Table.ApplyStyleHeadingRows Property (Word)

 Copy code hover
[image]

Table.ApplyStyleHeadingRows Property (Word)
See also Send feedback

Published: July 16, 2012

True for Microsoft Word to apply heading-row formatting to the first row of the selected table. Read/write Boolean.

Syntax

expression .ApplyStyleHeadingRows

expression An expression that returns a Table object.

Remarks

The specified table style must contain heading-row formatting to apply this formatting to a table.

Example

This example formats the second table in the active document with the table style "Table Style 1" and removes formatting for the first and last rows and the first and last columns. This example assumes that a table style named "Table Style 1" exists and that it contains heading-row formatting.

VBA Copy code Copy code
Sub TableStyles()
 With ActiveDocument.Tables(2)
 .Style = "Table Style 1"
 .ApplyStyleFirstColumn = False
 .ApplyStyleHeadingRows = False
 .ApplyStyleLastColumn = False
 .ApplyStyleLastRow = False
 End With
End Sub

See also

Concepts

Table Object

Other resources

Table Object Members


Table.ApplyStyleLastColumn Property (Word)

 Copy code hover
[image]

Table.ApplyStyleLastColumn Property (Word)
See also Send feedback

Published: July 16, 2012

True for Microsoft Word to apply last-column formatting to the last column of the specified table. Read/write Boolean.

Syntax

expression .ApplyStyleLastColumn

expression An expression that returns a Table object.

Remarks

The specified table style must contain last-column formatting to apply this formatting to a table.

Example

This example formats the second table in the active document with the table style "Table Style 1" and removes formatting for the first and last rows and the first and last columns. This example assumes that a table style named "Table Style 1" exists and that it contains last-column formatting.

VBA Copy code Copy code
Sub TableStyles()
 With ActiveDocument.Tables(2)
 .Style = "Table Style 1"
 .ApplyStyleFirstColumn = False
 .ApplyStyleHeadingRows = False
 .ApplyStyleLastColumn = False
 .ApplyStyleLastRow = False
 End With
End Sub

See also

Concepts

Table Object

Other resources

Table Object Members


Table.ApplyStyleLastRow Property (Word)

 Copy code hover
[image]

Table.ApplyStyleLastRow Property (Word)
See also Send feedback

Published: July 16, 2012

True for Microsoft Word to apply last-row formatting to the last row of the specified table. Read/write Boolean.

Syntax

expression .ApplyStyleLastRow

expression An expression that returns a Table object.

Remarks

The specified table style must contain last-row formatting to apply this formatting to a table.

Example

This example formats the second table in the active document with the table style "Table Style 1" and removes formatting for the first and last rows and the first and last columns. This example assumes that a table style named "Table Style 1" exists and that it contains last-row formatting.

VBA Copy code Copy code
Sub TableStyles()
 With ActiveDocument.Tables(2)
 .Style = "Table Style 1"
 .ApplyStyleFirstColumn = False
 .ApplyStyleHeadingRows = False
 .ApplyStyleLastColumn = False
 .ApplyStyleLastRow = False
 End With
End Sub

See also

Concepts

Table Object

Other resources

Table Object Members


Table.ApplyStyleRowBands Property (Word)

 Copy code hover
[image]

Table.ApplyStyleRowBands Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents whether to apply style bands to the rows in a table if an applied preset table style provides style banding for rows. Read/write.

Syntax

expression .ApplyStyleRowBands

expression An expression that returns a Table object.

See also

Concepts

Table Object

Other resources

Table Object Members


Table.AutoFormatType Property (Word)

 Copy code hover
[image]

Table.AutoFormatType Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the type of automatic formatting that's been applied to the specified table. Read-only Long.

Syntax

expression .AutoFormatType

expression A variable that represents a Table object.

Remarks

This property can be one of the WdTableFormat constants. Use the AutoFormat method to apply automatic formatting to a table.

Example

This example formats the first table in the active document to use the Classic 1 AutoFormat if the current format is Simple 1, Simple 2, or Simple 3.

VBA Copy code Copy code
If ActiveDocument.Tables.Count >= 1 Then
 If ActiveDocument.Tables(1).AutoFormatType <= wdTableFormatSimple3 Then
 ActiveDocument.Tables(1).AutoFormat _
 Format:=wdTableFormatClassic1
 End If
End If

See also

Concepts

Table Object

Other resources

Table Object Members


Table.Borders Property (Word)

 Copy code hover
[image]

Table.Borders Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Borders collection that represents all the borders for the specified object.

Syntax

expression .Borders

expression Required. A variable that represents a Table object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example applies inside and outside borders to the first table in the active document.

VBA Copy code Copy code
Set myTable = ActiveDocument.Tables(1)
With myTable.Borders
 .InsideLineStyle = wdLineStyleSingle
 .OutsideLineStyle = wdLineStyleDouble
End With

See also

Concepts

Table Object

Other resources

Table Object Members


Table.BottomPadding Property (Word)

 Copy code hover
[image]

Table.BottomPadding Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the amount of space (in points) to add below the contents of a single cell or all the cells in a table. Read/write Single.

Syntax

expression .BottomPadding

expression Required. A variable that represents a Table object.

Remarks

The setting of the BottomPadding property for a single cell overrides the setting of the BottomPadding property for the entire table.

Example

This example sets the bottom padding for the first table in the active document to 40 pixels.

VBA Copy code Copy code
ActiveDocument.Tables(1).BottomPadding = _
 PixelsToPoints(40, True)

See also

Concepts

Table Object

Other resources

Table Object Members


Table.Columns Property (Word)

 Copy code hover
[image]

Table.Columns Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Columns collection that represents all the table columns in the table. Read-only.

Syntax

expression .Columns

expression A variable that represents a Table object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example displays the number of columns in the first table in the active document.

VBA Copy code Copy code
If ActiveDocument.Tables.Count >= 1 Then
 MsgBox ActiveDocument.Tables(1).Columns.Count
End If

See also

Concepts

Table Object

Other resources

Table Object Members


Table.Creator Property (Word)

 Copy code hover
[image]

Table.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a Table object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Table Object

Other resources

Table Object Members


Table.Descr Property (Word)

 Copy code hover
[image]

Table.Descr Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a String that contains a description for the specified table. Read/write.

Version Information

Version Added: Word 2010

Syntax

expression .Descr

expression An expression that returns a Table object.

Remarks

Use the Descr property to provide an alternative text description for a table. This property adds text to the Description text box on the Alt Text tab of the Table Properties dialog in Word 2010.

Note Note

Web browsers display alternative text while tables are loading or if they are missing. Web search engines use the alternative text to help find Web pages. Alternative text is also used to assist disabilities.

Example

The following code example adds an alternative text table description to the first table in the active document.

VBA Copy code Copy code
Dim doc As Document
Dim tbl As Table

Set doc = ActiveDocument
Set tbl = doc.Tables(1)

tbl.Descr = "This is a table description."

See also

Concepts

Table Object

Other resources

Table Object Members


Table.ID Property (Word)

 Copy code hover
[image]

Table.ID Property (Word)
See also Send feedback

Returns or sets the identifying label for the specified table when the document is saved as a Web page. Read/write String.

Syntax

expression .ID

expression Required. A variable that represents a Table object.

See also

Concepts

Table Object

Other resources

Table Object Members


Table.LeftPadding Property (Word)

 Copy code hover
[image]

Table.LeftPadding Property (Word)
See also Send feedback

Returns or sets the amount of space (in points) to add to the left of the contents of all the cells in a table. Read/write Single.

Syntax

expression .LeftPadding

expression Required. A variable that represents a Table object.

Remarks

The setting of the LeftPadding property for a single cell overrides the setting of the LeftPadding property for the entire table.

Example

This example sets the left padding for the first table in the active document to 40 pixels.

VBA Copy code Copy code
ActiveDocument.Tables(1).LeftPadding = _
 PixelsToPoints(40, False)

See also

Concepts

Table Object

Other resources

Table Object Members


Table.NestingLevel Property (Word)

 Copy code hover
[image]

Table.NestingLevel Property (Word)
See also Send feedback

Returns the nesting level of the specified table. Read-only Long.

Syntax

expression .NestingLevel

expression Required. A variable that represents a Table object.

Remarks

The outermost table has a nesting level of 1. The nesting level of each successively nested table is one higher than the previous table.

See also

Concepts

Table Object

Other resources

Table Object Members


Table.Parent Property (Word)

 Copy code hover
[image]

Table.Parent Property (Word)
See also Send feedback

Returns an Object that represents the parent object of the specified Table object.

Syntax

expression .Parent

expression Required. A variable that represents a Table object.

See also

Concepts

Table Object

Other resources

Table Object Members


Table.PreferredWidth Property (Word)

 Copy code hover
[image]

Table.PreferredWidth Property (Word)
See also Send feedback

Returns or sets the preferred width (in points or as a percentage of the window width) for the specified table. Read/write Single.

Syntax

expression .PreferredWidth

expression An expression that represents a Table object.

Remarks

If the PreferredWidthType property is set to wdPreferredWidthPoints, the PreferredWidth property returns or sets the width in points. If the PreferredWidthType property is set to wdPreferredWidthPercent, the PreferredWidth property returns or sets the width as a percentage of the window width.

Example

This example sets Microsoft Word to accept preferred widths as a percentage of window width, and then sets the preferred width of the first table in the document to 50% of the window width.

VBA Copy code Copy code
With ActiveDocument.Tables(1)
 .PreferredWidthType = wdPreferredWidthPercent
 .PreferredWidth = 50
End With

See also

Concepts

Table Object

Other resources

Table Object Members


Table.PreferredWidthType Property (Word)

 Copy code hover
[image]

Table.PreferredWidthType Property (Word)
See also Send feedback

Returns or sets the preferred unit of measurement to use for the width of the specified table. Read/write WdPreferredWidthType.

Syntax

expression .PreferredWidthType

expression Required. A variable that represents a Table object.

Example

This example sets Microsoft Word to accept widths as a percentage of window width, and then it sets the width of the first table in the document to 50% of the window width.

VBA Copy code Copy code
With ActiveDocument.Tables(1)
 .PreferredWidthType = wdPreferredWidthPercent
 .PreferredWidth = 50
End With

See also

Concepts

Table Object

Other resources

Table Object Members


Table.Range Property (Word)

 Copy code hover
[image]

Table.Range Property (Word)
See also Send feedback

Returns a Range object that represents the portion of a document that is contained within the specified table.

Syntax

expression .Range

expression Required. A variable that represents a Table object.

See also

Concepts

Table Object

Other resources

Table Object Members


Table.RightPadding Property (Word)

 Copy code hover
[image]

Table.RightPadding Property (Word)
See also Send feedback

Returns or sets the amount of space (in points) to add to the right of the contents of all the cells in a table. Read/write Single.

Syntax

expression .RightPadding

expression Required. A variable that represents a Table object.

Remarks

The setting of the RightPadding property for a single cell overrides the setting of the RightPadding property for the entire table.

Example

This example sets the right padding for the first table in the active document to 40 pixels.

VBA Copy code Copy code
ActiveDocument.Tables(1).RightPadding = _
 PixelsToPoints(40, False)

See also

Concepts

Table Object

Other resources

Table Object Members


Table.Rows Property (Word)

 Copy code hover
[image]

Table.Rows Property (Word)
See also Send feedback

Returns a Rows collection that represents all the table rows within a table. Read-only.

Syntax

expression .Rows

expression A variable that represents a Table object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example deletes the second row from the first table in the active document.

VBA Copy code Copy code
ActiveDocument.Tables(1).Rows(2).Delete

See also

Concepts

Table Object

Other resources

Table Object Members


Table.Shading Property (Word)

 Copy code hover
[image]

Table.Shading Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Shading object that refers to the shading formatting for the specified object.

Syntax

expression .Shading

expression Required. A variable that represents a Table object.

Example

This example applies horizontal line texture to the first table in the active document.

VBA Copy code Copy code
If ActiveDocument.Tables.Count >= 1 Then
 With ActiveDocument.Tables(1)Shading
 .Texture = wdTextureHorizontal
 End With
End If

See also

Concepts

Table Object

Other resources

Table Object Members


Table.Spacing Property (Word)

 Copy code hover
[image]

Table.Spacing Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the spacing (in points) between the cells in a table. Read/write Single.

Syntax

expression .Spacing

expression Required. A variable that represents a Table object.

Example

This example sets the spacing between cells in the first table in the active document to nine points.

VBA Copy code Copy code
ActiveDocument.Tables(1).Spacing = 9

See also

Concepts

Table Object

Other resources

Table Object Members


Table.Style Property (Word)

 Copy code hover
[image]

Table.Style Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the style for the specified table. Read/write Variant.

Syntax

expression .Style

expression Required. A variable that represents a Table object.

Remarks

To set this property, you can specify the local name of the style, an integer, a WdBuiltinStyle constant, or a TableStyle object that contains the desired formatting for the table.

See also

Concepts

Table Object

Other resources

Table Object Members


Table.TableDirection Property (Word)

 Copy code hover
[image]

Table.TableDirection Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the direction in which Microsoft Word orders cells in the specified table. Read/write WdTableDirection.

Syntax

expression .TableDirection

expression Required. A variable that represents a Table object.

Remarks

If the TableDirection property is set to wdTableDirectionLtr, the selected rows are arranged with the first column in the leftmost position. If the TableDirection property is set to wdTableDirectionRtl, the selected rows are arranged with the first column in the rightmost position.

Example

This example sets Microsoft Word to order cells in the selected row from right to left.

VBA Copy code Copy code
Selection.Rows.TableDirection = _
 wdTableDirectionRtl

See also

Concepts

Table Object

Other resources

Table Object Members


Table.Tables Property (Word)

 Copy code hover
[image]

Table.Tables Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Tables collection that represents all the tables nested within the specified table. Read-only.

Syntax

expression .Tables

expression A variable that represents a Table object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

See also

Concepts

Table Object

Other resources

Table Object Members


Table.Title Property (Word)

 Copy code hover
[image]

Table.Title Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a String that contains a title for the specified table. Read/write.

Version Information

Version Added: Word 2010

Syntax

expression .Title

expression A variable that represents a Table object.

Remarks

Use the Title property to provide an alternative text title for a table. This property adds title text to the Title text box on the Alt Text tab of the Table Properties dialog in Word 2010.

Note Note

Web browsers display alternative text while tables are loading or if they are missing. Web search engines use the alternative text to help find Web pages. Alternative text is also used to assist disabilities.

Example

The following code example adds an alternative text table title to the first table in the active document.

VBA Copy code Copy code
ActiveDocument.Tables(1).Title = "Table 1."

See also

Concepts

Table Object

Other resources

Table Object Members


Table.TopPadding Property (Word)

 Copy code hover
[image]

Table.TopPadding Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the amount of space (in points) to add above the contents of all the cells in a table. Read/write Single.

Syntax

expression .TopPadding

expression Required. A variable that represents a Table object.

Remarks

The setting of the TopPadding property for a single cell overrides the setting of the TopPadding property for the entire table.

Example

This example sets the top padding for the first table in the active document to 40 pixels.

VBA Copy code Copy code
ActiveDocument.Tables(1).TopPadding = _
 PixelsToPoints(40, True)

See also

Concepts

Table Object

Other resources

Table Object Members


Table.Uniform Property (Word)

 Copy code hover
[image]

Table.Uniform Property (Word)
See also Send feedback

Published: July 16, 2012

True if all the rows in a table have the same number of columns. Read-only Boolean.

Syntax

expression .Uniform

expression An expression that returns a Table object.

Example

This example creates a table that contains a split cell and then displays a message box that confirms that the table doesn't have the same number of columns for each row.

VBA Copy code Copy code
Set newDoc = Documents.Add
Set myTable = newDoc.Tables.Add(Selection.Range, 5, 5)
myTable.Cell(3, 3).Split 1, 2
If myTable.Uniform = False Then MsgBox "Table is not uniform"

This example determines whether the table that contains the selection has the same number of columns for each row.

VBA Copy code Copy code
If Selection.Information(wdWithInTable) = True Then
 MsgBox Selection.Tables(1).Uniform
End If

See also

Concepts

Table Object

Other resources

Table Object Members


Table Methods (Word)

 Copy code hover
[image]

Table Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
ApplyStyleDirectFormatting | Applies the specified style but maintains any formatting that a user directly applies.
AutoFitBehavior | Determines how Microsoft Word resizes a table when the AutoFit feature is used.
AutoFormat | Applies a predefined look to a table.
Cell | Returns a Cell object that represents a cell in a table.
ConvertToText | Converts a table to text and returns a Range object that represents the delimited text.
Delete | Deletes the specified table.
Select | Selects the specified table.
Sort | Sorts the specified table.
SortAscending | Sorts paragraphs or table rows in ascending alphanumeric order.
SortDescending | Sorts table rows in descending alphanumeric order.
Split | Inserts an empty paragraph immediately above the specified row in the table, and returns a Table object that contains both the specified row and the rows that follow it.
UpdateAutoFormat | Updates the table with the characteristics of a predefined table format.


Table.ApplyStyleDirectFormatting Method (Word)

 Copy code hover
[image]

Table.ApplyStyleDirectFormatting Method (Word)
See also Send feedback

Published: July 16, 2012

Applies the specified style but maintains any formatting that a user directly applies.

Syntax

expression .ApplyStyleDirectFormatting(StyleName)

expression An expression that returns a Table object.

Parameters

Name | Required/Optional | Data Type | Description
StyleName | Required | String | The name of the style to apply.

See also

Concepts

Table Object

Other resources

Table Object Members


Table.AutoFitBehavior Method (Word)

 Copy code hover
[image]

Table.AutoFitBehavior Method (Word)
See also Send feedback

Published: July 16, 2012

Determines how Microsoft Word resizes a table when the AutoFit feature is used.

Syntax

expression .AutoFitBehavior(Behavior)

expression Required. A variable that represents a Table object.

Parameters

Name | Required/Optional | Data Type | Description
Behavior | Required | WdAutoFitBehavior | How Word resizes the specified table with the AutoFit feature is used.

Remarks

Word can resize the table based on the content of the table cells or the width of the document window. You can also use this method to turn off AutoFit so that the table size is fixed, regardless of cell contents or window width.

Setting the AutoFitBehavior property to wdAutoFitContent or wdAutoFitWindow sets the AllowAutoFit property to True if it is currently False. Likewise, setting the AutoFitBehavior property to wdAutoFitFixed sets the AllowAutoFit property to False if it is currently True.

Example

This example sets the AutoFit behavior for the first table in the active document to automatically resize based on the width of the document window.

VBA Copy code Copy code
ActiveDocument.Tables(1).AutoFitBehavior _
 wdAutoFitWindow

See also

Concepts

Table Object

Other resources

Table Object Members


Table.AutoFormat Method (Word)

 Copy code hover
[image]

Table.AutoFormat Method (Word)
See also Send feedback

Published: July 16, 2012

Applies a predefined look to a table.

Syntax

expression .AutoFormat(Format, ApplyBorders, ApplyShading, ApplyFont, ApplyColor, ApplyHeadingRows, ApplyLastRow, ApplyFirstColumn, ApplyLastColumn, AutoFit)

expression Required. A variable that represents a Table object.

Parameters

Name | Required/Optional | Data Type | Description
Format | Optional | Variant | The format to apply. This parameter can be a WdTableFormat constant, a WdTableFormatApply constant, or a TableStyle object.
ApplyBorders | Optional | Variant | True to apply the border properties of the specified format. The default value is True.
ApplyShading | Optional | Variant | True to apply the shading properties of the specified format. The default value is True.
ApplyFont | Optional | Variant | True to apply the font properties of the specified format. The default value is True.
ApplyColor | Optional | Variant | True to apply the color properties of the specified format. The default value is True.
ApplyHeadingRows | Optional | Variant | True to apply the heading-row properties of the specified format. The default value is True.
ApplyLastRow | Optional | Variant | True to apply the last-row properties of the specified format. The default value is False.
ApplyFirstColumn | Optional | Variant | True to apply the first-column properties of the specified format. The default value is True.
ApplyLastColumn | Optional | Variant | True to apply the last-column properties of the specified format. The default value is False.
AutoFit | Optional | Variant | True to decrease the width of the table columns as much as possible without changing the way text wraps in the cells. The default value is True.

Remarks

The arguments for this method correspond to the options in the Table AutoFormat dialog box.

Example

This example creates a 5x5 table in a new document and applies all the properties of the Colorful 2 format to the table.

VBA Copy code Copy code
Set newDoc = Documents.Add
Set myTable = newDoc.Tables.Add(Range:=Selection.Range, _
 NumRows:=5, NumColumns:=5)
myTable.AutoFormat Format:=wdTableFormatColorful2

This example applies all the properties of the Classic 2 format to the table in which the insertion point is currently located. If the insertion point isn't in a table, a message box is displayed.

VBA Copy code Copy code
Selection.Collapse Direction:=wdCollapseStart
If Selection.Information(wdWithInTable) = True Then
 Selection.Tables(1).AutoFormat Format:=wdTableFormatClassic2
Else
 MsgBox "The insertion point is not in a table."
End If

See also

Concepts

Table Object

Other resources

Table Object Members


Table.Cell Method (Word)

 Copy code hover
[image]

Table.Cell Method (Word)
See also Send feedback

Returns a Cell object that represents a cell in a table.

Syntax

expression .Cell(Row, Column)

expression Required. A variable that represents a Table object.

Parameters

Name | Required/Optional | Data Type | Description
Row | Required | Long | The number of the row in the table to return. Can be an integer between 1 and the number of rows in the table.
Column | Required | Long | The number of the cell in the table to return. Can be an integer between 1 and the number of columns in the table.

Return Value

Cell

Example

This example creates a 3x3 table in a new document and inserts text into the first and last cells in the table.

VBA Copy code Copy code
Dim docNew As Document
Dim tableNew As Table

Set docNew = Documents.Add
Set tableNew = docNew.Tables.Add(Selection.Range, 3, 3)

With tableNew
 .Cell(1,1).Range.InsertAfter "First cell"
 .Cell(tableNew.Rows.Count, _
 tableNew.Columns.Count).Range.InsertAfter "Last Cell"
End With

This example deletes the first cell from the first table in the active document.

VBA Copy code Copy code
If ActiveDocument.Tables.Count >= 1 Then
 ActiveDocument.Tables(1).Cell(1, 1).Delete
End If

See also

Concepts

Table Object

Other resources

Table Object Members


Table.ConvertToText Method (Word)

 Copy code hover
[image]

Table.ConvertToText Method (Word)
See also Send feedback

Published: July 16, 2012

Converts a table to text and returns a Range object that represents the delimited text.

Syntax

expression .ConvertToText(Separator, NestedTables)

expression Required. A variable that represents a Table object.

Parameters

Name | Required/Optional | Data Type | Description
Separator | Optional | Variant | The character that delimits the converted columns (paragraph marks delimit the converted rows). Can be any WdTableFieldSeparator constants.
NestedTables | Optional | Variant | True if nested tables are converted to text. This argument is ignored if Separator is not wdSeparateByParagraphs. The default value is True.

Remarks

When you apply the ConvertToText method to a Table object, the object is deleted. To maintain a reference to the converted contents of the table, you must assign the Range object returned by the ConvertToText method to a new object variable. In the following example, the first table in the active document is converted to text and then formatted as a bulleted list.

VBA Copy code Copy code
Dim tableTemp As Table
Dim rngTemp As Range

Set tableTemp = ActiveDocument.Tables(1)
Set rngTemp = _
 tableTemp.ConvertToText(Separator:=wdSeparateByParagraphs)

rngTemp.ListFormat.ApplyListTemplate _
 ListTemplate:=ListGalleries(wdBulletGallery).ListTemplates(1)

Example

This example creates a table and then converts it to text by using tabs as separator characters.

VBA Copy code Copy code
Dim docNew As Document
Dim tableNew As Table
Dim intTemp As Integer
Dim cellLoop As Cell
Dim rngTemp As Range

Set docNew = Documents.Add
Set tableNew = docNew.Tables.Add(Range:=Selection.Range, _
 NumRows:=3, NumColumns:=3)

intTemp = 1

For Each cellLoop In tableNew.Range.Cells
 cellLoop.Range.InsertAfter "Cell " & intTemp
 intTemp = intTemp + 1
Next cellLoop

MsgBox "Click OK to convert table to text."
Set rngTemp = _
 tableNew.ConvertToText(Separator:=wdSeparateByTabs)

This example converts the table that contains the selection to text, with spaces between the columns.

VBA Copy code Copy code
If Selection.Information(wdWithInTable) = True Then
 Selection.Tables(1).ConvertToText Separator:=" "
Else
 MsgBox "The insertion point is not in a table."
End If

See also

Concepts

Table Object

Other resources

Table Object Members


Table.Delete Method (Word)

 Copy code hover
[image]

Table.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the specified table.

Syntax

expression .Delete

expression Required. A variable that represents a Table object.

See also

Concepts

Table Object

Other resources

Table Object Members


Table.Select Method (Word)

 Copy code hover
[image]

Table.Select Method (Word)
See also Send feedback

Selects the specified table.

Syntax

expression .Select

expression Required. A variable that represents a Table object.

Remarks

After using this method, use the Selection object to work with the selected items. For more information, see Working with the Selection Object.

See also

Concepts

Table Object

Other resources

Table Object Members


Table.Sort Method (Word)

 Copy code hover
[image]

Table.Sort Method (Word)
See also Send feedback

Published: July 16, 2012

Sorts the specified table.

Syntax

expression .Sort(ExcludeHeader, FieldNumber, SortFieldType, SortOrder, FieldNumber2, SortFieldType2, SortOrder2, FieldNumber3, SortFieldType3, SortOrder3, CaseSensitive, BidiSort, IgnoreThe, IgnoreKashida, IgnoreDiacritics, IgnoreHe, LanguageID)

expression Required. A variable that represents a Table object.

Parameters

Name | Required/Optional | Data Type | Description
ExcludeHeader | Optional | Variant | True to exclude the first row from the sort operation. The default value is False.
FieldNumber | Optional | Variant | The first field by which to sort. Microsoft Word sorts by FieldNumber, then by FieldNumber2, and then by FieldNumber3.
SortFieldType | Optional | Variant | The sort type for FieldNumber. Can be one of the WdSortFieldType constants. Some of these constants may not be available to you, depending on the language support (U.S. English, for example) that you have selected or installed. The default value is wdSortFieldAlphanumeric.
SortOrder | Optional | Variant | The sorting order to use when sorting FieldNumber. Can be a WdSortOrder constant.
FieldNumber2 | Optional | Variant | The second field by which to sort.
SortFieldType2 | Optional | Variant | The sort type for FieldNumber2. Can be one of the WdSortFieldType constants. Some of these constants may not be available to you, depending on the language support (U.S. English, for example) that you have selected or installed. The default value is wdSortFieldAlphanumeric.
SortOrder2 | Optional | Variant | The sorting order to use when sorting FieldNumber2. Can be one WdSortOrder constant.
FieldNumber3 | Optional | Variant | The third field by which to sort.
SortFieldType3 | Optional | Variant | The sort type for FieldNumber3. Can be one of the WdSortFieldType constants. Some of these constants may not be available to you, depending on the language support (U.S. English, for example) that you have selected or installed. The default value is wdSortFieldAlphanumeric.
SortOrder3 | Optional | Variant | The sorting order to use when sorting FieldNumber3. Can be one WdSortOrder constant.
CaseSensitive | Optional | Variant | True to sort with case sensitivity. The default value is False.
BidiSort | Optional | Variant | True to sort based on right-to-left language rules. This argument may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.
IgnoreThe | Optional | Variant | True to ignore the Arabic character alef lam when sorting right-to-left language text. This argument may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.
IgnoreKashida | Optional | Variant | True to ignore kashidas when sorting right-to-left language text. This argument may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.
IgnoreDiacritics | Optional | Variant | True to ignore bidirectional control characters when sorting right-to-left language text. This argument may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.
IgnoreHe | Optional | Variant | True to ignore the Hebrew character he when sorting right-to-left language text. This argument may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.
LanguageID | Optional | Variant | Specifies the sorting language. Can be one of the WdLanguageID constants. Refer to the Object Browser for a list of the WdLanguageID constants.

Example

This example sorts the first table in the active document, excluding the heading row.

VBA Copy code Copy code
Sub NewTableSort()
 ActiveDocument.Tables(1).Sort ExcludeHeader:=True
End Sub

See also

Concepts

Table Object

Other resources

Table Object Members


Table.SortAscending Method (Word)

 Copy code hover
[image]

Table.SortAscending Method (Word)
See also Send feedback

Published: July 16, 2012

Sorts paragraphs or table rows in ascending alphanumeric order.

Syntax

expression .SortAscending

expression Required. A variable that represents a Table object.

Remarks

The first table row is considered a header record and isn't included in the sort. Use the Sort method to include the first row in a sort. This method offers a simplified form of sorting intended for mail merge data sources that contain columns of data. For most sorting tasks, use the Sort method.

Example

This example sorts the table that contains the selection in ascending order.

VBA Copy code Copy code
If Selection.Information(wdWithInTable) = True Then
 Selection.Tables(1).SortAscending
Else
 MsgBox "The insertion point is not in a table."
End If

See also

Concepts

Table Object

Other resources

Table Object Members


Table.SortDescending Method (Word)

 Copy code hover
[image]

Table.SortDescending Method (Word)
See also Send feedback

Published: July 16, 2012

Sorts table rows in descending alphanumeric order.

Syntax

expression .SortDescending

expression Required. A variable that represents a Table object.

Remarks

The first table row is considered a header record and isn't included in the sort. Use the Sort method to include the header record in a sort.

This method offers a simplified form of sorting intended for mail-merge data sources that contain columns of data. For most sorting tasks, use the Sort method.

Example

This example creates a 5x5 table in a new document, inserts text into each cell, and then sorts the table in descending alphanumeric order.

VBA Copy code Copy code
Set newDoc = Documents.Add
Set myTable = _
 newDoc.Tables.Add(Range:=Selection.Range, NumRows:=5, _
 NumColumns:=5)
For iRow = 1 To myTable.Rows.Count
 For iCol = 1 To myTable.Columns.Count
 Set MyRange = myTable.Rows(iRow).Cells(iCol).Range
 MyRange.InsertAfter "Cell" & Str$(iRow) & "," & Str$(iCol)
 Next iCol
Next iRow
MsgBox "Click OK to sort in descending order."
myTable.SortDescending

This example sorts the table that contains the insertion point in descending alphanumeric order.

VBA Copy code Copy code
If Selection.Information(wdWithInTable) = True Then
 Selection.Tables(1).SortDescending
Else
 MsgBox "The insertion point is not in a table."
End If

See also

Concepts

Table Object

Other resources

Table Object Members


Table.Split Method (Word)

 Copy code hover
[image]

Table.Split Method (Word)
See also Send feedback

Published: July 16, 2012

Inserts an empty paragraph immediately above the specified row in the table, and returns a Table object that contains both the specified row and the rows that follow it.

Syntax

expression .Split(BeforeRow)

expression Required. A variable that represents a Table object.

Parameters

Name | Required/Optional | Data Type | Description
BeforeRow | Required | Variant | The row that the table is to be split before. Can be a row number or a Row object.

Return Value

Table

See also

Concepts

Table Object

Other resources

Table Object Members


Table.UpdateAutoFormat Method (Word)

 Copy code hover
[image]

Table.UpdateAutoFormat Method (Word)
See also Send feedback

Published: July 16, 2012

Updates the table with the characteristics of a predefined table format.

Syntax

expression .UpdateAutoFormat

expression Required. A variable that represents a Table object.

Remarks

As an example of how this method functions, if you apply a table format with AutoFormat and then insert rows and columns, the table may no longer match the predefined look. UpdateAutoFormat restores the format.

Example

This example creates a table, applies a predefined format to it, adds a row, and then reapplies the predefined format.

VBA Copy code Copy code
Dim docNew As Document
Dim tableNew As Table

Set docNew = Documents.Add
Set tableNew = docNew.Tables.Add(Selection.Range, 5, 5)

With tableNew
 .AutoFormat Format:=wdTableFormatColumns1
 .Rows.Add BeforeRow:=tableNew.Rows(1)
End With
MsgBox "Click OK to reapply autoformatting."
tableNew.UpdateAutoFormat

This example restores the predefined format to the table that contains the insertion point.

VBA Copy code Copy code
If Selection.Information(wdWithInTable) = True Then
 Selection.Tables(1).UpdateAutoFormat
Else
 MsgBox "The insertion point is not in a table."
End If

See also

Concepts

Table Object

Other resources

Table Object Members


TableOfAuthorities Object (Word)

 Copy code hover
[image]

TableOfAuthorities Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a single table of authorities in a document (a TOA field). The TableOfAuthorities object is a member of the TablesOfAuthorities collection. The TablesOfAuthorities collection includes all the tables of authorities in a document.

Remarks

Use TablesOfAuthorities(Index), where Index is the index number, to return a single TableOfAuthorities object. The index number represents the position of the table of authorities in the document. The following example includes category headers in the first table of authorities in the active document and then updates the table.

VBA Copy code Copy code
With ActiveDocument.TablesOfAuthorities(1)
 .IncludeCategoryHeader = True
 .Update
End With

Use the Add method to add a table of authorities to a document. The following example adds a table of authorities that includes all categories at the beginning of the active document.

VBA Copy code Copy code
Set myRange = ActiveDocument.Range(Start:=0, End:=0)
ActiveDocument.TablesOfAuthorities.Add Range:=myRange, _
 Passim:=True, Category:=0, EntrySeparator:=", "
Note Note

A table of authorities is built from TA (Table of Authorities Entry) fields in a document. Use the MarkCitation method to mark citations to be included in a table of authorities.

See also

Concepts

Word Object Model Reference

Other resources

TableOfAuthorities Object Members


TableOfAuthorities Members (Word)

 Copy code hover
[image]

TableOfAuthorities Members (Word)
Send feedback

Published: July 16, 2012

Represents a single table of authorities in a document (a TOA field). The TableOfAuthorities object is a member of the TablesOfAuthorities collection. The TablesOfAuthorities collection includes all the tables of authorities in a document.

Methods

Name | Description
Delete | Deletes the specified table of authorities.
Update | Updates the entries shown in a table of authorities.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Bookmark | Returns or sets the name of the bookmark from which to collect table of authorities entries. Read/write String.
Category | Returns or sets the category of entries to be included in a table of authorities. Read/write Long.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
EntrySeparator | Returns or sets the characters (up to five) that separate a table of authorities entry and its page number. Read/write String.
IncludeCategoryHeader | True if the category name for a group of entries appears in the table of authorities. Read/write Boolean.
IncludeSequenceName | Returns or sets the Sequence (SEQ) field identifier for a table of authorities. Read/write String.
KeepEntryFormatting | True if formatting from table of authorities entries is applied to the entries in the specified table of authorities. Read/write Boolean.
PageNumberSeparator | Returns of sets the characters (up to five) that separate individual page references in a table of authorities. Read/write String.
PageRangeSeparator | Returns or sets the characters (up to five) that separate a range of pages in a table of authorities. Read/write String.
Parent | Returns an Object that represents the parent object of the specified TableOfAuthorities object.
Passim | True if five or more page references to the same authority are replaced with "Passim." Read/write Boolean.
Range | Returns a Range object that represents the portion of a document that is contained within a table of authorities.
Separator | Returns or sets up to five characters that appear between the sequence number and the page number in a table of authorities. Read/write String.
TabLeader | Returns or sets the leader character that appears between entries and their associated page numbers in a table of authorities. Read/write WdTabLeader.


TableOfAuthorities Properties (Word)

 Copy code hover
[image]

TableOfAuthorities Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Bookmark | Returns or sets the name of the bookmark from which to collect table of authorities entries. Read/write String.
Category | Returns or sets the category of entries to be included in a table of authorities. Read/write Long.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
EntrySeparator | Returns or sets the characters (up to five) that separate a table of authorities entry and its page number. Read/write String.
IncludeCategoryHeader | True if the category name for a group of entries appears in the table of authorities. Read/write Boolean.
IncludeSequenceName | Returns or sets the Sequence (SEQ) field identifier for a table of authorities. Read/write String.
KeepEntryFormatting | True if formatting from table of authorities entries is applied to the entries in the specified table of authorities. Read/write Boolean.
PageNumberSeparator | Returns of sets the characters (up to five) that separate individual page references in a table of authorities. Read/write String.
PageRangeSeparator | Returns or sets the characters (up to five) that separate a range of pages in a table of authorities. Read/write String.
Parent | Returns an Object that represents the parent object of the specified TableOfAuthorities object.
Passim | True if five or more page references to the same authority are replaced with "Passim." Read/write Boolean.
Range | Returns a Range object that represents the portion of a document that is contained within a table of authorities.
Separator | Returns or sets up to five characters that appear between the sequence number and the page number in a table of authorities. Read/write String.
TabLeader | Returns or sets the leader character that appears between entries and their associated page numbers in a table of authorities. Read/write WdTabLeader.


TableOfAuthorities.Application Property (Word)

 Copy code hover
[image]

TableOfAuthorities.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a TableOfAuthorities collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

TableOfAuthorities Object

Other resources

TableOfAuthorities Object Members


TableOfAuthorities.Bookmark Property (Word)

 Copy code hover
[image]

TableOfAuthorities.Bookmark Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the name of the bookmark from which to collect table of authorities entries. Read/write String.

Syntax

expression .Bookmark

expression A variable that represents a TableOfAuthorities object.

Remarks

The Bookmark property corresponds to the \b switch for a TOA (Table of Authorities) field.

Example

If a table of authorities exists in the active document, the entries are collected from the area defined by the bookmark named "area."

VBA Copy code Copy code
If ActiveDocument.TablesOfAuthorities.Count >= 1 Then
 ActiveDocument.TablesOfAuthorities(1).Bookmark = "area"
End If

See also

Concepts

TableOfAuthorities Object

Other resources

TableOfAuthorities Object Members


TableOfAuthorities.Category Property (Word)

 Copy code hover
[image]

TableOfAuthorities.Category Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the category of entries to be included in a table of authorities. Read/write Long.

Syntax

expression .Category

expression A variable that represents a TableOfAuthorities collection.

Remarks

This property corresponds to the \c switch for a TOA field. Values 1 through 16 correspond to the items in the Category list on the Table of Authorities tab in the Index and Tables dialog box. The number 0 (zero), which corresponds to all categories, cannot be used with this property. You can, however, use 0 to specify all categories when you are inserting a table of authorities.

Example

The following example inserts a table of authorities for all categories.

VBA Copy code Copy code
ActiveDocument.TablesOfAuthorities.Add _
 Range:=Selection.Range, Category:=0

This example formats the first table of authorities in the active document to include all citations in the first category (by default, the Cases category).

VBA Copy code Copy code
If ActiveDocument.TablesOfAuthorities.Count >= 1 Then
 ActiveDocument.TablesOfAuthorities(1).Category = 1
End If

See also

Concepts

TableOfAuthorities Object

Other resources

TableOfAuthorities Object Members


TableOfAuthorities.Creator Property (Word)

 Copy code hover
[image]

TableOfAuthorities.Creator Property (Word)
See also Send feedback

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a TableOfAuthorities collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

TableOfAuthorities Object

Other resources

TableOfAuthorities Object Members


TableOfAuthorities.EntrySeparator Property (Word)

 Copy code hover
[image]

TableOfAuthorities.EntrySeparator Property (Word)
See also Send feedback

Returns or sets the characters (up to five) that separate a table of authorities entry and its page number. Read/write String.

Syntax

expression .EntrySeparator

expression A variable that represents a TableOfAuthorities object.

Remarks

The default is a tab character with a dotted leader. Corresponds to the \e switch for a TOA (Table of Authorities) field.

Example

This example inserts a table of authorities into the active document and then formats the table to use a comma between the entries and their corresponding page numbers.

VBA Copy code Copy code
Dim rngTemp As Range
Dim toaLoop As TableOfAuthorities

Set rngTemp = ActiveDocument.Range(Start:=0, End:=0)
ActiveDocument.TablesOfAuthorities.Add _
 Range:=rngTemp, Category:=1
For Each toaLoop In ActiveDocument.TablesOfAuthorities
 toaLoop.EntrySeparator = ", "
Next toaLoop

This example returns the entry separator for the first table of authorities.

VBA Copy code Copy code
Dim strSeparator

strSeparator = _
 ActiveDocument.TablesOfAuthorities(1).EntrySeparator

See also

Concepts

TableOfAuthorities Object

Other resources

TableOfAuthorities Object Members


TableOfAuthorities.IncludeCategoryHeader Property (Word)

 Copy code hover
[image]

TableOfAuthorities.IncludeCategoryHeader Property (Word)
See also Send feedback

Published: July 16, 2012

True if the category name for a group of entries appears in the table of authorities. Read/write Boolean.

Syntax

expression .IncludeCategoryHeader

expression An expression that returns a TableOfAuthorities object.

Remarks

Corresponds to the \h switch for a Table of Authorities (TOA) field.

Example

This example includes the category name for each table of authorities in the active document.

VBA Copy code Copy code
Dim toaLoop As TableOfAuthorities

For Each toaLoop In ActiveDocument.TablesOfAuthorities
 toaLoop.IncludeCategoryHeader = True
Next toaLoop

See also

Concepts

TableOfAuthorities Object

Other resources

TableOfAuthorities Object Members


TableOfAuthorities.IncludeSequenceName Property (Word)

 Copy code hover
[image]

TableOfAuthorities.IncludeSequenceName Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the Sequence (SEQ) field identifier for a table of authorities. Read/write String.

Syntax

expression .IncludeSequenceName

expression An expression that returns a TableOfAuthorities object.

Remarks

Corresponds to the \s switch for a Table of Authorities (TOA) field.

Example

This example inserts a table of authorities at the beginning of the active document and then formats the table to include the Chapter sequence field number before the page number (for example, "Chapter 2-14").

VBA Copy code Copy code
Dim rngTemp As Range
Dim toaTemp As TableOfAuthorities

Set rngTemp = ActiveDocument.Range(Start:=0, End:=0)
Set toaTemp = _
 ActiveDocument.TablesOfAuthorities.Add(Range:=rngTemp)

toaTemp.IncludeSequenceName = "Chapter"

This example returns the sequence name for the first table of authorities.

VBA Copy code Copy code
Dim strSequence As String

strSequence = _
 ActiveDocument.TablesOfAuthorities(1).IncludeSequenceName

See also

Concepts

TableOfAuthorities Object

Other resources

TableOfAuthorities Object Members


TableOfAuthorities.KeepEntryFormatting Property (Word)

 Copy code hover
[image]

TableOfAuthorities.KeepEntryFormatting Property (Word)
See also Send feedback

Published: July 16, 2012

True if formatting from table of authorities entries is applied to the entries in the specified table of authorities. Read/write Boolean.

Syntax

expression .KeepEntryFormatting

expression An expression that returns a TableOfAuthorities object.

Remarks

Corresponds to the \f switch for a Table of Authorities (TOA) field.

Example

This example removes the formatting from the entries in the first table of authorities of the active document (the \f switch is added to the TOA field).

VBA Copy code Copy code
If ActiveDocument.TablesOfAuthorities.Count >= 1 Then
 ActiveDocument.TablesOfAuthorities(1) _
 .KeepEntryFormatting = False
End If

See also

Concepts

TableOfAuthorities Object

Other resources

TableOfAuthorities Object Members


TableOfAuthorities.PageNumberSeparator Property (Word)

 Copy code hover
[image]

TableOfAuthorities.PageNumberSeparator Property (Word)
See also Send feedback

Returns of sets the characters (up to five) that separate individual page references in a table of authorities. Read/write String.

Syntax

expression .PageNumberSeparator

expression An expression that returns a TableOfAuthorities object.

Remarks

The default is a comma and a space. Corresponds to the \l switch for a Table of Authorities (TOA) field.

Example

This example formats the tables of authorities in the active document to use a comma as the page separator (for example, "9,12").

VBA Copy code Copy code
For Each myTOA In ActiveDocument.TablesOfAuthorities
 myTOA.PageNumberSeparator = ","
Next myTOA

See also

Concepts

TableOfAuthorities Object

Other resources

TableOfAuthorities Object Members


TableOfAuthorities.PageRangeSeparator Property (Word)

 Copy code hover
[image]

TableOfAuthorities.PageRangeSeparator Property (Word)
See also Send feedback

Returns or sets the characters (up to five) that separate a range of pages in a table of authorities. Read/write String.

Syntax

expression .PageRangeSeparator

expression An expression that returns a TableOfAuthorities object.

Remarks

The default is an en dash. Corresponds to the \g switch for a Table of Authorities (TOA) field.

Example

This example formats the first table of authorities in the active document to use a hyphen with a space on either side as the page range separator (for example, "9 - 12").

VBA Copy code Copy code
ActiveDocument.TablesOfAuthorities(1).PageRangeSeparator = " - "

See also

Concepts

TableOfAuthorities Object

Other resources

TableOfAuthorities Object Members


TableOfAuthorities.Parent Property (Word)

 Copy code hover
[image]

TableOfAuthorities.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified TableOfAuthorities object.

Syntax

expression .Parent

expression Required. A variable that represents a TableOfAuthorities collection.

See also

Concepts

TableOfAuthorities Object

Other resources

TableOfAuthorities Object Members


TableOfAuthorities.Passim Property (Word)

 Copy code hover
[image]

TableOfAuthorities.Passim Property (Word)
See also Send feedback

Published: July 16, 2012

True if five or more page references to the same authority are replaced with "Passim." Read/write Boolean.

Syntax

expression .Passim

expression An expression that returns a TableOfAuthorities object.

Remarks

Corresponds to the \p switch for a Table of Authorities (TOA) field.

Example

This example formats the first table of authorities in Brief.doc to use page references instead of "Passim."

VBA Copy code Copy code
Documents("Brief.doc").TablesOfAuthorities(1).Passim = False

This example formats the tables of authorities in the active document to replace each instance of five or more page references for the same entry with "Passim."

VBA Copy code Copy code
For Each myTOA In ActiveDocument.TablesOfAuthorities
 myToa.Passim = True
Next myTOA

See also

Concepts

TableOfAuthorities Object

Other resources

TableOfAuthorities Object Members


TableOfAuthorities.Range Property (Word)

 Copy code hover
[image]

TableOfAuthorities.Range Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the portion of a document that is contained within a table of authorities.

Syntax

expression .Range

expression Required. A variable that represents a TableOfAuthorities collection.

See also

Concepts

TableOfAuthorities Object

Other resources

TableOfAuthorities Object Members


TableOfAuthorities.Separator Property (Word)

 Copy code hover
[image]

TableOfAuthorities.Separator Property (Word)
See also Send feedback

Returns or sets up to five characters that appear between the sequence number and the page number in a table of authorities. Read/write String.

Syntax

expression .Separator

expression Required. A variable that represents a TableOfAuthorities collection.

Remarks

This property corresponds to the \d switch for a Table of Authorities (TOA) field. A hyphen (-) is the default character.

Example

This example inserts a table of authorities at the beginning of the active document, and then it formats the table to include a sequence number and a page number, separated by a hyphen (-).

VBA Copy code Copy code
Set myRange = ActiveDocument.Range(0, 0)
With ActiveDocument.TablesOfAuthorities.Add(Range:=myRange)
 .IncludeSequenceName = "Chapter"
 .Separator = "-"
End With

See also

Concepts

TableOfAuthorities Object

Other resources

TableOfAuthorities Object Members


TableOfAuthorities.TabLeader Property (Word)

 Copy code hover
[image]

TableOfAuthorities.TabLeader Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the leader character that appears between entries and their associated page numbers in a table of authorities. Read/write WdTabLeader.

Syntax

expression .TabLeader

expression Required. A variable that represents a TableOfAuthorities collection.

Example

This example formats the tables of authorities in Sales.doc to use a dotted tab leader.

VBA Copy code Copy code
For Each aTOA In Documents("Sales.doc").TablesOfAuthorities
 aTOA.TabLeader = wdTabLeaderDots
Next aTOA

See also

Concepts

TableOfAuthorities Object

Other resources

TableOfAuthorities Object Members


TableOfAuthorities Methods (Word)

 Copy code hover
[image]

TableOfAuthorities Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the specified table of authorities.
Update | Updates the entries shown in a table of authorities.


TableOfAuthorities.Delete Method (Word)

 Copy code hover
[image]

TableOfAuthorities.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the specified table of authorities.

Syntax

expression .Delete

expression Required. A variable that represents a TableOfAuthorities collection.

See also

Concepts

TableOfAuthorities Object

Other resources

TableOfAuthorities Object Members


TableOfAuthorities.Update Method (Word)

 Copy code hover
[image]

TableOfAuthorities.Update Method (Word)
See also Send feedback

Published: July 16, 2012

Updates the entries shown in a table of authorities.

Syntax

expression .Update

expression Required. A variable that represents a TableOfAuthorities collection.

See also

Concepts

TableOfAuthorities Object

Other resources

TableOfAuthorities Object Members


TableOfAuthoritiesCategory Object (Word)

 Copy code hover
[image]

TableOfAuthoritiesCategory Object (Word)
See also Send feedback

Represents a single table of authorities category. The TableOfAuthoritiesCategories object is a member of the TablesOfAuthoritiesCategories collection.

Remarks

The TablesOfAuthoritiesCategories collection includes all 16 categories listed in the Category box on the Table of Authorities tab in the Index and Tables dialog box.

Use TablesOfAuthoritiesCategories(Index), where Index is the category name or index number, to return a single TableOfAuthoritiesCategory object. The following example renames the Rules category as Other Provisions.

VBA Copy code Copy code
ActiveDocument.TablesOfAuthoritiesCategories("Rules").Name = _
 "Other Provisions"

The index number represents the position of the category in the Index and Tables dialog box (Insert menu). The following example displays the name of the first category in the TablesOfAuthoritiesCategories collection.

VBA Copy code Copy code
MsgBox ActiveDocument.TablesOfAuthoritiesCategories(1).Name

The Add method isn't available for the TablesOfAuthoritiesCategories collection. The collection is limited to 16 items; however, you can use the Name property to rename an existing category.

See also

Concepts

Word Object Model Reference

Other resources

TableOfAuthoritiesCategory Object Members


TableOfAuthoritiesCategory Members (Word)

 Copy code hover
[image]

TableOfAuthoritiesCategory Members (Word)
Send feedback

Published: July 16, 2012

Represents a single table of authorities category. The TableOfAuthoritiesCategories object is a member of the TablesOfAuthoritiesCategories collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Index | Returns a Long that represents the position of an item in a collection. Read-only.
Name | Returns the name of the specified object. Read-only String.
Parent | Returns an Object that represents the parent object of the specified TableOfAuthoritiesCategory object.


TableOfAuthoritiesCategory Properties (Word)

 Copy code hover
[image]

TableOfAuthoritiesCategory Properties (Word)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Index | Returns a Long that represents the position of an item in a collection. Read-only.
Name | Returns the name of the specified object. Read-only String.
Parent | Returns an Object that represents the parent object of the specified TableOfAuthoritiesCategory object.


TableOfAuthoritiesCategory.Application Property (Word)

 Copy code hover
[image]

TableOfAuthoritiesCategory.Application Property (Word)
See also Send feedback

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a TableOfAuthoritiesCategory object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

TableOfAuthoritiesCategory Object

Other resources

TableOfAuthoritiesCategory Object Members


TableOfAuthoritiesCategory.Creator Property (Word)

 Copy code hover
[image]

TableOfAuthoritiesCategory.Creator Property (Word)
See also Send feedback

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a TableOfAuthoritiesCategory object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

TableOfAuthoritiesCategory Object

Other resources

TableOfAuthoritiesCategory Object Members


TableOfAuthoritiesCategory.Index Property (Word)

 Copy code hover
[image]

TableOfAuthoritiesCategory.Index Property (Word)
See also Send feedback

Returns a Long that represents the position of an item in a collection. Read-only.

Syntax

expression .Index

expression Required. A variable that represents a TableOfAuthoritiesCategory object.

See also

Concepts

TableOfAuthoritiesCategory Object

Other resources

TableOfAuthoritiesCategory Object Members


TableOfAuthoritiesCategory.Name Property (Word)

 Copy code hover
[image]

TableOfAuthoritiesCategory.Name Property (Word)
See also Send feedback

Returns the name of the specified object. Read-only String.

Syntax

expression .Name

expression Required. A variable that represents a TableOfAuthoritiesCategory object.

See also

Concepts

TableOfAuthoritiesCategory Object

Other resources

TableOfAuthoritiesCategory Object Members


TableOfAuthoritiesCategory.Parent Property (Word)

 Copy code hover
[image]

TableOfAuthoritiesCategory.Parent Property (Word)
See also Send feedback

Returns an Object that represents the parent object of the specified TableOfAuthoritiesCategory object.

Syntax

expression .Parent

expression Required. A variable that represents a TableOfAuthoritiesCategory object.

See also

Concepts

TableOfAuthoritiesCategory Object

Other resources

TableOfAuthoritiesCategory Object Members


TableOfContents (Word)

 Copy code hover
[image]

TableOfContents (Word)
See also Send feedback

Represents a single table of contents in a document. The TableOfContents object is a member of the TablesOfContents collection. The TablesOfContents collection includes all the tables of contents in a document.

Remarks

Use TablesOfContents(Index), where Index is the index number, to return a single TableOfContents object. The index number represents the position of the table of contents in the document. The following example updates the page numbers of the items in the first table of figures in the active document.

VBA Copy code Copy code
ActiveDocument.TablesOfContents(1).UpdatePageNumbers

Use the Add method to add a table of contents to a document. The following example adds a table of contents at the beginning of the active document. The example builds the table of contents from all paragraphs styled as either Heading 1, Heading 2, or Heading 3.

VBA Copy code Copy code
Set myRange = ActiveDocument.Range(Start:=0, End:=0)
ActiveDocument.TablesOfContents.Add Range:=myRange, _
 UseFields:=False, UseHeadingStyles:=True, _
 LowerHeadingLevel:=3, _
 UpperHeadingLevel:=1

See also

Concepts

Word Object Model Reference

Other resources

TableOfContents Object Members


TableOfContents Members (Word)

 Copy code hover
[image]

TableOfContents Members (Word)
Send feedback

Represents a single table of contents in a document. The TableOfContents object is a member of the TablesOfContents collection. The TablesOfContents collection includes all the tables of contents in a document.

Methods

Name | Description
Delete | Deletes the specified table of contents.
Update | Updates the entries shown in a table of contents.
UpdatePageNumbers | Updates the page numbers for items in the specified table of contents.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
HeadingStyles | Returns a HeadingStyles object that represents additional styles used to compile a table of contents or table of figures (styles other than the Heading 1 - Heading 9 styles). Read-only.
HidePageNumbersInWeb | Returns or sets whether page numbers in a table of contents or a table of figures should be hidden when publishing to the Web. Read/write Boolean.
IncludePageNumbers | True if page numbers are included in the table of contents. Read/write Boolean.
LowerHeadingLevel | Returns or sets the ending heading level for a table of contents or table of figures. Read/write Long.
Parent | Returns an Object that represents the parent object of the specified TableOfContents object.
Range | Returns a Range object that represents the portion of a document that is contained within the specified table of contents.
RightAlignPageNumbers | True if page numbers are aligned with the right margin in a table of contents. Read/write Boolean.
TabLeader | Returns or sets the character between entries and their page numbers in an index, table of authorities, table of contents, or table of figures. Read/write WdTabLeader.
TableID | Returns or sets a one-letter identifier that's used to build a table of contents from TOC fields. Read/write String.
UpperHeadingLevel | Returns or sets the starting heading level for a table of contents. Read/write Long.
UseFields | True if Table of Contents Entry (TC) fields are used to create a table of contents or a table of figures. Read/write Boolean.
UseHeadingStyles | True if built-in heading styles are used to create a table of contents. Read/write Boolean.
UseHyperlinks | Returns or sets whether entries in a table of contents should be formatted as hyperlinks when publishing to the Web. Read/write Boolean.


TableOfContents Properties (Word)

 Copy code hover
[image]

TableOfContents Properties (Word)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
HeadingStyles | Returns a HeadingStyles object that represents additional styles used to compile a table of contents or table of figures (styles other than the Heading 1 - Heading 9 styles). Read-only.
HidePageNumbersInWeb | Returns or sets whether page numbers in a table of contents or a table of figures should be hidden when publishing to the Web. Read/write Boolean.
IncludePageNumbers | True if page numbers are included in the table of contents. Read/write Boolean.
LowerHeadingLevel | Returns or sets the ending heading level for a table of contents or table of figures. Read/write Long.
Parent | Returns an Object that represents the parent object of the specified TableOfContents object.
Range | Returns a Range object that represents the portion of a document that is contained within the specified table of contents.
RightAlignPageNumbers | True if page numbers are aligned with the right margin in a table of contents. Read/write Boolean.
TabLeader | Returns or sets the character between entries and their page numbers in an index, table of authorities, table of contents, or table of figures. Read/write WdTabLeader.
TableID | Returns or sets a one-letter identifier that's used to build a table of contents from TOC fields. Read/write String.
UpperHeadingLevel | Returns or sets the starting heading level for a table of contents. Read/write Long.
UseFields | True if Table of Contents Entry (TC) fields are used to create a table of contents or a table of figures. Read/write Boolean.
UseHeadingStyles | True if built-in heading styles are used to create a table of contents. Read/write Boolean.
UseHyperlinks | Returns or sets whether entries in a table of contents should be formatted as hyperlinks when publishing to the Web. Read/write Boolean.


TableOfContents.Application Property (Word)

 Copy code hover
[image]

TableOfContents.Application Property (Word)
See also Send feedback

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a TableOfContents collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

TableOfContents Object

Other resources

TableOfContents Object Members


TableOfContents.Creator Property (Word)

 Copy code hover
[image]

TableOfContents.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a TableOfContents collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

TableOfContents Object

Other resources

TableOfContents Object Members


TableOfContents.HeadingStyles Property (Word)

 Copy code hover
[image]

TableOfContents.HeadingStyles Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a HeadingStyles object that represents additional styles used to compile a table of contents or table of figures (styles other than the Heading 1 - Heading 9 styles). Read-only.

Syntax

expression .HeadingStyles

expression A variable that represents a TableOfContents collection.

Example

This example adds a style to the HeadingStyles collection and then displays the names of all the style in the collection.

VBA Copy code Copy code
Dim hsLoop As HeadingStyle

If ActiveDocument.TablesOfContents.Count >=1 Then
 ActiveDocument.TablesOfContents(1).HeadingStyles.Add _
 Style:="Title", Level:=2
 For Each hsLoop In _
 ActiveDocument.TablesOfContents(1).HeadingStyles
 MsgBox hsLoop.Style
 Next hsLoop
End If

This example adds a style named "Blue" to the HeadingStyles collection in a table of contents for Sales.doc.

VBA Copy code Copy code
With Documents("Sales.doc")
 .Styles.Add Name:="Blue"
 .TablesOfContents(1).UseHeadingStyles = True
 .TablesOfContents(1).HeadingStyles.Add _
 Style:="Blue", Level:=4
End With

See also

Concepts

TableOfContents Object

Other resources

TableOfContents Object Members


TableOfContents.HidePageNumbersInWeb Property (Word)

 Copy code hover
[image]

TableOfContents.HidePageNumbersInWeb Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets whether page numbers in a table of contents or a table of figures should be hidden when publishing to the Web. Read/write Boolean.

Syntax

expression .HidePageNumbersInWeb

expression A variable that represents a TableOfContents collection.

Example

This example hides page numbers in the first table of contents if the document is to be published to the Web.

VBA Copy code Copy code
ActiveDocument.TableOfContents(1).HidePageNumbersInWeb = True

See also

Concepts

TableOfContents Object

Other resources

TableOfContents Object Members


TableOfContents.IncludePageNumbers Property (Word)

 Copy code hover
[image]

TableOfContents.IncludePageNumbers Property (Word)
See also Send feedback

Published: July 16, 2012

True if page numbers are included in the table of contents. Read/write Boolean.

Syntax

expression .IncludePageNumbers

expression Required. A variable that represents a TableOfContents collection.

Example

This example formats the first table of contents in the active document to include right-aligned page numbers.

VBA Copy code Copy code
If ActiveDocument.TablesOfContents.Count >= 1 Then
 With ActiveDocument.TablesOfContents(1)
 .IncludePageNumbers = True
 .RightAlignPageNumbers = True
 End With
End If

See also

Concepts

TableOfContents Object

Other resources

TableOfContents Object Members


TableOfContents.LowerHeadingLevel Property (Word)

 Copy code hover
[image]

TableOfContents.LowerHeadingLevel Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the ending heading level for a table of contents or table of figures. Read/write Long.

Syntax

expression .LowerHeadingLevel

expression Required. A variable that represents a TableOfContents collection.

Remarks

This property corresponds to the ending value used with the \o switch for a Table of Contents (TOC) field. Use the UpperHeadingLevel property to set the starting heading level. For example, to set the TOC field syntax {TOC \o "1-3"}, set the LowerHeadingLevel property to 3 and the UpperHeadingLevel property to 1.

Example

This example formats the first table of contents in the active document to show entries formatted with the Heading 2, Heading 3, and Heading 4 styles.

VBA Copy code Copy code
If ActiveDocument.TablesOfContents.Count >= 1 Then
 With ActiveDocument.TablesOfContents(1)
 .UseHeadingStyles = True
 .UpperHeadingLevel = 2
 .LowerHeadingLevel = 4
 End With
End If

See also

Concepts

TableOfContents Object

Other resources

TableOfContents Object Members


TableOfContents.Parent Property (Word)

 Copy code hover
[image]

TableOfContents.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified TableOfContents object.

Syntax

expression .Parent

expression Required. A variable that represents a TableOfContents collection.

See also

Concepts

TableOfContents Object

Other resources

TableOfContents Object Members


TableOfContents.Range Property (Word)

 Copy code hover
[image]

TableOfContents.Range Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the portion of a document that is contained within the specified table of contents.

Syntax

expression .Range

expression Required. A variable that represents a TableOfContents collection.

See also

Concepts

TableOfContents Object

Other resources

TableOfContents Object Members


TableOfContents.RightAlignPageNumbers Property (Word)

 Copy code hover
[image]

TableOfContents.RightAlignPageNumbers Property (Word)
See also Send feedback

Published: July 16, 2012

True if page numbers are aligned with the right margin in a table of contents. Read/write Boolean.

Syntax

expression .RightAlignPageNumbers

expression Required. A variable that represents a TableOfContents collection.

Example

This example right-aligns page numbers for the first table of contents in the active document.

VBA Copy code Copy code
If ActiveDocument.TablesOfContents.Count >= 1 Then
 With ActiveDocument.TablesOfContents(1)
 .IncludePageNumbers = True
 .RightAlignPageNumbers = True
 End With
End If

See also

Concepts

TableOfContents Object

Other resources

TableOfContents Object Members


TableOfContents.TabLeader Property (Word)

 Copy code hover
[image]

TableOfContents.TabLeader Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the character between entries and their page numbers in an index, table of authorities, table of contents, or table of figures. Read/write WdTabLeader.

Syntax

expression .TabLeader

expression Required. A variable that represents a TableOfContents collection.

Example

This example formats the tables of contents in Sales.doc to use a dotted tab leader.

VBA Copy code Copy code
For Each aTOC In Documents("Sales.doc").TablesOfContents
 aTOC.TabLeader = wdTabLeaderDots
Next aTOC

See also

Concepts

TableOfContents Object

Other resources

TableOfContents Object Members


TableOfContents.TableID Property (Word)

 Copy code hover
[image]

TableOfContents.TableID Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a one-letter identifier that's used to build a table of contents from TOC fields. Read/write String.

Syntax

expression .TableID

expression Required. A variable that represents a TableOfContents collection.

Remarks

This property corresponds to the \f switch for a TOC field. For example, "T" builds a table of contents from TOC fields using the table identifier T.

Example

This example inserts a TOC field with an "A" identifier after the selection in Sales.doc. The first table of contents is then formatted to compile "A" entries.

VBA Copy code Copy code
Documents("Sales.doc").TablesOfContents.MarkEntry _
 Range:=Selection.Range, _
 Entry:="Hello", TableID:="A"
With Documents("Sales.doc").TablesOfContents(1)
 .TableID = "A"
 .UseFields = True
 .UseHeadingStyles = False
 .Update
End With

See also

Concepts

TableOfContents Object

Other resources

TableOfContents Object Members


TableOfContents.UpperHeadingLevel Property (Word)

 Copy code hover
[image]

TableOfContents.UpperHeadingLevel Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the starting heading level for a table of contents. Read/write Long.

Syntax

expression .UpperHeadingLevel

expression Required. A variable that represents a TableOfContents collection.

Remarks

This property corresponds to the starting value used with the \o switch for a Table of Contents (TOC) field. Use the LowerHeadingLevel property to set the ending heading level. For example, to set the TOC field syntax {TOC \o "1-3"}, set the LowerHeadingLevel property to 3 and the UpperHeadingLevel property to 1.

Example

This example formats the first table of contents in the active document to compile all headings that are formatted with either the Heading 2 or Heading 3 style.

VBA Copy code Copy code
If ActiveDocument.TablesOfContents.Count >= 1 Then
 With ActiveDocument.TablesOfContents(1)
 .UseHeadingStyles = True
 .UseFields = False
 .UpperHeadingLevel = 2
 .LowerHeadingLevel = 3
 End With
End If

See also

Concepts

TableOfContents Object

Other resources

TableOfContents Object Members


TableOfContents.UseFields Property (Word)

 Copy code hover
[image]

TableOfContents.UseFields Property (Word)
See also Send feedback

Published: July 16, 2012

True if Table of Contents Entry (TC) fields are used to create a table of contents or a table of figures. Read/write Boolean.

Syntax

expression .UseFields

expression Required. A variable that represents a TableOfContents collection.

Example

This example formats the first table of contents in the active document to use heading styles instead of TC fields.

VBA Copy code Copy code
If ActiveDocument.TablesOfContents.Count >= 1 Then
 With ActiveDocument.TablesOfContents(1)
 .UseFields = False
 .UseHeadingStyles = True
 End With
End If

See also

Concepts

TableOfContents Object

Other resources

TableOfContents Object Members


TableOfContents.UseHeadingStyles Property (Word)

 Copy code hover
[image]

TableOfContents.UseHeadingStyles Property (Word)
See also Send feedback

Published: July 16, 2012

True if built-in heading styles are used to create a table of contents. Read/write Boolean.

Syntax

expression .UseHeadingStyles

expression Required. A variable that represents a TableOfContents collection.

Example

This example formats the first table of contents in the active document to compile entries formatted with the Heading 1, Heading 2, or Heading 3 style.

VBA Copy code Copy code
If ActiveDocument.TablesOfContents.Count >= 1 Then
 With ActiveDocument.TablesOfContents(1)
 .UseHeadingStyles = True
 .UseFields = False
 .UpperHeadingLevel = 1
 .LowerHeadingLevel = 3
 End With
End If

See also

Concepts

TableOfContents Object

Other resources

TableOfContents Object Members


TableOfContents.UseHyperlinks Property (Word)

 Copy code hover
[image]

TableOfContents.UseHyperlinks Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets whether entries in a table of contents should be formatted as hyperlinks when publishing to the Web. Read/write Boolean.

Syntax

expression .UseHyperlinks

expression Required. A variable that represents a TableOfContents collection.

Example

This example formats the first table of contents in the document using hyperlinks.

VBA Copy code Copy code
ActiveDocument.TableOfContents(1).UseHyperlinks = True

See also

Concepts

TableOfContents Object

Other resources

TableOfContents Object Members


TableOfContents Methods (Word)

 Copy code hover
[image]

TableOfContents Methods (Word)
Send feedback

This object has the following methods:

Methods

Name | Description
Delete | Deletes the specified table of contents.
Update | Updates the entries shown in a table of contents.
UpdatePageNumbers | Updates the page numbers for items in the specified table of contents.


TableOfContents.Delete Method (Word)

 Copy code hover
[image]

TableOfContents.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the specified table of contents.

Syntax

expression .Delete

expression Required. A variable that represents a TableOfContents collection.

See also

Concepts

TableOfContents Object

Other resources

TableOfContents Object Members


TableOfContents.Update Method (Word)

 Copy code hover
[image]

TableOfContents.Update Method (Word)
See also Send feedback

Published: July 16, 2012

Updates the entries shown in a table of contents.

Syntax

expression .Update

expression Required. A variable that represents a TableOfContents object.

Remarks

Use the UpdatePageNumbers method to update the page numbers of items in a table of contents.

See also

Concepts

TableOfContents Object

Other resources

TableOfContents Object Members


TableOfContents.UpdatePageNumbers Method (Word)

 Copy code hover
[image]

TableOfContents.UpdatePageNumbers Method (Word)
See also Send feedback

Published: July 16, 2012

Updates the page numbers for items in the specified table of contents.

Syntax

expression .UpdatePageNumbers

expression Required. A variable that represents a TableOfContents collection.

Example

This example inserts a page break at the insertion point and then updates the page numbers for the first table of contents in the active document.

VBA Copy code Copy code
Selection.Collapse Direction:=wdCollapseStart
Selection.InsertBreak Type:=wdPageBreak
ActiveDocument.TablesOfContents(1).UpdatePageNumbers

See also

Concepts

TableOfContents Object

Other resources

TableOfContents Object Members


TableOfFigures Object (Word)

 Copy code hover
[image]

TableOfFigures Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a single table of figures in a document. The TableOfFigures object is a member of the TablesOfFigures collection. The TablesOfFigures collection includes all the tables of figures in a document.

Remarks

Use TablesOfFigures(Index), where Index is the index number, to return a single TableOfFigures object. The index number represents the position of the table of figures in the document. The following example updates the page numbers of the items in the first table of figures in the active document.

VBA Copy code Copy code
ActiveDocument.TablesOfFigures(1).UpdatePageNumbers

Use the Add method to add a table of figures to a document. A table of figures lists figure captions in the order in which they appear in the document. The following example replaces the selection in the active document with a table of figures that includes caption labels and page numbers.

VBA Copy code Copy code
ActiveDocument.TablesOfFigures.Add Range:=Selection.Range, _
 IncludeLabel:=True, IncludePageNumbers:=True

See also

Concepts

Word Object Model Reference

Other resources

TableOfFigures Object Members


TableOfFigures Members (Word)

 Copy code hover
[image]

TableOfFigures Members (Word)
Send feedback

Published: July 16, 2012

Represents a single table of figures in a document. The TableOfFigures object is a member of the TablesOfFigures collection. The TablesOfFigures collection includes all the tables of figures in a document.

Methods

Name | Description
Delete | Deletes the specified table of figures.
Update | Updates the entries shown in a table of figures.
UpdatePageNumbers | Updates the page numbers for items in a table of figures.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Caption | Returns or sets the label that identifies the items to be included in a table of figures. Read/write String.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
HeadingStyles | Returns a HeadingStyles object that represents additional styles used to compile a table of contents or table of figures (styles other than the Heading 1 - Heading 9 styles). Read-only.
HidePageNumbersInWeb | Returns or sets whether page numbers in a table of contents or a table of figures should be hidden when publishing to the Web. Read/write Boolean.
IncludeLabel | True if the caption label and caption number are included in a table of figures. Read/write Boolean.
IncludePageNumbers | True if page numbers are included in the table of figures. Read/write Boolean.
LowerHeadingLevel | Returns or sets the ending heading level for a table of figures. Read/write Long.
Parent | Returns an Object that represents the parent object of the specified TableOfFigures object.
Range | Returns a Range object that represents the portion of a document that is contained within the specified table of figures.
RightAlignPageNumbers | True if page numbers are aligned with the right margin in an table of figures. Read/write Boolean.
TabLeader | Returns or sets the character between entries and their page numbers in an table of figures. Read/write WdTabLeader.
TableID | Returns or sets a one-letter identifier that is used to build a table of figures from TOC fields. Read/write String.
UpperHeadingLevel | Returns or sets the starting heading level for a table of figures. Read/write Long.
UseFields | True if Table of Contents Entry (TC) fields are used to create a table of figures. Read/write Boolean.
UseHeadingStyles | True if built-in heading styles are used to create a table of figures. Read/write Boolean.
UseHyperlinks | Returns or sets whether entries in a a table of figures should be formatted as hyperlinks when publishing to the Web. Read/write Boolean.


TableOfFigures Properties (Word)

 Copy code hover
[image]

TableOfFigures Properties (Word)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Caption | Returns or sets the label that identifies the items to be included in a table of figures. Read/write String.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
HeadingStyles | Returns a HeadingStyles object that represents additional styles used to compile a table of contents or table of figures (styles other than the Heading 1 - Heading 9 styles). Read-only.
HidePageNumbersInWeb | Returns or sets whether page numbers in a table of contents or a table of figures should be hidden when publishing to the Web. Read/write Boolean.
IncludeLabel | True if the caption label and caption number are included in a table of figures. Read/write Boolean.
IncludePageNumbers | True if page numbers are included in the table of figures. Read/write Boolean.
LowerHeadingLevel | Returns or sets the ending heading level for a table of figures. Read/write Long.
Parent | Returns an Object that represents the parent object of the specified TableOfFigures object.
Range | Returns a Range object that represents the portion of a document that is contained within the specified table of figures.
RightAlignPageNumbers | True if page numbers are aligned with the right margin in an table of figures. Read/write Boolean.
TabLeader | Returns or sets the character between entries and their page numbers in an table of figures. Read/write WdTabLeader.
TableID | Returns or sets a one-letter identifier that is used to build a table of figures from TOC fields. Read/write String.
UpperHeadingLevel | Returns or sets the starting heading level for a table of figures. Read/write Long.
UseFields | True if Table of Contents Entry (TC) fields are used to create a table of figures. Read/write Boolean.
UseHeadingStyles | True if built-in heading styles are used to create a table of figures. Read/write Boolean.
UseHyperlinks | Returns or sets whether entries in a a table of figures should be formatted as hyperlinks when publishing to the Web. Read/write Boolean.


TableOfFigures.Application Property (Word)

 Copy code hover
[image]

TableOfFigures.Application Property (Word)
See also Send feedback

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a TableOfFigures collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

TableOfFigures Object

Other resources

TableOfFigures Object Members


TableOfFigures.Caption Property (Word)

 Copy code hover
[image]

TableOfFigures.Caption Property (Word)
See also Send feedback

Returns or sets the label that identifies the items to be included in a table of figures. Read/write String.

Syntax

expression .Caption

expression A variable that represents a TableOfFigures collection.

Remarks

This property corresponds to the \c switch for a TOC field.

Example

This example inserts a table caption and then changes the caption of the first table of figures to "Table."

VBA Copy code Copy code
Selection.Collapse Direction:=wdCollapseStart
Selection.Range.InsertCaption "Table"
If ActiveDocument.TablesOfFigures.Count >= 1 Then
 ActiveDocument.TablesOfFigures(1).Caption = "Table"
End If

See also

Concepts

TableOfFigures Object

Other resources

TableOfFigures Object Members


TableOfFigures.Creator Property (Word)

 Copy code hover
[image]

TableOfFigures.Creator Property (Word)
See also Send feedback

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a TableOfFigures collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

TableOfFigures Object

Other resources

TableOfFigures Object Members


TableOfFigures.HeadingStyles Property (Word)

 Copy code hover
[image]

TableOfFigures.HeadingStyles Property (Word)
See also Send feedback

Returns a HeadingStyles object that represents additional styles used to compile a table of contents or table of figures (styles other than the Heading 1 - Heading 9 styles). Read-only.

Syntax

expression .HeadingStyles

expression A variable that represents a TableOfFigures collection.

See also

Concepts

TableOfFigures Object

Other resources

TableOfFigures Object Members


TableOfFigures.HidePageNumbersInWeb Property (Word)

 Copy code hover
[image]

TableOfFigures.HidePageNumbersInWeb Property (Word)
See also Send feedback

Returns or sets whether page numbers in a table of contents or a table of figures should be hidden when publishing to the Web. Read/write Boolean.

Syntax

expression .HidePageNumbersInWeb

expression A variable that represents a TableOfFigures collection.

See also

Concepts

TableOfFigures Object

Other resources

TableOfFigures Object Members


TableOfFigures.IncludeLabel Property (Word)

 Copy code hover
[image]

TableOfFigures.IncludeLabel Property (Word)
See also Send feedback

True if the caption label and caption number are included in a table of figures. Read/write Boolean.

Syntax

expression .IncludeLabel

expression An expression that returns a TableOfFigures object.

Example

This example formats the first table of figures in the active document to exclude caption labels (Figure 1, for example).

VBA Copy code Copy code
If ActiveDocument.TablesOfFigures.Count >= 1 Then
 ActiveDocument.TablesOfFigures(1).IncludeLabel = False
End If

This example adds a table of figures in place of the selection and then formats the table to include caption labels.

VBA Copy code Copy code
Dim tofTemp As TableOfFigures

Set tofTemp = ActiveDocument.TablesOfFigures _
 .Add(Range:=Selection.Range, _
 Caption:="Figure")

tofTemp.IncludeLabel = True

See also

Concepts

TableOfFigures Object

Other resources

TableOfFigures Object Members


TableOfFigures.IncludePageNumbers Property (Word)

 Copy code hover
[image]

TableOfFigures.IncludePageNumbers Property (Word)
See also Send feedback

True if page numbers are included in the table of figures. Read/write Boolean.

Syntax

expression .IncludePageNumbers

expression Required. A variable that represents a TableOfFigures collection.

Example

This example formats the first table of figures in the active document to include right-aligned page numbers.

VBA Copy code Copy code
If ActiveDocument.TablesOfFigures.Count >= 1 Then
 With ActiveDocument.TablesOfFigures(1)
 .IncludePageNumbers = True
 .RightAlignPageNumbers = True
 End With
End If

See also

Concepts

TableOfFigures Object

Other resources

TableOfFigures Object Members


TableOfFigures.LowerHeadingLevel Property (Word)

 Copy code hover
[image]

TableOfFigures.LowerHeadingLevel Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the ending heading level for a table of figures. Read/write Long.

Syntax

expression .LowerHeadingLevel

expression Required. A variable that represents a TableOfFigures collection.

Remarks

This property corresponds to the ending value used with the \o switch for a Table of Contents (TOC) field. Use the UpperHeadingLevel property to set the starting heading level. For example, to set the TOC field syntax {TOC \o "1-3"}, set the LowerHeadingLevel property to 3 and the UpperHeadingLevel property to 1.

Example

This example formats the first table of table of figures in the active document to compile all headings that are formatted with either the Heading 8 or Heading 9 style.

VBA Copy code Copy code
If ActiveDocument.TablesOfFigures.Count >= 1 Then
 With ActiveDocument.TablesOfFigures(1)
 .UseHeadingStyles = True
 .UseFields = False
 .UpperHeadingLevel = 8
 .LowerHeadingLevel = 9
 End With
End If

See also

Concepts

TableOfFigures Object

Other resources

TableOfFigures Object Members


TableOfFigures.Parent Property (Word)

 Copy code hover
[image]

TableOfFigures.Parent Property (Word)
See also Send feedback

Returns an Object that represents the parent object of the specified TableOfFigures object.

Syntax

expression .Parent

expression Required. A variable that represents a TableOfFigures collection.

See also

Concepts

TableOfFigures Object

Other resources

TableOfFigures Object Members


TableOfFigures.Range Property (Word)

 Copy code hover
[image]

TableOfFigures.Range Property (Word)
See also Send feedback

Returns a Range object that represents the portion of a document that is contained within the specified table of figures.

Syntax

expression .Range

expression Required. A variable that represents a TableOfFigures collection.

See also

Concepts

TableOfFigures Object

Other resources

TableOfFigures Object Members


TableOfFigures.RightAlignPageNumbers Property (Word)

 Copy code hover
[image]

TableOfFigures.RightAlignPageNumbers Property (Word)
See also Send feedback

True if page numbers are aligned with the right margin in an table of figures. Read/write Boolean.

Syntax

expression .RightAlignPageNumbers

expression Required. A variable that represents a TableOfFigures collection.

Example

This example right-aligns page numbers for the first table of figures in the active document.

VBA Copy code Copy code
If ActiveDocument.TablesOfFigures.Count >= 1 Then
 With ActiveDocument.TablesOfFigures(1)
 .IncludePageNumbers = True
 .RightAlignPageNumbers = True
 End With
End If

See also

Concepts

TableOfFigures Object

Other resources

TableOfFigures Object Members


TableOfFigures.TabLeader Property (Word)

 Copy code hover
[image]

TableOfFigures.TabLeader Property (Word)
See also Send feedback

Returns or sets the character between entries and their page numbers in an table of figures. Read/write WdTabLeader.

Syntax

expression .TabLeader

expression Required. A variable that represents a TableOfFigures collection.

Example

This example formats the tables of firgures in Sales.doc to use a dotted tab leader.

VBA Copy code Copy code
For Each aTOF In Documents("Sales.doc").TablesOfFigures
 aTOF.TabLeader = wdTabLeaderDots
Next aTOF

See also

Concepts

TableOfFigures Object

Other resources

TableOfFigures Object Members


TableOfFigures.TableID Property (Word)

 Copy code hover
[image]

TableOfFigures.TableID Property (Word)
See also Send feedback

Returns or sets a one-letter identifier that is used to build a table of figures from TOC fields. Read/write String.

Syntax

expression .TableID

expression Required. A variable that represents a TableOfFigures collection.

Remarks

This property corresponds to the \f switch for a TOC field. For example, "T" builds a table of figures from TOC fields using the table identifier T.

Example

This example adds a table of figures at the beginning of the active document and then formats the table to compile "B" entries.

VBA Copy code Copy code
Set myRange = ActiveDocument.Range(Start:=0, End:=0)
Set myTOF = ActiveDocument.TablesOfFigures.Add(Range:=myRange)
With myTOF
 .UseFields = True
 .UseHeadingStyles = False
 .TableID = "B"
 .Caption = ""
End With

See also

Concepts

TableOfFigures Object

Other resources

TableOfFigures Object Members


TableOfFigures.UpperHeadingLevel Property (Word)

 Copy code hover
[image]

TableOfFigures.UpperHeadingLevel Property (Word)
See also Send feedback

Returns or sets the starting heading level for a table of figures. Read/write Long.

Syntax

expression .UpperHeadingLevel

expression Required. A variable that represents a TableOfFigures collection.

Remarks

This property corresponds to the starting value used with the \o switch for a Table of Contents (TOC) field. Use the LowerHeadingLevel property to set the ending heading level. For example, to set the TOC field syntax {TOC \o "1-3"}, set the LowerHeadingLevel property to 3 and the UpperHeadingLevel property to 1.

Example

This example formats the first table of table of figures in the active document to compile all headings that are formatted with either the Heading 8 or Heading 9 style.

VBA Copy code Copy code
If ActiveDocument.TablesOfFigures.Count >= 1 Then
 With ActiveDocument.TablesOfFigures(1)
 .UseHeadingStyles = True
 .UseFields = False
 .UpperHeadingLevel = 8
 .LowerHeadingLevel = 9
 End With
End If

See also

Concepts

TableOfFigures Object

Other resources

TableOfFigures Object Members


TableOfFigures.UseFields Property (Word)

 Copy code hover
[image]

TableOfFigures.UseFields Property (Word)
See also Send feedback

True if Table of Contents Entry (TC) fields are used to create a table of figures. Read/write Boolean.

Syntax

expression .UseFields

expression Required. A variable that represents a TableOfFigures collection.

Example

This example adds a table of figures after the selection and formats the table to compile entries with the "B" identifier.

VBA Copy code Copy code
Selection.Collapse Direction:=wdCollapseEnd
Set myTOF = ActiveDocument.TablesOfFigures _
 .Add(Range:=Selection.Range)
With myTOF
 .UseFields = True
 .TableId = "B"
 .Caption = ""
End With

See also

Concepts

TableOfFigures Object

Other resources

TableOfFigures Object Members


TableOfFigures.UseHeadingStyles Property (Word)

 Copy code hover
[image]

TableOfFigures.UseHeadingStyles Property (Word)
See also Send feedback

True if built-in heading styles are used to create a table of figures. Read/write Boolean.

Syntax

expression .UseHeadingStyles

expression Required. A variable that represents a TableOfFigures collection.

Example

This example adds a table of figures in place of the selection and then formats the table to compile entries from TC fields.

VBA Copy code Copy code
With ActiveDocument.TablesOfFigures.Add(Range:=Selection.Range)
 .UseHeadingStyles = False
 .UseFields = True
End With

See also

Concepts

TableOfFigures Object

Other resources

TableOfFigures Object Members


TableOfFigures.UseHyperlinks Property (Word)

 Copy code hover
[image]

TableOfFigures.UseHyperlinks Property (Word)
See also Send feedback

Returns or sets whether entries in a a table of figures should be formatted as hyperlinks when publishing to the Web. Read/write Boolean.

Syntax

expression .UseHyperlinks

expression Required. A variable that represents a TableOfFigures collection.

Example

This example formats the first table of figures in the document using hyperlinks.

VBA Copy code Copy code
ActiveDocument.TableOfFigures(1).UseHyperlinks = True

See also

Concepts

TableOfFigures Object

Other resources

TableOfFigures Object Members


TableOfFigures Methods (Word)

 Copy code hover
[image]

TableOfFigures Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the specified table of figures.
Update | Updates the entries shown in a table of figures.
UpdatePageNumbers | Updates the page numbers for items in a table of figures.


TableOfFigures.Delete Method (Word)

 Copy code hover
[image]

TableOfFigures.Delete Method (Word)
See also Send feedback

Deletes the specified table of figures.

Syntax

expression .Delete

expression Required. A variable that represents a TableOfFigures collection.

See also

Concepts

TableOfFigures Object

Other resources

TableOfFigures Object Members


TableOfFigures.Update Method (Word)

 Copy code hover
[image]

TableOfFigures.Update Method (Word)
See also Send feedback

Updates the entries shown in a table of figures.

Syntax

expression .Update

expression Required. A variable that represents a TableOfFigures collection.

Remarks

Use the UpdatePageNumbers method to update the page numbers of items in a table of figures.

Example

This example updates the first table of figures in the active document.

VBA Copy code Copy code
If ActiveDocument.TablesOfFigures.Count >= 1 Then
 ActiveDocument.TableOfFigures(1).Update
End If

See also

Concepts

TableOfFigures Object

Other resources

TableOfFigures Object Members


TableOfFigures.UpdatePageNumbers Method (Word)

 Copy code hover
[image]

TableOfFigures.UpdatePageNumbers Method (Word)
See also Send feedback

Updates the page numbers for items in a table of figures.

Syntax

expression .UpdatePageNumbers

expression Required. A variable that represents a TableOfFigures collection.

Example

This example updates all tables of figures in Sales.doc.

VBA Copy code Copy code
Dim tofLoop As TableOfFigures

For Each tofLoop In Documents("Sales.doc").TablesOfFigures
 tofLoop.UpdatePageNumbers
Next tofLoop

See also

Concepts

TableOfFigures Object

Other resources

TableOfFigures Object Members


Tables Object (Word)

 Copy code hover
[image]

Tables Object (Word)
See also Send feedback

A collection of Table objects that represent the tables in a selection, range, or document.

Remarks

Use the Tables property to return the Tables collection. The following example applies a border around each of the tables in the active document.

VBA Copy code Copy code
For Each aTable In ActiveDocument.Tables
 aTable.Borders.OutsideLineStyle = wdLineStyleSingle
 aTable.Borders.OutsideLineWidth = wdLineWidth025pt
 aTable.Borders.InsideLineStyle = wdLineStyleNone
Next aTable

Use the Add method to add a table at the specified range. The following example adds a 3x4 table at the beginning of the active document.

VBA Copy code Copy code
Set myRange = ActiveDocument.Range(Start:=0, End:=0)
ActiveDocument.Tables.Add Range:=myRange, NumRows:=3, NumColumns:=4

Use Tables(Index), where Index is the index number, to return a single Table object. The index number represents the position of the table in the selection, range, or document. The following example converts the first table in the active document to text.

VBA Copy code Copy code
ActiveDocument.Tables(1).ConvertToText Separator:=wdSeparateByTabs

The Count property for this collection in a document returns the number of items in the main story only. To count items in other stories use the collection with the Range object.

See also

Concepts

Word Object Model Reference

Other resources

Tables Object Members


Tables Members (Word)

 Copy code hover
[image]

Tables Members (Word)
Send feedback

A collection of Table objects that represent the tables in a selection, range, or document.

Methods

Name | Description
Add | Returns a Table object that represents a new, blank table added to a document.
Item | Returns an individual Table object in a collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of tables in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
NestingLevel | Returns the nesting level of the specified tables. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified Tables object.


Tables Properties (Word)

 Copy code hover
[image]

Tables Properties (Word)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of tables in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
NestingLevel | Returns the nesting level of the specified tables. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified Tables object.


Tables.Application Property (Word)

 Copy code hover
[image]

Tables.Application Property (Word)
See also Send feedback

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a Tables collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

Tables Collection Object

Other resources

Tables Object Members


Tables.Count Property (Word)

 Copy code hover
[image]

Tables.Count Property (Word)
See also Send feedback

Returns a Long that represents the number of tables in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents a Tables collection.

See also

Concepts

Tables Collection Object

Other resources

Tables Object Members


Tables.Creator Property (Word)

 Copy code hover
[image]

Tables.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a Tables collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Tables Collection Object

Other resources

Tables Object Members


Tables.NestingLevel Property (Word)

 Copy code hover
[image]

Tables.NestingLevel Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the nesting level of the specified tables. Read-only Long.

Syntax

expression .NestingLevel

expression Required. A variable that represents a Tables collection.

Remarks

The outermost table has a nesting level of 1. The nesting level of each successively nested table is one higher than the previous table.

See also

Concepts

Tables Collection Object

Other resources

Tables Object Members


Tables.Parent Property (Word)

 Copy code hover
[image]

Tables.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Tables object.

Syntax

expression .Parent

expression Required. A variable that represents a Tables collection.

See also

Concepts

Tables Collection Object

Other resources

Tables Object Members


Tables Methods (Word)

 Copy code hover
[image]

Tables Methods (Word)
Send feedback

This object has the following methods:

Methods

Name | Description
Add | Returns a Table object that represents a new, blank table added to a document.
Item | Returns an individual Table object in a collection.


Tables.Add Method (Word)

 Copy code hover
[image]

Tables.Add Method (Word)
See also Send feedback

Returns a Table object that represents a new, blank table added to a document.

Syntax

expression .Add(Range, NumRows, NumColumns, DefaultTableBehavior, AutoFitBehavior)

expression Required. A variable that represents a Tables collection.

Parameters

Name | Required/Optional | Data Type | Description
Range | Required | Range object | The range where you want the table to appear. The table replaces the range, if the range isn't collapsed.
NumRows | Required | Long | The number of rows you want to include in the table.
NumColumns | Required | Long | The number of columns you want to include in the table.
DefaultTableBehavior | Optional | Variant | Sets a value that specifies whether Microsoft Word automatically resizes cells in tables to fit the cells' contents (AutoFit). Can be either of the following constants: wdWord8TableBehavior (AutoFit disabled) or wdWord9TableBehavior (AutoFit enabled). The default constant is wdWord8TableBehavior.
AutoFitBehavior | Optional | Variant | Sets the AutoFit rules for how Word sizes tables. Can be one of the WdAutoFitBehavior constants.

Return Value

Table

Example

This example adds a blank table with three rows and four columns at the beginning of the active document.

VBA Copy code Copy code
Set myRange = ActiveDocument.Range(0, 0)
ActiveDocument.Tables.Add Range:=myRange, NumRows:=3, NumColumns:=4

This example adds a new, blank table with six rows and ten columns at the end of the active document

VBA Copy code Copy code
Set MyRange = ActiveDocument.Content
MyRange.Collapse Direction:=wdCollapseEnd
ActiveDocument.Tables.Add Range:=MyRange, NumRows:=6, _
 NumColumns:=10

This example adds a table with three rows and five columns to a new document and then inserts data into each cell in the table.

VBA Copy code Copy code
Sub NewTable()
 Dim docNew As Document
 Dim tblNew As Table
 Dim intX As Integer
 Dim intY As Integer

 Set docNew = Documents.Add
 Set tblNew = docNew.Tables.Add(Selection.Range, 3, 5)
 With tblNew
 For intX = 1 To 3
 For intY = 1 To 5
 .Cell(intX, intY).Range.InsertAfter "Cell: R" & intX & ", C" & intY
 Next intY
 Next intX
 .Columns.AutoFit
 End With
End Sub

See also

Concepts

Tables Collection Object

Other resources

Tables Object Members


Tables.Item Method (Word)

 Copy code hover
[image]

Tables.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual Table object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents a Tables collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The individual object to be returned. Can be a Long indicating the ordinal position of the individual object.

Return Value

Table

See also

Concepts

Tables Collection Object

Other resources

Tables Object Members


TablesOfAuthorities Object (Word)

 Copy code hover
[image]

TablesOfAuthorities Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of TableOfAuthorities objects (TOA fields) that represents the tables of authorities in a document.

Remarks

Use the TablesOfAuthorities property to return the TablesOfAuthorities collection. The following example applies the Classic built-in format to all the tables of authorities in the active document.

VBA Copy code Copy code
ActiveDocument.TablesOfAuthorities.Format = wdTOAClassic

Use the Add method to add a table of authorities to a document. A table of authorities is built from TA (Table of Authorities Entry) fields in a document. The following example adds a table of authorities that includes all categories at the beginning of the active document.

VBA Copy code Copy code
Set myRange = ActiveDocument.Range(Start:=0, End:=0)
ActiveDocument.TablesOfAuthorities.Add Range:=myRange, _
 Passim:=True, Category:=0, EntrySeparator:= ", "

Use TablesOfAuthorities(Index), where Index is the index number, to return a single TableOfAuthorities object. The index number represents the position of the table of authorities in the document. The following example includes category headers in the first table of authorities in the active document and then updates the table.

VBA Copy code Copy code
With ActiveDocument.TablesOfAuthorities(1)
 .IncludeCategoryHeader = True
 .Update
End With

See also

Concepts

Word Object Model Reference

Other resources

TablesOfAuthorities Object Members


TablesOfAuthorities Members (Word)

 Copy code hover
[image]

TablesOfAuthorities Members (Word)
Send feedback

Published: July 16, 2012

A collection of TableOfAuthorities objects (TOA fields) that represents the tables of authorities in a document.

Methods

Name | Description
Add | Returns a TableOfAuthorities object that represents a table of authorities added to a document.
Item | Returns an individual TableOfAuthorities object in a collection.
MarkAllCitations | Inserts a TA (Table of Authorities Entry) field after all instances of the ShortCitation text.
MarkCitation | Inserts a TA (Table of Authorities Entry) field and returns the field as a Field object.
NextCitation | Finds and selects the next instance of the text specified by the ShortCitation parameter.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of tables of authorities in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Format | Returns or sets the formatting for the tables of authorities in the specified document. Read/write WdToaFormat.
Parent | Returns an Object that represents the parent object of the specified TablesOfAuthorities object.


TablesOfAuthorities Properties (Word)

 Copy code hover
[image]

TablesOfAuthorities Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of tables of authorities in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Format | Returns or sets the formatting for the tables of authorities in the specified document. Read/write WdToaFormat.
Parent | Returns an Object that represents the parent object of the specified TablesOfAuthorities object.


TablesOfAuthorities.Application Property (Word)

 Copy code hover
[image]

TablesOfAuthorities.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a TablesOfAuthorities collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

TablesOfAuthorities Collection Object

Other resources

TablesOfAuthorities Object Members


TablesOfAuthorities.Count Property (Word)

 Copy code hover
[image]

TablesOfAuthorities.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of tables of authorities in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents a TablesOfAuthorities collection.

See also

Concepts

TablesOfAuthorities Collection Object

Other resources

TablesOfAuthorities Object Members


TablesOfAuthorities.Creator Property (Word)

 Copy code hover
[image]

TablesOfAuthorities.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a TablesOfAuthorities collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

TablesOfAuthorities Collection Object

Other resources

TablesOfAuthorities Object Members


TablesOfAuthorities.Format Property (Word)

 Copy code hover
[image]

TablesOfAuthorities.Format Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the formatting for the tables of authorities in the specified document. Read/write WdToaFormat.

Syntax

expression .Format

expression Required. A variable that represents a TablesOfAuthorities collection.

See also

Concepts

TablesOfAuthorities Collection Object

Other resources

TablesOfAuthorities Object Members


TablesOfAuthorities.Parent Property (Word)

 Copy code hover
[image]

TablesOfAuthorities.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified TablesOfAuthorities object.

Syntax

expression .Parent

expression Required. A variable that represents a TablesOfAuthorities collection.

See also

Concepts

TablesOfAuthorities Collection Object

Other resources

TablesOfAuthorities Object Members


TablesOfAuthorities Methods (Word)

 Copy code hover
[image]

TablesOfAuthorities Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Returns a TableOfAuthorities object that represents a table of authorities added to a document.
Item | Returns an individual TableOfAuthorities object in a collection.
MarkAllCitations | Inserts a TA (Table of Authorities Entry) field after all instances of the ShortCitation text.
MarkCitation | Inserts a TA (Table of Authorities Entry) field and returns the field as a Field object.
NextCitation | Finds and selects the next instance of the text specified by the ShortCitation parameter.


TablesOfAuthorities.Add Method (Word)

 Copy code hover
[image]

TablesOfAuthorities.Add Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a TableOfAuthorities object that represents a table of authorities added to a document.

Syntax

expression .Add(Range, Category, Bookmark, Passim, KeepEntryFormatting, Separator, IncludeSequenceName, EntrySeparator, PageRangeSeparator, IncludeCategoryHeader, PageNumberSeparator)

expression Required. A variable that represents a TablesOfAuthorities collection.

Parameters

Name | Required/Optional | Data Type | Description
Range | Required | Range object | The range where you want the table of authorities to appear. The table of authorities replaces the range, if the range isn't collapsed.
Category | Optional | Variant | The category of entries you want to include in the table of authorities. Corresponds to the \c switch for a Table of Authorities (TOA) field. Values 0 through 16 correspond to the items listed in the Category box on the Table of Authorities tab in the Index and Tables dialog box (Reference command, Insert menu). The default value is 1.
Bookmark | Optional | Variant | The string name of the bookmark from which you want to collect entries for the table of authorities. If Bookmark is specified, the entries are collected only from the portion of the document marked by the bookmark. Corresponds to the \b switch for a Table of Authorities (TOA) field.
Passim | Optional | Variant | True to replace five or more page references to the same authority with Passim in the table of authorities. Corresponds to the \p switch for a Table of Authorities (TOA) field. If this argument is omitted, Passim is assumed to be False.
KeepEntryFormatting | Optional | Variant | True to apply formatting from table of authorities entries to the entries in the table of authorities. Corresponds to the \f switch for a Table of Authorities (TOA) field. If this argument is omitted, KeepEntryFormatting is assumed to be True.
Separator | Optional | Variant | The characters (up to five) between each sequence number and its page number in the table of authorities. Corresponds to the \d switch for a Table of Authorities (TOA) field. If argument is omitted, a hyphen (-) is used.
IncludeSequenceName | Optional | Variant | A string that specifies the Sequence (SEQ) field identifier for the table of authorities. Corresponds to the \s switch for a Table of Authorities (TOA) field.
EntrySeparator | Optional | Variant | The characters (up to five) that separate each entry and its page number in the table of authorities. Corresponds to the \e switch for a Table of Authorities (TOA) field. If this argument is omitted, no separator is used.
PageRangeSeparator | Optional | Variant | The characters (up to five) that separate the beginning and ending page numbers in each page range the table of authorities. Corresponds to the \g switch for a Table of Authorities (TOA) field. If this argument is omitted, an en dash is used.
IncludeCategoryHeader | Optional | Variant | True to have the category name for each group of entries appear in the table of authorities (for example, Cases). Corresponds to the \h switch for a Table of Authorities (TOA) field. If this argument is omitted, IncludeCategoryHeader is assumed to be True.
PageNumberSeparator | Optional | Variant | The characters (up to five) that separate individual page numbers within page references in the table of authorities. Corresponds to the \l switch for a Table of Authorities (TOA) field. If this argument is omitted, a comma and a space are used.

Return Value

TableOfAuthorities

Remarks

A table of authorities is built from Table of Authorities Entry (TA) fields in a document. Use the MarkCitation method to mark citations to be included in the table of authorities.

Example

This example adds, at the beginning of the active document, a table of authorities that includes all categories.

VBA Copy code Copy code
Set myRange = ActiveDocument.Range(0, 0)
ActiveDocument.TablesOfAuthorities.Add Range:=myRange, _
 Passim:= True, Category:= 0, EntrySeparator:= ", "

See also

Concepts

TablesOfAuthorities Collection Object

Other resources

TablesOfAuthorities Object Members


TablesOfAuthorities.Item Method (Word)

 Copy code hover
[image]

TablesOfAuthorities.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual TableOfAuthorities object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents a TablesOfAuthorities collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The individual object to be returned. Can be a Long indicating the ordinal position of the individual object.

Return Value

TableOfAuthorities

See also

Concepts

TablesOfAuthorities Collection Object

Other resources

TablesOfAuthorities Object Members


TablesOfAuthorities.MarkAllCitations Method (Word)

 Copy code hover
[image]

TablesOfAuthorities.MarkAllCitations Method (Word)
See also Send feedback

Published: July 16, 2012

Inserts a TA (Table of Authorities Entry) field after all instances of the ShortCitation text.

Syntax

expression .MarkAllCitations(ShortCitation, LongCitation, LongCitationAutoText, Category)

expression Required. A variable that represents a TablesOfAuthorities collection.

Parameters

Name | Required/Optional | Data Type | Description
ShortCitation | Required | String | The short citation for the entry as it will appear in the Mark Citation dialog box (Insert menu, Index and Tables command).
LongCitation | Optional | Variant | The long citation string for the entry as it will appear in the table of authorities.
LongCitationAutoText | Optional | Variant | The AutoText entry name that contains the text of the long citation as it will appear in the table of authorities.
Category | Optional | Variant | The category number to be associated with the entry: 1 corresponds to the first category in the Category box in the Mark Citation dialog box, 2 corresponds to the second category, and so on.

Example

This example marks all instances of "Forrester v. Craddock" in the active document with a TA field that references the "Forrester v. Craddock, 51 Wn. 2d 315 (1957)" citation.

VBA Copy code Copy code
ActiveDocument.TablesOfAuthorities.MarkAllCitations _
 ShortCitation:="Forrester v. Craddock", Category:=1, _
 LongCitation:="Forrester v. Craddock, 51 Wn. 2d 315 (1957)"

See also

Concepts

TablesOfAuthorities Collection Object

Other resources

TablesOfAuthorities Object Members


TablesOfAuthorities.MarkCitation Method (Word)

 Copy code hover
[image]

TablesOfAuthorities.MarkCitation Method (Word)
See also Send feedback

Published: July 16, 2012

Inserts a TA (Table of Authorities Entry) field and returns the field as a Field object.

Syntax

expression .MarkCitation(Range, ShortCitation, LongCitation, LongCitationAutoText, Category)

expression Required. A variable that represents a TablesOfAuthorities collection.

Parameters

Name | Required/Optional | Data Type | Description
Range | Required | Range | The location of the table of authorities entry. The TA field is inserted after Range.
ShortCitation | Required | String | The short citation for the entry as it will appear in the Mark Citation dialog box (Insert menu, Index and Tables command).
LongCitation | Optional | Variant | The long citation for the entry as it will appear in the table of authorities.
LongCitationAutoText | Optional | Variant | The name of the AutoText entry that contains the text of the long citation as it will appear in the table of authorities.
Category | Optional | Variant | The category number to be associated with the entry: 1 corresponds to the first category in the Category box in the Mark Citation dialog box, 2 corresponds to the second category, and so on.

Example

This example inserts a table of authorities entry (a TA field) that references the selected text. The long citation text is set to "Forrester v. Craddock" and the category is set to Cases.

VBA Copy code Copy code
ActiveDocument.TablesOfAuthorities.MarkCitation _
 Range:=Selection.Range, ShortCitation:=Selection.Range.Text, _
 LongCitation:="Forrester v. Craddock", Category:=1

This example inserts a table of authorities entry that references the selected text. The entry text that appears in the table of authorities is the text typed into the input box and the category is set to Other Authorities.

VBA Copy code Copy code
Dim strCitation As String

strCitation = InputBox("Type citation text")
ActiveDocument.TablesOfAuthorities.MarkCitation _
 Range:=Selection.Range, ShortCitation:=Selection.Range.Text, _
 LongCitation:=strCitation, Category:=3

See also

Concepts

TablesOfAuthorities Collection Object

Other resources

TablesOfAuthorities Object Members


TablesOfAuthorities.NextCitation Method (Word)

 Copy code hover
[image]

TablesOfAuthorities.NextCitation Method (Word)
See also Send feedback

Published: July 16, 2012

Finds and selects the next instance of the text specified by the ShortCitation parameter.

Syntax

expression .NextCitation(ShortCitation)

expression Required. A variable that represents a TablesOfAuthorities collection.

Parameters

Name | Required/Optional | Data Type | Description
ShortCitation | Required | String | The text of the short citation.

Example

This example selects the next citation in the active document that begins with "in re".

VBA Copy code Copy code
ActiveDocument.TablesOfAuthorities.NextCitation _
 ShortCitation:="in re"

See also

Concepts

TablesOfAuthorities Collection Object

Other resources

TablesOfAuthorities Object Members


TablesOfAuthoritiesCategories Object (Word)

 Copy code hover
[image]

TablesOfAuthoritiesCategories Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of TableOfAuthoritiesCategory objects that represent the table of authorities categories, such as Cases and Statutes. The TablesOfAuthoritiesCategories collection includes all 16 categories listed in the Category box on the Table of Authorities tab in the Index and Tables dialog box.

Remarks

Use the TablesOfAuthoritiesCategories property to return the TablesOfAuthoritiesCategories collection. The following example displays the names of the categories in the TablesOfAuthoritiesCategories collection.

VBA Copy code Copy code
For Each aCat In ActiveDocument.TablesOfAuthoritiesCategories
 response = MsgBox(Prompt:=aCat, Buttons:=vbOKCancel)
 If response = vbCancel Then Exit For
Next aCat

The Add method isn't available for the TablesOfAuthoritiesCategories collection. The collection is limited to 16 items; however, you can use the Name property to rename an existing category.

Use TablesOfAuthoritiesCategories(Index), where Index is the category name or index number, to return a single TableOfAuthoritiesCategory object. The following example renames the Rules category as Other Provisions.

VBA Copy code Copy code
ActiveDocument.TablesOfAuthoritiesCategories("Rules").Name = _
 "Other Provisions"

The index number represents the position of the category in the Index and Tables dialog box. The following example displays the name of the first category in the TablesOfAuthoritiesCategories collection.

VBA Copy code Copy code
MsgBox ActiveDocument.TablesOfAuthoritiesCategories(1).Name

See also

Concepts

Word Object Model Reference

Other resources

TablesOfAuthoritiesCategories Object Members


TablesOfAuthoritiesCategories Members (Word)

 Copy code hover
[image]

TablesOfAuthoritiesCategories Members (Word)
Send feedback

A collection of TableOfAuthoritiesCategory objects that represent the table of authorities categories, such as Cases and Statutes. The TablesOfAuthoritiesCategories collection includes all 16 categories listed in the Category box on the Table of Authorities tab in the Index and Tables dialog box.

Methods

Name | Description
Item | Returns an individual TablesOfAuthoritiesCategory object in a collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of categories in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified TablesOfAuthoritiesCategories object.


TablesOfAuthoritiesCategories Properties (Word)

 Copy code hover
[image]

TablesOfAuthoritiesCategories Properties (Word)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of categories in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified TablesOfAuthoritiesCategories object.


TablesOfAuthoritiesCategories.Application Property (Word)

 Copy code hover
[image]

TablesOfAuthoritiesCategories.Application Property (Word)
See also Send feedback

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a TablesOfAuthoritiesCategories collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

TablesOfAuthoritiesCategories Collection Object

Other resources

TablesOfAuthoritiesCategories Object Members


TablesOfAuthoritiesCategories.Count Property (Word)

 Copy code hover
[image]

TablesOfAuthoritiesCategories.Count Property (Word)
See also Send feedback

Returns a Long that represents the number of categories in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents a TablesOfAuthoritiesCategories collection.

See also

Concepts

TablesOfAuthoritiesCategories Collection Object

Other resources

TablesOfAuthoritiesCategories Object Members


TablesOfAuthoritiesCategories.Creator Property (Word)

 Copy code hover
[image]

TablesOfAuthoritiesCategories.Creator Property (Word)
See also Send feedback

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a TablesOfAuthoritiesCategories collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

TablesOfAuthoritiesCategories Collection Object

Other resources

TablesOfAuthoritiesCategories Object Members


TablesOfAuthoritiesCategories.Parent Property (Word)

 Copy code hover
[image]

TablesOfAuthoritiesCategories.Parent Property (Word)
See also Send feedback

Returns an Object that represents the parent object of the specified TablesOfAuthoritiesCategories object.

Syntax

expression .Parent

expression Required. A variable that represents a TablesOfAuthoritiesCategories collection.

See also

Concepts

TablesOfAuthoritiesCategories Collection Object

Other resources

TablesOfAuthoritiesCategories Object Members


TablesOfAuthoritiesCategories Methods (Word)

 Copy code hover
[image]

TablesOfAuthoritiesCategories Methods (Word)
Send feedback

This object has the following methods:

Methods

Name | Description
Item | Returns an individual TablesOfAuthoritiesCategory object in a collection.


TablesOfAuthoritiesCategories.Item Method (Word)

 Copy code hover
[image]

TablesOfAuthoritiesCategories.Item Method (Word)
See also Send feedback

Returns an individual TablesOfAuthoritiesCategory object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents a TablesOfAuthoritiesCategories collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The individual object to be returned. Can be a Long indicating the ordinal position or a String representing the name of the individual object.

Return Value

TablesOfAuthoritiesCategory

See also

Concepts

TablesOfAuthoritiesCategories Collection Object

Other resources

TablesOfAuthoritiesCategories Object Members


TablesOfContents Object (Word)

 Copy code hover
[image]

TablesOfContents Object (Word)
See also Send feedback

A collection of TableOfContents objects that represent the tables of contents in a document.

Remarks

Use the TablesOfContents property to return the TablesOfContents collection. The following example inserts a table of contents entry that references the selected text in the active document.

VBA Copy code Copy code
ActiveDocument.TablesOfContents.MarkEntry Range:=Selection.Range, _
 Level:=2, Entry:="Introduction"

Use the Add method to add a table of contents to a document. The following example adds a table of contents at the beginning of the active document. The example builds the table of contents from all paragraphs styled as either Heading 1, Heading 2, or Heading 3.

VBA Copy code Copy code
Set myRange = ActiveDocument.Range(Start:=0, End:=0)
ActiveDocument.TablesOfContents.Add Range:=myRange, _
 UseFields:=False, UseHeadingStyles:=True, _
 LowerHeadingLevel:=3, _
 UpperHeadingLevel:=1

Use TablesOfContents(Index), where Index is the index number, to return a single TableOfContents object. The index number represents the position of the table of contents in the document. The following example updates the page numbers of the items in the first table of figures in the active document.

VBA Copy code Copy code
ActiveDocument.TablesOfContents(1).UpdatePageNumbers

See also

Concepts

Word Object Model Reference

Other resources

TablesOfContents Object Members


TablesOfContents Members (Word)

 Copy code hover
[image]

TablesOfContents Members (Word)
Send feedback

A collection of TableOfContents objects that represent the tables of contents in a document.

Methods

Name | Description
Add | Returns a TableOfContents object that represents a table of contents added to a document.
Item | Returns an individual TableOfContents object in a collection.
MarkEntry | Inserts a TC (Table of Contents Entry) field after the specified range. The method returns a Field object representing the TC field.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of tables of contents in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Format | Returns or sets the formatting for the tables of contents in the specified document. Read/write WdTocFormat.
Parent | Returns an Object that represents the parent object of the specified TablesOfContents object.


TablesOfContents Properties (Word)

 Copy code hover
[image]

TablesOfContents Properties (Word)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of tables of contents in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Format | Returns or sets the formatting for the tables of contents in the specified document. Read/write WdTocFormat.
Parent | Returns an Object that represents the parent object of the specified TablesOfContents object.


TablesOfContents.Application Property (Word)

 Copy code hover
[image]

TablesOfContents.Application Property (Word)
See also Send feedback

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a TablesOfContents collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

TablesOfContents Collection Object

Other resources

TablesOfContents Object Members


TablesOfContents.Count Property (Word)

 Copy code hover
[image]

TablesOfContents.Count Property (Word)
See also Send feedback

Returns a Long that represents the number of tables of contents in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents a TablesOfContents collection.

See also

Concepts

TablesOfContents Collection Object

Other resources

TablesOfContents Object Members


TablesOfContents.Creator Property (Word)

 Copy code hover
[image]

TablesOfContents.Creator Property (Word)
See also Send feedback

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a TablesOfContents collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

TablesOfContents Collection Object

Other resources

TablesOfContents Object Members


TablesOfContents.Format Property (Word)

 Copy code hover
[image]

TablesOfContents.Format Property (Word)
See also Send feedback

Returns or sets the formatting for the tables of contents in the specified document. Read/write WdTocFormat.

Syntax

expression .Format

expression Required. A variable that represents a TablesOfContents collection.

Example

This example applies Classic formatting to the tables of contents in Report.doc.

VBA Copy code Copy code
Documents("Report.doc").TablesOfContents.Format = wdTOCClassic

See also

Concepts

TablesOfContents Collection Object

Other resources

TablesOfContents Object Members


TablesOfContents.Parent Property (Word)

 Copy code hover
[image]

TablesOfContents.Parent Property (Word)
See also Send feedback

Returns an Object that represents the parent object of the specified TablesOfContents object.

Syntax

expression .Parent

expression Required. A variable that represents a TablesOfContents collection.

See also

Concepts

TablesOfContents Collection Object

Other resources

TablesOfContents Object Members


TablesOfContents Methods (Word)

 Copy code hover
[image]

TablesOfContents Methods (Word)
Send feedback

This object has the following methods:

Methods

Name | Description
Add | Returns a TableOfContents object that represents a table of contents added to a document.
Item | Returns an individual TableOfContents object in a collection.
MarkEntry | Inserts a TC (Table of Contents Entry) field after the specified range. The method returns a Field object representing the TC field.


TablesOfContents.Add Method (Word)

 Copy code hover
[image]

TablesOfContents.Add Method (Word)
See also Send feedback

Returns a TableOfContents object that represents a table of contents added to a document.

Syntax

expression .Add(Range, UseHeadingStyles, UpperHeadingLevel, LowerHeadingLevel, UseFields, TableID, RightAlignPageNumbers, IncludePageNumbers, AddedStyles, UseHyperlinks, HidePageNumbersInWeb, UseOutlineLevels)

expression Required. A variable that represents a TablesOfContents collection.

Parameters

Name | Required/Optional | Data Type | Description
Range | Required | Range object | The range where you want the table of contents to appear. The table of contents replaces the range, if the range isn't collapsed.
UseHeadingStyles | Optional | Variant | True to use built-in heading styles to create the table of contents. The default value is True.
UpperHeadingLevel | Optional | Variant | The starting heading level for the table of contents. Corresponds to the starting value used with the \o switch for a Table of Contents (TOC) field. The default value is 1.
LowerHeadingLevel | Optional | Variant | The ending heading level for the table of contents. Corresponds to the ending value used with the \o switch for a Table of Contents (TOC) field. The default value is 9.
UseFields | Optional | Variant | True if Table of Contents Entry (TC) fields are used to create the table of contents. Use the MarkEntry method to mark entries to be included in the table of contents. The default value is False.
TableID | Optional | Variant | A one-letter identifier that's used to build a table of contents from TC fields. Corresponds to the \f switch for a Table of Contents (TOC) field. For example, "T" builds a table of contents from TC fields using the table identifier T. If this argument is omitted, TC fields aren't used.
RightAlignPageNumbers | Optional | Variant | True if page numbers in the table of contents are aligned with the right margin. The default value is True.
IncludePageNumbers | Optional | Variant | True to include page numbers in the table of contents. The default value is True.
AddedStyles | Optional | Variant | The string name for additional styles used to compile the table of contents (styles other than the Heading 1 - Heading 9 styles). Use the Add method of a HeadingStyles object to create new heading styles.
UseHyperlinks | Optional | Variant | True if entries in a table of contents should be formatted as hyperlinks when the document is being publishing to the Web. The default value is True.
HidePageNumbersInWeb | Optional | Variant | True if page numbers in a table of contents should be hidden when the document is being publishing to the Web. The default value is True.
UseOutlineLevels | Optional | Variant | True to use outline levels to create the table of contents. The default is False.

Return Value

TableOfContents

Example

This example adds a table of contents at the beginning of the active document. The table of contents is built from paragraphs styled with the Heading 1, Heading 2, and Heading 3 styles or the custom styles myStyle and yourStyle.

VBA Copy code Copy code
Set myRange = ActiveDocument.Range(0, 0)
ActiveDocument.TablesOfContents.Add _
 Range:=myRange, _
 UseFields:=False, _
 UseHeadingStyles:=True, _
 LowerHeadingLevel:=3, _
 UpperHeadingLevel:=1, _
 AddedStyles:="myStyle, yourStyle"

See also

Concepts

TablesOfContents Collection Object

Other resources

TablesOfContents Object Members


TablesOfContents.Item Method (Word)

 Copy code hover
[image]

TablesOfContents.Item Method (Word)
See also Send feedback

Returns an individual TableOfContents object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents a TablesOfContents collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The individual object to be returned. Can be a Long indicating the ordinal position of the individual object.

Return Value

TableOfContents

See also

Concepts

TablesOfContents Collection Object

Other resources

TablesOfContents Object Members


TablesOfContents.MarkEntry Method (Word)

 Copy code hover
[image]

TablesOfContents.MarkEntry Method (Word)
See also Send feedback

Inserts a TC (Table of Contents Entry) field after the specified range. The method returns a Field object representing the TC field.

Syntax

expression .MarkEntry(Range, Entry, EntryAutoText, TableID, Level)

expression Required. A variable that represents a TablesOfContents collection.

Parameters

Name | Required/Optional | Data Type | Description
Range | Required | Range | The location of the entry. The TC field is inserted after Range.
Entry | Optional | Variant | The text that appears in the table of contents or table of figures. To indicate a subentry, include the main entry text and the subentry text, separated by a colon (:) (for example, "Introduction:The Product").
EntryAutoText | Optional | Variant | The AutoText entry name that includes text for the index, table of figures, or table of contents (Entry is ignored).
TableID | Optional | Variant | A one-letter identifier for the table of figures or table of contents item (for example, "i" for an "illustration").
Level | Optional | Variant | A level for the entry in the table of contents or table of figures.

Return Value

Field

See also

Concepts

TablesOfContents Collection Object

Other resources

TablesOfContents Object Members


TablesOfFigures Object (Word)

 Copy code hover
[image]

TablesOfFigures Object (Word)
See also Send feedback

A collection of TableOfFigures objects that represent the tables of figures in a document.

Remarks

Use the TablesOfFigures property to return the TablesOfFigures collection. The following example applies the Classic format to all tables of figures in the active document.

VBA Copy code Copy code
ActiveDocument.TablesOfFigures.Format = wdTOFClassic

Use the Add method to add a table of figures to a document. A table of figures lists figure captions in the order in which they appear in the document. The following example replaces the selection in the active document with a table of figures that includes caption labels and page numbers.

VBA Copy code Copy code
ActiveDocument.TablesOfFigures.Add Range:=Selection.Range, _
 IncludeLabel:=True, IncludePageNumbers:=True

Use TablesOfFigures(Index), where Index is the index number, to return a single TableOfFigures object. The index number represents the position of the table of figures in the document. The following example updates the page numbers of the items in the first table of figures in the active document.

VBA Copy code Copy code
ActiveDocument.TablesOfFigures(1).UpdatePageNumbers

See also

Concepts

Word Object Model Reference

Other resources

TablesOfFigures Object Members


TablesOfFigures Members (Word)

 Copy code hover
[image]

TablesOfFigures Members (Word)
Send feedback

A collection of TableOfFigures objects that represent the tables of figures in a document.

Methods

Name | Description
Add | Returns a TableOfFigures object that represents a table of figures added to a document.
Item | Returns an individual TableOfFigures object in a collection.
MarkEntry | Inserts a TC (Table of Contents Entry) field after the specified range. The method returns a Field object representing the TC field.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of tables of figures in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Format | Returns or sets the formatting for the tables of figures in the specified document. Read/write WdTofFormat.
Parent | Returns an Object that represents the parent object of the specified TablesOfFigures object.


TablesOfFigures Properties (Word)

 Copy code hover
[image]

TablesOfFigures Properties (Word)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of tables of figures in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Format | Returns or sets the formatting for the tables of figures in the specified document. Read/write WdTofFormat.
Parent | Returns an Object that represents the parent object of the specified TablesOfFigures object.


TablesOfFigures.Application Property (Word)

 Copy code hover
[image]

TablesOfFigures.Application Property (Word)
See also Send feedback

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a TablesOfFigures collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

TablesOfFigures Collection Object

Other resources

TablesOfFigures Object Members


TablesOfFigures.Count Property (Word)

 Copy code hover
[image]

TablesOfFigures.Count Property (Word)
See also Send feedback

Returns a Long that represents the number of tables of figures in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents a TablesOfFigures collection.

See also

Concepts

TablesOfFigures Collection Object

Other resources

TablesOfFigures Object Members


TablesOfFigures.Creator Property (Word)

 Copy code hover
[image]

TablesOfFigures.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a TablesOfFigures collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

TablesOfFigures Collection Object

Other resources

TablesOfFigures Object Members


TablesOfFigures.Format Property (Word)

 Copy code hover
[image]

TablesOfFigures.Format Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the formatting for the tables of figures in the specified document. Read/write WdTofFormat.

Syntax

expression .Format

expression Required. A variable that represents a TablesOfFigures collection.

See also

Concepts

TablesOfFigures Collection Object

Other resources

TablesOfFigures Object Members


TablesOfFigures.Parent Property (Word)

 Copy code hover
[image]

TablesOfFigures.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified TablesOfFigures object.

Syntax

expression .Parent

expression Required. A variable that represents a TablesOfFigures collection.

See also

Concepts

TablesOfFigures Collection Object

Other resources

TablesOfFigures Object Members


TablesOfFigures Methods (Word)

 Copy code hover
[image]

TablesOfFigures Methods (Word)
Send feedback

This object has the following methods:

Methods

Name | Description
Add | Returns a TableOfFigures object that represents a table of figures added to a document.
Item | Returns an individual TableOfFigures object in a collection.
MarkEntry | Inserts a TC (Table of Contents Entry) field after the specified range. The method returns a Field object representing the TC field.


TablesOfFigures.Add Method (Word)

 Copy code hover
[image]

TablesOfFigures.Add Method (Word)
See also Send feedback

Returns a TableOfFigures object that represents a table of figures added to a document.

Syntax

expression .Add(Range, Caption, IncludeLabel, UseHeadingStyles, UpperHeadingLevel, LowerHeadingLevel, UseFields, TableID, RightAlignPageNumbers, IncludePageNumbers, AddedStyles, UseHyperlinks, HidePageNumbersInWeb)

expression Required. A variable that represents a TablesOfFigures collection.

Parameters

Name | Required/Optional | Data Type | Description
Range | Required | Range object | The range where you want the table of figures to appear.
Caption | Optional | Variant | The label that identifies the items you want to include in the table of figures. Corresponds to the \c switch for a Table of Contents (TOC) field. The default value is "Figure."
IncludeLabel | Optional | Variant | True to include the caption label and caption number in the table of figures. The default value is True.
UseHeadingStyles | Optional | Variant | True to use built-in heading styles to create the table of figures. The default value is False.
UpperHeadingLevel | Optional | Variant | The starting heading level for the table of figures, if UseHeadingStyles is set to True. Corresponds to the starting value used with the \o switch for a Table of Contents (TOC) field. The default value is 1.
LowerHeadingLevel | Optional | Variant | The ending heading level for the table of figures, if UseHeadingStyles is set to True. Corresponds to the ending value used with the \o switch for a Table of Contents (TOC) field. The default value is 9.
UseFields | Optional | Variant | True to use Table of Contents Entry (TC) fields to create the table of figures. Use the MarkEntry method to mark entries you want to include in the table of figures. The default value is False.
TableID | Optional | Variant | A one-letter identifier that's used to build a table of figures from Table of Contents Entry (TC) fields. Corresponds to the \f switch for a Table of Contents (TOC) field. For example, "i" builds a table of figures for an illustration.
RightAlignPageNumbers | Optional | Variant | True align page numbers with the right margin in the table of figures. The default value is True.
IncludePageNumbers | Optional | Variant | True if page numbers are included in the table of figures. The default value is True.
AddedStyles | Optional | Variant | The string name for additional styles used to compile the table of figures (styles other than the Heading 1 - Heading 9 styles).
UseHyperlinks | Optional | Variant | True if entries in a table of figures should be formatted as hyperlinks when publishing to the Web. The default value is True.
HidePageNumbersInWeb | Optional | Variant | True if page numbers in a table of figures should be hidden when publishing to the Web. The default value is True.

Return Value

TableOfFigures

Example

This example inserts a table of figures in the active document.

VBA Copy code Copy code
ActiveDocument.TablesOfFigures.Add Range:=Selection.Range

See also

Concepts

TablesOfFigures Collection Object

Other resources

TablesOfFigures Object Members


TablesOfFigures.Item Method (Word)

 Copy code hover
[image]

TablesOfFigures.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual TableOfFigures object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents a TablesOfFigures collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The individual object to be returned. Can be a Long indicating the ordinal position of the individual object.

Return Value

TableOfFigures

See also

Concepts

TablesOfFigures Collection Object

Other resources

TablesOfFigures Object Members


TablesOfFigures.MarkEntry Method (Word)

 Copy code hover
[image]

TablesOfFigures.MarkEntry Method (Word)
See also Send feedback

Published: July 16, 2012

Inserts a TC (Table of Contents Entry) field after the specified range. The method returns a Field object representing the TC field.

Syntax

expression .MarkEntry(Range, Entry, EntryAutoText, TableID, Level)

expression Required. A variable that represents a TablesOfFigures collection.

Parameters

Name | Required/Optional | Data Type | Description
Range | Required | Range object | The location of the entry. The TC field is inserted after Range.
Entry | Optional | Variant | The text that appears in the table of contents or table of figures. To indicate a subentry, include the main entry text and the subentry text, separated by a colon (:) (for example, "Introduction:The Product").
EntryAutoText | Optional | Variant | The AutoText entry name that includes text for the index, table of figures, or table of contents (Entry is ignored).
TableID | Optional | Variant | A one-letter identifier for the table of figures or table of contents item (for example, "i" for an "illustration").
Level | Optional | Variant | A level for the entry in the table of contents or table of figures.

Return Value

Field

See also

Concepts

TablesOfFigures Collection Object

Other resources

TablesOfFigures Object Members


TableStyle Object (Word)

 Copy code hover
[image]

TableStyle Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a single style that can be applied to a table.

Remarks

Use the Table property of the Styles object to return a TableStyle object. Use the Borders property to apply borders to an entire table. Use the Condition method to apply borders or shading only to specified sections of a table. This example creates a new table style and formats the table with a surrounding border. Special borders and shading are applied to the first and last rows and the last column.

VBA Copy code Copy code
Sub NewTableStyle()
 Dim styTable As Style

 Set styTable = ActiveDocument.Styles.Add( _
 Name:="TableStyle 1", Type:=wdStyleTypeTable)

 With styTable.Table

 'Apply borders around table
 .Borders(wdBorderTop).LineStyle = wdLineStyleSingle
 .Borders(wdBorderBottom).LineStyle = wdLineStyleSingle
 .Borders(wdBorderLeft).LineStyle = wdLineStyleSingle
 .Borders(wdBorderRight).LineStyle = wdLineStyleSingle

 'Apply a double border to the heading row
 .Condition(wdFirstRow).Borders(wdBorderBottom) _
 .LineStyle = wdLineStyleDouble

 'Apply a double border to the last column
 .Condition(wdLastColumn).Borders(wdBorderLeft) _
 .LineStyle = wdLineStyleDouble

 'Apply shading to last row
 .Condition(wdLastRow).Shading _
 .BackgroundPatternColor = wdColorGray125

 End With

End Sub

See also

Concepts

Word Object Model Reference

Other resources

TableStyle Object Members


TableStyle Members (Word)

 Copy code hover
[image]

TableStyle Members (Word)
Send feedback

Published: July 16, 2012

Represents a single style that can be applied to a table.

Methods

Name | Description
Condition | Returns a ConditionalStyle object that represents special style formatting for a portion of a table.

Properties

Name | Description
Alignment | Returns or sets a WdRowAlignment constant that represents the alignment for the specified table style. Read/write.
AllowBreakAcrossPage | Sets or returns a Long indicating whether lines in the rows of tables formatted with a specified style break across pages. Read/write.
AllowPageBreaks | Allows Microsoft Word to break the specified table across pages. Read/write Boolean.
Application | Returns an Application object that represents the Microsoft Word application.
Borders | Returns a Borders collection that represents all the borders for the specified object.
BottomPadding | Returns or sets the amount of space (in points) to add below the contents of a single cell or all the cells in a table. Read/write Single.
ColumnStripe | Returns or sets a Long that represents the number of columns in the banding when a style specifies odd- or even-column banding. Read/write.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
LeftIndent | Returns or sets a Single that represents the left indent value (in points) for the rows in the specified table style. Read/write.
LeftPadding | Returns or sets the amount of space (in points) to add to the left of the contents of all the cells in a table. Read/write Single.
Parent | Returns an Object that represents the parent object of the specified TableStyle object.
RightPadding | Returns or sets the amount of space (in points) to add to the right of the contents of all the cells in a table. Read/write Single.
RowStripe | Returns or sets a Long that represents the number of rows to include in the banding when a style specifies odd- or even-row banding. Read/write.
Shading | Returns a Shading object that refers to the shading formatting for the specified table style.
Spacing | Returns or sets the spacing (in points) between the cells in a table style. Read/write Single.
TableDirection | Returns or sets the direction in which Microsoft Word orders cells in the specified table style. Read/write WdTableDirection.
TopPadding | Returns or sets the amount of space (in points) to add above the contents of all the cells in a table. Read/write Single.


TableStyle Properties (Word)

 Copy code hover
[image]

TableStyle Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Alignment | Returns or sets a WdRowAlignment constant that represents the alignment for the specified table style. Read/write.
AllowBreakAcrossPage | Sets or returns a Long indicating whether lines in the rows of tables formatted with a specified style break across pages. Read/write.
AllowPageBreaks | Allows Microsoft Word to break the specified table across pages. Read/write Boolean.
Application | Returns an Application object that represents the Microsoft Word application.
Borders | Returns a Borders collection that represents all the borders for the specified object.
BottomPadding | Returns or sets the amount of space (in points) to add below the contents of a single cell or all the cells in a table. Read/write Single.
ColumnStripe | Returns or sets a Long that represents the number of columns in the banding when a style specifies odd- or even-column banding. Read/write.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
LeftIndent | Returns or sets a Single that represents the left indent value (in points) for the rows in the specified table style. Read/write.
LeftPadding | Returns or sets the amount of space (in points) to add to the left of the contents of all the cells in a table. Read/write Single.
Parent | Returns an Object that represents the parent object of the specified TableStyle object.
RightPadding | Returns or sets the amount of space (in points) to add to the right of the contents of all the cells in a table. Read/write Single.
RowStripe | Returns or sets a Long that represents the number of rows to include in the banding when a style specifies odd- or even-row banding. Read/write.
Shading | Returns a Shading object that refers to the shading formatting for the specified table style.
Spacing | Returns or sets the spacing (in points) between the cells in a table style. Read/write Single.
TableDirection | Returns or sets the direction in which Microsoft Word orders cells in the specified table style. Read/write WdTableDirection.
TopPadding | Returns or sets the amount of space (in points) to add above the contents of all the cells in a table. Read/write Single.


TableStyle.Alignment Property (Word)

 Copy code hover
[image]

TableStyle.Alignment Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a WdRowAlignment constant that represents the alignment for the specified table style. Read/write.

Syntax

expression .Alignment

expression Required. A variable that represents a TableStyle object.

See also

Concepts

TableStyle Object

Other resources

TableStyle Object Members


TableStyle.AllowBreakAcrossPage Property (Word)

 Copy code hover
[image]

TableStyle.AllowBreakAcrossPage Property (Word)
See also Send feedback

Published: July 16, 2012

Sets or returns a Long indicating whether lines in the rows of tables formatted with a specified style break across pages. Read/write.

Syntax

expression .AllowBreakAcrossPage

expression A variable that represents a TableStyle object.

Remarks

True to break the lines in table rows across page breaks. False to keep the lines in a row of a table all on the same page. The default setting is True.

Example

This example formats rows in tables formatted with the "Table Grid" style to not break at page breaks.

VBA Copy code Copy code
Sub DontSplitRows()
 ActiveDocument.Styles("Table Grid") _
 .Table.AllowBreakAcrossPage = False
End Sub

See also

Concepts

TableStyle Object

Other resources

TableStyle Object Members


TableStyle.AllowPageBreaks Property (Word)

 Copy code hover
[image]

TableStyle.AllowPageBreaks Property (Word)
See also Send feedback

Published: July 16, 2012

Allows Microsoft Word to break the specified table across pages. Read/write Boolean.

Syntax

expression .AllowPageBreaks

expression Required. A variable that represents a TableStyle object.

See also

Concepts

TableStyle Object

Other resources

TableStyle Object Members


TableStyle.Application Property (Word)

 Copy code hover
[image]

TableStyle.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a TableStyle object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

TableStyle Object

Other resources

TableStyle Object Members


TableStyle.Borders Property (Word)

 Copy code hover
[image]

TableStyle.Borders Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Borders collection that represents all the borders for the specified object.

Syntax

expression .Borders

expression Required. A variable that represents a TableStyle object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

See also

Concepts

TableStyle Object

Other resources

TableStyle Object Members


TableStyle.BottomPadding Property (Word)

 Copy code hover
[image]

TableStyle.BottomPadding Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the amount of space (in points) to add below the contents of a single cell or all the cells in a table. Read/write Single.

Syntax

expression .BottomPadding

expression Required. A variable that represents a TableStyle object.

Remarks

The setting of the BottomPadding property for a single cell overrides the setting of the BottomPadding property for the entire table.

See also

Concepts

TableStyle Object

Other resources

TableStyle Object Members


TableStyle.ColumnStripe Property (Word)

 Copy code hover
[image]

TableStyle.ColumnStripe Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Long that represents the number of columns in the banding when a style specifies odd- or even-column banding. Read/write.

Syntax

expression .ColumnStripe

expression A variable that represents a TableStyle object.

Remarks

Use the Condition method to set odd- or even-column banding for a table style.

Example

This example creates and formats a new table style then applies the new style to a new table. The resulting style causes three columns every third column and two rows every second row to have 20% shading.

VBA Copy code Copy code
Sub NewTableStyle()
 Dim styTable As Style

 With ActiveDocument
 Set styTable = .Styles.Add(Name:="TableStyle 1", _
 Type:=wdStyleTypeTable)

 With .Styles("TableStyle 1").Table
 .Condition(wdEvenColumnBanding).Shading _
 .Texture = wdTexture20Percent
 .ColumnStripe = 3
 .Condition(wdEvenRowBanding).Shading _
 .Texture = wdTexture20Percent
 .RowStripe = 2
 End With

 With .Tables.Add(Range:=Selection.Range, NumRows:=15, _
 NumColumns:=15)
 .Style = ActiveDocument.Styles("TableStyle 1")
 End With
 End With

End Sub

See also

Concepts

TableStyle Object

Other resources

TableStyle Object Members


TableStyle.Creator Property (Word)

 Copy code hover
[image]

TableStyle.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a TableStyle object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

TableStyle Object

Other resources

TableStyle Object Members


TableStyle.LeftIndent Property (Word)

 Copy code hover
[image]

TableStyle.LeftIndent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Single that represents the left indent value (in points) for the rows in the specified table style. Read/write.

Syntax

expression .LeftIndent

expression A variable that represents a TableStyle object.

Example

This example sets the left indent of the first paragraph in the active document to 1 inch. The InchesToPoints method is used to convert inches to points.

VBA Copy code Copy code
ActiveDocument.Paragraphs(1).LeftIndent = InchesToPoints(1)

This example sets the left indent for all rows in the first table in the active document.

VBA Copy code Copy code
ActiveDocument.Tables(1).Rows.LeftIndent = InchesToPoints(1)

See also

Concepts

TableStyle Object

Other resources

TableStyle Object Members


TableStyle.LeftPadding Property (Word)

 Copy code hover
[image]

TableStyle.LeftPadding Property (Word)
See also Send feedback

Returns or sets the amount of space (in points) to add to the left of the contents of all the cells in a table. Read/write Single.

Syntax

expression .LeftPadding

expression Required. A variable that represents a TableStyle object.

Remarks

The setting of the LeftPadding property for a single cell overrides the setting of the LeftPadding property for the entire table.

Example

This example sets the left padding for the first table in the active document to 40 pixels.

VBA Copy code Copy code
ActiveDocument.Tables(1).LeftPadding = _
 PixelsToPoints(40, False)

See also

Concepts

TableStyle Object

Other resources

TableStyle Object Members


TableStyle.Parent Property (Word)

 Copy code hover
[image]

TableStyle.Parent Property (Word)
See also Send feedback

Returns an Object that represents the parent object of the specified TableStyle object.

Syntax

expression .Parent

expression Required. A variable that represents a TableStyle object.

See also

Concepts

TableStyle Object

Other resources

TableStyle Object Members


TableStyle.RightPadding Property (Word)

 Copy code hover
[image]

TableStyle.RightPadding Property (Word)
See also Send feedback

Returns or sets the amount of space (in points) to add to the right of the contents of all the cells in a table. Read/write Single.

Syntax

expression .RightPadding

expression Required. A variable that represents a TableStyle object.

Remarks

The setting of the RightPadding property for a single cell overrides the setting of the RightPadding property for the entire table.

See also

Concepts

TableStyle Object

Other resources

TableStyle Object Members


TableStyle.RowStripe Property (Word)

 Copy code hover
[image]

TableStyle.RowStripe Property (Word)
See also Send feedback

Returns or sets a Long that represents the number of rows to include in the banding when a style specifies odd- or even-row banding. Read/write.

Syntax

expression .RowStripe

expression A variable that represents a TableStyle object.

Remarks

Use the Condition method to set odd- or even-column banding for a table style.

Example

This example creates and formats a new table style then applies the new style to a new table. The resulting style causes three columns every third column and two rows every second row to have 20% shading.

VBA Copy code Copy code
Sub NewTableStyle()
 Dim styTable As Style

 With ActiveDocument
 Set styTable = .Styles.Add(Name:="TableStyle 1", _
 Type:=wdStyleTypeTable)

 With .Styles("TableStyle 1").Table
 .Condition(wdEvenColumnBanding).Shading _
 .Texture = wdTexture20Percent
 .ColumnStripe = 3
 .Condition(wdEvenRowBanding).Shading _
 .Texture = wdTexture20Percent
 .RowStripe = 2
 End With

 With .Tables.Add(Range:=Selection.Range, NumRows:=15, _
 NumColumns:=15)
 .Style = ActiveDocument.Styles("TableStyle 1")
 End With
 End With

End Sub

See also

Concepts

TableStyle Object

Other resources

TableStyle Object Members


TableStyle.Shading Property (Word)

 Copy code hover
[image]

TableStyle.Shading Property (Word)
See also Send feedback

Returns a Shading object that refers to the shading formatting for the specified table style.

Syntax

expression .Shading

expression Required. A variable that represents a TableStyle object.

See also

Concepts

TableStyle Object

Other resources

TableStyle Object Members


TableStyle.Spacing Property (Word)

 Copy code hover
[image]

TableStyle.Spacing Property (Word)
See also Send feedback

Returns or sets the spacing (in points) between the cells in a table style. Read/write Single.

Syntax

expression .Spacing

expression Required. A variable that represents a TableStyle object.

See also

Concepts

TableStyle Object

Other resources

TableStyle Object Members


TableStyle.TableDirection Property (Word)

 Copy code hover
[image]

TableStyle.TableDirection Property (Word)
See also Send feedback

Returns or sets the direction in which Microsoft Word orders cells in the specified table style. Read/write WdTableDirection.

Syntax

expression .TableDirection

expression Required. A variable that represents a TableStyle object.

Remarks

If the TableDirection property is set to wdTableDirectionLtr, the selected rows are arranged with the first column in the leftmost position. If the TableDirection property is set to wdTableDirectionRtl, the selected rows are arranged with the first column in the rightmost position.

See also

Concepts

TableStyle Object

Other resources

TableStyle Object Members


TableStyle.TopPadding Property (Word)

 Copy code hover
[image]

TableStyle.TopPadding Property (Word)
See also Send feedback

Returns or sets the amount of space (in points) to add above the contents of all the cells in a table. Read/write Single.

Syntax

expression .TopPadding

expression Required. A variable that represents a TableStyle object.

Remarks

The setting of the TopPadding property for a single cell overrides the setting of the TopPadding property for the entire table.

See also

Concepts

TableStyle Object

Other resources

TableStyle Object Members


TableStyle Methods (Word)

 Copy code hover
[image]

TableStyle Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Condition | Returns a ConditionalStyle object that represents special style formatting for a portion of a table.


TableStyle.Condition Method (Word)

 Copy code hover
[image]

TableStyle.Condition Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a ConditionalStyle object that represents special style formatting for a portion of a table.

Syntax

expression .Condition(ConditionCode)

expression Required. A variable that represents a TableStyle object.

Parameters

Name | Required/Optional | Data Type | Description
ConditionCode | Required | WdConditionCode | The are of the table to which to apply the formatting.

Example

This example selects the first table in the active document and adds a 20 percent shading to odd-numbered columns.

VBA Copy code Copy code
Sub TableStylesTest()
 With ActiveDocument

 'Select the table to which the conditional
 'formatting will apply
 .Tables(1).Select

 'Specify the conditional formatting
 .Styles("Table Grid").Table _
 .Condition(wdOddColumnBanding).Shading _
 .BackgroundPatternColor = wdColorGray20
 End With
End Sub

See also

Concepts

TableStyle Object

Other resources

TableStyle Object Members


TabStop Object (Word)

 Copy code hover
[image]

TabStop Object (Word)
See also Send feedback

Represents a single tab stop. The TabStop object is a member of the TabStops collection. The TabStops collection represents all the custom and default tab stops in a paragraph or group of paragraphs.

Remarks

Use TabStops(Index), where Index is the location of the tab stop (in points) or the index number, to return a single TabStop object. Tab stops are indexed numerically from left to right along the ruler. The following example removes the first custom tab stop from the selected paragraphs.

VBA Copy code Copy code
Selection.Paragraphs.TabStops(1).Clear

The following example adds a right-aligned tab stop positioned at 2 inches to the selected paragraphs.

VBA Copy code Copy code
Selection.Paragraphs.TabStops(InchesToPoints(2)) _
 .Alignment = wdAlignTabRight

Use the Add method to add a tab stop. The following example adds two tab stops to the selected paragraphs. The first tab stop is a left-aligned tab with a dotted tab leader positioned at 1 inch (72 points). The second tab stop is centered and is positioned at 2 inches.

VBA Copy code Copy code
With Selection.Paragraphs.TabStops
 .Add Position:=InchesToPoints(1), _
 Leader:=wdTabLeaderDots, Alignment:=wdAlignTabLeft
 .Add Position:=InchesToPoints(2), Alignment:=wdAlignTabCenter
End With

You can also add a tab stop by specifying a location with the TabStops property. The following example adds a right-aligned tab stop positioned at 2 inches to the selected paragraphs.

VBA Copy code Copy code
Selection.Paragraphs.TabStops(InchesToPoints(2)) _
 .Alignment = wdAlignTabRight
Note Note

Set the DefaultTabStop property to adjust the spacing of default tab stops.

See also

Concepts

Word Object Model Reference

Other resources

TabStop Object Members


TabStop Members (Word)

 Copy code hover
[image]

TabStop Members (Word)
Send feedback

Represents a single tab stop. The TabStop object is a member of the TabStops collection. The TabStops collection represents all the custom and default tab stops in a paragraph or group of paragraphs.

Methods

Name | Description
Clear | Removes the specified custom tab stop.

Properties

Name | Description
Alignment | Returns or sets a WdTabAlignment constant that represents the alignment for the specified tab stop. Read/write.
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
CustomTab | True if the specified tab stop is a custom tab stop. Read-only Boolean.
Leader | Returns or sets the leader for the specified TabStop object. Read/write WdTabLeader.
Next | Returns the next tabstop in the collection. Read-only.
Parent | Returns an Object that represents the parent object of the specified TabStop object.
Position | Returns or sets the position of a tab stop relative to the left margin. Read/write Single.
Previous | Returns the previous tab stop in the collection. Read-only.


TabStop Properties (Word)

 Copy code hover
[image]

TabStop Properties (Word)
Send feedback

This object has the following properties:

Properties

Name | Description
Alignment | Returns or sets a WdTabAlignment constant that represents the alignment for the specified tab stop. Read/write.
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
CustomTab | True if the specified tab stop is a custom tab stop. Read-only Boolean.
Leader | Returns or sets the leader for the specified TabStop object. Read/write WdTabLeader.
Next | Returns the next tabstop in the collection. Read-only.
Parent | Returns an Object that represents the parent object of the specified TabStop object.
Position | Returns or sets the position of a tab stop relative to the left margin. Read/write Single.
Previous | Returns the previous tab stop in the collection. Read-only.


TabStop.Alignment Property (Word)

 Copy code hover
[image]

TabStop.Alignment Property (Word)
See also Send feedback

Returns or sets a WdTabAlignment constant that represents the alignment for the specified tab stop. Read/write.

Syntax

expression .Alignment

expression Required. A variable that represents a TabStop object.

Example

This example centers the first tab stop in the first paragraph of the active document.

VBA Copy code Copy code
Sub CenterTabStop()
 ActiveDocument.Paragraphs(1).TabStops(1) _
 .Alignment = wdAlignTabCenter
End Sub

See also

Concepts

TabStop Object

Other resources

TabStop Object Members


TabStop.Application Property (Word)

 Copy code hover
[image]

TabStop.Application Property (Word)
See also Send feedback

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a TabStop object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

TabStop Object

Other resources

TabStop Object Members


TabStop.Creator Property (Word)

 Copy code hover
[image]

TabStop.Creator Property (Word)
See also Send feedback

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a TabStop object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

TabStop Object

Other resources

TabStop Object Members


TabStop.CustomTab Property (Word)

 Copy code hover
[image]

TabStop.CustomTab Property (Word)
See also Send feedback

True if the specified tab stop is a custom tab stop. Read-only Boolean.

Syntax

expression .CustomTab

expression A variable that represents a TabStop object.

Example

This example cycles through the collection of tab stops in the first paragraph in the active document, and left-aligns any custom tab stops that it finds.

VBA Copy code Copy code
Dim tsLoop As TabStop

For each tsLoop in ActiveDocument.Paragraphs(1).TabStops
 If tsLoop.CustomTab = True Then
 tsLoop.Alignment = wdAlignTabLeft
 End If
Next tsLoop

See also

Concepts

TabStop Object

Other resources

TabStop Object Members


TabStop.Leader Property (Word)

 Copy code hover
[image]

TabStop.Leader Property (Word)
See also Send feedback

Returns or sets the leader for the specified TabStop object. Read/write WdTabLeader.

Syntax

expression .Leader

expression Required. A variable that represents a TabStop object.

Example

This example changes the leader for all tab stops that have a leader to dashes for all the paragraphs in the active document.

VBA Copy code Copy code
Dim tsLoop As TabStop

For each tsLoop in ActiveDocument.Paragraphs.TabStops
 If tsLoop.Leader <> wdTabLeaderSpaces Then
 tsLoop.Leader = wdTabLeaderDashes
 End If
Next tsLoop

See also

Concepts

TabStop Object

Other resources

TabStop Object Members


TabStop.Next Property (Word)

 Copy code hover
[image]

TabStop.Next Property (Word)
See also Send feedback

Returns the next tabstop in the collection. Read-only.

Syntax

expression .Next

expression A variable that represents a TabStop object.

See also

Concepts

TabStop Object

Other resources

TabStop Object Members


TabStop.Parent Property (Word)

 Copy code hover
[image]

TabStop.Parent Property (Word)
See also Send feedback

Returns an Object that represents the parent object of the specified TabStop object.

Syntax

expression .Parent

expression Required. A variable that represents a TabStop object.

See also

Concepts

TabStop Object

Other resources

TabStop Object Members


TabStop.Position Property (Word)

 Copy code hover
[image]

TabStop.Position Property (Word)
See also Send feedback

Returns or sets the position of a tab stop relative to the left margin. Read/write Single.

Syntax

expression .Position

expression Required. A variable that represents a TabStop object.

Example

This example adds a right tab stop to the selected paragraphs 2 inches from the left margin. The position of the tab stop is then displayed in a message box.

VBA Copy code Copy code
With Selection.Paragraphs.TabStops
 .ClearAll
 .Add Position:=InchesToPoints(2), Alignment:=wdAlignTabRight
 MsgBox .Item(1).Position & " or " & _
 PointsToInches(.Item(1).Position) & " inches"
End With

See also

Concepts

TabStop Object

Other resources

TabStop Object Members


TabStop.Previous Property (Word)

 Copy code hover
[image]

TabStop.Previous Property (Word)
See also Send feedback

Returns the previous tab stop in the collection. Read-only.

Syntax

expression .Previous

expression A variable that represents a TabStop object.

See also

Concepts

TabStop Object

Other resources

TabStop Object Members


TabStop Methods (Word)

 Copy code hover
[image]

TabStop Methods (Word)
Send feedback

This object has the following methods:

Methods

Name | Description
Clear | Removes the specified custom tab stop.


TabStop.Clear Method (Word)

 Copy code hover
[image]

TabStop.Clear Method (Word)
See also Send feedback

Removes the specified custom tab stop.

Syntax

expression .Clear

expression Required. A variable that represents a TabStop object.

Example

This example clears the first custom tab in the first paragraph of the active document.

VBA Copy code Copy code
ActiveDocument.Paragraphs(1).TabStops(1).Clear

See also

Concepts

TabStop Object

Other resources

TabStop Object Members


TabStops Object (Word)

 Copy code hover
[image]

TabStops Object (Word)
See also Send feedback

A collection of TabStop objects that represent the custom and default tabs for a paragraph or group of paragraphs.

Remarks

Use the TabStops property to return the TabStops collection. The following example clears all the custom tab stops from the first paragraph in the active document.

VBA Copy code Copy code
ActiveDocument.Paragraphs(1).TabStops.ClearAll

The following example adds a tab stop positioned at 2.5 inches to the selected paragraphs and then displays the position of each item in the TabStops collection.

VBA Copy code Copy code
Selection.Paragraphs.TabStops.Add Position:=InchesToPoints(2.5)
For Each aTab In Selection.Paragraphs.TabStops
 MsgBox "Position = " _
 & PointsToInches(aTab.Position) & " inches"
Next aTab

Use the Add method to add a tab stop. The following example adds two tab stops to the selected paragraphs. The first tab stop is a left-aligned tab with a dotted tab leader positioned at 1 inch (72 points). The second tab stop is centered and is positioned at 2 inches.

VBA Copy code Copy code
With Selection.Paragraphs.TabStops
 .Add Position:=InchesToPoints(1), _
 Leader:=wdTabLeaderDots, Alignment:=wdAlignTabLeft
 .Add Position:=InchesToPoints(2), Alignment:=wdAlignTabCenter
End With

You can also add a tab stop by specifying a location with the TabStops property. The following example adds a right-aligned tab stop positioned at 2 inches to the selected paragraphs.

VBA Copy code Copy code
Selection.Paragraphs.TabStops(InchesToPoints(2)) _
 .Alignment = wdAlignTabRight

Use TabStops(Index), where Index is the location of the tab stop (in points) or the index number, to return a single TabStop object. Tab stops are indexed numerically from left to right along the ruler. The following example removes the first custom tab stop from the first paragraph in the active document.

VBA Copy code Copy code
ActiveDocument.Paragraphs(1).TabStops(1).Clear

The following example adds a right-aligned tab stop positioned at 2 inches to the selected paragraphs.

VBA Copy code Copy code
Selection.Paragraphs.TabStops(InchesToPoints(2)) _
 .Alignment = wdAlignTabRight

When working with the Paragraphs collection (or a range with several paragraphs), you must modify each paragraph in the collection individually if the tab stops aren't identical in all the paragraphs. The following example removes the tab positioned at 1 inch from every paragraph in the active document.

VBA Copy code Copy code
For Each para In ActiveDocument.Content.Paragraphs
 para.TabStops(InchesToPoints(1)).Clear
Next para

See also

Concepts

Word Object Model Reference

Other resources

TabStops Object Members


TabStops Members (Word)

 Copy code hover
[image]

TabStops Members (Word)
Send feedback

A collection of TabStop objects that represent the custom and default tabs for a paragraph or group of paragraphs.

Methods

Name | Description
Add | Returns a TabStop object that represents a custom tab stop added to a document.
After | Returns the next TabStop object to the right of Position.
Before | Returns the next TabStop object to the left of Position.
ClearAll | Clears all the custom tab stops from the specified paragraphs.
Item | Returns an individual TabStop object in a collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of tab stops in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified TabStops object.


TabStops Properties (Word)

 Copy code hover
[image]

TabStops Properties (Word)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of tab stops in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified TabStops object.


TabStops.Application Property (Word)

 Copy code hover
[image]

TabStops.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a TabStops collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

TabStops Collection Object

Other resources

TabStops Object Members


TabStops.Count Property (Word)

 Copy code hover
[image]

TabStops.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of tab stops in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents a TabStops collection.

See also

Concepts

TabStops Collection Object

Other resources

TabStops Object Members


TabStops.Creator Property (Word)

 Copy code hover
[image]

TabStops.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a TabStops collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

TabStops Collection Object

Other resources

TabStops Object Members


TabStops.Parent Property (Word)

 Copy code hover
[image]

TabStops.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified TabStops object.

Syntax

expression .Parent

expression Required. A variable that represents a TabStops collection.

See also

Concepts

TabStops Collection Object

Other resources

TabStops Object Members


TabStops Methods (Word)

 Copy code hover
[image]

TabStops Methods (Word)
Send feedback

This object has the following methods:

Methods

Name | Description
Add | Returns a TabStop object that represents a custom tab stop added to a document.
After | Returns the next TabStop object to the right of Position.
Before | Returns the next TabStop object to the left of Position.
ClearAll | Clears all the custom tab stops from the specified paragraphs.
Item | Returns an individual TabStop object in a collection.


TabStops.Add Method (Word)

 Copy code hover
[image]

TabStops.Add Method (Word)
See also Send feedback

Returns a TabStop object that represents a custom tab stop added to a document.

Syntax

expression .Add(Position, Alignment, Leader)

expression Required. A variable that represents a TabStops collection.

Parameters

Name | Required/Optional | Data Type | Description
Position | Required | Single | The position of the tab stop (in points) relative to the left margin.
Alignment | Optional | Variant | The alignment of the tab stop. Can be one of the WdTabAlignment constants.
Leader | Optional | Variant | The type of leader for the tab stop. Can be one of the WdTabLeader constants. If this argument is omitted, wdTabLeaderSpaces is used.

Return Value

TabStop

Example

This example adds a tab stop positioned at 2.5 inches (from the left edge of the page) to the selected paragraphs.

VBA Copy code Copy code
Selection.Paragraphs.TabStops.Add Position:=InchesToPoints(2.5)

This example adds two tab stops to the selected paragraphs. The first tab stop is a left aligned, has a dotted leader, and is positioned at 1 inch (72 points) from the left edge of the page. The second tab stop is centered and is positioned at 2 inches from the left edge.

VBA Copy code Copy code
With Selection.Paragraphs.TabStops
 .Add Position:=InchesToPoints(1), _
 Leader:=wdTabLeaderDots, _
 Alignment:=wdAlignTabLeft
 .Add Position:=InchesToPoints(2), _
 Alignment:=wdAlignTabCenter
End With

See also

Concepts

TabStops Collection Object

Other resources

TabStops Object Members


TabStops.After Method (Word)

 Copy code hover
[image]

TabStops.After Method (Word)
See also Send feedback

Returns the next TabStop object to the right of Position.

Syntax

expression .After(Position)

expression Required. A variable that represents a TabStops collection.

Parameters

Name | Required/Optional | Data Type | Description
Position | Required | Single | A location on the ruler, in points.

Example

This example changes the alignment of the first custom tab stop in the first paragraph in the active document that's more than 1 inch from the left margin.

VBA Copy code Copy code
Dim tabTemp as TabStop

Set tabTemp = ActiveDocument.Paragraphs(1).TabStops _
 .After(InchesToPoints(1))

tabTemp.Alignment = wdAlignTabCenter

See also

Concepts

TabStops Collection Object

Other resources

TabStops Object Members


TabStops.Before Method (Word)

 Copy code hover
[image]

TabStops.Before Method (Word)
See also Send feedback

Published: July 16, 2012

Returns the next TabStop object to the left of Position.

Syntax

expression .Before(Position)

expression Required. A variable that represents a TabStops collection.

Parameters

Name | Required/Optional | Data Type | Description
Position | Required | Single | A location on the ruler, in points.

Example

This example changes the alignment of the first custom tab stop in the first paragraph in the active document that's less than 2 inches from the left margin.

VBA Copy code Copy code
Dim tsTemp As TabStop

Set tsTemp = ActiveDocument.Paragraphs(1) _
 .TabStops.Before(InchesToPoints(2))
tsTemp.Alignment = wdAlignTabCenter

See also

Concepts

TabStops Collection Object

Other resources

TabStops Object Members


TabStops.ClearAll Method (Word)

 Copy code hover
[image]

TabStops.ClearAll Method (Word)
See also Send feedback

Published: July 16, 2012

Clears all the custom tab stops from the specified paragraphs.

Syntax

expression .ClearAll

expression Required. A variable that represents a TabStops collection.

Remarks

To clear an individual tab stop, use the Clear method of the TabStop object. The ClearAll method doesn't clear the default tab stops. To manipulate the default tab stops, use the DefaultTabStop property for the document.

Example

This example clears all the custom tab stops in the active document.

VBA Copy code Copy code
ActiveDocument.Paragraphs.TabStops.ClearAll

See also

Concepts

TabStops Collection Object

Other resources

TabStops Object Members


TabStops.Item Method (Word)

 Copy code hover
[image]

TabStops.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual TabStop object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents a TabStops collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The individual object to be returned. Can be a Long indicating the ordinal position or a String representing the name of the individual object.

Return Value

TabStop

See also

Concepts

TabStops Collection Object

Other resources

TabStops Object Members


Task Object (Word)

 Copy code hover
[image]

Task Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a single task running on the system. The Task object is a member of the Tasks collection. The Tasks collection includes all the applications that are currently running on the system.

Remarks

Use Tasks(Index), where Index is the application name or the index number, to return a single Task object. The following example switches to and resizes the application window for the first visible task in the Tasks collection.

VBA Copy code Copy code
With Tasks(1)
 If .Visible = True Then
 .Activate
 .Width = 400
 .Height = 200
 End If
End With

The following example restores the Calculator application window if Calculator is in the Tasks collection.

VBA Copy code Copy code
If Tasks.Exists("Calculator") = True Then
 Tasks("Calculator").WindowState = wdWindowStateNormal
End If

Use Visual Basic's Shell function to run an executable program and add the program to the Tasks collection.

See also

Concepts

Word Object Model Reference

Other resources

Task Object Members


Task Members (Word)

 Copy code hover
[image]

Task Members (Word)
Send feedback

Published: July 16, 2012

Represents a single task running on the system. The Task object is a member of the Tasks collection. The Tasks collection includes all the applications that are currently running on the system.

Methods

Name | Description
Activate | Activates the Task object.
Close | Closes the specified task.
Move | Positions a task window.
Resize | Sizes the specified task window.
SendWindowMessage | Sends a Windows message and its associated parameters to the specified task.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Height | Returns or sets the height of the specified task window. Read/write Long.
Left | Returns or sets a Long that represents the horizontal position of the specified task, measured in points. Read/write.
Name | Returns the name of the specified object. Read-only String.
Parent | Returns an Object that represents the parent object of the specified Task object.
Top | Returns or sets the vertical position, in points, of the specified window. Read/write Long.
Visible | True if the specified object is visible. Read/write Boolean.
Width | Returns or sets the width of the specified Task object, in points. Read/write Long.
WindowState | Returns or sets the state of the specified document window or task window. Read/write WdWindowState.


Task Properties (Word)

 Copy code hover
[image]

Task Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Height | Returns or sets the height of the specified task window. Read/write Long.
Left | Returns or sets a Long that represents the horizontal position of the specified task, measured in points. Read/write.
Name | Returns the name of the specified object. Read-only String.
Parent | Returns an Object that represents the parent object of the specified Task object.
Top | Returns or sets the vertical position, in points, of the specified window. Read/write Long.
Visible | True if the specified object is visible. Read/write Boolean.
Width | Returns or sets the width of the specified Task object, in points. Read/write Long.
WindowState | Returns or sets the state of the specified document window or task window. Read/write WdWindowState.


Task.Application Property (Word)

 Copy code hover
[image]

Task.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a Task object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

Task Object

Other resources

Task Object Members


Task.Creator Property (Word)

 Copy code hover
[image]

Task.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a Task object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Task Object

Other resources

Task Object Members


Task.Height Property (Word)

 Copy code hover
[image]

Task.Height Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the height of the specified task window. Read/write Long.

Syntax

expression .Height

expression An expression that represents a Task object.

See also

Concepts

Task Object

Other resources

Task Object Members


Task.Left Property (Word)

 Copy code hover
[image]

Task.Left Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Long that represents the horizontal position of the specified task, measured in points. Read/write.

Syntax

expression .Left

expression Required. A variable that represents a Task object.

See also

Concepts

Task Object

Other resources

Task Object Members


Task.Name Property (Word)

 Copy code hover
[image]

Task.Name Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the name of the specified object. Read-only String.

Syntax

expression .Name

expression Required. A variable that represents a Task object.

See also

Concepts

Task Object

Other resources

Task Object Members


Task.Parent Property (Word)

 Copy code hover
[image]

Task.Parent Property (Word)
See also Send feedback

Returns an Object that represents the parent object of the specified Task object.

Syntax

expression .Parent

expression Required. A variable that represents a Task object.

See also

Concepts

Task Object

Other resources

Task Object Members


Task.Top Property (Word)

 Copy code hover
[image]

Task.Top Property (Word)
See also Send feedback

Returns or sets the vertical position, in points, of the specified window. Read/write Long.

Syntax

expression .Top

expression Required. A variable that represents a Task object.

Example

This example starts the Calculator and positions its window 100 points from the top of the screen.

VBA Copy code Copy code
Shell "Calc.exe"
With Tasks("Calculator")
 .WindowState = wdWindowStateNormal
 .Top = 100
End With

See also

Concepts

Task Object

Other resources

Task Object Members


Task.Visible Property (Word)

 Copy code hover
[image]

Task.Visible Property (Word)
See also Send feedback

True if the specified object is visible. Read/write Boolean.

Syntax

expression .Visible

expression Required. A variable that represents a Task object.

Remarks

For any object, some methods and properties may be unavailable if the Visible property is False.

Example

This example hides the Calculator, if it is running. If it is not running, a message is displayed.

VBA Copy code Copy code
If Tasks.Exists("Calculator") Then
 Tasks("Calculator").Visible = False
Else
 Msgbox "Calculator is not running."
End If

See also

Concepts

Task Object

Other resources

Task Object Members


Task.Width Property (Word)

 Copy code hover
[image]

Task.Width Property (Word)
See also Send feedback

Returns or sets the width of the specified Task object, in points. Read/write Long.

Syntax

expression .Width

expression A variable that represents a Task object.

See also

Concepts

Task Object

Other resources

Task Object Members


Task.WindowState Property (Word)

 Copy code hover
[image]

Task.WindowState Property (Word)
See also Send feedback

Returns or sets the state of the specified document window or task window. Read/write WdWindowState.

Syntax

expression .WindowState

expression Required. A variable that represents a Task object.

Example

This example minimizes the Microsoft Excel application window.

VBA Copy code Copy code
For Each myTask In Tasks
 If InStr(myTask.Name, "Microsoft Excel") > 0 Then
 myTask.Activate
 myTask.WindowState = wdWindowStateMinimize
 End If
Next myTask

See also

Concepts

Task Object

Other resources

Task Object Members


Task Methods (Word)

 Copy code hover
[image]

Task Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Activate | Activates the Task object.
Close | Closes the specified task.
Move | Positions a task window.
Resize | Sizes the specified task window.
SendWindowMessage | Sends a Windows message and its associated parameters to the specified task.


Task.Activate Method (Word)

 Copy code hover
[image]

Task.Activate Method (Word)
See also Send feedback

Published: July 16, 2012

Activates the Task object.

Syntax

expression .Activate(Wait)

expression Required. A variable that represents a Task object.

Parameters

Name | Required/Optional | Data Type | Description
Wait | Optional | Variant | True to wait until the user has activated Word before activating the task. False to immediately activate the task, even if Word isn't active.

Example

This example activates the Notepad application if Notepad is in the Tasks collection.

VBA Copy code Copy code
Sub ActivateNotePad()
 Dim Task1 'Notepad must be open and in the Task List.

 For Each Task1 In Tasks
 If InStr(Task1.Name, "Notepad") > 0 Then
 Task1.Activate
 Task1.WindowState = wdWindowStateNormal
 End If
 Next Task1
End Sub

See also

Concepts

Task Object

Other resources

Task Object Members


Task.Close Method (Word)

 Copy code hover
[image]

Task.Close Method (Word)
See also Send feedback

Published: July 16, 2012

Closes the specified task.

Syntax

expression .Close

expression Required. A variable that represents a Task object.

Example

This example activates Microsoft Excel and then closes it.

VBA Copy code Copy code
For Each myTask In Tasks
 If InStr(myTask.Name, "Microsoft Excel") > 0 Then
 myTask.Activate
 myTask.Close
 End If
Next myTask

See also

Concepts

Task Object

Other resources

Task Object Members


Task.Move Method (Word)

 Copy code hover
[image]

Task.Move Method (Word)
See also Send feedback

Published: July 16, 2012

Positions a task window.

Syntax

expression .Move(Left, Top)

expression Required. A variable that represents a Task object.

Parameters

Name | Required/Optional | Data Type | Description
Left | Required | Long | The horizontal screen position of the specified window.
Top | Required | Long | The vertical screen position of the specified window.

See also

Concepts

Task Object

Other resources

Task Object Members


Task.Resize Method (Word)

 Copy code hover
[image]

Task.Resize Method (Word)
See also Send feedback

Sizes the specified task window.

Syntax

expression .Resize(Width, Height)

expression Required. A variable that represents a Task object.

Parameters

Name | Required/Optional | Data Type | Description
Width | Required | Long | The width of the window, in points.
Height | Required | Long | The height of the window, in points.

Remarks

If the window is maximized or minimized, using this method causes an error. Use the Width or Height property to set the window width and height independently.

Example

This example resizes the Microsoft Excel application window to 6 inches wide by 4 inches high.

VBA Copy code Copy code
If Tasks.Exists("Microsoft Excel") = True Then
 With Tasks("Microsoft Excel")
 .WindowState = wdWindowStateNormal
 .Resize Width:=InchesToPoints(6), Height:=InchesToPoints(4)
 End With
End If

See also

Concepts

Task Object

Other resources

Task Object Members


Task.SendWindowMessage Method (Word)

 Copy code hover
[image]

Task.SendWindowMessage Method (Word)
See also Send feedback

Sends a Windows message and its associated parameters to the specified task.

Syntax

expression .SendWindowMessage(Message, wParam, IParam)

expression Required. A variable that represents a Task object.

Parameters

Name | Required/Optional | Data Type | Description
Message | Required | Long | A hexidecimal number that corresponds to the message you want to send. If you have the Microsoft Platform Software Development Kit, you can look up the name of the message in the header files (Winuser.h, for example) to find the associated hexadecimal number (precede the hexidecimal value with &h).
wParam | Required | Long | Parameters appropriate for the message you're sending. For information about what these values represent, see the reference topic for that message in the documentation included with the Microsoft Platform Software Development Kit, available on MSDN. To retrieve the appropriate values, you may need to use the Spy tool (which comes with the kit).

Example

If Notepad is running, this example displays the About dialog box (in Notepad) by sending a WM_COMMAND message to Notepad. The SendWindowMessage method is used to send the WM_COMMAND message (111 is the hexidecimal value for WM_COMMAND), with the parameters 11 and 0. The Spy tool was used to determine the wParam and lParam values.

VBA Copy code Copy code
Dim taskLoop As Task

For Each taskLoop In Tasks
 If InStr(taskLoop.Name, "Notepad") > 0 Then
 taskLoop.Activate
 taskLoop.SendWindowMessage &h111, 11, 0
 End If
Next taskLoop

See also

Concepts

Task Object

Other resources

Task Object Members


TaskPane Object (Word)

 Copy code hover
[image]

TaskPane Object (Word)
See also Send feedback

Represents a single task pane available to Microsoft Word, which contains common tasks that users perform. The TaskPane object is a member of the TaskPanes collection.

Remarks

Use the TaskPanes property to return a TaskPane object. Use the Visible property to display an individual task pane. This example displays the formatting task pane.

VBA Copy code Copy code
Sub FormattingPane()
 Application.TaskPanes(wdTaskPaneFormatting).Visible = True
End Sub

See also

Concepts

Word Object Model Reference

Other resources

TaskPane Object Members


TaskPane Members (Word)

 Copy code hover
[image]

TaskPane Members (Word)
Send feedback

Represents a single task pane available to Microsoft Word, which contains common tasks that users perform. The TaskPane object is a member of the TaskPanes collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified TaskPane object.
Visible | True if the specified object is visible. Read/write Boolean.


TaskPane Properties (Word)

 Copy code hover
[image]

TaskPane Properties (Word)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified TaskPane object.
Visible | True if the specified object is visible. Read/write Boolean.


TaskPane.Application Property (Word)

 Copy code hover
[image]

TaskPane.Application Property (Word)
See also Send feedback

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a TaskPane object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

TaskPane Object

Other resources

TaskPane Object Members


TaskPane.Creator Property (Word)

 Copy code hover
[image]

TaskPane.Creator Property (Word)
See also Send feedback

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a TaskPane object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

TaskPane Object

Other resources

TaskPane Object Members


TaskPane.Parent Property (Word)

 Copy code hover
[image]

TaskPane.Parent Property (Word)
See also Send feedback

Returns an Object that represents the parent object of the specified TaskPane object.

Syntax

expression .Parent

expression Required. A variable that represents a TaskPane object.

See also

Concepts

TaskPane Object

Other resources

TaskPane Object Members


TaskPane.Visible Property (Word)

 Copy code hover
[image]

TaskPane.Visible Property (Word)
See also Send feedback

True if the specified object is visible. Read/write Boolean.

Syntax

expression .Visible

expression Required. A variable that represents a TaskPane object.

Remarks

For any object, some methods and properties may be unavailable if the Visible property is False.

See also

Concepts

TaskPane Object

Other resources

TaskPane Object Members


TaskPanes Object (Word)

 Copy code hover
[image]

TaskPanes Object (Word)
See also Send feedback

A collection of TaskPane objects that contains commonly performed tasks in Microsoft Word.

Remarks

Use the TaskPanes property to return the TaskPanes collection. Use the Item method with a WdTaskPanes constant to refer to a specific task pane. The example below displays the formatting task pane.

VBA Copy code Copy code
Sub FormattingPane()
 Application.TaskPanes(wdTaskPaneFormatting).Visible = True
End Sub

See also

Concepts

Word Object Model Reference

Other resources

TaskPanes Object Members


TaskPanes Members (Word)

 Copy code hover
[image]

TaskPanes Members (Word)
Send feedback

A collection of TaskPane objects that contains commonly performed tasks in Microsoft Word.

Methods

Name | Description
Item | Returns the specified task pane as a TaskPane object.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of task panes in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified TaskPanes object.


TaskPanes Properties (Word)

 Copy code hover
[image]

TaskPanes Properties (Word)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of task panes in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified TaskPanes object.


TaskPanes.Application Property (Word)

 Copy code hover
[image]

TaskPanes.Application Property (Word)
See also Send feedback

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a TaskPanes collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

TaskPanes Collection

Other resources

TaskPanes Object Members


TaskPanes.Count Property (Word)

 Copy code hover
[image]

TaskPanes.Count Property (Word)
See also Send feedback

Returns a Long that represents the number of task panes in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents a TaskPanes collection.

See also

Concepts

TaskPanes Collection

Other resources

TaskPanes Object Members


TaskPanes.Creator Property (Word)

 Copy code hover
[image]

TaskPanes.Creator Property (Word)
See also Send feedback

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a TaskPanes collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

TaskPanes Collection

Other resources

TaskPanes Object Members


TaskPanes.Parent Property (Word)

 Copy code hover
[image]

TaskPanes.Parent Property (Word)
See also Send feedback

Returns an Object that represents the parent object of the specified TaskPanes object.

Syntax

expression .Parent

expression Required. A variable that represents a TaskPanes collection.

See also

Concepts

TaskPanes Collection

Other resources

TaskPanes Object Members


TaskPanes Methods (Word)

 Copy code hover
[image]

TaskPanes Methods (Word)
Send feedback

This object has the following methods:

Methods

Name | Description
Item | Returns the specified task pane as a TaskPane object.


TaskPanes.Item Method (Word)

 Copy code hover
[image]

TaskPanes.Item Method (Word)
See also Send feedback

Returns the specified task pane as a TaskPane object.

Syntax

expression .Item(Index)

expression Required. A variable that represents a TaskPanes collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | WdTaskPanes | The specified task pane.

Return Value

TaskPane

See also

Concepts

TaskPanes Collection

Other resources

TaskPanes Object Members


Tasks Object (Word)

 Copy code hover
[image]

Tasks Object (Word)
See also Send feedback

A collection of Task objects that represents all the tasks currently running on the system.

Remarks

Use the Tasks property to return the Tasks collection. The following example determines whether Microsoft Excel is running. If it is, this example switches to it and maximizes it; otherwise, the example starts it.

VBA Copy code Copy code
If Tasks.Exists("Microsoft Excel") = True Then
 Tasks("Microsoft Excel").Activate
 Tasks("Microsoft Excel").WindowState = wdWindowStateMaximize
Else
 Shell "C:\Program Files\" & _
 "Microsoft Office\Office10\Excel.exe"
End If

Use Visual Basic's Shell function to run an executable program and add the program to the Tasks collection.

Use Tasks(Index), where Index is the application name or the index number, to return a single Task object. The following example opens and resizes the application window for the first visible task in the Tasks collection.

VBA Copy code Copy code
With Tasks(1)
 If .Visible = True Then
 .Activate
 .Width = 400
 .Height = 200
 End If
End With

The following example restores the Calculator application window if the application is in the Tasks collection.

VBA Copy code Copy code
If Tasks.Exists("Calculator") = True Then
 Tasks("Calculator").WindowState = wdWindowStateNormal
End If

See also

Concepts

Word Object Model Reference

Other resources

Tasks Object Members


Tasks Members (Word)

 Copy code hover
[image]

Tasks Members (Word)
Send feedback

A collection of Task objects that represents all the tasks currently running on the system.

Methods

Name | Description
Exists | Determines whether the specified task exists. Returns True if the task exists.
ExitWindows | Closes all open applications, quits Microsoft Windows, and logs the current user off.
Item | Returns an individual Task object in a collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of tasks in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified Tasks object.


Tasks Properties (Word)

 Copy code hover
[image]

Tasks Properties (Word)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of tasks in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified Tasks object.


Tasks.Application Property (Word)

 Copy code hover
[image]

Tasks.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a Tasks collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

Tasks Collection Object

Other resources

Tasks Object Members


Tasks.Count Property (Word)

 Copy code hover
[image]

Tasks.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of tasks in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents a Tasks collection.

See also

Concepts

Tasks Collection Object

Other resources

Tasks Object Members


Tasks.Creator Property (Word)

 Copy code hover
[image]

Tasks.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a Tasks collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Tasks Collection Object

Other resources

Tasks Object Members


Tasks.Parent Property (Word)

 Copy code hover
[image]

Tasks.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Tasks object.

Syntax

expression .Parent

expression Required. A variable that represents a Tasks collection.

See also

Concepts

Tasks Collection Object

Other resources

Tasks Object Members


Tasks Methods (Word)

 Copy code hover
[image]

Tasks Methods (Word)
Send feedback

This object has the following methods:

Methods

Name | Description
Exists | Determines whether the specified task exists. Returns True if the task exists.
ExitWindows | Closes all open applications, quits Microsoft Windows, and logs the current user off.
Item | Returns an individual Task object in a collection.


Tasks.Exists Method (Word)

 Copy code hover
[image]

Tasks.Exists Method (Word)
See also Send feedback

Published: July 16, 2012

Determines whether the specified task exists. Returns True if the task exists.

Syntax

expression .Exists(Name)

expression A variable that represents a Tasks collection.

Parameters

Name | Required/Optional | Data Type | Description
Name | Required | String | The name of the task.

Return Value

Boolean

Example

This example determines whether the Windows Calculator program is running (if the task exists). If Calculator isn't running, the Shell statement starts it. If Calculator is running, the application is activated.

VBA Copy code Copy code
If Tasks.Exists("Calculator") = False Then
 Shell "Calc.exe"
Else
 Tasks("Calculator").Activate
End If
Tasks("Calculator").WindowState = wdWindowStateNormal

See also

Concepts

Tasks Collection Object

Other resources

Tasks Object Members


Tasks.ExitWindows Method (Word)

 Copy code hover
[image]

Tasks.ExitWindows Method (Word)
See also Send feedback

Published: July 16, 2012

Closes all open applications, quits Microsoft Windows, and logs the current user off.

Syntax

expression .ExitWindows

expression Required. A variable that represents a Tasks collection.

Remarks

This method does not save changes to open Microsoft Word documents; however, it does prompt you to save changes to open documents in other Windows-based applications.

Example

This example saves all open Word documents, closes Word, and then quits Microsoft Windows.

VBA Copy code Copy code
Documents.Save NoPrompt:=True, _
 OriginalFormat:=wdOriginalDocumentFormat
Tasks.ExitWindows

See also

Concepts

Tasks Collection Object

Other resources

Tasks Object Members


Tasks.Item Method (Word)

 Copy code hover
[image]

Tasks.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual Task object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents a Tasks collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The individual object to be returned. Can be a Long indicating the ordinal position or a String representing the name of the individual object.

Return Value

Task

See also

Concepts

Tasks Collection Object

Other resources

Tasks Object Members


Template Object (Word)

 Copy code hover
[image]

Template Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a document template. The Template object is a member of the Templates collection. The Templates collection includes all the available Template objects.

Remarks

Use Templates(Index), where Index is the template name or the index number, to return a single Template object. The following example saves the Memo2.dot template if it is in the Templates collection.

VBA Copy code Copy code
For Each aTemp In Templates
 If LCase(aTemp.Name) = "memo2.dot" Then aTemp.Save
Next aTemp

The index number represents the position of the template in the Templates collection. The following example opens the first template in the Templates collection.

VBA Copy code Copy code
Templates(1).OpenAsDocument

The Add method is not available for the Templates collection. Instead, you can add a template to the Templates collection by doing any of the following:

  • Using the Open method with the Documents collection to open a document based on a template or a template

  • Using the Add method with the Documents collection to open a new document based on a template

  • Using the Add method with the Addins collection to load a global template

  • Using the AttachedTemplate property with the Document object to attach a template to a document

Use the NormalTemplate property to return a template object that refers to the Normal template. Use the AttachedTemplate property to return the template attached to the specified document.

Use the DefaultFilePath property to return or set the location of user or workgroup templates (that is, the folder where you want to store these templates). The following example displays the user template folder from the File Locations tab in the Options dialog box (Tools menu).

VBA Copy code Copy code
MsgBox Options.DefaultFilePath(wdUserTemplatesPath)

See also

Concepts

Word Object Model Reference

Other resources

Template Object Members


Template Members (Word)

 Copy code hover
[image]

Template Members (Word)
Send feedback

Published: July 16, 2012

Represents a document template. The Template object is a member of the Templates collection. The Templates collection includes all the available Template objects.

Methods

Name | Description
OpenAsDocument | Opens the specified template as a document and returns a Document object.
Save | Saves the specified template.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
BuildingBlockEntries | Returns a BuildingBlockEntries collection that represents the collection of building block entries in a template. Read-only.
BuildingBlockTypes | Returns a BuildingBlockTypes collection that represents the collection of building block types that are contained in a template. Read-only.
BuiltInDocumentProperties | Returns a DocumentProperties collection that represents all the built-in document properties for the specified document.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
CustomDocumentProperties | Returns a DocumentProperties collection that represents all the custom document properties for the specified document.
FarEastLineBreakLanguage | Returns or sets the East Asian language to use when breaking lines of text in the specified document or template. Read/write WdFarEastLineBreakLanguageID.
FarEastLineBreakLevel | Returns or sets the line break control level for the specified document. Read/write WdFarEastLineBreakLevel.
FullName | Specifies the name of a template, including the drive or Web path. Read-only String.
JustificationMode | Returns or sets the character spacing adjustment for the specified template. Read/write WdJustificationMode.
KerningByAlgorithm | True if Microsoft Word kerns half-width Latin characters and punctuation marks in the specified document. Read/write Boolean.
LanguageID | Returns or sets a WdLanguageID constant that represents the language for the specified range. Read/write.
LanguageIDFarEast | Returns or sets an East Asian language for the specified object. Read/write WdLanguageID.
ListTemplates | Returns a ListTemplates collection that represents all the list formats for the specified document, template, or list gallery. Read-only.
Name | Returns the name of the specified object. Read-only String.
NoLineBreakAfter | Returns or sets the kinsoku characters after which Microsoft Word will not break a line. Read/write String.
NoLineBreakBefore | Returns or sets the kinsoku characters before which Microsoft Word will not break a line. Read/write String.
NoProofing | True if the spelling and grammar checker ignores documents based on this template. Read/write Long.
Parent | Returns an Object that represents the parent object of the specified Template object.
Path | Returns the path to the specified document template. Read-only String.
Saved | True if the specified template has not changed since it was last saved. False if Microsoft Word displays a prompt to save changes when the document is closed. Read/write Boolean.
Type | Returns the template type. Read-only WdTemplateType.
VBProject | Returns the VBProject object for the specified template.


Template Properties (Word)

 Copy code hover
[image]

Template Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
BuildingBlockEntries | Returns a BuildingBlockEntries collection that represents the collection of building block entries in a template. Read-only.
BuildingBlockTypes | Returns a BuildingBlockTypes collection that represents the collection of building block types that are contained in a template. Read-only.
BuiltInDocumentProperties | Returns a DocumentProperties collection that represents all the built-in document properties for the specified document.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
CustomDocumentProperties | Returns a DocumentProperties collection that represents all the custom document properties for the specified document.
FarEastLineBreakLanguage | Returns or sets the East Asian language to use when breaking lines of text in the specified document or template. Read/write WdFarEastLineBreakLanguageID.
FarEastLineBreakLevel | Returns or sets the line break control level for the specified document. Read/write WdFarEastLineBreakLevel.
FullName | Specifies the name of a template, including the drive or Web path. Read-only String.
JustificationMode | Returns or sets the character spacing adjustment for the specified template. Read/write WdJustificationMode.
KerningByAlgorithm | True if Microsoft Word kerns half-width Latin characters and punctuation marks in the specified document. Read/write Boolean.
LanguageID | Returns or sets a WdLanguageID constant that represents the language for the specified range. Read/write.
LanguageIDFarEast | Returns or sets an East Asian language for the specified object. Read/write WdLanguageID.
ListTemplates | Returns a ListTemplates collection that represents all the list formats for the specified document, template, or list gallery. Read-only.
Name | Returns the name of the specified object. Read-only String.
NoLineBreakAfter | Returns or sets the kinsoku characters after which Microsoft Word will not break a line. Read/write String.
NoLineBreakBefore | Returns or sets the kinsoku characters before which Microsoft Word will not break a line. Read/write String.
NoProofing | True if the spelling and grammar checker ignores documents based on this template. Read/write Long.
Parent | Returns an Object that represents the parent object of the specified Template object.
Path | Returns the path to the specified document template. Read-only String.
Saved | True if the specified template has not changed since it was last saved. False if Microsoft Word displays a prompt to save changes when the document is closed. Read/write Boolean.
Type | Returns the template type. Read-only WdTemplateType.
VBProject | Returns the VBProject object for the specified template.


Template.Application Property (Word)

 Copy code hover
[image]

Template.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a Template object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

Template Object

Other resources

Template Object Members


Template.BuildingBlockEntries Property (Word)

 Copy code hover
[image]

Template.BuildingBlockEntries Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a BuildingBlockEntries collection that represents the collection of building block entries in a template. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .BuildingBlockEntries

expression An expression that returns a Template object.

See also

Concepts

Template Object

Other resources

Template Object Members


Template.BuildingBlockTypes Property (Word)

 Copy code hover
[image]

Template.BuildingBlockTypes Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a BuildingBlockTypes collection that represents the collection of building block types that are contained in a template. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .BuildingBlockTypes

expression An expression that returns a Template object.

See also

Concepts

Template Object

Other resources

Template Object Members


Template.BuiltInDocumentProperties Property (Word)

 Copy code hover
[image]

Template.BuiltInDocumentProperties Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a DocumentProperties collection that represents all the built-in document properties for the specified document.

Syntax

expression .BuiltInDocumentProperties

expression Required. A variable that represents a Template object.

Remarks

To return a single DocumentProperty object that represents a specific built-in document property, use the BuiltinDocumentProperties property. If Microsoft Word doesn't define a value for one of the built-in document properties, reading the Value property for that document property generates an error.

Use the CustomDocumentProperties property to return the collection of custom document properties.

For information about returning a single member of a collection, see Returning an Object from a Collection.

See also

Concepts

Template Object

Other resources

Template Object Members


Template.Creator Property (Word)

 Copy code hover
[image]

Template.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a Template object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Template Object

Other resources

Template Object Members


Template.CustomDocumentProperties Property (Word)

 Copy code hover
[image]

Template.CustomDocumentProperties Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a DocumentProperties collection that represents all the custom document properties for the specified document.

Syntax

expression .CustomDocumentProperties

expression Required. A variable that represents a Template object.

Remarks

Use the BuiltInDocumentProperties property to return the collection of built-in document properties. Properties of type msoPropertyTypeString cannot exceed 255 characters in length.

For information about returning a single member of a collection, see Returning an Object from a Collection.

See also

Concepts

Template Object

Other resources

Template Object Members


Template.FarEastLineBreakLanguage Property (Word)

 Copy code hover
[image]

Template.FarEastLineBreakLanguage Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the East Asian language to use when breaking lines of text in the specified document or template. Read/write WdFarEastLineBreakLanguageID.

Syntax

expression .FarEastLineBreakLanguage

expression Required. A variable that represents a Template object.

See also

Concepts

Template Object

Other resources

Template Object Members


Template.FarEastLineBreakLevel Property (Word)

 Copy code hover
[image]

Template.FarEastLineBreakLevel Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the line break control level for the specified document. Read/write WdFarEastLineBreakLevel.

Syntax

expression .FarEastLineBreakLevel

expression Required. A variable that represents a Template object.

Remarks

This property is ignored if the FarEastLineBreakControl property is set to False.

Example

This example sets Microsoft Word to perform line breaking on first-level kinsoku characters in the active document.

VBA Copy code Copy code
ActiveDocument.FarEastLineBreakLevel = wdJustificationModeCompressKana

See also

Concepts

Template Object

Other resources

Template Object Members


Template.FullName Property (Word)

 Copy code hover
[image]

Template.FullName Property (Word)
See also Send feedback

Specifies the name of a template, including the drive or Web path. Read-only String.

Syntax

expression .FullName

expression Required. A variable that represents a Template object.

Remarks

Using this property is equivalent to using the Path, PathSeparator, and Name properties in sequence.

Example

This example displays the path and file name of the template attached to the active document.

VBA Copy code Copy code
Sub TemplateName()
 MsgBox ActiveDocument.AttachedTemplate.FullName
End Sub

See also

Concepts

Template Object

Other resources

Template Object Members


Template.JustificationMode Property (Word)

 Copy code hover
[image]

Template.JustificationMode Property (Word)
See also Send feedback

Returns or sets the character spacing adjustment for the specified template. Read/write WdJustificationMode.

Syntax

expression .JustificationMode

expression Required. A variable that represents a Template object.

Example

This example sets Microsoft Word to compress only punctuation marks when adjusting character spacing.

VBA Copy code Copy code
NormalTemplate.JustificationMode = wdJustificationModeCompressKana

See also

Concepts

Template Object

Other resources

Template Object Members


Template.KerningByAlgorithm Property (Word)

 Copy code hover
[image]

Template.KerningByAlgorithm Property (Word)
See also Send feedback

True if Microsoft Word kerns half-width Latin characters and punctuation marks in the specified document. Read/write Boolean.

Syntax

expression .KerningByAlgorithm

expression A variable that represents a Template object.

Example

This example sets Microsoft Word to kern half-width Latin characters and punctuation marks in the normal template.

VBA Copy code Copy code
NormalTemplate.KerningByAlgorithm = True

See also

Concepts

Template Object

Other resources

Template Object Members


Template.LanguageID Property (Word)

 Copy code hover
[image]

Template.LanguageID Property (Word)
See also Send feedback

Returns or sets a WdLanguageID constant that represents the language for the specified range. Read/write.

Syntax

expression .LanguageID

expression An expression that represents a Template object.

Remarks

Some of the WdLanguageID constants may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.

See also

Concepts

Template Object

Other resources

Template Object Members


Template.LanguageIDFarEast Property (Word)

 Copy code hover
[image]

Template.LanguageIDFarEast Property (Word)
See also Send feedback

Returns or sets an East Asian language for the specified object. Read/write WdLanguageID.

Syntax

expression .LanguageIDFarEast

expression Required. A variable that represents a Template object.

Remarks

This is the recommended way to return or set the language of East Asian text in a document created in an East Asian version of Microsoft Word.

Example

This example sets the language of the selection to Korean.

VBA Copy code Copy code
NormalTemplate.LanguageIDFarEast = wdKorean

See also

Concepts

Template Object

Other resources

Template Object Members


Template.ListTemplates Property (Word)

 Copy code hover
[image]

Template.ListTemplates Property (Word)
See also Send feedback

Returns a ListTemplates collection that represents all the list formats for the specified document, template, or list gallery. Read-only.

Syntax

expression .ListTemplates

expression A variable that represents a Template object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

See also

Concepts

Template Object

Other resources

Template Object Members


Template.Name Property (Word)

 Copy code hover
[image]

Template.Name Property (Word)
See also Send feedback

Returns the name of the specified object. Read-only String.

Syntax

expression .Name

expression Required. A variable that represents a Template object.

See also

Concepts

Template Object

Other resources

Template Object Members


Template.NoLineBreakAfter Property (Word)

 Copy code hover
[image]

Template.NoLineBreakAfter Property (Word)
See also Send feedback

Returns or sets the kinsoku characters after which Microsoft Word will not break a line. Read/write String.

Syntax

expression .NoLineBreakAfter

expression A variable that represents a Template object.

Example

This example sets "$", "(", "[", "\", and "{" as the kinsoku characters after which Microsoft Word will not break a line in the active document.

VBA Copy code Copy code
ActiveDocument.NoLineBreakAfter = "$([\{"

See also

Concepts

Template Object

Other resources

Template Object Members


Template.NoLineBreakBefore Property (Word)

 Copy code hover
[image]

Template.NoLineBreakBefore Property (Word)
See also Send feedback

Returns or sets the kinsoku characters before which Microsoft Word will not break a line. Read/write String.

Syntax

expression .NoLineBreakBefore

expression A variable that represents a Template object.

Example

This example sets "!", ")", and "]" as the kinsoku characters before which Word will not break a line in the active document.

VBA Copy code Copy code
NormalTemplate.NoLineBreakBefore = "!)]"

See also

Concepts

Template Object

Other resources

Template Object Members


Template.NoProofing Property (Word)

 Copy code hover
[image]

Template.NoProofing Property (Word)
See also Send feedback

True if the spelling and grammar checker ignores documents based on this template. Read/write Long.

Syntax

expression .NoProofing

expression A variable that represents a Template object.

See also

Concepts

Template Object

Other resources

Template Object Members


Template.Parent Property (Word)

 Copy code hover
[image]

Template.Parent Property (Word)
See also Send feedback

Returns an Object that represents the parent object of the specified Template object.

Syntax

expression .Parent

expression Required. A variable that represents a Template object.

See also

Concepts

Template Object

Other resources

Template Object Members


Template.Path Property (Word)

 Copy code hover
[image]

Template.Path Property (Word)
See also Send feedback

Returns the path to the specified document template. Read-only String.

Syntax

expression .Path

expression Required. A variable that represents a Template object.

Remarks

The path doesn't include a trailing character — for example, "C:\MSOffice" or "http://MyServer". Use the PathSeparator property to add the character that separates folders and drive letters. Use the Name property to return the file name without the path and use the FullName property to return the file name and the path together.

See also

Concepts

Template Object

Other resources

Template Object Members


Template.Saved Property (Word)

 Copy code hover
[image]

Template.Saved Property (Word)
See also Send feedback

True if the specified template has not changed since it was last saved. False if Microsoft Word displays a prompt to save changes when the document is closed. Read/write Boolean.

Syntax

expression .Saved

expression A variable that represents a Template object.

Example

This example changes the status of the Normal template to unchanged. If changes were made to the Normal template, the changes are not saved when you exit Word.

VBA Copy code Copy code
NormalTemplate.Saved = True
Application.Quit

See also

Concepts

Template Object

Other resources

Template Object Members


Template.Type Property (Word)

 Copy code hover
[image]

Template.Type Property (Word)
See also Send feedback

Returns the template type. Read-only WdTemplateType.

Syntax

expression .Type

expression Required. A variable that represents a Template object.

See also

Concepts

Template Object

Other resources

Template Object Members


Template.VBProject Property (Word)

 Copy code hover
[image]

Template.VBProject Property (Word)
See also Send feedback

Returns the VBProject object for the specified template.

Syntax

expression .VBProject

expression Required. A variable that represents a Template object.

Remarks

Use this property to gain access to code modules and user forms.

To view the VBProject object in the object browser, you must select the Microsoft Visual Basic for Applications Extensibility check box in the References dialog box (Tools menu) in the Visual Basic Editor.

Example

This example displays the name of the Visual Basic project for the Normal template.

VBA Copy code Copy code
Set normProj = NormalTemplate.VBProject
MsgBox normProj.Name

See also

Concepts

Template Object

Other resources

Template Object Members


Template Methods (Word)

 Copy code hover
[image]

Template Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
OpenAsDocument | Opens the specified template as a document and returns a Document object.
Save | Saves the specified template.


Template.OpenAsDocument Method (Word)

 Copy code hover
[image]

Template.OpenAsDocument Method (Word)
See also Send feedback

Opens the specified template as a document and returns a Document object.

Syntax

expression .OpenAsDocument

expression Required. A variable that represents a Template object.

Return Value

Document

Remarks

Opening a template as a document allows the user to edit the contents of the template. This may be necessary if a property or method (the Styles property, for example) isn't available from the Template object.

Example

This example opens the template attached to the active document, displays a message box if the template contains anything more than a single paragraph mark, and then closes the template.

VBA Copy code Copy code
Dim docNew As Document

Set docNew = ActiveDocument.AttachedTemplate.OpenAsDocument

If docNew.Content.Text <> Chr(13) Then
 MsgBox "Template is not empty"
Else
 MsgBox "Template is empty"
End If
docNew.Close SaveChanges:=wdDoNotSaveChanges

This example saves a copy of the Normal template as "Backup.dot."

VBA Copy code Copy code
Dim docNew As Document

Set docNew = NormalTemplate.OpenAsDocument

With docNew
 .SaveAs FileName:="Backup.dot"
 .Close SaveChanges:=wdDoNotSaveChanges
End With

This example changes the formatting of the Heading 1 style in the template attached to the active document. The UpdateStyles method updates the styles in the active document.

VBA Copy code Copy code
Dim docNew As Document

Set docNew = ActiveDocument.AttachedTemplate.OpenAsDocument

With docNew.Styles(wdStyleHeading1).Font
 .Name = "Arial"
 .Size = 16
 .Bold = False
End With
docNew.Close SaveChanges:=wdSaveChanges
ActiveDocument.UpdateStyles

See also

Concepts

Template Object

Other resources

Template Object Members


Template.Save Method (Word)

 Copy code hover
[image]

Template.Save Method (Word)
See also Send feedback

Saves the specified template.

Syntax

expression .Save

expression Required. A variable that represents a Template object.

Remarks

If the template has not been saved before, the Save As dialog box prompts the user for a file name.

See also

Concepts

Template Object

Other resources

Template Object Members


Templates Object (Word)

 Copy code hover
[image]

Templates Object (Word)
See also Send feedback

A collection of Template objects that represent all the templates that are currently available. This collection includes open templates, templates attached to open documents, and global templates loaded in the Templates and Add-ins dialog box.

Remarks

Use the Templates property to return the Templates collection. The following example displays the path and file name of each template in the Templates collection.

VBA Copy code Copy code
For Each aTemp In Templates
 MsgBox aTemp.FullName
Next aTemp

The Add method isn't available for the Templates collection. Instead, you can add a template to the Templates collection by doing any of the following:

  • Using the Open method with the Documents collection to open a document based on a template or a template

  • Using the Add method with the Documents collection to open a new document based on a template

  • Using the Add method with the Addins collection to load a global template

  • Using the AttachedTemplate property with the Document object to attach a template to a document

Use Templates(Index), where Index is the template name or the index number, to return a single Template object. The following example saves the Dot1.dot template.

VBA Copy code Copy code
Templates("C:\MSOffice\WinWord\Templates\Dot1.dot").Save

The index number represents the position of the template in the Templates collection. The following example displays the file name of the first template in the Templates collection.

VBA Copy code Copy code
MsgBox Templates(1).FullName

Use the NormalTemplate property to return a template object that refers to the Normal template. Use the AttachedTemplate property to return the template attached to the specified document.

Use the DefaultFilePath property to determine the location of user or workgroup templates (that is, the folder where you want to store these templates). The following example displays the user template folder from the File Locations tab in the Options dialog box.

VBA Copy code Copy code
MsgBox Options.DefaultFilePath(wdUserTemplatePath)

See also

Concepts

Word Object Model Reference

Other resources

Templates Object Members


Templates Members (Word)

 Copy code hover
[image]

Templates Members (Word)
Send feedback

A collection of Template objects that represent all the templates that are currently available. This collection includes open templates, templates attached to open documents, and global templates loaded in the Templates and Add-ins dialog box.

Methods

Name | Description
Item | Returns an individual Template object in a collection.
LoadBuildingBlocks | Loads the building blocks for all templates into Microsoft Word.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of templates in the specified collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified Templates object.


Templates Properties (Word)

 Copy code hover
[image]

Templates Properties (Word)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of templates in the specified collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified Templates object.


Templates.Application Property (Word)

 Copy code hover
[image]

Templates.Application Property (Word)
See also Send feedback

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a Templates collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

Templates Collection Object

Other resources

Templates Object Members


Templates.Count Property (Word)

 Copy code hover
[image]

Templates.Count Property (Word)
See also Send feedback

Returns a Long that represents the number of templates in the specified collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents a Templates collection.

See also

Concepts

Templates Collection Object

Other resources

Templates Object Members


Templates.Creator Property (Word)

 Copy code hover
[image]

Templates.Creator Property (Word)
See also Send feedback

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a Templates collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Templates Collection Object

Other resources

Templates Object Members


Templates.Parent Property (Word)

 Copy code hover
[image]

Templates.Parent Property (Word)
See also Send feedback

Returns an Object that represents the parent object of the specified Templates object.

Syntax

expression .Parent

expression Required. A variable that represents a Templates collection.

See also

Concepts

Templates Collection Object

Other resources

Templates Object Members


Templates Methods (Word)

 Copy code hover
[image]

Templates Methods (Word)
Send feedback

This object has the following methods:

Methods

Name | Description
Item | Returns an individual Template object in a collection.
LoadBuildingBlocks | Loads the building blocks for all templates into Microsoft Word.


Templates.Item Method (Word)

 Copy code hover
[image]

Templates.Item Method (Word)
See also Send feedback

Returns an individual Template object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents a Templates collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The individual object to be returned. Can be a Long indicating the ordinal position or a String representing the name of the individual object.

Return Value

Template

See also

Concepts

Templates Collection Object

Other resources

Templates Object Members


Templates.LoadBuildingBlocks Method (Word)

 Copy code hover
[image]

Templates.LoadBuildingBlocks Method (Word)
See also Send feedback

Loads the building blocks for all templates into Microsoft Word.

Syntax

expression .LoadBuildingBlocks

expression An expression that returns a Templates object.

Remarks

Word normally loads building blocks when they are first needed, for example when a user displays a gallery by using the ribbon. This method forces Word to immediately load all building blocks.

See also

Concepts

Templates Collection Object

Other resources

Templates Object Members


TextColumn Object (Word)

 Copy code hover
[image]

TextColumn Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a single text column. The TextColumn object is a member of the TextColumns collection. The TextColumns collection includes all the columns in a document or section of a document.

Remarks

Use TextColumns(Index), where Index is the index number, to return a single TextColumn object. The index number represents the position of the column in the TextColumns collection (counting from left to right).

The following example sets the space after the first text column in the active document to 0.5 inch.

VBA Copy code Copy code
ActiveDocument.PageSetup.TextColumns(1).SpaceAfter = _
 InchesToPoints(0.5)

Use the Add method to add a column to the collection of columns. By default, there is one text column in the TextColumns collection. The following example adds a 2.5-inch-widecolumn to the active document.

VBA Copy code Copy code
ActiveDocument.PageSetup.TextColumns.Add _
 Width:=InchesToPoints(2.5), _
 Spacing:=InchesToPoints(0.5), EvenlySpaced:=False

Use the SetCount method to arrange text into columns. The following example arranges the text in the active document into three columns.

VBA Copy code Copy code
ActiveDocument.PageSetup.TextColumns.SetCount NumColumns:=3

See also

Concepts

Word Object Model Reference

Other resources

TextColumn Object Members


TextColumn Members (Word)

 Copy code hover
[image]

TextColumn Members (Word)
Send feedback

Represents a single text column. The TextColumn object is a member of the TextColumns collection. The TextColumns collection includes all the columns in a document or section of a document.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified TextColumn object.
SpaceAfter | Returns or sets the amount of spacing (in points) after the specified paragraph or text column. Read/write Single.
Width | Returns or sets the width, in points, of the specified text columns. Read/write Long.


TextColumn Properties (Word)

 Copy code hover
[image]

TextColumn Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified TextColumn object.
SpaceAfter | Returns or sets the amount of spacing (in points) after the specified paragraph or text column. Read/write Single.
Width | Returns or sets the width, in points, of the specified text columns. Read/write Long.


TextColumn.Application Property (Word)

 Copy code hover
[image]

TextColumn.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a TextColumn object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

TextColumn Object

Other resources

TextColumn Object Members


TextColumn.Creator Property (Word)

 Copy code hover
[image]

TextColumn.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a TextColumn object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

TextColumn Object

Other resources

TextColumn Object Members


TextColumn.Parent Property (Word)

 Copy code hover
[image]

TextColumn.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified TextColumn object.

Syntax

expression .Parent

expression Required. A variable that represents a TextColumn object.

See also

Concepts

TextColumn Object

Other resources

TextColumn Object Members


TextColumn.SpaceAfter Property (Word)

 Copy code hover
[image]

TextColumn.SpaceAfter Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the amount of spacing (in points) after the specified paragraph or text column. Read/write Single.

Syntax

expression .SpaceAfter

expression Required. A variable that represents a TextColumn object.

Example

This example sets the active document to three columns with a 0.5-inch space after the first column. The InchesToPoints method is used to convert inches to points.

VBA Copy code Copy code
With ActiveDocument.PageSetup.TextColumns
 .SetCount NumColumns:=3
 .LineBetween = False
 .EvenlySpaced = True
 .Item(1).SpaceAfter = InchesToPoints(0.5)
End With

See also

Concepts

TextColumn Object

Other resources

TextColumn Object Members


TextColumn.Width Property (Word)

 Copy code hover
[image]

TextColumn.Width Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the width, in points, of the specified text columns. Read/write Long.

Syntax

expression .Width

expression A variable that represents a TextColumn object.

Example

This example formats the section that includes the selection as three columns. The For Each loop is used to display the width of each column in the TextColumns collection.

VBA Copy code Copy code
Selection.PageSetup.TextColumns.SetCount NumColumns:=3
For Each acol In Selection.PageSetup.TextColumns
 MsgBox "Width= " & PointsToInches(acol.Width)
Next acol

See also

Concepts

TextColumn Object

Other resources

TextColumn Object Members


TextColumns Object (Word)

 Copy code hover
[image]

TextColumns Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of TextColumn objects that represent all the columns of text in a document or a section of a document.

Remarks

Use the TextColumns property to return the TextColumns collection. The following example formats the columns in the first section in the active document to be evenly spaced, with a line between the columns.

VBA Copy code Copy code
With ActiveDocument.Sections(1).PageSetup.TextColumns
 .EvenlySpaced = True
 .LineBetween = True
End With

Use the Add method to add a column to the collection of columns. By default, there is one text column in the TextColumns collection. The following example adds a 2.5-inch-wide column to the active document.

VBA Copy code Copy code
ActiveDocument.PageSetup.TextColumns.Add _
 Width:=InchesToPoints(2.5), _
 Spacing:=InchesToPoints(0.5), EvenlySpaced:=False

Use the SetCount method to arrange text into columns. The following example arranges the text in the active document into three columns.

VBA Copy code Copy code
ActiveDocument.PageSetup.TextColumns.SetCount NumColumns:=3

See also

Concepts

Word Object Model Reference

Other resources

TextColumns Object Members


TextColumns Members (Word)

 Copy code hover
[image]

TextColumns Members (Word)
Send feedback

Published: July 16, 2012

A collection of TextColumn objects that represent all the columns of text in a document or a section of a document.

Methods

Name | Description
Add | Returns a TextColumn object that represents a new text column added to a section or document.
Item | Returns an individual TextColumn object in a collection.
SetCount | Arranges text into the specified number of text columns.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of text columns in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
EvenlySpaced | True if text columns are evenly spaced. Read/write Long.
FlowDirection | Returns or sets the direction in which text flows from one text column to the next. Read/write WdFlowDirection.
LineBetween | True if vertical lines appear between all the columns in the TextColumns collection. Read/write Long.
Parent | Returns an Object that represents the parent object of the specified TextColumns object.
Spacing | Returns or sets the spacing (in points) between between columns. Read/write Single.
Width | Returns or sets the width of the Word art text effects, in points. Read/write Long.


TextColumns Properties (Word)

 Copy code hover
[image]

TextColumns Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of text columns in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
EvenlySpaced | True if text columns are evenly spaced. Read/write Long.
FlowDirection | Returns or sets the direction in which text flows from one text column to the next. Read/write WdFlowDirection.
LineBetween | True if vertical lines appear between all the columns in the TextColumns collection. Read/write Long.
Parent | Returns an Object that represents the parent object of the specified TextColumns object.
Spacing | Returns or sets the spacing (in points) between between columns. Read/write Single.
Width | Returns or sets the width of the Word art text effects, in points. Read/write Long.


TextColumns.Application Property (Word)

 Copy code hover
[image]

TextColumns.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a TextColumns collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

TextColumns Collection Object

Other resources

TextColumns Object Members


TextColumns.Count Property (Word)

 Copy code hover
[image]

TextColumns.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of text columns in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents a TextColumns collection.

See also

Concepts

TextColumns Collection Object

Other resources

TextColumns Object Members


TextColumns.Creator Property (Word)

 Copy code hover
[image]

TextColumns.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a TextColumns collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

TextColumns Collection Object

Other resources

TextColumns Object Members


TextColumns.EvenlySpaced Property (Word)

 Copy code hover
[image]

TextColumns.EvenlySpaced Property (Word)
See also Send feedback

Published: July 16, 2012

True if text columns are evenly spaced. Read/write Long.

Syntax

expression .EvenlySpaced

expression A variable that represents a TextColumns object.

Remarks

The EvenlySpaced property can be True, False, or wdUndefined.

If you set the Spacing or Width property of the TextColumns object, the EvenlySpaced property is automatically set to True. Also, setting the EvenlySpaced property may change the settings for the Spacing and Width properties of the TextColumns object.

Example

This example topic sets columns in the active document to be evenly spaced.

VBA Copy code Copy code
Dim colTextColumns

Set colTextColumns = ActiveDocument.PageSetup.TextColumns

If colTextColumns.Count > 1 Then _
 colTextColumns.EvenlySpaced = True
End If

This example returns the status of the Equal column width option in the Columns dialog box (Format menu).

VBA Copy code Copy code
Dim lngSpaced As Long

lngSpaced = ActiveDocument.PageSetup.TextColumns.EvenlySpaced

See also

Concepts

TextColumns Collection Object

Other resources

TextColumns Object Members


TextColumns.FlowDirection Property (Word)

 Copy code hover
[image]

TextColumns.FlowDirection Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the direction in which text flows from one text column to the next. Read/write WdFlowDirection.

Syntax

expression .FlowDirection

expression Required. A variable that represents a TextColumns collection.

Example

This example sets the flow direction so that text flows through the specified columns from right to left.

VBA Copy code Copy code
ActiveDocument.PageSetup.TextColumns.FlowDirection = _
 wdFlowRtl

See also

Concepts

TextColumns Collection Object

Other resources

TextColumns Object Members


TextColumns.LineBetween Property (Word)

 Copy code hover
[image]

TextColumns.LineBetween Property (Word)
See also Send feedback

Published: July 16, 2012

True if vertical lines appear between all the columns in the TextColumns collection. Read/write Long.

Syntax

expression .LineBetween

expression An expression that returns a TextColumns collection object.

Remarks

The LineBetween property can be True, False, or wdUndefined.

Example

This example cycles through each section in the active document and displays a message box if the text columns in the section are separated by vertical lines.

VBA Copy code Copy code
i = 1
For each s in ActiveDocument.Sections
 If s.PageSetup.TextColumns.LineBetween = True Then
 MsgBox "The columns in section " & i & " contain lines."
 End If
 i = i + 1
Next s

See also

Concepts

TextColumns Collection Object

Other resources

TextColumns Object Members


TextColumns.Parent Property (Word)

 Copy code hover
[image]

TextColumns.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified TextColumns object.

Syntax

expression .Parent

expression Required. A variable that represents a TextColumns collection.

See also

Concepts

TextColumns Collection Object

Other resources

TextColumns Object Members


TextColumns.Spacing Property (Word)

 Copy code hover
[image]

TextColumns.Spacing Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the spacing (in points) between between columns. Read/write Single.

Syntax

expression .Spacing

expression Required. A variable that represents a TextColumns collection.

Remarks

After this property has been set for a TextColumns object, the EvenlySpaced property is set to True. To return or set the spacing for a single text column when EvenlySpaced is False, use the SpaceAfter property of the TextColumn object.

Example

This example formats the active document to display text in two columns with 0.5 inch (36 points) spacing between the columns.

VBA Copy code Copy code
With ActiveDocument.PageSetup.TextColumns
 .SetCount NumColumns:=2
 .LineBetween = False
 .EvenlySpaced = True
 .Spacing = 36
End With

See also

Concepts

TextColumns Collection Object

Other resources

TextColumns Object Members


TextColumns.Width Property (Word)

 Copy code hover
[image]

TextColumns.Width Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the width of the Word art text effects, in points. Read/write Long.

Syntax

expression .Width

expression A variable that represents a TextColumns collection.

See also

Concepts

TextColumns Collection Object

Other resources

TextColumns Object Members


TextColumns Methods (Word)

 Copy code hover
[image]

TextColumns Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Returns a TextColumn object that represents a new text column added to a section or document.
Item | Returns an individual TextColumn object in a collection.
SetCount | Arranges text into the specified number of text columns.


TextColumns.Add Method (Word)

 Copy code hover
[image]

TextColumns.Add Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a TextColumn object that represents a new text column added to a section or document.

Syntax

expression .Add(Width, Spacing, EvenlySpaced)

expression Required. A variable that represents a TextColumns collection.

Parameters

Name | Required/Optional | Data Type | Description
Width | Optional | Variant | The width of the new text column in the document, in points.
Spacing | Optional | Variant | The spacing between the text columns in the document, in points.
EvenlySpaced | Optional | Variant | True to evenly space all the text columns be in the document.

Return Value

TextColumn

Example

This example creates a new document and then adds another 2.5-inch-wide text column to it.

VBA Copy code Copy code
Set myDoc = Documents.Add
myDoc.PageSetup.TextColumns.Add Width:=InchesToPoints(2.5), _
 Spacing:=InchesToPoints(0.5), EvenlySpaced:=False

This example adds a new text column to the active document and then evenly spaces all the text columns in the document.

VBA Copy code Copy code
ActiveDocument.PageSetup.TextColumns.Add _
 Width:=InchesToPoints(1.5), _
 EvenlySpaced:=True

See also

Concepts

TextColumns Collection Object

Other resources

TextColumns Object Members


TextColumns.Item Method (Word)

 Copy code hover
[image]

TextColumns.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual TextColumn object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents a TextColumns collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The individual object to be returned. Can be a Long indicating the ordinal position of the individual object.

Return Value

TextColumn

See also

Concepts

TextColumns Collection Object

Other resources

TextColumns Object Members


TextColumns.SetCount Method (Word)

 Copy code hover
[image]

TextColumns.SetCount Method (Word)
See also Send feedback

Published: July 16, 2012

Arranges text into the specified number of text columns.

Syntax

expression .SetCount(NumColumns)

expression Required. A variable that represents a TextColumns collection.

Parameters

Name | Required/Optional | Data Type | Description
NumColumns | Required | Long | The number of columns the text is to be arranged into.

Remarks

You can also use the Add method to add a single column to the TextColumns collection.

Example

This example arranges the text in the active document into two columns of equal width.

VBA Copy code Copy code
ActiveDocument.PageSetup.TextColumns.SetCount NumColumns:=2

This example arranges the text in the first section of Brochure.doc into three columns of equal width.

VBA Copy code Copy code
Documents("Brochure.doc").Sections(1) _
 .PageSetup.TextColumns.SetCount NumColumns:=3

See also

Concepts

TextColumns Collection Object

Other resources

TextColumns Object Members


TextEffectFormat Object (Word)

 Copy code hover
[image]

TextEffectFormat Object (Word)
See also Send feedback

Published: July 16, 2012

Contains properties and methods that apply to WordArt objects.

Remarks

Use the TextEffect property to return a TextEffectFormat object. The following example sets the font name and formatting for shape one on the active document. For this example to work, shape one must be a WordArt object.

VBA Copy code Copy code
With ActiveDocument.Shapes(1).TextEffect
 .FontName = "Courier New"
 .FontBold = True
 .FontItalic = True
End With

See also

Concepts

Word Object Model Reference

Other resources

TextEffectFormat Object Members


TextEffectFormat Members (Word)

 Copy code hover
[image]

TextEffectFormat Members (Word)
Send feedback

Published: July 16, 2012

Contains properties and methods that apply to WordArt objects.

Methods

Name | Description
ToggleVerticalText | Switches the text flow in the specified WordArt from horizontal to vertical, or vice versa.

Properties

Name | Description
Alignment | Returns or sets an MsoTextEffectAlignment constant that represents the alignment for the specified text effect. Read/write.
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
FontBold | Sets the font to bold for the specified Word Art shape. Read/write MsoTriState.
FontItalic | Italicizes WordArt text. Read/write MsoTriState.
FontName | Returns or sets the name of the font for the dropped capital letter. Read/write String.
FontSize | Returns or sets the font size for the specified WordArt, in points. Read/write Single.
KernedPairs | Indicates that character pairs in a WordArt object have been kerned. Read/write MsoTriState.
NormalizedHeight | MsoTrue if all characters (both uppercase and lowercase) in the specified WordArt are the same height. Read/write MsoTriState.
Parent | Returns an Object that represents the parent object of the specified TextEffectFormat object.
PresetShape | Returns or sets the shape of the specified WordArt. Read/write MsoPresetTextEffectShape.
PresetTextEffect | Returns or sets the style of the specified WordArt. The values for this property correspond to the formats in the WordArt Gallery dialog box (Insert menu), numbered from left to right, top to bottom. Read/write MsoPresetTextEffect.
RotatedChars | MsoTrue if characters in the specified WordArt are rotated 90 degrees relative to the WordArt's bounding shape. MsoFalse if characters in the specified WordArt retain their original orientation relative to the bounding shape. Read/write MsoTriState.
Text | Returns or sets the text in the specified object. Read/write String.
Tracking | Returns or sets the ratio of the horizontal space allotted to each character in the specified WordArt in relation to the width of the character. Read/write Single.


TextEffectFormat Properties (Word)

 Copy code hover
[image]

TextEffectFormat Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Alignment | Returns or sets an MsoTextEffectAlignment constant that represents the alignment for the specified text effect. Read/write.
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
FontBold | Sets the font to bold for the specified Word Art shape. Read/write MsoTriState.
FontItalic | Italicizes WordArt text. Read/write MsoTriState.
FontName | Returns or sets the name of the font for the dropped capital letter. Read/write String.
FontSize | Returns or sets the font size for the specified WordArt, in points. Read/write Single.
KernedPairs | Indicates that character pairs in a WordArt object have been kerned. Read/write MsoTriState.
NormalizedHeight | MsoTrue if all characters (both uppercase and lowercase) in the specified WordArt are the same height. Read/write MsoTriState.
Parent | Returns an Object that represents the parent object of the specified TextEffectFormat object.
PresetShape | Returns or sets the shape of the specified WordArt. Read/write MsoPresetTextEffectShape.
PresetTextEffect | Returns or sets the style of the specified WordArt. The values for this property correspond to the formats in the WordArt Gallery dialog box (Insert menu), numbered from left to right, top to bottom. Read/write MsoPresetTextEffect.
RotatedChars | MsoTrue if characters in the specified WordArt are rotated 90 degrees relative to the WordArt's bounding shape. MsoFalse if characters in the specified WordArt retain their original orientation relative to the bounding shape. Read/write MsoTriState.
Text | Returns or sets the text in the specified object. Read/write String.
Tracking | Returns or sets the ratio of the horizontal space allotted to each character in the specified WordArt in relation to the width of the character. Read/write Single.


TextEffectFormat.Alignment Property (Word)

 Copy code hover
[image]

TextEffectFormat.Alignment Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets an MsoTextEffectAlignment constant that represents the alignment for the specified text effect. Read/write.

Syntax

expression .Alignment

expression Required. A variable that represents a TextEffectFormat object.

See also

Concepts

TextEffectFormat Object

Other resources

TextEffectFormat Object Members


TextEffectFormat.Application Property (Word)

 Copy code hover
[image]

TextEffectFormat.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a TextEffectFormat object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

TextEffectFormat Object

Other resources

TextEffectFormat Object Members


TextEffectFormat.Creator Property (Word)

 Copy code hover
[image]

TextEffectFormat.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a TextEffectFormat object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

TextEffectFormat Object

Other resources

TextEffectFormat Object Members


TextEffectFormat.FontBold Property (Word)

 Copy code hover
[image]

TextEffectFormat.FontBold Property (Word)
See also Send feedback

Published: July 16, 2012

Sets the font to bold for the specified Word Art shape. Read/write MsoTriState.

Syntax

expression .FontBold

expression A variable that represents a TextEffectFormat object.

Example

This example sets the font to bold for the third shape on the active document if the shape is WordArt.

VBA Copy code Copy code
Dim docActive As Document

Set docActive = ActiveDocument

With docActive.Shapes(3)
 If .Type = msoTextEffect Then
 .TextEffect.FontBold = msoTrue
 End If
End With

See also

Concepts

TextEffectFormat Object

Other resources

TextEffectFormat Object Members


TextEffectFormat.FontItalic Property (Word)

 Copy code hover
[image]

TextEffectFormat.FontItalic Property (Word)
See also Send feedback

Published: July 16, 2012

Italicizes WordArt text. Read/write MsoTriState.

Syntax

expression .FontItalic

expression Required. A variable that represents a TextEffectFormat object.

Example

This example sets the font to italic for the shape named "WordArt 4" in the active document.

VBA Copy code Copy code
Sub ItalicizeWordArt()
 ActiveDocument.Shapes("WordArt 4") _
 .TextEffect.FontItalic = msoTrue
End Sub

See also

Concepts

TextEffectFormat Object

Other resources

TextEffectFormat Object Members


TextEffectFormat.FontName Property (Word)

 Copy code hover
[image]

TextEffectFormat.FontName Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the name of the font for the dropped capital letter. Read/write String.

Syntax

expression .FontName

expression A variable that represents a TextEffectFormat object.

Example

This example sets Arial as the font for the dropped capital letter for the first paragraph in the active document.

VBA Copy code Copy code
With ActiveDocument.Paragraphs(1).DropCap
 .FontName = "Arial"
 .Position = wdDropNormal
 .LinesToDrop = 3
 .DistanceFromText = InchesToPoints(0.1)
End With

See also

Concepts

TextEffectFormat Object

Other resources

TextEffectFormat Object Members


TextEffectFormat.FontSize Property (Word)

 Copy code hover
[image]

TextEffectFormat.FontSize Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the font size for the specified WordArt, in points. Read/write Single.

Syntax

expression .FontSize

expression A variable that represents a TextEffectFormat object.

Example

This example sets the font size to 16 points for the shape named "WordArt 2" in the active document.

VBA Copy code Copy code
Dim docActive As Document

Set docActive = ActiveDocument
docActive.Shapes("WordArt 2").TextEffect.FontSize = 16

See also

Concepts

TextEffectFormat Object

Other resources

TextEffectFormat Object Members


TextEffectFormat.KernedPairs Property (Word)

 Copy code hover
[image]

TextEffectFormat.KernedPairs Property (Word)
See also Send feedback

Published: July 16, 2012

Indicates that character pairs in a WordArt object have been kerned. Read/write MsoTriState.

Syntax

expression .KernedPairs

expression Required. A variable that represents a TextEffectFormat object.

Example

This example turns on character pair kerning for all WordArt objects in the active document.

VBA Copy code Copy code
Sub Kerned()
 With ActiveDocument.Range(1, ActiveDocument.Shapes.Count).ShapeRange
 If .Type = msoTextEffect Then
 .TextEffect.KernedPairs = True
 End If
 End With
End Sub

See also

Concepts

TextEffectFormat Object

Other resources

TextEffectFormat Object Members


TextEffectFormat.NormalizedHeight Property (Word)

 Copy code hover
[image]

TextEffectFormat.NormalizedHeight Property (Word)
See also Send feedback

Published: July 16, 2012

MsoTrue if all characters (both uppercase and lowercase) in the specified WordArt are the same height. Read/write MsoTriState.

Syntax

expression .NormalizedHeight

expression Required. A variable that represents a TextEffectFormat object.

Example

This example adds WordArt that contains the text "Test Effect" to myDocument and gives the new WordArt the name "texteff1." The code then makes all characters in the shape named "texteff1" the same height.

VBA Copy code Copy code
Set myDocument = ActiveDocument
myDocument.Shapes.AddTextEffect(PresetTextEffect:=msoTextEffect1, _
 Text:="Test Effect", FontName:="Courier New", _
 FontSize:=44, FontBold:=True, _
 FontItalic:=False, Left:=10, Top:=10).Name = "texteff1"
myDocument.Shapes("texteff1").TextEffect.NormalizedHeight = msoTrue

See also

Concepts

TextEffectFormat Object

Other resources

TextEffectFormat Object Members


TextEffectFormat.Parent Property (Word)

 Copy code hover
[image]

TextEffectFormat.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified TextEffectFormat object.

Syntax

expression .Parent

expression Required. A variable that represents a TextEffectFormat object.

See also

Concepts

TextEffectFormat Object

Other resources

TextEffectFormat Object Members


TextEffectFormat.PresetShape Property (Word)

 Copy code hover
[image]

TextEffectFormat.PresetShape Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the shape of the specified WordArt. Read/write MsoPresetTextEffectShape.

Syntax

expression .PresetShape

expression Required. A variable that represents a TextEffectFormat object.

Remarks

Setting the PresetTextEffect property automatically sets the PresetShape property.

Example

This example sets the shape of all WordArt on myDocument to a chevron whose center points down.

VBA Copy code Copy code
Set myDocument = ActiveDocument
For Each s In myDocument.Shapes
 If s.Type = msoTextEffect Then
 s.TextEffect.PresetShape = msoTextEffectShapeChevronDown
 End If
Next

See also

Concepts

TextEffectFormat Object

Other resources

TextEffectFormat Object Members


TextEffectFormat.PresetTextEffect Property (Word)

 Copy code hover
[image]

TextEffectFormat.PresetTextEffect Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the style of the specified WordArt. The values for this property correspond to the formats in the WordArt Gallery dialog box (Insert menu), numbered from left to right, top to bottom. Read/write MsoPresetTextEffect.

Syntax

expression .PresetTextEffect

expression Required. A variable that represents a TextEffectFormat object.

Remarks

Setting the PresetTextEffect property automatically sets many other formatting properties of the specified shape.

Example

This example sets the style for all WordArt on myDocument to the first style listed in the WordArt Gallery dialog box.

VBA Copy code Copy code
Set myDocument = ActiveDocument
For Each s In myDocument.Shapes
 If s.Type = msoTextEffect Then
 s.TextEffect.PresetTextEffect = msoTextEffect1
 End If
Next

See also

Concepts

TextEffectFormat Object

Other resources

TextEffectFormat Object Members


TextEffectFormat.RotatedChars Property (Word)

 Copy code hover
[image]

TextEffectFormat.RotatedChars Property (Word)
See also Send feedback

Published: July 16, 2012

MsoTrue if characters in the specified WordArt are rotated 90 degrees relative to the WordArt's bounding shape. MsoFalse if characters in the specified WordArt retain their original orientation relative to the bounding shape. Read/write MsoTriState.

Syntax

expression .RotatedChars

expression Required. A variable that represents a TextEffectFormat object.

Remarks

If the WordArt has horizontal text, setting the RotatedChars property to True rotates the characters 90 degrees counterclockwise. If the WordArt has vertical text, setting the RotatedChars property to False rotates the characters 90 degrees clockwise. Use the ToggleVerticalText method to switch between horizontal and vertical text flow.

The Flip method and Rotation property of the Shape object and the RotatedChars property and ToggleVerticalText method of the TextEffectFormat object all affect the character orientation and direction of text flow in a Shape object that represents WordArt. You may have to experiment to find out how to combine the effects of these properties and methods to get the result you want.

Example

This example adds WordArt that contains the text "Test" to myDocument and rotates the characters 90 degrees counterclockwise.

VBA Copy code Copy code
Set myDocument = ActiveDocument
Set newWordArt = _
 myDocument.Shapes.AddTextEffect( _
 PresetTextEffect:=msoTextEffect1, _
 Text:="Test", _
 FontName:="Arial Black", FontSize:=36, _
 FontBold:=False, FontItalic:=False, Left:=10, Top:=10)
newWordArt.TextEffect.RotatedChars = True

See also

Concepts

TextEffectFormat Object

Other resources

TextEffectFormat Object Members


TextEffectFormat.Text Property (Word)

 Copy code hover
[image]

TextEffectFormat.Text Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the text in the specified object. Read/write String.

Syntax

expression .Text

expression A variable that represents a TextEffectFormat object.

Remarks

The Text property returns the plain, unformatted text of the selection or range. When you set this property, the text of the range or selection is replaced.

See also

Concepts

TextEffectFormat Object

Other resources

TextEffectFormat Object Members


TextEffectFormat.Tracking Property (Word)

 Copy code hover
[image]

TextEffectFormat.Tracking Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the ratio of the horizontal space allotted to each character in the specified WordArt in relation to the width of the character. Read/write Single.

Syntax

expression .Tracking

expression Required. A variable that represents a TextEffectFormat object.

Remarks

This property can be a value from 0 (zero) through 5. (Large values for this property specify ample space between characters; values less than 1 can produce character overlap.) The following table gives the values of the Tracking property that correspond to the settings available in the user interface.

User interface setting | Equivalent Tracking property value
Very Tight | 0.8
Tight | 0.9
Normal | 1.0
Loose | 1.2
Very Loose | 1.5

Example

This example adds WordArt that contains the text "Test" to the active document and specifies that the characters be very tightly spaced.

VBA Copy code Copy code
Set newWordArt = ActiveDocument.Shapes.AddTextEffect( _
 PresetTextEffect:=msoTextEffect1, Text:="Test", _
 FontName:="Arial Black", FontSize:=36, FontBold:=False, _
 FontItalic:=False, Left:=100, Top:=100)
newWordArt.TextEffect.Tracking = 0.8

See also

Concepts

TextEffectFormat Object

Other resources

TextEffectFormat Object Members


TextEffectFormat Methods (Word)

 Copy code hover
[image]

TextEffectFormat Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
ToggleVerticalText | Switches the text flow in the specified WordArt from horizontal to vertical, or vice versa.


TextEffectFormat.ToggleVerticalText Method (Word)

 Copy code hover
[image]

TextEffectFormat.ToggleVerticalText Method (Word)
See also Send feedback

Published: July 16, 2012

Switches the text flow in the specified WordArt from horizontal to vertical, or vice versa.

Syntax

expression .ToggleVerticalText

expression Required. A variable that represents a TextEffectFormat object.

Remarks

Using the ToggleVerticalText method swaps the values of the Width and Height properties of the Shape object that represents the WordArt and leaves the Left and Top properties unchanged.

The Flip method and Rotation property of the Shape object and the RotatedChars property and ToggleVerticalText method of the TextEffectFormat object all affect the character orientation and the direction of text flow in a Shape object that represents WordArt. You may have to experiment to find out how to combine the effects of these properties and methods to get the result you want.

Example

This example adds WordArt that contains the text "Test" to the active document and switches from horizontal text flow (the default for the specified WordArt style, msoTextEffect1) to vertical text flow.

VBA Copy code Copy code
Dim newWordArt As Shape

Set newWordArt = _
 ActiveDocument.Shapes.AddTextEffect( _
 PresetTextEffect:=msoTextEffect1, Text:="Test", _
 FontName:="Arial Black", FontSize:=36, FontBold:=False, _
 FontItalic:=False, Left:=100, Top:=100)
newWordArt.TextEffect.ToggleVerticalText

See also

Concepts

TextEffectFormat Object

Other resources

TextEffectFormat Object Members


TextFrame Object (Word)

 Copy code hover
[image]

TextFrame Object (Word)
See also Send feedback

Published: July 16, 2012

Represents the text frame in a Shape object. The TextFrame object contains the text in the text frame and the properties that control the margins and orientation of the text frame.

Remarks

Use the TextFrame property to return the TextFrame object for a shape. The TextRange property returns a Range object that represents the range of text inside the specified text frame. The following example adds text to the text frame of shape one in the active document.

VBA Copy code Copy code
ActiveDocument.Shapes(1).TextFrame.TextRange.Text = "My Text"
Note Note

Some shapes do not support attached text (lines, freeforms, pictures, and OLE objects, for example). If you attempt to return or set properties that control text in a text frame for those objects, an error occurs.

Use the HasText property to determine whether the text frame contains text, as shown in the following example.

VBA Copy code Copy code
For Each s In ActiveDocument.Shapes
 With s.TextFrame
 If .HasText Then MsgBox .TextRange.Text
 End With
Next

Text frames can be linked together so that the text flows from the text frame of one shape into the text frame of another shape. Use the Next and Previous properties to link text frames. The following example creates a text box (a rectangle with a text frame) and adds some text to it. It then creates another text box and links the two text frames together so that the text flows from the first text frame into the second one.

VBA Copy code Copy code
Set myTB1 = ActiveDocument.Shapes.AddTextbox _
 (msoTextOrientationHorizontal, 72, 72, 72, 36)
myTB1.TextFrame.TextRange = _
 "This is some text. This is some more text."
Set myTB2 = ActiveDocument.Shapes.AddTextbox _
 (msoTextOrientationHorizontal, 72, 144, 72, 36)
myTB1.TextFrame.Next = myTB2.TextFrame

Use the ContainingRange property to return a Range object that represents the entire story that flows between linked text frames. The following example checks the spelling of the text in TextBox 3 and of any other text that is linked to TextBox 3.

VBA Copy code Copy code
Set myStory = ActiveDocument.Shapes("TextBox 3") _
 .TextFrame.ContainingRange
myStory.CheckSpelling

See also

Concepts

Word Object Model Reference

Other resources

TextFrame Object Members


TextFrame Members (Word)

 Copy code hover
[image]

TextFrame Members (Word)
Send feedback

Published: July 16, 2012

Represents the text frame in a Shape object. The TextFrame object contains the text in the text frame and the properties that control the margins and orientation of the text frame.

Methods

Name | Description
BreakForwardLink | Breaks the forward link for the specified text frame, if such a link exists.
DeleteText | Deletes the text from a text frame and all the associated properties of the text, including font attributes.
ValidLinkTarget | Determines whether the text frame of one shape can be linked to the text frame of another shape. .

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
AutoSize | Returns or sets a Long that represents whether a text frame is sized automatically. Read/write.
Column | This object, member, or enumeration is deprecated and is not intended to be used in your code.
ContainingRange | Returns a Range object that represents the entire story in a series of shapes with linked text frames that the specified text frame belongs to. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
HasText | True if the specified shape has text associated with it. Read-only Boolean.
HorizontalAnchor | Returns or sets the horizontal alignment of text in a text frame. Read/write MsoHorizontalAnchor.
MarginBottom | Returns or sets the distance (in points) between the bottom of the text frame and the bottom of the inscribed rectangle of the shape that contains the text. Read/write Single.
MarginLeft | Returns or sets the distance (in points) between the left edge of the text frame and the left edge of the inscribed rectangle of the shape that contains the text. Read/write Single.
MarginRight | Returns or sets the distance (in points) between the right edge of the text frame and the right edge of the inscribed rectangle of the shape that contains the text. Read/write Single.
MarginTop | Returns or sets the distance (in points) between the top of the text frame and the top of the inscribed rectangle of the shape that contains the text. Read/write Single.
Next | Returns a TextFrame object that represents the next text frame in a collection of shapes. Read-only.
NoTextRotation | True if text in the text frame should not rotate when the shape is rotated. Read/write MsoTriState.
Orientation | Returns or sets the orientation of the text inside the frame. Read/write MsoTextOrientation.
Overflowing | True if the text inside the specified text frame doesn't all fit within the frame. Read-only Boolean.
Parent | Returns a Shape object that represents the parent shape of the text frame.
PathFormat | Returns or sets the path type for the specified text frame. Read/write MsoPathType.
Previous | Returns a TextFrame object that represents the previous text frame in a collection of shapes. Read-only.
TextRange | Returns a Range object that represents the text in the specified text frame.
ThreeD | Returns a ThreeDFormat object that contains 3-D effect formatting properties for the specified text frame. Read-only.
VerticalAnchor | Returns or sets an MsoVerticalAnchor constant that represents the vertical alignment of the text within a shape. Read/write.
WarpFormat | Returns or sets the warp format (how the text is warped) for the specified text frame. Read/write MsoWarpFormat.
WordWrap | True if Microsoft Word wraps Latin text in the middle of a word in the specified text frames. Read/write Long. .


TextFrame Properties (Word)

 Copy code hover
[image]

TextFrame Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
AutoSize | Returns or sets a Long that represents whether a text frame is sized automatically. Read/write.
Column | This object, member, or enumeration is deprecated and is not intended to be used in your code.
ContainingRange | Returns a Range object that represents the entire story in a series of shapes with linked text frames that the specified text frame belongs to. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
HasText | True if the specified shape has text associated with it. Read-only Boolean.
HorizontalAnchor | Returns or sets the horizontal alignment of text in a text frame. Read/write MsoHorizontalAnchor.
MarginBottom | Returns or sets the distance (in points) between the bottom of the text frame and the bottom of the inscribed rectangle of the shape that contains the text. Read/write Single.
MarginLeft | Returns or sets the distance (in points) between the left edge of the text frame and the left edge of the inscribed rectangle of the shape that contains the text. Read/write Single.
MarginRight | Returns or sets the distance (in points) between the right edge of the text frame and the right edge of the inscribed rectangle of the shape that contains the text. Read/write Single.
MarginTop | Returns or sets the distance (in points) between the top of the text frame and the top of the inscribed rectangle of the shape that contains the text. Read/write Single.
Next | Returns a TextFrame object that represents the next text frame in a collection of shapes. Read-only.
NoTextRotation | True if text in the text frame should not rotate when the shape is rotated. Read/write MsoTriState.
Orientation | Returns or sets the orientation of the text inside the frame. Read/write MsoTextOrientation.
Overflowing | True if the text inside the specified text frame doesn't all fit within the frame. Read-only Boolean.
Parent | Returns a Shape object that represents the parent shape of the text frame.
PathFormat | Returns or sets the path type for the specified text frame. Read/write MsoPathType.
Previous | Returns a TextFrame object that represents the previous text frame in a collection of shapes. Read-only.
TextRange | Returns a Range object that represents the text in the specified text frame.
ThreeD | Returns a ThreeDFormat object that contains 3-D effect formatting properties for the specified text frame. Read-only.
VerticalAnchor | Returns or sets an MsoVerticalAnchor constant that represents the vertical alignment of the text within a shape. Read/write.
WarpFormat | Returns or sets the warp format (how the text is warped) for the specified text frame. Read/write MsoWarpFormat.
WordWrap | True if Microsoft Word wraps Latin text in the middle of a word in the specified text frames. Read/write Long. .


TextFrame.Application Property (Word)

 Copy code hover
[image]

TextFrame.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a TextFrame object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

TextFrame Object

Other resources

TextFrame Object Members


TextFrame.AutoSize Property (Word)

 Copy code hover
[image]

TextFrame.AutoSize Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Long that represents whether a text frame is sized automatically. Read/write.

Syntax

expression .AutoSize

expression Required. A variable that represents a TextFrame object.

See also

Concepts

TextFrame Object

Other resources

TextFrame Object Members


TextFrame.Column Property (Word)

 Copy code hover
[image]

TextFrame.Column Property (Word)
See also Send feedback

Published: July 16, 2012

This object, member, or enumeration is deprecated and is not intended to be used in your code.

See also

Concepts

TextFrame Object

Other resources

TextFrame Object Members


TextFrame.ContainingRange Property (Word)

 Copy code hover
[image]

TextFrame.ContainingRange Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the entire story in a series of shapes with linked text frames that the specified text frame belongs to. Read-only.

Syntax

expression .ContainingRange

expression A variable that represents a TextFrame object.

Example

This example checks the spelling in TextBox 1 and any other text in text frames that are linked to TextBox 1.

VBA Copy code Copy code
Dim rngStory As Range

Set rngStory = ActiveDocument.Shapes("TextBox 1") _
 .TextFrame.ContainingRange

rngStory.CheckSpelling

See also

Concepts

TextFrame Object

Other resources

TextFrame Object Members


TextFrame.Creator Property (Word)

 Copy code hover
[image]

TextFrame.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a TextFrame object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

TextFrame Object

Other resources

TextFrame Object Members


TextFrame.HasText Property (Word)

 Copy code hover
[image]

TextFrame.HasText Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified shape has text associated with it. Read-only Boolean.

Syntax

expression .HasText

expression A variable that represents a TextFrame object.

Example

If the second shape on the active document contains text, this example displays a message if the text overflows its frame.

VBA Copy code Copy code
Dim docActive As Document

Set docActive = ActiveDocument
With docActive.Shapes(2).TextFrame
 If .HasText = True Then
 If .Overflowing = True Then
 Msgbox "Text overflows the frame."
 End If
 End If
End With

See also

Concepts

TextFrame Object

Other resources

TextFrame Object Members


TextFrame.HorizontalAnchor Property (Word)

 Copy code hover
[image]

TextFrame.HorizontalAnchor Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the horizontal alignment of text in a text frame. Read/write MsoHorizontalAnchor.

Version Information

Version Added: Word 2010

Syntax

expression .HorizontalAnchor

expression A variable that represents a TextFrame object.

Example

The following code example shows how to set the alignment for the first shape in the active document to top center.

VBA Copy code Copy code
Public Sub HorizontalAnchor_Example()

 With ActiveDocument.Shapes(1)
 .TextFrame.HorizontalAnchor = msoAnchorCenter
 .TextFrame.VerticalAnchor = msoAnchorTop
 End With

End Sub

See also

Concepts

TextFrame Object

Other resources

TextFrame Object Members


TextFrame.MarginBottom Property (Word)

 Copy code hover
[image]

TextFrame.MarginBottom Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the distance (in points) between the bottom of the text frame and the bottom of the inscribed rectangle of the shape that contains the text. Read/write Single.

Syntax

expression .MarginBottom

expression An expression that returns a TextFrame object.

Example

This example adds a rectangle to myDocument, adds text to the rectangle, and then sets the margins for the text frame.

VBA Copy code Copy code
Set myDocument = ActiveDocument
With myDocument.Shapes.AddShape(msoShapeRectangle, _
 0, 0, 250, 140).TextFrame
 .TextRange.Text = "Here is some test text"
 .MarginBottom = 0
 .MarginLeft = 100
 .MarginRight = 0
 .MarginTop = 20
End With

See also

Concepts

TextFrame Object

Other resources

TextFrame Object Members


TextFrame.MarginLeft Property (Word)

 Copy code hover
[image]

TextFrame.MarginLeft Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the distance (in points) between the left edge of the text frame and the left edge of the inscribed rectangle of the shape that contains the text. Read/write Single.

Syntax

expression .MarginLeft

expression An expression that returns a TextFrame object.

Example

This example adds a rectangle to myDocument, adds text to the rectangle, and then sets the margins for the text frame.

VBA Copy code Copy code
Set myDocument = ActiveDocument
With myDocument.Shapes.AddShape(msoShapeRectangle, _
 0, 0, 250, 140).TextFrame
 .TextRange.Text = "Here is some test text"
 .MarginBottom = 0
 .MarginLeft = 100
 .MarginRight = 0
 .MarginTop = 20
End With

See also

Concepts

TextFrame Object

Other resources

TextFrame Object Members


TextFrame.MarginRight Property (Word)

 Copy code hover
[image]

TextFrame.MarginRight Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the distance (in points) between the right edge of the text frame and the right edge of the inscribed rectangle of the shape that contains the text. Read/write Single.

Syntax

expression .MarginRight

expression An expression that returns a TextFrame object.

Example

This example adds a rectangle to myDocument, adds text to the rectangle, and then sets the margins for the text frame.

VBA Copy code Copy code
Set myDocument = ActiveDocument
With myDocument.Shapes.AddShape(msoShapeRectangle, _
 0, 0, 250, 140).TextFrame
 .TextRange.Text = "Here is some test text"
 .MarginBottom = 0
 .MarginLeft = 100
 .MarginRight = 0
 .MarginTop = 20
End With

See also

Concepts

TextFrame Object

Other resources

TextFrame Object Members


TextFrame.MarginTop Property (Word)

 Copy code hover
[image]

TextFrame.MarginTop Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the distance (in points) between the top of the text frame and the top of the inscribed rectangle of the shape that contains the text. Read/write Single.

Syntax

expression .MarginTop

expression An expression that returns a TextFrame object.

Example

This example adds a rectangle to myDocument, adds text to the rectangle, and then sets the margins for the text frame.

VBA Copy code Copy code
Set myDocument = ActiveDocument
With myDocument.Shapes.AddShape(msoShapeRectangle, _
 0, 0, 250, 140).TextFrame
 .TextRange.Text = "Here is some test text"
 .MarginBottom = 0
 .MarginLeft = 100
 .MarginRight = 0
 .MarginTop = 20
End With

See also

Concepts

TextFrame Object

Other resources

TextFrame Object Members


TextFrame.Next Property (Word)

 Copy code hover
[image]

TextFrame.Next Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a TextFrame object that represents the next text frame in a collection of shapes. Read-only.

Syntax

expression .Next

expression A variable that represents a TextFrame object.

See also

Concepts

TextFrame Object

Other resources

TextFrame Object Members


TextFrame.NoTextRotation Property (Word)

 Copy code hover
[image]

TextFrame.NoTextRotation Property (Word)
See also Send feedback

Published: July 16, 2012

True if text in the text frame should not rotate when the shape is rotated. Read/write MsoTriState.

Version Information

Version Added: Word 2010

Syntax

expression .NoTextRotation

expression A variable that represents a TextFrame object.

Remarks

Only the MsoTriState constants msoFalse and msoTrue can be used to set this property.

See also

Concepts

TextFrame Object

Other resources

TextFrame Object Members


TextFrame.Orientation Property (Word)

 Copy code hover
[image]

TextFrame.Orientation Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the orientation of the text inside the frame. Read/write MsoTextOrientation.

Syntax

expression .Orientation

expression Required. A variable that represents a TextFrame object.

Remarks

Some of the MsoTextOrientation constants may not be available to you, depending on the language support (U.S. English, for example) that you have selected or installed.

You can set the orientation for a text frame or for a range or selection that happens to occur inside a text frame. For information about the difference between a text frame and a text box, see the TextFrame object.

Example

This example creates a new document, inserts text into it, uses this text to create a text box, and then sets the orientation of the text frame so that the text slopes upward.

VBA Copy code Copy code
Set mydoc = Documents.Add
Selection.TypeText "This is some text."
mydoc.Content.Select
Selection.CreateTextbox
mydoc.Shapes(1).TextFrame.Orientation = msoTextOrientationUpward

See also

Concepts

TextFrame Object

Other resources

TextFrame Object Members


TextFrame.Overflowing Property (Word)

 Copy code hover
[image]

TextFrame.Overflowing Property (Word)
See also Send feedback

Published: July 16, 2012

True if the text inside the specified text frame doesn't all fit within the frame. Read-only Boolean.

Syntax

expression .Overflowing

expression An expression that returns a TextFrame object.

Example

This example checks to see whether the text in MyTextBox is overflowing its text frame. If so, the example adds another text box and links the two text boxes so that the text flows into the next one.

VBA Copy code Copy code
Set myTBox = ActiveDocument.Shapes("MyTextBox")
If myTBox.TextFrame.Overflowing = True Then
 Set nextTBox = ActiveDocument.Shapes. _
 AddTextbox(msoTextOrientationHorizontal, 72, 72, 100, 200)
 MyTBox.TextFrame.Next = nextTBox.TextFrame
End If

See also

Concepts

TextFrame Object

Other resources

TextFrame Object Members


TextFrame.Parent Property (Word)

 Copy code hover
[image]

TextFrame.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Shape object that represents the parent shape of the text frame.

Syntax

expression .Parent

expression Required. A variable that represents a TextFrame object.

See also

Concepts

TextFrame Object

Other resources

TextFrame Object Members


TextFrame.PathFormat Property (Word)

 Copy code hover
[image]

TextFrame.PathFormat Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the path type for the specified text frame. Read/write MsoPathType.

Version Information

Version Added: Word 2010

Syntax

expression .PathFormat

expression A variable that represents a TextFrame object.

Remarks

The value of the PathFormat property can be one of the following MsoPathType constants:

  • msoPathType1

  • msoPathType2

  • msoPathType3

  • msoPathType4

  • msoPathTypeMixed

  • msoPathTypeNone

The value msoPathTypeMixed cannot be set. Setting the value msoPathTypeNone removes any existing path.

See also

Concepts

TextFrame Object

Other resources

TextFrame Object Members


TextFrame.Previous Property (Word)

 Copy code hover
[image]

TextFrame.Previous Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a TextFrame object that represents the previous text frame in a collection of shapes. Read-only.

Syntax

expression .Previous

expression A variable that represents a TextFrame object.

See also

Concepts

TextFrame Object

Other resources

TextFrame Object Members


TextFrame.TextRange Property (Word)

 Copy code hover
[image]

TextFrame.TextRange Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the text in the specified text frame.

Syntax

expression .TextRange

expression An expression that returns a TextFrame object.

Example

This example adds a text box to the active document and then adds text to the text box.

VBA Copy code Copy code
Set myTBox = ActiveDocument.Shapes _
 .AddTextBox(Orientation:=msoTextOrientationHorizontal, _
 Left:=100, Top:=100, Width:=300, Height:=200)
myTBox.TextFrame.TextRange = "Test Box"

This example adds text to TextBox 1 in the active document.

VBA Copy code Copy code
ActiveDocument.Shapes("TextBox 1").TextFrame.TextRange _
 .InsertAfter("New Text")

This example returns the text from TextBox 1 in the active document and displays it in a message box.

VBA Copy code Copy code
MsgBox ActiveDocument.Shapes("TextBox 1").TextFrame.TextRange.Text

See also

Concepts

TextFrame Object

Other resources

TextFrame Object Members


TextFrame.ThreeD Property (Word)

 Copy code hover
[image]

TextFrame.ThreeD Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a ThreeDFormat object that contains 3-D effect formatting properties for the specified text frame. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .ThreeD

expression A variable that represents a TextFrame object.

See also

Concepts

TextFrame Object

Other resources

TextFrame Object Members


TextFrame.VerticalAnchor Property (Word)

 Copy code hover
[image]

TextFrame.VerticalAnchor Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets an MsoVerticalAnchor constant that represents the vertical alignment of the text within a shape. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .VerticalAnchor

expression An expression that returns a TextFrame object.

See also

Concepts

TextFrame Object

Other resources

TextFrame Object Members


TextFrame.WarpFormat Property (Word)

 Copy code hover
[image]

TextFrame.WarpFormat Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the warp format (how the text is warped) for the specified text frame. Read/write MsoWarpFormat.

Version Information

Version Added: Word 2010

Syntax

expression .WarpFormat

expression A variable that represents a TextFrame object.

Example

The following code example shows how to set the warp format for the first shape on the active document.

VBA Copy code Copy code
ActiveDocument.Shapes(1).TextFrame.WarpFormat = msoWarpFormat15

See also

Concepts

TextFrame Object

Other resources

TextFrame Object Members


TextFrame.WordWrap Property (Word)

 Copy code hover
[image]

TextFrame.WordWrap Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word wraps Latin text in the middle of a word in the specified text frames. Read/write Long. .

Syntax

expression .WordWrap

expression Required. A variable that represents a TextFrame object.

Remarks

This property returns wdUndefined if it's set to True for some of the specified text in the specified text frame and false for other text.

Note Note

This property may not be available to you, depending on the language support (U.S. English, for example) that you have selected or installed.

See also

Concepts

TextFrame Object

Other resources

TextFrame Object Members


TextFrame Methods (Word)

 Copy code hover
[image]

TextFrame Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
BreakForwardLink | Breaks the forward link for the specified text frame, if such a link exists.
DeleteText | Deletes the text from a text frame and all the associated properties of the text, including font attributes.
ValidLinkTarget | Determines whether the text frame of one shape can be linked to the text frame of another shape. .


TextFrame.BreakForwardLink Method (Word)

 Copy code hover
[image]

TextFrame.BreakForwardLink Method (Word)
See also Send feedback

Published: July 16, 2012

Breaks the forward link for the specified text frame, if such a link exists.

Syntax

expression .BreakForwardLink

expression Required. A variable that represents a TextFrame object.

Remarks

Applying this method to a shape in the middle of a chain of shapes with linked text frames will break the chain, leaving two sets of linked shapes. All of the text, however, will remain in the first series of linked shapes.

Example

This example creates a new document adds a chain of three linked text boxes to it, and then breaks the link after the second text box.

VBA Copy code Copy code
Dim shapeTextbox1 As Shape
Dim shapeTextbox2 As Shape
Dim shapeTextbox3 As Shape

Documents.Add

Set shapeTextbox1 = ActiveDocument.Shapes.AddTextbox _
 (Orientation:=msoTextOrientationHorizontal, _
 Left:=InchesToPoints(1.5), _
 Top:=InchesToPoints(0.5), _
 Width:=InchesToPoints(1), _
 Height:=InchesToPoints(0.5))
shapeTextbox1.TextFrame.TextRange = "This is some text. " _
 & "This is some more text. This is even more text."

Set shapeTextbox2 = ActiveDocument.Shapes.AddTextbox _
 (Orientation:=msoTextOrientationHorizontal, _
 Left:=InchesToPoints(1.5), _
 Top:=InchesToPoints(1.5), _
 Width:=InchesToPoints(1), _
 Height:=InchesToPoints(0.5))

Set shapeTextbox3 = ActiveDocument.Shapes.AddTextbox _
 (Orientation:=msoTextOrientationHorizontal, _
 Left:=InchesToPoints(1.5), _
 Top:=InchesToPoints(2.5), _
 Width:=InchesToPoints(1), _
 Height:=InchesToPoints(0.5))

shapeTextbox1.TextFrame.Next = shapeTextbox2.TextFrame
shapeTextbox2.TextFrame.Next = shapeTextbox3.TextFrame
MsgBox "Textboxes 1, 2, and 3 are linked."
shapeTextbox2.TextFrame.BreakForwardLink

See also

Concepts

TextFrame Object

Other resources

TextFrame Object Members


TextFrame.DeleteText Method (Word)

 Copy code hover
[image]

TextFrame.DeleteText Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the text from a text frame and all the associated properties of the text, including font attributes.

Version Information

Version Added: Word 2010

Syntax

expression .DeleteText

expression A variable that represents a TextFrame object.

Example

The following code example deletes the text from the first shape in the active document, if that shape contains text.

VBA Copy code Copy code
Public Sub DeleteText_Example()
 ActiveDocument.Shapes(1).TextFrame.DeleteText
End Sub

See also

Concepts

TextFrame Object

Other resources

TextFrame Object Members


TextFrame.ValidLinkTarget Method (Word)

 Copy code hover
[image]

TextFrame.ValidLinkTarget Method (Word)
See also Send feedback

Published: July 16, 2012

Determines whether the text frame of one shape can be linked to the text frame of another shape. .

Syntax

expression .ValidLinkTarget(TargetTextFrame)

expression Required. A variable that represents a TextFrame object.

Parameters

Name | Required/Optional | Data Type | Description
TargetTextFrame | Required | TextFrame | The target text frame to which you want to link the text frame returned by expression.

Return Value

Boolean

Remarks

This method returns True if TargetTextFrame is a valid target and returns False if TargetTextFrame already contains text, is already linked, or if the shape doesn't support attached text.

Example

This example checks to see whether the text frames for the first and second shapes in the active document can be linked to one another. If so, the example links the two text frames.

VBA Copy code Copy code
Dim textFrame1 As TextFrame
Dim textFrame2 As TextFrame

Set textFrame1 = ActiveDocument.Shapes(1).TextFrame
Set textFrame2 = ActiveDocument.Shapes(2).TextFrame
If textFrame1.ValidLinkTarget(textFrame2) = True Then
 textFrame1.Next = textFrame2
End If

See also

Concepts

TextFrame Object

Other resources

TextFrame Object Members


TextInput Object (Word)

 Copy code hover
[image]

TextInput Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a single text form field.

Remarks

Use FormFields(Index), where Index is either the bookmark name associated with the text form field or the index number, to return a FormField object. Use the TextInput property with the FormField object to return a TextInput object. The following example deletes the contents of the text form field named "Text1" in the active document.

VBA Copy code Copy code
ActiveDocument.FormFields("Text1").TextInput.Clear

The index number represents the position of the form field in the FormFields collection. The following example checks the type of the first form field in the active document. If the form field is a text form field, the example sets "Mission Critical" as the value of the field.

VBA Copy code Copy code
If ActiveDocument.FormFields(1).Type = wdFieldFormTextInput Then
 ActiveDocument.FormFields(1).Result = "Mission Critical"
End If

The following example determines whether the ffield variable represents a valid text form field in the active document before it sets the default text.

VBA Copy code Copy code
Set ffield = ActiveDocument.FormFields(1).TextInput
If ffield.Valid = True Then
 ffield.Default = "Type your name here"
Else
 MsgBox "First field is not a text box"
End If

Use the Add method with the FormFields object to add a text form field. The following example adds a text form field at the beginning of the active document and then sets the name of the form field to "FirstName."

VBA Copy code Copy code
Set ffield = ActiveDocument.FormFields.Add( _
 Range:=ActiveDocument.Range(Start:=0, End:=0), _
 Type:=wdFieldFormTextInput)
ffield.Name = "FirstName"

See also

Concepts

Word Object Model Reference

Other resources

TextInput Object Members


TextInput Members (Word)

 Copy code hover
[image]

TextInput Members (Word)
Send feedback

Published: July 16, 2012

Represents a single text form field.

Methods

Name | Description
Clear | Deletes the text from the specified text form field.
EditType | Sets options for the specified text form field.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Default | Returns or sets the text that represents the default text box contents. Read/write String.
Format | Returns the text formatting for the specified text box. Read-only String.
Parent | Returns an Object that represents the parent object of the specified TextInput object.
Type | Returns the type of text form field. Read-only WdTextFormFieldType.
Valid | True if the specified form field object is a valid check box form field. Read-only Boolean. .
Width | Returns or sets the width, in points, of the specified text input field. Read/write Long.


TextInput Properties (Word)

 Copy code hover
[image]

TextInput Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Default | Returns or sets the text that represents the default text box contents. Read/write String.
Format | Returns the text formatting for the specified text box. Read-only String.
Parent | Returns an Object that represents the parent object of the specified TextInput object.
Type | Returns the type of text form field. Read-only WdTextFormFieldType.
Valid | True if the specified form field object is a valid check box form field. Read-only Boolean. .
Width | Returns or sets the width, in points, of the specified text input field. Read/write Long.


TextInput.Application Property (Word)

 Copy code hover
[image]

TextInput.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a TextInput object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

TextInput Object

Other resources

TextInput Object Members


TextInput.Creator Property (Word)

 Copy code hover
[image]

TextInput.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a TextInput object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

TextInput Object

Other resources

TextInput Object Members


TextInput.Default Property (Word)

 Copy code hover
[image]

TextInput.Default Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the text that represents the default text box contents. Read/write String.

Syntax

expression .Default

expression Required. A variable that represents a TextInput object.

See also

Concepts

TextInput Object

Other resources

TextInput Object Members


TextInput.Format Property (Word)

 Copy code hover
[image]

TextInput.Format Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the text formatting for the specified text box. Read-only String.

Syntax

expression .Format

expression Required. A variable that represents a TextInput object.

Example

This example displays the text formatting in the first field of the active document.

VBA Copy code Copy code
If ActiveDocument.FormFields(1).Type = wdFieldFormTextInput Then
 MsgBox ActiveDocument.FormFields(1).TextInput.Format
Else
 MsgBox "First field is not a text form field"
End If

See also

Concepts

TextInput Object

Other resources

TextInput Object Members


TextInput.Parent Property (Word)

 Copy code hover
[image]

TextInput.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified TextInput object.

Syntax

expression .Parent

expression Required. A variable that represents a TextInput object.

See also

Concepts

TextInput Object

Other resources

TextInput Object Members


TextInput.Type Property (Word)

 Copy code hover
[image]

TextInput.Type Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the type of text form field. Read-only WdTextFormFieldType.

Syntax

expression .Type

expression Required. A variable that represents a TextInput object.

See also

Concepts

TextInput Object

Other resources

TextInput Object Members


TextInput.Valid Property (Word)

 Copy code hover
[image]

TextInput.Valid Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified form field object is a valid check box form field. Read-only Boolean. .

Syntax

expression .Valid

expression A variable that represents a TextInput object.

Example

This example determines whether the first form field in the active document is a text form field. If the Valid property is True, the contents of the text form field are changed to "Hello."

VBA Copy code Copy code
If ActiveDocument.FormFields(1).TextInput.Valid = True Then
 ActiveDocument.FormFields(1).Result = "Hello"
End If

See also

Concepts

TextInput Object

Other resources

TextInput Object Members


TextInput.Width Property (Word)

 Copy code hover
[image]

TextInput.Width Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the width, in points, of the specified text input field. Read/write Long.

Syntax

expression .Width

expression A variable that represents a TextInput object.

See also

Concepts

TextInput Object

Other resources

TextInput Object Members


TextInput Methods (Word)

 Copy code hover
[image]

TextInput Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Clear | Deletes the text from the specified text form field.
EditType | Sets options for the specified text form field.


TextInput.Clear Method (Word)

 Copy code hover
[image]

TextInput.Clear Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the text from the specified text form field.

Syntax

expression .Clear

expression Required. A variable that represents a TextInput object.

Example

This example protects the document for forms and deletes the text from the first form field if the field is a text form field.

VBA Copy code Copy code
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True
If ActiveDocument.FormFields(1).Type = wdFieldFormTextInput Then
 ActiveDocument.FormFields(1).TextInput.Clear
End If

See also

Concepts

TextInput Object

Other resources

TextInput Object Members


TextInput.EditType Method (Word)

 Copy code hover
[image]

TextInput.EditType Method (Word)
See also Send feedback

Published: July 16, 2012

Sets options for the specified text form field.

Syntax

expression .EditType(Type, Default, Format, Enabled)

expression Required. A variable that represents a TextInput object.

Parameters

Name | Required/Optional | Data Type | Description
Type | Required | WdTextFormFieldType | The text box type.
Default | Optional | Variant | The default text that appears in the text box.
Format | Optional | Variant | The formatting string used to format the text, number, or date (for example, "0.00," "Title Case," or "M/d/yy"). For more examples of formats, see the list of formats for the specified text form field type in the Text Form Field Options dialog box.
Enabled | Optional | Variant | True to enable the form field for text entry.

Example

This example adds a text form field named "Today" at the beginning of the active document. The EditType method is used to set the type to wdCurrentDateText and set the date format to "M/d/yy."

VBA Copy code Copy code
With ActiveDocument.FormFields.Add _
 (Range:=ActiveDocument.Range(0, 0), _
 Type:=wdFieldFormTextInput)
 .Name = "Today"
 .TextInput.EditType Type:=wdCurrentDateText, _
 Format:="M/d/yy", Enabled:=False
End With

See also

Concepts

TextInput Object

Other resources

TextInput Object Members


TextRetrievalMode Object (Word)

 Copy code hover
[image]

TextRetrievalMode Object (Word)
See also Send feedback

Published: July 16, 2012

Represents options that control how text is retrieved from a Range object.

Remarks

Use the TextRetrievalMode property to return a TextRetrievalMode object. The following example displays the text of the first sentence in the active document, excluding field codes and hidden text.

VBA Copy code Copy code
With ActiveDocument.Sentences(1).TextRetrievalMode
 .IncludeHiddenText = False
 .IncludeFieldCodes = False
 MsgBox .Parent.Text
End With

Changing the ViewType, IncludeHiddentText, or IncludeFieldCodes property of the TextRetrievalMode object doesn't change the screen display. Instead, changing one of these properties determines what text is retrieved from a Range object when the Text property is used.

See also

Concepts

Word Object Model Reference

Other resources

TextRetrievalMode Object Members


TextRetrievalMode Members (Word)

 Copy code hover
[image]

TextRetrievalMode Members (Word)
Send feedback

Published: July 16, 2012

Represents options that control how text is retrieved from a Range object.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Duplicate | Returns a read-only TextRetrievalMode object that represents options related to retrieving text from a Range object.
IncludeFieldCodes | True if the text retrieved from the specified range includes field codes. Read/write Boolean.
IncludeHiddenText | True if the text retrieved from the specified range includes hidden text. Read/write Boolean.
Parent | Returns an Object that represents the parent object of the specified TextRetrievalMode object.
ViewType | Returns or sets the view for the TextRetrievalMode object. Read/write WdViewType.


TextRetrievalMode Properties (Word)

 Copy code hover
[image]

TextRetrievalMode Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Duplicate | Returns a read-only TextRetrievalMode object that represents options related to retrieving text from a Range object.
IncludeFieldCodes | True if the text retrieved from the specified range includes field codes. Read/write Boolean.
IncludeHiddenText | True if the text retrieved from the specified range includes hidden text. Read/write Boolean.
Parent | Returns an Object that represents the parent object of the specified TextRetrievalMode object.
ViewType | Returns or sets the view for the TextRetrievalMode object. Read/write WdViewType.


TextRetrievalMode.Application Property (Word)

 Copy code hover
[image]

TextRetrievalMode.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a TextRetrievalMode object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

TextRetrievalMode Object

Other resources

TextRetrievalMode Object Members


TextRetrievalMode.Creator Property (Word)

 Copy code hover
[image]

TextRetrievalMode.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a TextRetrievalMode object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

TextRetrievalMode Object

Other resources

TextRetrievalMode Object Members


TextRetrievalMode.Duplicate Property (Word)

 Copy code hover
[image]

TextRetrievalMode.Duplicate Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a read-only TextRetrievalMode object that represents options related to retrieving text from a Range object.

Syntax

expression .Duplicate

expression Required. A variable that represents a TextRetrievalMode object.

Remarks

You can use the Duplicate property to pick up the settings of all the properties of a duplicated object. You can assign the object returned by the Duplicate property to another object of the same type to apply those settings all at once. Before assigning the duplicate object to another object, you can change any of the properties of the duplicate object without affecting the original text.

See also

Concepts

TextRetrievalMode Object

Other resources

TextRetrievalMode Object Members


TextRetrievalMode.IncludeFieldCodes Property (Word)

 Copy code hover
[image]

TextRetrievalMode.IncludeFieldCodes Property (Word)
See also Send feedback

Published: July 16, 2012

True if the text retrieved from the specified range includes field codes. Read/write Boolean.

Syntax

expression .IncludeFieldCodes

expression An expression that returns a TextRetrievalMode object.

Remarks

The default value is the same as the setting of the Field codes option on the View tab in the Options dialog box (Tools menu) until this property has been set.

Use the Text property with a Range object to retrieve text from the specified range.

Example

This example displays the text of the first paragraph in the active document in a message box. The example uses the IncludeFieldCodes property to exclude field codes.

VBA Copy code Copy code
Dim rngTemp As Range

Set rngTemp = ActiveDocument.Paragraphs(1).Range

rngTemp.TextRetrievalMode.IncludeFieldCodes = False
MsgBox rngTemp.Text

This example excludes field codes and hidden text from the range that refers to the selected text, and then it displays the text in a message box.

VBA Copy code Copy code
Dim rngTemp As Range

If Selection.Type = wdSelectionNormal Then
 Set rngTemp = Selection.Range
 With rngTemp.TextRetrievalMode
 .IncludeHiddenText = False
 .IncludeFieldCodes = False
 End With
 MsgBox rngTemp.Text
End If

See also

Concepts

TextRetrievalMode Object

Other resources

TextRetrievalMode Object Members


TextRetrievalMode.IncludeHiddenText Property (Word)

 Copy code hover
[image]

TextRetrievalMode.IncludeHiddenText Property (Word)
See also Send feedback

Published: July 16, 2012

True if the text retrieved from the specified range includes hidden text. Read/write Boolean.

Syntax

expression .IncludeHiddenText

expression An expression that returns a TextRetrievalMode object.

Remarks

The default value is the same as the current setting of the Hidden text option on the View tab in the Options dialog box (Tools menu) until this property has been set.

Use the Text property with a Range object to retrieve text from the specified range.

Example

This example displays the text of the first sentence in the active document in a message box. The example uses the IncludeHiddenText property to include hidden text.

VBA Copy code Copy code
Dim rngTemp As Range

Set rngTemp = ActiveDocument.Sentences(1)

rngTemp.TextRetrievalMode.IncludeHiddenText = True
MsgBox rngTemp.Text

This example posts a message if the entire selection is formatted as hidden text.

VBA Copy code Copy code
Dim rngTemp As Range

If Selection.Type = wdSelectionNormal Then
 Set rngTemp = Selection.Range

 rngTemp.TextRetrievalMode.IncludeHiddenText = False
 If rngTemp.Text = "" Then MsgBox "Selection is hidden"
End If

See also

Concepts

TextRetrievalMode Object

Other resources

TextRetrievalMode Object Members


TextRetrievalMode.Parent Property (Word)

 Copy code hover
[image]

TextRetrievalMode.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified TextRetrievalMode object.

Syntax

expression .Parent

expression Required. A variable that represents a TextRetrievalMode object.

See also

Concepts

TextRetrievalMode Object

Other resources

TextRetrievalMode Object Members


TextRetrievalMode.ViewType Property (Word)

 Copy code hover
[image]

TextRetrievalMode.ViewType Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the view for the TextRetrievalMode object. Read/write WdViewType.

Syntax

expression .ViewType

expression Required. A variable that represents a TextRetrievalMode object.

Remarks

Changing the view for the TextRetrievalMode object doesn't change the display of a document on the screen. Instead, it determines which characters in the document will be included when a range is retrieved.

Example

This example sets the view for text retrieval to outline view and then displays the contents of the active document in a dialog box. Note that only the text displayed in outline view is retrieved.

VBA Copy code Copy code
Set myText = ActiveDocument.Content
myText.TextRetrievalMode.ViewType = wdOutlineView
Msgbox myText

See also

Concepts

TextRetrievalMode Object

Other resources

TextRetrievalMode Object Members


ThreeDFormat Object (Word)

 Copy code hover
[image]

ThreeDFormat Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a shape's three-dimensional formatting.

Remarks

Use the ThreeD property to return a ThreeDFormat object. The following example adds an oval to the active document and then specifies that the oval be extruded to a depth of 50 points and that the extrusion be purple.

VBA Copy code Copy code
Set myShape = ActiveDocument.Shapes _
 .AddShape(msoShapeOval, 90, 90, 90, 40)
With myShape.ThreeD
 .Visible = True
 .Depth = 50
 ' RGB value for purple
 .ExtrusionColor.RGB = RGB(255, 100, 255)
End With

You cannot apply three-dimensional formatting to some kinds of shapes, such as beveled shapes or multiple-disjoint paths. Most of the properties and methods of the ThreeDFormat object for such a shape will fail.

See also

Concepts

Word Object Model Reference

Other resources

ThreeDFormat Object Members


ThreeDFormat Members (Word)

 Copy code hover
[image]

ThreeDFormat Members (Word)
Send feedback

Published: July 16, 2012

Represents a shape's three-dimensional formatting.

Methods

Name | Description
IncrementRotationHorizontal | Horizontally rotates a shape on the x-axis using the specified incrementation value.
IncrementRotationVertical | Vertically rotates a shape on the y-axis using the specified incrementation value.
IncrementRotationX | Changes the rotation of the specified shape around the x-axis by the specified number of degrees.
IncrementRotationY | Changes the rotation of the specified shape around the y-axis by the specified number of degrees.
IncrementRotationZ | Rotates a shape on the z-axis using the specified incrementation.
ResetRotation | Resets the extrusion rotation around the x-axis and the y-axis to 0 (zero) so that the front of the extrusion faces forward.
SetExtrusionDirection | Sets the direction that the extrusion's sweep path takes away from the extruded shape.
SetPresetCamera | Sets the camera presets for a shape.
SetThreeDFormat | Sets the preset extrusion format.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
BevelBottomDepth | Returns or sets a Single that represents the depth of the bottom bevel. Read/write.
BevelBottomInset | Returns or sets a Single that represents the inset size for the bottom bevel. Read/write.
BevelBottomType | Returns or sets an MsoPresetCamera constant that represents the bevel type for the bottom bevel. Read/write.
BevelTopDepth | Returns or sets a Single that represents the depth of the top bevel. Read/write.
BevelTopInset | Returns or sets a Single that represents the inset size for the top bevel. Read/write.
BevelTopType | Returns or sets an MsoPresetCamera constant that represents the bevel type for the top bevel. Read/write.
ContourColor | Returns or sets a ColorFormat object that represents color of the contour of a shape. Read/write.
ContourWidth | Returns or sets a Single that represents the width of the contour of a shape. Read/write.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Depth | Returns or sets the depth of the shape's extrusion. Read/write Single.
ExtrusionColor | Returns a ColorFormat object that represents the color of the shape's extrusion. Read-only.
ExtrusionColorType | Returns or sets a value that indicates whether the extrusion color is based on the extruded shape's fill (the front face of the extrusion) and automatically changes when the shape's fill changes, or whether the extrusion color is independent of the shape's fill. Read/write MsoExtrusionColorType.
FieldOfView | Returns or sets a Single that represents the amount of perspective for a shape. Read/write.
LightAngle | Returns or sets a Single that represents angle of the lighting. Read/write.
Parent | Returns an Object that represents the parent object of the specified ThreeDFormat object.
Perspective | MsoTrue if the extrusion appears in perspective — that is, if the walls of the extrusion narrow toward a vanishing point. MsoFalse if the extrusion is a parallel, or orthographic, projection — that is, if the walls don't narrow toward a vanishing point. Read/write MsoTriState.
PresetCamera | Returns an MsoPresetCamera constant that represents the camera presets. Read-only.
PresetExtrusionDirection | Returns the direction taken by the extrusion's sweep path leading away from the extruded shape (the front face of the extrusion). Read/write MsoPresetExtrusionDirection.
PresetLighting | Returns or sets an MsoBevelType constant that represents the lighting preset. Read/write.
PresetLightingDirection | Returns or sets the position of the light source relative to the extrusion. Read/write MsoPresetLightingDirection.
PresetLightingSoftness | Returns or sets the intensity of the extrusion lighting. Read/write MsoPresetLightingSoftness.
PresetMaterial | Returns or sets the extrusion surface material. Read/write MsoPresetMaterial.
PresetThreeDFormat | Returns the preset extrusion format. Read-only MsoPresetThreeDFormat.
ProjectText | Returns or sets an MsoTriState constant that represents whether text on a shape rotates with shape. msoTrue rotates the text. Read/write.
RotationX | Returns or sets the rotation of the extruded shape around the x-axis in degrees. Read/write Single.
RotationY | Returns or sets the rotation of the extruded shape around the y-axis, in degrees. Read/write Single.
RotationZ | Returns or sets a Single that represents z-axis rotation of the camera. Read/write.
Visible | True if the specified object, or the formatting applied to it, is visible. Read/write MsoTriState.
Z | Returns or sets a Single that represents the z-axis for the shape. Read/write.


ThreeDFormat Properties (Word)

 Copy code hover
[image]

ThreeDFormat Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
BevelBottomDepth | Returns or sets a Single that represents the depth of the bottom bevel. Read/write.
BevelBottomInset | Returns or sets a Single that represents the inset size for the bottom bevel. Read/write.
BevelBottomType | Returns or sets an MsoPresetCamera constant that represents the bevel type for the bottom bevel. Read/write.
BevelTopDepth | Returns or sets a Single that represents the depth of the top bevel. Read/write.
BevelTopInset | Returns or sets a Single that represents the inset size for the top bevel. Read/write.
BevelTopType | Returns or sets an MsoPresetCamera constant that represents the bevel type for the top bevel. Read/write.
ContourColor | Returns or sets a ColorFormat object that represents color of the contour of a shape. Read/write.
ContourWidth | Returns or sets a Single that represents the width of the contour of a shape. Read/write.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Depth | Returns or sets the depth of the shape's extrusion. Read/write Single.
ExtrusionColor | Returns a ColorFormat object that represents the color of the shape's extrusion. Read-only.
ExtrusionColorType | Returns or sets a value that indicates whether the extrusion color is based on the extruded shape's fill (the front face of the extrusion) and automatically changes when the shape's fill changes, or whether the extrusion color is independent of the shape's fill. Read/write MsoExtrusionColorType.
FieldOfView | Returns or sets a Single that represents the amount of perspective for a shape. Read/write.
LightAngle | Returns or sets a Single that represents angle of the lighting. Read/write.
Parent | Returns an Object that represents the parent object of the specified ThreeDFormat object.
Perspective | MsoTrue if the extrusion appears in perspective — that is, if the walls of the extrusion narrow toward a vanishing point. MsoFalse if the extrusion is a parallel, or orthographic, projection — that is, if the walls don't narrow toward a vanishing point. Read/write MsoTriState.
PresetCamera | Returns an MsoPresetCamera constant that represents the camera presets. Read-only.
PresetExtrusionDirection | Returns the direction taken by the extrusion's sweep path leading away from the extruded shape (the front face of the extrusion). Read/write MsoPresetExtrusionDirection.
PresetLighting | Returns or sets an MsoBevelType constant that represents the lighting preset. Read/write.
PresetLightingDirection | Returns or sets the position of the light source relative to the extrusion. Read/write MsoPresetLightingDirection.
PresetLightingSoftness | Returns or sets the intensity of the extrusion lighting. Read/write MsoPresetLightingSoftness.
PresetMaterial | Returns or sets the extrusion surface material. Read/write MsoPresetMaterial.
PresetThreeDFormat | Returns the preset extrusion format. Read-only MsoPresetThreeDFormat.
ProjectText | Returns or sets an MsoTriState constant that represents whether text on a shape rotates with shape. msoTrue rotates the text. Read/write.
RotationX | Returns or sets the rotation of the extruded shape around the x-axis in degrees. Read/write Single.
RotationY | Returns or sets the rotation of the extruded shape around the y-axis, in degrees. Read/write Single.
RotationZ | Returns or sets a Single that represents z-axis rotation of the camera. Read/write.
Visible | True if the specified object, or the formatting applied to it, is visible. Read/write MsoTriState.
Z | Returns or sets a Single that represents the z-axis for the shape. Read/write.


ThreeDFormat.Application Property (Word)

 Copy code hover
[image]

ThreeDFormat.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a ThreeDFormat object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat.BevelBottomDepth Property (Word)

 Copy code hover
[image]

ThreeDFormat.BevelBottomDepth Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Single that represents the depth of the bottom bevel. Read/write.

Syntax

expression .BevelBottomDepth

expression An expression that returns a ThreeDFormat object.

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat.BevelBottomInset Property (Word)

 Copy code hover
[image]

ThreeDFormat.BevelBottomInset Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Single that represents the inset size for the bottom bevel. Read/write.

Syntax

expression .BevelBottomInset

expression An expression that returns a ThreeDFormat object.

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat.BevelBottomType Property (Word)

 Copy code hover
[image]

ThreeDFormat.BevelBottomType Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets an MsoPresetCamera constant that represents the bevel type for the bottom bevel. Read/write.

Syntax

expression .BevelBottomType

expression An expression that returns a ThreeDFormat object.

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat.BevelTopDepth Property (Word)

 Copy code hover
[image]

ThreeDFormat.BevelTopDepth Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Single that represents the depth of the top bevel. Read/write.

Syntax

expression .BevelTopDepth

expression An expression that returns a ThreeDFormat object.

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat.BevelTopInset Property (Word)

 Copy code hover
[image]

ThreeDFormat.BevelTopInset Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Single that represents the inset size for the top bevel. Read/write.

Syntax

expression .BevelTopInset

expression An expression that returns a ThreeDFormat object.

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat.BevelTopType Property (Word)

 Copy code hover
[image]

ThreeDFormat.BevelTopType Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets an MsoPresetCamera constant that represents the bevel type for the top bevel. Read/write.

Syntax

expression .BevelTopType

expression An expression that returns a ThreeDFormat object.

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat.ContourColor Property (Word)

 Copy code hover
[image]

ThreeDFormat.ContourColor Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a ColorFormat object that represents color of the contour of a shape. Read/write.

Syntax

expression .ContourColor

expression An expression that returns a ThreeDFormat object.

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat.ContourWidth Property (Word)

 Copy code hover
[image]

ThreeDFormat.ContourWidth Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Single that represents the width of the contour of a shape. Read/write.

Syntax

expression .ContourWidth

expression An expression that returns a ThreeDFormat object.

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat.Creator Property (Word)

 Copy code hover
[image]

ThreeDFormat.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a ThreeDFormat object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat.Depth Property (Word)

 Copy code hover
[image]

ThreeDFormat.Depth Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the depth of the shape's extrusion. Read/write Single.

Syntax

expression .Depth

expression A variable that represents a ThreeDFormat object.

Remarks

The Depth property can be a value from - 600 through 9600 (positive values produce an extrusion whose front face is the original shape; negative values produce an extrusion whose back face is the original shape).

Example

This example adds an oval to the active document and then specifies that the oval be extruded to a depth of 50 points and that the extrusion be purple.

VBA Copy code Copy code
Dim docActive As Document
Dim shapeNew As Shape

Set docActive = ActiveDocument
Set shapeNew = docActive.Shapes.AddShape(msoShapeOval, _
 90, 90, 90, 40)

With shapeNew.ThreeD
 .Visible = True
 .Depth = 50
 ' RGB value for purple
 .ExtrusionColor.RGB = RGB(255, 100, 255)
End With

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat.ExtrusionColor Property (Word)

 Copy code hover
[image]

ThreeDFormat.ExtrusionColor Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a ColorFormat object that represents the color of the shape's extrusion. Read-only.

Syntax

expression .ExtrusionColor

expression A variable that represents a ThreeDFormat object.

Example

This example adds an oval to the active document and then specifies that the oval be extruded to a depth of 50 points and that the extrusion be purple.

VBA Copy code Copy code
Dim docActive As Document
Dim shapeNew As Shape

Set docActive = ActiveDocument
Set shapeNew = docActive.Shapes.AddShape(msoShapeOval, _
 90, 90, 90, 40)
With shapeNew.ThreeD
 .Visible = True
 .Depth = 50
 ' RGB value for purple
 .ExtrusionColor.RGB = RGB(255, 100, 255)
End With

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat.ExtrusionColorType Property (Word)

 Copy code hover
[image]

ThreeDFormat.ExtrusionColorType Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a value that indicates whether the extrusion color is based on the extruded shape's fill (the front face of the extrusion) and automatically changes when the shape's fill changes, or whether the extrusion color is independent of the shape's fill. Read/write MsoExtrusionColorType.

Syntax

expression .ExtrusionColorType

expression Required. A variable that represents a ThreeDFormat object.

Example

If the first shape on the active document has an automatic extrusion color, this example gives the extrusion a custom yellow color.

VBA Copy code Copy code
Dim docActive As Document

Set docActive = ActiveDocument

With docActive.Shapes(1).ThreeD
 If .ExtrusionColorType = msoExtrusionColorAutomatic Then
 .ExtrusionColor.RGB = RGB(240, 235, 16)
 End If
End With

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat.FieldOfView Property (Word)

 Copy code hover
[image]

ThreeDFormat.FieldOfView Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Single that represents the amount of perspective for a shape. Read/write.

Syntax

expression .FieldOfView

expression An expression that returns a ThreeDFormat object.

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat.LightAngle Property (Word)

 Copy code hover
[image]

ThreeDFormat.LightAngle Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Single that represents angle of the lighting. Read/write.

Syntax

expression .LightAngle

expression An expression that returns a ThreeDFormat object.

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat.Parent Property (Word)

 Copy code hover
[image]

ThreeDFormat.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified ThreeDFormat object.

Syntax

expression .Parent

expression Required. A variable that represents a ThreeDFormat object.

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat.Perspective Property (Word)

 Copy code hover
[image]

ThreeDFormat.Perspective Property (Word)
See also Send feedback

Published: July 16, 2012

MsoTrue if the extrusion appears in perspective — that is, if the walls of the extrusion narrow toward a vanishing point. MsoFalse if the extrusion is a parallel, or orthographic, projection — that is, if the walls don't narrow toward a vanishing point. Read/write MsoTriState.

Syntax

expression .Perspective

expression Required. A variable that represents a ThreeDFormat object.

Example

This example sets the extrusion depth for shape one on myDocument to 100 points and specifies that the extrusion be parallel, or orthographic.

VBA Copy code Copy code
Set myDocument = ActiveDocument
With myDocument.Shapes(1).ThreeD
 .Visible = True
 .Depth = 100
 .Perspective = msoFalse
End With

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat.PresetCamera Property (Word)

 Copy code hover
[image]

ThreeDFormat.PresetCamera Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an MsoPresetCamera constant that represents the camera presets. Read-only.

Syntax

expression .PresetCamera

expression An expression that returns a ThreeDFormat object.

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat.PresetExtrusionDirection Property (Word)

 Copy code hover
[image]

ThreeDFormat.PresetExtrusionDirection Property (Word)
See also Send feedback

Returns the direction taken by the extrusion's sweep path leading away from the extruded shape (the front face of the extrusion). Read/write MsoPresetExtrusionDirection.

Syntax

expression .PresetExtrusionDirection

expression Required. A variable that represents a ThreeDFormat object.

Remarks

This property is read-only. To set the value of this property, use the SetExtrusionDirection method.

Example

This example changes each extrusion on myDocument that extends toward the upper-left corner of the extrusion's front face to an extrusion that extends toward the lower-right corner of the front face.

VBA Copy code Copy code
Set myDocument = ActiveDocument
For Each s In myDocument.Shapes
 With s.ThreeD
 If .PresetExtrusionDirection = msoExtrusionTopLeft Then
 .SetExtrusionDirection msoExtrusionBottomRight
 End If
 End With
Next

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat.PresetLighting Property (Word)

 Copy code hover
[image]

ThreeDFormat.PresetLighting Property (Word)
See also Send feedback

Returns or sets an MsoBevelType constant that represents the lighting preset. Read/write.

Syntax

expression .PresetLighting

expression An expression that returns a ThreeDFormat object.

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat.PresetLightingDirection Property (Word)

 Copy code hover
[image]

ThreeDFormat.PresetLightingDirection Property (Word)
See also Send feedback

Returns or sets the position of the light source relative to the extrusion. Read/write MsoPresetLightingDirection.

Syntax

expression .PresetLightingDirection

expression Required. A variable that represents a ThreeDFormat object.

Remarks

The lighting effects you set will not be apparent if the extrusion has a wireframe surface.

Example

This example specifies that the extrusion for shape one on myDocument extend toward the top of the shape and that the lighting for the extrusion come from the left.

VBA Copy code Copy code
Set myDocument = ActiveDocument
With myDocument.Shapes(1).ThreeD
 .Visible = True
 .SetExtrusionDirection msoExtrusionTop
 .PresetLightingDirection = msoLightingLeft
End With

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat.PresetLightingSoftness Property (Word)

 Copy code hover
[image]

ThreeDFormat.PresetLightingSoftness Property (Word)
See also Send feedback

Returns or sets the intensity of the extrusion lighting. Read/write MsoPresetLightingSoftness.

Syntax

expression .PresetLightingSoftness

expression Required. A variable that represents a ThreeDFormat object.

Example

This example specifies that the extrusion for shape one on myDocument be lit brightly from the left.

VBA Copy code Copy code
Set myDocument = ActiveDocument
With myDocument.Shapes(1).ThreeD
 .Visible = True
 .PresetLightingSoftness = msoLightingBright
 .PresetLightingDirection = msoLightingLeft
End With

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat.PresetMaterial Property (Word)

 Copy code hover
[image]

ThreeDFormat.PresetMaterial Property (Word)
See also Send feedback

Returns or sets the extrusion surface material. Read/write MsoPresetMaterial.

Syntax

expression .PresetMaterial

expression Required. A variable that represents a ThreeDFormat object.

Example

This example specifies that the extrusion surface for shape one in myDocument be wireframe.

VBA Copy code Copy code
Set myDocument = ActiveDocument
With myDocument.Shapes(1).ThreeD
 .Visible = True
 .PresetMaterial = msoMaterialWireFrame
End With

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat.PresetThreeDFormat Property (Word)

 Copy code hover
[image]

ThreeDFormat.PresetThreeDFormat Property (Word)
See also Send feedback

Returns the preset extrusion format. Read-only MsoPresetThreeDFormat.

Syntax

expression .PresetThreeDFormat

expression Required. A variable that represents a ThreeDFormat object.

Remarks

Each preset extrusion format contains a set of preset values for the various properties of the extrusion. If the extrusion has a custom format rather than a preset format, this property returns msoPresetThreeDFormatMixed.

The values for this property correspond to the options (numbered from left to right, top to bottom) displayed when you click the 3-D button on the Drawing toolbar.

Use the SetThreeDFormat method to set the preset extrusion format.

Example

This example sets the extrusion format for shape one on myDocument to 3-D Style 12 if the shape initially has a custom extrusion format.

VBA Copy code Copy code
Set myDocument = ActiveDocument
With myDocument.Shapes(1).ThreeD
 If .PresetThreeDFormat = msoPresetThreeDFormatMixed Then
 .SetThreeDFormat msoThreeD12
 End If
End With

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat.ProjectText Property (Word)

 Copy code hover
[image]

ThreeDFormat.ProjectText Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets an MsoTriState constant that represents whether text on a shape rotates with shape. msoTrue rotates the text. Read/write.

Syntax

expression .ProjectText

expression An expression that returns a ThreeDFormat object.

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat.RotationX Property (Word)

 Copy code hover
[image]

ThreeDFormat.RotationX Property (Word)
See also Send feedback

Returns or sets the rotation of the extruded shape around the x-axis in degrees. Read/write Single.

Syntax

expression .RotationX

expression An expression that returns a ThreeDFormat object.

Remarks

The RotationX property can be a value from - 90 through 90. A positive value indicates upward rotation; a negative value indicates downward rotation.

To set the rotation of the extruded shape around the y-axis, use the RotationY property of the ThreeDFormat object. To set the rotation of the extruded shape around the z-axis, use the Rotation property of the Shape object. To change the direction of the extrusion's sweep path without rotating the front face of the extrusion, use the SetExtrusionDirection method.

Example

This example adds three identical extruded ovals to the active document and sets their rotation around the x-axis to - 30, 0, and 30 degrees, respectively.

VBA Copy code Copy code
With ActiveDocument.Shapes
 With .AddShape(msoShapeOval, 30, 60, 50, 25).ThreeD
 .Visible = True
 .RotationX = -30
 End With
 With .AddShape(msoShapeOval, 90, 60, 50, 25).ThreeD
 .Visible = True
 .RotationX = 0
 End With
 With .AddShape(msoShapeOval, 150, 60, 50, 25).ThreeD
 .Visible = True
 .RotationX = 30
 End With
End With

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat.RotationY Property (Word)

 Copy code hover
[image]

ThreeDFormat.RotationY Property (Word)
See also Send feedback

Returns or sets the rotation of the extruded shape around the y-axis, in degrees. Read/write Single.

Syntax

expression .RotationY

expression An expression that returns a ThreeDFormat object.

Remarks

The RotationY property can be a value from - 90 through 90. A positive value indicates rotation to the left; a negative value indicates rotation to the right.

To set the rotation of the extruded shape around the x-axis, use the RotationX property of the ThreeDFormat object. To set the rotation of the extruded shape around the z-axis, use the Rotation property of the Shape object. To change the direction of the extrusion's sweep path without rotating the front face of the extrusion, use the SetExtrusionDirection method.

Example

This example adds three identical extruded ovals to myDocument and sets their rotation around the y-axis to - 30, 0, and 30 degrees, respectively.

VBA Copy code Copy code
Set myDocument = ActiveDocument
With myDocument.Shapes
 With .AddShape(msoShapeOval, 30, 30, 50, 25).ThreeD
 .Visible = True
 .RotationY = -30
 End With
 With .AddShape(msoShapeOval, 30, 70, 50, 25).ThreeD
 .Visible = True
 .RotationY = 0
 End With
 With .AddShape(msoShapeOval, 30, 110, 50, 25).ThreeD
 .Visible = True
 .RotationY = 30
 End With
End With

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat.RotationZ Property (Word)

 Copy code hover
[image]

ThreeDFormat.RotationZ Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Single that represents z-axis rotation of the camera. Read/write.

Syntax

expression .RotationZ

expression An expression that returns a ThreeDFormat object.

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat.Visible Property (Word)

 Copy code hover
[image]

ThreeDFormat.Visible Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified object, or the formatting applied to it, is visible. Read/write MsoTriState.

Syntax

expression .Visible

expression Required. A variable that represents a ThreeDFormat object.

Remarks

Some methods and properties may be unavailable if the Visible property is False.

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat.Z Property (Word)

 Copy code hover
[image]

ThreeDFormat.Z Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Single that represents the z-axis for the shape. Read/write.

Syntax

expression .Z

expression An expression that returns a ThreeDFormat object.

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat Methods (Word)

 Copy code hover
[image]

ThreeDFormat Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
IncrementRotationHorizontal | Horizontally rotates a shape on the x-axis using the specified incrementation value.
IncrementRotationVertical | Vertically rotates a shape on the y-axis using the specified incrementation value.
IncrementRotationX | Changes the rotation of the specified shape around the x-axis by the specified number of degrees.
IncrementRotationY | Changes the rotation of the specified shape around the y-axis by the specified number of degrees.
IncrementRotationZ | Rotates a shape on the z-axis using the specified incrementation.
ResetRotation | Resets the extrusion rotation around the x-axis and the y-axis to 0 (zero) so that the front of the extrusion faces forward.
SetExtrusionDirection | Sets the direction that the extrusion's sweep path takes away from the extruded shape.
SetPresetCamera | Sets the camera presets for a shape.
SetThreeDFormat | Sets the preset extrusion format.


ThreeDFormat.IncrementRotationHorizontal Method (Word)

 Copy code hover
[image]

ThreeDFormat.IncrementRotationHorizontal Method (Word)
See also Send feedback

Published: July 16, 2012

Horizontally rotates a shape on the x-axis using the specified incrementation value.

Syntax

expression .IncrementRotationHorizontal(Increment)

expression An expression that returns a ThreeDFormat object.

Parameters

Name | Required/Optional | Data Type | Description
Increment | Required | Single | Specifies the incrementation value.

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat.IncrementRotationVertical Method (Word)

 Copy code hover
[image]

ThreeDFormat.IncrementRotationVertical Method (Word)
See also Send feedback

Published: July 16, 2012

Vertically rotates a shape on the y-axis using the specified incrementation value.

Syntax

expression .IncrementRotationVertical(Increment)

expression An expression that returns a ThreeDFormat object.

Parameters

Name | Required/Optional | Data Type | Description
Increment | Required | Single | Specifies the incrementation value.

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat.IncrementRotationX Method (Word)

 Copy code hover
[image]

ThreeDFormat.IncrementRotationX Method (Word)
See also Send feedback

Published: July 16, 2012

Changes the rotation of the specified shape around the x-axis by the specified number of degrees.

Syntax

expression .IncrementRotationX(Increment)

expression Required. A variable that represents a ThreeDFormat object.

Parameters

Name | Required/Optional | Data Type | Description
Increment | Required | Single | Specifies how much (in degrees) the rotation of the shape around the x-axis is to be changed. Can be a value from -90 through 90. A positive value tilts the shape up; a negative value tilts it down.

Remarks

Use the RotationX property to set the absolute rotation of the shape around the x-axis.

You cannot adjust the rotation around the x-axis of the specified shape past the upper or lower limit for the RotationX property (90 degrees to -90 degrees). For example, if the RotationX property is initially set to 80 and you specify 40 for the Increment argument, the resulting rotation will be 90 (the upper limit for the RotationX property) instead of 120.

To change the rotation of a shape around the y-axis, use the IncrementRotationY method. To change the rotation around the z-axis, use the IncrementRotation method.

Example

This example tilts the first shape on the active document up 10 degrees. The first shape must be an extruded shape for you to see the effect of this code.

VBA Copy code Copy code
ActiveDocument.Shapes(1).ThreeD.IncrementRotationX 10

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat.IncrementRotationY Method (Word)

 Copy code hover
[image]

ThreeDFormat.IncrementRotationY Method (Word)
See also Send feedback

Published: July 16, 2012

Changes the rotation of the specified shape around the y-axis by the specified number of degrees.

Syntax

expression .IncrementRotationY(Increment)

expression Required. A variable that represents a ThreeDFormat object.

Parameters

Name | Required/Optional | Data Type | Description
Increment | Required | Single | Specifies how much (in degrees) the rotation of the shape around the y-axis is to be changed. Can be a value from - 90 through 90. A positive value tilts the shape to the left; a negative value tilts it to the right.

Remarks

Use the RotationY property to set the absolute rotation of the shape around the y-axis.

To change the rotation of a shape around the x-axis, use the IncrementRotationX method. To change the rotation around the z-axis, use the IncrementRotation method.

You cannot adjust the rotation around the y-axis of the specified shape past the upper or lower limit for the RotationY property (90 degrees to - 90 degrees). For example, if the RotationY property is initially set to 80 and you specify 40 for the Increment argument, the resulting rotation will be 90 (the upper limit for the RotationY property) instead of 120.

Example

This example tilts the first shape on the active document 10 degrees to the right. The first shape must be an extruded shape for you to see the effect of this code.

VBA Copy code Copy code
ActiveDocument.Shapes(1).ThreeD.IncrementRotationY -10

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat.IncrementRotationZ Method (Word)

 Copy code hover
[image]

ThreeDFormat.IncrementRotationZ Method (Word)
See also Send feedback

Published: July 16, 2012

Rotates a shape on the z-axis using the specified incrementation.

Syntax

expression .IncrementRotationZ(Increment)

expression An expression that returns a ThreeDFormat object.

Parameters

Name | Required/Optional | Data Type | Description
Increment | Required | Single | Specifies the incrementation value.

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat.ResetRotation Method (Word)

 Copy code hover
[image]

ThreeDFormat.ResetRotation Method (Word)
See also Send feedback

Resets the extrusion rotation around the x-axis and the y-axis to 0 (zero) so that the front of the extrusion faces forward.

Syntax

expression .ResetRotation

expression Required. A variable that represents a ThreeDFormat object.

Remarks

To set the extrusion rotation around the x-axis and the y-axis to anything other than 0 (zero), use the RotationX and RotationY properties of the ThreeDFormat object. To set the extrusion rotation around the z-axis, use the Rotation property of the Shape object that represents the extruded shape.

Note Note

This method does not reset the rotation around the z-axis.

Example

This example resets the rotation around the x-axis and the y-axis to 0 (zero) for the extrusion of the first shape on the active document.

VBA Copy code Copy code
ActiveDocument.Shapes(1).ThreeD.ResetRotation

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat.SetExtrusionDirection Method (Word)

 Copy code hover
[image]

ThreeDFormat.SetExtrusionDirection Method (Word)
See also Send feedback

Published: July 16, 2012

Sets the direction that the extrusion's sweep path takes away from the extruded shape.

Syntax

expression .SetExtrusionDirection(PresetExtrusionDirection)

expression Required. A variable that represents a ThreeDFormat object.

Parameters

Name | Required/Optional | Data Type | Description
PresetExtrusionDirection | Required | MsoPresetExtrusionDirection | Sets the direction of the extrusion.

Remarks

This method sets the PresetExtrusionDirection property to the direction specified by the PresetExtrusionDirection argument.

Example

This example specifies that the extrusion for the first shape on the active document extend toward the top of the shape and that the lighting for the extrusion come from the left.

VBA Copy code Copy code
With ActiveDocument.Shapes(1).ThreeD
 .Visible = True
 .SetExtrusionDirection msoExtrusionTop
 .PresetLightingDirection = msoLightingLeft
End With

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat.SetPresetCamera Method (Word)

 Copy code hover
[image]

ThreeDFormat.SetPresetCamera Method (Word)
See also Send feedback

Published: July 16, 2012

Sets the camera presets for a shape.

Syntax

expression .SetPresetCamera(PresetCamera)

expression An expression that returns a ThreeDFormat object.

Parameters

Name | Required/Optional | Data Type | Description
PresetCamera | Required | MsoPresetCamera | Specifies the camera preset type.

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


ThreeDFormat.SetThreeDFormat Method (Word)

 Copy code hover
[image]

ThreeDFormat.SetThreeDFormat Method (Word)
See also Send feedback

Published: July 16, 2012

Sets the preset extrusion format.

Syntax

expression .SetThreeDFormat(PresetThreeDFormat)

expression Required. A variable that represents a ThreeDFormat object.

Parameters

Name | Required/Optional | Data Type | Description
PresetThreeDFormat | Required | MsoPresetThreeDFormat | Specifies a preset extrusion format that corresponds to one of the options (numbered from left to right, top to bottom) displayed when you click the 3-D button on the Drawing toolbar.

Remarks

Each preset extrusion format contains a set of preset values for the various properties of the extrusion. This method sets the PresetThreeDFormat property to the format specified by the PresetThreeDFormat argument.

Note Note

Specifying msoPresetThreeDFormatMixed for the PresetThreeDFormat argument causes an error.

Example

This example adds an oval to the active document and sets its extrusion format to 3D Style 12.

VBA Copy code Copy code
With ActiveDocument.Shapes.AddShape(msoShapeOval, _
 30, 30, 50, 25).ThreeD
 .Visible = True
 .SetThreeDFormat msoThreeD12
End With

See also

Concepts

ThreeDFormat Object

Other resources

ThreeDFormat Object Members


TickLabels Object (Word)

 Copy code hover
[image]

TickLabels Object (Word)
See also Send feedback

Published: July 16, 2012

Represents the tick-mark labels associated with tick marks on a chart axis.

Version Information

Version Added: Word 2007

Remarks

This object is not a collection. There is no object that represents a single tick-mark label; you must return all the tick-mark labels as a unit.

Tick-mark label text for the category axis comes from the name of the associated category in the chart. The default tick-mark label text for the category axis is the number that indicates the position of the category relative to the left end of this axis. To change the number of unlabeled tick marks between tick-mark labels, you must change the TickLabelSpacing property for the category axis.

Tick-mark label text for the value axis is calculated based on the MajorUnit, MinimumScale, and MaximumScale properties of the value axis. To change the tick-mark label text for the value axis, you must change the values of these properties.

Example

Use the TickLabels property to return the TickLabels object. The following example sets the number format for the tick-mark labels on the value axis for the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.Axes(xlValue).TickLabels.NumberFormat = "0.00"
 End If
End With

See also

Concepts

Word Object Model Reference

Other resources

TickLabels Object Members


TickLabels Members (Word)

 Copy code hover
[image]

TickLabels Members (Word)
Send feedback

Published: July 16, 2012

Represents the tick-mark labels associated with tick marks on a chart axis.

Methods

Name | Description
Delete | Deletes the object.
Select | Selects the object.

Properties

Name | Description
Alignment | Returns or sets the alignment for the specified phonetic text or tick label. Read/write Long.
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Depth | Returns the number of levels of category tick labels. Read-only Long.
Font | Returns the font of the specified object. Read-only ChartFont.
Format | Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.
MultiLevel | Returns or sets a value that indicates whether an axis is multilevel. Read/write Boolean.
Name | Returns the name of the object. Read-only String.
NumberFormat | Returns or sets the format code for the object. Read/write String.
NumberFormatLinked | True if the number format is linked to the cells (so that the number format changes in the labels when it changes in the cells). Read/write Boolean.
NumberFormatLocal | Returns or sets the format code for the object as a string in the language of the user. Read/write Variant.
Offset | Returns or sets the distance between the levels of labels, and the distance between the first level and the axis line. Read/write Long.
Orientation | Returns or sets the text orientation. Read/write Long.
Parent | Returns the parent for the specified object. Read-only Object.
ReadingOrder | Returns or sets an XlReadingOrder constant that represents the reading order for the specified object. Read/write Long.


TickLabels Properties (Word)

 Copy code hover
[image]

TickLabels Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Alignment | Returns or sets the alignment for the specified phonetic text or tick label. Read/write Long.
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Depth | Returns the number of levels of category tick labels. Read-only Long.
Font | Returns the font of the specified object. Read-only ChartFont.
Format | Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.
MultiLevel | Returns or sets a value that indicates whether an axis is multilevel. Read/write Boolean.
Name | Returns the name of the object. Read-only String.
NumberFormat | Returns or sets the format code for the object. Read/write String.
NumberFormatLinked | True if the number format is linked to the cells (so that the number format changes in the labels when it changes in the cells). Read/write Boolean.
NumberFormatLocal | Returns or sets the format code for the object as a string in the language of the user. Read/write Variant.
Offset | Returns or sets the distance between the levels of labels, and the distance between the first level and the axis line. Read/write Long.
Orientation | Returns or sets the text orientation. Read/write Long.
Parent | Returns the parent for the specified object. Read-only Object.
ReadingOrder | Returns or sets an XlReadingOrder constant that represents the reading order for the specified object. Read/write Long.


TickLabels.Alignment Property (Word)

 Copy code hover
[image]

TickLabels.Alignment Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the alignment for the specified phonetic text or tick label. Read/write Long.

Version Information

Version Added: Word 2007

Syntax

expression .Alignment

expression A variable that represents a TickLabels object.

See also

Concepts

TickLabels Object

Other resources

TickLabels Object Members


TickLabels.Application Property (Word)

 Copy code hover
[image]

TickLabels.Application Property (Word)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Application

expression A variable that represents a TickLabels object.

Example

The following example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveDocument
If myObject.Application.Value = "Microsoft Word" Then
 MsgBox "This is a Word Application object."
Else
 MsgBox "This is not a Word Application object."
End If

See also

Concepts

TickLabels Object

Other resources

TickLabels Object Members


TickLabels.Creator Property (Word)

 Copy code hover
[image]

TickLabels.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version Information

Version Added: Word 2007

Syntax

expression .Creator

expression A variable that represents a TickLabels object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD". This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Word has the creator code MSWD. For more information about this property, consult the language reference Help included with Microsoft Office for Mac.

See also

Concepts

TickLabels Object

Other resources

TickLabels Object Members


TickLabels.Depth Property (Word)

 Copy code hover
[image]

TickLabels.Depth Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the number of levels of category tick labels. Read-only Long.

Version Information

Version Added: Word 2007

Syntax

expression .Depth

expression A variable that represents a TickLabels object.

See also

Concepts

TickLabels Object

Other resources

TickLabels Object Members


TickLabels.Font Property (Word)

 Copy code hover
[image]

TickLabels.Font Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the font of the specified object. Read-only ChartFont.

Version Information

Version Added: Word 2007

Syntax

expression .Font

expression A variable that represents a TickLabels object.

See also

Concepts

TickLabels Object

Other resources

TickLabels Object Members


TickLabels.Format Property (Word)

 Copy code hover
[image]

TickLabels.Format Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.

Version Information

Version Added: Word 2007

Syntax

expression .Format

expression A variable that represents a TickLabels object.

See also

Concepts

TickLabels Object

Other resources

TickLabels Object Members


TickLabels.MultiLevel Property (Word)

 Copy code hover
[image]

TickLabels.MultiLevel Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a value that indicates whether an axis is multilevel. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .MultiLevel

expression A variable that represents a TickLabels object.

Remarks

The default value for this property is True.

See also

Concepts

TickLabels Object

Other resources

TickLabels Object Members


TickLabels.Name Property (Word)

 Copy code hover
[image]

TickLabels.Name Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the name of the object. Read-only String.

Version Information

Version Added: Word 2007

Syntax

expression .Name

expression A variable that represents a TickLabels object.

See also

Concepts

TickLabels Object

Other resources

TickLabels Object Members


TickLabels.NumberFormat Property (Word)

 Copy code hover
[image]

TickLabels.NumberFormat Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the format code for the object. Read/write String.

Version Information

Version Added: Word 2007

Syntax

expression .NumberFormat

expression A variable that represents a TickLabels object.

Remarks

The format code is the same string as the Format Codes option in the Format Cells dialog box. The Format function uses different format code strings than do the NumberFormat and NumberFormatLocal properties.

See also

Concepts

TickLabels Object

Other resources

TickLabels Object Members


TickLabels.NumberFormatLinked Property (Word)

 Copy code hover
[image]

TickLabels.NumberFormatLinked Property (Word)
See also Send feedback

Published: July 16, 2012

True if the number format is linked to the cells (so that the number format changes in the labels when it changes in the cells). Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .NumberFormatLinked

expression A variable that represents a TickLabels object.

Example

The following example links the number format for tick-mark labels to its cells for the value axis of the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.Axes(xlValue).TickLabels.NumberFormatLinked = True
 End If
End With

See also

Concepts

TickLabels Object

Other resources

TickLabels Object Members


TickLabels.NumberFormatLocal Property (Word)

 Copy code hover
[image]

TickLabels.NumberFormatLocal Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the format code for the object as a string in the language of the user. Read/write Variant.

Version Information

Version Added: Word 2007

Syntax

expression .NumberFormatLocal

expression A variable that represents a TickLabels object.

Remarks

The Format function uses different format code strings than do the NumberFormat and NumberFormatLocal properties.

See also

Concepts

TickLabels Object

Other resources

TickLabels Object Members


TickLabels.Offset Property (Word)

 Copy code hover
[image]

TickLabels.Offset Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the distance between the levels of labels, and the distance between the first level and the axis line. Read/write Long.

Version Information

Version Added: Word 2007

Syntax

expression .Offset

expression A variable that represents a TickLabels object.

Remarks

The default distance is 100 percent, which represents the default spacing between the axis labels and the axis line. The value can be an integer percentage from 0 through 1000, relative to the axis label's font size.

Example

The following example sets the label spacing of the category axis for the first chart in the active document to twice the current setting, if the offset is less than 500.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.Axes(xlCategory).TickLabels
 If .Offset < 500 then
 .Offset = .Offset * 2
 End If
 End With
 End If
End With

See also

Concepts

TickLabels Object

Other resources

TickLabels Object Members


TickLabels.Orientation Property (Word)

 Copy code hover
[image]

TickLabels.Orientation Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the text orientation. Read/write Long.

Version Information

Version Added: Word 2007

Syntax

expression .Orientation

expression A variable that represents a TickLabels object.

Remarks

The value of this property can be an integer from -90 through 90 degrees or one of the XlTickLabelOrientation constants.

See also

Concepts

TickLabels Object

Other resources

TickLabels Object Members


TickLabels.Parent Property (Word)

 Copy code hover
[image]

TickLabels.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the parent for the specified object. Read-only Object.

Version Information

Version Added: Word 2007

Syntax

expression .Parent

expression A variable that represents a TickLabels object.

See also

Concepts

TickLabels Object

Other resources

TickLabels Object Members


TickLabels.ReadingOrder Property (Word)

 Copy code hover
[image]

TickLabels.ReadingOrder Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets an XlReadingOrder constant that represents the reading order for the specified object. Read/write Long.

Version Information

Version Added: Word 2007

Syntax

expression .ReadingOrder

expression A variable that represents a TickLabels object.

See also

Concepts

TickLabels Object

Other resources

TickLabels Object Members


TickLabels Methods (Word)

 Copy code hover
[image]

TickLabels Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the object.
Select | Selects the object.


TickLabels.Delete Method (Word)

 Copy code hover
[image]

TickLabels.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Version Information

Version Added: Word 2007

Syntax

expression .Delete

expression A variable that represents a TickLabels object.

See also

Concepts

TickLabels Object

Other resources

TickLabels Object Members


TickLabels.Select Method (Word)

 Copy code hover
[image]

TickLabels.Select Method (Word)
See also Send feedback

Published: July 16, 2012

Selects the object.

Version Information

Version Added: Word 2007

Syntax

expression .Select

expression A variable that represents a TickLabels object.

See also

Concepts

TickLabels Object

Other resources

TickLabels Object Members


Trendline Object (Word)

 Copy code hover
[image]

Trendline Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a trendline in a chart.

Version Information

Version Added: Word 2007

Remarks

A trendline shows the trend, or direction, of data in a series. The Trendline object is a member of the Trendlines collection. The Trendlines collection contains all the Trendline objects for a single series.

Example

Use Trendlines(Index), where Index is the trendline index number, to return a single Trendline object.

The index number denotes the order in which the trendlines were added to the series. Trendlines(1) is the first trendline added to the series, and Trendlines(Trendlines.Count) is the last one added.

The following example changes the trendline type for the first series of the first chart in the active document. If the series has no trendline, this example will fail.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.SeriesCollection(1).Trendlines(1).Type = xlMovingAvg
 End If
End With

See also

Concepts

Word Object Model Reference

Other resources

Trendline Object Members


Trendline Members (Word)

 Copy code hover
[image]

Trendline Members (Word)
Send feedback

Published: July 16, 2012

Represents a trendline in a chart.

Methods

Name | Description
ClearFormats | Clears the formatting of the object.
Delete | Deletes the object.
Select | Selects the object.

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
Backward2 | Returns or sets the number of periods (or units on a scatter chart) that the trendline extends backward. Read/write Double.
Border | Returns the border of the object. Read-only ChartBorder.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
DataLabel | Returns the data label that is associated with the trendline. Read-only DataLabel.
DisplayEquation | True if the equation for the trendline is displayed on the chart (in the same data label as the R-squared value). Read/write Boolean.
DisplayRSquared | True if the R-squared value of the trendline is displayed on the chart (in the same data label as the equation). Read/write Boolean.
Format | Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.
Forward2 | Returns or sets the number of periods (or units on a scatter chart) that the trendline extends forward. Read/write Double.
Index | Returns the index number of the object within the collection of similar objects. Read-only Long.
Intercept | Returns or sets the point where the trendline crosses the value axis. Read/write Double.
InterceptIsAuto | True if the point where the trendline crosses the value axis is automatically determined by the regression. Read/write Boolean.
Name | Returns or sets name of the object. Read/write String.
NameIsAuto | True if Microsoft Word automatically determines the name of the trendline. Read/write Boolean.
Order | Returns or sets the trendline order (an integer greater than 1) when the trendline type is xlPolynomial. Read/write Long.
Parent | Returns the parent for the specified object. Read-only Object.
Period | Returns or sets the period for the moving-average trendline. Read/write Long.
Type | Returns or sets the trendline type. Read/write XlTrendlineType.


Trendline Properties (Word)

 Copy code hover
[image]

Trendline Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
Backward2 | Returns or sets the number of periods (or units on a scatter chart) that the trendline extends backward. Read/write Double.
Border | Returns the border of the object. Read-only ChartBorder.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
DataLabel | Returns the data label that is associated with the trendline. Read-only DataLabel.
DisplayEquation | True if the equation for the trendline is displayed on the chart (in the same data label as the R-squared value). Read/write Boolean.
DisplayRSquared | True if the R-squared value of the trendline is displayed on the chart (in the same data label as the equation). Read/write Boolean.
Format | Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.
Forward2 | Returns or sets the number of periods (or units on a scatter chart) that the trendline extends forward. Read/write Double.
Index | Returns the index number of the object within the collection of similar objects. Read-only Long.
Intercept | Returns or sets the point where the trendline crosses the value axis. Read/write Double.
InterceptIsAuto | True if the point where the trendline crosses the value axis is automatically determined by the regression. Read/write Boolean.
Name | Returns or sets name of the object. Read/write String.
NameIsAuto | True if Microsoft Word automatically determines the name of the trendline. Read/write Boolean.
Order | Returns or sets the trendline order (an integer greater than 1) when the trendline type is xlPolynomial. Read/write Long.
Parent | Returns the parent for the specified object. Read-only Object.
Period | Returns or sets the period for the moving-average trendline. Read/write Long.
Type | Returns or sets the trendline type. Read/write XlTrendlineType.


Trendline.Application Property (Word)

 Copy code hover
[image]

Trendline.Application Property (Word)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Application

expression A variable that represents a Trendline object.

Example

The following example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveDocument
If myObject.Application.Value = "Microsoft Word" Then
 MsgBox "This is a Word Application object."
Else
 MsgBox "This is not a Word Application object."
End If

See also

Concepts

Trendline Object

Other resources

Trendline Object Members


Trendline.Backward2 Property (Word)

 Copy code hover
[image]

Trendline.Backward2 Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the number of periods (or units on a scatter chart) that the trendline extends backward. Read/write Double.

Version Information

Version Added: Word 2007

Syntax

expression .Backward2

expression A variable that represents a Trendline object.

Example

The following example sets the number of units that the trendline for the first chart in the active document extends forward and backward. You should run the example on a 2-D column chart that contains a single series that has a trendline.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.SeriesCollection(1).Trendlines(1)
 .Forward2 = 5
 .Backward2 = .5
 End With
 End If
End With

See also

Concepts

Trendline Object

Other resources

Trendline Object Members


Trendline.Border Property (Word)

 Copy code hover
[image]

Trendline.Border Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the border of the object. Read-only ChartBorder.

Version Information

Version Added: Word 2007

Syntax

expression .Border

expression A variable that represents a Trendline object.

See also

Concepts

Trendline Object

Other resources

Trendline Object Members


Trendline.Creator Property (Word)

 Copy code hover
[image]

Trendline.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version Information

Version Added: Word 2007

Syntax

expression .Creator

expression A variable that represents a Trendline object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD". This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Word has the creator code MSWD. For more information about this property, consult the language reference Help included with Microsoft Office for Mac.

See also

Concepts

Trendline Object

Other resources

Trendline Object Members


Trendline.DataLabel Property (Word)

 Copy code hover
[image]

Trendline.DataLabel Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the data label that is associated with the trendline. Read-only DataLabel.

Version Information

Version Added: Word 2007

Syntax

expression .DataLabel

expression A variable that represents a Trendline object.

Remarks

To enable data labels for a trendline, you need to set the DisplayEquation property or the DisplayRSquared property to True.

See also

Concepts

Trendline Object

Other resources

Trendline Object Members


Trendline.DisplayEquation Property (Word)

 Copy code hover
[image]

Trendline.DisplayEquation Property (Word)
See also Send feedback

Published: July 16, 2012

True if the equation for the trendline is displayed on the chart (in the same data label as the R-squared value). Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .DisplayEquation

expression A variable that represents a Trendline object.

Remarks

Setting this property to True automatically enables data labels.

Example

The following example displays the R-squared value and equation for the first trendline of the first chart in the active document. You should run the example on a 2-D column chart that has a trendline for the first series.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.SeriesCollection(1).Trendlines(1)
 .DisplayRSquared = True
 .DisplayEquation = True
 End With
 End If
End With

See also

Concepts

Trendline Object

Other resources

Trendline Object Members


Trendline.DisplayRSquared Property (Word)

 Copy code hover
[image]

Trendline.DisplayRSquared Property (Word)
See also Send feedback

Published: July 16, 2012

True if the R-squared value of the trendline is displayed on the chart (in the same data label as the equation). Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .DisplayRSquared

expression A variable that represents a Trendline object.

Remarks

Setting this property to True automatically turns on data labels.

Example

The following example displays the R-squared value and equation for trendline one of the first chart in the active document. You should run the example on a 2-D column chart that has a trendline for the first series.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.SeriesCollection(1).Trendlines(1)
 .DisplayRSquared = True
 .DisplayEquation = True
 End With
 End If
End With

See also

Concepts

Trendline Object

Other resources

Trendline Object Members


Trendline.Format Property (Word)

 Copy code hover
[image]

Trendline.Format Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.

Version Information

Version Added: Word 2007

Syntax

expression .Format

expression A variable that represents a Trendline object.

See also

Concepts

Trendline Object

Other resources

Trendline Object Members


Trendline.Forward2 Property (Word)

 Copy code hover
[image]

Trendline.Forward2 Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the number of periods (or units on a scatter chart) that the trendline extends forward. Read/write Double.

Version Information

Version Added: Word 2007

Syntax

expression .Forward2

expression A variable that represents a Trendline object.

Example

The following example sets the number of units that the trendline for the first chart in the active document extends forward and backward. You should run the example on a 2-D column chart that contains a single series that has a trendline.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.SeriesCollection(1).Trendlines(1)
 .Forward2 = 5
 .Backward2 = .5
 End With
 End If
End With

See also

Concepts

Trendline Object

Other resources

Trendline Object Members


Trendline.Index Property (Word)

 Copy code hover
[image]

Trendline.Index Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the index number of the object within the collection of similar objects. Read-only Long.

Version Information

Version Added: Word 2007

Syntax

expression .Index

expression A variable that represents a Trendline object.

See also

Concepts

Trendline Object

Other resources

Trendline Object Members


Trendline.Intercept Property (Word)

 Copy code hover
[image]

Trendline.Intercept Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the point where the trendline crosses the value axis. Read/write Double.

Version Information

Version Added: Word 2007

Syntax

expression .Intercept

expression A variable that represents a Trendline object.

Remarks

Setting this property sets the InterceptIsAuto property to False.

Example

The following example sets trendline one for the first chart in the active document to cross the value axis at 5. You should run the example on a 2-D column chart that contains a single series that has a trendline.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.SeriesCollection(1).Trendlines(1).Intercept = 5
 End If
End With

See also

Concepts

Trendline Object

Other resources

Trendline Object Members


Trendline.InterceptIsAuto Property (Word)

 Copy code hover
[image]

Trendline.InterceptIsAuto Property (Word)
See also Send feedback

Published: July 16, 2012

True if the point where the trendline crosses the value axis is automatically determined by the regression. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .InterceptIsAuto

expression A variable that represents a Trendline object.

Remarks

Setting the Intercept property sets this property to False.

Example

The following example sets Microsoft Word to automatically determine the trendline intercept point for the first chart in the active document. You should run the example on a 2-D column chart that contains a single series that has a trendline.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.SeriesCollection(1).Trendlines(1) _
 .InterceptIsAuto = True
 End If
End With

See also

Concepts

Trendline Object

Other resources

Trendline Object Members


Trendline.Name Property (Word)

 Copy code hover
[image]

Trendline.Name Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets name of the object. Read/write String.

Version Information

Version Added: Word 2007

Syntax

expression .Name

expression A variable that represents a Trendline object.

See also

Concepts

Trendline Object

Other resources

Trendline Object Members


Trendline.NameIsAuto Property (Word)

 Copy code hover
[image]

Trendline.NameIsAuto Property (Word)
See also Send feedback

Published: July 16, 2012

True if Microsoft Word automatically determines the name of the trendline. Read/write Boolean.

Version Information

Version Added: Word 2007

Syntax

expression .NameIsAuto

expression A variable that represents a Trendline object.

Example

The following example sets Microsoft Word to automatically determine the name for trendline one of the first chart in the active document. You should run the example on a 2-D column chart that contains a single series that has a trendline.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.SeriesCollection(1) _
 .Trendlines(1).NameIsAuto = True
 End If
End With

See also

Concepts

Trendline Object

Other resources

Trendline Object Members


Trendline.Order Property (Word)

 Copy code hover
[image]

Trendline.Order Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the trendline order (an integer greater than 1) when the trendline type is xlPolynomial. Read/write Long.

Version Information

Version Added: Word 2007

Syntax

expression .Order

expression A variable that represents a Trendline object.

See also

Concepts

Trendline Object

Other resources

Trendline Object Members


Trendline.Parent Property (Word)

 Copy code hover
[image]

Trendline.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the parent for the specified object. Read-only Object.

Version Information

Version Added: Word 2007

Syntax

expression .Parent

expression A variable that represents a Trendline object.

See also

Concepts

Trendline Object

Other resources

Trendline Object Members


Trendline.Period Property (Word)

 Copy code hover
[image]

Trendline.Period Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the period for the moving-average trendline. Read/write Long.

Version Information

Version Added: Word 2007

Syntax

expression .Period

expression A variable that represents a Trendline object.

Remarks

This property can have a value from 2 through 255.

Example

The following example sets the period for the moving-average trendline on the first chart in the active document. You should run the example on a 2-D column chart that has a single series that contains 10 data points and a moving-average trendline.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.SeriesCollection(1).Trendlines(1)
 If .Type = xlMovingAvg Then .Period = 5
 End With
 End If
End With

See also

Concepts

Trendline Object

Other resources

Trendline Object Members


Trendline.Type Property (Word)

 Copy code hover
[image]

Trendline.Type Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the trendline type. Read/write XlTrendlineType.

Version Information

Version Added: Word 2007

Syntax

expression .Type

expression A variable that represents a Trendline object.

Example

The following example changes the trendline type for the first series of the first chart in the active document. If the series has no trendline, this example fails.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.SeriesCollection(1).Trendlines(1).Type = xlMovingAvg
 End If
End With

See also

Concepts

Trendline Object

Other resources

Trendline Object Members


Trendline Methods (Word)

 Copy code hover
[image]

Trendline Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
ClearFormats | Clears the formatting of the object.
Delete | Deletes the object.
Select | Selects the object.


Trendline.ClearFormats Method (Word)

 Copy code hover
[image]

Trendline.ClearFormats Method (Word)
See also Send feedback

Published: July 16, 2012

Clears the formatting of the object.

Version Information

Version Added: Word 2007

Syntax

expression .ClearFormats

expression A variable that represents a Trendline object.

See also

Concepts

Trendline Object

Other resources

Trendline Object Members


Trendline.Delete Method (Word)

 Copy code hover
[image]

Trendline.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Version Information

Version Added: Word 2007

Syntax

expression .Delete

expression A variable that represents a Trendline object.

See also

Concepts

Trendline Object

Other resources

Trendline Object Members


Trendline.Select Method (Word)

 Copy code hover
[image]

Trendline.Select Method (Word)
See also Send feedback

Published: July 16, 2012

Selects the object.

Version Information

Version Added: Word 2007

Syntax

expression .Select

expression A variable that represents a Trendline object.

See also

Concepts

Trendline Object

Other resources

Trendline Object Members


Trendlines Object (Word)

 Copy code hover
[image]

Trendlines Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a collection of all the Trendline objects for the specified series.

Version Information

Version Added: Word 2007

Remarks

Each Trendline object represents a trendline in a chart. A trendline shows the trend, or direction, of data in a series.

Example

Use the Trendlines method to return the Trendlines collection. The following example displays the number of trendlines for series one of the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 MsgBox .Chart.SeriesCollection(1).Trendlines.Count
 End If
End With

Use the Add method to create a new trendline and add it to the series. The following example adds a linear trendline to the first series for the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.SeriesCollection(1) _
 .Trendlines.Add Type:=xlLinear, Name:="Linear Trend"
 End If
End With

Use Trendlines(Index), where Index is the trendline index number, to return a single TrendLine object. The following example changes the trendline type for the first series of the first chart in the active document. If the series has no trendline, this example will fail.

The index number denotes the order in which the trendlines were added to the series. Trendlines(1) is the first trendline added to the series, and Trendlines(Trendlines.Count) is the last one added.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.SeriesCollection(1).Trendlines(1).Type = xlMovingAvg
 End If
End With

See also

Concepts

Word Object Model Reference

Other resources

Trendlines Object Members


Trendlines Members (Word)

 Copy code hover
[image]

Trendlines Members (Word)
Send feedback

Published: July 16, 2012

Represents a collection of all the Trendline objects for the specified series.

Methods

Name | Description
Add | Creates a new trendline.
Item | Returns a single object from a collection.

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
Count | Returns the number of objects in the collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns the parent for the specified object. Read-only Object.


Trendlines Properties (Word)

 Copy code hover
[image]

Trendlines Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
Count | Returns the number of objects in the collection. Read-only Long.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns the parent for the specified object. Read-only Object.


Trendlines.Application Property (Word)

 Copy code hover
[image]

Trendlines.Application Property (Word)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Application

expression A variable that represents a Trendlines object.

Example

The following example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveDocument
If myObject.Application.Value = "Microsoft Word" Then
 MsgBox "This is a Word Application object."
Else
 MsgBox "This is not a Word Application object."
End If

See also

Concepts

Trendlines Object

Other resources

Trendlines Object Members


Trendlines.Count Property (Word)

 Copy code hover
[image]

Trendlines.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the number of objects in the collection. Read-only Long.

Version Information

Version Added: Word 2007

Syntax

expression .Count

expression A variable that represents a Trendlines object.

See also

Concepts

Trendlines Object

Other resources

Trendlines Object Members


Trendlines.Creator Property (Word)

 Copy code hover
[image]

Trendlines.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version Information

Version Added: Word 2007

Syntax

expression .Creator

expression A variable that represents a Trendlines object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD". This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Word has the creator code MSWD. For more information about this property, consult the language reference Help included with Microsoft Office for Mac.

See also

Concepts

Trendlines Object

Other resources

Trendlines Object Members


Trendlines.Parent Property (Word)

 Copy code hover
[image]

Trendlines.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the parent for the specified object. Read-only Object.

Version Information

Version Added: Word 2007

Syntax

expression .Parent

expression A variable that represents a Trendlines object.

See also

Concepts

Trendlines Object

Other resources

Trendlines Object Members


Trendlines Methods (Word)

 Copy code hover
[image]

Trendlines Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Creates a new trendline.
Item | Returns a single object from a collection.


Trendlines.Add Method (Word)

 Copy code hover
[image]

Trendlines.Add Method (Word)
See also Send feedback

Published: July 16, 2012

Creates a new trendline.

Version Information

Version Added: Word 2007

Syntax

expression .Add(Type, Order, Period, Forward, Backward, Intercept, DisplayEquation, DisplayRSquared, Name)

expression A variable that represents a Trendlines object.

Parameters

Name

Required/Optional

Data Type

Description

Type

Optional

XlTrendlineType

One of the enumeration values that specifies the trendline type. The default is xlLinear.

Order

Optional

Variant

The trendline order. Required ifType is set to xlPolynomial. If specified, the value must be an integer from 2 through 6.

Period

Optional

Variant

The trendline period. Required ifType is set to xlMovingAvg. If specified, the value must be an integer greater than 1 and less than the number of data points in the series to which you are adding a trendline.

Forward

Optional

Variant

The number of periods (or units on a scatter chart) that the trendline extends forward.

Backward

Optional

Variant

The number of periods (or units on a scatter chart) that the trendline extends backward.

Intercept

Optional

Variant

The trendline intercept. If specified, the value must be a double-precision floating-point number. If omitted, the intercept is automatically set by the regression, and the InterceptIsAuto property of the resulting Trendline object is set to True.

Note Note

This parameter is applicable only ifType is set to xlExponential, xlLinear, or xlPolynomial.

DisplayEquation

Optional

Variant

True to display the equation of the trendline on the chart (in the same data label as the R-squared value). The default is False.

DisplayRSquared

Optional

Variant

True to display the R-squared value of the trendline on the chart (in the same data label as the equation). The default is False.

Name

Optional

Variant

The name of the trendline. If omitted, Microsoft Word generates a name, and the NameIsAuto property of the resulting Trendline object is set to True.

Return Value

A Trendline object that represents the new trendline.

Example

The following example creates a new linear trendline for the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
    If .HasChart Then
        .Chart.SeriesCollection(1).Trendlines.Add
    End If
End With

See also

Concepts

Trendlines Object

Other resources

Trendlines Object Members


Trendlines.Item Method (Word)

 Copy code hover
[image]

Trendlines.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a single object from a collection.

Version Information

Version Added: Word 2007

Syntax

expression .Item(Index)

expression A variable that represents a Trendlines object.

Parameters

Name | Required/Optional | Data Type | Description
Index | Optional | Variant | The index number for the object.

Return Value

A Trendline object that the collection contains.

Example

The following example sets the number of units that the trendline on the first chart in the active document extends forward and backward. The example should be run on a 2-D column chart that contains a single series with a trendline.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.SeriesCollection(1).Trendlines.Item(1)
 .Forward = 5
 .Backward = .5
 End With
 End If
End With

See also

Concepts

Trendlines Object

Other resources

Trendlines Object Members


TwoInitialCapsException Object (Word)

 Copy code hover
[image]

TwoInitialCapsException Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a single initial-capital AutoCorrect exception. The TwoInitialCapsException object is a member of the TwoInitialCapsExceptions collection. The TwoInitialCapsExceptions collection includes all the items listed in the Don't correct box on the INitial CAps tab in the AutoCorrect Exceptions dialog box.

Remarks

Use TwoInitialCapsExceptions(Index), where Index is the initial capital exception name or the index number, to return a single TwoInitialCapsException object. The following example deletes the initial-capital exception named "KMenu."

VBA Copy code Copy code
AutoCorrect.TwoInitialCapsExceptions("KMenu").Delete

The index number represents the position of the initial-capital exception in the TwoInitialCapsExceptions collection. The following example displays the name of the first item in the TwoInitialCapsExceptions collection.

VBA Copy code Copy code
MsgBox AutoCorrect.TwoInitialCapsExceptions(1).Name

If the TwoInitialCapsAutoAdd property is True, words are automatically added to the list of initial-capital exceptions. Use the Add method to add an item to the TwoInitialCapsExceptions collection. The following example adds "INdustry" to the list of initial-capital exceptions.

VBA Copy code Copy code
AutoCorrect.TwoInitialCapsExceptions.Add Name:="INdustry"

See also

Concepts

Word Object Model Reference

Other resources

TwoInitialCapsException Object Members


TwoInitialCapsException Members (Word)

 Copy code hover
[image]

TwoInitialCapsException Members (Word)
Send feedback

Published: July 16, 2012

Represents a single initial-capital AutoCorrect exception. The TwoInitialCapsException object is a member of the TwoInitialCapsExceptions collection. The TwoInitialCapsExceptions collection includes all the items listed in the Don't correct box on the INitial CAps tab in the AutoCorrect Exceptions dialog box.

Methods

Name | Description
Delete | Deletes the specified two initial-capital exception from the collection of AutoCorrect exceptions.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Index | Returns a Long that represents the position of an item in a collection. Read-only.
Name | Returns the name of the specified object. Read-only String.
Parent | Returns an Object that represents the parent object of the specified TwoInitialCapsException object.


TwoInitialCapsException Properties (Word)

 Copy code hover
[image]

TwoInitialCapsException Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Index | Returns a Long that represents the position of an item in a collection. Read-only.
Name | Returns the name of the specified object. Read-only String.
Parent | Returns an Object that represents the parent object of the specified TwoInitialCapsException object.


TwoInitialCapsException.Application Property (Word)

 Copy code hover
[image]

TwoInitialCapsException.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a TwoInitialCapsException object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

TwoInitialCapsException Object

Other resources

TwoInitialCapsException Object Members


TwoInitialCapsException.Creator Property (Word)

 Copy code hover
[image]

TwoInitialCapsException.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a TwoInitialCapsException object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

TwoInitialCapsException Object

Other resources

TwoInitialCapsException Object Members


TwoInitialCapsException.Index Property (Word)

 Copy code hover
[image]

TwoInitialCapsException.Index Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the position of an item in a collection. Read-only.

Syntax

expression .Index

expression Required. A variable that represents a TwoInitialCapsException object.

See also

Concepts

TwoInitialCapsException Object

Other resources

TwoInitialCapsException Object Members


TwoInitialCapsException.Name Property (Word)

 Copy code hover
[image]

TwoInitialCapsException.Name Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the name of the specified object. Read-only String.

Syntax

expression .Name

expression Required. A variable that represents a TwoInitialCapsException object.

See also

Concepts

TwoInitialCapsException Object

Other resources

TwoInitialCapsException Object Members


TwoInitialCapsException.Parent Property (Word)

 Copy code hover
[image]

TwoInitialCapsException.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified TwoInitialCapsException object.

Syntax

expression .Parent

expression Required. A variable that represents a TwoInitialCapsException object.

See also

Concepts

TwoInitialCapsException Object

Other resources

TwoInitialCapsException Object Members


TwoInitialCapsException Methods (Word)

 Copy code hover
[image]

TwoInitialCapsException Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the specified two initial-capital exception from the collection of AutoCorrect exceptions.


TwoInitialCapsException.Delete Method (Word)

 Copy code hover
[image]

TwoInitialCapsException.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the specified two initial-capital exception from the collection of AutoCorrect exceptions.

Syntax

expression .Delete

expression Required. A variable that represents a TwoInitialCapsException object.

See also

Concepts

TwoInitialCapsException Object

Other resources

TwoInitialCapsException Object Members


TwoInitialCapsExceptions Object (Word)

 Copy code hover
[image]

TwoInitialCapsExceptions Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of TwoInitialCapsException objects that represent all the items listed in the Don't correct box on the INitial CAps tab in the AutoCorrect Exceptions dialog box.

Remarks

Use the TwoInitialCapsExceptions property to return the TwoInitialCapsExceptions collection. The following example displays the items in this collection.

VBA Copy code Copy code
For Each aCap In AutoCorrect.TwoInitialCapsExceptions
 MsgBox aCap.Name
Next aCap

If the TwoInitialCapsAutoAdd property is True, words are automatically added to the list of initial-capital exceptions. Use the Add method to add an item to the TwoInitialCapsExceptions collection. The following example adds "Industry" to the list of initial-capital exceptions.

VBA Copy code Copy code
AutoCorrect.TwoInitialCapsExceptions.Add Name:="INdustry"

Use TwoInitialCapsExceptions(Index), where Index is the initial cap name or the index number, to return a single TwoInitialCapsException object. The following example deletes the initial-capital item named "KMenu."

VBA Copy code Copy code
AutoCorrect.TwoInitialCapsExceptions("KMenu").Delete

The index number represents the position of the initial-capital exception in the TwoInitialCapsExceptions collection. The following example displays the name of the first item in the TwoInitialCapsExceptions collection.

VBA Copy code Copy code
MsgBox AutoCorrect.TwoInitialCapsExceptions(1).Name

See also

Concepts

Word Object Model Reference

Other resources

TwoInitialCapsExceptions Object Members


TwoInitialCapsExceptions Members (Word)

 Copy code hover
[image]

TwoInitialCapsExceptions Members (Word)
Send feedback

Published: July 16, 2012

A collection of TwoInitialCapsException objects that represent all the items listed in the Don't correct box on the INitial CAps tab in the AutoCorrect Exceptions dialog box.

Methods

Name | Description
Add | Returns a TwoInitialCapsException object that represents a new exception added to the list of AutoCorrect exceptions.
Item | Returns an individual TwoInitialCapsException object in a collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of exceptions in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified TwoInitialCapsExceptions object.


TwoInitialCapsExceptions Properties (Word)

 Copy code hover
[image]

TwoInitialCapsExceptions Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of exceptions in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified TwoInitialCapsExceptions object.


TwoInitialCapsExceptions.Application Property (Word)

 Copy code hover
[image]

TwoInitialCapsExceptions.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a TwoInitialCapsExceptions collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

TwoInitialCapsExceptions Collection Object

Other resources

TwoInitialCapsExceptions Object Members


TwoInitialCapsExceptions.Count Property (Word)

 Copy code hover
[image]

TwoInitialCapsExceptions.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of exceptions in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents a TwoInitialCapsExceptions collection.

See also

Concepts

TwoInitialCapsExceptions Collection Object

Other resources

TwoInitialCapsExceptions Object Members


TwoInitialCapsExceptions.Creator Property (Word)

 Copy code hover
[image]

TwoInitialCapsExceptions.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a TwoInitialCapsExceptions collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

TwoInitialCapsExceptions Collection Object

Other resources

TwoInitialCapsExceptions Object Members


TwoInitialCapsExceptions.Parent Property (Word)

 Copy code hover
[image]

TwoInitialCapsExceptions.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified TwoInitialCapsExceptions object.

Syntax

expression .Parent

expression Required. A variable that represents a TwoInitialCapsExceptions collection.

See also

Concepts

TwoInitialCapsExceptions Collection Object

Other resources

TwoInitialCapsExceptions Object Members


TwoInitialCapsExceptions Methods (Word)

 Copy code hover
[image]

TwoInitialCapsExceptions Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Returns a TwoInitialCapsException object that represents a new exception added to the list of AutoCorrect exceptions.
Item | Returns an individual TwoInitialCapsException object in a collection.


TwoInitialCapsExceptions.Add Method (Word)

 Copy code hover
[image]

TwoInitialCapsExceptions.Add Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a TwoInitialCapsException object that represents a new exception added to the list of AutoCorrect exceptions.

Syntax

expression .Add(Name)

expression Required. A variable that represents a TwoInitialCapsExceptions collection.

Parameters

Name | Required/Optional | Data Type | Description
Name | Required | String | The word with two initial capital letters that you want Microsoft Word to overlook.

Return Value

TwoInitialCapsException

Remarks

If the TwoInitialCapsAutoAdd property is True, words are automatically added to the list of initial-capital exceptions.

Example

This example adds the abbreviation addr. to the list of first-letter exceptions.

VBA Copy code Copy code
AutoCorrect.FirstLetterExceptions.Add Name:="addr."

This example adds MSOffice to the list of initial-capital exceptions.

VBA Copy code Copy code
AutoCorrect.TwoInitialCapsExceptions.Add Name:="MSOffice"

This example adds myCompany to the list of other corrections exceptions.

VBA Copy code Copy code
AutoCorrect.OtherCorrectionsExceptions.Add Name:="myCompany"

See also

Concepts

TwoInitialCapsExceptions Collection Object

Other resources

TwoInitialCapsExceptions Object Members


TwoInitialCapsExceptions.Item Method (Word)

 Copy code hover
[image]

TwoInitialCapsExceptions.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual TwoInitialCapsException object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents a TwoInitialCapsExceptions collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The individual object to be returned. Can be a Long indicating the ordinal position or a String representing the name of the individual object.

Return Value

TwoInitialCapsException

See also

Concepts

TwoInitialCapsExceptions Collection Object

Other resources

TwoInitialCapsExceptions Object Members


UndoRecord Object (Word)

 Copy code hover
[image]

UndoRecord Object (Word)
See also Send feedback

Published: July 16, 2012

Provides an entry point into the undo stack.

Version Information

Version Added: Word 2010

Remarks

Use the UndoRecord object to create and modify custom undo records in the Word 2010 undo stack.

Example

The following code example instantiates an UndoRecord object.

VBA Copy code Copy code
Dim objUndo As UndoRecord
Set objUndo = Application.UndoRecord

See also

Concepts

Working With the UndoRecord Object
Word Object Model Reference

Other resources

UndoRecord Object Members


UndoRecord Members (Word)

 Copy code hover
[image]

UndoRecord Members (Word)
Send feedback

Published: July 16, 2012

Provides an entry point into the undo stack.

Methods

Name | Description
EndCustomRecord | Completes the creation of a custom undo record.
StartCustomRecord | Initiates the creation of a custom undo record.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word 2010 application. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
CustomRecordLevel | Returns a Long that specifies the number of custom undo action calls that are currently active. Read-only.
CustomRecordName | Returns a String that specifies the entry that appears on the undo stack when all custom undo actions have completed. Read-only.
IsRecordingCustomRecord | Returns a Boolean that specifies whether a custom undo action is being recorded. Read-only.
Parent | Returns an Object that represents the parent object of the specified UndoRecord object.


UndoRecord Properties (Word)

 Copy code hover
[image]

UndoRecord Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word 2010 application. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
CustomRecordLevel | Returns a Long that specifies the number of custom undo action calls that are currently active. Read-only.
CustomRecordName | Returns a String that specifies the entry that appears on the undo stack when all custom undo actions have completed. Read-only.
IsRecordingCustomRecord | Returns a Boolean that specifies whether a custom undo action is being recorded. Read-only.
Parent | Returns an Object that represents the parent object of the specified UndoRecord object.


UndoRecord.Application Property (Word)

 Copy code hover
[image]

UndoRecord.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word 2010 application. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .Application

expression A variable that represents an UndoRecord object.

See also

Concepts

UndoRecord Object

Other resources

UndoRecord Object Members


UndoRecord.Creator Property (Word)

 Copy code hover
[image]

UndoRecord.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version Information

Version Added: Word 2010

Syntax

expression .Creator

expression A variable that represents a UndoRecord object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD". This property was primarily designed to be used on the Apple Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For more information about this property, see the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

UndoRecord Object

Other resources

UndoRecord Object Members


UndoRecord.CustomRecordLevel Property (Word)

 Copy code hover
[image]

UndoRecord.CustomRecordLevel Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that specifies the number of custom undo action calls that are currently active. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .CustomRecordLevel

expression A variable that represents a UndoRecord object.

Remarks

If no custom undo action is active, this property is set to 0.

Example

The following code example verifies that a custom undo record is currently recording. If not, the code creates a custom undo record. Finally, the code verifies that any custom undo action calls are active. If so, a message is printed to the Debug window.

VBA Copy code Copy code
Dim objUndo As UndoRecord

Sub MyFunction()
 Set objUndo = Application.UndoRecord

 ' Verify that a custom undo record is already being recorded, and if not, start one
 If objUndo.IsRecordingCustomRecord = False Then
 objUndo.StartCustomRecord("New Undo Record")
 End If
 ' Add some actions here.
 objUndo.EndCustomRecord

 ' Verify that any custom undo action calls are currently active.
 If objUndo.CustomRecordLevel > 0 Then
 Debug.Print "An undo record call was not closed!"
 End If
End Sub

See also

Concepts

UndoRecord Object

Other resources

UndoRecord Object Members


UndoRecord.CustomRecordName Property (Word)

 Copy code hover
[image]

UndoRecord.CustomRecordName Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a String that specifies the entry that appears on the undo stack when all custom undo actions have completed. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .CustomRecordName

expression A variable that represents a UndoRecord object.

Remarks

If custom undo records are nested within other custom undo records, this property specifies what string appears on the undo stack after all custom undo actions have completed. If multiple calls to the StartCustomRecord method are nested, the string specified by the first call will be returned by this property. If no action is active, the property returns an empty string.

Example

The following code example creates nested custom undo records. When the code completes, a message about each undo record is inserted into the active document, and "First call" appears as the entry on the undo stack.

Note Note

To run this code example, place it the code file for ThisDocument in the Visual Basic for Applications Project Explorer.

VBA Copy code Copy code
Sub WalkUndoRecordStack()
Dim objUndo As UndoRecord

'Create UndoRecord object
Set objUndo = Application.UndoRecord

'Begin first custom record
objUndo.StartCustomRecord ("First call")
    'Begin nested second custom record
    objUndo.StartCustomRecord ("Second call")
        'Begin nested third undo record
        objUndo.StartCustomRecord ("Third call")
            'Message for the third call is written first to the document
            Me.Content.InsertAfter "Third call. "
            'End third custom record
        objUndo.EndCustomRecord
        'Message for the second call is written second to the document
        Me.Content.InsertAfter "Second call. "
    'End second custom record
    objUndo.EndCustomRecord
    'Message for first call is written third to the document
    Me.Content.InsertAfter "First call. "
'End first custom record
objUndo.EndCustomRecord

Set objUndo = Nothing
End Sub

See also

Concepts

UndoRecord Object

Other resources

UndoRecord Object Members


UndoRecord.IsRecordingCustomRecord Property (Word)

 Copy code hover
[image]

UndoRecord.IsRecordingCustomRecord Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Boolean that specifies whether a custom undo action is being recorded. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .IsRecordingCustomRecord

expression A variable that represents a UndoRecord object.

Example

The following code example displays whether a custom undo action is currently being recorded.

VBA Copy code Copy code
Dim objUndo as UndoRecord
Set objUndo = Application.UndoRecord

If objUndo.IsRecordingCustomRecord = False Then
objUndo.StartCustomRecord ("My Custom Undo")
End If
'Custom undo actions here
objUndo.EndCustomRecord

See also

Concepts

UndoRecord Object

Other resources

UndoRecord Object Members


UndoRecord.Parent Property (Word)

 Copy code hover
[image]

UndoRecord.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified UndoRecord object.

Version Information

Version Added: Word 2010

Syntax

expression .Parent

expression A variable that represents a UndoRecord object.

See also

Concepts

UndoRecord Object

Other resources

UndoRecord Object Members


UndoRecord Methods (Word)

 Copy code hover
[image]

UndoRecord Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
EndCustomRecord | Completes the creation of a custom undo record.
StartCustomRecord | Initiates the creation of a custom undo record.


UndoRecord.EndCustomRecord Method (Word)

 Copy code hover
[image]

UndoRecord.EndCustomRecord Method (Word)
See also Send feedback

Published: July 16, 2012

Completes the creation of a custom undo record.

Version Information

Version Added: Word 2010

Syntax

expression .EndCustomRecord

expression A variable that represents an UndoRecord object.

Remarks

You use the UndoRecord.StartCustomRecord to initiate the creation of a custom undo record. To complete the creation of a custom undo record, you use the EndCustomRecord method.

Example

The following code example creates a custom undo record.

VBA Copy code Copy code
Sub TestUndo()
Dim objUndo As UndoRecord

Set objUndo = Application.UndoRecord
objUndo.StartCustomRecord ("My Custom Undo")
    'Add some actions here
objUndo.EndCustomRecord

End Sub

See also

Concepts

Working with the UndoRecord Object
UndoRecord Object

Other resources

UndoRecord Object Members


UndoRecord.StartCustomRecord Method (Word)

 Copy code hover
[image]

UndoRecord.StartCustomRecord Method (Word)
See also Send feedback

Published: July 16, 2012

Initiates the creation of a custom undo record.

Version Information

Version Added: Word 2010

Syntax

expression .StartCustomRecord(Name)

expression A variable that represents an UndoRecord object.

Parameters

Name

Required/Optional

Data Type

Description

Name

Optional

String

Specifies the name of the custom undo record. This string is limited to 64 characters. If a longer string is supplied, the string is truncated to 64 characters.

Note Note

If this parameter is omitted or is an empty string, Word 2010 uses the name of the first command executed as the name of the undo record.

Remarks

StartCustomRecord begins the creation of a custom undo record, which records all actions done to the application while it is active under a record defined by Name.

Example

VBA Copy code Copy code
Sub TestUndo()
Dim objUndo As UndoRecord

Set objUndo = Application.UndoRecord
objUndo.StartCustomRecord ("My Custom Undo")
    'Add some actions here
objUndo.EndCustomRecord

End Sub

See also

Concepts

Working with the UndoRecord Object
UndoRecord Object

Other resources

UndoRecord Object Members


UpBars Object (Word)

 Copy code hover
[image]

UpBars Object (Word)
See also Send feedback

Published: July 16, 2012

Represents the up bars in a chart group.

Version Information

Version Added: Word 2007

Remarks

Up bars connect points on series one with higher values on the last series in the chart group (the lines go up from series one). Only 2-D line groups that contain at least two series can have up bars. This object is not a collection. There is no object that represents a single up bar; you either enable up bars for all points in a chart group or you disable them.

If the HasUpDownBars property is False, most properties of the UpBars object are disabled.

Example

Use the UpBars property to return the UpBars object. The following example enables up and down bars for chart group one of the first chart in the active document. The example then sets the up bar color to blue and sets the down bar color to red.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.ChartGroups(1)
 .HasUpDownBars = True
 .UpBars.Interior.Color = RGB(0, 0, 255)
 .DownBars.Interior.Color = RGB(255, 0, 0)
 End With
 End If
End With

See also

Concepts

Word Object Model Reference

Other resources

UpBars Object Members


UpBars Members (Word)

 Copy code hover
[image]

UpBars Members (Word)
Send feedback

Published: July 16, 2012

Represents the up bars in a chart group.

Methods

Name | Description
Delete | Deletes the object.
Select | Selects the object.

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
Border | Returns the border of the object. Read-only ChartBorder.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Fill | Returns a FillFormat object for the parent chart element that contains fill formatting properties for the chart element. Read-only.
Format | Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.
Interior | Returns the interior of the object. Read-only Interior.
Name | Returns the name of the object. Read-only String.
Parent | Returns the parent for the specified object. Read-only Object.


UpBars Properties (Word)

 Copy code hover
[image]

UpBars Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
Border | Returns the border of the object. Read-only ChartBorder.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Fill | Returns a FillFormat object for the parent chart element that contains fill formatting properties for the chart element. Read-only.
Format | Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.
Interior | Returns the interior of the object. Read-only Interior.
Name | Returns the name of the object. Read-only String.
Parent | Returns the parent for the specified object. Read-only Object.


UpBars.Application Property (Word)

 Copy code hover
[image]

UpBars.Application Property (Word)
See also Send feedback

Published: July 16, 2012

When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Application

expression A variable that represents an UpBars object.

Example

The following example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveDocument
If myObject.Application.Value = "Microsoft Word" Then
 MsgBox "This is a Word Application object."
Else
 MsgBox "This is not a Word Application object."
End If

See also

Concepts

UpBars Object

Other resources

UpBars Object Members


UpBars.Border Property (Word)

 Copy code hover
[image]

UpBars.Border Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the border of the object. Read-only ChartBorder.

Version Information

Version Added: Word 2007

Syntax

expression .Border

expression A variable that represents an UpBars object.

See also

Concepts

UpBars Object

Other resources

UpBars Object Members


UpBars.Creator Property (Word)

 Copy code hover
[image]

UpBars.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version Information

Version Added: Word 2007

Syntax

expression .Creator

expression A variable that represents an UpBars object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD". This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Word has the creator code MSWD. For more information about this property, consult the language reference Help included with Microsoft Office for Mac.

See also

Concepts

UpBars Object

Other resources

UpBars Object Members


UpBars.Fill Property (Word)

 Copy code hover
[image]

UpBars.Fill Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a FillFormat object for the parent chart element that contains fill formatting properties for the chart element. Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Fill

expression A variable that represents an UpBars object.

See also

Concepts

UpBars Object

Other resources

UpBars Object Members


UpBars.Format Property (Word)

 Copy code hover
[image]

UpBars.Format Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.

Version Information

Version Added: Word 2007

Syntax

expression .Format

expression A variable that represents an UpBars object.

See also

Concepts

UpBars Object

Other resources

UpBars Object Members


UpBars.Interior Property (Word)

 Copy code hover
[image]

UpBars.Interior Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the interior of the object. Read-only Interior.

Version Information

Version Added: Word 2007

Syntax

expression .Interior

expression A variable that represents an UpBars object.

Example

The following example enables up and down bars, then sets the interior color of the down bars to red and the up bars to green, for the first chart group of the first chart in the active document.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 With .Chart.ChartGroups(1)
 .HasUpDownBars = True
 .DownBars.Interior.ColorIndex = 3
 .UpBars.Interior.ColorIndex = 4
 End With
 End If
End With

See also

Concepts

UpBars Object

Other resources

UpBars Object Members


UpBars.Name Property (Word)

 Copy code hover
[image]

UpBars.Name Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the name of the object. Read-only String.

Version Information

Version Added: Word 2007

Syntax

expression .Name

expression A variable that represents an UpBars object.

See also

Concepts

UpBars Object

Other resources

UpBars Object Members


UpBars.Parent Property (Word)

 Copy code hover
[image]

UpBars.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the parent for the specified object. Read-only Object.

Version Information

Version Added: Word 2007

Syntax

expression .Parent

expression A variable that represents an UpBars object.

See also

Concepts

UpBars Object

Other resources

UpBars Object Members


UpBars Methods (Word)

 Copy code hover
[image]

UpBars Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the object.
Select | Selects the object.


UpBars.Delete Method (Word)

 Copy code hover
[image]

UpBars.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the object.

Version Information

Version Added: Word 2007

Syntax

expression .Delete

expression A variable that represents an UpBars object.

See also

Concepts

UpBars Object

Other resources

UpBars Object Members


UpBars.Select Method (Word)

 Copy code hover
[image]

UpBars.Select Method (Word)
See also Send feedback

Published: July 16, 2012

Selects the object.

Version Information

Version Added: Word 2007

Syntax

expression .Select

expression A variable that represents an UpBars object.

See also

Concepts

UpBars Object

Other resources

UpBars Object Members


Variable Object (Word)

 Copy code hover
[image]

Variable Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a variable stored as part of a document. Document variables are used to preserve macro settings in between macro sessions. The Variable object is a member of the Variables collection. The Variables collection includes all the document variables in a document or template.

Remarks

Use Variables(Index), where Index is the document variable name or the index number, to return a single Variable object. The following example displays the value of the Temp document variable in the active document.

VBA Copy code Copy code
MsgBox ActiveDocument.Variables("Temp").Value

The index number represents the position of the document variable in the Variables collection. The last variable added to the Variables collection is index number 1; the second-to-last variable added to the collection is index number 2, and so on. The following example displays the name of the first document variable in the active document.

VBA Copy code Copy code
MsgBox ActiveDocument.Variables(1).Name

Use the Add method of the Variables collection to add a variable to a document. The following example adds a document variable named "Temp" with a value of 12 to the active document.

VBA Copy code Copy code
ActiveDocument.Variables.Add Name:="Temp", Value:="12"

If you try to add a document variable with a name that already exists in the Variables collection, an error occurs. To avoid this error, you can enumerate the collection before adding any new variables. If the Blue document variable already exists in the active document, the following example sets its value to 6. If this variable does not already exist, this example adds it to the document and sets it to 6.

VBA Copy code Copy code
For Each aVar In ActiveDocument.Variables
 If aVar.Name = "Blue" Then num = aVar.Index
Next aVar
If num = 0 Then
 ActiveDocument.Variables.Add Name:="Blue", Value:=6
Else
 ActiveDocument.Variables(num).Value = 6
End If

Document variables are invisible to the user unless a DOCVARIABLE field is inserted with the appropriate variable name. The following example adds a document variable named "Temp" to the active document and then inserts a DOCVARIABLE field to display the value in the variable.

VBA Copy code Copy code
With ActiveDocument
 .Variables.Add Name:="Temp", Value:="12"
 .Fields.Add Range:=Selection.Range, _
 Type:=wdFieldDocVariable, Text:="Temp"
End With
ActiveDocument.ActiveWindow.View.ShowFieldCodes = False

To add a document variable to a template, open the template as a document by using the OpenAsDocument method. The following example stores the user name (from the Options dialog box) in the template attached to the active document.

VBA Copy code Copy code
ScreenUpdating = False
With ActiveDocument.AttachedTemplate.OpenAsDocument
 .Variables.Add Name:="UserName", Value:=Application.UserName
 .Close SaveChanges:=wdSaveChanges
End With

See also

Concepts

Word Object Model Reference

Other resources

Variable Object Members


Variable Members (Word)

 Copy code hover
[image]

Variable Members (Word)
Send feedback

Published: July 16, 2012

Represents a variable stored as part of a document. Document variables are used to preserve macro settings in between macro sessions. The Variable object is a member of the Variables collection. The Variables collection includes all the document variables in a document or template.

Methods

Name | Description
Delete | Deletes the specified variable.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Index | Returns a Long that represents the ordinal position of a variable with in the collection of variables. Read-only.
Name | Returns the name of the specified object. Read-only String.
Parent | Returns an Object that represents the parent object of the specified Variable object.
Value | Returns or sets the value of a document variable. Read/write String.


Variable Properties (Word)

 Copy code hover
[image]

Variable Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Index | Returns a Long that represents the ordinal position of a variable with in the collection of variables. Read-only.
Name | Returns the name of the specified object. Read-only String.
Parent | Returns an Object that represents the parent object of the specified Variable object.
Value | Returns or sets the value of a document variable. Read/write String.


Variable.Application Property (Word)

 Copy code hover
[image]

Variable.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a Variable object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

Variable Object

Other resources

Variable Object Members


Variable.Creator Property (Word)

 Copy code hover
[image]

Variable.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a Variable object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Variable Object

Other resources

Variable Object Members


Variable.Index Property (Word)

 Copy code hover
[image]

Variable.Index Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the ordinal position of a variable with in the collection of variables. Read-only.

Syntax

expression .Index

expression Required. A variable that represents a Variable object.

Example

This example adds a document variable to the active document and then returns the position of the specified variable in the Variables collection.

VBA Copy code Copy code
Set myVar = ActiveDocument.Variables.Add(Name:="Name", _
 Value:="Joe")
num = myVar.Index

See also

Concepts

Variable Object

Other resources

Variable Object Members


Variable.Name Property (Word)

 Copy code hover
[image]

Variable.Name Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the name of the specified object. Read-only String.

Syntax

expression .Name

expression Required. A variable that represents a Variable object.

See also

Concepts

Variable Object

Other resources

Variable Object Members


Variable.Parent Property (Word)

 Copy code hover
[image]

Variable.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Variable object.

Syntax

expression .Parent

expression Required. A variable that represents a Variable object.

See also

Concepts

Variable Object

Other resources

Variable Object Members


Variable.Value Property (Word)

 Copy code hover
[image]

Variable.Value Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the value of a document variable. Read/write String.

Syntax

expression .Value

expression Required. A variable that represents a Variable object.

Example

This example adds a document variable to the active document and then displays the value of the new variable.

VBA Copy code Copy code
ActiveDocument.Variables.Add Name:="Temp2", Value:="10"
MsgBox ActiveDocument.Variables("Temp2").Value
Caution note Caution

The value of a Variable object cannot be set to a zero-length string. Setting a Variable object to a zero-length string results in a run time error.

See also

Concepts

Variable Object

Other resources

Variable Object Members


Variable Methods (Word)

 Copy code hover
[image]

Variable Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the specified variable.


Variable.Delete Method (Word)

 Copy code hover
[image]

Variable.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the specified variable.

Syntax

expression .Delete

expression Required. A variable that represents a Variable object.

See also

Concepts

Variable Object

Other resources

Variable Object Members


Variables Object (Word)

 Copy code hover
[image]

Variables Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of Variable objects that represent the variables added to a document or template. Document variables are used to preserve macro settings in between macro sessions.

Remarks

Use the Variables property to return the Variables collection. The following example displays the number of variables in the document named "Sales.doc."

VBA Copy code Copy code
MsgBox Documents("Sales.doc").Variables.Count & " variables"

Use the Add method to add a variable to a document. The following example adds a document variable named "Temp" with a value of 12 to the active document.

VBA Copy code Copy code
ActiveDocument.Variables.Add Name:="Temp", Value:="12"

If you try to add a document variable with a name that already exists in the Variables collection, an error occurs. To avoid this error, you can enumerate the collection before adding any new variables. If the Blue document variable already exists in the active document, the following example sets its value to 6. If this variable doesn't already exist, this example adds it to the document and sets it to 6.

VBA Copy code Copy code
For Each aVar In ActiveDocument.Variables
 If aVar.Name = "Blue" Then num = aVar.Index
Next aVar
If num = 0 Then
 ActiveDocument.Variables.Add Name:="Blue", Value:=6
Else
 ActiveDocument.Variables(num).Value = 6
End If

Use Variables(Index), where Index is the document variable name or the index number, to return a single Variable object. The following example displays the value of the Temp document variable in the active document.

VBA Copy code Copy code
MsgBox ActiveDocument.Variables("Temp").Value

The index number represents the position of the document variable in the Variables collection. The first variable added to the Variables collection is index number 1; the second variable added to the collection is index number 2, and so on. The following example displays the name of the first document variable in the active document.

VBA Copy code Copy code
MsgBox ActiveDocument.Variables(1).Name

To add a variable to a template, open the template as a document by using the OpenAsDocument method. The following example stores the user name (from the Options dialog box) in the template attached to the active document.

VBA Copy code Copy code
ScreenUpdating = False
With ActiveDocument.AttachedTemplate.OpenAsDocument
 .Variables.Add Name:="UserName", Value:= Application.UserName
 .Close SaveChanges:=wdSaveChanges
End With

See also

Concepts

Word Object Model Reference

Other resources

Variables Object Members


Variables Members (Word)

 Copy code hover
[image]

Variables Members (Word)
Send feedback

Published: July 16, 2012

A collection of Variable objects that represent the variables added to a document or template. Document variables are used to preserve macro settings in between macro sessions.

Methods

Name | Description
Add | Returns a Variable object that represents a variable added to a document.
Item | Returns an individual Variable object in a collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of variables in the collection.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified Variables object.


Variables Properties (Word)

 Copy code hover
[image]

Variables Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of variables in the collection.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified Variables object.


Variables.Application Property (Word)

 Copy code hover
[image]

Variables.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a Variables collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

Variables Collection Object

Other resources

Variables Object Members


Variables.Count Property (Word)

 Copy code hover
[image]

Variables.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of variables in the collection.

Syntax

expression .Count

expression Required. A variable that represents a Variables collection.

See also

Concepts

Variables Collection Object

Other resources

Variables Object Members


Variables.Creator Property (Word)

 Copy code hover
[image]

Variables.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a Variables collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Variables Collection Object

Other resources

Variables Object Members


Variables.Parent Property (Word)

 Copy code hover
[image]

Variables.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Variables object.

Syntax

expression .Parent

expression Required. A variable that represents a Variables collection.

See also

Concepts

Variables Collection Object

Other resources

Variables Object Members


Variables Methods (Word)

 Copy code hover
[image]

Variables Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Returns a Variable object that represents a variable added to a document.
Item | Returns an individual Variable object in a collection.


Variables.Add Method (Word)

 Copy code hover
[image]

Variables.Add Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a Variable object that represents a variable added to a document.

Syntax

expression .Add(Name, Value)

expression Required. A variable that represents a Variables collection.

Parameters

Name | Required/Optional | Data Type | Description
Name | Required | String | The name of the document variable.
Value | Optional | Variant | The value for the document variable.

Return Value

Variable

Remarks

Document variables are invisible to the user unless a DOCVARIABLE field is inserted with the appropriate variable name. If you try to add a variable with a name that already exists in the Variables collection, an error occurs. To avoid this error, you can enumerate the collection before adding a new variable to it.

Example

This example adds a variable named Temp to the active document and then inserts a DOCVARIABLE field to display the value in the Temp variable.

VBA Copy code Copy code
With ActiveDocument
 .Variables.Add Name:="Temp", Value:="12"
 .Fields.Add Range:=Selection.Range, _
 Type:=wdFieldDocVariable, Text:="Temp"
End With
ActiveDocument.ActiveWindow.View.ShowFieldCodes = False

This example sets the value of the Blue variable to six. If this variable doesn't already exist, the example adds it to the document and sets it to six.

VBA Copy code Copy code
For Each aVar In ActiveDocument.Variables
 If aVar.Name = "Blue" Then num = aVar.Index
Next aVar
If num = 0 Then
 ActiveDocument.Variables.Add Name:="Blue", Value:=6
Else
 ActiveDocument.Variables(num).Value = 6
End If

This example stores the user name (from the Options dialog box) in the template attached to the active document.

VBA Copy code Copy code
ScreenUpdating = False
With ActiveDocument.AttachedTemplate.OpenAsDocument
 .Variables.Add Name:="UserName", Value:= Application.UserName
 .Close SaveChanges:=wdSaveChanges
End With

See also

Concepts

Variables Collection Object

Other resources

Variables Object Members


Variables.Item Method (Word)

 Copy code hover
[image]

Variables.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual Variable object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents a Variables collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The individual object to be returned. Can be a Long indicating the ordinal position or a String representing the name of the individual object.

Return Value

Variable

See also

Concepts

Variables Collection Object

Other resources

Variables Object Members


Version Object (Word)

 Copy code hover
[image]

Version Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a single version of a document. The Version object is a member of the Versions collection. The Versions collection includes all the versions of the specified document.

Remarks

Use Versions(Index), where Index is the index number, to return a single Version object. The index number represents the position of the version in the Versions collection. The first version added to the Versions collection is index number 1. The following example displays the comment, author, and date of the first version of the active document.

VBA Copy code Copy code
If ActiveDocument.Versions.Count >= 1 Then
 With ActiveDocument.Versions(1)
 MsgBox "Comment = " & .Comment & vbCr & "Author = " & _
 .SavedBy & vbCr & "Date = " & .Date
 End With
End If

Use the Save method to add an item to the Versions collection. The following example adds a version of the active document with the specified comment.

VBA Copy code Copy code
ActiveDocument.Versions.Save _
 Comment:="incorporated Judy's revisions"

See also

Concepts

Word Object Model Reference

Other resources

Version Object Members


Version Object Members (Word)

 Copy code hover
[image]

Version Object Members (Word)
Send feedback

Published: July 16, 2012

Represents a single version of a document. The Version object is a member of the Versions collection. The Versions collection includes all the versions of the specified document.

Methods

Name | Description
Delete | Deletes the specified version.
Open | Opens the specified version of a document. Returns a Document object representing the opened document.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Comment | Returns the comment associated with the specified version of a document. Read-only String.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Date | The date and time that the document version was saved. Read-only Date.
Index | Returns a Long that represents the position of an item in a collection. Read-only.
Parent | Returns an Object that represents the parent object of the specified Version object.
SavedBy | Returns the name of the user who saved the specified version of the document. Read-only String.


Version Properties (Word)

 Copy code hover
[image]

Version Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Comment | Returns the comment associated with the specified version of a document. Read-only String.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Date | The date and time that the document version was saved. Read-only Date.
Index | Returns a Long that represents the position of an item in a collection. Read-only.
Parent | Returns an Object that represents the parent object of the specified Version object.
SavedBy | Returns the name of the user who saved the specified version of the document. Read-only String.


Version.Application Property (Word)

 Copy code hover
[image]

Version.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a Version object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

Version Object

Other resources

Version Object Members


Version.Comment Property (Word)

 Copy code hover
[image]

Version.Comment Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the comment associated with the specified version of a document. Read-only String.

Syntax

expression .Comment

expression A variable that represents a Version object.

Example

This example displays the comment text for the first version of the active document.

VBA Copy code Copy code
If ActiveDocument.Versions.Count >= 1 Then
 MsgBox Prompt:=ActiveDocument.Versions(1).Comment, _
 Title:="First Version Comment"
End If

This example saves a version of the document with the user's comment and then displays the comment.

VBA Copy code Copy code
Dim verTemp As Versions
Dim strComment As String
Dim lngCount As Long

Set verTemp = ActiveDocument.Versions

strComment = InputBox("Type a comment")
verTemp.Save Comment:=strComment
lngCount = verTemp.Count
MsgBox Prompt:=verTemp(lngCount).Comment, _
 Title:=verTemp(lngCount).SavedBy

See also

Concepts

Version Object

Other resources

Version Object Members


Version.Creator Property (Word)

 Copy code hover
[image]

Version.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a Version object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Version Object

Other resources

Version Object Members


Version.Date Property (Word)

 Copy code hover
[image]

Version.Date Property (Word)
See also Send feedback

Published: July 16, 2012

The date and time that the document version was saved. Read-only Date.

Syntax

expression .Date

expression A variable that represents a Version object.

Example

This example displays the date and time that the last version of the active document was saved.

VBA Copy code Copy code
Dim docActive As Document

Set docActive = ActiveDocument
VBA Copy code Copy code
If docActive.Path <> "" Then MsgBox _
 docActive.Versions(docActive.Versions.Count).Date

This example displays the date and time of the next tracked change found in the active document.

VBA Copy code Copy code
Dim revTemp As Revision

If ActiveDocument.Revisions.Count >= 1 Then
 Set revTemp = Selection.NextRevision
 If Not (revTemp Is Nothing) Then MsgBox revTemp.Date
End If

See also

Concepts

Version Object

Other resources

Version Object Members


Version.Index Property (Word)

 Copy code hover
[image]

Version.Index Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the position of an item in a collection. Read-only.

Syntax

expression .Index

expression Required. A variable that represents a Version object.

See also

Concepts

Version Object

Other resources

Version Object Members


Version.Parent Property (Word)

 Copy code hover
[image]

Version.Parent Property (Word)
See also Send feedback

Returns an Object that represents the parent object of the specified Version object.

Syntax

expression .Parent

expression Required. A variable that represents a Version object.

See also

Concepts

Version Object

Other resources

Version Object Members


Version.SavedBy Property (Word)

 Copy code hover
[image]

Version.SavedBy Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the name of the user who saved the specified version of the document. Read-only String.

Syntax

expression .SavedBy

expression An expression that returns a Version object.

Example

This example displays the name of the user who saved the first version of the active document.

VBA Copy code Copy code
If ActiveDocument.Versions.Count >= 1 Then
 MsgBox ActiveDocument.Versions(1).SavedBy
End If

This example saves a version of the document with a comment and then displays the user name.

VBA Copy code Copy code
ActiveDocument.Versions.Save Comment:="Added client information"
last = ActiveDocument.Versions.Count
MsgBox ActiveDocument.Versions(last).SavedBy

See also

Concepts

Version Object

Other resources

Version Object Members


Version Methods (Word)

 Copy code hover
[image]

Version Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the specified version.
Open | Opens the specified version of a document. Returns a Document object representing the opened document.


Version.Delete Method (Word)

 Copy code hover
[image]

Version.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the specified version.

Syntax

expression .Delete

expression Required. A variable that represents a Version object.

See also

Concepts

Version Object

Other resources

Version Object Members


Version.Open Method (Word)

 Copy code hover
[image]

Version.Open Method (Word)
See also Send feedback

Opens the specified version of a document. Returns a Document object representing the opened document.

Syntax

expression .Open

expression Required. A variable that represents a Version object.

Return Value

Document

Example

This example opens the most recent version of Report.doc.

VBA Copy code Copy code
Sub OpenVersion()
 Dim mydoc As Document
 Set mydoc = Documents.Open("C:\MyFiles\Report.doc")
 If mydoc.Versions.Count > 0 Then
 mydoc.Versions(mydoc.Versions.Count).Open
 Else
 MsgBox "There are no saved versions for this document."
 End If
End Sub

See also

Concepts

Version Object

Other resources

Version Object Members


View Object (Word)

 Copy code hover
[image]

View Object (Word)
See also Send feedback

Published: July 16, 2012

Contains the view attributes (such as show all, field shading, and table gridlines) for a window or pane.

Remarks

Use the View property to return the View object. The following example sets view options for the active window.

VBA Copy code Copy code
With ActiveDocument.ActiveWindow.View
 .ShowAll = True
 .TableGridlines = True
 .WrapToWindow = False
End With

Use the Type property to change the view. The following example switches the active window to normal view.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.View.Type = wdNormalView

Use the Percentage property to change the size of the text on-screen. The following example enlarges the on-screen text to 120 percent.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.View.Zoom.Percentage = 120

Use the SeekView property to view comments, endnotes, footnotes, or the document header or footer. The following example displays the current footer in the active window in print layout view.

VBA Copy code Copy code
With ActiveDocument.ActiveWindow.View
 .Type = wdPrintView
 .SeekView = wdSeekCurrentPageFooter
End With

See also

Concepts

Word Object Model Reference

Other resources

View Object Members


View Object Members (Word)

 Copy code hover
[image]

View Object Members (Word)
Send feedback

Published: July 16, 2012

Contains the view attributes (such as show all, field shading, and table gridlines) for a window or pane.

Methods

Name | Description
CollapseAllHeadings | Collapses all the headings in the document.
CollapseOutline | Collapses the text under the selection or the specified range by one heading level.
ExpandAllHeadings | Expands all the headings in the document.
ExpandOutline | Expands the text under the selection by one heading level.
ForceLowresUpdate |
ForceOffscreenUpdate |
NextHeaderFooter | Moves to the next header or footer, depending on whether a header or footer is displayed in the view.
PreviousHeaderFooter | Moves to the previous header or footer, depending on whether a header or footer is displayed in the view.
ShowAllHeadings | Switches between showing all text (headings and body text) and showing only headings.
ShowHeading | Shows all headings up to the specified heading level and hides subordinate headings and body text.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
ColumnWidth | Returns or gets a constant that determines the column width in reading mode. Read-write WdColumnWidth
ConflictMode | True if the document is in conflict mode view. Read/write.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
DisplayBackgrounds | Returns or sets a Boolean that represents whether background colors and images are shown when a document is displayed in print layout view. .
DisplayPageBoundaries | True to display the top and bottom margins (white space) and the gray area (gray space) between pages in a document. Read/write Boolean.
Draft | True if all the text in a window is displayed in the same sans-serif font with minimal formatting to speed up display. Read/write Boolean.
FieldShading | Returns or sets on-screen shading for fields. Read/write WdFieldShading.
FullScreen | True if the window is in full-screen view. Read/write Boolean.
Magnifier | True if the pointer is displayed as a magnifying glass in print preview, indicating that the user can click to zoom in on a particular area of the page or zoom out to see an entire page or spread of pages. Read/write Boolean.
MailMergeDataView | True if mail merge data is displayed instead of mail merge fields in the specified window. Read/write Boolean.
MarkupMode | Returns or sets a WdRevisionsMode constant that represents the display mode for tracked changes. Read/write.
PageColor | Returns and sets the page color in Reading mode. Read-write WdPageColor.
Panning | Returns or sets a Boolean that represents whether Microsoft Word is in Panning mode. Read/write.
Parent | Returns an Object that represents the parent object of the specified View object.
ReadingLayout | Sets or returns a Boolean that represents whether a document is being viewed in reading layout view. .
ReadingLayoutActualView | Sets or returns a Boolean that represents whether pages displayed in reading layout view are displayed using the same layout as printed pages.
ReadingLayoutTruncateMargins | Returns or sets a WdReadingLayoutMargin constant that represents whether margins are visible or hidden when a document is viewed in Full Screen Reading view. Read/write.
RevisionsBalloonShowConnectingLines | True for Microsoft Word to display connecting lines from the text to the revision and comment balloons. Read/write Boolean.
RevisionsBalloonSide | Sets or returns a WdRevisionsBalloonMargin constant that specifies whether Word displays revision balloons in the left or right margin in a document.
RevisionsBalloonWidth | Sets or returns a Single representing the global setting in Microsoft Word that specifies the width of the revision balloons. Read/write.
RevisionsBalloonWidthType | Sets or returns a WdRevisionsBalloonWidthType constant representing the global setting that specifies how Microsoft Word measures the width of revision balloons. Read/write.
RevisionsFilter | Returns an instance of a RevisionsFilter object. Read-only.
SeekView | Returns or sets the document element displayed in print layout view. Read/write WdSeekView.
ShadeEditableRanges | Returns or sets a Long that represents whether shading is applied to the ranges in a document for which users have permission to modify. .
ShowAll | True if all nonprinting characters (such as hidden text, tab marks, space marks, and paragraph marks) are displayed. Read/write Boolean.
ShowBookmarks | True if square brackets are displayed at the beginning and end of each bookmark. Read/write Boolean.
ShowComments | True for Microsoft Word to display the comments in a document. Read/write Boolean.
ShowCropMarks | Returns or sets a Boolean that represents whether to show crop marks in the corners of pages to indicate where margins are located. Read/write.
ShowDrawings | True if objects created with the drawing tools are displayed in print layout view. Read/write Boolean.
ShowFieldCodes | True if field codes are displayed. Read/write Boolean.
ShowFirstLineOnly | True if only the first line of body text is shown in outline view. Read/write Boolean.
ShowFormat | True if character formatting is visible in outline view. Read/write Boolean.
ShowFormatChanges | True for Microsoft Word to display formatting changes made to a document with Track Changes enabled. Read/write Boolean.
ShowHiddenText | True if text formatted as hidden text is displayed. Read/write Boolean.
ShowHighlight | True if highlight formatting is displayed and printed with a document. Read/write Boolean.
ShowHyphens | True if optional hyphens are displayed. An optional hyphen indicates where to break a word when it falls at the end of a line. Read/write Boolean.
ShowInkAnnotations | Returns or sets Boolean that shows or hides handwritten ink annotations. True displays ink annotations. False hides ink annotations.
ShowInsertionsAndDeletions | True for Microsoft Word to display insertions and deletions that were made to a document with Track Changes enabled. Read/write Boolean.
ShowMainTextLayer | True if the text in the specified document is visible when the header and footer areas are displayed. This property is equivalent to the Show/Hide Document Text button on the Header and Footer toolbar. Read/write Boolean.
ShowMarkupAreaHighlight | Returns or sets a Boolean that represents whether the markup area that shows revision and comment balloons is shaded. Read/write.
ShowObjectAnchors | True if object anchors are displayed next to items that can be positioned in print layout view. Read/write Boolean.
ShowOptionalBreaks | True if Microsoft Word displays optional line breaks. Read/write Boolean.
ShowOtherAuthors | True if other authors' presence should be visible in the document. Read/write Boolean.
ShowParagraphs | True if paragraph marks are displayed. Read/write Boolean.
ShowPicturePlaceHolders | True if blank boxes are displayed as placeholders for pictures. Read/write Boolean.
ShowRevisionsAndComments | True for Microsoft Word to display revisions and comments that were made to a document with Track Changes enabled. Read/write Boolean.
ShowSpaces | True if space characters are displayed. Read/write Boolean.
ShowTabs | True if tab characters are displayed. Read/write Boolean.
ShowTextBoundaries | True if dotted lines are displayed around page margins, text columns, objects, and frames in print layout view. Read/write Boolean.
ShowXMLMarkup | Returns a Long that represents whether XML tags are visible in a document.
SplitSpecial | Returns or sets the active window pane. Read/write WdSpecialPane.
TableGridlines | True if table gridlines are displayed. Read/write Boolean.
Type | Returns or sets the view type. Read/write WdViewType.
WrapToWindow | True if lines wrap at the right edge of the document window rather than at the right margin or the right column boundary. Read/write Boolean.
Zoom | Returns a Zoom object that represents the magnification for the specified view.


View Properties (Word)

 Copy code hover
[image]

View Properties (Word)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
ColumnWidth | Returns or gets a constant that determines the column width in reading mode. Read-write WdColumnWidth
ConflictMode | True if the document is in conflict mode view. Read/write.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
DisplayBackgrounds | Returns or sets a Boolean that represents whether background colors and images are shown when a document is displayed in print layout view. .
DisplayPageBoundaries | True to display the top and bottom margins (white space) and the gray area (gray space) between pages in a document. Read/write Boolean.
Draft | True if all the text in a window is displayed in the same sans-serif font with minimal formatting to speed up display. Read/write Boolean.
FieldShading | Returns or sets on-screen shading for fields. Read/write WdFieldShading.
FullScreen | True if the window is in full-screen view. Read/write Boolean.
Magnifier | True if the pointer is displayed as a magnifying glass in print preview, indicating that the user can click to zoom in on a particular area of the page or zoom out to see an entire page or spread of pages. Read/write Boolean.
MailMergeDataView | True if mail merge data is displayed instead of mail merge fields in the specified window. Read/write Boolean.
MarkupMode | Returns or sets a WdRevisionsMode constant that represents the display mode for tracked changes. Read/write.
PageColor | Returns and sets the page color in Reading mode. Read-write WdPageColor.
Panning | Returns or sets a Boolean that represents whether Microsoft Word is in Panning mode. Read/write.
Parent | Returns an Object that represents the parent object of the specified View object.
ReadingLayout | Sets or returns a Boolean that represents whether a document is being viewed in reading layout view. .
ReadingLayoutActualView | Sets or returns a Boolean that represents whether pages displayed in reading layout view are displayed using the same layout as printed pages.
ReadingLayoutTruncateMargins | Returns or sets a WdReadingLayoutMargin constant that represents whether margins are visible or hidden when a document is viewed in Full Screen Reading view. Read/write.
RevisionsBalloonShowConnectingLines | True for Microsoft Word to display connecting lines from the text to the revision and comment balloons. Read/write Boolean.
RevisionsBalloonSide | Sets or returns a WdRevisionsBalloonMargin constant that specifies whether Word displays revision balloons in the left or right margin in a document.
RevisionsBalloonWidth | Sets or returns a Single representing the global setting in Microsoft Word that specifies the width of the revision balloons. Read/write.
RevisionsBalloonWidthType | Sets or returns a WdRevisionsBalloonWidthType constant representing the global setting that specifies how Microsoft Word measures the width of revision balloons. Read/write.
RevisionsFilter | Returns an instance of a RevisionsFilter object. Read-only.
SeekView | Returns or sets the document element displayed in print layout view. Read/write WdSeekView.
ShadeEditableRanges | Returns or sets a Long that represents whether shading is applied to the ranges in a document for which users have permission to modify. .
ShowAll | True if all nonprinting characters (such as hidden text, tab marks, space marks, and paragraph marks) are displayed. Read/write Boolean.
ShowBookmarks | True if square brackets are displayed at the beginning and end of each bookmark. Read/write Boolean.
ShowComments | True for Microsoft Word to display the comments in a document. Read/write Boolean.
ShowCropMarks | Returns or sets a Boolean that represents whether to show crop marks in the corners of pages to indicate where margins are located. Read/write.
ShowDrawings | True if objects created with the drawing tools are displayed in print layout view. Read/write Boolean.
ShowFieldCodes | True if field codes are displayed. Read/write Boolean.
ShowFirstLineOnly | True if only the first line of body text is shown in outline view. Read/write Boolean.
ShowFormat | True if character formatting is visible in outline view. Read/write Boolean.
ShowFormatChanges | True for Microsoft Word to display formatting changes made to a document with Track Changes enabled. Read/write Boolean.
ShowHiddenText | True if text formatted as hidden text is displayed. Read/write Boolean.
ShowHighlight | True if highlight formatting is displayed and printed with a document. Read/write Boolean.
ShowHyphens | True if optional hyphens are displayed. An optional hyphen indicates where to break a word when it falls at the end of a line. Read/write Boolean.
ShowInkAnnotations | Returns or sets Boolean that shows or hides handwritten ink annotations. True displays ink annotations. False hides ink annotations.
ShowInsertionsAndDeletions | True for Microsoft Word to display insertions and deletions that were made to a document with Track Changes enabled. Read/write Boolean.
ShowMainTextLayer | True if the text in the specified document is visible when the header and footer areas are displayed. This property is equivalent to the Show/Hide Document Text button on the Header and Footer toolbar. Read/write Boolean.
ShowMarkupAreaHighlight | Returns or sets a Boolean that represents whether the markup area that shows revision and comment balloons is shaded. Read/write.
ShowObjectAnchors | True if object anchors are displayed next to items that can be positioned in print layout view. Read/write Boolean.
ShowOptionalBreaks | True if Microsoft Word displays optional line breaks. Read/write Boolean.
ShowOtherAuthors | True if other authors' presence should be visible in the document. Read/write Boolean.
ShowParagraphs | True if paragraph marks are displayed. Read/write Boolean.
ShowPicturePlaceHolders | True if blank boxes are displayed as placeholders for pictures. Read/write Boolean.
ShowRevisionsAndComments | True for Microsoft Word to display revisions and comments that were made to a document with Track Changes enabled. Read/write Boolean.
ShowSpaces | True if space characters are displayed. Read/write Boolean.
ShowTabs | True if tab characters are displayed. Read/write Boolean.
ShowTextBoundaries | True if dotted lines are displayed around page margins, text columns, objects, and frames in print layout view. Read/write Boolean.
ShowXMLMarkup | Returns a Long that represents whether XML tags are visible in a document.
SplitSpecial | Returns or sets the active window pane. Read/write WdSpecialPane.
TableGridlines | True if table gridlines are displayed. Read/write Boolean.
Type | Returns or sets the view type. Read/write WdViewType.
WrapToWindow | True if lines wrap at the right edge of the document window rather than at the right margin or the right column boundary. Read/write Boolean.
Zoom | Returns a Zoom object that represents the magnification for the specified view.


View.Application Property (Word)

 Copy code hover
[image]

View.Application Property (Word)
See also Send feedback

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a View object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

View Object

Other resources

View Object Members


View.ColumnWidth Property (Word)

 Copy code hover
[image]

View.ColumnWidth Property (Word)
See also Send feedback

Returns or gets a constant that determines the column width in reading mode. Read-write WdColumnWidth

Version information

Version Added: Word 2013

Syntax

expression .ColumnWidth

expression A variable that represents a View object.

Property value

WDCOLUMNWIDTH

See also

Concepts

View Object

Other resources

View Object Members


View.ConflictMode Property (Word)

 Copy code hover
[image]

View.ConflictMode Property (Word)
See also Send feedback

True if the document is in conflict mode view. Read/write.

Version Information

Version Added: Word 2010

Syntax

expression .ConflictMode

expression An expression that returns a View object.

See also

Concepts

View Object

Other resources

View Object Members


View.Creator Property (Word)

 Copy code hover
[image]

View.Creator Property (Word)
See also Send feedback

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a View object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

View Object

Other resources

View Object Members


View.DisplayBackgrounds Property (Word)

 Copy code hover
[image]

View.DisplayBackgrounds Property (Word)
See also Send feedback

Returns or sets a Boolean that represents whether background colors and images are shown when a document is displayed in print layout view. .

Syntax

expression .DisplayBackgrounds

expression An expression that returns a View object.

Remarks

Corresponds to the Background colors and images (Print view only) option located on the View tab of the Options dialog box.

Example

The following example hides background colors and images when the active document is displayed in print layout view.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.View.DisplayBackgrounds = False

See also

Concepts

View Object

Other resources

View Object Members


View.DisplayPageBoundaries Property (Word)

 Copy code hover
[image]

View.DisplayPageBoundaries Property (Word)
See also Send feedback

True to display the top and bottom margins (white space) and the gray area (gray space) between pages in a document. Read/write Boolean.

Syntax

expression .DisplayPageBoundaries

expression An expression that returns a View object.

Remarks

False to hide from view the white and gray space so that the pages flow together as one long page. The default value is True.

This feature is only available in the Print Layout view and only affects the gray space on the top and bottom of a page, not the left and right sides of a page. This setting affects the document in the in the specified window. When the document is saved, the state of this setting is saved with it.

Example

This example changes the current view to Print Layout and suppresses the white and gray space between document pages.

VBA Copy code Copy code
Sub WhiteSpace()
 With ActiveWindow.View
 .Type = wdPrintView
 .DisplayPageBoundaries = False
 End With
End Sub

See also

Concepts

View Object

Other resources

View Object Members


View.Draft Property (Word)

 Copy code hover
[image]

View.Draft Property (Word)
See also Send feedback

Published: July 16, 2012

True if all the text in a window is displayed in the same sans-serif font with minimal formatting to speed up display. Read/write Boolean.

Syntax

expression .Draft

expression A variable that represents a View object.

Example

This example displays the contents of the window for Document1 in the draft font.

VBA Copy code Copy code
Windows("Document1").View.Draft = True

This example toggles the draft font option for the active window.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.View.Draft = _
 Not ActiveDocument.ActiveWindow.View.Draft

See also

Concepts

View Object

Other resources

View Object Members


View.FieldShading Property (Word)

 Copy code hover
[image]

View.FieldShading Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets on-screen shading for fields. Read/write WdFieldShading.

Syntax

expression .FieldShading

expression Required. A variable that represents a View object.

Example

This example enables field shading for all form fields in the active window.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.View.FieldShading = _
 wdFieldShadingAlways

See also

Concepts

View Object

Other resources

View Object Members


View.FullScreen Property (Word)

 Copy code hover
[image]

View.FullScreen Property (Word)
See also Send feedback

Published: July 16, 2012

True if the window is in full-screen view. Read/write Boolean.

Syntax

expression .FullScreen

expression A variable that represents a View object.

Example

This example switches the active window to full-screen view.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.View.FullScreen = True

This example activates the window for Sales.doc and switches out of full-screen view.

VBA Copy code Copy code
With Windows("Sales.doc")
 .Activate
 .View.FullScreen = False
End With

See also

Concepts

View Object

Other resources

View Object Members


View.Magnifier Property (Word)

 Copy code hover
[image]

View.Magnifier Property (Word)
See also Send feedback

Published: July 16, 2012

True if the pointer is displayed as a magnifying glass in print preview, indicating that the user can click to zoom in on a particular area of the page or zoom out to see an entire page or spread of pages. Read/write Boolean.

Syntax

expression .Magnifier

expression An expression that returns a View object.

Remarks

This property generates an error if the view is not print preview.

Example

This example switches to print preview and changes the pointer to an insertion point.

VBA Copy code Copy code
PrintPreview = True
ActiveDocument.ActiveWindow.View.Magnifier = False

See also

Concepts

View Object

Other resources

View Object Members


View.MailMergeDataView Property (Word)

 Copy code hover
[image]

View.MailMergeDataView Property (Word)
See also Send feedback

Published: July 16, 2012

True if mail merge data is displayed instead of mail merge fields in the specified window. Read/write Boolean.

Syntax

expression .MailMergeDataView

expression An expression that returns a View object.

Remarks

If the specified window isn't a main document, an error occurs.

Example

If the active document includes at least one mail merge field, this example displays mail merge data from the first record in the attached data source.

VBA Copy code Copy code
If ActiveDocument.MailMerge.Fields.Count >= 1 Then
 ActiveDocument.MailMerge.DataSource.ActiveRecord = 1
 ActiveDocument.ActiveWindow.View.ShowFieldCodes = False
 ActiveDocument.ActiveWindow.View.MailMergeDataView = True
End If

This example switches between viewing mail merge fields and viewing the resulting data.

VBA Copy code Copy code
With ActiveDocument.ActiveWindow.View
 .ShowFieldCodes = False
 .MailMergeDataView = Not .MailMergeDataView
End With

See also

Concepts

View Object

Other resources

View Object Members


View.MarkupMode Property (Word)

 Copy code hover
[image]

View.MarkupMode Property (Word)
See also Send feedback

Returns or sets a WdRevisionsMode constant that represents the display mode for tracked changes. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .MarkupMode

expression An expression that returns a View object.

See also

Concepts

View Object

Other resources

View Object Members


View.PageColor Property (Word)

 Copy code hover
[image]

View.PageColor Property (Word)
See also Send feedback

Returns and sets the page color in Reading mode. Read-write WdPageColor.

Version information

Version Added: Word 2013

Syntax

expression .PageColor

expression A variable that represents a View object.

Property value

WDPAGECOLOR

See also

Concepts

View Object

Other resources

View Object Members


View.Panning Property (Word)

 Copy code hover
[image]

View.Panning Property (Word)
See also Send feedback

Returns or sets a Boolean that represents whether Microsoft Word is in Panning mode. Read/write.

Syntax

expression .Panning

expression An expression that returns a View object.

Remarks

Panning mode changes the mouse pointer to a hand and enables the user to press and drag the document to scroll through the pages.

See also

Concepts

View Object

Other resources

View Object Members


View.Parent Property (Word)

 Copy code hover
[image]

View.Parent Property (Word)
See also Send feedback

Returns an Object that represents the parent object of the specified View object.

Syntax

expression .Parent

expression Required. A variable that represents a View object.

See also

Concepts

View Object

Other resources

View Object Members


View.ReadingLayout Property (Word)

 Copy code hover
[image]

View.ReadingLayout Property (Word)
See also Send feedback

Sets or returns a Boolean that represents whether a document is being viewed in reading layout view. .

Syntax

expression .ReadingLayout

expression An expression that returns a View object.

Remarks

True switches the document to reading layout view. False closes reading layout view.

Example

The following example closes reading layout view.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.View.ReadingLayout = False

See also

Concepts

View Object

Other resources

View Object Members


View.ReadingLayoutActualView Property (Word)

 Copy code hover
[image]

View.ReadingLayoutActualView Property (Word)
See also Send feedback

Sets or returns a Boolean that represents whether pages displayed in reading layout view are displayed using the same layout as printed pages.

Syntax

expression .ReadingLayoutActualView

expression An expression that returns a View object.

Remarks

In reading layout view, pages are not displayed with the full content contained in the literal printed pages, as you would see in normal view or in print layout view. Instead they are displayed in screens. When the ReadingLayoutActualView property is set to True, the document is displayed as it would appear when printed. On smaller monitors, this requires a zoom level that makes the document hard to read, but it is fine for larger monitors.

Example

The following example displays the pages in reading layout view as they would appear if they were printed.

VBA Copy code Copy code
ActiveWindow.View.ReadingLayout = True
ActiveWindow.View.ReadingLayoutActualView = True

See also

Concepts

View Object

Other resources

View Object Members


View.ReadingLayoutTruncateMargins Property (Word)

 Copy code hover
[image]

View.ReadingLayoutTruncateMargins Property (Word)
See also Send feedback

Returns or sets a WdReadingLayoutMargin constant that represents whether margins are visible or hidden when a document is viewed in Full Screen Reading view. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .ReadingLayoutTruncateMargins

expression An expression that returns a View object.

See also

Concepts

View Object

Other resources

View Object Members


View.RevisionsBalloonShowConnectingLines Property (Word)

 Copy code hover
[image]

View.RevisionsBalloonShowConnectingLines Property (Word)
See also Send feedback

True for Microsoft Word to display connecting lines from the text to the revision and comment balloons. Read/write Boolean.

Syntax

expression .RevisionsBalloonShowConnectingLines

expression A variable that represents a View object.

Example

This example hides the lines connecting the document text with the corresponding revision or comment balloons.

VBA Copy code Copy code
Sub ShowConnectingLines()
 ActiveWindow.View _
 .RevisionsBalloonShowConnectingLines = False
End Sub

See also

Concepts

View Object

Other resources

View Object Members


View.RevisionsBalloonSide Property (Word)

 Copy code hover
[image]

View.RevisionsBalloonSide Property (Word)
See also Send feedback

Sets or returns a WdRevisionsBalloonMargin constant that specifies whether Word displays revision balloons in the left or right margin in a document.

Syntax

expression .RevisionsBalloonSide

expression Required. A variable that represents a View object.

Example

This example switches the revision balloons between the left side and the right side. This example assumes that the document in the active window contains revisions made by one or more reviewers and that revisions are displayed in balloons.

VBA Copy code Copy code
Sub ToggleRevisionBalloons()
 With ActiveWindow.View
 If .RevisionsBalloonSide = wdLeftMargin Then
 .RevisionsBalloonSide = wdRightMargin
 Else
 .RevisionsBalloonSide = wdLeftMargin
 End If
 End With
End Sub

See also

Concepts

View Object

Other resources

View Object Members


View.RevisionsBalloonWidth Property (Word)

 Copy code hover
[image]

View.RevisionsBalloonWidth Property (Word)
See also Send feedback

Sets or returns a Single representing the global setting in Microsoft Word that specifies the width of the revision balloons. Read/write.

Syntax

expression .RevisionsBalloonWidth

expression An expression that returns one a View object.

Remarks

The width of revision balloons includes padding of 0.5 inch between the document margin and the edge of the balloon and an eighth-inch between the edge of the balloon and the edge of the paper. Word adds space along the left or right edge of the paper. This width is extended into the margin and does not change the width of the document or paper size. Use the RevisionsBalloonWidthType property to specify the measurement to use when setting the RevisionsBalloonWidth property.

Example

This example sets the width of the revision balloons to one inch and displays the revision balloons in the left margin. This example assumes that the document in the active window contains revisions made by one or more reviewers and that revisions are displayed in balloons.

VBA Copy code Copy code
Sub BalloonWidth()
 With ActiveWindow.View
 .RevisionsBalloonWidthType = wdBalloonWidthPoints
 .RevisionsBalloonWidth = InchesToPoints(1)
 .RevisionsBalloonSide = wdLeftMargin
 End With
End Sub

See also

Concepts

View Object

Other resources

View Object Members


View.RevisionsBalloonWidthType Property (Word)

 Copy code hover
[image]

View.RevisionsBalloonWidthType Property (Word)
See also Send feedback

Sets or returns a WdRevisionsBalloonWidthType constant representing the global setting that specifies how Microsoft Word measures the width of revision balloons. Read/write.

Syntax

expression .RevisionsBalloonWidthType

expression Required. A variable that represents a View object.

Remarks

The RevisionsBalloonWidthType property sets the measurement unit to use when setting the RevisionsBalloonWidth property.

Example

This example sets the width of the revision balloons to twenty-five percent of the document's width. This example assumes that the document in the active window contains revisions made by one or more reviewers and that revisions are displayed in balloons.

VBA Copy code Copy code
Sub BalloonWidthType()
 With ActiveWindow.View
 .RevisionsBalloonWidthType = wdBalloonWidthPercent
 .RevisionsBalloonWidth = 25
 End With
End Sub

See also

Concepts

View Object

Other resources

View Object Members


View.RevisionsFilter Property (Word)

 Copy code hover
[image]

View.RevisionsFilter Property (Word)
See also Send feedback

Returns an instance of a RevisionsFilter object. Read-only.

Version information

Version Added: Word 2013

Syntax

expression .RevisionsFilter

expression A variable that represents a View object.

Property value

REVISIONSFILTER

See also

Concepts

View Object

Other resources

View Object Members
RevisionsFilter Object


View.SeekView Property (Word)

 Copy code hover
[image]

View.SeekView Property (Word)
See also Send feedback

Returns or sets the document element displayed in print layout view. Read/write WdSeekView.

Syntax

expression .SeekView

expression Required. A variable that represents a View object.

Remarks

This property generates an error if the view is not print layout view.

Example

If the active document has footnotes, this example displays footnotes in print layout view.

VBA Copy code Copy code
If ActiveDocument.Footnotes.Count >= 1 Then
 With ActiveDocument.ActiveWindow.View
 .Type = wdPrintView
 .SeekView = wdSeekFootnotes
 End With
End If

This example shows the first page footer for the current section.

VBA Copy code Copy code
ActiveDocument.PageSetup.DifferentFirstPageHeaderFooter = True
With ActiveDocument.ActiveWindow.View
 .Type = wdPrintView
 .SeekView = wdSeekFirstPageFooter
End With

If the selection is in a footnote or endnote area in print layout view, this example switches to the main document.

VBA Copy code Copy code
Set myView = ActiveDocument.ActiveWindow.View
If myView.SeekView = wdSeekFootnotes Or _
 myView.SeekView = wdSeekEndnotes Then
 myView.SeekView = wdSeekMainDocument
End If

See also

Concepts

View Object

Other resources

View Object Members


View.ShadeEditableRanges Property (Word)

 Copy code hover
[image]

View.ShadeEditableRanges Property (Word)
See also Send feedback

Returns or sets a Long that represents whether shading is applied to the ranges in a document for which users have permission to modify. .

Syntax

expression .ShadeEditableRanges

expression An expression that returns a View object.

Remarks

True shades the ranges in a document that users can modify. Range shading is on by default. When range shading is on, or when you set the property to True, the ShadeEditableRanges property returns a value of -1. When you set the ShadeEditableRanges property to False it returns a value of 0. The values have no meaning beyond indicating whether the property is True or False.

Example

The following example shades all ranges for which users have permission to modify.

VBA Copy code Copy code
ActiveWindow.View.ShadeEditableRanges = True

See also

Concepts

View Object

Other resources

View Object Members


View.ShowAll Property (Word)

 Copy code hover
[image]

View.ShowAll Property (Word)
See also Send feedback

Published: July 16, 2012

True if all nonprinting characters (such as hidden text, tab marks, space marks, and paragraph marks) are displayed. Read/write Boolean.

Syntax

expression .ShowAll

expression Required. A variable that represents a View object.

Example

This example displays all nonprinting characters in the active window.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.View.ShowAll = True

This example toggles the display of nonprinting characters in the first window.

VBA Copy code Copy code
Windows(1).View.ShowAll = Not Windows(1).View.ShowAll

See also

Concepts

View Object

Other resources

View Object Members


View.ShowBookmarks Property (Word)

 Copy code hover
[image]

View.ShowBookmarks Property (Word)
See also Send feedback

Published: July 16, 2012

True if square brackets are displayed at the beginning and end of each bookmark. Read/write Boolean.

Syntax

expression .ShowBookmarks

expression An expression that returns a View object.

Example

This example displays square brackets around bookmarks in all windows.

VBA Copy code Copy code
For Each aWindow In Windows
 aWindow.View.ShowBookmarks = True
Next aWindow

This example marks the selection with a bookmark, displays square brackets around each bookmark in the active document, and then collapses the selection.

VBA Copy code Copy code
ActiveDocument.Bookmarks.Add Range:=Selection.Range, Name:="temp"
ActiveDocument.ActiveWindow.View.ShowBookmarks = True
Selection.Collapse Direction:=wdCollapseStart

See also

Concepts

View Object

Other resources

View Object Members


View.ShowComments Property (Word)

 Copy code hover
[image]

View.ShowComments Property (Word)
See also Send feedback

True for Microsoft Word to display the comments in a document. Read/write Boolean.

Syntax

expression .ShowComments

expression An expression that returns a View object.

Remarks

If revision marks are displayed in balloons in the right or left margin, comments are displayed in balloons. If revision marks are displayed inline, the text to which comments apply is surrounded by wide-angled square brackets; when a user places the mouse pointer over the text within the brackets, the related comment is displayed in a square balloon directly above the mouse pointer.

Example

This example hides the comments in the active document. This example assumes that the document in the active window contains one or more comments.

VBA Copy code Copy code
Sub HideComments()
 ActiveWindow.View.ShowComments = False
End Sub

See also

Concepts

View Object

Other resources

View Object Members


View.ShowCropMarks Property (Word)

 Copy code hover
[image]

View.ShowCropMarks Property (Word)
See also Send feedback

Returns or sets a Boolean that represents whether to show crop marks in the corners of pages to indicate where margins are located. Read/write.

Syntax

expression .ShowCropMarks

expression An expression that returns a View object.

Remarks

Displaying crop marks does not allow a user to change the margins by dragging the crop marks. Crop marks are only displayed to indicate where margins are located in the page. This property corresponds to the Crop marks check box in the Advanced tab of the Word Options dialog box.

Note Note

Crop marks are shown by default in East Asian languages and are off by default in all other langauges.

See also

Concepts

View Object

Other resources

View Object Members


View.ShowDrawings Property (Word)

 Copy code hover
[image]

View.ShowDrawings Property (Word)
See also Send feedback

True if objects created with the drawing tools are displayed in print layout view. Read/write Boolean.

Syntax

expression .ShowDrawings

expression An expression that returns a View object.

Example

This example switches the active window to print layout view and displays objects created with the drawing tools.

VBA Copy code Copy code
With ActiveDocument.ActiveWindow.View
 .Type = wdPrintView
 .ShowDrawings = True
End With

See also

Concepts

View Object

Other resources

View Object Members


View.ShowFieldCodes Property (Word)

 Copy code hover
[image]

View.ShowFieldCodes Property (Word)
See also Send feedback

True if field codes are displayed. Read/write Boolean.

Syntax

expression .ShowFieldCodes

expression An expression that returns a View object.

Example

This example hides field codes in the window for Document1.

VBA Copy code Copy code
Windows("Document1").View.ShowFieldCodes = False

This example shows field codes in the first window.

VBA Copy code Copy code
Windows(1).View.ShowFieldCodes = True

This example toggles field codes in the active window.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.View.ShowFieldCodes = _
 Not ActiveDocument.ActiveWindow.View.ShowFieldCodes

See also

Concepts

View Object

Other resources

View Object Members


View.ShowFirstLineOnly Property (Word)

 Copy code hover
[image]

View.ShowFirstLineOnly Property (Word)
See also Send feedback

True if only the first line of body text is shown in outline view. Read/write Boolean.

Syntax

expression .ShowFirstLineOnly

expression An expression that returns a View object.

Remarks

This property generates an error if the view isn't outline or master document view.

Example

This example switches the active window to outline view and hides all but the first line of body text.

VBA Copy code Copy code
With ActiveDocument.ActiveWindow.View
 .Type = wdOutlineView
 .ShowFirstLineOnly = True
End With

See also

Concepts

View Object

Other resources

View Object Members


View.ShowFormat Property (Word)

 Copy code hover
[image]

View.ShowFormat Property (Word)
See also Send feedback

True if character formatting is visible in outline view. Read/write Boolean.

Syntax

expression .ShowFormat

expression An expression that returns a View object.

Remarks

This property generates an error if the view isn't outline or master document view.

Example

This example switches the active window to outline view and shows character formatting.

VBA Copy code Copy code
With ActiveDocument.ActiveWindow.View
 .Type = wdOutlineView
 .ShowFormat = True
End With

See also

Concepts

View Object

Other resources

View Object Members


View.ShowFormatChanges Property (Word)

 Copy code hover
[image]

View.ShowFormatChanges Property (Word)
See also Send feedback

True for Microsoft Word to display formatting changes made to a document with Track Changes enabled. Read/write Boolean.

Syntax

expression .ShowFormatChanges

expression An expression that returns a View object.

Example

This example hides the formatting changes made to the active document. This example assumes that formatting changes have been made to a document in which Track Changes is enabled.

VBA Copy code Copy code
Sub HideFormattingChanges()
 ActiveWindow.View.ShowFormatChanges = False
End Sub

See also

Concepts

View Object

Other resources

View Object Members


View.ShowHiddenText Property (Word)

 Copy code hover
[image]

View.ShowHiddenText Property (Word)
See also Send feedback

True if text formatted as hidden text is displayed. Read/write Boolean.

Syntax

expression .ShowHiddenText

expression An expression that returns a View object.

Example

This example hides text formatted as hidden text in each window.

VBA Copy code Copy code
For Each myWindow In Windows
 myWindow.View.ShowHiddenText = False
Next myWindow

This example toggles the display of hidden text.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.View.ShowHiddenText = _
 Not ActiveDocument.ActiveWindow.View.ShowHiddenText

See also

Concepts

View Object

Other resources

View Object Members


View.ShowHighlight Property (Word)

 Copy code hover
[image]

View.ShowHighlight Property (Word)
See also Send feedback

True if highlight formatting is displayed and printed with a document. Read/write Boolean.

Syntax

expression .ShowHighlight

expression An expression that returns a View object.

Example

This example toggles the display of highlighting in the active document.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.View.ShowHighlight = _
 Not ActiveDocument.ActiveWindow.View.ShowHighlight

This example prints the active document without highlight formatting.

VBA Copy code Copy code
With ActiveDocument
 .ActiveWindow.View.ShowHighlight = False
 .PrintOut
End With

See also

Concepts

View Object

Other resources

View Object Members


View.ShowHyphens Property (Word)

 Copy code hover
[image]

View.ShowHyphens Property (Word)
See also Send feedback

True if optional hyphens are displayed. An optional hyphen indicates where to break a word when it falls at the end of a line. Read/write Boolean.

Syntax

expression .ShowHyphens

expression An expression that returns a View object.

Example

This example inserts an optional hyphen before the selection and then displays optional hyphens in the active window.

VBA Copy code Copy code
Selection.InsertBefore Chr(31)
ActiveDocument.ActiveWindow.View.ShowHyphens = True

See also

Concepts

View Object

Other resources

View Object Members


View.ShowInkAnnotations Property (Word)

 Copy code hover
[image]

View.ShowInkAnnotations Property (Word)
See also Send feedback

Returns or sets Boolean that shows or hides handwritten ink annotations. True displays ink annotations. False hides ink annotations.

Syntax

expression .ShowInkAnnotations

expression A variable that represents a View object.

Remarks

To work with ink annotations, you must be running Microsoft Word on a tablet computer. For more information on adding handwritten ink annotations to a document, see "Mark up a document with ink annotations" in Microsoft Word Help.

Example

The following example shows all handwritten ink annotations in the active document.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.View.ShowInkAnnotations = True

See also

Concepts

View Object

Other resources

View Object Members


View.ShowInsertionsAndDeletions Property (Word)

 Copy code hover
[image]

View.ShowInsertionsAndDeletions Property (Word)
See also Send feedback

True for Microsoft Word to display insertions and deletions that were made to a document with Track Changes enabled. Read/write Boolean.

Syntax

expression .ShowInsertionsAndDeletions

expression An expression that returns a View object.

Example

This example hides the insertions and deletions made in a document. This example assumes that the document in the active window contains revisions made by one or more reviewers.

VBA Copy code Copy code
Sub HideInsertDelete()
 ActiveWindow.View.ShowInsertionsAndDeletions = False
End Sub

See also

Concepts

View Object

Other resources

View Object Members


View.ShowMainTextLayer Property (Word)

 Copy code hover
[image]

View.ShowMainTextLayer Property (Word)
See also Send feedback

True if the text in the specified document is visible when the header and footer areas are displayed. This property is equivalent to the Show/Hide Document Text button on the Header and Footer toolbar. Read/write Boolean.

Syntax

expression .ShowMainTextLayer

expression An expression that returns a View object.

Example

This example displays the document header in the active window and hides the document text.

VBA Copy code Copy code
With ActiveDocument.ActiveWindow.View
 .Type = wdPrintView
 .SeekView = wdSeekCurrentPageHeader
 .ShowMainTextLayer = False
End With

See also

Concepts

View Object

Other resources

View Object Members


View.ShowMarkupAreaHighlight Property (Word)

 Copy code hover
[image]

View.ShowMarkupAreaHighlight Property (Word)
See also Send feedback

Returns or sets a Boolean that represents whether the markup area that shows revision and comment balloons is shaded. Read/write.

Syntax

expression .ShowMarkupAreaHighlight

expression An expression that returns a View object.

Remarks

This property corresponds to the Markup Area Highlight option in the Show Markup menu on the Review ribbon.

See also

Concepts

View Object

Other resources

View Object Members


View.ShowObjectAnchors Property (Word)

 Copy code hover
[image]

View.ShowObjectAnchors Property (Word)
See also Send feedback

True if object anchors are displayed next to items that can be positioned in print layout view. Read/write Boolean.

Syntax

expression .ShowObjectAnchors

expression An expression that returns a View object.

Example

This example adds a frame around the selection, switches the active window to print layout view, and shows object anchors for framed objects.

VBA Copy code Copy code
Selection.Frames.Add(Range:=Selection.Range).LockAnchor = True
With ActiveDocument.ActiveWindow.View
 .Type = wdPrintView
 .ShowObjectAnchors = True
End With

See also

Concepts

View Object

Other resources

View Object Members


View.ShowOptionalBreaks Property (Word)

 Copy code hover
[image]

View.ShowOptionalBreaks Property (Word)
See also Send feedback

True if Microsoft Word displays optional line breaks. Read/write Boolean.

Syntax

expression .ShowOptionalBreaks

expression An expression that returns a View object.

Example

This example displays the optional line breaks in the active window.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.View.ShowOptionalBreaks = True

See also

Concepts

View Object

Other resources

View Object Members


View.ShowOtherAuthors Property (Word)

 Copy code hover
[image]

View.ShowOtherAuthors Property (Word)
See also Send feedback

True if other authors' presence should be visible in the document. Read/write Boolean.

Version Information

Version Added: Word 2010

Syntax

expression .ShowOtherAuthors

expression An expression that returns a View object.

Remarks

By default, when Word 2010 other authors are editing or have blocked off a section of the document. Use the ShowOtherAuthors property to toggle showing other authors' presence while co-authoring.

See also

Concepts

View Object

Other resources

View Object Members


View.ShowParagraphs Property (Word)

 Copy code hover
[image]

View.ShowParagraphs Property (Word)
See also Send feedback

True if paragraph marks are displayed. Read/write Boolean.

Syntax

expression .ShowParagraphs

expression An expression that returns a View object.

Example

This example hides paragraph marks in the active window.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.View.ShowParagraphs = False

See also

Concepts

View Object

Other resources

View Object Members


View.ShowPicturePlaceHolders Property (Word)

 Copy code hover
[image]

View.ShowPicturePlaceHolders Property (Word)
See also Send feedback

True if blank boxes are displayed as placeholders for pictures. Read/write Boolean.

Syntax

expression .ShowPicturePlaceHolders

expression An expression that returns a View object.

Example

This example inserts a picture in the active document and displays picture placeholders in the active window.

VBA Copy code Copy code
Selection.Collapse Direction:=wdCollapseStart
ActiveDocument.InlineShapes.AddPicture Range:=Selection.Range, _
 FileName:="C:\Windows\Bubbles.bmp"
ActiveDocument.ActiveWindow.View.ShowPicturePlaceHolders = True

See also

Concepts

View Object

Other resources

View Object Members


View.ShowRevisionsAndComments Property (Word)

 Copy code hover
[image]

View.ShowRevisionsAndComments Property (Word)
See also Send feedback

True for Microsoft Word to display revisions and comments that were made to a document with Track Changes enabled. Read/write Boolean.

Syntax

expression .ShowRevisionsAndComments

expression An expression that returns a View object.

Example

This example hides the revisions and comments in a document. This example assumes that the document in the active window contains revisions made by one or more reviewers.

VBA Copy code Copy code
Sub ShowRevsComments()
 ActiveWindow.View.ShowRevisionsAndComments = False
End Sub

See also

Concepts

View Object

Other resources

View Object Members


View.ShowSpaces Property (Word)

 Copy code hover
[image]

View.ShowSpaces Property (Word)
See also Send feedback

True if space characters are displayed. Read/write Boolean.

Syntax

expression .ShowSpaces

expression An expression that returns a View object.

Example

This example inserts spaces before the selection and displays space characters in the active window.

VBA Copy code Copy code
Selection.InsertBefore " "
ActiveDocument.ActiveWindow.View.ShowSpaces = True

See also

Concepts

View Object

Other resources

View Object Members


View.ShowTabs Property (Word)

 Copy code hover
[image]

View.ShowTabs Property (Word)
See also Send feedback

True if tab characters are displayed. Read/write Boolean.

Syntax

expression .ShowTabs

expression An expression that returns a View object.

Example

This example inserts a tab before the selection and displays tab characters in the window for Document2.

VBA Copy code Copy code
With Windows("Document2")
 .Activate
 .View.ShowTabs = True
End With
Selection.InsertBefore vbTab
Selection.Collapse Direction:=wdCollapseEnd

This example splits the active window, shows tab characters in the first pane, and hides tab characters in the second pane.

VBA Copy code Copy code
With ActiveDocument.ActiveWindow
 .Split = True
 .Panes(1).View.ShowTabs = True
 .Panes(2).View.ShowTabs = False
End With

See also

Concepts

View Object

Other resources

View Object Members


View.ShowTextBoundaries Property (Word)

 Copy code hover
[image]

View.ShowTextBoundaries Property (Word)
See also Send feedback

True if dotted lines are displayed around page margins, text columns, objects, and frames in print layout view. Read/write Boolean.

Syntax

expression .ShowTextBoundaries

expression An expression that returns a View object.

Example

This example switches the active window to page view and displays text boundary lines.

VBA Copy code Copy code
With ActiveDocument.ActiveWindow.View
 .Type = wdPrintView
 .ShowTextBoundaries = True
End With

See also

Concepts

View Object

Other resources

View Object Members


View.ShowXMLMarkup Property (Word)

 Copy code hover
[image]

View.ShowXMLMarkup Property (Word)
See also Send feedback

Returns a Long that represents whether XML tags are visible in a document.

Syntax

expression .ShowXMLMarkup

expression An expression that returns a View object.

Remarks

True indicates that tags are visible. False indicates that tags are hidden. wdToggle allows you to switch between showing and hiding the XML markup.

Example

The following example switches between showing and hiding the XML markup in the active document.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.View.ShowXMLMarkup = wdToggle

See also

Concepts

View Object

Other resources

View Object Members


View.SplitSpecial Property (Word)

 Copy code hover
[image]

View.SplitSpecial Property (Word)
See also Send feedback

Returns or sets the active window pane. Read/write WdSpecialPane.

Syntax

expression .SplitSpecial

expression A variable that represents a View object.

Example

This example displays the primary footer in a separate pane in the active window.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.View.SplitSpecial = wdPanePrimaryFooter

This example adds a footnote to the active document and displays all the footnotes in a separate pane in the active window.

VBA Copy code Copy code
ActiveDocument.Footnotes.Add Range:=Selection.Range, _
 Text:="Footnote text"
With ActiveDocument.ActiveWindow.View
 .Type = wdNormalView
 .SplitSpecial = wdPaneFootnotes
End With

See also

Concepts

View Object

Other resources

View Object Members


View.TableGridlines Property (Word)

 Copy code hover
[image]

View.TableGridlines Property (Word)
See also Send feedback

True if table gridlines are displayed. Read/write Boolean.

Syntax

expression .TableGridlines

expression An expression that returns a View object.

Example

This example displays table gridlines in the active window.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.View.TableGridlines = True

This example shows table gridlines for the panes associated with window one in the Windows collection.

VBA Copy code Copy code
For Each myPane In Windows(1).Panes
 myPane.View.TableGridlines = True
Next myPane

See also

Concepts

View Object

Other resources

View Object Members


View.Type Property (Word)

 Copy code hover
[image]

View.Type Property (Word)
See also Send feedback

Returns or sets the view type. Read/write WdViewType.

Syntax

expression .Type

expression Required. A variable that represents a View object.

Remarks

The Type property returns wdMasterView for all documents where the current view is an outline or a master document. The current view will never return wdOutlineView unless explicitly set first in code.

To check whether the current document is an outline, use the Type property and the Subdocuments collection's Count property. If the Type property returns either wdOutlineView or wdMasterView and the Count property returns zero, the document is an outline. For example:

VBA Copy code Copy code
Sub VerifyOutlineView()
 With ActiveWindow.View
 If .Type = wdOutlineView Or wdMasterView Then
 If ActiveDocument.Subdocuments.Count = 0 Then
 .
 .
 .
 End If
 End If
 End With
End Sub

Example

This example switches the active window to print preview. The Type property creates a new print preview window.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.View.Type = wdPrintPreview

See also

Concepts

View Object

Other resources

View Object Members


View.WrapToWindow Property (Word)

 Copy code hover
[image]

View.WrapToWindow Property (Word)
See also Send feedback

True if lines wrap at the right edge of the document window rather than at the right margin or the right column boundary. Read/write Boolean.

Syntax

expression .WrapToWindow

expression An expression that returns a View object.

Remarks

This property has no effect in print layout or Web layout view.

Example

This example wraps the text to fit within the active window.

VBA Copy code Copy code
With ActiveDocument.ActiveWindow.View
 .Type = wdNormalView
 .WrapToWindow = True
End With

See also

Concepts

View Object

Other resources

View Object Members


View.Zoom Property (Word)

 Copy code hover
[image]

View.Zoom Property (Word)
See also Send feedback

Returns a Zoom object that represents the magnification for the specified view.

Syntax

expression .Zoom

expression An expression that returns one of a View object.

Example

This example changes the zoom percentage of each open window to 125 percent.

VBA Copy code Copy code
Sub wndBig()
 Dim wndBig As Window

 For Each wndBig In Windows
 wndBig.View.Zoom.Percentage = 125
 Next wndBig
End Sub

This example changes the zoom percentage of the active window so that the entire width of the text is visible.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.View.Zoom.PageFit = wdPageFitBestFit

See also

Concepts

View Object

Other resources

View Object Members


View Methods (Word)

 Copy code hover
[image]

View Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
CollapseAllHeadings | Collapses all the headings in the document.
CollapseOutline | Collapses the text under the selection or the specified range by one heading level.
ExpandAllHeadings | Expands all the headings in the document.
ExpandOutline | Expands the text under the selection by one heading level.
ForceLowresUpdate |
ForceOffscreenUpdate |
NextHeaderFooter | Moves to the next header or footer, depending on whether a header or footer is displayed in the view.
PreviousHeaderFooter | Moves to the previous header or footer, depending on whether a header or footer is displayed in the view.
ShowAllHeadings | Switches between showing all text (headings and body text) and showing only headings.
ShowHeading | Shows all headings up to the specified heading level and hides subordinate headings and body text.


View.CollapseAllHeadings Method (Word)

 Copy code hover
[image]

View.CollapseAllHeadings Method (Word)
See also Send feedback

Collapses all the headings in the document.

Version information

Version Added: Word 2013

Syntax

expression .CollapseAllHeadings

expression A variable that represents a View object.

Return value

VOID

Remarks

This method corresponds to the Collapse All Headings command on the Expand/Collapse submenu of the context menu that appears when you right-click a heading.

See also

Concepts

View Object

Other resources

View Members


View.CollapseOutline Method (Word)

 Copy code hover
[image]

View.CollapseOutline Method (Word)
See also Send feedback

Collapses the text under the selection or the specified range by one heading level.

Syntax

expression .CollapseOutline(Range)

expression Required. A variable that represents a View object.

Parameters

Name | Required/Optional | Data Type | Description
Range | Optional | Range object | The range of paragraphs to be collapsed. If this argument is omitted, the entire selection is collapsed.

Remarks

If the document isn't in outline or master document view, an error occurs.

Example

This example applies the Heading 2 style to the second paragraph in the active document, switches the active window to outline view, and collapses the text under the second paragraph in the document.

VBA Copy code Copy code
ActiveDocument.Paragraphs(2).Style = wdStyleHeading2
With ActiveDocument.ActiveWindow.View
 .Type = wdOutlineView
 .CollapseOutline Range:=ActiveDocument.Paragraphs(2).Range
End With

This example collapses every heading in the document by one level.

VBA Copy code Copy code
With ActiveDocument.ActiveWindow.View
 .Type = wdOutlineView
 .CollapseOutline Range:=ActiveDocument.Content
End With

See also

Concepts

View Object

Other resources

View Object Members


View.ExpandAllHeadings Method (Word)

 Copy code hover
[image]

View.ExpandAllHeadings Method (Word)
See also Send feedback

Published: July 16, 2012

Expands all the headings in the document.

Version information

Version Added: Word 2013

Syntax

expression .ExpandAllHeadings

expression A variable that represents a View object.

Return value

VOID

Remarks

This method corresponds to the Expand All Headings command on the Expand/Collapse submenu of the context menu that appears when you right-click a heading.

See also

Concepts

View Object

Other resources

View Members


View.ExpandOutline Method (Word)

 Copy code hover
[image]

View.ExpandOutline Method (Word)
See also Send feedback

Published: July 16, 2012

Expands the text under the selection by one heading level.

Syntax

expression .ExpandOutline(Range)

expression Required. A variable that represents a View object.

Parameters

Name | Required/Optional | Data Type | Description
Range | Optional | Range | The range of paragraphs to be expanded. If this argument is omitted, the entire selection is expanded.

Remarks

If the document isn't in outline or master document view, an error occurs.

Example

This example expands every heading in the document by one level.

VBA Copy code Copy code
With ActiveDocument.ActiveWindow.View
 .Type = wdOutlineView
 .ExpandOutline Range:=ActiveDocument.Content
End With

This example expands the active paragraph in the Document2 window.

VBA Copy code Copy code
With Windows("Document2")
 .Activate
 .View.Type = wdOutlineView
 .View.ExpandOutline
End With

See also

Concepts

View Object

Other resources

View Object Members


View.NextHeaderFooter Method (Word)

 Copy code hover
[image]

View.NextHeaderFooter Method (Word)
See also Send feedback

Moves to the next header or footer, depending on whether a header or footer is displayed in the view.

Syntax

expression .NextHeaderFooter

expression Required. A variable that represents a View object.

Remarks

If the view displays a header, this method moves to the next header within the current section (for example, from an odd header to an even header) or to the first header in the following section. If the view displays a footer, this method moves to the next footer.

Note Note

If the view displays the last header or footer in the last section of the document, or if it is not displaying a header or footer at all, an error occurs.

Example

This example displays the first page header in the active document and then switches to the next header. The document needs to be at least two pages long.

VBA Copy code Copy code
ActiveDocument.PageSetup.DifferentFirstPageHeaderFooter = True
With ActiveDocument.ActiveWindow.View
 .Type = wdPrintView
 .SeekView =wdSeekFirstPageHeader
 .NextHeaderFooter
End With

See also

Concepts

View Object

Other resources

View Object Members


View.PreviousHeaderFooter Method (Word)

 Copy code hover
[image]

View.PreviousHeaderFooter Method (Word)
See also Send feedback

Moves to the previous header or footer, depending on whether a header or footer is displayed in the view.

Syntax

expression .PreviousHeaderFooter

expression Required. A variable that represents a View object.

Remarks

If the view displays a header, this method moves to the previous header within the current section (for example, from an even header to an odd header) or to the last header in the previous section. If the view displays a footer, this method moves to the previous footer.

Note Note

If the view displays the first header or footer in the first section of the document, or if it is not displaying a header or footer at all, an error occurs.

Example

This example inserts an even section break, switches the active window to print layout view, displays the current header, and then switches to the previous header.

VBA Copy code Copy code
Selection.Collapse Direction:=wdCollapseStart
Selection.InsertBreak Type:=wdSectionBreakEvenPage
With ActiveDocument.ActiveWindow.View
 .Type = wdPrintView
 .SeekView = wdSeekCurrentPageHeader
 .PreviousHeaderFooter
End With

See also

Concepts

View Object

Other resources

View Object Members


View.ShowAllHeadings Method (Word)

 Copy code hover
[image]

View.ShowAllHeadings Method (Word)
See also Send feedback

Switches between showing all text (headings and body text) and showing only headings.

Syntax

expression .ShowAllHeadings

expression Required. A variable that represents a View object.

Remarks

This method generates an error if the view isn't outline view or master document view.

Example

This example uses the ShowHeading method to show all headings (without any body text) and then switches the display to show all text (headings and body text) in outline view.

VBA Copy code Copy code
With ActiveDocument.ActiveWindow.View
 .Type = wdOutlineView
 .ShowHeading 9
 .ShowAllHeadings
End With

See also

Concepts

View Object

Other resources

View Object Members


View.ShowHeading Method (Word)

 Copy code hover
[image]

View.ShowHeading Method (Word)
See also Send feedback

Shows all headings up to the specified heading level and hides subordinate headings and body text.

Syntax

expression .ShowHeading(Level)

expression Required. A variable that represents a View object.

Parameters

Name | Required/Optional | Data Type | Description
Level | Required | Long | The outline heading level (a number from 1 to 9).

Remarks

This method generates an error if the view isn't outline view or master document view.

Example

This example switches the active window to outline view and displays all text that's formatted with the Heading 1 style. Body text and all other types of headings are hidden.

VBA Copy code Copy code
With ActiveDocument.ActiveWindow.View
 .Type = wdOutlineView
 .ShowHeading 1
End With

This example switches the window for Document1 to outline view and displays all text that's formatted with the Heading 1, Heading 2, or Heading 3 style.

VBA Copy code Copy code
With Windows("Document1").View
 .Type = wdOutlineView
 .ShowHeading 3
End With

See also

Concepts

View Object

Other resources

View Object Members


Walls Object (Word)

 Copy code hover
[image]

Walls Object (Word)
See also Send feedback

Represents the walls of a 3-D chart.

Version Information

Version Added: Word 2007

Remarks

This object is not a collection. There is no object that represents a single wall; you must return all the walls as a unit.

Example

Use the Walls property to return the Walls object. The following example sets the pattern on the walls for the first chart in the active document. If the chart is not a 3-D chart, this example will fail.

VBA Copy code Copy code
With ActiveDocument.InlineShapes(1)
 If .HasChart Then
 .Chart.Walls.Interior.Pattern = xlGray75
 End If
End With

See also

Concepts

Word Object Model Reference

Other resources

Walls Object Members


Walls Members (Word)

 Copy code hover
[image]

Walls Members (Word)
Send feedback

Represents the walls of a 3-D chart.

Methods

Name | Description
ClearFormats | Clears the formatting of the object.
Paste | Pastes a picture from the Clipboard on the walls of the specified chart.
Select | Selects the object.

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Format | Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.
Name | Returns the name of the object. Read-only String.
Parent | Returns the parent for the specified object. Read-only Object.
PictureType | Returns or sets a value that specifies how pictures are displayed on the walls and faces of a 3-D chart. Read/write Variant.
PictureUnit | Returns or sets the unit for each picture on the chart if the PictureType property is set to xlStackScale; otherwise, this property is ignored. Read/write Long.
Thickness | Returns or sets the thickness of the wall. Read/write Long.


Walls Properties (Word)

 Copy code hover
[image]

Walls Properties (Word)
Send feedback

This object has the following properties:

Properties

Name | Description
Application | When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Format | Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.
Name | Returns the name of the object. Read-only String.
Parent | Returns the parent for the specified object. Read-only Object.
PictureType | Returns or sets a value that specifies how pictures are displayed on the walls and faces of a 3-D chart. Read/write Variant.
PictureUnit | Returns or sets the unit for each picture on the chart if the PictureType property is set to xlStackScale; otherwise, this property is ignored. Read/write Long.
Thickness | Returns or sets the thickness of the wall. Read/write Long.


Walls.Application Property (Word)

 Copy code hover
[image]

Walls.Application Property (Word)
See also Send feedback

When used without an object qualifier, returns an Application object that represents the Microsoft Word application. When used with an object qualifier, returns an Application object that represents the creator of the specified object (you can use this property with an Automation object to return the application of that object). Read-only.

Version Information

Version Added: Word 2007

Syntax

expression .Application

expression A variable that represents a Walls object.

Example

The following example displays a message about the application that created myObject.

VBA Copy code Copy code
Set myObject = ActiveDocument
If myObject.Application.Value = "Microsoft Word" Then
 MsgBox "This is a Word Application object."
Else
 MsgBox "This is not a Word Application object."
End If

See also

Concepts

Walls Object

Other resources

Walls Object Members


Walls.Creator Property (Word)

 Copy code hover
[image]

Walls.Creator Property (Word)
See also Send feedback

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Version Information

Version Added: Word 2007

Syntax

expression .Creator

expression A variable that represents a Walls object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD". This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Word has the creator code MSWD. For more information about this property, consult the language reference Help included with Microsoft Office for Mac.

See also

Concepts

Walls Object

Other resources

Walls Object Members


Walls.Format Property (Word)

 Copy code hover
[image]

Walls.Format Property (Word)
See also Send feedback

Returns the line, fill, and effect formatting for the object. Read-only ChartFormat.

Version Information

Version Added: Word 2007

Syntax

expression .Format

expression A variable that represents a Walls object.

See also

Concepts

Walls Object

Other resources

Walls Object Members


Walls.Name Property (Word)

 Copy code hover
[image]

Walls.Name Property (Word)
See also Send feedback

Returns the name of the object. Read-only String.

Version Information

Version Added: Word 2007

Syntax

expression .Name

expression A variable that represents a Walls object.

See also

Concepts

Walls Object

Other resources

Walls Object Members


Walls.Parent Property (Word)

 Copy code hover
[image]

Walls.Parent Property (Word)
See also Send feedback

Returns the parent for the specified object. Read-only Object.

Version Information

Version Added: Word 2007

Syntax

expression .Parent

expression A variable that represents a Walls object.

See also

Concepts

Walls Object

Other resources

Walls Object Members


Walls.PictureType Property (Word)

 Copy code hover
[image]

Walls.PictureType Property (Word)
See also Send feedback

Returns or sets a value that specifies how pictures are displayed on the walls and faces of a 3-D chart. Read/write Variant.

Version Information

Version Added: Word 2007

Syntax

expression .PictureType

expression A variable that represents a Walls object.

Remarks

You can set this property to one of the following XlChartPictureType constants: xlStack or xlStretch.

See also

Concepts

Walls Object

Other resources

Walls Object Members


Walls.PictureUnit Property (Word)

 Copy code hover
[image]

Walls.PictureUnit Property (Word)
See also Send feedback

Returns or sets the unit for each picture on the chart if the PictureType property is set to xlStackScale; otherwise, this property is ignored. Read/write Long.

Version Information

Version Added: Word 2007

Syntax

expression .PictureUnit

expression A variable that represents a Walls object.

See also

Concepts

Walls Object

Other resources

Walls Object Members


Walls.Thickness Property (Word)

 Copy code hover
[image]

Walls.Thickness Property (Word)
See also Send feedback

Returns or sets the thickness of the wall. Read/write Long.

Version Information

Version Added: Word 2007

Syntax

expression .Thickness

expression A variable that represents a Walls object.

Remarks

Use this property to set the thickness of the walls on a chart. The default value is zero (0).

See also

Concepts

Walls Object

Other resources

Walls Object Members


Walls Methods (Word)

 Copy code hover
[image]

Walls Methods (Word)
Send feedback

This object has the following methods:

Methods

Name | Description
ClearFormats | Clears the formatting of the object.
Paste | Pastes a picture from the Clipboard on the walls of the specified chart.
Select | Selects the object.


Walls.ClearFormats Method (Word)

 Copy code hover
[image]

Walls.ClearFormats Method (Word)
See also Send feedback

Clears the formatting of the object.

Version Information

Version Added: Word 2007

Syntax

expression .ClearFormats

expression A variable that represents a Walls object.

See also

Concepts

Walls Object

Other resources

Walls Object Members


Walls.Paste Method (Word)

 Copy code hover
[image]

Walls.Paste Method (Word)
See also Send feedback

Pastes a picture from the Clipboard on the walls of the specified chart.

Version Information

Version Added: Word 2007

Syntax

expression .Paste

expression A variable that represents a Walls object.

Remarks

You can use this method on column, bar, line, or radar charts.

See also

Concepts

Walls Object

Other resources

Walls Object Members


Walls.Select Method (Word)

 Copy code hover
[image]

Walls.Select Method (Word)
See also Send feedback

Selects the object.

Version Information

Version Added: Word 2007

Syntax

expression .Select

expression A variable that represents a Walls object.

See also

Concepts

Walls Object

Other resources

Walls Object Members


WebOptions Object (Word)

 Copy code hover
[image]

WebOptions Object (Word)
See also Send feedback

Published: July 16, 2012

Contains document-level attributes used by Microsoft Word when you save a document as a Web page or open a Web page.

Remarks

You can return or set attributes either at the application (global) level or at the document level. (Note that attribute values can be different from one document to another, depending on the attribute value at the time the document was saved.) Document-level attribute settings override application-level attribute settings. Application-level attributes are contained in the DefaultWebOptions object.

Use the WebOptions property to return the WebOptions object. The following example checks to see whether PNG (Portable Network Graphics) is allowed as an image format and then sets the strImageFileType variable accordingly.

VBA Copy code Copy code
Set objAppWebOptions = ActiveDocument.WebOptions
With objAppWebOptions
 If .AllowPNG = True Then
 strImageFileType = "PNG"
 Else
 strImageFileType = "JPG"
 End If
End With

See also

Concepts

Word Object Model Reference

Other resources

WebOptions Object Members


WebOptions Members (Word)

 Copy code hover
[image]

WebOptions Members (Word)
Send feedback

Published: July 16, 2012

Contains document-level attributes used by Microsoft Word when you save a document as a Web page or open a Web page.

Methods

Name | Description
UseDefaultFolderSuffix | Sets the folder suffix for the specified document to the default suffix for the language support you have selected or installed.

Properties

Name | Description
AllowPNG | True if PNG (Portable Network Graphics) is allowed as an image format when you save a document as a Web page. False if PNG is not allowed as an output format. The default value is False. Read/write Boolean.
Application | Returns an Application object that represents the Microsoft Word application.
BrowserLevel | Returns or sets WdBrowserLevel that represents the level of Web browser at which you want to target the specified Web page. Read/write.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Encoding | Returns or sets the document encoding (code page or character set) to be used by the Web browser when you view the saved document. Read/write MsoEncoding.
FolderSuffix | Returns the folder suffix that Microsoft Word uses when you save a document as a Web page, use long file names, and choose to save supporting files in a separate folder (that is, if the UseLongFileNames and OrganizeInFolder properties are set to True). Read-only String.
OptimizeForBrowser | True if Word optimizes the specified Web page for the Web browser specified by the BrowserLevel property. Read/write Boolean.
OrganizeInFolder | True if all supporting files, such as background textures and graphics, are organized in a separate folder when you save the specified document as a Web page. False if supporting files are saved in the same folder as the Web page. The default value is True. Read/write Boolean.
Parent | Returns an Object that represents the parent object of the specified WebOptions object.
PixelsPerInch | Returns or sets the density (pixels per inch) of graphics images and table cells on a Web page. Read/write Long.
RelyOnCSS | True if cascading style sheets (CSS) are used for font formatting when you view a saved document in a Web browser. The default value is True. Read/write Boolean.
RelyOnVML | True if image files are not generated from drawing objects when you save a document as a Web page. False if images are generated. The default value is False. Read/write Boolean.
ScreenSize | Returns or sets the ideal minimum screen size (width by height, in pixels) that you should use when viewing the saved document in a Web browser. Read/write MsoScreenSize.
TargetBrowser | Sets or returns an MsoTargetBrowser constant representing the target browser for documents viewed in a Web browser. Read/write.
UseLongFileNames | True if long file names are used when you save the document as a Web page. False if long file names are not used and the DOS file name format (8.3) is used. The default value is True. Read/write Boolean.


WebOptions Properties (Word)

 Copy code hover
[image]

WebOptions Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
AllowPNG | True if PNG (Portable Network Graphics) is allowed as an image format when you save a document as a Web page. False if PNG is not allowed as an output format. The default value is False. Read/write Boolean.
Application | Returns an Application object that represents the Microsoft Word application.
BrowserLevel | Returns or sets WdBrowserLevel that represents the level of Web browser at which you want to target the specified Web page. Read/write.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Encoding | Returns or sets the document encoding (code page or character set) to be used by the Web browser when you view the saved document. Read/write MsoEncoding.
FolderSuffix | Returns the folder suffix that Microsoft Word uses when you save a document as a Web page, use long file names, and choose to save supporting files in a separate folder (that is, if the UseLongFileNames and OrganizeInFolder properties are set to True). Read-only String.
OptimizeForBrowser | True if Word optimizes the specified Web page for the Web browser specified by the BrowserLevel property. Read/write Boolean.
OrganizeInFolder | True if all supporting files, such as background textures and graphics, are organized in a separate folder when you save the specified document as a Web page. False if supporting files are saved in the same folder as the Web page. The default value is True. Read/write Boolean.
Parent | Returns an Object that represents the parent object of the specified WebOptions object.
PixelsPerInch | Returns or sets the density (pixels per inch) of graphics images and table cells on a Web page. Read/write Long.
RelyOnCSS | True if cascading style sheets (CSS) are used for font formatting when you view a saved document in a Web browser. The default value is True. Read/write Boolean.
RelyOnVML | True if image files are not generated from drawing objects when you save a document as a Web page. False if images are generated. The default value is False. Read/write Boolean.
ScreenSize | Returns or sets the ideal minimum screen size (width by height, in pixels) that you should use when viewing the saved document in a Web browser. Read/write MsoScreenSize.
TargetBrowser | Sets or returns an MsoTargetBrowser constant representing the target browser for documents viewed in a Web browser. Read/write.
UseLongFileNames | True if long file names are used when you save the document as a Web page. False if long file names are not used and the DOS file name format (8.3) is used. The default value is True. Read/write Boolean.


WebOptions.AllowPNG Property (Word)

 Copy code hover
[image]

WebOptions.AllowPNG Property (Word)
See also Send feedback

Published: July 16, 2012

True if PNG (Portable Network Graphics) is allowed as an image format when you save a document as a Web page. False if PNG is not allowed as an output format. The default value is False. Read/write Boolean.

Syntax

expression .AllowPNG

expression A variable that represents a WebOptions collection.

Remarks

If you save images in the PNG format and if the Web browsers you are targeting support the PNG format, you might improve the image quality or reduce the size of those image files, and therefore decrease the download time.

Example

This example enables PNG as an output format for the active document.

VBA Copy code Copy code
ActiveDocument.WebOptions.AllowPNG = True

See also

Concepts

WebOptions Object

Other resources

WebOptions Object Members


WebOptions.Application Property (Word)

 Copy code hover
[image]

WebOptions.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a WebOptions collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

WebOptions Object

Other resources

WebOptions Object Members


WebOptions.BrowserLevel Property (Word)

 Copy code hover
[image]

WebOptions.BrowserLevel Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets WdBrowserLevel that represents the level of Web browser at which you want to target the specified Web page. Read/write.

Syntax

expression .BrowserLevel

expression Required. A variable that represents a WebOptions collection.

Remarks

This property is ignored if the OptimizeForBrowser property is set to False.

After you set the BrowserLevel property on the DefaultWebOptions object, the BrowserLevel property of any new Web pages you create in Word will be the same as the global setting.

See also

Concepts

WebOptions Object

Other resources

WebOptions Object Members


WebOptions.Creator Property (Word)

 Copy code hover
[image]

WebOptions.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a WebOptions collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

WebOptions Object

Other resources

WebOptions Object Members


WebOptions.Encoding Property (Word)

 Copy code hover
[image]

WebOptions.Encoding Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the document encoding (code page or character set) to be used by the Web browser when you view the saved document. Read/write MsoEncoding.

Syntax

expression .Encoding

expression Required. A variable that represents a WebOptions collection.

Example

This example checks to see whether the default document encoding is Western, and then it sets the string strDocEncoding accordingly.

VBA Copy code Copy code
Dim strDocEncoding As String

If Application.DefaultWebOptions.Encoding _
 = msoEncodingWestern Then
 strDocEncoding = "Western"
Else
 strDocEncoding = "Other"
End If

See also

Concepts

WebOptions Object

Other resources

WebOptions Object Members


WebOptions.FolderSuffix Property (Word)

 Copy code hover
[image]

WebOptions.FolderSuffix Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the folder suffix that Microsoft Word uses when you save a document as a Web page, use long file names, and choose to save supporting files in a separate folder (that is, if the UseLongFileNames and OrganizeInFolder properties are set to True). Read-only String.

Syntax

expression .FolderSuffix

expression Required. A variable that represents a WebOptions collection.

Remarks

Newly created documents use the suffix returned by the FolderSuffix property of the DefaultWebOptions object. The value of the FolderSuffix property of the WebOptions object may differ from that of the DefaultWebOptions object if the document was previously edited in a different language version of Microsoft Word. You can use the UseDefaultFolderSuffix method to change the suffix to the language you are currently using in Microsoft Office.

By default, the name of the supporting folder is the name of the Web page plus an underscore (_), a period (.), or a hyphen (-) and the word "files" (appearing in the language of the version of Word in which the file was saved as a Web page). For example, suppose that you use the Dutch language version of Word to save a file called "Page1" as a Web page. The default name of the supporting folder is Page1_bestanden.

The following table lists each language version of Office and gives its corresponding LanguageID property value and folder suffix. For the languages that are not listed in the table, the suffix ".files" is used.

Language | LanguageID | Folder suffix
Arabic | 1025 | .files
Basque | 1069 | _fitxategiak
Portuguese (Brazil) | 1046 | _arquivos
Bulgarian | 1026 | .files
Catalan | 1027 | _fitxers
Chinese - Simplified | 2052 | .files
Chinese - Traditional | 1028 | .files
Croatian | 1050 | _datoteke
Czech | 1029 | _soubory
Danish | 1030 | -filer
Dutch | 1043 | _bestanden
English | 1033 | _files
Estonian | 1061 | _failid
Finnish | 1035 | _tiedostot
French | 1036 | _fichiers
German | 1031 | -Dateien
Greek | 1032 | .files
Hebrew | 1037 | .files
Hungarian | 1038 | _elemei
Italian | 1040 | _file
Japanese | 1041 | .files
Korean | 1042 | .files
Latvian | 1062 | _fails
Lithuanian | 1063 | _bylos
Norwegian | 1044 | -filer
Polish | 1045 | _pliki
Portuguese | 2070 | _ficheiros
Romanian | 1048 | .files
Russian | 1049 | .files
Serbian (Cyrillic) | 3098 | .files
Serbian (Latin) | 2074 | _fajlovi
Slovakian | 1051 | .files
Slovenian | 1060 | _datoteke
Spanish | 3082 | _archivos
Swedish | 1053 | -filer
Thai | 1054 | .files
Turkish | 1055 | _dosyalar
Ukranian | 1058 | .files
Vietnamese | 1066 | .files

Example

This example places the folder suffix used by the active document in a string variable.

VBA Copy code Copy code
strFolderSuffix = ActiveDocument.WebOptions.FolderSuffix

See also

Concepts

WebOptions Object

Other resources

WebOptions Object Members


WebOptions.OptimizeForBrowser Property (Word)

 Copy code hover
[image]

WebOptions.OptimizeForBrowser Property (Word)
See also Send feedback

Published: July 16, 2012

True if Word optimizes the specified Web page for the Web browser specified by the BrowserLevel property. Read/write Boolean.

Syntax

expression .OptimizeForBrowser

expression Required. A variable that represents a WebOptions collection.

Example

This example creates a new Web page and optimizes it for Microsoft Internet Explorer 5.

VBA Copy code Copy code
Documents.Add DocumentType:=wdNewWebPage
With ActiveDocument.WebOptions
 .BrowserLevel = wdBrowserLevelMicrosoftInternetExplorer5
 .OptimizeForBrowser = True
End With

See also

Concepts

WebOptions Object

Other resources

WebOptions Object Members


WebOptions.OrganizeInFolder Property (Word)

 Copy code hover
[image]

WebOptions.OrganizeInFolder Property (Word)
See also Send feedback

Published: July 16, 2012

True if all supporting files, such as background textures and graphics, are organized in a separate folder when you save the specified document as a Web page. False if supporting files are saved in the same folder as the Web page. The default value is True. Read/write Boolean.

Syntax

expression .OrganizeInFolder

expression Required. A variable that represents a WebOptions collection.

Remarks

The new folder is created in the folder where you have saved the Web page and is named after the document. If long file names are used, a suffix is added to the folder name. The FolderSuffix property returns wither the folder suffix for the language support you have selected or installed or the default folder suffix.

If you save a document that was previously saved with the OrganizeInFolder property set to a different value, Microsoft Word automatically moves the supporting files into or out of the folder, as appropriate.

If you don't use long file names (that is, if the UseLongFileNames property is set to False), Microsoft Word automatically saves any supporting files in a separate folder. The files cannot be saved in the same folder as the Web page.

Example

This example specifies that all supporting files are saved in the same folder when the document is saved as a Web page.

VBA Copy code Copy code
Application.DefaultWebOptions.OrganizeInFolder = False

See also

Concepts

WebOptions Object

Other resources

WebOptions Object Members


WebOptions.Parent Property (Word)

 Copy code hover
[image]

WebOptions.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified WebOptions object.

Syntax

expression .Parent

expression Required. A variable that represents a WebOptions collection.

See also

Concepts

WebOptions Object

Other resources

WebOptions Object Members


WebOptions.PixelsPerInch Property (Word)

 Copy code hover
[image]

WebOptions.PixelsPerInch Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the density (pixels per inch) of graphics images and table cells on a Web page. Read/write Long.

Syntax

expression .PixelsPerInch

expression Required. A variable that represents a WebOptions collection.

Remarks

The range of settings is usually from 19 to 480, and common settings for popular screen sizes are 72, 96, and 120. The default setting is 96.

This property determines the size of the images and cells on the specified Web page relative to the size of text whenever you view the saved document in a Web browser. The physical dimensions of the resulting image or cell are the result of the original dimensions (in inches) multiplied by the number of pixels per inch.

Use the ScreenSize property to set the optimum screen size for the targeted Web browsers.

Example

This example sets the pixel density depending on the target screen size of the Web browser.

VBA Copy code Copy code
With ActiveDocument.WebOptions
 Select Case .ScreenSize
 Case msoScreenSize800x600
 .PixelsPerInch = 72
 Case msoScreenSize1024x768
 .PixelsPerInch = 96
 Case Else
 .PixelsPerInch = 120
 End Select
End With

See also

Concepts

WebOptions Object

Other resources

WebOptions Object Members


WebOptions.RelyOnCSS Property (Word)

 Copy code hover
[image]

WebOptions.RelyOnCSS Property (Word)
See also Send feedback

Published: July 16, 2012

True if cascading style sheets (CSS) are used for font formatting when you view a saved document in a Web browser. The default value is True. Read/write Boolean.

Syntax

expression .RelyOnCSS

expression Required. A variable that represents a WebOptions collection.

Remarks

Microsoft Word creates a cascading style sheet file and saves it either to the specified folder or to the same folder as your Web page, depending on the value of the OrganizeInFolder property. False if HTML <FONT> tags and cascading style sheets are used.

You should set this property to True if your Web browser supports cascading style sheets because this will give you more precise layout and formatting control on your Web page and make it look more like your document (as it appears in Microsoft Word).

Example

This example enables the use of cascading style sheets as the global default for the application.

VBA Copy code Copy code
Application.DefaultWebOptions.RelyOnCSS = True

See also

Concepts

WebOptions Object

Other resources

WebOptions Object Members


WebOptions.RelyOnVML Property (Word)

 Copy code hover
[image]

WebOptions.RelyOnVML Property (Word)
See also Send feedback

Published: July 16, 2012

True if image files are not generated from drawing objects when you save a document as a Web page. False if images are generated. The default value is False. Read/write Boolean.

Syntax

expression .RelyOnVML

expression Required. A variable that represents a WebOptions collection.

Remarks

You can reduce file sizes by not generating images for drawing objects, if your Web browser supports Vector Markup Language (VML). For example, Microsoft Internet Explorer 5 supports this feature, and you should set the RelyOnVML property to True if you are targeting this browser. For browsers that do not support VML, the image will not appear when you view a Web page saved with this property enabled.

Don't generate images if your Web page uses image files that you have generated earlier and if the location where you save the document is different from the final location of the page on the Web server.

Example

This example specifies that images are generated when saving the document as a Web page.

VBA Copy code Copy code
ActiveDocument.WebOptions.RelyOnVML = False

See also

Concepts

WebOptions Object

Other resources

WebOptions Object Members


WebOptions.ScreenSize Property (Word)

 Copy code hover
[image]

WebOptions.ScreenSize Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the ideal minimum screen size (width by height, in pixels) that you should use when viewing the saved document in a Web browser. Read/write MsoScreenSize.

Syntax

expression .ScreenSize

expression Required. A variable that represents a WebOptions collection.

Example

This example sets the target screen size for the active Web page at 800x600 pixels.

VBA Copy code Copy code
ActiveDocument.WebOptions.ScreenSize = _
 msoScreenSize800x600

See also

Concepts

WebOptions Object

Other resources

WebOptions Object Members


WebOptions.TargetBrowser Property (Word)

 Copy code hover
[image]

WebOptions.TargetBrowser Property (Word)
See also Send feedback

Published: July 16, 2012

Sets or returns an MsoTargetBrowser constant representing the target browser for documents viewed in a Web browser. Read/write.

Syntax

expression .TargetBrowser

expression Required. A variable that represents a WebOptions collection.

Example

This example sets the target browser for the active document to Microsoft Internet Explorer 6 if the current target browser is an earlier version.

VBA Copy code Copy code
Sub SetWebBrowser()
 With ActiveDocument.WebOptions
 If .TargetBrowser < msoTargetBrowserIE6 Then
 .TargetBrowser = msoTargetBrowserIE6
 End If
 End With
End Sub

See also

Concepts

WebOptions Object

Other resources

WebOptions Object Members


WebOptions.UseLongFileNames Property (Word)

 Copy code hover
[image]

WebOptions.UseLongFileNames Property (Word)
See also Send feedback

Published: July 16, 2012

True if long file names are used when you save the document as a Web page. False if long file names are not used and the DOS file name format (8.3) is used. The default value is True. Read/write Boolean.

Syntax

expression .UseLongFileNames

expression Required. A variable that represents a WebOptions collection.

Remarks

If you don't use long file names and your document has supporting files, Microsoft Word automatically organizes those files in a separate folder. Otherwise, use the OrganizeInFolder property to determine whether supporting files are organized in a separate folder.

Example

This example disallows the use of long file names as the global default for the application.

VBA Copy code Copy code
Application.DefaultWebOptions.UseLongFileNames = False

See also

Concepts

WebOptions Object

Other resources

WebOptions Object Members


WebOptions Methods (Word)

 Copy code hover
[image]

WebOptions Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
UseDefaultFolderSuffix | Sets the folder suffix for the specified document to the default suffix for the language support you have selected or installed.


WebOptions.UseDefaultFolderSuffix Method (Word)

 Copy code hover
[image]

WebOptions.UseDefaultFolderSuffix Method (Word)
See also Send feedback

Published: July 16, 2012

Sets the folder suffix for the specified document to the default suffix for the language support you have selected or installed.

Syntax

expression .UseDefaultFolderSuffix

expression Required. A variable that represents a WebOptions collection.

Remarks

Microsoft Word uses the folder suffix when you save a document as a Web page, use long file names, and choose to save supporting files in a separate folder (that is, if the UseLongFileNames and OrganizeInFolder properties are set to True).

The suffix appears in the folder name after the document name. For example, if the document is called "Doc1" and the language is English, the folder name is Doc1_files. The available folder suffixes are listed in the FolderSuffix property topic.

Example

This example sets the folder suffix for the active document to the default suffix.

VBA Copy code Copy code
ActiveDocument.WebOptions.UseDefaultFolderSuffix

See also

Concepts

WebOptions Object

Other resources

WebOptions Object Members


Window Object (Word)

 Copy code hover
[image]

Window Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a window. Many document characteristics, such as scroll bars and rulers, are actually properties of the window.

Remarks

The Window object is a member of the Windows collection. The Windows collection for the Application object contains all the windows in the application, whereas the Windows collection for the Document object contains only the windows that display the specified document.

Use Windows(Index), where Index is the window name or the index number, to return a single Window object. The following example maximizes the Document1 window.

VBA Copy code Copy code
Windows("Document1").WindowState = wdWindowStateMaximize

The index number is the number to the left of the window name on the Window menu. The following example displays the caption of the first window in the Windows collection.

VBA Copy code Copy code
MsgBox Windows(1).Caption

Use the Add method or the NewWindow method to add a new window to the Windows collection. Each of the following statements creates a new window for the document in the active window.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.NewWindow
NewWindow
Windows.Add

A colon (:) and a number appear in the window caption when more than one window is open for a document.

When you switch the view to print preview, a new window is created. This window is removed from the Windows collection when you close print preview.

See also

Concepts

Word Object Model Reference

Other resources

Window Object Members


Window Members (Word)

 Copy code hover
[image]

Window Members (Word)
Send feedback

Published: July 16, 2012

Represents a window. Many document characteristics, such as scroll bars and rulers, are actually properties of the window.

Methods

Name | Description
Activate | Activates the specified window.
Close | Closes the specified window.
GetPoint | Returns the screen coordinates of the specified range or shape.
LargeScroll | Scrolls a window or pane by the specified number of screens.
NewWindow | Opens a new window with the same document as the specified window. Returns a Window object.
PageScroll | Scrolls through the specified pane or window page by page.
PrintOut | Prints all or part of the document displayed in the specified window.
RangeFromPoint | Returns the Range or Shape object that is located at the point specified by the screen position coordinate pair.
ScrollIntoView | Scrolls through the document window so the specified range or shape is displayed in the document window.
SetFocus | Sets the focus of the specified document window to the body of an e-mail message.
SmallScroll | Scrolls a window or pane by the specified number of lines.
ToggleRibbon | Shows or hides the ribbon.

Properties

Name | Description
Active | True if the specified window is active. Read-only Boolean.
ActivePane | Returns a Pane object that represents the active pane for the specified window. Read-only.
Application | Returns an Application object that represents the Microsoft OfficeWord application.
Caption | Returns or sets the caption text for the window that is displayed in the title bar of the document or application window. Read/write String.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
DisplayHorizontalScrollBar | True if a horizontal scroll bar is displayed for the specified window. Read/write Boolean.
DisplayLeftScrollBar | True if the vertical scroll bar appears on the left side of the document window. Read/write Boolean.
DisplayRightRuler | True if the vertical ruler appears on the right side of the document window in print layout view. Read/write Boolean.
DisplayRulers | True if rulers are displayed for the specified window or pane. Read/write Boolean.
DisplayScreenTips | True if comments, footnotes, endnotes, and hyperlinks are displayed as tips. Read/write Boolean.
DisplayVerticalRuler | True if a vertical ruler is displayed for the specified window or pane. Read/write Boolean.
DisplayVerticalScrollBar | True if a vertical scroll bar is displayed for the specified window. Read/write Boolean.
Document | Returns a Document object associated with the specified pane, window, or selection. Read-only.
DocumentMap | True if the document map is visible. Read/write Boolean.
EnvelopeVisible | True if the e-mail message header is visible in the document window. The default value is False. Read/write Boolean.
Height | Returns or sets the height of the window. Read/write Long.
HorizontalPercentScrolled | Returns or sets the horizontal scroll position as a percentage of the document width. Read/write Long.
Hwnd | Returns a Long that indicates the window handle of the specified window. Read-only.
IMEMode | Returns or sets the default start-up mode for the Japanese Input Method Editor (IME). Read/write WdIMEMode.
Index | Returns a Long that represents the position of an item in a collection. Read-only.
Left | Returns or sets a Long that represents the horizontal position of the specified window, measured in points. Read/write.
Next | Returns the next document window in the collection of open document windows. Read-only.
Panes | Returns a Panes collection that represents all the window panes for the specified window.
Parent | Returns an Object that represents the parent object of the specified Window object.
Previous | Returns the previous document window in the collection open document windows. Read-only.
Selection | Returns the Selection object that represents a selected range or the insertion point. Read-only.
ShowSourceDocuments | Returns or sets a WdShowSourceDocuments constant that represents how Microsoft Word displays source documents after a compare and merge process. Read/write.
Split | True if the window is split into multiple panes. Read/write Boolean.
SplitVertical | Returns or sets the vertical split percentage for the specified window. Read/write Long.
StyleAreaWidth | Returns or sets the width of the style area in points. Read/write Single.
Thumbnails | Sets or returns a Boolean that represents whether thumbnail images of the pages in a document are displayed along the left side of the Microsoft Word document window.
Top | Returns or sets the vertical position of the specified document window, in points. Read/write Long.
Type | Returns the window type. Read-only WdWindowType.
UsableHeight | Returns the height (in points) of the active working area in the specified document window. Read-only Long. .
UsableWidth | Returns the width (in points) of the active working area in the specified document window. Read-only Long.
VerticalPercentScrolled | Returns or sets the vertical scroll position as a percentage of the document length. Read/write Long.
View | Returns a View object that represents the view for the specified window or pane.
Visible | True if the specified object is visible. Read/write Boolean.
Width | Returns or sets the width of the specified document window, in points. Read/write Long.
WindowNumber | Returns the window number of the document displayed in the specified window. For example, if the caption of the window is "Sales.doc:2", this property returns the number 2. Read-only Long.
WindowState | Returns or sets the state of the specified document window or task window. Read/write WdWindowState.


Window Properties (Word)

 Copy code hover
[image]

Window Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Active | True if the specified window is active. Read-only Boolean.
ActivePane | Returns a Pane object that represents the active pane for the specified window. Read-only.
Application | Returns an Application object that represents the Microsoft OfficeWord application.
Caption | Returns or sets the caption text for the window that is displayed in the title bar of the document or application window. Read/write String.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
DisplayHorizontalScrollBar | True if a horizontal scroll bar is displayed for the specified window. Read/write Boolean.
DisplayLeftScrollBar | True if the vertical scroll bar appears on the left side of the document window. Read/write Boolean.
DisplayRightRuler | True if the vertical ruler appears on the right side of the document window in print layout view. Read/write Boolean.
DisplayRulers | True if rulers are displayed for the specified window or pane. Read/write Boolean.
DisplayScreenTips | True if comments, footnotes, endnotes, and hyperlinks are displayed as tips. Read/write Boolean.
DisplayVerticalRuler | True if a vertical ruler is displayed for the specified window or pane. Read/write Boolean.
DisplayVerticalScrollBar | True if a vertical scroll bar is displayed for the specified window. Read/write Boolean.
Document | Returns a Document object associated with the specified pane, window, or selection. Read-only.
DocumentMap | True if the document map is visible. Read/write Boolean.
EnvelopeVisible | True if the e-mail message header is visible in the document window. The default value is False. Read/write Boolean.
Height | Returns or sets the height of the window. Read/write Long.
HorizontalPercentScrolled | Returns or sets the horizontal scroll position as a percentage of the document width. Read/write Long.
Hwnd | Returns a Long that indicates the window handle of the specified window. Read-only.
IMEMode | Returns or sets the default start-up mode for the Japanese Input Method Editor (IME). Read/write WdIMEMode.
Index | Returns a Long that represents the position of an item in a collection. Read-only.
Left | Returns or sets a Long that represents the horizontal position of the specified window, measured in points. Read/write.
Next | Returns the next document window in the collection of open document windows. Read-only.
Panes | Returns a Panes collection that represents all the window panes for the specified window.
Parent | Returns an Object that represents the parent object of the specified Window object.
Previous | Returns the previous document window in the collection open document windows. Read-only.
Selection | Returns the Selection object that represents a selected range or the insertion point. Read-only.
ShowSourceDocuments | Returns or sets a WdShowSourceDocuments constant that represents how Microsoft Word displays source documents after a compare and merge process. Read/write.
Split | True if the window is split into multiple panes. Read/write Boolean.
SplitVertical | Returns or sets the vertical split percentage for the specified window. Read/write Long.
StyleAreaWidth | Returns or sets the width of the style area in points. Read/write Single.
Thumbnails | Sets or returns a Boolean that represents whether thumbnail images of the pages in a document are displayed along the left side of the Microsoft Word document window.
Top | Returns or sets the vertical position of the specified document window, in points. Read/write Long.
Type | Returns the window type. Read-only WdWindowType.
UsableHeight | Returns the height (in points) of the active working area in the specified document window. Read-only Long. .
UsableWidth | Returns the width (in points) of the active working area in the specified document window. Read-only Long.
VerticalPercentScrolled | Returns or sets the vertical scroll position as a percentage of the document length. Read/write Long.
View | Returns a View object that represents the view for the specified window or pane.
Visible | True if the specified object is visible. Read/write Boolean.
Width | Returns or sets the width of the specified document window, in points. Read/write Long.
WindowNumber | Returns the window number of the document displayed in the specified window. For example, if the caption of the window is "Sales.doc:2", this property returns the number 2. Read-only Long.
WindowState | Returns or sets the state of the specified document window or task window. Read/write WdWindowState.


Window.Active Property (Word)

 Copy code hover
[image]

Window.Active Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified window is active. Read-only Boolean.

Syntax

expression .Active

expression Required. A variable that represents a Window object.

Example

This example activates the first window in the Windows collection, if the window isn't currently active.

VBA Copy code Copy code
Sub ActiveWin()
 If Windows(1).Active = False Then Windows(1).Activate
End Sub

See also

Concepts

Window Object

Other resources

Window Object Members


Window.ActivePane Property (Word)

 Copy code hover
[image]

Window.ActivePane Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Pane object that represents the active pane for the specified window. Read-only.

Syntax

expression .ActivePane

expression A variable that represents a Window object.

Example

This example splits the active window and then activates the next pane after the active pane.

VBA Copy code Copy code
With ActiveDocument.ActiveWindow
 .Split = True
 .ActivePane.Next.Activate
 MsgBox "Pane " & .ActivePane.Index & " is active"
End With

This example activates the first window and displays tabs in the active pane.

VBA Copy code Copy code
With Application.Windows(1)
 .Activate
 .ActivePane.View.ShowTabs = True
End With

See also

Concepts

Window Object

Other resources

Window Object Members


Window.Application Property (Word)

 Copy code hover
[image]

Window.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft OfficeWord application.

Syntax

expression .Application

expression Required. A variable that represents a Window object.

Remarks

The Microsoft Visual Basic CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications (VBA) project.

See also

Concepts

Window Object

Other resources

Window Object Members


Window.Caption Property (Word)

 Copy code hover
[image]

Window.Caption Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the caption text for the window that is displayed in the title bar of the document or application window. Read/write String.

Syntax

expression .Caption

expression A variable that represents a Window object.

Remarks

To change the caption of the application window to the default text, set this property to an empty string ("").

Example

This example displays the caption of each window in the Windows collection.

VBA Copy code Copy code
Count = 1
For Each win In Windows
 MsgBox Prompt:=win.Caption, Title:="Window" & Str(Count) & _
 " Caption"
 Count = Count + 1
Next win

This example resets the caption of the application window.

VBA Copy code Copy code
Application.Caption = ""

This example sets the caption of the active window to the active document name.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.Caption = ActiveDocument.FullName

This example changes the caption of the Word application window to include the user name.

VBA Copy code Copy code
Application.Caption = UserName & "'s copy of Word"

This example inserts a Table caption and then changes the caption of the first table of figures to "Table."

VBA Copy code Copy code
Selection.Collapse Direction:=wdCollapseStart
Selection.Range.InsertCaption "Table"
If ActiveDocument.TablesOfFigures.Count >= 1 Then
 ActiveDocument.TablesOfFigures(1).Caption = "Table"
End If

See also

Concepts

Window Object

Other resources

Window Object Members


Window.Creator Property (Word)

 Copy code hover
[image]

Window.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a Window object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Window Object

Other resources

Window Object Members


Window.DisplayHorizontalScrollBar Property (Word)

 Copy code hover
[image]

Window.DisplayHorizontalScrollBar Property (Word)
See also Send feedback

Published: July 16, 2012

True if a horizontal scroll bar is displayed for the specified window. Read/write Boolean.

Syntax

expression .DisplayHorizontalScrollBar

expression A variable that represents a Window object.

Example

This example displays vertical and horizontal scroll bars for the active window.

VBA Copy code Copy code
With ActiveDocument.ActiveWindow
 .DisplayHorizontalScrollBar = True
 .DisplayVerticalScrollBar = True
End With

This example toggles the horizontal scroll bar of the window for Document1.

VBA Copy code Copy code
Dim winTemp As Window

Set winTemp = Windows("Document1")

winTemp.DisplayHorizontalScrollBar = _
 Not winTemp.DisplayHorizontalScrollBar

See also

Concepts

Window Object

Other resources

Window Object Members


Window.DisplayLeftScrollBar Property (Word)

 Copy code hover
[image]

Window.DisplayLeftScrollBar Property (Word)
See also Send feedback

Published: July 16, 2012

True if the vertical scroll bar appears on the left side of the document window. Read/write Boolean.

Syntax

expression .DisplayLeftScrollBar

expression An expression that returns a Window object.

Example

This example displays the vertical scroll bar on the left side of the active window.

VBA Copy code Copy code
ActiveWindow.DisplayLeftScrollBar = True

See also

Concepts

Window Object

Other resources

Window Object Members


Window.DisplayRightRuler Property (Word)

 Copy code hover
[image]

Window.DisplayRightRuler Property (Word)
See also Send feedback

Published: July 16, 2012

True if the vertical ruler appears on the right side of the document window in print layout view. Read/write Boolean.

Syntax

expression .DisplayRightRuler

expression An expression that returns a Window object.

Remarks

For more information on using Word with right-to-left languages, see Word features for right-to-left languages .

Example

This example sets the active window to print layout view and displays the vertical ruler on the right side.

VBA Copy code Copy code
With ActiveWindow
 .View = wdPrintView
 .DisplayRightRuler = True
End With

See also

Concepts

Window Object

Other resources

Window Object Members


Window.DisplayRulers Property (Word)

 Copy code hover
[image]

Window.DisplayRulers Property (Word)
See also Send feedback

Published: July 16, 2012

True if rulers are displayed for the specified window or pane. Read/write Boolean.

Syntax

expression .DisplayRulers

expression A variable that represents a Window object.

Remarks

This property is equivalent to the Ruler command on the View menu. If DisplayRulers is False, the horizontal and vertical rulers won't be displayed, regardless of the state of the DisplayVerticalRuler property.

Example

This example toggles the ruler display for the active window.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.DisplayRulers = _
 Not ActiveDocument.ActiveWindow.DisplayRulers

This example switches the window to print layout view and displays the horizontal and vertical rulers.

VBA Copy code Copy code
With ActiveDocument.ActiveWindow
 .View.Type = wdPrintView
 .DisplayVerticalRuler = True
 .DisplayRulers = True
End With

See also

Concepts

Window Object

Other resources

Window Object Members


Window.DisplayScreenTips Property (Word)

 Copy code hover
[image]

Window.DisplayScreenTips Property (Word)
See also Send feedback

Published: July 16, 2012

True if comments, footnotes, endnotes, and hyperlinks are displayed as tips. Read/write Boolean.

Syntax

expression .DisplayScreenTips

expression A variable that represents a Window object.

Remarks

Text marked as having comments is highlighted.

Example

This example enables Word to display comments, footnotes, and endnotes as tips. Also, text marked as having comments is highlighted.

VBA Copy code Copy code
Application.DisplayScreenTips = True

This example returns the current status of the Show document tooltips on hover checkbox in the Page display options section on the Display tab of the Word Options dialog box.

VBA Copy code Copy code
temp = Application.DisplayScreenTips

See also

Concepts

Window Object

Other resources

Window Object Members


Window.DisplayVerticalRuler Property (Word)

 Copy code hover
[image]

Window.DisplayVerticalRuler Property (Word)
See also Send feedback

Published: July 16, 2012

True if a vertical ruler is displayed for the specified window or pane. Read/write Boolean.

Syntax

expression .DisplayVerticalRuler

expression A variable that represents a Window object.

Remarks

A vertical ruler appears only in print layout view, and only if the DisplayRulers property is set to True.

Example

This example switches each window in the Windows collection to print layout view and displays the horizontal and vertical rulers.

VBA Copy code Copy code
Dim winLoop As Window

For Each winLoop In Windows
 With winLoop
 .View.Type = wdPrintView
 .DisplayRulers = True
 .DisplayVerticalRuler = True
 End With
Next winLoop

This example hides the horizontal and vertical rulers for the active window.

VBA Copy code Copy code
With ActiveDocument.ActiveWindow
 .DisplayVerticalRuler = False
 .DisplayRulers = False
End With

See also

Concepts

Window Object

Other resources

Window Object Members


Window.DisplayVerticalScrollBar Property (Word)

 Copy code hover
[image]

Window.DisplayVerticalScrollBar Property (Word)
See also Send feedback

Published: July 16, 2012

True if a vertical scroll bar is displayed for the specified window. Read/write Boolean.

Syntax

expression .DisplayVerticalScrollBar

expression A variable that represents a Window object.

Example

This example displays the vertical and horizontal scroll bars for each window in the Windows collection.

VBA Copy code Copy code
Dim winLoop As Window

For Each winLoop In Windows
 winLoop.DisplayVerticalScrollBar = True
 winLoop.DisplayHorizontalScrollBar = True
Next winLoop

This example toggles the vertical scroll bar for the active window.

VBA Copy code Copy code
Dim winTemp As Window

Set winTemp = ActiveDocument.ActiveWindow
winTemp.DisplayVerticalScrollBar = _
 Not winTemp.DisplayVerticalScrollBar

See also

Concepts

Window Object

Other resources

Window Object Members


Window.Document Property (Word)

 Copy code hover
[image]

Window.Document Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Document object associated with the specified pane, window, or selection. Read-only.

Syntax

expression .Document

expression A variable that represents a Window object.

Example

This example sets myDoc to the document associated with the active window. The focus is changed to the next window, and the window is split. The Activate method is used to switch back to the original document.

VBA Copy code Copy code
Set myDoc = Application.ActiveWindow.Document
If Windows.Count >= 2 Then
 Application.ActiveWindow.Next.Activate
 Application.ActiveWindow.Split = True
 myDoc.Activate
End If

See also

Concepts

Window Object

Other resources

Window Object Members


Window.DocumentMap Property (Word)

 Copy code hover
[image]

Window.DocumentMap Property (Word)
See also Send feedback

Published: July 16, 2012

True if the document map is visible. Read/write Boolean.

Syntax

expression .DocumentMap

expression A variable that represents a Window object.

Example

This example toggles the document map for the active window.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.DocumentMap = _
 Not ActiveDocument.ActiveWindow.DocumentMap

This example displays the document map in the window for Sales.doc.

VBA Copy code Copy code
Dim docSales As Document

Set docSales = _
 Documents.Open(FileName:="C:\Documents\Sales.doc")

docSales.ActiveWindow.DocumentMap = True

See also

Concepts

Window Object

Other resources

Window Object Members


Window.EnvelopeVisible Property (Word)

 Copy code hover
[image]

Window.EnvelopeVisible Property (Word)
See also Send feedback

Published: July 16, 2012

True if the e-mail message header is visible in the document window. The default value is False. Read/write Boolean.

Syntax

expression .EnvelopeVisible

expression A variable that represents a Window object.

Remarks

This property has no effect if the document isn't an e-mail message.

Example

This example displays the e-mail message header.

VBA Copy code Copy code
ActiveWindow.EnvelopeVisible = True

See also

Concepts

Window Object

Other resources

Window Object Members


Window.Height Property (Word)

 Copy code hover
[image]

Window.Height Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the height of the window. Read/write Long.

Syntax

expression .Height

expression A variable that represents a Window object.

Remarks

You cannot set this property if the window is maximized or minimized. Use the UsableHeight property of the Application object to determine the maximum size for the window. Use the WindowState property to determine the window state.

Example

This example changes the height of the active window to fill the application window area.

VBA Copy code Copy code
With ActiveDocument.ActiveWindow
 .WindowState = wdWindowStateNormal
 .Height = Application.UsableHeight
End With

See also

Concepts

Window Object

Other resources

Window Object Members


Window.HorizontalPercentScrolled Property (Word)

 Copy code hover
[image]

Window.HorizontalPercentScrolled Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the horizontal scroll position as a percentage of the document width. Read/write Long.

Syntax

expression .HorizontalPercentScrolled

expression A variable that represents a Window object.

Example

This example displays the percentage that the active window is scrolled horizontally.

VBA Copy code Copy code
MsgBox _
 ActiveDocument.ActiveWindow.HorizontalPercentScrolled & "%"

See also

Concepts

Window Object

Other resources

Window Object Members


Window.Hwnd Property (Word)

 Copy code hover
[image]

Window.Hwnd Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that indicates the window handle of the specified window. Read-only.

Version information

Version Added: Word 2013

Syntax

expression .Hwnd

expression A variable that represents a Window object.

Property value

INT32

See also

Concepts

Window Object

Other resources

Window Members


Window.IMEMode Property (Word)

 Copy code hover
[image]

Window.IMEMode Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the default start-up mode for the Japanese Input Method Editor (IME). Read/write WdIMEMode.

Syntax

expression .IMEMode

expression Required. A variable that represents a Window object.

See also

Concepts

Window Object

Other resources

Window Object Members


Window.Index Property (Word)

 Copy code hover
[image]

Window.Index Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the position of an item in a collection. Read-only.

Syntax

expression .Index

expression Required. A variable that represents a Window object.

See also

Concepts

Window Object

Other resources

Window Object Members


Window.Left Property (Word)

 Copy code hover
[image]

Window.Left Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Long that represents the horizontal position of the specified window, measured in points. Read/write.

Syntax

expression .Left

expression Required. A variable that represents a Window object.

Example

This example sets the horizontal position of the active window to 100 points.

VBA Copy code Copy code
With ActiveDocument.ActiveWindow
 .WindowState = wdWindowStateNormal
 .Left = 100
 .Top = 0
End With

See also

Concepts

Window Object

Other resources

Window Object Members


Window.Next Property (Word)

 Copy code hover
[image]

Window.Next Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the next document window in the collection of open document windows. Read-only.

Syntax

expression .Next

expression A variable that represents a Window object.

Example

This example activates the next window.

VBA Copy code Copy code
If Windows.Count > 1 Then ActiveDocument.ActiveWindow.Next.Activate

See also

Concepts

Window Object

Other resources

Window Object Members


Window.Panes Property (Word)

 Copy code hover
[image]

Window.Panes Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Panes collection that represents all the window panes for the specified window.

Syntax

expression .Panes

expression An expression that returns a Window object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example splits the active window in half.

VBA Copy code Copy code
If ActiveDocument.ActiveWindow.Panes.Count = 1 Then _
 ActiveDocument.ActiveWindow.Panes.Add

This example activates the first pane in the window for Document2.

VBA Copy code Copy code
Windows("Document2").Panes(1).Activate

See also

Concepts

Window Object

Other resources

Window Object Members


Window.Parent Property (Word)

 Copy code hover
[image]

Window.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Window object.

Syntax

expression .Parent

expression Required. A variable that represents a Window object.

See also

Concepts

Window Object

Other resources

Window Object Members


Window.Previous Property (Word)

 Copy code hover
[image]

Window.Previous Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the previous document window in the collection open document windows. Read-only.

Syntax

expression .Previous

expression A variable that represents a Window object.

See also

Concepts

Window Object

Other resources

Window Object Members


Window.Selection Property (Word)

 Copy code hover
[image]

Window.Selection Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the Selection object that represents a selected range or the insertion point. Read-only.

Syntax

expression .Selection

expression A variable that represents a Window object.

Example

This example copies the selection from window one to the next window.

VBA Copy code Copy code
If Windows.Count >= 2 Then
 Windows(1).Selection.Copy
 Windows(1).Next.Activate
 Selection.Paste
End If

See also

Concepts

Window Object

Other resources

Window Object Members


Window.ShowSourceDocuments Property (Word)

 Copy code hover
[image]

Window.ShowSourceDocuments Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a WdShowSourceDocuments constant that represents how Microsoft Word displays source documents after a compare and merge process. Read/write.

Version Information

Version Added: Word 2007

Syntax

expression .ShowSourceDocuments

expression An expression that returns a Window object.

See also

Concepts

Window Object

Other resources

Window Object Members


Window.Split Property (Word)

 Copy code hover
[image]

Window.Split Property (Word)
See also Send feedback

Published: July 16, 2012

True if the window is split into multiple panes. Read/write Boolean.

Syntax

expression .Split

expression Required. A variable that represents a Window object.

Example

This example splits the active window into two equal-sized window panes.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.Split = True

If the Document1 window is split, this example closes the active pane.

VBA Copy code Copy code
If Windows("Document1").Split = True Then
 Windows("Document1").ActivePane.Close
End If

See also

Concepts

Window Object

Other resources

Window Object Members


Window.SplitVertical Property (Word)

 Copy code hover
[image]

Window.SplitVertical Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the vertical split percentage for the specified window. Read/write Long.

Syntax

expression .SplitVertical

expression An expression that returns a Window object.

Remarks

To remove the split, set this property to zero (0) or set the Split property to False.

Example

This example splits the active window so that the top pane occupies 70 percent of the window.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.SplitVertical = 70

This example splits the window for Document1 in half vertically.

VBA Copy code Copy code
Windows("Document1").SplitVertical = 50

See also

Concepts

Window Object

Other resources

Window Object Members


Window.StyleAreaWidth Property (Word)

 Copy code hover
[image]

Window.StyleAreaWidth Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the width of the style area in points. Read/write Single.

Syntax

expression .StyleAreaWidth

expression An expression that returns a Window object.

Remarks

When the StyleAreaWidth property is greater than 0 (zero), style names are displayed to the left of the text. The style area isn't visible in print layout or Web layout view.

Example

This example switches the active window to normal view and sets the width of the style area to 1 inch.

VBA Copy code Copy code
With ActiveDocument.ActiveWindow
 .View.Type = wdNormalView
 .StyleAreaWidth = InchesToPoints(1)
End With

See also

Concepts

Window Object

Other resources

Window Object Members


Window.Thumbnails Property (Word)

 Copy code hover
[image]

Window.Thumbnails Property (Word)
See also Send feedback

Published: July 16, 2012

Sets or returns a Boolean that represents whether thumbnail images of the pages in a document are displayed along the left side of the Microsoft Word document window.

Syntax

expression .Thumbnails

expression An expression that returns a Window object.

Example

The following example displays thumbnail images of the pages in the active document.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.Thumbnails = True

See also

Concepts

Window Object

Other resources

Window Object Members


Window.Top Property (Word)

 Copy code hover
[image]

Window.Top Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the vertical position of the specified document window, in points. Read/write Long.

Syntax

expression .Top

expression Required. A variable that represents a Window object.

See also

Concepts

Window Object

Other resources

Window Object Members


Window.Type Property (Word)

 Copy code hover
[image]

Window.Type Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the window type. Read-only WdWindowType.

Syntax

expression .Type

expression Required. A variable that represents a Window object.

See also

Concepts

Window Object

Other resources

Window Object Members


Window.UsableHeight Property (Word)

 Copy code hover
[image]

Window.UsableHeight Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the height (in points) of the active working area in the specified document window. Read-only Long. .

Syntax

expression .UsableHeight

expression A variable that represents a Window object.

Remarks

If none of the working area is visible in the document window, UsableHeight returns 1. To determine the actual available height, subtract 1 from the UsableHeight value.

Example

This example displays the size of the working area in the active document window.

VBA Copy code Copy code
With ActiveDocument.ActiveWindow
 MsgBox "Working area height = " _
 & .UsableHeight & vbLf _
 & "Working area width = " _
 & .UsableWidth
End With

See also

Concepts

Window Object

Other resources

Window Object Members


Window.UsableWidth Property (Word)

 Copy code hover
[image]

Window.UsableWidth Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the width (in points) of the active working area in the specified document window. Read-only Long.

Syntax

expression .UsableWidth

expression An expression that returns a Window object.

Remarks

If none of the working area is visible in the document window, UsableWidth returns 1. To determine the actual available height, subtract 1 from the UsableWidth value.

Example

This example displays the size of the working area in the active document window.

VBA Copy code Copy code
With ActiveDocument.ActiveWindow
 MsgBox "Working area height = " _
 & .UsableHeight & vbLf _
 & "Working area width = " _
 & .UsableWidth
End With

See also

Concepts

Window Object

Other resources

Window Object Members


Window.VerticalPercentScrolled Property (Word)

 Copy code hover
[image]

Window.VerticalPercentScrolled Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the vertical scroll position as a percentage of the document length. Read/write Long.

Syntax

expression .VerticalPercentScrolled

expression Required. A variable that represents a Window object.

Example

This example displays the percentage that the active window is scrolled vertically.

VBA Copy code Copy code
MsgBox ActiveDocument.ActiveWindow.VerticalPercentScrolled & "%"

This example scrolls the active window vertically by 10 percent.

VBA Copy code Copy code
Set aWindow = ActiveDocument.ActiveWindow
aWindow.VerticalPercentScrolled = _
 aWindow.VerticalPercentScrolled + 10

See also

Concepts

Window Object

Other resources

Window Object Members


Window.View Property (Word)

 Copy code hover
[image]

Window.View Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a View object that represents the view for the specified window or pane.

Syntax

expression .View

expression Required. A variable that represents a Window object.

Example

This example switches the active window to full-screen view.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.View.FullScreen = True

This example sets view options for each window in the Windows collection.

VBA Copy code Copy code
For Each myWindow In Windows
 With myWindow.View
 .ShowTabs = True
 .ShowParagraphs = True
 .Type = wdNormalView
 End With
Next myWindow

See also

Concepts

Window Object

Other resources

Window Object Members


Window.Visible Property (Word)

 Copy code hover
[image]

Window.Visible Property (Word)
See also Send feedback

Published: July 16, 2012

True if the specified object is visible. Read/write Boolean.

Syntax

expression .Visible

expression Required. A variable that represents a Window object.

Remarks

Some methods and properties may be unavailable if the Visible property is False.

See also

Concepts

Window Object

Other resources

Window Object Members


Window.Width Property (Word)

 Copy code hover
[image]

Window.Width Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the width of the specified document window, in points. Read/write Long.

Syntax

expression .Width

expression A variable that represents a Window object.

See also

Concepts

Window Object

Other resources

Window Object Members


Window.WindowNumber Property (Word)

 Copy code hover
[image]

Window.WindowNumber Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the window number of the document displayed in the specified window. For example, if the caption of the window is "Sales.doc:2", this property returns the number 2. Read-only Long.

Syntax

expression .WindowNumber

expression An expression that returns a Window object.

Remarks

Use the property to return the number of the specified window in the Windows collection.

Example

This example retrieves the window number of the active window, opens a new window, and then activates the original window.

VBA Copy code Copy code
Sub WinNum()
 Dim lwindowNum As Long

 lwindowNum = ActiveDocument.ActiveWindow.WindowNumber
 NewWindow
 ActiveDocument.Windows(lwindowNum).Activate
End Sub

See also

Concepts

Window Object

Other resources

Window Object Members


Window.WindowState Property (Word)

 Copy code hover
[image]

Window.WindowState Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the state of the specified document window or task window. Read/write WdWindowState.

Syntax

expression .WindowState

expression Required. A variable that represents a Window object.

Remarks

The wdWindowStateNormal constant indicates a window that's not maximized or minimized. The state of an inactive window cannot be set. Use the Activate method to activate a window prior to setting the window state.

Example

This example maximizes the active window if it is not maximized or minimized.

VBA Copy code Copy code
If ActiveDocument.ActiveWindow _
 .WindowState = wdWindowStateNormal Then _
 ActiveDocument.ActiveWindow _
 .WindowState = wdWindowStateMaximize

See also

Concepts

Window Object

Other resources

Window Object Members


Window Methods (Word)

 Copy code hover
[image]

Window Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Activate | Activates the specified window.
Close | Closes the specified window.
GetPoint | Returns the screen coordinates of the specified range or shape.
LargeScroll | Scrolls a window or pane by the specified number of screens.
NewWindow | Opens a new window with the same document as the specified window. Returns a Window object.
PageScroll | Scrolls through the specified pane or window page by page.
PrintOut | Prints all or part of the document displayed in the specified window.
RangeFromPoint | Returns the Range or Shape object that is located at the point specified by the screen position coordinate pair.
ScrollIntoView | Scrolls through the document window so the specified range or shape is displayed in the document window.
SetFocus | Sets the focus of the specified document window to the body of an e-mail message.
SmallScroll | Scrolls a window or pane by the specified number of lines.
ToggleRibbon | Shows or hides the ribbon.


Window.Activate Method (Word)

 Copy code hover
[image]

Window.Activate Method (Word)
See also Send feedback

Published: July 16, 2012

Activates the specified window.

Syntax

expression .Activate

expression Required. A variable that represents a Window object.

Example

This example activates the next window in the Windows collection.

VBA Copy code Copy code
Sub NextWindow()
 'Two or more documents must be open for this statement to execute.
 ActiveDocument.ActiveWindow.Next.Activate
End Sub

See also

Concepts

Window Object

Other resources

Window Object Members


Window.Close Method (Word)

 Copy code hover
[image]

Window.Close Method (Word)
See also Send feedback

Published: July 16, 2012

Closes the specified window.

Syntax

expression .Close(SaveChanges, RouteDocument)

expression Required. A variable that represents a Window object.

Parameters

Name | Required/Optional | Data Type | Description
SaveChanges | Optional | Variant | Specifies the save action for the document. Can be one of the following WdSaveOptions constants: wdDoNotSaveChanges, wdPromptToSaveChanges, or wdSaveChanges.
RouteDocument | Optional | Variant | True to route the document to the next recipient. If the document doesn't have a routing slip attached, this argument is ignored.

Example

This example closes the active window of the active document and saves it.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.Close SaveChanges:=wdSaveChanges

See also

Concepts

Window Object

Other resources

Window Object Members


Window.GetPoint Method (Word)

 Copy code hover
[image]

Window.GetPoint Method (Word)
See also Send feedback

Published: July 16, 2012

Returns the screen coordinates of the specified range or shape.

Syntax

expression .GetPoint(ScreenPixelsLeft, ScreenPixelsTop, ScreenPixelsWidth, ScreenPixelsHeight, obj)

expression Required. A variable that represents a Window object.

Parameters

Name | Required/Optional | Data Type | Description
ScreenPixelsLeft | Required | Long | The variable name to which you want Microsoft Word to return the value for the left edge of the object.
ScreenPixelsTop | Required | Long | The variable name to which you want Word to return the value for the top edge of the object.
ScreenPixelsWidth | Required | Long | The variable name to which you want Word to return the value for the width of the object.
ScreenPixelsHeight | Required | Long | The variable name to which you want Word to return the value for the height of the object.
obj | Required | Object | A Range or Shape object.

Remarks

If the entire range or shape isn't visible on the screen, an error occurs.

Example

This example examines the current selection and returns its screen coordinates.

VBA Copy code Copy code
Dim pLeft As Long
Dim pTop As Long
Dim pWidth As Long
Dim pHeight As Long

ActiveWindow.GetPoint pLeft, pTop, pWidth, pHeight, _
 Selection.Range
MsgBox "Left = " & pLeft & vbLf _
 & "Top = " & pTop & vbLf _
 & "Width = " & pWidth & vbLf _
 & "Height = " & pHeight

See also

Concepts

Window Object

Other resources

Window Object Members


Window.LargeScroll Method (Word)

 Copy code hover
[image]

Window.LargeScroll Method (Word)
See also Send feedback

Published: July 16, 2012

Scrolls a window or pane by the specified number of screens.

Syntax

expression .LargeScroll(Down, Up, ToRight, ToLeft)

expression Required. A variable that represents a Window object.

Parameters

Name | Required/Optional | Data Type | Description
Down | Optional | Variant | The number of screens to scroll the window down.
Up | Optional | Variant | The number of screens to scroll the window up.
ToRight | Optional | Variant | The number of screens to scroll the window to the right.
ToLeft | Optional | Variant | The number of screens to scroll the window to the left.

Remarks

This method is equivalent to clicking just before or just after the scroll boxes on the horizontal and vertical scroll bars.

If Down and Up are both specified, the window is scrolled by the difference of the arguments. For example, if Down is 2 and Up is 4, the window is scrolled up two screens. Similarly, if ToLeft and ToRight are both specified, the window is scrolled by the difference of the arguments.

Any of these arguments can be a negative number. If no arguments are specified, the window is scrolled down one screen.

Example

This example scrolls the active window down one screen.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.LargeScroll Down:=1

This example splits the active window and then scrolls up two screens and to the right one screen.

VBA Copy code Copy code
With ActiveDocument.ActiveWindow
 .Split = True
 .LargeScroll Up:=2, ToRight:=1
End With

See also

Concepts

Window Object

Other resources

Window Object Members


Window.NewWindow Method (Word)

 Copy code hover
[image]

Window.NewWindow Method (Word)
See also Send feedback

Published: July 16, 2012

Opens a new window with the same document as the specified window. Returns a Window object.

Syntax

expression .NewWindow

expression Required. A variable that represents a Window object.

Return Value

Window

Remarks

A colon (:) and a number appear in the window caption when more than one window is open for a the same document. The following two instructions are functionally equivalent.

VBA Copy code Copy code
Set myWindow = ActiveDocument.ActiveWindow.NewWindow
Set myWindow = NewWindow

Example

This example posts a message that indicates the number of windows that exist before and after you open a new window for Document1.

VBA Copy code Copy code
MsgBox Windows.Count & " windows open"
Windows("Document1").NewWindow
MsgBox Windows.Count & " windows open"

See also

Concepts

Window Object

Other resources

Window Object Members


Window.PageScroll Method (Word)

 Copy code hover
[image]

Window.PageScroll Method (Word)
See also Send feedback

Published: July 16, 2012

Scrolls through the specified pane or window page by page.

Syntax

expression .PageScroll(Down, Up)

expression Required. A variable that represents a Window object.

Parameters

Name | Required/Optional | Data Type | Description
Down | Optional | Variant | The number of pages to be scrolled down. If this argument is omitted, this value is assumed to be 1.
Up | Optional | Variant | The number of pages to be scrolled up.

Remarks

The PageScroll method is available only if you are in print layout view or Web layout view. This method does not affect the position of the insertion point.

If Down and Up are both specified, the window is scrolled by the difference of the arguments. For example, if Down is 2 and Up is 4, the window is scrolled up two pages.

Example

This example scrolls down three pages in the active window.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.View.Type = wdPrintView
ActiveDocument.ActiveWindow.PageScroll Down:=3

This example scrolls down one page in the active window.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.View.Type = wdPrintView
ActiveDocument.ActiveWindow.PageScroll

See also

Concepts

Window Object

Other resources

Window Object Members


Window.PrintOut Method (Word)

 Copy code hover
[image]

Window.PrintOut Method (Word)
See also Send feedback

Published: July 16, 2012

Prints all or part of the document displayed in the specified window.

Syntax

expression .PrintOut(Background, Append, Range, OutputFileName, From, To, Item, Copies, Pages, PageType, PrintToFile, Collate, FileName, ActivePrinterMacGX, ManualDuplexPrint, PrintZoomColumn, PrintZoomRow, PrintZoomPaperWidth, PrintZoomPaperHeight)

expression Required. A variable that represents a Window object.

Parameters

Name | Required/Optional | Data Type | Description
Background | Optional | Variant | Set to True to have the macro continue while Microsoft Word prints the document.
Append | Optional | Variant | Set to True to append the specified document to the file name specified by the OutputFileName argument. False to overwrite the contents of OutputFileName.
Range | Optional | Variant | The page range. Can be any WdPrintOutRange constant.
OutputFileName | Optional | Variant | If PrintToFile is True, this argument specifies the path and file name of the output file.
From | Optional | Variant | The starting page number when Range is set to wdPrintFromTo.
To | Optional | Variant | The ending page number when Range is set to wdPrintFromTo.
Item | Optional | Variant | The item to be printed. Can be any WdPrintOutItem constant.
Copies | Optional | Variant | The number of copies to be printed.
Pages | Optional | Variant | The page numbers and page ranges to be printed, separated by commas. For example, "2, 6-10" prints page 2 and pages 6 through 10.
PageType | Optional | Variant | The type of pages to be printed. Can be any WdPrintOutPages constant.
PrintToFile | Optional | Variant | True to send printer instructions to a file. Make sure to specify a file name with OutputFileName.
Collate | Optional | Variant | When printing multiple copies of a document, True to print all pages of the document before printing the next copy.
FileName | Optional | Variant | The path and file name of the document to be printed. If this argument is omitted, Word prints the active document. (Available only with the Application object.)
ActivePrinterMacGX | Optional | Variant | This argument is available only in Microsoft Office Macintosh Edition. For additional information about this argument, consult the language reference Help included with Microsoft Office Macintosh Edition.
ManualDuplexPrint | Optional | Variant | True to print a two-sided document on a printer without a duplex printing kit. If this argument is True, the PrintBackground and PrintReverse properties are ignored. Use the PrintOddPagesInAscendingOrder and PrintEvenPagesInAscendingOrder properties to control the output during manual duplex printing. This argument may not be available to you, depending on the language support (U.S. English, for example) that you've selected or installed.
PrintZoomColumn | Optional | Variant | The number of pages you want Word to fit horizontally on one page. Can be 1, 2, 3, or 4. Use with the PrintZoomRow argument to print multiple pages on a single sheet.
PrintZoomRow | Optional | Variant | The number of pages you want Word to fit vertically on one page. Can be 1, 2, or 4. Use with the PrintZoomColumn argument to print multiple pages on a single sheet.
PrintZoomPaperWidth | Optional | Variant | The width to which you want Word to scale printed pages, in twips (20 twips = 1 point; 72 points = 1 inch).
PrintZoomPaperHeight | Optional | Variant | The height to which you want Word to scale printed pages, in twips (20 twips = 1 point; 72 points = 1 inch).

Example

This example prints the current page of the active document.

VBA Copy code Copy code
ActiveDocument.PrintOut Range:=wdPrintCurrentPage

This example prints all the documents in the current folder. The Dir function is used to return all file names that have the file name extension ".doc".

VBA Copy code Copy code
adoc = Dir("*.DOC")
Do While adoc <> ""
 Application.PrintOut FileName:=adoc
 adoc = Dir()
Loop

This example prints the first three pages of the document in the active window.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.PrintOut _
 Range:=wdPrintFromTo, From:="1", To:="3"

This example prints the comments in the active document.

VBA Copy code Copy code
If ActiveDocument.Comments.Count >= 1 Then
 ActiveDocument.PrintOut Item:=wdPrintComments
End If

This example prints the active document, fitting six pages on each sheet.

VBA Copy code Copy code
ActiveDocument.PrintOut PrintZoomColumn:=3, _
 PrintZoomRow:=2

This example prints the active document at 75% of actual size.

VBA Copy code Copy code
ActiveDocument.PrintOut _
 PrintZoomPaperWidth:=0.75 * (8.5 * 1440), _
 PrintZoomPaperHeight:=0.75 * (11 * 1440)

See also

Concepts

Window Object

Other resources

Window Object Members


Window.RangeFromPoint Method (Word)

 Copy code hover
[image]

Window.RangeFromPoint Method (Word)
See also Send feedback

Published: July 16, 2012

Returns the Range or Shape object that is located at the point specified by the screen position coordinate pair.

Syntax

expression .RangeFromPoint(x, y)

expression Required. A variable that represents a Window object.

Parameters

Name | Required/Optional | Data Type | Description
x | Required | Long | The horizontal distance (in pixels) from the left edge of the screen to the point.
y | Required | Long | The vertical distance (in pixels) from the top of the screen to the point.

Return Value

Object

Remarks

If no range or shape is located at the coordinate pair specified, the method returns Nothing.

Example

This example creates a new document and adds a five-point star. It then obtains the screen location of the shape and calculates where the center of the shape is. Using these coordinates, the example uses the RangeFromPoint method to return a reference to the shape and change its fill color.

VBA Copy code Copy code
Dim pLeft As Long
Dim pTop As Long
Dim pWidth As Long
Dim pHeight As Long
Dim newShape As Object
Dim newDoc As New Document

With newDoc
 .Shapes.AddShape msoShape5pointStar, _
 288, 100, 100, 72
 .ActiveWindow.GetPoint pLeft, pTop, _
 pWidth, pHeight, .Shapes(1)
 Set newShape = .ActiveWindow.RangeFromPoint(pLeft _
 + pWidth * 0.5, pTop + pHeight * 0.5)
 newShape.Fill.ForeColor.RGB = RGB(80, 160, 130)
End With

See also

Concepts

Window Object

Other resources

Window Object Members


Window.ScrollIntoView Method (Word)

 Copy code hover
[image]

Window.ScrollIntoView Method (Word)
See also Send feedback

Published: July 16, 2012

Scrolls through the document window so the specified range or shape is displayed in the document window.

Syntax

expression .ScrollIntoView(Obj, Start)

expression Required. A variable that represents a Window object.

Parameters

Name | Required/Optional | Data Type | Description
Obj | Required | Object | A Range or Shape object.
Start | Optional | Boolean | True if the upper-left corner of the range or shape appears at the upper-left corner of the document window. False if the lower-right corner of the range or shape appears at the lower-right corner of the document window. The default value is True.

Remarks

If the range or shape is larger than the document window, the Start argument specifies which portion of the range or shape displays or gets initial focus. This method cannot be used with outline view.

Example

This example scrolls through the active document so that the current selection is visible in the document window.

VBA Copy code Copy code
ActiveWindow.ScrollIntoView Selection.Range, True

See also

Concepts

Window Object

Other resources

Window Object Members


Window.SetFocus Method (Word)

 Copy code hover
[image]

Window.SetFocus Method (Word)
See also Send feedback

Published: July 16, 2012

Sets the focus of the specified document window to the body of an e-mail message.

Syntax

expression .SetFocus

expression Required. A variable that represents a Window object.

Remarks

If the document isn't an e-mail message, this method has no effect.

Example

This example makes the header of an e-mail message visible and sets the focus to the body of the message.

VBA Copy code Copy code
ActiveWindow.EnvelopeVisible = True
ActiveWindow.SetFocus

See also

Concepts

Window Object

Other resources

Window Object Members


Window.SmallScroll Method (Word)

 Copy code hover
[image]

Window.SmallScroll Method (Word)
See also Send feedback

Published: July 16, 2012

Scrolls a window or pane by the specified number of lines.

Syntax

expression .SmallScroll(Down, Up, ToRight, ToLeft)

expression Required. A variable that represents a Window object.

Parameters

Name | Required/Optional | Data Type | Description
Down | Optional | Variant | The number of lines to scroll the window down. A "line" corresponds to the distance scrolled by clicking the down scroll arrow on the vertical scroll bar once.
Up | Optional | Variant | The number of lines to scroll the window up. A "line" corresponds to the distance scrolled by clicking the up scroll arrow on the vertical scroll bar once.
ToRight | Optional | Variant | The number of lines to scroll the window to the right. A "line" corresponds to the distance scrolled by clicking the right scroll arrow on the horizontal scroll bar once.
ToLeft | Optional | Variant | The number of lines to scroll the window to the left. A "line" corresponds to the distance scrolled by clicking the left scroll arrow on the horizontal scroll bar once.

Remarks

This method is equivalent to clicking the scroll arrows on the horizontal and vertical scroll bars.

If Down and Up are both specified, the window is scrolled by the difference of the arguments. For example, if Down is 3 and Up is 6, the window is scrolled up three lines. Similarly, if ToLeft and ToRight are both specified, the window is scrolled by the difference of the arguments.

Any of these arguments can be a negative number. If no arguments are specified, the window is scrolled down by one line.

Example

This example scrolls the active window down one line.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.SmallScroll Down:=1

This example splits the active window and then scrolls up and over to the left.

VBA Copy code Copy code
With ActiveDocument.ActiveWindow
 .Split = True
 .SmallScroll Up:=5, ToLeft:=5
End With

See also

Concepts

Window Object

Other resources

Window Object Members


Window.ToggleRibbon Method (Word)

 Copy code hover
[image]

Window.ToggleRibbon Method (Word)
See also Send feedback

Published: July 16, 2012

Shows or hides the ribbon.

Syntax

expression .ToggleRibbon

expression An expression that returns a Window object.

Remarks

If the ribbon is visible, the TobbleRibbon method hides it; if the ribbon is hidden, the ToggleRibbon method shows it.

See also

Concepts

Window Object

Other resources

Window Object Members


Windows Object (Word)

 Copy code hover
[image]

Windows Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of Window objects that represent all the available windows. The Windows collection for the Application object contains all the windows in the application, whereas the Windows collection for the Document object contains only the windows that display the specified document.

Remarks

Use the Windows property to return the Windows collection. The following example tiles all the windows so that they don't overlap one another.

VBA Copy code Copy code
Windows.Arrange ArrangeStyle:=wdTiled

Use the Add method or the NewWindow method to add a new window to the Windows collection. Each of the following statements creates a new window for the document in the active window.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.NewWindow
NewWindow
Windows.Add

Use Windows(Index), where Index is the window name or the index number, to return a single Window object. The following example maximizes the Document1 window.

VBA Copy code Copy code
Windows("Document1").WindowState = wdWindowStateMaximize

The index number is the number to the left of the window name on the Window menu. The following example displays the caption of the first window in the Windows collection.

VBA Copy code Copy code
MsgBox Windows(1).Caption

A colon (:) and a number appear in the window caption when more than one window is open for a document.

When you switch the view to print preview, a new window is created. This window is removed from the Windows collection when you close print preview.

See also

Concepts

Word Object Model Reference

Other resources

Windows Object Members


Windows Members (Word)

 Copy code hover
[image]

Windows Members (Word)
Send feedback

Published: July 16, 2012

A collection of Window objects that represent all the available windows. The Windows collection for the Application object contains all the windows in the application, whereas the Windows collection for the Document object contains only the windows that display the specified document.

Methods

Name | Description
Add | Returns a Window object that represents a new window of a document.
Arrange | Arranges all open document windows in the application workspace.
BreakSideBySide | Ends side by side mode if two windows are in side by side mode. Returns a Boolean that represents whether the method was successful.
CompareSideBySideWith | Opens two windows in side by side mode. Returns a Boolean.
Item | Returns an individual Window object in a collection.
ResetPositionsSideBySide | Resets two document windows that are in the Compare side by side with view mode.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of windows in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified Windows object.
SyncScrollingSideBySide | True enables scrolling the contents of the windows at the same time. Read/write Boolean.


Windows Properties (Word)

 Copy code hover
[image]

Windows Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of windows in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified Windows object.
SyncScrollingSideBySide | True enables scrolling the contents of the windows at the same time. Read/write Boolean.


Windows.Application Property (Word)

 Copy code hover
[image]

Windows.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a Windows collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

Windows Collection Object

Other resources

Windows Object Members


Windows.Count Property (Word)

 Copy code hover
[image]

Windows.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of windows in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents a Windows collection.

See also

Concepts

Windows Collection Object

Other resources

Windows Object Members


Windows.Creator Property (Word)

 Copy code hover
[image]

Windows.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a Windows collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Windows Collection Object

Other resources

Windows Object Members


Windows.Parent Property (Word)

 Copy code hover
[image]

Windows.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Windows object.

Syntax

expression .Parent

expression Required. A variable that represents a Windows collection.

See also

Concepts

Windows Collection Object

Other resources

Windows Object Members


Windows.SyncScrollingSideBySide Property (Word)

 Copy code hover
[image]

Windows.SyncScrollingSideBySide Property (Word)
See also Send feedback

Published: July 16, 2012

True enables scrolling the contents of the windows at the same time. Read/write Boolean.

Syntax

expression .SyncScrollingSideBySide

expression An expression that returns a Windows collection.

Remarks

False disables scrolling the windows at the same time.

Example

The following example enables scrolling of adjacent windows at the same time.

VBA Copy code Copy code
Dim objDoc1 As Word.Document
Dim objDoc2 As Word.Document

Set objDoc1 = Documents.Add
Set objDoc2 = Documents.Add

objDoc2.Activate
objDoc2.Windows.CompareSideBySideWith objDoc1
Windows.ResetPositionsSideBySide
Windows.SyncScrollingSideBySide = True

See also

Concepts

Windows Collection Object

Other resources

Windows Object Members


Windows Methods (Word)

 Copy code hover
[image]

Windows Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Returns a Window object that represents a new window of a document.
Arrange | Arranges all open document windows in the application workspace.
BreakSideBySide | Ends side by side mode if two windows are in side by side mode. Returns a Boolean that represents whether the method was successful.
CompareSideBySideWith | Opens two windows in side by side mode. Returns a Boolean.
Item | Returns an individual Window object in a collection.
ResetPositionsSideBySide | Resets two document windows that are in the Compare side by side with view mode.


Windows.Add Method (Word)

 Copy code hover
[image]

Windows.Add Method (Word)
See also Send feedback

Published: July 16, 2012

Returns a Window object that represents a new window of a document.

Syntax

expression .Add(Window)

expression Required. A variable that represents a Windows collection.

Parameters

Name | Required/Optional | Data Type | Description
Window | Optional | Variant | The Window object you want to open another window for. If this argument is omitted, a new window is opened for the active document.

Return Value

Window

Remarks

A colon (:) and a number appear in the window caption when more than one window is open for the document.

Example

This example opens a new window for the document that's displayed in the active window.

VBA Copy code Copy code
Windows.Add

This example opens a new window for MyDoc.doc.

VBA Copy code Copy code
Windows.Add Window:=Documents("MyDoc.doc").Windows(1)

See also

Concepts

Windows Collection Object

Other resources

Windows Object Members


Windows.Arrange Method (Word)

 Copy code hover
[image]

Windows.Arrange Method (Word)
See also Send feedback

Published: July 16, 2012

Arranges all open document windows in the application workspace.

Syntax

expression .Arrange(ArrangeStyle)

expression A variable that represents a Windows collection.

Parameters

Name | Required/Optional | Data Type | Description
ArrangeStyle | Optional | Variant | The window arrangement. Can be either of the following WdArrangeStyle constants: wdIcons or wdTiled.

Remarks

Because Microsoft Word uses a Single Document Interface (SDI), this method no longer has any effect.

Example

This example arranges all open windows so that they don't overlap.

VBA Copy code Copy code
Windows.Arrange ArrangeStyle:=wdTiled

This example minimizes all open windows and then arranges the minimized windows.

VBA Copy code Copy code
Dim windowLoop As Window

For Each windowLoop In Windows
 With windowLoop
 .Activate
 .WindowState = wdWindowStateMinimize
 End With
Next windowLoop

Windows.Arrange ArrangeStyle:=wdIcons

See also

Concepts

Windows Collection Object

Other resources

Windows Object Members


Windows.BreakSideBySide Method (Word)

 Copy code hover
[image]

Windows.BreakSideBySide Method (Word)
See also Send feedback

Published: July 16, 2012

Ends side by side mode if two windows are in side by side mode. Returns a Boolean that represents whether the method was successful.

Syntax

expression .BreakSideBySide

expression Required. A variable that represents a Windows collection.

Return Value

Boolean

Example

The following example ends side by side mode.

VBA Copy code Copy code
ActiveDocument.Windows.BreakSideBySide

See also

Concepts

Windows Collection Object

Other resources

Windows Object Members


Windows.CompareSideBySideWith Method (Word)

 Copy code hover
[image]

Windows.CompareSideBySideWith Method (Word)
See also Send feedback

Published: July 16, 2012

Opens two windows in side by side mode. Returns a Boolean.

Syntax

expression .CompareSideBySideWith(Document)

expression Required. A variable that represents a Windows collection.

Parameters

Name | Required/Optional | Data Type | Description
Document | Required | Variant | The document to view in side by side windows.

Return Value

Boolean

Remarks

You cannot use the CompareSideBySideWith method with the Application object or the ActiveDocument property.

Example

The following example places two new documents in adjacent windows.

VBA Copy code Copy code
Dim objDoc1 As Word.Document
Dim objDoc2 As Word.Document

Set objDoc1 = Documents.Add
Set objDoc2 = Documents.Add

objDoc2.Activate
objDoc2.Windows.CompareSideBySideWith objDoc1
Windows.ResetPositionsSideBySide

See also

Concepts

Windows Collection Object

Other resources

Windows Object Members


Windows.Item Method (Word)

 Copy code hover
[image]

Windows.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual Window object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents a Windows collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The individual object to be returned. Can be a Long indicating the ordinal position or a String representing the name of the individual object.

Return Value

Window

See also

Concepts

Windows Collection Object

Other resources

Windows Object Members


Windows.ResetPositionsSideBySide Method (Word)

 Copy code hover
[image]

Windows.ResetPositionsSideBySide Method (Word)
See also Send feedback

Published: July 16, 2012

Resets two document windows that are in the Compare side by side with view mode.

Syntax

expression .ResetPositionsSideBySide

expression Required. A variable that represents a Windows collection.

Remarks

This method corresponds to the Reset Window Position button on the Compare Side by Side toolbar. Use the ResetPositionsSideBySide method to reset the display of two documents. For example, if a user minimizes or maximizes one of the two document windows being compared, the ResetPositionsSideBySide method resets the display so that the two windows are displayed side by side again.

Example

The following example places two documents that were previously placed in side-by-side windows in adjacent windows.

VBA Copy code Copy code
Windows.ResetPositionsSideBySide

See also

Concepts

Windows Collection Object

Other resources

Windows Object Members


Words Object (Word)

 Copy code hover
[image]

Words Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of words in a selection, range, or document. Each item in the Words collection is a Range object that represents one word. There is no Word object.

Remarks

Use the Words property to return the Words object. The following code example displays how many words are currently selected.

VBA Copy code Copy code
MsgBox Selection.Words.Count & " words are selected"

Use Words(Index), where Index is the index number, to return a Range object that represents one word. The index number represents the position of the word in the Words collection. The following code example formats the first word in the selection as 24-point italic.

VBA Copy code Copy code
With Selection.Words(1)
 .Italic = True
 .Font.Size = 24
End With

The item in the Words collection includes both the word and the spaces after the word. To remove the trailing spaces, use the Visual Basic RTrim function — for example, RTrim(ActiveDocument.Words(1)). The following code example selects the first word (and its trailing spaces) in the active document.

VBA Copy code Copy code
ActiveDocument.Words(1).Select

If the selection is the insertion point and it is immediately followed by a space, Selection.Words(1) refers to the word preceding the selection. If the selection is the insertion point and is immediately followed by a character, Selection.Words(1) refers to the word following the selection.

The Count property for this collection in a document returns the number of items in the main story only. To count items in other stories use the collection with the Range object. Also, the Count property includes punctuation and paragraph marks in the total. To count the actual words in a document, use the Word Count dialog box. The following code example retrieves the number of words in the active document and assigns the value to the variable numWords.

VBA Copy code Copy code
Set temp = Dialogs(wdDialogToolsWordCount)
' Execute the dialog box to refresh its data.
temp.Execute
numWords = temp.Words
Note Note

For more information about calling built-in dialog boxes, see Displaying built-in Word dialog boxes.

The Add method is not available for the Words collection. Instead, use the InsertAfter method or the InsertBefore method to add text to a Range object. The following code example inserts text after the first word in the active document.

VBA Copy code Copy code
ActiveDocument.Range.Words(1).InsertAfter "New text "

See also

Concepts

Word Object Model Reference

Other resources

Words Object Members


Words Members (Word)

 Copy code hover
[image]

Words Members (Word)
Send feedback

Published: July 16, 2012

A collection of words in a selection, range, or document. Each item in the Words collection is a Range object that represents one word. There is no Word object.

Methods

Name | Description
Item | Returns an individual Range object in a collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of words in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
First | Returns a Range object that represents the first word in a collection of words.
Last | Returns a Range object that represents the last word in a collection of words.
Parent | Returns an Object that represents the parent object of the specified Words object.


Words Properties (Word)

 Copy code hover
[image]

Words Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of words in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
First | Returns a Range object that represents the first word in a collection of words.
Last | Returns a Range object that represents the last word in a collection of words.
Parent | Returns an Object that represents the parent object of the specified Words object.


Words.Application Property (Word)

 Copy code hover
[image]

Words.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a Words collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

Words Collection Object

Other resources

Words Object Members


Words.Count Property (Word)

 Copy code hover
[image]

Words.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of words in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents a Words collection.

Example

This example displays the number of words in the selection.

VBA Copy code Copy code
If Selection.Words.Count >= 1 And _
 Selection.Type <> wdSelectionIP Then
 MsgBox "The selection contains " & Selection.Words.Count _
 & " words."
End If

See also

Concepts

Words Collection Object

Other resources

Words Object Members


Words.Creator Property (Word)

 Copy code hover
[image]

Words.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a Words collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Words Collection Object

Other resources

Words Object Members


Words.First Property (Word)

 Copy code hover
[image]

Words.First Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the first word in a collection of words.

Syntax

expression .First

expression Required. A variable that represents a Words collection.

See also

Concepts

Words Collection Object

Other resources

Words Object Members


Words.Last Property (Word)

 Copy code hover
[image]

Words.Last Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the last word in a collection of words.

Syntax

expression .Last

expression Required. A variable that represents a Words collection.

Example

This example applies bold formatting to the last word in the selection.

VBA Copy code Copy code
If Selection.Words.Count >= 2 Then
 Selection.Words.Last.Bold = True
End If

See also

Concepts

Words Collection Object

Other resources

Words Object Members


Words.Parent Property (Word)

 Copy code hover
[image]

Words.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Words object.

Syntax

expression .Parent

expression Required. A variable that represents a Words collection.

See also

Concepts

Words Collection Object

Other resources

Words Object Members


Words Methods (Word)

 Copy code hover
[image]

Words Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Item | Returns an individual Range object in a collection.


Words.Item Method (Word)

 Copy code hover
[image]

Words.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual Range object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents a Words collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The individual object to be returned. Can be a Long indicating the ordinal position of the individual object.

Return Value

Range

See also

Concepts

Words Collection Object

Other resources

Words Object Members


WrapFormat Object (Word)

 Copy code hover
[image]

WrapFormat Object (Word)
See also Send feedback

Published: July 16, 2012

Represents all the properties for wrapping text around a shape or shape range.

Remarks

Use the WrapFormat property to return the WrapFormat object. The following example adds an oval to the active document and specifies that document text wrap around the left and right sides of the square that circumscribes the oval. There will be a 0.1-inch margin between the document text and the top, bottom, left side, and right side of the square.

VBA Copy code Copy code
Set myOval = _
 ActiveDocument.Shapes.AddShape(msoShapeOval, 36, 36, 100, 35)
With myOval.WrapFormat
 .Type = wdWrapSquare
 .Side = wdWrapBoth
 .DistanceTop = InchesToPoints(0.1)
 .DistanceBottom = InchesToPoints(0.1)
 .DistanceLeft = InchesToPoints(0.1)
 .DistanceRight = InchesToPoints(0.1)
End With

See also

Concepts

Word Object Model Reference

Other resources

WrapFormat Object Members


WrapFormat Members (Word)

 Copy code hover
[image]

WrapFormat Members (Word)
Send feedback

Published: July 16, 2012

Represents all the properties for wrapping text around a shape or shape range.

Properties

Name | Description
AllowOverlap | Returns or sets a value that specifies whether a given shape can overlap other shapes. Read/write Long.
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
DistanceBottom | Returns or sets the distance (in points) between the document text and the bottom edge of the text-free area surrounding the specified shape. Read/write Single.
DistanceLeft | Returns or sets the distance (in points) between the document text and the left edge of the text-free area surrounding the specified shape. Read/write Single.
DistanceRight | Returns or sets the distance (in points) between the document text and the right edge of the text-free area surrounding the specified shape. Read/write Single.
DistanceTop | Returns or sets the distance (in points) between the document text and the top edge of the text-free area surrounding the specified shape. Read/write Single.
Parent | Returns an Object that represents the parent object of the specified WrapFormat object.
Side | Returns or sets a value that indicates whether the document text should wrap on both sides of the specified shape, on either the left or right side only, or on the side of the shape that's farthest from the page margin.Read/write WdWrapSideType.
Type | Returns the wrap type for the specified shape. Read/write WdWrapType.


WrapFormat Properties (Word)

 Copy code hover
[image]

WrapFormat Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
AllowOverlap | Returns or sets a value that specifies whether a given shape can overlap other shapes. Read/write Long.
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
DistanceBottom | Returns or sets the distance (in points) between the document text and the bottom edge of the text-free area surrounding the specified shape. Read/write Single.
DistanceLeft | Returns or sets the distance (in points) between the document text and the left edge of the text-free area surrounding the specified shape. Read/write Single.
DistanceRight | Returns or sets the distance (in points) between the document text and the right edge of the text-free area surrounding the specified shape. Read/write Single.
DistanceTop | Returns or sets the distance (in points) between the document text and the top edge of the text-free area surrounding the specified shape. Read/write Single.
Parent | Returns an Object that represents the parent object of the specified WrapFormat object.
Side | Returns or sets a value that indicates whether the document text should wrap on both sides of the specified shape, on either the left or right side only, or on the side of the shape that's farthest from the page margin.Read/write WdWrapSideType.
Type | Returns the wrap type for the specified shape. Read/write WdWrapType.


WrapFormat.AllowOverlap Property (Word)

 Copy code hover
[image]

WrapFormat.AllowOverlap Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a value that specifies whether a given shape can overlap other shapes. Read/write Long.

Syntax

expression .AllowOverlap

expression A variable that represents a WrapFormat object.

Remarks

This property can be set to either True or False. Because HTML doesn't support overlapping tables or shapes, AllowOverlap is ignored in Web layout view.

Example

This example specifies that the first shape in the active document can overlap other shapes.

VBA Copy code Copy code
ActiveDocument.Shapes(1).WrapFormat.AllowOverlap = True

See also

Concepts

WrapFormat Object

Other resources

WrapFormat Object Members


WrapFormat.Application Property (Word)

 Copy code hover
[image]

WrapFormat.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a WrapFormat object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

WrapFormat Object

Other resources

WrapFormat Object Members


WrapFormat.Creator Property (Word)

 Copy code hover
[image]

WrapFormat.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a WrapFormat object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

WrapFormat Object

Other resources

WrapFormat Object Members


WrapFormat.DistanceBottom Property (Word)

 Copy code hover
[image]

WrapFormat.DistanceBottom Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the distance (in points) between the document text and the bottom edge of the text-free area surrounding the specified shape. Read/write Single.

Syntax

expression .DistanceBottom

expression A variable that represents a WrapFormat object.

Remarks

The size and shape of the specified shape, together with the values of the Type and Side properties of the WrapFormat object, determine the size and shape of this text-free area.

Example

This example sets text to wrap around the first table in the active document and sets the distance for wrapped text to 20 points on all sides of the table.

VBA Copy code Copy code
With ActiveDocument.Tables(1).Rows
 .WrapAroundText = True
 .DistanceLeft = 20
 .DistanceRight = 20
 .DistanceTop = 20
 .DistanceBottom = 20
End With

This example adds an oval to the active document and specifies that the document text wrap around the left and right sides of the square that circumscribes the oval. The example sets a 0.1-inch margin between the document text and the top, bottom, left side, and right side of the square.

VBA Copy code Copy code
Dim shapeOval As Shape

Set shapeOval = ActiveDocument.Shapes.AddShape(msoShapeOval, _
 36, 36, 100, 35)
With shapeOval.WrapFormat
 .Type = wdWrapSquare
 .Side = wdWrapBoth
 .DistanceTop = InchesToPoints(0.1)
 .DistanceBottom = InchesToPoints(0.1)
 .DistanceLeft = InchesToPoints(0.1)
 .DistanceRight = InchesToPoints(0.1)
End With

See also

Concepts

WrapFormat Object

Other resources

WrapFormat Object Members


WrapFormat.DistanceLeft Property (Word)

 Copy code hover
[image]

WrapFormat.DistanceLeft Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the distance (in points) between the document text and the left edge of the text-free area surrounding the specified shape. Read/write Single.

Syntax

expression .DistanceLeft

expression A variable that represents a WrapFormat object.

Remarks

The size and shape of the specified shape, together with the values of the Type and Side properties of the WrapFormat object, determine the size and shape of this text-free area.

Example

This example sets text to wrap around the first table in the active document and sets the distance for wrapped text to 20 points on all sides of the table.

VBA Copy code Copy code
With ActiveDocument.Tables(1).Rows
 .WrapAroundText = True
 .DistanceLeft = 20
 .DistanceRight = 20
 .DistanceTop = 20
 .DistanceBottom = 20
End With

This example adds an oval to the active document and specifies that the document text wrap tightly around the oval. The example sets a 0.1-inch margin between the document text and the top, bottom, left side, and right side of the oval.

VBA Copy code Copy code
Dim shapeOval As Shape

Set shapeOval = ActiveDocument.Shapes.AddShape(msoShapeOval, _
 0, 0, 200, 50)
With shapeOval.WrapFormat
 .Type = wdWrapTight
 .Side = wdWrapBoth
 .DistanceTop = InchesToPoints(0.1)
 .DistanceBottom = InchesToPoints(0.1)
 .DistanceLeft = InchesToPoints(0.1)
 .DistanceRight = InchesToPoints(0.1)
End With

See also

Concepts

WrapFormat Object

Other resources

WrapFormat Object Members


WrapFormat.DistanceRight Property (Word)

 Copy code hover
[image]

WrapFormat.DistanceRight Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the distance (in points) between the document text and the right edge of the text-free area surrounding the specified shape. Read/write Single.

Syntax

expression .DistanceRight

expression A variable that represents a WrapFormat object.

Remarks

The size and shape of the specified shape, together with the values of the Type and Side properties of the WrapFormat object, determine the size and shape of this text-free area.

Example

This example sets text to wrap around the first table in the active document and sets the distance for wrapped text to 20 points on all sides of the table.

VBA Copy code Copy code
With ActiveDocument.Tables(1).Rows
 .WrapAroundText = True
 .DistanceLeft = 20
 .DistanceRight = 20
 .DistanceTop = 20
 .DistanceBottom = 20
End With

This example adds an oval to the active document and specifies that the document text wrap around the left and right sides of the square that circumscribes the oval. The example sets a 0.1-inch margin between the document text and the top, bottom, left side, and right side of the square.

VBA Copy code Copy code
Dim shapeOval As Shape

Set shapeOval = ActiveDocument.Shapes.AddShape(msoShapeOval, _
 0, 0, 200, 50)
With shapeOval.WrapFormat
 .Type = wdWrapSquare
 .Side = wdWrapBoth
 .DistanceTop = InchesToPoints(0.1)
 .DistanceBottom = InchesToPoints(0.1)
 .DistanceLeft = InchesToPoints(0.1)
 .DistanceRight = InchesToPoints(0.1)
End With

See also

Concepts

WrapFormat Object

Other resources

WrapFormat Object Members


WrapFormat.DistanceTop Property (Word)

 Copy code hover
[image]

WrapFormat.DistanceTop Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the distance (in points) between the document text and the top edge of the text-free area surrounding the specified shape. Read/write Single.

Syntax

expression .DistanceTop

expression A variable that represents a WrapFormat object.

Remarks

The size and shape of the specified shape, together with the values of the Type and Side properties of the WrapFormat object, determine the size and shape of this text-free area.

Example

This example sets text to wrap around the first table in the active document and sets the distance for wrapped text to 20 points on all sides of the table.

VBA Copy code Copy code
With ActiveDocument.Tables(1).Rows
 .WrapAroundText = True
 .DistanceLeft = 20
 .DistanceRight = 20
 .DistanceTop = 20
 .DistanceBottom = 20
End With

This example adds an oval to the active document and specifies that the document text wrap around the left and right sides of the square that circumscribes the oval. The example sets a 0.1-inch margin between the document text and the top, bottom, left side, and right side of the square.

VBA Copy code Copy code
Dim
VBA Copy code Copy code
shapeOval As Shape

Set shapeOval = ActiveDocument.Shapes.AddShape(msoShapeOval, _
 0, 0, 200, 50)
With shapeOval.WrapFormat
 .Type = wdWrapSquare
 .Side = wdWrapBoth
 .DistanceTop = InchesToPoints(0.1)
 .DistanceBottom = InchesToPoints(0.1)
 .DistanceLeft = InchesToPoints(0.1)
 .DistanceRight = InchesToPoints(0.1)
End With

See also

Concepts

WrapFormat Object

Other resources

WrapFormat Object Members


WrapFormat.Parent Property (Word)

 Copy code hover
[image]

WrapFormat.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified WrapFormat object.

Syntax

expression .Parent

expression Required. A variable that represents a WrapFormat object.

See also

Concepts

WrapFormat Object

Other resources

WrapFormat Object Members


WrapFormat.Side Property (Word)

 Copy code hover
[image]

WrapFormat.Side Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a value that indicates whether the document text should wrap on both sides of the specified shape, on either the left or right side only, or on the side of the shape that's farthest from the page margin.Read/write WdWrapSideType.

Syntax

expression .Side

expression Required. A variable that represents a WrapFormat object.

Remarks

If the text wraps on only one side of the shape, there is a text-free area between the other side of the shape and the page margin.

Example

This example adds an oval to the active document and specifies that the document text wrap around the left and right sides of the square that circumscribes the oval. The example sets a 0.1-inch margin between the document text and the top, bottom, left side, and right side of the square.

VBA Copy code Copy code
Set myOval = ActiveDocument.Shapes.AddShape(msoShapeOval, _
 0, 0, 200, 50)
With myEll.WrapFormat
 .Type = wdWrapSquare
 .Side = wdWrapBoth
 .DistanceTop = InchesToPoints(0.1)
 .DistanceBottom = InchesToPoints(0.1)
 .DistanceLeft = InchesToPoints(0.1)
 .DistanceRight = InchesToPoints(0.1)
End With

See also

Concepts

WrapFormat Object

Other resources

WrapFormat Object Members


WrapFormat.Type Property (Word)

 Copy code hover
[image]

WrapFormat.Type Property (Word)
See also Send feedback

Published: July 16, 2012

Returns the wrap type for the specified shape. Read/write WdWrapType.

Syntax

expression .Type

expression Required. A variable that represents a WrapFormat object.

See also

Concepts

WrapFormat Object

Other resources

WrapFormat Object Members


XMLMapping Object (Word)

 Copy code hover
[image]

XMLMapping Object (Word)
See also Send feedback

Published: July 16, 2012

Represents the XML mapping on a ContentControl object between custom XML and a content control. An XML mapping is a link between the text in a content control and an XML element in the custom XML data store for this document.

Remarks

Use the SetMapping method to add or change the XML mapping for a content control using an XPath string. The following example sets the built-in document property for the document author, inserts a new content control into the active document, and then sets the XML mapping for the control to the built-in document property.

VBA Copy code Copy code
Dim objcc As ContentControl
Dim objMap As XMLMapping
Dim blnMap As Boolean

ActiveDocument.BuiltInDocumentProperties("Author").Value = "David Jaffe"

Set objcc = ActiveDocument.ContentControls.Add _
 (wdContentControlDate, ActiveDocument.Paragraphs(1).Range)

Set objMap = objcc.XMLMapping
blnMap = objMap.SetMapping(XPath:="/ns1:coreProperties[1]/ns0:createdate[1]")

If blnMap = False Then
 MsgBox "Unable to map the content control."
End If

Use the SetMappingByNode method to add or change the XML mapping for a content control using a CustomXMLNode object. The following example does the same thing as the previous example, but uses the SetMappingByNode method.

VBA Copy code Copy code
Dim objcc As ContentControl
Dim objNode As CustomXMLNode
Dim objMap As XMLMapping
Dim blnMap As Boolean

ActiveDocument.BuiltInDocumentProperties("Author").Value = "David Jaffe"

Set objcc = ActiveDocument.ContentControls.Add _
 (wdContentControlDate, ActiveDocument.Paragraphs(1).Range)

Set objNode = ActiveDocument.CustomXMLParts.SelectByNamespace _
 ("http://schemas.openxmlformats.org/package/2006/metadata/core-properties") _
 (1).DocumentElement.ChildNodes(1)

Set objMap = objcc.XMLMapping
blnMap = objMap.SetMappingByNode(objNode)

The following example creates a new CustomXMLPart object, loads custom XML into it, and then creates two new content controls and maps each to a different XML element within the custom XML.

VBA Copy code Copy code
Dim objRange As Range
Dim objCustomPart As CustomXMLPart
Dim objCustomControl As ContentControl
Dim objCustomNode As CustomXMLNode

Set objCustomPart = ActiveDocument.CustomXMLParts.Add
objCustomPart.LoadXML ("<books><book><author>Matt Hink</author>" & _
 "<title>Migration Paths of the Red Breasted Robin</title>" & _
 "<genre>non-fiction</genre><price>29.95</price>" & _
 "<pub_date>2/1/2007</pub_date><abstract>You see them in " & _
 "the spring outside your windows. You hear their lovely " & _
 "songs wafting in the warm spring air. Now follow the path " & _
 "of the red breasted robin as it migrates to warmer climes " & _
 "in the fall, and then back to your back yard in the spring." & _
 "</abstract></book></books>")

ActiveDocument.Range.InsertParagraphBefore
Set objRange = ActiveDocument.Paragraphs(1).Range
Set objCustomNode = objCustomPart.SelectSingleNode _
 ("/books/book/title")
Set objCustomControl = ActiveDocument.ContentControls _
 .Add(wdContentControlText, objRange)
objCustomControl.XMLMapping.SetMappingByNode objCustomNode

objRange.InsertParagraphAfter
Set objRange = ActiveDocument.Paragraphs(2).Range
Set objCustomNode = objCustomPart.SelectSingleNode _
 ("/books/book/abstract")
Set objCustomControl = ActiveDocument.ContentControls _
 .Add(wdContentControlText, objRange)
objCustomControl.XMLMapping.SetMappingByNode objCustomNode

MsgBox objCustomControl.XMLMapping.IsMapped

Use the Delete method to remove the XML mapping for a content control. Deleting the XML mapping for a content control deletes only the connection between the content control and the XML data. Both the content control and the XML data remain in the document. The following example deletes the XML mapping for all content controls in the active document that are currently mapped.

VBA Copy code Copy code
Dim objCC As ContentControl

For Each objCC In ActiveDocument.ContentControls
 If objCC.XMLMapping.IsMapped Then
 objCC.XMLMapping.Delete
 End If
Next

Use the IsMapped property to determine if a content control is mapped to an XML node in the document's data store. The following example deletes the XML mapping for all mapped content controls in the active document.

VBA Copy code Copy code
Dim objCC As ContentControl

For Each objCC In ActiveDocument.ContentControls
 If objCC.XMLMapping.IsMapped Then
 objCC.XMLMapping.Delete
 End If
Next

Use the CustomXMLNode property to access the XML node to which a content control maps. Use the CustomXMLPart property to access the XML part to which a content control maps. For more information about working with CustomXMLNode and CustomXMLPart objects, see the respective object topics.

See also

Concepts

Word Object Model Reference

Other resources

XMLMapping Object Members


XMLMapping Members (Word)

 Copy code hover
[image]

XMLMapping Members (Word)
Send feedback

Published: July 16, 2012

Represents the XML mapping on a ContentControl object between custom XML and a content control. An XML mapping is a link between the text in a content control and an XML element in the custom XML data store for this document.

Methods

Name | Description
Delete | Deletes the XML mapping from the parent content control.
SetMapping | Allows creating or changing the XML mapping on a content control. Returns True if Microsoft Word maps the content control to a custom XML node in the document's custom XML data store.
SetMappingByNode | Allows creating or changing the XML data mapping on a content control. Returns True if Microsoft Word maps the content control to a custom XML node in the document's custom XML data store.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
CustomXMLNode | Returns a CustomXMLNode object that represents the custom XML node in the data store to which the content control in the document maps.
CustomXMLPart | Returns a CustomXMLPart object that represents the custom XML part to which the content control in the document maps.
IsMapped | Returns a Boolean that represents whether the content control in the document is mapped to an XML node in the document's XML data store. Read-only.
Parent | Returns an Object that represents the parent object of the specified XMLMapping object.
PrefixMappings | Returns a String that represents the prefix mappings used to evaluate the XPath for the current XML mapping. Read-only.
XPath | Returns a String that represents the XPath for the XML mapping, which evaluates to the currently mapped XML node. Read-only.


XMLMapping Properties (Word)

 Copy code hover
[image]

XMLMapping Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.
CustomXMLNode | Returns a CustomXMLNode object that represents the custom XML node in the data store to which the content control in the document maps.
CustomXMLPart | Returns a CustomXMLPart object that represents the custom XML part to which the content control in the document maps.
IsMapped | Returns a Boolean that represents whether the content control in the document is mapped to an XML node in the document's XML data store. Read-only.
Parent | Returns an Object that represents the parent object of the specified XMLMapping object.
PrefixMappings | Returns a String that represents the prefix mappings used to evaluate the XPath for the current XML mapping. Read-only.
XPath | Returns a String that represents the XPath for the XML mapping, which evaluates to the currently mapped XML node. Read-only.


XMLMapping.Application Property (Word)

 Copy code hover
[image]

XMLMapping.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a XMLMapping object.

See also

Concepts

XMLMapping Object

Other resources

XMLMapping Object Members


XMLMapping.Creator Property (Word)

 Copy code hover
[image]

XMLMapping.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the add-in was created. Read-only Long.

Syntax

expression .Creator

expression An expression that returns an XMLMapping object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

Note Note

This value can also be represented by the constant wdCreatorCode.

See also

Concepts

XMLMapping Object

Other resources

XMLMapping Object Members


XMLMapping.CustomXMLNode Property (Word)

 Copy code hover
[image]

XMLMapping.CustomXMLNode Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a CustomXMLNode object that represents the custom XML node in the data store to which the content control in the document maps.

Syntax

expression .CustomXMLNode

expression An expression that returns an XMLMapping object.

Example

The following example inserts a new content control and custom XML part into the active document, maps the content control to a node in the custom XML part, and then sets the value of the mapped XML node.

VBA Copy code Copy code
Dim objCC As ContentControl
Dim objPart As CustomXMLPart
Dim objNode As CustomXMLNode
Dim objMap As XMLMapping

Set objCC = ActiveDocument.ContentControls.Add(wdContentControlText)
Set objPart = ActiveDocument.CustomXMLParts.Add("<books><book>" & _
 "<author></author><title></title><genre></genre><price></price>" & _
 "<pub_date></pub_date><abstract></abstract></book></books>")

Set objMap = objCC.XMLMapping
objMap.SetMapping "/books/book/author", , objPart

Set objNode = objMap.CustomXMLNode
objNode.Text = "Matt Hink"

objCC.Range.Text = objNode.Text

See also

Concepts

XMLMapping Object

Other resources

XMLMapping Object Members


XMLMapping.CustomXMLPart Property (Word)

 Copy code hover
[image]

XMLMapping.CustomXMLPart Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a CustomXMLPart object that represents the custom XML part to which the content control in the document maps.

Syntax

expression .CustomXMLPart

expression An expression that returns an XMLMapping object.

Example

The following example accesses the first content control in the active document and the custom XML part to which it is mapped, and then sets the text value of one of the XML nodes contained within the custom XML part.

Note Note

This example assumes that at least one content control in the active document is mapped to a custom XML part that contains the XML nodes specified in the XPath string.

VBA Copy code Copy code
Dim objCC As ContentControl
Dim objPart As CustomXMLPart
Dim objNode As CustomXMLNode

Set objCC = ActiveDocument.ContentControls(1)
Set objPart = objCC.XMLMapping.CustomXMLPart
Set objNode = objPart.SelectSingleNode("/books/book/title")
objNode.Text = "Mystery of the Empty Chair"

See also

Concepts

XMLMapping Object

Other resources

XMLMapping Object Members


XMLMapping.IsMapped Property (Word)

 Copy code hover
[image]

XMLMapping.IsMapped Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Boolean that represents whether the content control in the document is mapped to an XML node in the document's XML data store. Read-only.

Syntax

expression .IsMapped

expression An expression that returns an XMLMapping object.

Example

The following example deletes the XML mapping for all content controls in the active document that are currently mapped.

VBA Copy code Copy code
Dim objCC As ContentControl

For Each objCC In ActiveDocument.ContentControls
 If objCC.XMLMapping.IsMapped Then
 objCC.XMLMapping.Delete
 End If
Next

See also

Concepts

XMLMapping Object

Other resources

XMLMapping Object Members


XMLMapping.Parent Property (Word)

 Copy code hover
[image]

XMLMapping.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified XMLMapping object.

Syntax

expression .Parent

expression A variable that represents a XMLMapping object.

See also

Concepts

XMLMapping Object

Other resources

XMLMapping Object Members


XMLMapping.PrefixMappings Property (Word)

 Copy code hover
[image]

XMLMapping.PrefixMappings Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a String that represents the prefix mappings used to evaluate the XPath for the current XML mapping. Read-only.

Syntax

expression .PrefixMappings

expression An expression that returns an XMLMapping object.

Remarks

To set mapping for a content control, use the SetMapping method or the SetMappingByNode method.

See also

Concepts

XMLMapping Object

Other resources

XMLMapping Object Members


XMLMapping.XPath Property (Word)

 Copy code hover
[image]

XMLMapping.XPath Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a String that represents the XPath for the XML mapping, which evaluates to the currently mapped XML node. Read-only.

Syntax

expression .XPath

expression An expression that returns an XMLMapping object.

Remarks

To set mapping for a content control, use the SetMapping method or the SetMappingByNode method. If the mapping is not active, using this property returns an error.

Example

The following example checks whether the first content control in the active document is a date control and whether the XPath string is set to a specific built-in document property. It then sets the mapping to the control, if the XPath does not match and the control is a date control.

VBA Copy code Copy code
Dim objCC As ContentControl
Dim objMap As XMLMapping
Dim blnMap As Boolean

Set objCC = ActiveDocument.ContentControls(1)
Set objMap = objCC.XMLMapping

If (objCC.Type = wdContentControlDate) And (objMap.XPath <> _
 "/ns1:coreProperties[1]/ns0:createdate[1]") Then
 blnMap = objMap.SetMapping(XPath:="/ns1:coreProperties[1]/ns0:createdate[1]")

 If blnMap = False Then
 MsgBox "Unable to map the content control."
 End If
End If

See also

Concepts

XMLMapping Object

Other resources

XMLMapping Object Members


XMLMapping Methods (Word)

 Copy code hover
[image]

XMLMapping Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the XML mapping from the parent content control.
SetMapping | Allows creating or changing the XML mapping on a content control. Returns True if Microsoft Word maps the content control to a custom XML node in the document's custom XML data store.
SetMappingByNode | Allows creating or changing the XML data mapping on a content control. Returns True if Microsoft Word maps the content control to a custom XML node in the document's custom XML data store.


XMLMapping.Delete Method (Word)

 Copy code hover
[image]

XMLMapping.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the XML mapping from the parent content control.

Syntax

expression .Delete

expression An expression that returns an XMLMapping object.

Remarks

This operation removes the XML mapping. Both the XML data and the content control remain in the document.

Example

The following example deletes the XML mapping for all content controls in the active document that are currently mapped.

VBA Copy code Copy code
Dim objCC As ContentControl

For Each objCC In ActiveDocument.ContentControls
 If objCC.XMLMapping.IsMapped Then
 objCC.XMLMapping.Delete
 End If
Next

See also

Concepts

XMLMapping Object

Other resources

XMLMapping Object Members


XMLMapping.SetMapping Method (Word)

 Copy code hover
[image]

XMLMapping.SetMapping Method (Word)
See also Send feedback

Published: July 16, 2012

Allows creating or changing the XML mapping on a content control. Returns True if Microsoft Word maps the content control to a custom XML node in the document's custom XML data store.

Syntax

expression .SetMapping(XPath, PrefixMapping, Source)

expression An expression that returns an XMLMapping object.

Parameters

Name | Required/Optional | Data Type | Description
XPath | Required | String | Specifies an XPath string that represents the XML node to which to map the content control. An invalid XPath string causes a run-time error.
PrefixMapping | Optional | String | Specifies the prefix mappings to use when querying the expression provided in the XPath parameter. If omitted, Word uses the set of prefix mappings for the specified custom XML part in the current document.
Source | Optional | CustomXMLPart | Specifies the desired custom XML data to which to map the content control. If this parameter is omitted, the XPath is evaluated against all custom XML in the current document, and the mapping is established with the first CustomXMLPart in which the XPath resolves to an XML node.

Return Value

Boolean

Remarks

If the XML mapping already exists, Word replaces the existing XML mapping and the contents of the new mapped XML node replaces the text of the content control. If the specified XPath does not evaluate to an XML node in the specified custom XML part or parts, you can still specify the mapping, and one will be created. This mapping automatically links when the specified XPath would evaluate to an XML node in the specified custom XML parts.

See also the SetMappingByNode method.

Note Note

Creating a mapping for a rich-text content control causes a run-time error.

Example

The following example inserts a custom XML part and sets the XML for the custom part, and then inserts two content controls at the beginning of the document and maps the contents of the controls to the contents of XML elements in the custom part.

VBA Copy code Copy code
Dim objRange As Range
Dim objCustomPart As CustomXMLPart
Dim objCustomControl As ContentControl

Set objCustomPart = ActiveDocument.CustomXMLParts.Add
objCustomPart.LoadXML ("<books><book><author>Matt Hink</author>" & _
 "<title>Migration Paths of the Red Breasted Robin</title>" & _
 "<genre>non-fiction</genre><price>29.95</price>" & _
 "<pub_date>2/1/2007</pub_date><abstract>You see them in " & _
 "the spring outside your windows. You hear their lovely " & _
 "songs wafting in the warm spring air. Now follow the path " & _
 "of the red breasted robin as it migrates to warmer climes " & _
 "in the fall, and then back to your back yard in the spring." & _
 "</abstract></book></books>")

ActiveDocument.Range.InsertParagraphBefore
Set objRange = ActiveDocument.Paragraphs(1).Range
Set objCustomControl = ActiveDocument.ContentControls _
 .Add(wdContentControlText, objRange)
objCustomControl.XMLMapping.SetMapping _
 "/books/book/title", , objCustomPart

objRange.InsertParagraphAfter
Set objRange = ActiveDocument.Paragraphs(2).Range
Set objCustomControl = ActiveDocument.ContentControls _
 .Add(wdContentControlText, objRange)
objCustomControl.XMLMapping.SetMapping _
 "/books/book/abstract", , objCustomPart

See also

Concepts

XMLMapping Object

Other resources

XMLMapping Object Members


XMLMapping.SetMappingByNode Method (Word)

 Copy code hover
[image]

XMLMapping.SetMappingByNode Method (Word)
See also Send feedback

Published: July 16, 2012

Allows creating or changing the XML data mapping on a content control. Returns True if Microsoft Word maps the content control to a custom XML node in the document's custom XML data store.

Syntax

expression .SetMappingByNode(Node)

expression An expression that returns an XMLMapping object.

Parameters

Name | Required/Optional | Data Type | Description
Node | Required | CustomXMLNode | Specifies the XML node to which to map the current content control.

Return Value

Boolean

Remarks

If the XML mapping already exists, then Word replaces the existing XML mapping, and the contents of the new mapped XML node replaces the text of the content control. See also the SetMapping method.

Note Note

Creating a mapping for a rich-text content control causes a run-time error.

Example

The following example sets the built-in document property for the document author, inserts a new content control into the active document, and then sets the XML mapping for the control to the built-in document property.

VBA Copy code Copy code
Dim objcc As ContentControl
Dim objNode As CustomXMLNode
Dim objMap As XMLMapping
Dim blnMap As Boolean

ActiveDocument.BuiltInDocumentProperties("Author").Value = "David Jaffe"

Set objcc = ActiveDocument.ContentControls.Add _
 (wdContentControlDate, ActiveDocument.Paragraphs(1).Range)

Set objNode = ActiveDocument.CustomXMLParts.SelectByNamespace _
 ("http://schemas.openxmlformats.org/package/2006/metadata/core-properties") _
 (1).DocumentElement.ChildNodes(1)

Set objMap = objcc.XMLMapping
blnMap = objMap.SetMappingByNode(objNode)

The following example creates a custom XML part, and then creates two content controls and maps each content control to a specific node within the custom XML.

VBA Copy code Copy code
Dim objRange As Range
Dim objCustomPart As CustomXMLPart
Dim objCustomControl As ContentControl
Dim objCustomNode As CustomXMLNode

Set objCustomPart = ActiveDocument.CustomXMLParts.Add
objCustomPart.LoadXML ("<books><book><author>Matt Hink</author>" & _
 "<title>Migration Paths of the Red Breasted Robin</title><genre>non-fiction</genre>" & _
 "<price>29.95</price><pub_date>2007-02-01</pub_date><abstract>" & _
 "You see them in the spring outside your windows. You hear their lovely " & _
 "songs wafting in the warm spring air. Now follow the path of the red breasted robin " & _
 "as it migrates to warmer climes in the fall, and then back to your back yard " & _
 "in the spring.</abstract></book></books>")

ActiveDocument.Range.InsertParagraphBefore
Set objRange = ActiveDocument.Paragraphs(1).Range
Set objCustomNode = objCustomPart.SelectSingleNode _
 ("/books/book/title")
Set objCustomControl = ActiveDocument.ContentControls _
 .Add(wdContentControlText, objRange)
objCustomControl.XMLMapping.SetMappingByNode objCustomNode

objRange.InsertParagraphAfter
Set objRange = ActiveDocument.Paragraphs(2).Range
Set objCustomNode = objCustomPart.SelectSingleNode _
 ("/books/book/abstract")
Set objCustomControl = ActiveDocument.ContentControls _
 .Add(wdContentControlText, objRange)
objCustomControl.XMLMapping.SetMappingByNode objCustomNode

See also

Concepts

XMLMapping Object

Other resources

XMLMapping Object Members


XMLNamespace Object (Word)

 Copy code hover
[image]

XMLNamespace Object (Word)
See also Send feedback

Published: July 16, 2012

Represents an individual schema within the Schema Library.

Remarks

You can access the Schema Library from within Microsoft Word from the XML Schema tab in the Templates and Add-ins dialog box. The Schema Library represents schemas installed on a user's computer that a user has applied to a Word document or that a user has explicitly added to the Schema Library by using the Schema Library dialog box.

Use the Item method of the XMLNamespaces collection to return an individual XMLNameSpace object. The index value of the Item method can be either a Long, which indicates the position of the schema in the Schema Library, or a String, which represents the name of the schema as returned using the URI property (the TargetNamespace setting defined in the schema).

The following example attaches a schema named SimpleSample to the active document.

VBA Copy code Copy code
Sub ApplySampleSchema()
 Dim objSchema As XMLNamespace

 For Each objSchema In Application.XMLNamespaces
 If objSchema.URI = "SimpleSample" Then
 objSchema.AttachToDocument ActiveDocument
 Exit For
 End If
 Next
End Sub
Note Note

The SimpleSample schema is included in the Smart Document Software Development Kit (SDK). For more information, refer to the Smart Document SDK on the Microsoft Developer Network (MSDN) Web site.

See also

Concepts

Word Object Model Reference

Other resources

XMLNamespace Object Members


XMLNamespace Members (Word)

 Copy code hover
[image]

XMLNamespace Members (Word)
Send feedback

Published: July 16, 2012

Represents an individual schema within the Schema Library.

Methods

Name | Description
AttachToDocument | Attaches an XML schema to a document.
Delete | Deletes the specified XML schema from the list of available XML schemas.

Properties

Name | Description
Alias | Returns a String that represents the display name for the specified object.
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
DefaultTransform | Returns an XSLTransform object that represents the default Extensible Stylesheet Language Transformation (XSLT) file to use when opening a document from an XML schema for a particular namespace.
Location | Returns or sets a String that represents the physical location of the namespace of an XML schema in the Schema Library. Read/write.
Parent | Returns an Object that represents the parent object of the specified XMLNamespace object.
URI | Returns a String that represents the Uniform Resource Identifier (URI) of the associated namespace.
XSLTransforms | Returns an XSLTransforms collection that represents the Extensible Stylesheet Language Transformation (XSLT) files specified for use with a schema.


XMLNamespace Properties (Word)

 Copy code hover
[image]

XMLNamespace Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Alias | Returns a String that represents the display name for the specified object.
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
DefaultTransform | Returns an XSLTransform object that represents the default Extensible Stylesheet Language Transformation (XSLT) file to use when opening a document from an XML schema for a particular namespace.
Location | Returns or sets a String that represents the physical location of the namespace of an XML schema in the Schema Library. Read/write.
Parent | Returns an Object that represents the parent object of the specified XMLNamespace object.
URI | Returns a String that represents the Uniform Resource Identifier (URI) of the associated namespace.
XSLTransforms | Returns an XSLTransforms collection that represents the Extensible Stylesheet Language Transformation (XSLT) files specified for use with a schema.


XMLNamespace.Alias Property (Word)

 Copy code hover
[image]

XMLNamespace.Alias Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a String that represents the display name for the specified object.

Syntax

expression .Alias

expression Required. A variable that represents a XMLNamespace object.

Example

The following example shows the display name for the first schema attached to the active document.

VBA Copy code Copy code
MsgBox Application.XMLNamespaces(1).Alias

See also

Concepts

XMLNamespace Object

Other resources

XMLNamespace Object Members


XMLNamespace.Application Property (Word)

 Copy code hover
[image]

XMLNamespace.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a XMLNamespace object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

XMLNamespace Object

Other resources

XMLNamespace Object Members


XMLNamespace.Creator Property (Word)

 Copy code hover
[image]

XMLNamespace.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a XMLNamespace object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

XMLNamespace Object

Other resources

XMLNamespace Object Members


XMLNamespace.DefaultTransform Property (Word)

 Copy code hover
[image]

XMLNamespace.DefaultTransform Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an XSLTransform object that represents the default Extensible Stylesheet Language Transformation (XSLT) file to use when opening a document from an XML schema for a particular namespace.

Syntax

expression .DefaultTransform

expression An expression that returns an XMLNamespace object.

Example

The following example returns the default XSLT for the first schema in the Schema Library that Microsoft Word will use to open XML files associated with that schema's namespace. This example assumes that the first schema has one or more applied XSLT files.

VBA Copy code Copy code
Dim objXSLT As XSLTransform

Set objXSLT = Application.XMLNamespaces(1).DefaultTransform

See also

Concepts

XMLNamespace Object

Other resources

XMLNamespace Object Members


XMLNamespace.Location Property (Word)

 Copy code hover
[image]

XMLNamespace.Location Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a String that represents the physical location of the namespace of an XML schema in the Schema Library. Read/write.

Syntax

expression .Location(AllUsers)

expression An expression that returns an XMLNamespace object.

Parameters

Name | Required/Optional | Data Type | Description
AllUsers | Optional | Boolean | Specifies whether to return the location for all users. False returns the location for only the current user, which may be different than the location for all users.

See also

Concepts

XMLNamespace Object

Other resources

XMLNamespace Object Members


XMLNamespace.Parent Property (Word)

 Copy code hover
[image]

XMLNamespace.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified XMLNamespace object.

Syntax

expression .Parent

expression Required. A variable that represents a XMLNamespace object.

See also

Concepts

XMLNamespace Object

Other resources

XMLNamespace Object Members


XMLNamespace.URI Property (Word)

 Copy code hover
[image]

XMLNamespace.URI Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a String that represents the Uniform Resource Identifier (URI) of the associated namespace.

Syntax

expression .URI

expression An expression that returns an XMLNamespace object.

Example

The following example displays the URI for the first schema in the Schema Library.

VBA Copy code Copy code
MsgBox Application.XMLNamespaces(1).URI

See also

Concepts

XMLNamespace Object

Other resources

XMLNamespace Object Members


XMLNamespace.XSLTransforms Property (Word)

 Copy code hover
[image]

XMLNamespace.XSLTransforms Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an XSLTransforms collection that represents the Extensible Stylesheet Language Transformation (XSLT) files specified for use with a schema.

Syntax

expression .XSLTransforms

expression An expression that returns an XMLNamespace object.

Example

The following example adds the simplesample.xsl transform to the transforms for the SimpleSample schema.

Note Note

The SimpleSample schema is included in the Smart Document Software Development Kit (SDK); however, there is no corresponding simplesample.xsl file. This code was created for example purposes only. For more information, refer to the Smart Document SDK on the Microsoft Developer Network (MSDN) Web site.

VBA Copy code Copy code
Dim objSchema As XMLNamespace
Dim objTransform As XSLTransform

Set objSchema = Application.XMLNamespaces("SimpleSample")
Set objTransform = objSchema.XSLTransforms _
 .Add("c:\schemas\simplesample.xsl")

See also

Concepts

XMLNamespace Object

Other resources

XMLNamespace Object Members


XMLNamespace Methods (Word)

 Copy code hover
[image]

XMLNamespace Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
AttachToDocument | Attaches an XML schema to a document.
Delete | Deletes the specified XML schema from the list of available XML schemas.


XMLNamespace.AttachToDocument Method (Word)

 Copy code hover
[image]

XMLNamespace.AttachToDocument Method (Word)
See also Send feedback

Published: July 16, 2012

Attaches an XML schema to a document.

Syntax

expression .AttachToDocument(Document)

expression An expression that represents a XMLNamespace object.

Parameters

Name | Required/Optional | Data Type | Description
Document | Required | Document | The document to which to attach the specified XML schema.

Example

The following example adds the SimpleSample schema to the Schema Library and then attaches it to the active document.

Note Note

The SimpleSample schema is included in the Smart Document Software Development Kit (SDK). For more information, refer to the Smart Document SDK on the Microsoft Developer Network (MSDN) Web site.

VBA Copy code Copy code
Dim objSchema As XMLNamespace

Set objSchema = Application.XMLNamespaces _
 .Add("c:\schemas\simplesample.xsd")

objSchema.AttachToDocument ActiveDocument

See also

Concepts

XMLNamespace Object

Other resources

XMLNamespace Object Members


XMLNamespace.Delete Method (Word)

 Copy code hover
[image]

XMLNamespace.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the specified XML schema from the list of available XML schemas.

Syntax

expression .Delete

expression Required. A variable that represents a XMLNamespace object.

See also

Concepts

XMLNamespace Object

Other resources

XMLNamespace Object Members


XMLNamespaces Object (Word)

 Copy code hover
[image]

XMLNamespaces Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of XMLNamespace objects that represents the entire collection of schemas in the Schema Library.

Remarks

In Microsoft OfficeWord, you can access the Schema Library from the XML Schema tab in the Templates and Add-ins dialog box. The Schema Library represents schemas installed on a user's computer that a user has applied to a Word document or that a user has explicitly added to the Schema Library by using the Schema Library dialog box.

Use the Item method of the XMLNamespaces collection to return an individual XMLNameSpace object. The index value of the Item method can be either a Long, which indicates the position of the schema in the Schema Library, or a String, which represents the name of the schema as returned by using the URI property (the TargetNamespace setting defined in the schema).

The following example attaches a schema named SimpleSample to the active document.

VBA Copy code Copy code
Sub ApplySampleSchema()
 Dim objSchema As XMLNamespace

 For Each objSchema In Application.XMLNamespaces
 If objSchema.URI = "SimpleSample" Then
 objSchema.AttachToDocument ActiveDocument
 Exit For
 End If
 Next
End Sub
Note Note

The SimpleSample schema is included in the Smart Document Software Development Kit (SDK). For more information, refer to the Smart Document SDK on the Microsoft Developer Network (MSDN) Web site.

See also

Concepts

Word Object Model Reference

Other resources

XMLNamespaces Object Members


XMLNamespaces Members (Word)

 Copy code hover
[image]

XMLNamespaces Members (Word)
Send feedback

Published: July 16, 2012

A collection of XMLNamespace objects that represents the entire collection of schemas in the Schema Library.

Methods

Name | Description
Add | Returns an XMLNamespace object that represents a schema that is added to the Schema Library and made available to users in Microsoft Word.
InstallManifest | Installs the specified XML expansion pack on the user's computer, making an XML smart document solution available to one or more users.
Item | Returns an individual XMLNamespace object in a collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of XML namespaces in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified XMLNamespaces object.


XMLNamespaces Properties (Word)

 Copy code hover
[image]

XMLNamespaces Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of XML namespaces in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified XMLNamespaces object.


XMLNamespaces.Application Property (Word)

 Copy code hover
[image]

XMLNamespaces.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a XMLNamespaces collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

XMLNamespaces Collection

Other resources

XMLNamespaces Object Members


XMLNamespaces.Count Property (Word)

 Copy code hover
[image]

XMLNamespaces.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of XML namespaces in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents a XMLNamespaces collection.

See also

Concepts

XMLNamespaces Collection

Other resources

XMLNamespaces Object Members


XMLNamespaces.Creator Property (Word)

 Copy code hover
[image]

XMLNamespaces.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a XMLNamespaces collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

XMLNamespaces Collection

Other resources

XMLNamespaces Object Members


XMLNamespaces.Parent Property (Word)

 Copy code hover
[image]

XMLNamespaces.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified XMLNamespaces object.

Syntax

expression .Parent

expression Required. A variable that represents a XMLNamespaces collection.

See also

Concepts

XMLNamespaces Collection

Other resources

XMLNamespaces Object Members


XMLNamespaces Methods (Word)

 Copy code hover
[image]

XMLNamespaces Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Returns an XMLNamespace object that represents a schema that is added to the Schema Library and made available to users in Microsoft Word.
InstallManifest | Installs the specified XML expansion pack on the user's computer, making an XML smart document solution available to one or more users.
Item | Returns an individual XMLNamespace object in a collection.


XMLNamespaces.Add Method (Word)

 Copy code hover
[image]

XMLNamespaces.Add Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an XMLNamespace object that represents a schema that is added to the Schema Library and made available to users in Microsoft Word.

Syntax

expression .Add(Path, NamespaceURI, Alias, InstallForAllUsers)

expression Required. A variable that represents a XMLNamespaces collection.

Parameters

Name | Required/Optional | Data Type | Description
Path | Required | String | The path and file name of the schema. This may be a local file path, a network path, or an Internet address.
NamespaceURI | Optional | String | The namespace Uniform Resource Indicator as specified in the schema. The NamespaceURI parameter is case-sensitive and must be spelled exactly as specified in schema.
Alias | Optional | String | The name of the schema as it appears on the Schemas tab in the Templates and Add-ins dialog box.
InstallForAllUsers | Optional | Boolean | True if all users that log on to a computer can access and use the new schema. The default is False.

Return Value

XMLNamespace

Example

The following example adds the specified schema to the Schema Library and then attaches it to the active document. This example assumes that you have a schema named simplesample.xsd at the specified path.

VBA Copy code Copy code
Sub AddSchema()
 Dim objSchema As XMLNamespace

 Set objSchema = Application.XMLNamespaces _
 .Add ("c:\schemas\simplesample.xsd")

 objSchema.AttachToDocument ActiveDocument
End Sub

See also

Concepts

XMLNamespaces Collection

Other resources

XMLNamespaces Object Members


XMLNamespaces.InstallManifest Method (Word)

 Copy code hover
[image]

XMLNamespaces.InstallManifest Method (Word)
See also Send feedback

Published: July 16, 2012

Installs the specified XML expansion pack on the user's computer, making an XML smart document solution available to one or more users.

Syntax

expression .InstallManifest(Path, InstallForAllUsers)

expression An expression that represents an XMLNamespaces object.

Parameters

Name | Required/Optional | Data Type | Description
Path | Required | String | The path and file name of the XML expansion pack.
InstallForAllUsers | Optional | Boolean | True installs the XML expansion pack and makes it available to all users on a computer. False makes the XML expansion pack available for the current user only. Default is False.

Remarks

For security purposes, you cannot install an unsigned manifest. For more information about manifests, see the Smart Document Software Development Kit (SDK) on the Microsoft Developer Network (MSDN) Web site.

Example

The following code example installs the SimpleSample smart document solution on the user's computer and makes it available only to the current user.

Note Note

The SimpleSample schema is included in the Smart Document Software Development Kit (SDK). For more information, refer to the Smart Document SDK.

VBA Copy code Copy code
Application.XMLNamespaces.InstallManifest _
 "http://smartdocuments/simplesample/manifest.xml"

See also

Concepts

XMLNamespaces Collection

Other resources

XMLNamespaces Object Members


XMLNamespaces.Item Method (Word)

 Copy code hover
[image]

XMLNamespaces.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual XMLNamespace object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents a XMLNamespaces collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The individual object to be returned. Can be a Long indicating the ordinal position or a String representing the name of the individual object.

Return Value

XMLNamespace

See also

Concepts

XMLNamespaces Collection

Other resources

XMLNamespaces Object Members


XMLNode Object (Word)

 Copy code hover
[image]

XMLNode Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a single XML element applied to a document.

Remarks

Each XML element that has been applied to a document is displayed as a node in a tree view control in the XML Structure task pane. Each node in the tree view is an instance of an XMLNode object. The hierarchy in the tree view indicates whether a node contains child nodes.

Use the Item method of the XMLNodes collection to return an individual XMLNode object. Use the Validate method to verify that an XML element is valid according to the applied schemas and that any required child elements exist and are in the required order. Once you run the Validate method, use the ValidationStatus property to verify whether an element is valid, and use the ValidationErrorText property to display information about what the user needs to do to make the document conform to the XML schema rules.

The following example validates each of the XML elements in the active document. If the element is found to be invalid against the schema, the example returns a message to the user explaining what the problem is.

VBA Copy code Copy code
Sub ValidateXMLElements()
 Dim objNode As XMLNode

 For Each objNode In ActiveDocument.XMLNodes
 objNode.Validate
 If objNode.ValidationStatus <> wdXMLValidationStatusOK Then
 MsgBox objNode.ValidationErrorText(True)
 End If
 Next
End Sub

See also

Concepts

Word Object Model Reference

Other resources

XMLNode Object Members


XMLNode Members (Word)

 Copy code hover
[image]

XMLNode Members (Word)
Send feedback

Published: July 16, 2012

Represents a single XML element applied to a document.

Methods

Name | Description
Copy | Copies the specified XML element, excluding XML markup, to the Clipboard.
Cut | Removes the specified XML element from the document and places it on the Clipboard.
Delete | Deletes the specified XML element from an XML document.
RemoveChild | Removes a child element from the specified element.
SelectNodes | Returns an XMLNodes collection that represents all the child elements that match the XPath parameter, in the order in which they appear within the specified XML element.
SelectSingleNode | Returns an XMLNode object that represents the first child element that matches the XPath parameter within the specified XML element. .
SetValidationError | Changes the validation error text displayed to a user for a specified node and forces Word to report a node as invalid.
Validate | Validates an individual XML element against the XML schemas that are attached to a document.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Attributes | Returns an XMLNodes collection that represents the attributes for the specified element.
BaseName | Returns a String that represents the name of the element without any prefix.
ChildNodes | Returns an XMLNodes collection that represents the child elements of a specified element.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
FirstChild | Returns a DiagramNode object that represents the first child node of a parent node. Read-only.
HasChildNodes | Returns a Boolean that represents whether an XML node has child nodes. Read-only.
LastChild | Returns an XMLNode object that represents the last child node of an XML element.
Level | Returns a WdXMLNodeLevel constant that represents whether an XML element is part of a paragraph, is a paragraph, or is contained within a table cell or contains a table row. Read-only.
NamespaceURI | Returns a String that represents the Uniform Resource Identifier (URI) of the schema namespace for the specified object. Read-only.
NextSibling | Returns an XMLNode object that represents the next element in the document that is at the same level as the specified element.
NodeType | Returns a WdXMLNodeType constant that represents the type of node.
NodeValue | Returns or sets a String that represents the value of an XML element. Read/write.
OwnerDocument | Returns a Document object that represents the parent document of the specified XML element.
Parent | Returns an Object that represents the parent object of the specified XMLNode object.
ParentNode | Returns an XMLNode object that represents the parent element of the specified element.
PlaceholderText | Sets or returns a String that represents the text displayed for an element that contains no text.
PreviousSibling | Returns an XMLNode object that represents the previous element in the document that is at the same level as the specified element.
Range | Returns a Range object that represents the portion of a document that is contained in the specified object. Read-only.
Text | Returns or sets the text contained within the XML element. Read/write String.
ValidationErrorText | Returns a String that represents the description for a validation error on an XMLNode object.
ValidationStatus | Returns a WdXMLValidationStatus constant that represents whether an element or attribute is valid according to the attached schema.
WordOpenXML | Returns a String that represents the XML for the node in the Microsoft Word Open XML format. Read-only.
XML | Returns a String that represents the text, with or without XML markup, that is contained within an XML node. Read-only.


XMLNode Properties (Word)

 Copy code hover
[image]

XMLNode Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Attributes | Returns an XMLNodes collection that represents the attributes for the specified element.
BaseName | Returns a String that represents the name of the element without any prefix.
ChildNodes | Returns an XMLNodes collection that represents the child elements of a specified element.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
FirstChild | Returns a DiagramNode object that represents the first child node of a parent node. Read-only.
HasChildNodes | Returns a Boolean that represents whether an XML node has child nodes. Read-only.
LastChild | Returns an XMLNode object that represents the last child node of an XML element.
Level | Returns a WdXMLNodeLevel constant that represents whether an XML element is part of a paragraph, is a paragraph, or is contained within a table cell or contains a table row. Read-only.
NamespaceURI | Returns a String that represents the Uniform Resource Identifier (URI) of the schema namespace for the specified object. Read-only.
NextSibling | Returns an XMLNode object that represents the next element in the document that is at the same level as the specified element.
NodeType | Returns a WdXMLNodeType constant that represents the type of node.
NodeValue | Returns or sets a String that represents the value of an XML element. Read/write.
OwnerDocument | Returns a Document object that represents the parent document of the specified XML element.
Parent | Returns an Object that represents the parent object of the specified XMLNode object.
ParentNode | Returns an XMLNode object that represents the parent element of the specified element.
PlaceholderText | Sets or returns a String that represents the text displayed for an element that contains no text.
PreviousSibling | Returns an XMLNode object that represents the previous element in the document that is at the same level as the specified element.
Range | Returns a Range object that represents the portion of a document that is contained in the specified object. Read-only.
Text | Returns or sets the text contained within the XML element. Read/write String.
ValidationErrorText | Returns a String that represents the description for a validation error on an XMLNode object.
ValidationStatus | Returns a WdXMLValidationStatus constant that represents whether an element or attribute is valid according to the attached schema.
WordOpenXML | Returns a String that represents the XML for the node in the Microsoft Word Open XML format. Read-only.
XML | Returns a String that represents the text, with or without XML markup, that is contained within an XML node. Read-only.


XMLNode.Application Property (Word)

 Copy code hover
[image]

XMLNode.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a XMLNode object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

XMLNode Object

Other resources

XMLNode Object Members


XMLNode.Attributes Property (Word)

 Copy code hover
[image]

XMLNode.Attributes Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an XMLNodes collection that represents the attributes for the specified element.

Syntax

expression .Attributes

expression Required. A variable that represents a XMLNode object.

Remarks

All XMLNode objects in the XMLNodes collection returned by using the Attributes property have a NodeType property value of wdXMLNodeAttribute.

Example

The following example adds the author attribute to the book element in the active document and then sets the value of the attribute.

VBA Copy code Copy code
Sub AddIDAttribute()
 Dim objElement As XMLNode
 Dim objAttribute As XMLNode

 For Each objElement In ActiveDocument.XMLNodes
 If objElement.NodeType = wdXMLNodeElement Then
 If objElement.BaseName = "book" Then

 Set objAttribute = objElement.Attributes _
 .Add("author", objElement.NamespaceURI)

 objAttribute.NodeValue = "David Barber"

 Exit For
 End If
 End If
 Next
End Sub

See also

Concepts

XMLNode Object

Other resources

XMLNode Object Members


XMLNode.BaseName Property (Word)

 Copy code hover
[image]

XMLNode.BaseName Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a String that represents the name of the element without any prefix.

Syntax

expression .BaseName

expression Required. A variable that represents a XMLNode object.

Example

The following example adds the author attribute to the book element in the active document and then sets the value of the attribute.

VBA Copy code Copy code
Sub AddIDAttribute()
 Dim objElement As XMLNode
 Dim objAttribute As XMLNode

 For Each objElement In ActiveDocument.XMLNodes
 If objElement.NodeType = wdXMLNodeElement Then
 If objElement.BaseName = "book" Then

 Set objAttribute = objElement.Attributes _
 .Add("author", objElement.NamespaceURI)

 objAttribute.NodeValue = "David Barber"

 Exit For
 End If
 End If
 Next
End Sub

See also

Concepts

XMLNode Object

Other resources

XMLNode Object Members


XMLNode.ChildNodes Property (Word)

 Copy code hover
[image]

XMLNode.ChildNodes Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an XMLNodes collection that represents the child elements of a specified element.

Syntax

expression .ChildNodes

expression Required. A variable that represents a XMLNode object.

Example

The following example removes the first child element of the root element in the active document.

VBA Copy code Copy code
ActiveDocument.XMLNodes(1).RemoveChild _
 ActiveDocument.XMLNodes(1).ChildNodes(1)

See also

Concepts

XMLNode Object

Other resources

XMLNode Object Members


XMLNode.Creator Property (Word)

 Copy code hover
[image]

XMLNode.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a XMLNode object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

XMLNode Object

Other resources

XMLNode Object Members


XMLNode.FirstChild Property (Word)

 Copy code hover
[image]

XMLNode.FirstChild Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a DiagramNode object that represents the first child node of a parent node. Read-only.

Syntax

expression .FirstChild

expression Required. A variable that represents a XMLNode object.

Remarks

Use the LastChild property to access the last child node. Use the Root property to access the parent node in a diagram.

Example

This example adds an organization chart diagram to the current document, adds three nodes, and assigns the first and last child nodes to variables.

VBA Copy code Copy code
Sub FirstChild()
 Dim shpDiagram As Shape
 Dim dgnRoot As DiagramNode
 Dim dgnFirstChild As DiagramNode
 Dim dgnLastChild As DiagramNode
 Dim intCount As Integer

 'Add organizational chart diagram to the current document
 Set shpDiagram = ActiveDocument.Shapes.AddDiagram _
 (Type:=msoDiagramOrgChart, Left:=10, _
 Top:=15, Width:=400, Height:=475)

 'Add the first node to the diagram
 Set dgnRoot = shpDiagram.DiagramNode.Children.AddNode

 'Add three child nodes
 For intCount = 1 To 3
 dgnRoot.Children.AddNode
 Next intCount

 'Assign the first and last child nodes to variables
 Set dgnFirstChild = dgnRoot.Children.FirstChild
 Set dgnLastChild = dgnRoot.Children.LastChild
End Sub

See also

Concepts

XMLNode Object

Other resources

XMLNode Object Members


XMLNode.HasChildNodes Property (Word)

 Copy code hover
[image]

XMLNode.HasChildNodes Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Boolean that represents whether an XML node has child nodes. Read-only.

Syntax

expression .HasChildNodes

expression An expression that returns an XMLNode object.

See also

Concepts

XMLNode Object

Other resources

XMLNode Object Members


XMLNode.LastChild Property (Word)

 Copy code hover
[image]

XMLNode.LastChild Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an XMLNode object that represents the last child node of an XML element.

Syntax

expression .LastChild

expression An expression that returns an XMLNode object.

Example

The following example accesses the last child of the second element in the active document.

VBA Copy code Copy code
Dim objNode As XMLNode

Set objNode = ActiveDocument.XMLNodes(2).LastChild

See also

Concepts

XMLNode Object

Other resources

XMLNode Object Members


XMLNode.Level Property (Word)

 Copy code hover
[image]

XMLNode.Level Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a WdXMLNodeLevel constant that represents whether an XML element is part of a paragraph, is a paragraph, or is contained within a table cell or contains a table row. Read-only.

Syntax

expression .Level

expression An expression that returns an XMLNode object.

See also

Concepts

XMLNode Object

Other resources

XMLNode Object Members


XMLNode.NamespaceURI Property (Word)

 Copy code hover
[image]

XMLNode.NamespaceURI Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a String that represents the Uniform Resource Identifier (URI) of the schema namespace for the specified object. Read-only.

Syntax

expression .NamespaceURI

expression An expression that returns an XMLNode object.

Remarks

Note Note

If you are authoring XML schemas for use with Microsoft Word, it is highly recommended that you specify the targetNamespace setting in the schema.

See also

Concepts

XMLNode Object

Other resources

XMLNode Object Members


XMLNode.NextSibling Property (Word)

 Copy code hover
[image]

XMLNode.NextSibling Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an XMLNode object that represents the next element in the document that is at the same level as the specified element.

Syntax

expression .NextSibling

expression An expression that returns an XMLNode object.

Remarks

If the specified element is the last element in the XMLNodes collection, this property returns Nothing.

Example

The following example returns the next sibling element to the second element in the active document.

VBA Copy code Copy code
Dim objNode As XMLNode

Set objNode = ActiveDocument.XMLNodes(2).NextSibling

See also

Concepts

XMLNode Object

Other resources

XMLNode Object Members


XMLNode.NodeType Property (Word)

 Copy code hover
[image]

XMLNode.NodeType Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a WdXMLNodeType constant that represents the type of node.

Syntax

expression .NodeType

expression An expression that returns an XMLNode object.

Remarks

An XMLNode object can be either an XML element or an attribute of an element. Use the NodeType property to determine which type of node you are working with, so that you do not attempt to perform invalid operations on the node. For example, the Attributes property applies only to element nodes, although it appears in the list of available properties for the XMLNode object.

Example

The following example adds the author attribute to the book element in the active document and then sets the value of the attribute.

VBA Copy code Copy code
Sub AddIDAttribute()
 Dim objElement As XMLNode
 Dim objAttribute As XMLNode

 For Each objElement In ActiveDocument.XMLNodes
 If objElement.NodeType = wdXMLNodeElement Then
 If objElement.BaseName = "book" Then

 Set objAttribute = objElement.Attributes _
 .Add("author", objElement.NamespaceURI)

 objAttribute.NodeValue = "David Barber"

 Exit For
 End If
 End If
 Next
End Sub

See also

Concepts

XMLNode Object

Other resources

XMLNode Object Members


XMLNode.NodeValue Property (Word)

 Copy code hover
[image]

XMLNode.NodeValue Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a String that represents the value of an XML element. Read/write.

Syntax

expression .NodeValue

expression An expression that returns an XMLNode object.

See also

Concepts

XMLNode Object

Other resources

XMLNode Object Members


XMLNode.OwnerDocument Property (Word)

 Copy code hover
[image]

XMLNode.OwnerDocument Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Document object that represents the parent document of the specified XML element.

Syntax

expression .OwnerDocument

expression An expression that returns an XMLNode object.

Example

The following example accesses the parent document of the first XML element in the active selection.

VBA Copy code Copy code
Dim objDoc As Document

Set objDoc = Selection.XMLNodes(1).OwnerDocument

See also

Concepts

XMLNode Object

Other resources

XMLNode Object Members


XMLNode.Parent Property (Word)

 Copy code hover
[image]

XMLNode.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified XMLNode object.

Syntax

expression .Parent

expression Required. A variable that represents a XMLNode object.

See also

Concepts

XMLNode Object

Other resources

XMLNode Object Members


XMLNode.ParentNode Property (Word)

 Copy code hover
[image]

XMLNode.ParentNode Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an XMLNode object that represents the parent element of the specified element.

Syntax

expression .ParentNode

expression An expression that returns an XMLNode object.

Example

The following example accesses the parent XML node of the text selected in the active document.

VBA Copy code Copy code
Dim objNode As XMLNode

Set objNode = Selection.XMLParentNode.ParentNode

See also

Concepts

XMLNode Object

Other resources

XMLNode Object Members


XMLNode.PlaceholderText Property (Word)

 Copy code hover
[image]

XMLNode.PlaceholderText Property (Word)
See also Send feedback

Published: July 16, 2012

Sets or returns a String that represents the text displayed for an element that contains no text.

Syntax

expression .PlaceholderText

expression An expression that returns an XMLNode object.

Remarks

Placeholder text is displayed in Microsoft Word only when the Show XML tags in the document check box in the XML Structure task pane is cleared. The Show XML tags in the document check box corresponds to the ShowXMLMarkup property.

Example

The following example inserts a new element into the active document at the insertion point and sets what text to display when tags are not displayed in the document.

VBA Copy code Copy code
Dim objNode As XMLNode

Set objNode = Selection.XMLNodes.Add("catalog", "book")

objNode.PlaceholderText = "Enter Book Information Here"

See also

Concepts

XMLNode Object

Other resources

XMLNode Object Members


XMLNode.PreviousSibling Property (Word)

 Copy code hover
[image]

XMLNode.PreviousSibling Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an XMLNode object that represents the previous element in the document that is at the same level as the specified element.

Syntax

expression .PreviousSibling

expression An expression that returns an XMLNode object.

Remarks

If the specified element is the first element in the XMLNodes collection, this property returns Nothing.

Example

The following example returns the previous sibling element to the third element in the active document.

VBA Copy code Copy code
Dim objNode As XMLNode

Set objNode = ActiveDocument.XMLNodes(3).PreviousSibling

See also

Concepts

XMLNode Object

Other resources

XMLNode Object Members


XMLNode.Range Property (Word)

 Copy code hover
[image]

XMLNode.Range Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Range object that represents the portion of a document that is contained in the specified object. Read-only.

Syntax

expression .Range

expression An expression that returns an XMLNode object.

See also

Concepts

XMLNode Object

Other resources

XMLNode Object Members


XMLNode.Text Property (Word)

 Copy code hover
[image]

XMLNode.Text Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the text contained within the XML element. Read/write String.

Syntax

expression .Text

expression A variable that represents a XMLNode object.

Remarks

The Text property returns the plain, unformatted text that is contained within the XML element. Setting this property, replaces the existing text.

See also

Concepts

XMLNode Object

Other resources

XMLNode Object Members


XMLNode.ValidationErrorText Property (Word)

 Copy code hover
[image]

XMLNode.ValidationErrorText Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a String that represents the description for a validation error on an XMLNode object.

Syntax

expression .ValidationErrorText(Advanced)

expression A variable that represents a XMLNode object.

Parameters

Name | Required/Optional | Data Type | Description
Advanced | Optional | Boolean | Indicates that the error text displayed is the advanced version of the validation error description, which comes from the MSXML 5.0 component included with Microsoft Word.

Example

The following example checks each element in the active document and displays a message containing the elements and attributes that do not validate according to the schema and a description of why.

VBA Copy code Copy code
Dim objNode As XMLNode
Dim strValid As String

For Each objNode In ActiveDocument.XMLNodes
 objNode.Validate
 If objNode.ValidationStatus <> wdXMLValidationStatusOK Then
 strValid = strValid & objNode.BaseName & vbTab & _
 objNode.ValidationErrorText & vbCrLf
 End If
Next

MsgBox "The following elements do not validate against " & _
 "the schema." & vbCrLf & vbCrLf & strValid & vbCrLf & _
 "You should fix these elements before continuing."

See also

Concepts

XMLNode Object

Other resources

XMLNode Object Members


XMLNode.ValidationStatus Property (Word)

 Copy code hover
[image]

XMLNode.ValidationStatus Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a WdXMLValidationStatus constant that represents whether an element or attribute is valid according to the attached schema.

Syntax

expression .ValidationStatus

expression Required. A variable that represents a XMLNode object.

Remarks

This property can return either of the two following WdXMLValidationStatus constants.

wdXMLValidationStatusCustom | Indicates that the SetValidationError method was used to set ValidationErrorText property to a custom text string.
wdXMLValidationStatusOK | Indicates an XML element or attribute is valid according to the attached schema.

While these are the only two named constants the ValidationStatus property allows, there are many more unnamed values that come from the MSXML 5.0 component included with Microsoft Word. For a more complete list of possible values and their corresponding meaning, refer to the Microsoft Word XML schema reference on the Microsoft Developer Network (MSDN) Web site.

Example

The following example checks each element in the active document and displays a message containing the elements that do not validate according to the schema and a description of why.

VBA Copy code Copy code
Dim objNode As XMLNode
Dim strValid As String

For Each objNode In ActiveDocument.XMLNodes
 objNode.Validate
 If objNode.ValidationStatus <> wdXMLValidationStatusOK Then
 strValid = strValid & objNode.BaseName & vbTab & _
 objNode.ValidationErrorText & vbCrLf
 End If
Next

MsgBox "The following elements do not validate against " & _
 "the schema." & vbCrLf & vbCrLf & strValid & vbCrLf & _
 "You should fix these elements before continuing."

See also

Concepts

XMLNode Object

Other resources

XMLNode Object Members


XMLNode.WordOpenXML Property (Word)

 Copy code hover
[image]

XMLNode.WordOpenXML Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a String that represents the XML for the node in the Microsoft Word Open XML format. Read-only.

Syntax

expression .WordOpenXML

expression An expression that returns an XMLNode object.

Remarks

This property returns only the XML in the document that is needed to represent the specified XML node.

See also

Concepts

XMLNode Object

Other resources

XMLNode Object Members


XMLNode.XML Property (Word)

 Copy code hover
[image]

XMLNode.XML Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a String that represents the text, with or without XML markup, that is contained within an XML node. Read-only.

Syntax

expression .XML(DataOnly)

expression An expression that returns an XMLNode object.

Parameters

Name | Required/Optional | Data Type | Description
DataOnly | Optional | Boolean | Specifies whether to return the XML with or without markup. True returns the text contained within the XML node without XML markup. False returns the text with XML markup.

See also

Concepts

XMLNode Object

Other resources

XMLNode Object Members


XMLNode Methods (Word)

 Copy code hover
[image]

XMLNode Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Copy | Copies the specified XML element, excluding XML markup, to the Clipboard.
Cut | Removes the specified XML element from the document and places it on the Clipboard.
Delete | Deletes the specified XML element from an XML document.
RemoveChild | Removes a child element from the specified element.
SelectNodes | Returns an XMLNodes collection that represents all the child elements that match the XPath parameter, in the order in which they appear within the specified XML element.
SelectSingleNode | Returns an XMLNode object that represents the first child element that matches the XPath parameter within the specified XML element. .
SetValidationError | Changes the validation error text displayed to a user for a specified node and forces Word to report a node as invalid.
Validate | Validates an individual XML element against the XML schemas that are attached to a document.


XMLNode.Copy Method (Word)

 Copy code hover
[image]

XMLNode.Copy Method (Word)
See also Send feedback

Published: July 16, 2012

Copies the specified XML element, excluding XML markup, to the Clipboard.

Syntax

expression .Copy

expression An expression that returns an XMLNode object.

Return Value

Nothing

See also

Concepts

XMLNode Object

Other resources

XMLNode Object Members


XMLNode.Cut Method (Word)

 Copy code hover
[image]

XMLNode.Cut Method (Word)
See also Send feedback

Published: July 16, 2012

Removes the specified XML element from the document and places it on the Clipboard.

Syntax

expression .Cut

expression Required. A variable that represents a XMLNode object.

See also

Concepts

XMLNode Object

Other resources

XMLNode Object Members


XMLNode.Delete Method (Word)

 Copy code hover
[image]

XMLNode.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the specified XML element from an XML document.

Syntax

expression .Delete

expression Required. A variable that represents a XMLNode object.

See also

Concepts

XMLNode Object

Other resources

XMLNode Object Members


XMLNode.RemoveChild Method (Word)

 Copy code hover
[image]

XMLNode.RemoveChild Method (Word)
See also Send feedback

Published: July 16, 2012

Removes a child element from the specified element.

Syntax

expression .RemoveChild(ChildElement)

expression An expression that returns an XMLNode object.

Parameters

Name | Required/Optional | Data Type | Description
ChildElement | Required | XMLNode | The child element to be removed.

Return Value

Nothing

Example

The following example removes the first child from the first element in the active document.

VBA Copy code Copy code
ActiveDocument.XMLNodes(1).RemoveChild _
 ActiveDocument.XMLNodes(1).ChildNodes(1)

See also

Concepts

XMLNode Object

Other resources

XMLNode Object Members


XMLNode.SelectNodes Method (Word)

 Copy code hover
[image]

XMLNode.SelectNodes Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an XMLNodes collection that represents all the child elements that match the XPath parameter, in the order in which they appear within the specified XML element.

Syntax

expression .SelectNodes(XPath, PrefixMapping, FastSearchSkippingTextNodes)

expression An expression that returns an XMLNode object.

Parameters

Name | Required/Optional | Data Type | Description
XPath | Required | String | Specifies a valid XPath string. For more information on XPath, see the XPath reference documentation on the Microsoft Developer Network (MSDN) Web site.
PrefixMapping | Optional | String | Provides the prefix in the schema against which to perform the search. Use the PrefixMapping parameter if your XPath parameter uses names to search for elements.
FastSearchSkippingTextNodes | Optional | Boolean | True skips all text nodes while searching for the specified node. False includes text nodes in the search. Default value is False.

Return Value

XMLNodes

See also

Concepts

XMLNode Object

Other resources

XMLNode Object Members


XMLNode.SelectSingleNode Method (Word)

 Copy code hover
[image]

XMLNode.SelectSingleNode Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an XMLNode object that represents the first child element that matches the XPath parameter within the specified XML element. .

Syntax

expression .SelectSingleNode(XPath, PrefixMapping, FastSearchSkippingTextNodes)

expression An expression that returns an XMLNode object.

Parameters

Name | Required/Optional | Data Type | Description
XPath | Required | String | Specifies a valid XPath string. For more information on XPath, see the XPath reference documentation on the Microsoft Developer Network (MSDN) Web site.
PrefixMapping | Optional | String | Provides the prefix in the schema against which to perform the search. Use the PrefixMapping parameter if your XPath parameter uses names to search for elements.
FastSearchSkippingTextNodes | Optional | Boolean | True skips all text nodes while searching for the specified node. False includes text nodes in the search. Default value is False.

Return Value

XMLNode

See also

Concepts

XMLNode Object

Other resources

XMLNode Object Members


XMLNode.SetValidationError Method (Word)

 Copy code hover
[image]

XMLNode.SetValidationError Method (Word)
See also Send feedback

Published: July 16, 2012

Changes the validation error text displayed to a user for a specified node and forces Word to report a node as invalid.

Syntax

expression .SetValidationError(Status, ErrorText, ClearedAutomatically)

expression Required. A variable that represents a XMLNode object.

Parameters

Name | Required/Optional | Data Type | Description
Status | Required | WdXMLValidationStatus | Specifies whether to set the validation status error text (wdXMLValidationStatusCustom) or to clear the validation status error text (wdXMLValidationStatusOK).
ErrorText | Optional | Variant | The text displayed to the user. Leave blank when the Status parameter is set to wdXMLValidationStatusOK.
ClearedAutomatically | Optional | Boolean | True automatically clears the error message as soon as the next validation event occurs on the specified node. False requires running the SetValidationError method with a Status parameter of wdXMLValidationStatusOK to clear the custom error text.

Remarks

To set custom error text, use the wdXMLValidationStatusCustom constant.

Example

The following example specifies custom validation error text.

VBA Copy code Copy code
Dim objNode As XMLNode

Set objNode = ActiveDocument.XMLNodes(1)
objNode.SetValidationError wdXMLValidationStatusCustom, _
 "Error Text", True

See also

Concepts

XMLNode Object

Other resources

XMLNode Object Members


XMLNode.Validate Method (Word)

 Copy code hover
[image]

XMLNode.Validate Method (Word)
See also Send feedback

Published: July 16, 2012

Validates an individual XML element against the XML schemas that are attached to a document.

Syntax

expression .Validate

expression An expression that returns an XMLNode object.

Return Value

Nothing

Remarks

Use the Validate method with the ValidationStatus and ValidationErrorText properties to determine if an XML element is valid against the applied schema and what error text to display to the user. Use the SetValidationError method to override the schema violations with custom validation errors.

When you run the Validate method, Microsoft Word populates the XMLSchemaViolations property of the Document object with a collection of the XML nodes that have validation errors.

Example

The following example checks each element and attribute in the active document and displays a message containing the elements and attributes that do not pass validation, according to the schema, and a description of why.

VBA Copy code Copy code
Dim objNode As XMLNode
Dim strValid As String

For Each objNode In ActiveDocument.XMLNodes
 objNode.Validate
 If objNode.ValidationStatus <> wdXMLValidationStatusOK Then
 strValid = strValid & objNode.BaseName & vbTab & _
 objNode.ValidationErrorText & vbCrLf
 End If
Next

MsgBox "The following elements do not validate against " & _
 "the schema." & vbCrLf & vbCrLf & strValid & vbCrLf & _
 "You should fix these elements before continuing."

See also

Concepts

XMLNode Object

Other resources

XMLNode Object Members


XMLNodes Object (Word)

 Copy code hover
[image]

XMLNodes Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of XMLNode objects that represents the nodes in the tree view of the XML Structure task pane, which indicates the elements that a user has applied to a document. Each node in the tree view is an instance of an XMLNode object. The hierarchy in the tree view indicates whether a node contains child nodes.Y

Remarks

ou can return an XMLNodes collection for a selection, a range, or the entire document. The order in which the XMLNode objects appear in the XMLNodes collection is the same order in which their start or end tags appear within the specified selection, range, or document.

Use the Item method of the XMLNodes collection to return an individual XMLNode object. Use the Validate method to verify that an XML element is valid according to the applied schemas and that any required child elements exist and are in the required order. Once you run the Validate method, use the ValidationStatus property to verify whether an element is valid and the ValidationErrorText property to display a message to the user as to what the user needs to fix to make the XML in the document conform to the XML schema rules.

The following example validates each of the XML elements in the active document and, if the element or attribute is found to be invalid against the schema, returns a message to the user explaining why the element is invalid.

VBA Copy code Copy code
Dim objNode As XMLNode

For Each objNode In ActiveDocument.XMLNodes
 objNode.Validate
 If objNode.ValidationStatus <> wdXMLValidationStatusOK Then
 MsgBox objNode.ValidationErrorText(True)
 End If
Next

Use the Add method to add an XML element to a selection, a range, or the document. The following example inserts the example element from the SimpleSample schema into the active document at the insertion point or surrounding the active selection.

Note Note

Because XML is case sensitive, the XML element as typed in the Name parameter of the Add method must be typed exactly as it appears in the schema referenced in the Namespace parameter.

VBA Copy code Copy code
Dim objNode As XMLNode
Dim intResponse As Integer

Set objNode = Selection.XMLNodes.Add("example", "SimpleSample")

objNode.Validate

If objNode.ValidationStatus < 0 Then
 intResponse = MsgBox("This element is invalid. " & _
 "Are you sure you want to add it?", vbYesNo)
 If intResponse = vbNo Then objNode.Delete
End If

See also

Concepts

Word Object Model Reference

Other resources

XMLNodes Object Members


XMLNodes Members (Word)

 Copy code hover
[image]

XMLNodes Members (Word)
Send feedback

Published: July 16, 2012

A collection of XMLNode objects that represents the nodes in the tree view of the XML Structure task pane, which indicates the elements that a user has applied to a document. Each node in the tree view is an instance of an XMLNode object. The hierarchy in the tree view indicates whether a node contains child nodes.Y

Methods

Name | Description
Item | Returns an individual XMLNode object in a collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of XML elements in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified XMLNodes object.


XMLNodes Properties (Word)

 Copy code hover
[image]

XMLNodes Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of XML elements in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified XMLNodes object.


XMLNodes.Application Property (Word)

 Copy code hover
[image]

XMLNodes.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a XMLNodes collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

XMLNodes Collection

Other resources

XMLNodes Object Members


XMLNodes.Count Property (Word)

 Copy code hover
[image]

XMLNodes.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of XML elements in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents a XMLNodes collection.

See also

Concepts

XMLNodes Collection

Other resources

XMLNodes Object Members


XMLNodes.Creator Property (Word)

 Copy code hover
[image]

XMLNodes.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a XMLNodes collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

XMLNodes Collection

Other resources

XMLNodes Object Members


XMLNodes.Parent Property (Word)

 Copy code hover
[image]

XMLNodes.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified XMLNodes object.

Syntax

expression .Parent

expression Required. A variable that represents a XMLNodes collection.

See also

Concepts

XMLNodes Collection

Other resources

XMLNodes Object Members


XMLNodes Methods (Word)

 Copy code hover
[image]

XMLNodes Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Item | Returns an individual XMLNode object in a collection.


XMLNodes.Item Method (Word)

 Copy code hover
[image]

XMLNodes.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual XMLNode object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents a XMLNodes collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Long | The individual object to be returned. Can be a Long indicating the ordinal position of the individual object.

Return Value

XMLNode

See also

Concepts

XMLNodes Collection

Other resources

XMLNodes Object Members


XMLSchemaReference Object (Word)

 Copy code hover
[image]

XMLSchemaReference Object (Word)
See also Send feedback

Published: July 16, 2012

Represents an individual schema that is attached to a document.

Remarks

Use the XMLSchemaReference property to return an XMLSchemaReference object for a ChildNodeSuggestion object. The following example inserts the suggested XML child element if the XML schema referenced is the SimpleSample schema.

VBA Copy code Copy code
Dim objSuggestion As XMLChildNodeSuggestion

For Each objSuggestion In ActiveDocument _
 .ChildNodeSuggestions

 If objSuggestion.XMLSchemaReference = "SimpleSample" Then
 objSuggestion.Insert
 End If

Next
Note Note

The SimpleSample schema is included in the Smart Document Software Development Kit (SDK). For more information, refer to the Smart Document SDK on the Microsoft Developer Network (MSDN) Web site.

See also

Concepts

Word Object Model Reference

Other resources

XMLSchemaReference Object Members


XMLSchemaReference Members (Word)

 Copy code hover
[image]

XMLSchemaReference Members (Word)
Send feedback

Published: July 16, 2012

Represents an individual schema that is attached to a document.

Methods

Name | Description
Delete | Deletes the specified XML Schema Reference.
Reload | Reloads the XML schemas that are referenced in a document.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Location | Returns a String that represents the physical location of an XML schema. Read-only.
NamespaceURI | Returns a String that represents the Uniform Resource Identifier (URI) of the schema namespace for the specified object. Read-only.
Parent | Returns an Object that represents the parent object of the specified XMLSchemaReference object.


XMLSchemaReference Properties (Word)

 Copy code hover
[image]

XMLSchemaReference Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Location | Returns a String that represents the physical location of an XML schema. Read-only.
NamespaceURI | Returns a String that represents the Uniform Resource Identifier (URI) of the schema namespace for the specified object. Read-only.
Parent | Returns an Object that represents the parent object of the specified XMLSchemaReference object.


XMLSchemaReference.Application Property (Word)

 Copy code hover
[image]

XMLSchemaReference.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a XMLSchemaReference object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

XMLSchemaReference Object

Other resources

XMLSchemaReference Object Members


XMLSchemaReference.Creator Property (Word)

 Copy code hover
[image]

XMLSchemaReference.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a XMLSchemaReference object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

XMLSchemaReference Object

Other resources

XMLSchemaReference Object Members


XMLSchemaReference.Location Property (Word)

 Copy code hover
[image]

XMLSchemaReference.Location Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a String that represents the physical location of an XML schema. Read-only.

Syntax

expression .Location

expression An expression that returns an XMLSchemaReference object.

See also

Concepts

XMLSchemaReference Object

Other resources

XMLSchemaReference Object Members


XMLSchemaReference.NamespaceURI Property (Word)

 Copy code hover
[image]

XMLSchemaReference.NamespaceURI Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a String that represents the Uniform Resource Identifier (URI) of the schema namespace for the specified object. Read-only.

Syntax

expression .NamespaceURI

expression An expression that returns a XMLSchemaReference object.

Remarks

If you are authoring XML schemas for use with Microsoft Word, it is highly recommended that you specify the targetNamespace setting in the schema.

Example

The following example reloads the SimpleSample schema or, if the schema is not attached to the active document, attaches it.

Note Note

The SimpleSample schema is included in the Smart Document Software Development Kit (SDK). For more information, refer to the Smart Document SDK on the Microsoft Developer Network (MSDN) Web site.

VBA Copy code Copy code
If ActiveDocument.XMLSchemaReferences.Item(1) _
 .NamespaceURI <> "SimpleSample" Then

 Application.XMLNamespaces.Item("SimpleSample") _
 .AttachToDocument (ActiveDocument)

End If

See also

Concepts

XMLSchemaReference Object

Other resources

XMLSchemaReference Object Members


XMLSchemaReference.Parent Property (Word)

 Copy code hover
[image]

XMLSchemaReference.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified XMLSchemaReference object.

Syntax

expression .Parent

expression Required. A variable that represents a XMLSchemaReference object.

See also

Concepts

XMLSchemaReference Object

Other resources

XMLSchemaReference Object Members


XMLSchemaReference Methods (Word)

 Copy code hover
[image]

XMLSchemaReference Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the specified XML Schema Reference.
Reload | Reloads the XML schemas that are referenced in a document.


XMLSchemaReference.Delete Method (Word)

 Copy code hover
[image]

XMLSchemaReference.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the specified XML Schema Reference.

Syntax

expression .Delete

expression Required. A variable that represents a XMLSchemaReference object.

See also

Concepts

XMLSchemaReference Object

Other resources

XMLSchemaReference Object Members


XMLSchemaReference.Reload Method (Word)

 Copy code hover
[image]

XMLSchemaReference.Reload Method (Word)
See also Send feedback

Published: July 16, 2012

Reloads the XML schemas that are referenced in a document.

Syntax

expression .Reload

expression An expression that returns an XMLSchemaReference object.

Return Value

Nothing

See also

Concepts

XMLSchemaReference Object

Other resources

XMLSchemaReference Object Members


XMLSchemaReferences Object (Word)

 Copy code hover
[image]

XMLSchemaReferences Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of XMLSchemaReference objects that represent the unique namespaces that are attached to a document.

Remarks

Use the XMLSchemaReferences property to return a collection of schemas attached to a document. The following example loops through the schemas attached to a document. If it finds the specified schema, it reloads it; if it doesn't find the specified schema, it attaches the schema to the document.

VBA Copy code Copy code
Sub VerifySampleSchema()
 Dim objNS As XMLNamespace
 Dim objSchema As XMLSchemaReference
 Dim blnSchemaAttached As Boolean

 For Each objSchema In ActiveDocument.XMLSchemaReferences
 If objSchema.NamespaceURI <> "SimpleSample" Then
 blnSchemaAttached = False
 Else
 objSchema.Reload
 blnSchemaAttached = True
 Exit For
 End If
 Next

 If blnSchemaAttached = False Then
 Set objNS = Application.XMLNamespaces.Item("SimpleSample")
 objNS.AttachToDocument (ActiveDocument)
 End If
End Sub
Note Note

The SimpleSample schema is included in the Smart Document Software Development Kit (SDK). For more information, refer to the Smart Document SDK on the Microsoft Developer Network (MSDN) Web site.

See also

Concepts

Word Object Model Reference

Other resources

XMLSchemaReferences Object Members


XMLSchemaReferences Members (Word)

 Copy code hover
[image]

XMLSchemaReferences Members (Word)
Send feedback

Published: July 16, 2012

A collection of XMLSchemaReference objects that represent the unique namespaces that are attached to a document.

Methods

Name | Description
Add | Returns an XMLSchemaReference that represents a schema applied to a document.
Item | Returns an individual XMLSchemaReference object in a collection.
Validate | Validates all the XML schemas that are attached to a document.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of XML schemas in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
HideValidationErrors | Returns a Boolean indicating whether Word displays schema validation errors for the current XML document. Read/write.
IgnoreMixedContent | Returns a Boolean that represents whether Microsoft Word preforms validation on text nodes that have element siblings and specifies whether these text nodes are saved in XML when the XMLSaveDataOnly property is True. Read/write.
Parent | Returns an Object that represents the parent object of the specified XMLSchemaReferences object.
ShowPlaceholderText | Returns or sets a Boolean that represents whether automatic placeholder text is displayed for XML elements in a document. Read/write.


XMLSchemaReferences Properties (Word)

 Copy code hover
[image]

XMLSchemaReferences Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of XML schemas in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
HideValidationErrors | Returns a Boolean indicating whether Word displays schema validation errors for the current XML document. Read/write.
IgnoreMixedContent | Returns a Boolean that represents whether Microsoft Word preforms validation on text nodes that have element siblings and specifies whether these text nodes are saved in XML when the XMLSaveDataOnly property is True. Read/write.
Parent | Returns an Object that represents the parent object of the specified XMLSchemaReferences object.
ShowPlaceholderText | Returns or sets a Boolean that represents whether automatic placeholder text is displayed for XML elements in a document. Read/write.


XMLSchemaReferences.Application Property (Word)

 Copy code hover
[image]

XMLSchemaReferences.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a XMLSchemaReferences collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

XMLSchemaReferences Collection

Other resources

XMLSchemaReferences Object Members


XMLSchemaReferences.Count Property (Word)

 Copy code hover
[image]

XMLSchemaReferences.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of XML schemas in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents a XMLSchemaReferences collection.

See also

Concepts

XMLSchemaReferences Collection

Other resources

XMLSchemaReferences Object Members


XMLSchemaReferences.Creator Property (Word)

 Copy code hover
[image]

XMLSchemaReferences.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a XMLSchemaReferences collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

XMLSchemaReferences Collection

Other resources

XMLSchemaReferences Object Members


XMLSchemaReferences.HideValidationErrors Property (Word)

 Copy code hover
[image]

XMLSchemaReferences.HideValidationErrors Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Boolean indicating whether Word displays schema validation errors for the current XML document. Read/write.

Syntax

expression .HideValidationErrors

expression An expression that returns an XMLSchemaReferences collection.

Remarks

True causes Word to hide schema validation errors for the current XML document. False causes schema validation errors to be displayed in the XML Structure task pane.

Example

The following example disables the display of schema validation errors in the current XML document.

VBA Copy code Copy code
ActiveDocument.XMLSchemaReferences _
 .HideValidationErrors = True

See also

Concepts

XMLSchemaReferences Collection

Other resources

XMLSchemaReferences Object Members


XMLSchemaReferences.IgnoreMixedContent Property (Word)

 Copy code hover
[image]

XMLSchemaReferences.IgnoreMixedContent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Boolean that represents whether Microsoft Word preforms validation on text nodes that have element siblings and specifies whether these text nodes are saved in XML when the XMLSaveDataOnly property is True. Read/write.

Syntax

expression .IgnoreMixedContent

expression An expression that returns an XMLSchemaReferences collection.

Remarks

True causes Word to ignore schema violations caused by text nodes that have element siblings; it also prevents these text nodes from being saved in XML when the XMLSaveDataOnly property is True, which helps to prevent text that was inserted by an Extensible Stylesheet Language Transformation (XLST) from being saved as part of the data. False raises validation errors on text nodes with element siblings.

Example

The following example disables validation of XML and prevents text nodes that have elements as siblings from being saved as XML for the active document.

VBA Copy code Copy code
ActiveDocument.XMLSchemaReferences _
 .IgnoreMixedContent = True

See also

Concepts

XMLSchemaReferences Collection

Other resources

XMLSchemaReferences Object Members


XMLSchemaReferences.Parent Property (Word)

 Copy code hover
[image]

XMLSchemaReferences.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified XMLSchemaReferences object.

Syntax

expression .Parent

expression Required. A variable that represents a XMLSchemaReferences collection.

See also

Concepts

XMLSchemaReferences Collection

Other resources

XMLSchemaReferences Object Members


XMLSchemaReferences.ShowPlaceholderText Property (Word)

 Copy code hover
[image]

XMLSchemaReferences.ShowPlaceholderText Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a Boolean that represents whether automatic placeholder text is displayed for XML elements in a document. Read/write.

Syntax

expression .ShowPlaceholderText

expression An expression that returns an XMLSchemaReferences collection.

Remarks

True displays placeholder text. False hides placeholder text.

Example

The following toggles the display of placeholder text in the active document.

VBA Copy code Copy code
ActiveDocument.XMLSchemaReferences.ShowPlaceholderText = _
 Not ActiveDocument.XMLSchemaReferences.ShowPlaceholderText

See also

Concepts

XMLSchemaReferences Collection

Other resources

XMLSchemaReferences Object Members


XMLSchemaReferences Methods (Word)

 Copy code hover
[image]

XMLSchemaReferences Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Returns an XMLSchemaReference that represents a schema applied to a document.
Item | Returns an individual XMLSchemaReference object in a collection.
Validate | Validates all the XML schemas that are attached to a document.


XMLSchemaReferences.Add Method (Word)

 Copy code hover
[image]

XMLSchemaReferences.Add Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an XMLSchemaReference that represents a schema applied to a document.

Syntax

expression .Add(NamespaceURI, Alias, FileName, InstallForAllUsers)

expression Required. A variable that represents a XMLSchemaReferences collection.

Parameters

Name | Required/Optional | Data Type | Description
NamespaceURI | Optional | String | The name of the schema as defined in the schema. The Namespace parameter is case-sensitive and must be spelled exactly as it appears in the schema. If the specified namespace cannot be found in any of the schemas attached to the document, an error is displayed.
Alias | Optional | String | The name of the schema as it appears on the Schemas tab in the Templates and Add-ins dialog box.
FileName | Optional | String | The path and file name of the schema. This may be a local file path, a network path, or an Internet address.
InstallForAllUsers | Optional | Boolean | True if all users that log on to a computer can access and use the new schema. The default is False.

Return Value

XMLSchemaReference

Example

The following example attaches the specified schema to the active document. This example assumes that you have an xsd file located at the path specified in the FileName parameter.

VBA Copy code Copy code
Sub AddSchema()
 Dim objSchema As XMLSchemaReference

 Set objSchema = ActiveDocument.XMLSchemaReferences _
 .Add(, , "c:\schemas\simplesample.xsd", True)
End Sub

See also

Concepts

XMLSchemaReferences Collection

Other resources

XMLSchemaReferences Object Members


XMLSchemaReferences.Item Method (Word)

 Copy code hover
[image]

XMLSchemaReferences.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an individual XMLSchemaReference object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents a XMLSchemaReferences collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The individual object to be returned. Can be a Long indicating the ordinal position or a String representing the name of the individual object.

Return Value

XMLSchemaReference

See also

Concepts

XMLSchemaReferences Collection

Other resources

XMLSchemaReferences Object Members


XMLSchemaReferences.Validate Method (Word)

 Copy code hover
[image]

XMLSchemaReferences.Validate Method (Word)
See also Send feedback

Published: July 16, 2012

Validates all the XML schemas that are attached to a document.

Syntax

expression .Validate

expression An expression that returns an XMLSchemaReferences object.

Return Value

Nothing

Remarks

When you run the Validate method, Microsoft Word populates the XMLSchemaViolations property of the Document object with a collection of the XML nodes that have validation errors.

See also

Concepts

XMLSchemaReferences Collection

Other resources

XMLSchemaReferences Object Members


XSLTransform Object (Word)

 Copy code hover
[image]

XSLTransform Object (Word)
See also Send feedback

Published: July 16, 2012

Represents a single registered Extensible Stylesheet Language Transformation (XSLT).

Remarks

Use the Add method of the XSLTransforms collection to add an individual XSLT to the list of XSLTs available for a schema. The following example adds the simplesample.xslt transformation to the XSLTs for the SimpleSample schema.

Copy code Copy code
Sub AddXSLT()
 Dim objSchema As XMLNamespace
 Dim objTransform As XSLTransform

 Set objSchema = Application.XMLNamespaces("SimpleSample")
 Set objTransform = objSchema.XSLTransforms _
 .Add("c:\schemas\simplesample.xslt")

End Sub

Use the Item method of the XSLTransforms collection to return a single XSLTransform object. The following example deletes the first XSLT in the collection of XSLTs for the SimpleSample schema.

VBA Copy code Copy code
Sub DeleteTransform()
 Dim objXSLT As XSLTransform
 Dim intResponse As Integer

 Set objXSLT = Application.XMLNamespaces("SimpleSample") _
 .XSLTransforms.Item(1)

 intResponse = MsgBox("Are you sure you want to delete the " _
 & objXSLT.Alias & " XSLT?", vbYesNo)

 If intResponse = vbYes Then objXSLT.Delete

End Sub
Note Note

The SimpleSample schema is included in the Smart Document Software Development Kit (SDK). For more information, refer to the Smart Document SDK on the Microsoft Developer Network (MSDN) Web site.

See also

Concepts

Word Object Model Reference

Other resources

XSLTransform Object Members


XSLTransform Members (Word)

 Copy code hover
[image]

XSLTransform Members (Word)
Send feedback

Published: July 16, 2012

Represents a single registered Extensible Stylesheet Language Transformation (XSLT).

Methods

Name | Description
Delete | Deletes the specified Extensible Stylesheet Language Transformation (XSLT) from the list of avaliable XSLTs.

Properties

Name | Description
Alias | Returns a String that represents the display name for the specified object.
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
ID | Returns a String containing the GUID assigned to the current XSLTransform object. Read-only.
Location | Returns or sets a String that represents the physical location of the XSL transform for the namespace of an XML schema in the Schema Library. Read/write.
Parent | Returns an Object that represents the parent object of the specified XSLTransform object.


XSLTransform Properties (Word)

 Copy code hover
[image]

XSLTransform Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Alias | Returns a String that represents the display name for the specified object.
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
ID | Returns a String containing the GUID assigned to the current XSLTransform object. Read-only.
Location | Returns or sets a String that represents the physical location of the XSL transform for the namespace of an XML schema in the Schema Library. Read/write.
Parent | Returns an Object that represents the parent object of the specified XSLTransform object.


XSLTransform.Alias Property (Word)

 Copy code hover
[image]

XSLTransform.Alias Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a String that represents the display name for the specified object.

Syntax

expression .Alias

expression Required. A variable that represents a XSLTransform object.

Example

The following example shows the display name for the first schema attached to the active document.

VBA Copy code Copy code
MsgBox Application.XMLNamespaces(1).Alias

See also

Concepts

XSLTransform Object

Other resources

XSLTransform Object Members


XSLTransform.Application Property (Word)

 Copy code hover
[image]

XSLTransform.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a XSLTransform object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

XSLTransform Object

Other resources

XSLTransform Object Members


XSLTransform.Creator Property (Word)

 Copy code hover
[image]

XSLTransform.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a XSLTransform object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

XSLTransform Object

Other resources

XSLTransform Object Members


XSLTransform.ID Property (Word)

 Copy code hover
[image]

XSLTransform.ID Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a String containing the GUID assigned to the current XSLTransform object. Read-only.

Version Information

Version Added: Word 2010

Syntax

expression .ID

expression An expression that returns a XSLTransform object.

See also

Concepts

XSLTransform Object

Other resources

XSLTransform Object Members


XSLTransform.Location Property (Word)

 Copy code hover
[image]

XSLTransform.Location Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets a String that represents the physical location of the XSL transform for the namespace of an XML schema in the Schema Library. Read/write.

Syntax

expression .Location(AllUsers)

expression An expression that returns an XSLTransform object.

Parameters

Name | Required/Optional | Data Type | Description
AllUsers | Optional | Boolean | Specifies whether to return the location for all users. False returns the location for only the current user, which may be different than the location for all users.

See also

Concepts

XSLTransform Object

Other resources

XSLTransform Object Members


XSLTransform.Parent Property (Word)

 Copy code hover
[image]

XSLTransform.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified XSLTransform object.

Syntax

expression .Parent

expression Required. A variable that represents a XSLTransform object.

See also

Concepts

XSLTransform Object

Other resources

XSLTransform Object Members


XSLTransform Methods (Word)

 Copy code hover
[image]

XSLTransform Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Delete | Deletes the specified Extensible Stylesheet Language Transformation (XSLT) from the list of avaliable XSLTs.


XSLTransform.Delete Method (Word)

 Copy code hover
[image]

XSLTransform.Delete Method (Word)
See also Send feedback

Published: July 16, 2012

Deletes the specified Extensible Stylesheet Language Transformation (XSLT) from the list of avaliable XSLTs.

Syntax

expression .Delete

expression Required. A variable that represents a XSLTransform object.

See also

Concepts

XSLTransform Object

Other resources

XSLTransform Object Members


XSLTransforms Object (Word)

 Copy code hover
[image]

XSLTransforms Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of XSLTransform objects that represent all of the Extensible Stylesheet Language Transformations (XSLTs) for a specific XML namespace.

Remarks

Use the Add method to add an individual XSLTransform object to the collection of XSLTs for a schema. The following example adds simplesample.xslt to the XSLTs for the SimpleSample schema.

Copy code Copy code
Sub AddXSLT()
 Dim objSchema As XMLNamespace
 Dim objTransform As XSLTransform

 Set objSchema = Application.XMLNamespaces("SimpleSample")
 Set objTransform = objSchema.XSLTransforms _
 .Add("c:\schemas\simplesample.xslt")

End Sub

Use the Item method to return a single XSLTransform object. The following example deletes the first XSLT in the collection of XSLTs for the SimpleSample schema.

VBA Copy code Copy code
Sub DeleteTransform()
 Dim objXSLT As XSLTransform
 Dim intResponse As Integer

 Set objXSLT = Application.XMLNamespaces("SimpleSample") _
 .XSLTransforms.Item(1)

 intResponse = MsgBox("Are you sure you want to delete the " _
 & objXSLT.Alias & " XSL transform?", vbYesNo)

 If intResponse = vbYes Then objXSLT.Delete

End Sub
Note Note

The SimpleSample schema is included in the Smart Document Software Development Kit (SDK). For more information, refer to the Smart Document SDK on the Microsoft Developer Network (MSDN) Web site.

See also

Concepts

Word Object Model Reference

Other resources

XSLTransforms Object Members


XSLTransforms Members (Word)

 Copy code hover
[image]

XSLTransforms Members (Word)
Send feedback

Published: July 16, 2012

A collection of XSLTransform objects that represent all of the Extensible Stylesheet Language Transformations (XSLTs) for a specific XML namespace.

Methods

Name | Description
Add | Returns an XSLTransform object that represents an Extensible Stylesheet Language Transformation (XSLT) added to the collection of XSLTs for a specified schema.
Item | Returns an XSLTransform object in a collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of XSLTransforms in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified XSLTransforms object.


XSLTransforms Properties (Word)

 Copy code hover
[image]

XSLTransforms Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Count | Returns a Long that represents the number of XSLTransforms in the collection. Read-only.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified XSLTransforms object.


XSLTransforms.Application Property (Word)

 Copy code hover
[image]

XSLTransforms.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a XSLTransforms collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

XSLTransforms Collection

Other resources

XSLTransforms Object Members


XSLTransforms.Count Property (Word)

 Copy code hover
[image]

XSLTransforms.Count Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a Long that represents the number of XSLTransforms in the collection. Read-only.

Syntax

expression .Count

expression Required. A variable that represents a XSLTransforms collection.

See also

Concepts

XSLTransforms Collection

Other resources

XSLTransforms Object Members


XSLTransforms.Creator Property (Word)

 Copy code hover
[image]

XSLTransforms.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a XSLTransforms collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

XSLTransforms Collection

Other resources

XSLTransforms Object Members


XSLTransforms.Parent Property (Word)

 Copy code hover
[image]

XSLTransforms.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified XSLTransforms object.

Syntax

expression .Parent

expression Required. A variable that represents a XSLTransforms collection.

See also

Concepts

XSLTransforms Collection

Other resources

XSLTransforms Object Members


XSLTransforms Methods (Word)

 Copy code hover
[image]

XSLTransforms Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Add | Returns an XSLTransform object that represents an Extensible Stylesheet Language Transformation (XSLT) added to the collection of XSLTs for a specified schema.
Item | Returns an XSLTransform object in a collection.


XSLTransforms.Add Method (Word)

 Copy code hover
[image]

XSLTransforms.Add Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an XSLTransform object that represents an Extensible Stylesheet Language Transformation (XSLT) added to the collection of XSLTs for a specified schema.

Syntax

expression .Add(Location, Alias, InstallForAllUsers)

expression Required. A variable that represents a XSLTransforms collection.

Parameters

Name | Required/Optional | Data Type | Description
Location | Required | String | The path and file name of the XSLT. This may be a local file path, a network path, or an Internet address.
Alias | Optional | String | The name of the XSLT as it appears in the Schema Library.
InstallForAllUsers | Optional | Boolean | True if all users that log on to a computer can access and use the new schema. The default is False.

Return Value

XSLTransform

Example

The following code adds a schema to the Schema Library and then adds an XSLT to the newly added schema.

VBA Copy code Copy code
Sub AddXSLT()
 Dim objSchema As XMLNamespace
 Dim objTransform As XSLTransform

 Set objSchema = Application.XMLNamespaces("SimpleSample")
 Set objTransform = objSchema.XSLTransforms _
 .Add("c:\schemas\simplesample.xsl")

End Sub

See also

Concepts

XSLTransforms Collection

Other resources

XSLTransforms Object Members


XSLTransforms.Item Method (Word)

 Copy code hover
[image]

XSLTransforms.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns an XSLTransform object in a collection.

Syntax

expression .Item(Index)

expression Required. A variable that represents a XSLTransforms collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | Variant | The individual object to be returned. Can be a Long indicating the ordinal position or a String representing the name of the individual object.

Return Value

XSLTransform

See also

Concepts

XSLTransforms Collection

Other resources

XSLTransforms Object Members


Zoom Object (Word)

 Copy code hover
[image]

Zoom Object (Word)
See also Send feedback

Published: July 16, 2012

Contains magnification options (for example, the zoom percentage) for a window or pane. The Zoom object is a member of the Zooms collection.

Remarks

Use the Zoom property of the View object to return a single Zoom object. The following example sets the zoom percentage for the active window to 110 percent.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.View.Zoom.Percentage = 110

Use Zooms(Index), where Index identifies the view type, to return a single Zoom object. The view type specified by index can be one of the following WdViewType constants: wdMasterView, wdNormalView, wdOutlineView, wdPrintPreview, wdPrintView, or wdWebView. The following example sets the magnification for the active window so that an entire page is visible.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.ActivePane _
 .Zooms(wdPrintView).PageFit = wdPageFitFullPage

The Add method isn't available for the Zooms collection. The Zooms collection includes a single Zoom object for each of the various view types (such as outline, normal, or page layout).

See also

Concepts

Word Object Model Reference

Other resources

Zoom Object Members


Zoom Members (Word)

 Copy code hover
[image]

Zoom Members (Word)
Send feedback

Published: July 16, 2012

Contains magnification options (for example, the zoom percentage) for a window or pane. The Zoom object is a member of the Zooms collection.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
PageColumns | Returns or sets the number of pages to be displayed side by side on-screen at the same time in print layout view or print preview. Read/write Long.
PageFit | Returns or sets the view magnification of a window so that either the entire page is visible or the entire width of the page is visible. Read/write WdPageFit.
PageRows | Returns or sets the number of pages to be displayed one above the other on-screen at the same time in print layout view or print preview. Read/write Long.
Parent | Returns an Object that represents the parent object of the specified Zoom object.
Percentage | Returns or sets the magnification for a window as a percentage. Read/write Long.


Zoom Properties (Word)

 Copy code hover
[image]

Zoom Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
PageColumns | Returns or sets the number of pages to be displayed side by side on-screen at the same time in print layout view or print preview. Read/write Long.
PageFit | Returns or sets the view magnification of a window so that either the entire page is visible or the entire width of the page is visible. Read/write WdPageFit.
PageRows | Returns or sets the number of pages to be displayed one above the other on-screen at the same time in print layout view or print preview. Read/write Long.
Parent | Returns an Object that represents the parent object of the specified Zoom object.
Percentage | Returns or sets the magnification for a window as a percentage. Read/write Long.


Zoom.Application Property (Word)

 Copy code hover
[image]

Zoom.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a Zoom object.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

Zoom Object

Other resources

Zoom Object Members


Zoom.Creator Property (Word)

 Copy code hover
[image]

Zoom.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a Zoom object.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Zoom Object

Other resources

Zoom Object Members


Zoom.PageColumns Property (Word)

 Copy code hover
[image]

Zoom.PageColumns Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the number of pages to be displayed side by side on-screen at the same time in print layout view or print preview. Read/write Long.

Syntax

expression .PageColumns

expression An expression that returns a Zoom object.

Example

This example switches the active window to print layout view and displays two pages side by side.

VBA Copy code Copy code
With ActiveDocument.ActiveWindow.View
 .Type = wdPrintView
 .Zoom.PageColumns = 2
 .Zoom.PageRows = 1
End With

This example switches the document window for Hello.doc to print layout view and displays one full page.

VBA Copy code Copy code
With Windows("Hello.doc").View
 .Type = wdPrintView
 With .Zoom
 .PageColumns = 1
 .PageRows = 1
 .PageFit = wdPageFitFullPage
 End With
End With

See also

Concepts

Zoom Object

Other resources

Zoom Object Members


Zoom.PageFit Property (Word)

 Copy code hover
[image]

Zoom.PageFit Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the view magnification of a window so that either the entire page is visible or the entire width of the page is visible. Read/write WdPageFit.

Syntax

expression .PageFit

expression Required. A variable that represents a Zoom object.

Remarks

The wdPageFitFullPage constant has no effect if the document isn't in print view.

When the PageFit property is set to wdPageFitBestFit, the zoom percentage is automatically recalculated every time the document window size is changed. Setting this property to wdPageFitNone keeps the zoom percentage from being recalculated whenever this happens.

Example

This example changes the magnification percentage of the window for Letter.doc so that the entire width of the text is visible.

VBA Copy code Copy code
With Windows("Letter.doc").View
 .Type = wdNormalView
 .Zoom.PageFit = wdPageFitBestFit
End With

This example switches the active window to print view and changes the magnification so that the entire page is visible.

VBA Copy code Copy code
With ActiveDocument.ActiveWindow.View
 .Type = wdPrintView
 .Zoom.PageFit = wdPageFitFullPage
End With

See also

Concepts

Zoom Object

Other resources

Zoom Object Members


Zoom.PageRows Property (Word)

 Copy code hover
[image]

Zoom.PageRows Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the number of pages to be displayed one above the other on-screen at the same time in print layout view or print preview. Read/write Long.

Syntax

expression .PageRows

expression An expression that returns a Zoom object.

Example

This example switches the active window to print preview and displays two pages one above the other.

VBA Copy code Copy code
PrintPreview = True
With ActiveDocument.ActiveWindow.View.Zoom
 .PageColumns = 1
 .PageRows = 2
End With

See also

Concepts

Zoom Object

Other resources

Zoom Object Members


Zoom.Parent Property (Word)

 Copy code hover
[image]

Zoom.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Zoom object.

Syntax

expression .Parent

expression Required. A variable that represents a Zoom object.

See also

Concepts

Zoom Object

Other resources

Zoom Object Members


Zoom.Percentage Property (Word)

 Copy code hover
[image]

Zoom.Percentage Property (Word)
See also Send feedback

Published: July 16, 2012

Returns or sets the magnification for a window as a percentage. Read/write Long.

Syntax

expression .Percentage

expression An expression that returns a Zoom object.

Example

This example switches the active window to normal view and sets the magnification to 80 percent.

VBA Copy code Copy code
With ActiveDocument.ActiveWindow.View
 .Type = wdNormalView
 .Zoom.Percentage = 80
End With

This example increases the magnification of the active window by 10 percent.

VBA Copy code Copy code
Set myZoom = ActiveDocument.ActiveWindow.View.Zoom
myZoom.Percentage = myZoom.Percentage + 10

See also

Concepts

Zoom Object

Other resources

Zoom Object Members


Zooms Object (Word)

 Copy code hover
[image]

Zooms Object (Word)
See also Send feedback

Published: July 16, 2012

A collection of Zoom objects that represents the magnification options for each view (such as outline, normal, or print layout).

Remarks

Use the Zooms property to return the Zooms collection. The following example sets the zoom percentage for the active window to 100 percent in Normal view.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.ActivePane _
 .Zooms(wdNormalView).Percentage = 100

The Add method isn't available for the Zooms collection. The Zooms collection includes a single Zoom object for each of the various view types (such as outline, normal, or page layout). You cannot enumerate the Zooms collection by using a For Each loop.

Use Zooms(index), where index identifies the view type, to return a single Zoom object. The view type specified by index can be one of the following WdViewType constants: wdMasterView, wdNormalView, wdOutlineView, wdPrintPreview, wdPrintView, or wdWebView. The following example sets the magnification for the active window so that an entire page is visible.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.ActivePane _
 .Zooms(wdPrintView).PageFit = wdPageFitFullPage

You can also use the Zoom property of the View object to return a single Zoom object. The following example sets the zoom percentage for the active window to 110 percent.

VBA Copy code Copy code
ActiveDocument.ActiveWindow.View.Zoom.Percentage = 110

See also

Concepts

Word Object Model Reference

Other resources

Zooms Object Members


Zooms Members (Word)

 Copy code hover
[image]

Zooms Members (Word)
Send feedback

Published: July 16, 2012

A collection of Zoom objects that represents the magnification options for each view (such as outline, normal, or print layout).

Methods

Name | Description
Item | Returns the specified Zoom object.

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified Zooms object.


Zooms Properties (Word)

 Copy code hover
[image]

Zooms Properties (Word)
Send feedback

Published: July 16, 2012

This object has the following properties:

Properties

Name | Description
Application | Returns an Application object that represents the Microsoft Word application.
Creator | Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.
Parent | Returns an Object that represents the parent object of the specified Zooms object.


Zooms.Application Property (Word)

 Copy code hover
[image]

Zooms.Application Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Application object that represents the Microsoft Word application.

Syntax

expression .Application

expression Required. A variable that represents a Zooms collection.

Remarks

Visual Basic's CreateObject and GetObject functions give you access to an OLE Automation object from a Visual Basic for Applications project.

See also

Concepts

Zooms Collection Object

Other resources

Zooms Object Members


Zooms.Creator Property (Word)

 Copy code hover
[image]

Zooms.Creator Property (Word)
See also Send feedback

Published: July 16, 2012

Returns a 32-bit integer that indicates the application in which the specified object was created. Read-only Long.

Syntax

expression .Creator

expression Required. A variable that represents a Zooms collection.

Remarks

If the object was created in Microsoft Word, the Creator property returns the hexadecimal number 4D535744, which represents the string "MSWD." This property was primarily designed to be used on the Macintosh, where each application has a four-character creator code. For example, Microsoft Word has the creator code MSWD. For additional information about this property, consult the language reference Help included with Microsoft Office Macintosh Edition.

See also

Concepts

Zooms Collection Object

Other resources

Zooms Object Members


Zooms.Parent Property (Word)

 Copy code hover
[image]

Zooms.Parent Property (Word)
See also Send feedback

Published: July 16, 2012

Returns an Object that represents the parent object of the specified Zooms object.

Syntax

expression .Parent

expression Required. A variable that represents a Zooms collection.

See also

Concepts

Zooms Collection Object

Other resources

Zooms Object Members


Zooms Methods (Word)

 Copy code hover
[image]

Zooms Methods (Word)
Send feedback

Published: July 16, 2012

This object has the following methods:

Methods

Name | Description
Item | Returns the specified Zoom object.


Zooms.Item Method (Word)

 Copy code hover
[image]

Zooms.Item Method (Word)
See also Send feedback

Published: July 16, 2012

Returns the specified Zoom object.

Syntax

expression .Item(Index)

expression Required. A variable that represents a Zooms collection.

Parameters

Name | Required/Optional | Data Type | Description
Index | Required | WdViewType | The specified zoom type.

Return Value

Zoom

See also

Concepts

Zooms Collection Object

Other resources

Zooms Object Members


Enumerations (Word)

 Copy code hover
[image]

Enumerations (Word)
Send feedback

Published: July 16, 2012

This section contains documentation for the enumerations in the Word object model.


WdAlertLevel Enumeration (Word)

 Copy code hover
[image]

WdAlertLevel Enumeration (Word)
Send feedback

Specifies the way certain alerts and messages are handled while a macro is running.

Name | Value | Description
wdAlertsAll | -1 | All message boxes and alerts are displayed; errors are returned to the macro.
wdAlertsMessageBox | -2 | Only message boxes are displayed; errors are trapped and returned to the macro.
wdAlertsNone | 0 | No alerts or message boxes are displayed. If a macro encounters a message box, the default value is chosen and the macro continues.


WdAlignmentTabAlignment Enumeration (Word)

 Copy code hover
[image]

WdAlignmentTabAlignment Enumeration (Word)
Send feedback

Specifies tab alignment.

Name | Value | Description
wdCenter | 1 | Centered tab.
wdLeft | 0 | Left-aligned tab.
wdRight | 2 | Right-aligned tab.


WdAlignmentTabRelative Enumeration (Word)

 Copy code hover
[image]

WdAlignmentTabRelative Enumeration (Word)
Send feedback

Specifies whether Microsoft Word calculates the alignment for a tab relative to the section margins or the paragraph indents.

Name | Value | Description
wdIndent | 1 | Word calculates tab alignment relative to the paragraph indents.
wdMargin | 0 | Word calculates tab alignment relative to the margins


WdApplyQuickStyleSets Enumeration (Word)

 Copy code hover
[image]

WdApplyQuickStyleSets Enumeration (Word)
Send feedback

Specifies a Quick Style set to apply to the document.

Version Information

Version Added: Word 2010

Name | Value | Description
wdSessionStartSet | 1 | Resets the Quick Style to the style set in use when the document was opened.
wdTemplateSet | 2 | Resets the Quick Style to the style set from the template, if any.


WdArabicNumeral Enumeration (Word)

 Copy code hover
[image]

WdArabicNumeral Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the numeral style for an Arabic-language document.

Name | Value | Description
wdNumeralArabic | 0 | Arabic shape is used for numerals.
wdNumeralContext | 2 | Numeral shape depends on text surrounding it.
wdNumeralHindi | 1 | Hindi shape is used for numerals.
wdNumeralSystem | 3 | Numeral shape is determined by system settings.


WdAraSpeller Enumeration (Word)

 Copy code hover
[image]

WdAraSpeller Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies spelling rules for the Arabic spelling checker.

Name | Value | Description
wdBoth | 3 | The spelling checker uses spelling rules regarding both Arabic words ending with the letter yaa and Arabic words beginning with an alef hamza.
wdFinalYaa | 2 | The spelling checker uses spelling rules regarding Arabic words ending with the letter yaa.
wdInitialAlef | 1 | The spelling checker uses spelling rules regarding Arabic words beginning with an alef hamza.
wdNone | 0 | The spelling checker ignores spelling rules regarding either Arabic words ending with the letter yaa or Arabic words beginning with an alef hamza.


WdArrangeStyle Enumeration (Word)

 Copy code hover
[image]

WdArrangeStyle Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the window arrangement.

Name | Value | Description
wdIcons | 1 | Windows are displayed as icons in a single window.
wdTiled | 0 | Windows are tiled into a single window.


WdAutoFitBehavior Enumeration (Word)

 Copy code hover
[image]

WdAutoFitBehavior Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies how Microsoft Word resizes a table when the AutoFit feature is used.

Name | Value | Description
wdAutoFitContent | 1 | The table is automatically sized to fit the content contained in the table.
wdAutoFitFixed | 0 | The table is set to a fixed size, regardless of the content, and is not automatically sized.
wdAutoFitWindow | 2 | The table is automatically sized to the width of the active window.


WdAutoMacros Enumeration (Word)

 Copy code hover
[image]

WdAutoMacros Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies an auto macro that is stored in the document.

Name | Value | Description
wdAutoClose | 3 | AutoClose macro.
wdAutoExec | 0 | AutoExec macro.
wdAutoExit | 4 | AutoExit macro.
wdAutoNew | 1 | AutoNew macro.
wdAutoOpen | 2 | AutoOpen macro.
wdAutoSync | 5 | AutoSync macro.


WdAutoVersions Enumeration (Word)

 Copy code hover
[image]

WdAutoVersions Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the state of the option for automatically saving document versions.

Name | Value | Description
wdAutoVersionOff | 0 | No document version is saved.
wdAutoVersionOnClose | 1 | A document version is saved automatically when the document is closed.


WdBaselineAlignment Enumeration (Word)

 Copy code hover
[image]

WdBaselineAlignment Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the vertical position of fonts on a line.

Name | Value | Description
wdBaselineAlignAuto | 4 | Microsoft Word automatically adjusts the baseline font alignment.
wdBaselineAlignBaseline | 2 | Align to a baseline for the paragraph.
wdBaselineAlignCenter | 1 | Align center points of each font.
wdBaselineAlignFarEast50 | 3 | Align using the baseline for Asian langauge font standards.
wdBaselineAlignTop | 0 | Align along top of each font.


WdBookmarkSortBy Enumeration (Word)

 Copy code hover
[image]

WdBookmarkSortBy Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the sorting option for bookmark names displayed in the Bookmark dialog box.

Name | Value | Description
wdSortByLocation | 1 | Sorted by location in document.
wdSortByName | 0 | Sorted by bookmark name.


WdBorderDistanceFrom Enumeration (Word)

 Copy code hover
[image]

WdBorderDistanceFrom Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies whether a page border is measured from the edge of the page or from the text it surrounds.

Name | Value | Description
wdBorderDistanceFromPageEdge | 1 | From the edge of the page.
wdBorderDistanceFromText | 0 | From the text it surrounds.


WdBorderType Enumeration (Word)

 Copy code hover
[image]

WdBorderType Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the type of border to be used.

Name | Value | Description
wdBorderBottom | -3 | A bottom border.
wdBorderDiagonalDown | -7 | A diagonal border starting in the upper-left corner.
wdBorderDiagonalUp | -8 | A diagonal border starting in the lower-left corner.
wdBorderHorizontal | -5 | Horizontal borders.
wdBorderLeft | -2 | A left border.
wdBorderRight | -4 | A right border.
wdBorderTop | -1 | A top border.
wdBorderVertical | -6 | Vertical borders.


WdBreakType Enumeration (Word)

 Copy code hover
[image]

WdBreakType Enumeration (Word)
Send feedback

Specifies type of break.

Name | Value | Description
wdColumnBreak | 8 | Column break at the insertion point.
wdLineBreak | 6 | Line break.
wdLineBreakClearLeft | 9 | Line break.
wdLineBreakClearRight | 10 | Line break.
wdPageBreak | 7 | Page break at the insertion point.
wdSectionBreakContinuous | 3 | New section without a corresponding page break.
wdSectionBreakEvenPage | 4 | Section break with the next section beginning on the next even-numbered page. If the section break falls on an even-numbered page, Word leaves the next odd-numbered page blank.
wdSectionBreakNextPage | 2 | Section break on next page.
wdSectionBreakOddPage | 5 | Section break with the next section beginning on the next odd-numbered page. If the section break falls on an odd-numbered page, Word leaves the next even-numbered page blank.
wdTextWrappingBreak | 11 | Ends the current line and forces the text to continue below a picture, table, or other item. The text continues on the next blank line that does not contain a table aligned with the left or right margin.


WdBrowserLevel Enumeration (Word)

 Copy code hover
[image]

WdBrowserLevel Enumeration (Word)
Send feedback

Specifies the version of Web browser at which you want to target new Web pages created in Microsoft Word.

Name | Value | Description
wdBrowserLevelMicrosoftInternetExplorer5 | 1 | Microsoft Internet Explorer 5.
wdBrowserLevelMicrosoftInternetExplorer6 | 2 | Microsoft Internet Explorer 6.
wdBrowserLevelV4 | 0 | Microsoft Internet Explorer 4.


WdBrowseTarget Enumeration (Word)

 Copy code hover
[image]

WdBrowseTarget Enumeration (Word)
Send feedback

Specifies the document item that the Next or Previous method locates, and places the insertion point before the next or previous instance of the item.

Name | Value | Description
wdBrowseComment | 3 | Places insertion point before next or previous comment.
wdBrowseEdit | 10 | Places insertion point before next or previous edit.
wdBrowseEndnote | 5 | Places insertion point before next or previous endnote.
wdBrowseField | 6 | Places insertion point before next or previous browsefield.
wdBrowseFind | 11 | Places insertion point before next or previous browsefind.
wdBrowseFootnote | 4 | Places insertion point before next or previous footnote.
wdBrowseGoTo | 12 | Places insertion point before next or previous GoTo item.
wdBrowseGraphic | 8 | Places insertion point before next or previous graphic.
wdBrowseHeading | 9 | Places insertion point before next or previous heading.
wdBrowsePage | 1 | Places insertion point before next or previous page.
wdBrowseSection | 2 | Places insertion point before next or previous section.
wdBrowseTable | 7 | Places insertion point before next or previous table.


WdBuildingBlockTypes Enumeration (Word)

 Copy code hover
[image]

WdBuildingBlockTypes Enumeration (Word)
Send feedback

Specifies the type of building block.

Name | Value | Description
wdTypeAutoText | 9 | Autotext building block.
wdTypeBibliography | 34 | Bibliography building block.
wdTypeCoverPage | 2 | Cover page building block.
wdTypeCustom1 | 29 | Custom building block.
wdTypeCustom2 | 30 | Custom building block.
wdTypeCustom3 | 31 | Custom building block.
wdTypeCustom4 | 32 | Custom building block.
wdTypeCustom5 | 33 | Custom building block.
wdTypeCustomAutoText | 23 | Custom autotext building block.
wdTypeCustomBibliography | 35 | Custom bibliography building block.
wdTypeCustomCoverPage | 16 | Custom cover page building block.
wdTypeCustomEquations | 17 | Custom equations building block.
wdTypeCustomFooters | 18 | Custom footers building block.
wdTypeCustomHeaders | 19 | Custom headers building block.
wdTypeCustomPageNumber | 20 | Custom page numbering building block.
wdTypeCustomPageNumberBottom | 26 | Building block for custom page numbering on the bottom of the page.
wdTypeCustomPageNumberPage | 27 | Custom page numbering building block.
wdTypeCustomPageNumberTop | 25 | Building block for custom page numbering on the top of the page.
wdTypeCustomQuickParts | 15 | Custom quick parts building block.
wdTypeCustomTableOfContents | 28 | Custom table of contents building block.
wdTypeCustomTables | 21 | Custom table bulding block.
wdTypeCustomTextBox | 24 | Custom text box building block.
wdTypeCustomWatermarks | 22 | Custom watermark building block.
wdTypeEquations | 3 | Equation building block.
wdTypeFooters | 4 | Footer bulding block.
wdTypeHeaders | 5 | Header building block.
wdTypePageNumber | 6 | Page numbering building block.
wdTypePageNumberBottom | 12 | Building block for page numbering on the bottom of the page.
wdTypePageNumberPage | 13 | Page numbering building block.
wdTypePageNumberTop | 11 | Building block for page numbering on the top of the page.
wdTypeQuickParts | 1 | Quick parts building block.
wdTypeTableOfContents | 14 | Table of contents building block.
wdTypeTables | 7 | Table building block.
wdTypeTextBox | 10 | Text box building block.
wdTypeWatermarks | 8 | Watermark building block.


WdBuiltInProperty Enumeration (Word)

 Copy code hover
[image]

WdBuiltInProperty Enumeration (Word)
Send feedback

Specifies a built-in document property.

Name | Value | Description
wdPropertyAppName | 9 | Name of application.
wdPropertyAuthor | 3 | Author.
wdPropertyBytes | 22 | Byte count.
wdPropertyCategory | 18 | Category.
wdPropertyCharacters | 16 | Character count.
wdPropertyCharsWSpaces | 30 | Character count with spaces.
wdPropertyComments | 5 | Comments.
wdPropertyCompany | 21 | Company.
wdPropertyFormat | 19 | Not supported.
wdPropertyHiddenSlides | 27 | Not supported.
wdPropertyHyperlinkBase | 29 | Not supported.
wdPropertyKeywords | 4 | Keywords.
wdPropertyLastAuthor | 7 | Last author.
wdPropertyLines | 23 | Line count.
wdPropertyManager | 20 | Manager.
wdPropertyMMClips | 28 | Not supported.
wdPropertyNotes | 26 | Notes.
wdPropertyPages | 14 | Page count.
wdPropertyParas | 24 | Paragraph count.
wdPropertyRevision | 8 | Revision number.
wdPropertySecurity | 17 | Security setting.
wdPropertySlides | 25 | Not supported.
wdPropertySubject | 2 | Subject.
wdPropertyTemplate | 6 | Template name.
wdPropertyTimeCreated | 11 | Time created.
wdPropertyTimeLastPrinted | 10 | Time last printed.
wdPropertyTimeLastSaved | 12 | Time last saved.
wdPropertyTitle | 1 | Title.
wdPropertyVBATotalEdit | 13 | Number of edits to VBA project.
wdPropertyWords | 15 | Word count.


WdBuiltinStyle Enumeration (Word)

 Copy code hover
[image]

WdBuiltinStyle Enumeration (Word)
Send feedback

Specifies a built-in Microsoft Word style.

Name | Value | Description
wdStyleBlockQuotation | -85 | Block Text.
wdStyleBodyText | -67 | Body Text.
wdStyleBodyText2 | -81 | Body Text 2.
wdStyleBodyText3 | -82 | Body Text 3.
wdStyleBodyTextFirstIndent | -78 | Body Text First Indent.
wdStyleBodyTextFirstIndent2 | -79 | Body Text First Indent 2.
wdStyleBodyTextIndent | -68 | Body Text Indent.
wdStyleBodyTextIndent2 | -83 | Body Text Indent 2.
wdStyleBodyTextIndent3 | -84 | Body Text Indent 3.
wdStyleBookTitle | -265 | Book Title.
wdStyleCaption | -35 | Caption.
wdStyleClosing | -64 | Closing.
wdStyleCommentReference | -40 | Comment Reference.
wdStyleCommentText | -31 | Comment Text.
wdStyleDate | -77 | Date.
wdStyleDefaultParagraphFont | -66 | Default Paragraph Font.
wdStyleEmphasis | -89 | Emphasis.
wdStyleEndnoteReference | -43 | Endnote Reference.
wdStyleEndnoteText | -44 | Endnote Text.
wdStyleEnvelopeAddress | -37 | Envelope Address.
wdStyleEnvelopeReturn | -38 | Envelope Return.
wdStyleFooter | -33 | Footer.
wdStyleFootnoteReference | -39 | Footnote Reference.
wdStyleFootnoteText | -30 | Footnote Text.
wdStyleHeader | -32 | Header.
wdStyleHeading1 | -2 | Heading 1.
wdStyleHeading2 | -3 | Heading 2.
wdStyleHeading3 | -4 | Heading 3.
wdStyleHeading4 | -5 | Heading 4.
wdStyleHeading5 | -6 | Heading 5.
wdStyleHeading6 | -7 | Heading 6.
wdStyleHeading7 | -8 | Heading 7.
wdStyleHeading8 | -9 | Heading 8.
wdStyleHeading9 | -10 | Heading 9.
wdStyleHtmlAcronym | -96 | HTML Acronym.
wdStyleHtmlAddress | -97 | HTML Address.
wdStyleHtmlCite | -98 | HTML Cite.
wdStyleHtmlCode | -99 | HTML Code.
wdStyleHtmlDfn | -100 | HTML Definition.
wdStyleHtmlKbd | -101 | HTML Keyboard.
wdStyleHtmlNormal | -95 | Normal (Web).
wdStyleHtmlPre | -102 | HTML Preformatted.
wdStyleHtmlSamp | -103 | HTML Sample.
wdStyleHtmlTt | -104 | HTML Typewriter.
wdStyleHtmlVar | -105 | HTML Variable.
wdStyleHyperlink | -86 | Hyperlink.
wdStyleHyperlinkFollowed | -87 | Followed Hyperlink.
wdStyleIndex1 | -11 | Index 1.
wdStyleIndex2 | -12 | Index 2.
wdStyleIndex3 | -13 | Index 3.
wdStyleIndex4 | -14 | Index 4.
wdStyleIndex5 | -15 | Index 5.
wdStyleIndex6 | -16 | Index 6.
wdStyleIndex7 | -17 | Index 7.
wdStyleIndex8 | -18 | Index 8.
wdStyleIndex9 | -19 | Index 9.
wdStyleIndexHeading | -34 | Index Heading
wdStyleIntenseEmphasis | -262 | Intense Emphasis.
wdStyleIntenseQuote | -182 | Intense Quote.
wdStyleIntenseReference | -264 | Intense Reference.
wdStyleLineNumber | -41 | Line Number.
wdStyleList | -48 | List.
wdStyleList2 | -51 | List 2.
wdStyleList3 | -52 | List 3.
wdStyleList4 | -53 | List 4.
wdStyleList5 | -54 | List 5.
wdStyleListBullet | -49 | List Bullet.
wdStyleListBullet2 | -55 | List Bullet 2.
wdStyleListBullet3 | -56 | List Bullet 3.
wdStyleListBullet4 | -57 | List Bullet 4.
wdStyleListBullet5 | -58 | List Bullet 5.
wdStyleListContinue | -69 | List Continue.
wdStyleListContinue2 | -70 | List Continue 2.
wdStyleListContinue3 | -71 | List Continue 3.
wdStyleListContinue4 | -72 | List Continue 4.
wdStyleListContinue5 | -73 | List Continue 5.
wdStyleListNumber | -50 | List Number.
wdStyleListNumber2 | -59 | List Number 2.
wdStyleListNumber3 | -60 | List Number 3.
wdStyleListNumber4 | -61 | List Number 4.
wdStyleListNumber5 | -62 | List Number 5.
wdStyleListParagraph | -180 | List Paragraph.
wdStyleMacroText | -46 | Macro Text.
wdStyleMessageHeader | -74 | Message Header.
wdStyleNavPane | -90 | Document Map.
wdStyleNormal | -1 | Normal.
wdStyleNormalIndent | -29 | Normal Indent.
wdStyleNormalObject | -158 | Normal (applied to an object).
wdStyleNormalTable | -106 | Normal (applied within a table).
wdStyleNoteHeading | -80 | Note Heading.
wdStylePageNumber | -42 | Page Number.
wdStylePlainText | -91 | Plain Text.
wdStyleQuote | -181 | Quote.
wdStyleSalutation | -76 | Salutation.
wdStyleSignature | -65 | Signature.
wdStyleStrong | -88 | Strong.
wdStyleSubtitle | -75 | Subtitle.
wdStyleSubtleEmphasis | -261 | Subtle Emphasis.
wdStyleSubtleReference | -263 | Subtle Reference.
wdStyleTableColorfulGrid | -172 | Colorful Grid.
wdStyleTableColorfulList | -171 | Colorful List.
wdStyleTableColorfulShading | -170 | Colorful Shading.
wdStyleTableDarkList | -169 | Dark List.
wdStyleTableLightGrid | -161 | Light Grid.
wdStyleTableLightGridAccent1 | -175 | Light Grid Accent 1.
wdStyleTableLightList | -160 | Light List.
wdStyleTableLightListAccent1 | -174 | Light List Accent 1.
wdStyleTableLightShading | -159 | Light Shading.
wdStyleTableLightShadingAccent1 | -173 | Light Shading Accent 1.
wdStyleTableMediumGrid1 | -166 | Medium Grid 1.
wdStyleTableMediumGrid2 | -167 | Medium Grid 2.
wdStyleTableMediumGrid3 | -168 | Medium Grid 3.
wdStyleTableMediumList1 | -164 | Medium List 1.
wdStyleTableMediumList1Accent1 | -178 | Medium List 1 Accent 1.
wdStyleTableMediumList2 | -165 | Medium List 2.
wdStyleTableMediumShading1 | -162 | Medium Shading 1.
wdStyleTableMediumShading1Accent1 | -176 | Medium Shading 1 Accent 1.
wdStyleTableMediumShading2 | -163 | Medium Shading 2.
wdStyleTableMediumShading2Accent1 | -177 | Medium Shading 2 Accent 1.
wdStyleTableOfAuthorities | -45 | Table of Authorities.
wdStyleTableOfFigures | -36 | Table of Figures.
wdStyleTitle | -63 | Title.
wdStyleTOAHeading | -47 | TOA Heading.
wdStyleTOC1 | -20 | TOC 1.
wdStyleTOC2 | -21 | TOC 2.
wdStyleTOC3 | -22 | TOC 3.
wdStyleTOC4 | -23 | TOC 4.
wdStyleTOC5 | -24 | TOC 5.
wdStyleTOC6 | -25 | TOC 6.
wdStyleTOC7 | -26 | TOC 7.
wdStyleTOC8 | -27 | TOC 8.
wdStyleTOC9 | -28 | TOC 9.


WdCalendarType Enumeration (Word)

 Copy code hover
[image]

WdCalendarType Enumeration (Word)
Send feedback

Specifies a calendar type.

Name | Value | Description
wdCalendarArabic | 1 | Arabic Hijri calendar.
wdCalendarHebrew | 2 | Hebrew Lunar calendar.
wdCalendarJapan | 4 | Japanese Emperor Era calendar.
wdCalendarKorean | 6 | Korean Danki calendar.
wdCalendarSakaEra | 7 | Saka Era calendar.
wdCalendarTaiwan | 3 | Taiwan calendar.
wdCalendarThai | 5 | Thai calendar.
wdCalendarTranslitEnglish | 8 | English transliterated. Gregorian calendar with English month and day names transliterated to the Arabic script. Unsupported.
wdCalendarTranslitFrench | 9 | French transliterated. Gregorian calendar with French month and day names transliterated to the Arabic script. Unsupported.
wdCalendarUmalqura | 13 | Um-al-Qura calendar.
wdCalendarWestern | 0 | Western. Corresponds to the Gregorian calendar.


WdCalendarTypeBi Enumeration (Word)

 Copy code hover
[image]

WdCalendarTypeBi Enumeration (Word)
Send feedback

Specifies calendar type to use when displaying the date or time.

Name | Value | Description
wdCalendarTypeBidi | 99 | Bi-directional calendar.
wdCalendarTypeGregorian | 100 | Gregorian calendar.


WdCaptionLabelID Enumeration (Word)

 Copy code hover
[image]

WdCaptionLabelID Enumeration (Word)
Send feedback

Specifies the type for a caption label.

Name | Value | Description
wdCaptionEquation | -3 | Equation.
wdCaptionFigure | -1 | Figure.
wdCaptionTable | -2 | Table.


WdCaptionNumberStyle Enumeration (Word)

 Copy code hover
[image]

WdCaptionNumberStyle Enumeration (Word)
Send feedback

Specifies the number style to be used with the CaptionLabel object.

Name | Value | Description
wdCaptionNumberStyleArabic | 0 | Arabic style.
wdCaptionNumberStyleArabicFullWidth | 14 | Full-width Arabic style.
wdCaptionNumberStyleArabicLetter1 | 46 | Arabic letter style 1.
wdCaptionNumberStyleArabicLetter2 | 48 | Arabic letter style 2.
wdCaptionNumberStyleChosung | 25 | Chosung style.
wdCaptionNumberStyleGanada | 24 | Ganada style.
wdCaptionNumberStyleHanjaRead | 41 | Hanja read style.
wdCaptionNumberStyleHanjaReadDigit | 42 | Hanja read digit style.
wdCaptionNumberStyleHebrewLetter1 | 45 | Hebrew letter style 1.
wdCaptionNumberStyleHebrewLetter2 | 47 | Hebrew letter style 2.
wdCaptionNumberStyleHindiArabic | 51 | Hindi Arabic style.
wdCaptionNumberStyleHindiCardinalText | 52 | Hindi cardinal style.
wdCaptionNumberStyleHindiLetter1 | 49 | Hindi letter style 1.
wdCaptionNumberStyleHindiLetter2 | 50 | Hindi letter style 2.
wdCaptionNumberStyleKanji | 10 | Kanji style.
wdCaptionNumberStyleKanjiDigit | 11 | Kanji digit style.
wdCaptionNumberStyleKanjiTraditional | 16 | Kanji traditional style.
wdCaptionNumberStyleLowercaseLetter | 4 | Lowercase letter style.
wdCaptionNumberStyleLowercaseRoman | 2 | Lowercase roman style.
wdCaptionNumberStyleNumberInCircle | 18 | Number in circle style.
wdCaptionNumberStyleSimpChinNum2 | 38 | Simplified Chinese number style 2.
wdCaptionNumberStyleSimpChinNum3 | 39 | Simplified Chinese number style 3.
wdCaptionNumberStyleThaiArabic | 54 | Thai Arabic style.
wdCaptionNumberStyleThaiCardinalText | 55 | Thai cardinal text style.
wdCaptionNumberStyleThaiLetter | 53 | Thai letter style.
wdCaptionNumberStyleTradChinNum2 | 34 | Traditional Chinese number style 2.
wdCaptionNumberStyleTradChinNum3 | 35 | Traditional Chinese number style 3.
wdCaptionNumberStyleUppercaseLetter | 3 | Uppercase letter style.
wdCaptionNumberStyleUppercaseRoman | 1 | Uppercase roman style.
wdCaptionNumberStyleVietCardinalText | 56 | Vietnamese cardinal text style.
wdCaptionNumberStyleZodiac1 | 30 | Zodiac style 1.
wdCaptionNumberStyleZodiac2 | 31 | Zodiac style 2.


WdCaptionPosition Enumeration (Word)

 Copy code hover
[image]

WdCaptionPosition Enumeration (Word)
Send feedback

Specifies the position of the caption label text.

Name | Value | Description
wdCaptionPositionAbove | 0 | The caption label is added above.
wdCaptionPositionBelow | 1 | The caption label is added below.


WdCellColor Enumeration (Word)

 Copy code hover
[image]

WdCellColor Enumeration (Word)
Send feedback

Specifies the color of highlighting for table cells that were added, deleted, or merged in the current document.

Version Information

Version Added: Word 2007

Name | Value | Description
wdCellColorByAuthor | -1 | Highlighting color determined by reviewer.
wdCellColorLightBlue | 2 | Light blue.
wdCellColorLightGray | 7 | Light gray.
wdCellColorLightGreen | 6 | Light green.
wdCellColorLightOrange | 5 | Light orange.
wdCellColorLightPurple | 4 | Light purple.
wdCellColorLightYellow | 3 | Light yellow.
wdCellColorNoHighlight | 0 | No highlighting.
wdCellColorPink | 1 | Pink.


WdCellVerticalAlignment Enumeration (Word)

 Copy code hover
[image]

WdCellVerticalAlignment Enumeration (Word)
Send feedback

Specifies the vertical alignment of text in one or more cells of a table.

Name | Value | Description
wdCellAlignVerticalBottom | 3 | Text is aligned to the bottom border of the cell.
wdCellAlignVerticalCenter | 1 | Text is aligned to the center of the cell.
wdCellAlignVerticalTop | 0 | Text is aligned to the top border of the cell.


WdCharacterCase Enumeration (Word)

 Copy code hover
[image]

WdCharacterCase Enumeration (Word)
Send feedback

Specifies the case of the text in the specified range.

Name | Value | Description
wdFullWidth | 7 | Full-width. Used for Japanese characters.
wdHalfWidth | 6 | Half-width. Used for Japanese characters.
wdHiragana | 9 | Hiragana characters. Used with Japanese text.
wdKatakana | 8 | Katakana characters. Used with Japanese text.
wdLowerCase | 0 | Lowercase.
wdNextCase | -1 | Toggles between uppercase, lowercase, and sentence case.
wdTitleSentence | 4 | Sentence case.
wdTitleWord | 2 | Title word case.
wdToggleCase | 5 | Switches uppercase characters to lowercase, and lowercase characters to uppercase.
wdUpperCase | 1 | Uppercase.


WdCharacterWidth Enumeration (Word)

 Copy code hover
[image]

WdCharacterWidth Enumeration (Word)
Send feedback

Specifies the character width of the specified range.

Name | Value | Description
wdWidthFullWidth | 7 | Characters are displayed in full character width.
wdWidthHalfWidth | 6 | Characters are displayed in half the character width.


WdCheckInVersionType Enumeration (Word)

 Copy code hover
[image]

WdCheckInVersionType Enumeration (Word)
Send feedback

Specifies the type of version for the document checked in when using the CheckIn method. Applies to documents stored in a SharePoint library.

Name | Value | Description
wdCheckInMajorVersion | 1 | Major version.
wdCheckInMinorVersion | 0 | Minor version.
wdCheckInOverwriteVersion | 2 | Overwrite current version on the server.


WdChevronConvertRule Enumeration (Word)

 Copy code hover
[image]

WdChevronConvertRule Enumeration (Word)
Send feedback

Specifies rules for converting text enclosed in chevron characters (« ») to merge fields.

Name | Value | Description
wdAlwaysConvert | 1 | The converter attempts to convert text enclosed in chevrons (« ») to mail merge fields.
wdAskToConvert | 3 | The converter prompts the user to convert or not convert chevrons when a Word for the Macintosh document is opened.
wdAskToNotConvert | 2 | The converter prompts the user to convert or not convert chevrons when a Word for the Macintosh document is opened.
wdNeverConvert | 0 | The converter passes the text through without attempting any interpretation.


WdCollapseDirection Enumeration (Word)

 Copy code hover
[image]

WdCollapseDirection Enumeration (Word)
Send feedback

Specifies the direction in which to collapse a range or selection.

Name | Value | Description
wdCollapseEnd | 0 | Collapse the range to the ending point.
wdCollapseStart | 1 | Collapse the range to the starting point.


WdColor Enumeration (Word)

 Copy code hover
[image]

WdColor Enumeration (Word)
Send feedback

Specifies the 24-bit color to apply.

Name | Value | Description
wdColorAqua | 13421619 | Aqua color.
wdColorAutomatic | -16777216 | Automatic color. Default; usually black.
wdColorBlack | 0 | Black color.
wdColorBlue | 16711680 | Blue color.
wdColorBlueGray | 10053222 | Blue-gray color.
wdColorBrightGreen | 65280 | Bright green color.
wdColorBrown | 13209 | Brown color.
wdColorDarkBlue | 8388608 | Dark blue color.
wdColorDarkGreen | 13056 | Dark green color.
wdColorDarkRed | 128 | Dark red color.
wdColorDarkTeal | 6697728 | Dark teal color.
wdColorDarkYellow | 32896 | Dark yellow color.
wdColorGold | 52479 | Gold color.
wdColorGray05 | 15987699 | Shade 05 of gray color.
wdColorGray10 | 15132390 | Shade 10 of gray color.
wdColorGray125 | 14737632 | Shade 125 of gray color.
wdColorGray15 | 14277081 | Shade 15 of gray color.
wdColorGray20 | 13421772 | Shade 20 of gray color.
wdColorGray25 | 12632256 | Shade 25 of gray color.
wdColorGray30 | 11776947 | Shade 30 of gray color.
wdColorGray35 | 10921638 | Shade 35 of gray color.
wdColorGray375 | 10526880 | Shade 375 of gray color.
wdColorGray40 | 10066329 | Shade 40 of gray color.
wdColorGray45 | 9211020 | Shade 45 of gray color.
wdColorGray50 | 8421504 | Shade 50 of gray color.
wdColorGray55 | 7566195 | Shade 55 of gray color.
wdColorGray60 | 6710886 | Shade 60 of gray color.
wdColorGray625 | 6316128 | Shade 625 of gray color.
wdColorGray65 | 5855577 | Shade 65 of gray color.
wdColorGray70 | 5000268 | Shade 70 of gray color.
wdColorGray75 | 4210752 | Shade 75 of gray color.
wdColorGray80 | 3355443 | Shade 80 of gray color.
wdColorGray85 | 2500134 | Shade 85 of gray color.
wdColorGray875 | 2105376 | Shade 875 of gray color.
wdColorGray90 | 1644825 | Shade 90 of gray color.
wdColorGray95 | 789516 | Shade 95 of gray color.
wdColorGreen | 32768 | Green color.
wdColorIndigo | 10040115 | Indigo color.
wdColorLavender | 16751052 | Lavender color.
wdColorLightBlue | 16737843 | Light blue color.
wdColorLightGreen | 13434828 | Light green color.
wdColorLightOrange | 39423 | Light orange color.
wdColorLightTurquoise | 16777164 | Light turquoise color.
wdColorLightYellow | 10092543 | Light yellow color.
wdColorLime | 52377 | Lime color.
wdColorOliveGreen | 13107 | Olive green color.
wdColorOrange | 26367 | Orange color.
wdColorPaleBlue | 16764057 | Pale blue color.
wdColorPink | 16711935 | Pink color.
wdColorPlum | 6697881 | Plum color.
wdColorRed | 255 | Red color.
wdColorRose | 13408767 | Rose color.
wdColorSeaGreen | 6723891 | Sea green color.
wdColorSkyBlue | 16763904 | Sky blue color.
wdColorTan | 10079487 | Tan color.
wdColorTeal | 8421376 | Teal color.
wdColorTurquoise | 16776960 | Turquoise color.
wdColorViolet | 8388736 | Violet color.
wdColorWhite | 16777215 | White color.
wdColorYellow | 65535 | Yellow color.


WdColorIndex Enumeration (Word)

 Copy code hover
[image]

WdColorIndex Enumeration (Word)
Send feedback

Specifies the color to apply.

Name | Value | Description
wdAuto | 0 | Automatic color. Default; usually black.
wdBlack | 1 | Black color.
wdBlue | 2 | Blue color.
wdBrightGreen | 4 | Bright green color.
wdByAuthor | -1 | Color defined by document author.
wdDarkBlue | 9 | Dark blue color.
wdDarkRed | 13 | Dark red color.
wdDarkYellow | 14 | Dark yellow color.
wdGray25 | 16 | Shade 25 of gray color.
wdGray50 | 15 | Shade 50 of gray color.
wdGreen | 11 | Green color.
wdNoHighlight | 0 | Removes highlighting that has been applied.
wdPink | 5 | Pink color.
wdRed | 6 | Red color.
wdTeal | 10 | Teal color.
wdTurquoise | 3 | Turquoise color.
wdViolet | 12 | Violet color.
wdWhite | 8 | White color.
wdYellow | 7 | Yellow color.


WdColumnWidth Enumeration (Word)

 Copy code hover
[image]

WdColumnWidth Enumeration (Word)
Send feedback

Constants that represent column width in reading layout, passed to and returned by the View.ColumnWidth property.

Version information

Version Added: Word 2013

Members

Name | Value | Description
wdColumnWidthDefault | 2 | Default column width.
wdColumnWidthNarrow | 1 | Narrow column width.
wdColumnWidthWide | 3 | Wide column width.


WdCompareDestination Enumeration (Word)

 Copy code hover
[image]

WdCompareDestination Enumeration (Word)
Send feedback

When comparing two files for differences, specifies whether to create a new file or mark the differences between the two documents in the original document or the revised document.

Version Information

Version Added: Word 2007

Name | Value | Description
wdCompareDestinationNew | 2 | Creates a new file and tracks the diferences between the original document and the revised document using tracked changes.
wdCompareDestinationOriginal | 0 | Tracks the differences between the two files using tracked changes in the original document.
wdCompareDestinationRevised | 1 | Tracks the differences between the two files using tracked changes in the revised document.


WdCompareTarget Enumeration (Word)

 Copy code hover
[image]

WdCompareTarget Enumeration (Word)
Send feedback

Specifies the target document for displaying document comparison differences.

Name | Value | Description
wdCompareTargetCurrent | 1 | Places comparison differences in the current document. Default.
wdCompareTargetNew | 2 | Places comparison differences in a new document.
wdCompareTargetSelected | 0 | Places comparison differences in the target document.


WdCompatibility Enumeration (Word)

 Copy code hover
[image]

WdCompatibility Enumeration (Word)
Send feedback

Specifies a compatibility option.

Name | Value | Description
wdAlignTablesRowByRow | 39 | Align table rows independently.
wdApplyBreakingRules | 46 | Use line-breaking rules.
wdAutospaceLikeWW7 | 38 | Autospace like Microsoft Word 95.
wdConvMailMergeEsc | 6 | Treat \" as "" in mail merge data sources.
wdDontAdjustLineHeightInTable | 36 | Adjust line height to grid height in the table.
wdDontBalanceSingleByteDoubleByteWidth | 16 | Balance SBCS characters and DBCS characters.
wdDontBreakWrappedTables | 43 | Do not break wrapped tables across pages.
wdDontSnapTextToGridInTableWithObjects | 44 | Do not snap text to grid inside table with inline objects.
wdDontULTrailSpace | 15 | Draw underline on trailing spaces.
wdDontUseAsianBreakRulesInGrid | 48 | Do not use Asian rules for line breaks with character grid.
wdDontUseHTMLParagraphAutoSpacing | 35 | Do not use HTML paragraph auto spacing.
wdDontWrapTextWithPunctuation | 47 | Do not allow hanging punctuation with character grid.
wdExactOnTop | 28 | Do not center "exact line height" lines.
wdExpandShiftReturn | 14 | Do not expand character spaces on the line ending Shift+Return.
wdFootnoteLayoutLikeWW8 | 34 | Lay out footnotes like Word 6.x/95/97.
wdForgetLastTabAlignment | 37 | Forget last tab alignment.
wdGrowAutofit | 50 | Allow tables to extend into margins.
wdLayoutRawTableWidth | 40 | Lay out tables with raw width.
wdLayoutTableRowsApart | 41 | Allow table rows to lay out apart.
wdLeaveBackslashAlone | 13 | Convert backslash characters into yen signs.
wdLineWrapLikeWord6 | 32 | Line wrap like Word 6.0.
wdMWSmallCaps | 22 | Use larger small caps like Word 5.x for the Macintosh.
wdNoColumnBalance | 5 | Do not balance columns for continuous section starts.
wdNoExtraLineSpacing | 23 | Suppress extra line spacing like WordPerfect 5.x.
wdNoLeading | 20 | Do not add leading (extra space) between rows of text.
wdNoSpaceForUL | 21 | Add space for underline.
wdNoSpaceRaiseLower | 2 | Do not add extra space for raised/lowered characters.
wdNoTabHangIndent | 1 | Do not add automatic tab stop for hanging indent.
wdOrigWordTableRules | 9 | Combine table borders like Word 5.x for the Macintosh.
wdPrintBodyTextBeforeHeader | 19 | Print body text before header/footer.
wdPrintColBlack | 3 | Print colors as black on noncolor printers.
wdSelectFieldWithFirstOrLastCharacter | 45 | Select entire field with first or last character.
wdShapeLayoutLikeWW8 | 33 | Lay out autoshapes like Word 97.
wdShowBreaksInFrames | 11 | Show hard page or column breaks in frames.
wdSpacingInWholePoints | 18 | Expand/condense by whole number of points.
wdSubFontBySize | 25 | Substitute fonts based on font size.
wdSuppressBottomSpacing | 29 | Suppress extra line spacing at bottom of page.
wdSuppressSpBfAfterPgBrk | 7 | Suppress Space Before after a hard page or column break.
wdSuppressTopSpacing | 8 | Suppress extra line spacing at top of page.
wdSuppressTopSpacingMac5 | 17 | Suppress extra line spacing at top of page like Word 5.x for the Macintosh.
wdSwapBordersFacingPages | 12 | Swap left and right borders on odd facing pages.
wdTransparentMetafiles | 10 | Do not blank the area behind metafile pictures.
wdTruncateFontHeight | 24 | Truncate font height.
wdUsePrinterMetrics | 26 | Use printer metrics to lay out document.
wdUseWord2002TableStyleRules | 49 | Use Microsoft Word 2002 table style rules.
wdUseWord2010TableStyleRules |  | Use Microsoft Word 2010 table style rules.
wdUseWord97LineBreakingRules | 42 | Use Microsoft Word 97 line breaking rules for Asian text.
wdWPJustification | 31 | Do full justification like WordPerfect 6.x for Windows.
wdWPSpaceWidth | 30 | Set the width of a space like WordPerfect 5.x.
wdWrapTrailSpaces | 4 | Wrap trailing spaces to next line.
wdWW6BorderRules | 27 | Use Word 6.x/95 border rules.
wdAllowSpaceOfSameStyleInTable | 54 | Allow space between paragraphs of the same style in a table.
wdAutofitLikeWW11 | 57 | Use Microsoft Word 2003 table autofit rules.
wdDontAutofitConstrainedTables | 56 | Do not autofit tables next to wrapped objects.
wdDontUseIndentAsNumberingTabStop | 52 | Do not use hanging indent as tab stop for bullets and numbering.
wdFELineBreak11 | 53 | Use Word 2003 hanging-punctuation rules in Asian langauges.
wdHangulWidthLikeWW11 | 59 | Do not use proportional width for Korean characters.
wdSplitPgBreakAndParaMark | 60 | Split apart page break and paragraph mark.
wdUnderlineTabInNumList | 58 | Underline the tab character between the number and the text in numbered lists.
wdUseNormalStyleForList | 51 | Use the Normal style instead of the List Paragraph style for bulleted or numbered lists.
wdWW11IndentRules | 55 | Use Word 2003 indent rules for text next to wrapped objects.


WdCompatibilityMode Enumeration (Word)

 Copy code hover
[image]

WdCompatibilityMode Enumeration (Word)
Send feedback

Specifies the compatibility mode that Word 2010 uses when opening a document.

Name | Value | Description
wdCurrent | 65535 | Compatibility mode equivalent to the latest version of Microsoft Word.
wdWord2003 | 11 | Word 2010 is put into a mode that is most compatible with Word 2003. Features new to Word 2010 are disabled in this mode.
wdWord2007 | 12 | Word 2010 is put into a mode that is most compatible with Office Word 2007. Features new to Word 2010are disabled in this mode.
wdWord2010 | 14 | Word 2013 is put into a mode that is most compatible with . Features new to Word 2013are disabled in this mode.
wdWord2013 | 15 | Default. All Word 2013 features are enabled.


WdConditionCode Enumeration (Word)

 Copy code hover
[image]

WdConditionCode Enumeration (Word)
Send feedback

Specifies the area of a table to which to apply special style formatting.

Name | Value | Description
wdEvenColumnBanding | 7 | Applies formatting to even-numbered columns.
wdEvenRowBanding | 3 | Applies formatting to even-numbered rows.
wdFirstColumn | 4 | Applies formatting to the first column in a table.
wdFirstRow | 0 | Applies formatting to the first row in a table.
wdLastColumn | 5 | Applies formatting to the last column in a table.
wdLastRow | 1 | Applies formatting to the last row in a table.
wdNECell | 8 | Applies formatting to the last cell in the first row.
wdNWCell | 9 | Applies formatting to the first cell in the first row.
wdOddColumnBanding | 6 | Applies formatting to odd-numbered columns.
wdOddRowBanding | 2 | Applies formatting to odd-numbered rows.
wdSECell | 10 | Applies formatting to the last cell in the table.
wdSWCell | 11 | Applies formatting to first cell in the last row of the table.


WdConstants Enumeration (Word)

 Copy code hover
[image]

WdConstants Enumeration (Word)
Send feedback

This enumeration groups together constants used with various Microsoft Word methods.

Name | Value | Description
wdAutoPosition | 0 | Represents the Auto value for the specified setting.
wdBackward | -1073741823 | Indicates that selection will be extended backward using the MoveStartUntil or MoveStartWhile method of the Range or Selection object.
wdCreatorCode | 1297307460 | Represents the creator code for objects created by Microsoft Word.
wdFirst | 1 | Represents the first item in a collection.
wdForward | 1073741823 | Indicates that selection will be extended forward using the MoveStartUntil or MoveStartWhile method of the Range or Selection object.
wdToggle | 9999998 | Toggles a property's value.
wdUndefined | 9999999 | Represents an undefined value.


WdContentControlAppearance Enumeration (Word)

 Copy code hover
[image]

WdContentControlAppearance Enumeration (Word)
Send feedback

Constants that represent the visualizations for a content control, passed to and returned by the ContentControl.Appearance property.

Version information

Version Added: Word 2013

Members

Name | Value | Description
wdContentControlBoundingBox | 0 | Represents a content control shown as a shaded rectangle or bounding box (with optional title).
wdContentControlTags | 2 | Represents a content control shown as start and end markers.
wdContentControlHidden | 1 | Represents a content control that is not shown.


WdContentControlDateStorageFormat Enumeration (Word)

 Copy code hover
[image]

WdContentControlDateStorageFormat Enumeration (Word)
Send feedback

Indicates how the date for a date content control is stored or retrieved when the date control is bound to an XML node in the document's data store.

Name | Value | Description
wdContentControlDateStorageDate | 1 | Specifies to store or retrieve the date value for a date content control as a date in the standard XML Schema DateTime format.
wdContentControlDateStorageDateTime | 2 | Specifies to store or retrieve the date value for a date content control as a time in the standard XML Schema DateTime format.
wdContentControlDateStorageText | 0 | Specifies to store or retrieve the date value for a date content control as text.


WdContentControlLevel Enumeration (Word)

 Copy code hover
[image]

WdContentControlLevel Enumeration (Word)
Send feedback

Constants that represent the possible levels for a content control, returned by the ContentControl.Level property.

Version information

Version Added: Word 2013

Members

Name | Value | Description
wdContentControlLevelCell | 3 | Represents a content control that surrounds a table cell.
wdContentControlLevelInline | 0 | Represents a content control that surrounds content within a single paragraph.
wdContentControlLevelParagraph | 1 | Represents a content control that surrounds one or more complete paragraphs.
wdContentControlLevelRow | 2 | Represents a content control that surrounds a table row.


WdContentControlType Enumeration (Word)

 Copy code hover
[image]

WdContentControlType Enumeration (Word)
Send feedback

Indicates the type of content control.

Version Information

Version Added: Word 2007

Name | Value | Description
wdContentControlBuildingBlockGallery | 5 | Specifies a building block gallery content control.
wdContentControlCheckbox | 8 | Specifies a checkbox content control.
wdContentControlComboBox | 3 | Specifies a combo box content control.
wdContentControlDate | 6 | Specifies a date content control.
wdContentControlGroup | 7 | Specifies a group content control.
wdContentControlDropdownList | 4 | Specifies a drop-down list content control.
wdContentControlPicture | 2 | Specifies a picture content control.
wdContentControlRepeatingSection | 9 | Specifies a repeating section content control.
wdContentControlRichText | 0 | Specifies a rich-text content control.
wdContentControlText | 1 | Specifies a text content control


WdContinue Enumeration (Word)

 Copy code hover
[image]

WdContinue Enumeration (Word)
Send feedback

Specifies whether the formatting from the previous list can be continued.

Name | Value | Description
wdContinueDisabled | 0 | Formatting cannot continue from the previous list.
wdContinueList | 2 | Formatting can continue from the previous list.
wdResetList | 1 | Numbering can be restarted.


WdCountry Enumeration (Word)

 Copy code hover
[image]

WdCountry Enumeration (Word)
Send feedback

Specifies the country/region setting of the current system.

Name | Value | Description
wdArgentina | 54 | Argentina
wdBrazil | 55 | Brazil
wdCanada | 2 | Canada
wdChile | 56 | Chile
wdChina | 86 | China
wdDenmark | 45 | Denmark
wdFinland | 358 | Finland
wdFrance | 33 | France
wdGermany | 49 | Germany
wdIceland | 354 | Iceland
wdItaly | 39 | Italy
wdJapan | 81 | Japan
wdKorea | 82 | Korea
wdLatinAmerica | 3 | Latin America
wdMexico | 52 | Mexico
wdNetherlands | 31 | Netherlands
wdNorway | 47 | Norway
wdPeru | 51 | Peru
wdSpain | 34 | Spain
wdSweden | 46 | Sweden
wdTaiwan | 886 | Taiwan
wdUK | 44 | United Kingdom
wdUS | 1 | United States
wdVenezuela | 58 | Venezuela


WdCursorMovement Enumeration (Word)

 Copy code hover
[image]

WdCursorMovement Enumeration (Word)
Send feedback

Specifies how the insertion point progresses within bidirectional text.

Name | Value | Description
wdCursorMovementLogical | 0 | Insertion point progresses according to the direction of the language Microsoft Word detects.
wdCursorMovementVisual | 1 | Insertion point progresses to the next visually adjacent character.


WdCursorType Enumeration (Word)

 Copy code hover
[image]

WdCursorType Enumeration (Word)
Send feedback

Specifies the state (shape) of the cursor.

Name | Value | Description
wdCursorIBeam | 1 | I-beam cursor shape.
wdCursorNormal | 2 | Normal cursor shape. Default; cursor takes shape designated by Microsoft Windows or the application.
wdCursorNorthwestArrow | 3 | Diagonal cursor shape starting at upper-left corner.
wdCursorWait | 0 | Hourglass cursor shape.


WdCustomLabelPageSize Enumeration (Word)

 Copy code hover
[image]

WdCustomLabelPageSize Enumeration (Word)
Send feedback

Specifies the page size for a custom mailing label.

Name | Value | Description
wdCustomLabelA4 | 2 | A4 portrait label dimensions.
wdCustomLabelA4LS | 3 | A4 landscape label dimensions.
wdCustomLabelA5 | 4 | A5 portrait label dimensions.
wdCustomLabelA5LS | 5 | A5 landscape label dimensions.
wdCustomLabelB4JIS | 13 | B4 JIS label dimensions.
wdCustomLabelB5 | 6 | B5 label dimensions.
wdCustomLabelFanfold | 8 | Fanfold label dimensions.
wdCustomLabelHigaki | 11 | Higaki portrait label dimensions.
wdCustomLabelHigakiLS | 12 | Higaki landscape label dimensions.
wdCustomLabelLetter | 0 | Standard letter portrait label dimensions.
wdCustomLabelLetterLS | 1 | Standard letter landscape label dimensions.
wdCustomLabelMini | 7 | Mini label dimensions.
wdCustomLabelVertHalfSheet | 9 | Half-sheet portrait label dimensions.
wdCustomLabelVertHalfSheetLS | 10 | Half-sheet landscape label dimensions.


WdDateLanguage Enumeration (Word)

 Copy code hover
[image]

WdDateLanguage Enumeration (Word)
Send feedback

Specifies the language format to apply to the current date, time, or both.

Name | Value | Description
wdDateLanguageBidi | 10 | Bidirectional date/time format.
wdDateLanguageLatin | 1033 | Latin date/time format.


WdDefaultFilePath Enumeration (Word)

 Copy code hover
[image]

WdDefaultFilePath Enumeration (Word)
Send feedback

Specifies a default folder for files related to Microsoft Word.

Name | Value | Description
wdAutoRecoverPath | 5 | Path for Auto Recover files.
wdBorderArtPath | 19 | Border art path.
wdCurrentFolderPath | 14 | Current folder path.
wdDocumentsPath | 0 | Documents path.
wdGraphicsFiltersPath | 10 | Graphics filters path.
wdPicturesPath | 1 | Pictures path.
wdProgramPath | 9 | Program path.
wdProofingToolsPath | 12 | Proofing tools path.
wdStartupPath | 8 | Startup path.
wdStyleGalleryPath | 15 | Style Gallery path.
wdTempFilePath | 13 | Temp file path.
wdTextConvertersPath | 11 | Text converters path.
wdToolsPath | 6 | Tools path.
wdTutorialPath | 7 | Tutorial path.
wdUserOptionsPath | 4 | User Options path.
wdUserTemplatesPath | 2 | User templates path.
wdWorkgroupTemplatesPath | 3 | Workgroup templates path.


WdDefaultListBehavior Enumeration (Word)

 Copy code hover
[image]

WdDefaultListBehavior Enumeration (Word)
Send feedback

Specifies the default list behavior for a list.

Name | Value | Description
wdWord10ListBehavior | 2 | Use formatting compatible with Microsoft Word 2002.
wdWord8ListBehavior | 0 | Use formatting compatible with Microsoft Word 97.
wdWord9ListBehavior | 1 | Use Web-oriented formatting as introduced in Microsoft Word 2000.


WdDefaultTableBehavior Enumeration (Word)

 Copy code hover
[image]

WdDefaultTableBehavior Enumeration (Word)
Send feedback

Specifies whether Microsoft Word automatically resizes cells in a table to fit the contents (AutoFit).

Name | Value | Description
wdWord8TableBehavior | 0 | Disables AutoFit. Default.
wdWord9TableBehavior | 1 | Enables AutoFit.


WdDeleteCells Enumeration (Word)

 Copy code hover
[image]

WdDeleteCells Enumeration (Word)
Send feedback

Specifies a range of cells to be deleted from a table in a delete cells action or the behavior of the remaining cells after the deletion has occurred.

Name | Value | Description
wdDeleteCellsEntireColumn | 3 | Delete the entire column of cells from the table.
wdDeleteCellsEntireRow | 2 | Delete the entire row of cells from the table.
wdDeleteCellsShiftLeft | 0 | Shift remaining cells left in the row where the deletion occurred after a cell or range of cells has been deleted.
wdDeleteCellsShiftUp | 1 | Shift remaining cells up in the column where the deletion occurred after a cell or range of cells has been deleted.


WdDeletedTextMark Enumeration (Word)

 Copy code hover
[image]

WdDeletedTextMark Enumeration (Word)
Send feedback

Specifies the formatting of text that is deleted while change tracking is enabled.

Name | Value | Description
wdDeletedTextMarkBold | 5 | Deleted text is displayed in bold.
wdDeletedTextMarkCaret | 2 | Deleted text is marked up by using caret characters.
wdDeletedTextMarkColorOnly | 9 | Deleted text is displayed in a specified color (default is red).
wdDeletedTextMarkDoubleUnderline | 8 | Deleted text is marked up by using double-underline characters.
wdDeletedTextMarkHidden | 0 | Deleted text is hidden.
wdDeletedTextMarkItalic | 6 | Deleted text is displayed in italic.
wdDeletedTextMarkNone | 4 | Deleted text is not marked up.
wdDeletedTextMarkPound | 3 | Deleted text is marked up by using pound characters.
wdDeletedTextMarkStrikeThrough | 1 | Deleted text is marked up by using strikethrough characters.
wdDeletedTextMarkUnderline | 7 | Deleted text is underlined.
wdDeletedTextMarkDoubleStrikeThrough | 10 | Deleted text is marked up by using double-strikethrough characters.


WdDiacriticColor Enumeration (Word)

 Copy code hover
[image]

WdDiacriticColor Enumeration (Word)
Send feedback

Specifies whether to apply a different color to diacritics in bi-directional or Latin style languages.

Name | Value | Description
wdDiacriticColorBidi | 0 | Bi-directional language (Arabic, Hebrew, and so forth).
wdDiacriticColorLatin | 1 | Latin style languages.


WdDictionaryType Enumeration (Word)

 Copy code hover
[image]

WdDictionaryType Enumeration (Word)
Send feedback

Specifies a proofing tool type.

Name | Value | Description
wdGrammar | 1 | Grammar.
wdHangulHanjaConversion | 8 | Dictionary for converting between Hangul and Hanja. Available only if you have enabled support for Korean through Microsoft Office Language Settings.
wdHangulHanjaConversionCustom | 9 | Custom dictionary for converting between Hangul and Hanja.
wdHyphenation | 3 | Hyphenation.
wdSpelling | 0 | Spelling.
wdSpellingComplete | 4 | Not supported.
wdSpellingCustom | 5 | Custom spelling dictionary.
wdSpellingLegal | 6 | Legal dictionary.
wdSpellingMedical | 7 | Medical dictionary.
wdThesaurus | 2 | Thesaurus.


WdDisableFeaturesIntroducedAfter Enumeration (Word)

 Copy code hover
[image]

WdDisableFeaturesIntroducedAfter Enumeration (Word)
Send feedback

Specifies the version of Microsoft Word for which to disable all features introduced after that version.

Name | Value | Description
wd70 | 0 | Specifies Word for Windows 95, versions 7.0 and 7.0a.
wd70FE | 1 | Specifies Word for Windows 95, versions 7.0 and 7.0a, Asian edition.
wd80 | 2 | Specifies Word 97 for Windows. Default.


WdDocPartInsertOptions Enumeration (Word)

 Copy code hover
[image]

WdDocPartInsertOptions Enumeration (Word)
Send feedback

Specifies how a building block is inserted into a document.

Name | Value | Description
wdInsertContent | 0 | Inline building block.
wdInsertPage | 2 | Page-level building block.
wdInsertParagraph | 1 | Paragraph-level building block.


WdDocumentDirection Enumeration (Word)

 Copy code hover
[image]

WdDocumentDirection Enumeration (Word)
Send feedback

Specifies the direction to flow the text in a document.

Name | Value | Description
wdLeftToRight | 0 | Left to right.
wdRightToLeft | 1 | Right to left.


WdDocumentKind Enumeration (Word)

 Copy code hover
[image]

WdDocumentKind Enumeration (Word)
Send feedback

Specifies the format type that Microsoft Word uses when automatically formatting a document.

Name | Value | Description
wdDocumentEmail | 2 | E-mail format.
wdDocumentLetter | 1 | Letter format.
wdDocumentNotSpecified | 0 | No format specified.


WdDocumentMedium Enumeration (Word)

 Copy code hover
[image]

WdDocumentMedium Enumeration (Word)
Send feedback

Specifies the type of document to which you are applying a theme.

Name | Value | Description
wdDocument | 1 | Document.
wdEmailMessage | 0 | E-mail message.
wdWebPage | 2 | Web page.


WdDocumentType Enumeration (Word)

 Copy code hover
[image]

WdDocumentType Enumeration (Word)
Send feedback

Specifies a document type.

Name | Value | Description
wdTypeDocument | 0 | Document.
wdTypeFrameset | 2 | Frameset.
wdTypeTemplate | 1 | Template.


WdDocumentViewDirection Enumeration (Word)

 Copy code hover
[image]

WdDocumentViewDirection Enumeration (Word)
Send feedback

Specifies the alignment and reading order for the entire document.

Name | Value | Description
wdDocumentViewLtr | 1 | Displays the document with left alignment and left-to-right reading order.
wdDocumentViewRtl | 0 | Displays the document with right alignment and right-to-left reading order.


WdDropPosition Enumeration (Word)

 Copy code hover
[image]

WdDropPosition Enumeration (Word)
Send feedback

Specifies the position of a dropped capital letter.

Name | Value | Description
wdDropMargin | 2 | Dropped capital letter ends at the left margin.
wdDropNone | 0 | No dropped capital letter.
wdDropNormal | 1 | Dropped capital letter begins at the left margin.


WdEditionOption Enumeration (Word)

 Copy code hover
[image]

WdEditionOption Enumeration (Word)
Send feedback

This enumeration has been deprecated and should not be used.

Name | Value | Description
wdAutomaticUpdate | 3 | Not supported.
wdCancelPublisher | 0 | Not supported.
wdChangeAttributes | 5 | Not supported.
wdManualUpdate | 4 | Not supported.
wdOpenSource | 7 | Not supported.
wdSelectPublisher | 2 | Not supported.
wdSendPublisher | 1 | Not supported.
wdUpdateSubscriber | 6 | Not supported.


WdEditionType Enumeration (Word)

 Copy code hover
[image]

WdEditionType Enumeration (Word)
Send feedback

This enumeration has been deprecated and should not be used.

Name | Value | Description
wdPublisher | 0 | Not supported.
wdSubscriber | 1 | Not supported.


WdEditorType Enumeration (Word)

 Copy code hover
[image]

WdEditorType Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies a user or group of users for a document.

Name | Value | Description
wdEditorCurrent | -6 | Represents the current user of the document.
wdEditorEditors | -5 | Represents the Editors group for documents that use Information Rights Management.
wdEditorEveryone | -1 | Represents all users who open a document.
wdEditorOwners | -4 | Represents the Owners group for documents that use Information Rights Management.


WdEmailHTMLFidelity Enumeration (Word)

 Copy code hover
[image]

WdEmailHTMLFidelity Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies whether to leave or remove HTML tags not required for display.

Name | Value | Description
wdEmailHTMLFidelityHigh | 3 | Leaves HTML intact.
wdEmailHTMLFidelityLow | 1 | Removes all HTML tags that do not affect how a message displays.
wdEmailHTMLFidelityMedium | 2 | Not supported.


WdEmphasisMark Enumeration (Word)

 Copy code hover
[image]

WdEmphasisMark Enumeration (Word)
Send feedback

Specifies the type of emphasis mark to use for a character or designated character string.

Name | Value | Description
wdEmphasisMarkNone | 0 | No emphasis mark.
wdEmphasisMarkOverComma | 2 | A comma.
wdEmphasisMarkOverSolidCircle | 1 | A solid black circle.
wdEmphasisMarkOverWhiteCircle | 3 | An empty white circle.
wdEmphasisMarkUnderSolidCircle | 4 | A solid black circle.


WdEnableCancelKey Enumeration (Word)

 Copy code hover
[image]

WdEnableCancelKey Enumeration (Word)
Send feedback

Specifies whether CTRL+BREAK can or cannot interrupt a macro

Name | Value | Description
wdCancelDisabled | 0 | Prevents CTRL+BREAK from interrupting a macro.
wdCancelInterrupt | 1 | Allows a macro to be interrupted by CTRL+BREAK.


WdEncloseStyle Enumeration (Word)

 Copy code hover
[image]

WdEncloseStyle Enumeration (Word)
Send feedback

Specifies the relative size of an enclosure.

Name | Value | Description
wdEncloseStyleLarge | 2 | The enclosure is larger.
wdEncloseStyleNone | 0 | The enclosure assumes the default size.
wdEncloseStyleSmall | 1 | The enclosure is smaller.


WdEnclosureType Enumeration (Word)

 Copy code hover
[image]

WdEnclosureType Enumeration (Word)
Send feedback

Specifies the type of symbol to use as an enclosure.

Name | Value | Description
wdEnclosureCircle | 0 | A circle.
wdEnclosureDiamond | 3 | A diamond.
wdEnclosureSquare | 1 | A square.
wdEnclosureTriangle | 2 | A triangle.


WdEndnoteLocation Enumeration (Word)

 Copy code hover
[image]

WdEndnoteLocation Enumeration (Word)
Send feedback

Specifies the position of endnotes.

Name | Value | Description
wdEndOfDocument | 1 | At end of active document.
wdEndOfSection | 0 | At end of current section.


WdEnvelopeOrientation Enumeration (Word)

 Copy code hover
[image]

WdEnvelopeOrientation Enumeration (Word)
Send feedback

Specifies the orientation of envelopes.

Name | Value | Description
wdCenterClockwise | 7 | Center clockwise orientation.
wdCenterLandscape | 4 | Center landscape orientation.
wdCenterPortrait | 1 | Center portrait orientation.
wdLeftClockwise | 6 | Left clockwise orientation.
wdLeftLandscape | 3 | Left landscape orientation.
wdLeftPortrait | 0 | Left portrait orientation.
wdRightClockwise | 8 | Right clockwise orientation.
wdRightLandscape | 5 | Right landscape orientation.
wdRightPortrait | 2 | Right portrait orientation.


WdExportCreateBookmarks Enumeration (Word)

 Copy code hover
[image]

WdExportCreateBookmarks Enumeration (Word)
Send feedback

Specifies what bookmarks to include when exporting a document.

Name | Value | Description
wdExportCreateHeadingBookmarks | 1 | Create a bookmark in the exported document for each Microsoft Word heading, which includes only headings within the main document and text boxes not within headers, footers, endnotes, footnotes, or comments.
wdExportCreateNoBookmarks | 0 | Do not create bookmarks in the exported document.
wdExportCreateWordBookmarks | 2 | Create a bookmark in the exported document for each Word bookmark, which includes all bookmarks except those contained within headers and footers.


WdExportFormat Enumeration (Word)

 Copy code hover
[image]

WdExportFormat Enumeration (Word)
Send feedback

Specifies format to use for exporting a document.

Name | Value | Description
wdExportFormatPDF | 17 | Export document into PDF format.
wdExportFormatXPS | 18 | Export document into XML Paper Specification (XPS) format.


WdExportItem Enumeration (Word)

 Copy code hover
[image]

WdExportItem Enumeration (Word)
Send feedback

Specifies whether to export the document with markup.

Name | Value | Description
wdExportDocumentContent | 0 | Exports the document without markup.
wdExportDocumentWithMarkup | 7 | Exports the document with markup.


WdExportOptimizeFor Enumeration (Word)

 Copy code hover
[image]

WdExportOptimizeFor Enumeration (Word)
Send feedback

Specifies the resolution and quality of the exported document.

Name | Value | Description
wdExportOptimizeForOnScreen | 1 | Export for screen, which is a lower quality and results in a smaller file size.
wdExportOptimizeForPrint | 0 | Export for print, which is higher quailty and results in a larger file size.


WdExportRange Enumeration (Word)

 Copy code hover
[image]

WdExportRange Enumeration (Word)
Send feedback

Specifies how much of the document to export.

Name | Value | Description
wdExportAllDocument | 0 | Exports the entire document.
wdExportCurrentPage | 2 | Exports the current page.
wdExportFromTo | 3 | Exports the contents of a range using the starting and ending positions.
wdExportSelection | 1 | Exports the contents of the current selection.


WdFarEastLineBreakLanguageID Enumeration (Word)

 Copy code hover
[image]

WdFarEastLineBreakLanguageID Enumeration (Word)
Send feedback

Specifies the East Asian language to use when breaking lines of text in the specified document or template.

Name | Value | Description
wdLineBreakJapanese | 1041 | Japanese.
wdLineBreakKorean | 1042 | Korean.
wdLineBreakSimplifiedChinese | 2052 | Simplified Chinese.
wdLineBreakTraditionalChinese | 1028 | Traditional Chinese.


WdFarEastLineBreakLevel Enumeration (Word)

 Copy code hover
[image]

WdFarEastLineBreakLevel Enumeration (Word)
Send feedback

Specifies the line break control level for the specified document.

Name | Value | Description
wdFarEastLineBreakLevelCustom | 2 | Custom line break control.
wdFarEastLineBreakLevelNormal | 0 | Normal line break control.
wdFarEastLineBreakLevelStrict | 1 | Strict line break control.


WdFieldKind Enumeration (Word)

 Copy code hover
[image]

WdFieldKind Enumeration (Word)
Send feedback

Specifies the type of field for a Field object.

Name | Value | Description
wdFieldKindCold | 3 | A field that does not have a result, for example, an Index Entry (XE), Table of Contents Entry (TC), or Private field.
wdFieldKindHot | 1 | A field that's automatically updated each time it is displayed or each time the page is reformatted, but which can also be manually updated (for example, INCLUDEPICTURE or FORMDROPDOWN).
wdFieldKindNone | 0 | An invalid field (for example, a pair of field characters with nothing inside).
wdFieldKindWarm | 2 | A field that can be updated and has a result. This type includes fields that are automatically updated when the source changes and fields that can be manually updated (for example, DATE or INCLUDETEXT).


WdFieldShading Enumeration (Word)

 Copy code hover
[image]

WdFieldShading Enumeration (Word)
Send feedback

Specifies when to apply on-screen shading for form fields.

Name | Value | Description
wdFieldShadingAlways | 1 | Always apply.
wdFieldShadingNever | 0 | Never apply.
wdFieldShadingWhenSelected | 2 | Apply only when form field is selected.


WdFieldType Enumeration (Word)

 Copy code hover
[image]

WdFieldType Enumeration (Word)
Send feedback

Specifies a Microsoft Word field. Unless otherwise specified, the field types described in this enumeration can be added interactively to a Word document by using the Field dialog box. See the Word Help for more information about specific field codes.

Name | Value | Description
wdFieldAddin | 81 | Add-in field. Not available through the Field dialog box. Used to store data that is hidden from the user interface.
wdFieldAddressBlock | 93 | AddressBlock field.
wdFieldAdvance | 84 | Advance field.
wdFieldAsk | 38 | Ask field.
wdFieldAuthor | 17 | Author field.
wdFieldAutoNum | 54 | AutoNum field.
wdFieldAutoNumLegal | 53 | AutoNumLgl field.
wdFieldAutoNumOutline | 52 | AutoNumOut field.
wdFieldAutoText | 79 | AutoText field.
wdFieldAutoTextList | 89 | AutoTextList field.
wdFieldBarCode | 63 | BarCode field.
wdFieldBidiOutline | 92 | BidiOutline field.
wdFieldComments | 19 | Comments field.
wdFieldCompare | 80 | Compare field.
wdFieldCreateDate | 21 | CreateDate field.
wdFieldData | 40 | Data field.
wdFieldDatabase | 78 | Database field.
wdFieldDate | 31 | Date field.
wdFieldDDE | 45 | DDE field. No longer available through the Field dialog box, but supported for documents created in earlier versions of Word.
wdFieldDDEAuto | 46 | DDEAuto field. No longer available through the Field dialog box, but supported for documents created in earlier versions of Word.
wdFieldDisplayBarcode | 99 | DisplayBarcode field.
wdFieldDocProperty | 85 | DocProperty field.
wdFieldDocVariable | 64 | DocVariable field.
wdFieldEditTime | 25 | EditTime field.
wdFieldEmbed | 58 | Embedded field.
wdFieldEmpty | -1 | Empty field. Acts as a placeholder for field content that has not yet been added. A field added by pressing Ctrl+F9 in the user interface is an Empty field.
wdFieldExpression | 34 | = (Formula) field.
wdFieldFileName | 29 | FileName field.
wdFieldFileSize | 69 | FileSize field.
wdFieldFillIn | 39 | Fill-In field.
wdFieldFootnoteRef | 5 | FootnoteRef field. Not available through the Field dialog box. Inserted programmatically or interactively.
wdFieldFormCheckBox | 71 | FormCheckBox field.
wdFieldFormDropDown | 83 | FormDropDown field.
wdFieldFormTextInput | 70 | FormText field.
wdFieldFormula | 49 | EQ (Equation) field.
wdFieldGlossary | 47 | Glossary field. No longer supported in Word.
wdFieldGoToButton | 50 | GoToButton field.
wdFieldGreetingLine | 94 | GreetingLine field.
wdFieldHTMLActiveX | 91 | HTMLActiveX field. Not currently supported.
wdFieldHyperlink | 88 | Hyperlink field.
wdFieldIf | 7 | If field.
wdFieldImport | 55 | Import field. Cannot be added through the Field dialog box, but can be added interactively or through code.
wdFieldInclude | 36 | Include field. Cannot be added through the Field dialog box, but can be added interactively or through code.
wdFieldIncludePicture | 67 | IncludePicture field.
wdFieldIncludeText | 68 | IncludeText field.
wdFieldIndex | 8 | Index field.
wdFieldIndexEntry | 4 | XE (Index Entry) field.
wdFieldInfo | 14 | Info field.
wdFieldKeyWord | 18 | Keywords field.
wdFieldLastSavedBy | 20 | LastSavedBy field.
wdFieldLink | 56 | Link field.
wdFieldListNum | 90 | ListNum field.
wdFieldMacroButton | 51 | MacroButton field.
wdFieldMergeBarcode | 98 | MergeBarcode field.
wdFieldMergeField | 59 | MergeField field.
wdFieldMergeRec | 44 | MergeRec field.
wdFieldMergeSeq | 75 | MergeSeq field.
wdFieldNext | 41 | Next field.
wdFieldNextIf | 42 | NextIf field.
wdFieldNoteRef | 72 | NoteRef field.
wdFieldNumChars | 28 | NumChars field.
wdFieldNumPages | 26 | NumPages field.
wdFieldNumWords | 27 | NumWords field.
wdFieldOCX | 87 | OCX field. Cannot be added through the Field dialog box, but can be added through code by using the AddOLEControl method of the Shapes collection or of the InlineShapes collection.
wdFieldPage | 33 | Page field.
wdFieldPageRef | 37 | PageRef field.
wdFieldPrint | 48 | Print field.
wdFieldPrintDate | 23 | PrintDate field.
wdFieldPrivate | 77 | Private field.
wdFieldQuote | 35 | Quote field.
wdFieldRef | 3 | Ref field.
wdFieldRefDoc | 11 | RD (Reference Document) field.
wdFieldRevisionNum | 24 | RevNum field.
wdFieldSaveDate | 22 | SaveDate field.
wdFieldSection | 65 | Section field.
wdFieldSectionPages | 66 | SectionPages field.
wdFieldSequence | 12 | Seq (Sequence) field.
wdFieldSet | 6 | Set field.
wdFieldShape | 95 | Shape field. Automatically created for any drawn picture.
wdFieldSkipIf | 43 | SkipIf field.
wdFieldStyleRef | 10 | StyleRef field.
wdFieldSubject | 16 | Subject field.
wdFieldSubscriber | 82 | Macintosh only. For information about this constant, consult the language reference Help included with Microsoft Office Macintosh Edition.
wdFieldSymbol | 57 | Symbol field.
wdFieldTemplate | 30 | Template field.
wdFieldTime | 32 | Time field.
wdFieldTitle | 15 | Title field.
wdFieldTOA | 73 | TOA (Table of Authorities) field.
wdFieldTOAEntry | 74 | TOA (Table of Authorities Entry) field.
wdFieldTOC | 13 | TOC (Table of Contents) field.
wdFieldTOCEntry | 9 | TOC (Table of Contents Entry) field.
wdFieldUserAddress | 62 | UserAddress field.
wdFieldUserInitials | 61 | UserInitials field.
wdFieldUserName | 60 | UserName field.
wdFieldBibliography | 97 | Bibliography field.
wdFieldCitation | 96 | Citation field.


WdFindMatch Enumeration (Word)

 Copy code hover
[image]

WdFindMatch Enumeration (Word)
Send feedback

This enumeration has been deprecated and should not be used.

Name | Value | Description
wdMatchAnyCharacter | 65599 | Not supported.
wdMatchAnyDigit | 65567 | Not supported.
wdMatchAnyLetter | 65583 | Not supported.
wdMatchCaretCharacter | 11 | Not supported.
wdMatchColumnBreak | 14 | Not supported.
wdMatchCommentMark | 5 | Not supported.
wdMatchEmDash | 8212 | Not supported.
wdMatchEnDash | 8211 | Not supported.
wdMatchEndnoteMark | 65555 | Not supported.
wdMatchField | 19 | Not supported.
wdMatchFootnoteMark | 65554 | Not supported.
wdMatchGraphic | 1 | Not supported.
wdMatchManualLineBreak | 65551 | Not supported.
wdMatchManualPageBreak | 65564 | Not supported.
wdMatchNonbreakingHyphen | 30 | Not supported.
wdMatchNonbreakingSpace | 160 | Not supported.
wdMatchOptionalHyphen | 31 | Not supported.
wdMatchParagraphMark | 65551 | Not supported.
wdMatchSectionBreak | 65580 | Not supported.
wdMatchTabCharacter | 9 | Not supported.
wdMatchWhiteSpace | 65655 | Not supported.


WdFindWrap Enumeration (Word)

 Copy code hover
[image]

WdFindWrap Enumeration (Word)
Send feedback

Specifies wrap behavior if a selection or range is specified for a find operation and the search text isn't found in the selection or range.

Name | Value | Description
wdFindAsk | 2 | After searching the selection or range, Microsoft Word displays a message asking whether to search the remainder of the document.
wdFindContinue | 1 | The find operation continues if the beginning or end of the search range is reached.
wdFindStop | 0 | The find operation ends if the beginning or end of the search range is reached.


WdFlowDirection Enumeration (Word)

 Copy code hover
[image]

WdFlowDirection Enumeration (Word)
Send feedback

Specifies the direction in which text flows from one text column to the next.

Name | Value | Description
wdFlowLtr | 0 | Text in columns flows from left to right.
wdFlowRtl | 1 | Text in columns flows from right to left.


WdFontBias Enumeration (Word)

 Copy code hover
[image]

WdFontBias Enumeration (Word)
Send feedback

Specifies the font bias for symbols.

Name | Value | Description
wdFontBiasDefault | 0 | Default font bias.
wdFontBiasDontCare | 255 | No font bias specified.
wdFontBiasFareast | 1 | Font bias for Asian languages.


WdFootnoteLocation Enumeration (Word)

 Copy code hover
[image]

WdFootnoteLocation Enumeration (Word)
Send feedback

Specifies the position of footnotes.

Name | Value | Description
wdBeneathText | 1 | Beneath current text.
wdBottomOfPage | 0 | At bottom of current page.


WdFramePosition Enumeration (Word)

 Copy code hover
[image]

WdFramePosition Enumeration (Word)
Send feedback

Specifies the reference point against which the frame position is calculated.

Name | Value | Description
wdFrameBottom | -999997 | Bottom margin.
wdFrameCenter | -999995 | Center of document.
wdFrameInside | -999994 | Content inside frame.
wdFrameLeft | -999998 | Left margin.
wdFrameOutside | -999993 | Content outside frame.
wdFrameRight | -999996 | Right margin.
wdFrameTop | -999999 | Top margin.


WdFramesetNewFrameLocation Enumeration (Word)

 Copy code hover
[image]

WdFramesetNewFrameLocation Enumeration (Word)
Send feedback

Specifies the position of a new frame in relation to an existing frame.

Name | Value | Description
wdFramesetNewFrameAbove | 0 | Above existing frame.
wdFramesetNewFrameBelow | 1 | Below existing frame.
wdFramesetNewFrameLeft | 3 | To the left of existing frame.
wdFramesetNewFrameRight | 2 | To the right of existing frame.


WdFramesetSizeType Enumeration (Word)

 Copy code hover
[image]

WdFramesetSizeType Enumeration (Word)
Send feedback

Specifies how to interpret the height or width of a specified frame on a frames page.

Name | Value | Description
wdFramesetSizeTypeFixed | 1 | Microsoft Word interprets the height or width of the specified frame as a fixed value (in points).
wdFramesetSizeTypePercent | 0 | Word interprets the height or width of the specified frame as a percentage of the screen height or width.
wdFramesetSizeTypeRelative | 2 | Word interprets the height or width of the specified frame as relative to the height or width of other frames on the frames page.


WdFramesetType Enumeration (Word)

 Copy code hover
[image]

WdFramesetType Enumeration (Word)
Send feedback

Specifies the type of frame.

Name | Value | Description
wdFramesetTypeFrame | 1 | A single frame.
wdFramesetTypeFrameset | 0 | A frameset.


WdFrameSizeRule Enumeration (Word)

 Copy code hover
[image]

WdFrameSizeRule Enumeration (Word)
Send feedback

Specifies how Word interprets the rule used to determine the height or width of a frame.

Name | Value | Description
wdFrameAtLeast | 1 | Sets the height or width to a value equal to or greater than the value specified by the Height property or Width property.
wdFrameAuto | 0 | Sets the height or width according to the height or width of the item in the frame.
wdFrameExact | 2 | Sets the height or width to an exact value specified by the Height property or Width property.


WdFrenchSpeller Enumeration (Word)

 Copy code hover
[image]

WdFrenchSpeller Enumeration (Word)
Send feedback

Indicates which version of French to use when using the French language spelling checker dictionaries.

Name | Value | Description
wdFrenchBoth | 0 | Use both Post Reform and Pre-Reform French dictionaries when checking French language spelling.
wdFrenchPostReform | 2 | Use only the Post Reform French dictionary when checking French language spelling.
wdFrenchPreReform | 1 | Use only the Pre-Reform French dictionary when checking French language spelling.


WdGoToDirection Enumeration (Word)

 Copy code hover
[image]

WdGoToDirection Enumeration (Word)
Send feedback

Specifies the position to which a selection or the insertion point is moved in relation to an object or to itself.

Name | Value | Description
wdGoToAbsolute | 1 | An absolute position.
wdGoToFirst | 1 | The first instance of the specified object.
wdGoToLast | -1 | The last instance of the specified object.
wdGoToNext | 2 | The next instance of the specified object.
wdGoToPrevious | 3 | The previous instance of the specified object.
wdGoToRelative | 2 | A position relative to the current position.


WdGoToItem Enumeration (Word)

 Copy code hover
[image]

WdGoToItem Enumeration (Word)
Send feedback

Specifies the type of item to move the insertion point or selection just prior to.

Name | Value | Description
wdGoToBookmark | -1 | A bookmark.
wdGoToComment | 6 | A comment.
wdGoToEndnote | 5 | An endnote.
wdGoToEquation | 10 | An equation.
wdGoToField | 7 | A field.
wdGoToFootnote | 4 | A footnote.
wdGoToGrammaticalError | 14 | A grammatical error.
wdGoToGraphic | 8 | A graphic.
wdGoToHeading | 11 | A heading.
wdGoToLine | 3 | A line.
wdGoToObject | 9 | An object.
wdGoToPage | 1 | A page.
wdGoToPercent | 12 | A percent.
wdGoToProofreadingError | 15 | A proofreading error.
wdGoToSection | 0 | A section.
wdGoToSpellingError | 13 | A spelling error.
wdGoToTable | 2 | A table.


WdGranularity Enumeration (Word)

 Copy code hover
[image]

WdGranularity Enumeration (Word)
Send feedback

Specifies the granularity of changes to track when comparing two documents.

Version Information

Version Added: Word 2007

Name | Value | Description
wdGranularityCharLevel | 0 | Tracks character-level changes.
wdGranularityWordLevel | 1 | Tracks word-level changes.


WdGutterStyle Enumeration (Word)

 Copy code hover
[image]

WdGutterStyle Enumeration (Word)
Send feedback

Specifies where the gutter appears in the document.

Name | Value | Description
wdGutterPosLeft | 0 | On the left side.
wdGutterPosRight | 2 | On the right side.
wdGutterPosTop | 1 | At the top.


WdGutterStyleOld Enumeration (Word)

 Copy code hover
[image]

WdGutterStyleOld Enumeration (Word)
Send feedback

Specifies whether the gutter style should conform to left-to-right text flow or right-to-left text flow.

Name | Value | Description
wdGutterStyleBidi | 2 | Bidirectional gutter should be used to conform to right-to-left text flow.
wdGutterStyleLatin | -10 | Latin gutter should be used to conform to left-to-right text flow.


WdHeaderFooterIndex Enumeration (Word)

 Copy code hover
[image]

WdHeaderFooterIndex Enumeration (Word)
Send feedback

Returns the specified header or footer in a document or section.

Name | Value | Description
wdHeaderFooterEvenPages | 3 | Returns all headers or footers on even-numbered pages.
wdHeaderFooterFirstPage | 2 | Returns the first header or footer in a document or section.
wdHeaderFooterPrimary | 1 | Returns the header or footer on all pages other than the first page of a document or section.


WdHeadingSeparator Enumeration (Word)

 Copy code hover
[image]

WdHeadingSeparator Enumeration (Word)
Send feedback

Specifies the type of text separator to place between headings in an index.

Name | Value | Description
wdHeadingSeparatorBlankLine | 1 | A blank line.
wdHeadingSeparatorLetter | 2 | A designated letter.
wdHeadingSeparatorLetterFull | 4 | A designated uppercase letter.
wdHeadingSeparatorLetterLow | 3 | A designated lowercase letter.
wdHeadingSeparatorNone | 0 | No separator.


WdHebSpellStart Enumeration (Word)

 Copy code hover
[image]

WdHebSpellStart Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies which rules the Hebrew spelling checker will follow.

Name | Value | Description
wdFullScript | 0 | The spelling checker follows rules for the conventional script required by the Hebrew Language Academy for writing text without diacritics.
wdMixedAuthorizedScript | 3 | The spelling checker follows rules for full and partial script, but highlights as potential mistakes any spelling variations not permitted within either system and any completely unrecognized words.
wdMixedScript | 2 | The spelling checker follows rules for full and partial script and allows non-conventional spelling variations. Only completely unrecognized words are highlighted as potential mistakes.
wdPartialScript | 1 | The spelling checker follows rules for the traditional script used only for text with diacritics.


WdHelpType Enumeration (Word)

 Copy code hover
[image]

WdHelpType Enumeration (Word)
Send feedback

Specifies the type of Help topic or window to display.

Name | Value | Description
wdHelp | 0 | Displays the Help Topics dialog box.
wdHelpAbout | 1 | Displays the About Microsoft Word dialog box.
wdHelpActiveWindow | 2 | Displays Help describing the command associated with the active view or pane.
wdHelpContents | 3 | Displays the Help Topics dialog box.
wdHelpExamplesAndDemos | 4 | Displays examples and demos.
wdHelpHWP | 13 | Displays Help topics for AreA Hangul users.
wdHelpIchitaro | 11 | Displays Help topics for Ichitaro users.
wdHelpIndex | 5 | Displays the Help Topics dialog box.
wdHelpKeyboard | 6 | Displays keyboard shortcuts associated with help.
wdHelpPE2 | 12 | Displays Help topics for IBM Personal Editor 2 users.
wdHelpPSSHelp | 7 | Displays product support information
wdHelpQuickPreview | 8 | Displays quick previews.
wdHelpSearch | 9 | Displays the Help Topics dialog box.
wdHelpUsingHelp | 10 | Displays a list of Help topics that describe how to use Help.


WdHighAnsiText Enumeration (Word)

 Copy code hover
[image]

WdHighAnsiText Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies how Word interprets high-ANSI text.

Name | Value | Description
wdAutoDetectHighAnsiFarEast | 2 | Microsoft Word interprets high-ANSI text as East Asian characters only if Word automatically detects East Asian language text.
wdHighAnsiIsFarEast | 0 | Word doesn't interpret any high-ANSI text as East Asian characters.
wdHighAnsiIsHighAnsi | 1 | Word interprets all high-ANSI text as East Asian characters.


WdHorizontalInVerticalType Enumeration (Word)

 Copy code hover
[image]

WdHorizontalInVerticalType Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the format of horizontal text set within vertical text.

Name | Value | Description
wdHorizontalInVerticalFitInLine | 1 | The horizontal text is sized to fit in the line of vertical text.
wdHorizontalInVerticalNone | 0 | No formatting is applied to the horizontal text.
wdHorizontalInVerticalResizeLine | 2 | The line of vertical text is sized to accommodate the horizontal text.


WdHorizontalLineAlignment Enumeration (Word)

 Copy code hover
[image]

WdHorizontalLineAlignment Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the alignment of a horizontal line.

Name | Value | Description
wdHorizontalLineAlignCenter | 1 | Centered.
wdHorizontalLineAlignLeft | 0 | Aligned to the left.
wdHorizontalLineAlignRight | 2 | Aligned to the right.


WdHorizontalLineWidthType Enumeration (Word)

 Copy code hover
[image]

WdHorizontalLineWidthType Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies how Word interprets the width (length) of the specified horizontal line.

Name | Value | Description
wdHorizontalLineFixedWidth | -2 | Microsoft Word interprets the width (length) of the specified horizontal line as a fixed value (in points). This is the default value for horizontal lines added with the AddHorizontalLine method. Setting the Width property for the InlineShape object associated with a horizontal line sets the WidthType property to this value.
wdHorizontalLinePercentWidth | -1 | Word interprets the width (length) of the specified horizontal line as a percentage of the screen width. This is the default value for horizontal lines added with the AddHorizontalLineStandard method. Setting the PercentWidth property on a horizontal line sets the WidthType property to this value.


WdIMEMode Enumeration (Word)

 Copy code hover
[image]

WdIMEMode Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the default start-up mode for the Japanese Input Method Editor (IME).

Name | Value | Description
wdIMEModeAlpha | 8 | Activates the IME in half-width Latin mode.
wdIMEModeAlphaFull | 7 | Activates the IME in full-width Latin mode.
wdIMEModeHangul | 10 | Activates the IME in half-width Hangul mode.
wdIMEModeHangulFull | 9 | Activates the IME in full-width Hangul mode.
wdIMEModeHiragana | 4 | Activates the IME in full-width hiragana mode.
wdIMEModeKatakana | 5 | Activates the IME in full-width katakana mode.
wdIMEModeKatakanaHalf | 6 | Activates the IME in half-width katakana mode.
wdIMEModeNoControl | 0 | Does not change the IME mode.
wdIMEModeOff | 2 | Disables the IME and activates Latin text entry.
wdIMEModeOn | 1 | Activates the IME.


WdIndexFilter Enumeration (Word)

 Copy code hover
[image]

WdIndexFilter Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies how Microsoft Word classifies the first character of entries in the specified index.

Name | Value | Description
wdIndexFilterAiueo | 1 | Japanese words use the AIUEO method of alphabetizing.
wdIndexFilterAkasatana | 2 | Japanese words use Akasatana.
wdIndexFilterChosung | 3 | Korean words use Chosung.
wdIndexFilterFull | 6 | Korean words use Chosung.
wdIndexFilterLow | 4 | Japanese words use Akasatana.
wdIndexFilterMedium | 5 | Japanese words use the AIUEO method of alphabetizing.
wdIndexFilterNone | 0 | No special filtering.


WdIndexFormat Enumeration (Word)

 Copy code hover
[image]

WdIndexFormat Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the formatting for indexes in a document.

Name | Value | Description
wdIndexBulleted | 4 | Bulleted.
wdIndexClassic | 1 | Classic.
wdIndexFancy | 2 | Fancy.
wdIndexFormal | 5 | Formal.
wdIndexModern | 3 | Modern.
wdIndexSimple | 6 | Simple.
wdIndexTemplate | 0 | From template.


WdIndexSortBy Enumeration (Word)

 Copy code hover
[image]

WdIndexSortBy Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the criteria by which Word sorts the specified index.

Name | Value | Description
wdIndexSortByStroke | 0 | Sort by the number of strokes in a character.
wdIndexSortBySyllable | 1 | Sort phonetically.


WdIndexType Enumeration (Word)

 Copy code hover
[image]

WdIndexType Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the type of index.

Name | Value | Description
wdIndexIndent | 0 | An indented index.
wdIndexRunin | 1 | A run-in index.


WdInformation Enumeration (Word)

 Copy code hover
[image]

WdInformation Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the type of information returned about a specified selection or range.

Name | Value | Description
wdActiveEndAdjustedPageNumber | 1 | Returns the number of the page that contains the active end of the specified selection or range. If you set a starting page number or make other manual adjustments, returns the adjusted page number (unlike wdActiveEndPageNumber).
wdActiveEndPageNumber | 3 | Returns the number of the page that contains the active end of the specified selection or range, counting from the beginning of the document. Any manual adjustments to page numbering are disregarded (unlike wdActiveEndAdjustedPageNumber).
wdActiveEndSectionNumber | 2 | Returns the number of the section that contains the active end of the specified selection or range.
wdAtEndOfRowMarker | 31 | Returns True if the specified selection or range is at the end-of-row mark in a table.
wdCapsLock | 21 | Returns True if Caps Lock is in effect.
wdEndOfRangeColumnNumber | 17 | Returns the table column number that contains the end of the specified selection or range.
wdEndOfRangeRowNumber | 14 | Returns the table row number that contains the end of the specified selection or range.
wdFirstCharacterColumnNumber | 9 | Returns the character position of the first character in the specified selection or range. If the selection or range is collapsed, the character number immediately to the right of the range or selection is returned (this is the same as the character column number displayed in the status bar after "Col").
wdFirstCharacterLineNumber | 10 | Returns the character position of the first character in the specified selection or range. If the selection or range is collapsed, the character number immediately to the right of the range or selection is returned (this is the same as the character line number displayed in the status bar after "Ln").
wdFrameIsSelected | 11 | Returns True if the selection or range is an entire frame or text box.
wdHeaderFooterType | 33 | Returns a value that indicates the type of header or footer that contains the specified selection or range. See the table in the remarks section for additional information.
wdHorizontalPositionRelativeToPage | 5 | Returns the horizontal position of the specified selection or range; this is the distance from the left edge of the selection or range to the left edge of the page measured in points (1 point = 20 twips, 72 points = 1 inch). If the selection or range isn't within the screen area, returns - 1.
wdHorizontalPositionRelativeToTextBoundary | 7 | Returns the horizontal position of the specified selection or range relative to the left edge of the nearest text boundary enclosing it, in points (1 point = 20 twips, 72 points = 1 inch). If the selection or range isn't within the screen area, returns - 1.
wdInBibliography | 42 | Returns True if the specified selection or range is in a bibliography.
wdInCitation | 43 | Returns True if the specified selection or range is in a citation.
wdInClipboard | 38 | For information about this constant, consult the language reference Help included with Microsoft Office Macintosh Edition.
wdInCommentPane | 26 | Returns True if the specified selection or range is in a comment pane.
wdInContentControl | 46 | Returns True if the specified selection or range is in a content control.
wdInCoverPage | 41 | Returns True if the specified selection or range is in a cover page.
wdInEndnote | 36 | Returns True if the specified selection or range is in an endnote area in print layout view or in the endnote pane in normal view.
wdInFieldCode | 44 | Returns True if the specified selection or range is in a field code.
wdInFieldResult | 45 | Returns True if the specified selection or range is in a field result.
wdInFootnote | 35 | Returns True if the specified selection or range is in a footnote area in print layout view or in the footnote pane in normal view.
wdInFootnoteEndnotePane | 25 | Returns True if the specified selection or range is in the footnote or endnote pane in normal view or in a footnote or endnote area in print layout view. For more information, see the descriptions of wdInFootnote and wdInEndnote in the preceding paragraphs.
wdInHeaderFooter | 28 | Returns True if the selection or range is in the header or footer pane or in a header or footer in print layout view.
wdInMasterDocument | 34 | Returns True if the selection or range is in a master document (that is, a document that contains at least one subdocument).
wdInWordMail | 37 | Returns True if the selection or range is in the header or footer pane or in a header or footer in print layout view.
wdMaximumNumberOfColumns | 18 | Returns the greatest number of table columns within any row in the selection or range.
wdMaximumNumberOfRows | 15 | Returns the greatest number of table rows within the table in the specified selection or range.
wdNumberOfPagesInDocument | 4 | Returns the number of pages in the document associated with the selection or range.
wdNumLock | 22 | Returns True if Num Lock is in effect.
wdOverType | 23 | Returns True if Overtype mode is in effect. The Overtype property can be used to change the state of the Overtype mode.
wdReferenceOfType | 32 | Returns a value that indicates where the selection is in relation to a footnote, endnote, or comment reference, as shown in the table in the remarks section.
wdRevisionMarking | 24 | Returns True if change tracking is in effect.
wdSelectionMode | 20 | Returns a value that indicates the current selection mode, as shown in the following table.
wdStartOfRangeColumnNumber | 16 | Returns the table column number that contains the beginning of the selection or range.
wdStartOfRangeRowNumber | 13 | Returns the table row number that contains the beginning of the selection or range.
wdVerticalPositionRelativeToPage | 6 | Returns the vertical position of the selection or range; this is the distance from the top edge of the selection to the top edge of the page measured in points (1 point = 20 twips, 72 points = 1 inch). If the selection isn't visible in the document window, returns - 1.
wdVerticalPositionRelativeToTextBoundary | 8 | Returns the vertical position of the selection or range relative to the top edge of the nearest text boundary enclosing it, in points (1 point = 20 twips, 72 points = 1 inch). This is useful for determining the position of the insertion point within a frame or table cell. If the selection isn't visible, returns - 1.
wdWithInTable | 12 | Returns True if the selection is in a table.
wdZoomPercentage | 19 | Returns the current percentage of magnification as set by the Percentage property.


WdInlineShapeType Enumeration (Word)

 Copy code hover
[image]

WdInlineShapeType Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies a shape type for inline shapes.

Name | Value | Description
wdInlineShapeChart | 12 | Inline chart.
wdInlineShapeDiagram | 13 | Inline diagram.
wdInlineShapeEmbeddedOLEObject | 1 | Embedded OLE object.
wdInlineShapeHorizontalLine | 6 | Horizontal line.
wdInlineShapeLinkedOLEObject | 2 | Linked OLE object.
wdInlineShapeLinkedPicture | 4 | Linked picture.
wdInlineShapeLinkedPictureHorizontalLine | 8 | Linked picture with horizontal line.
wdInlineShapeLockedCanvas | 14 | Locked inline shape canvas.
wdInlineShapeOLEControlObject | 5 | OLE control object.
wdInlineShapeOWSAnchor | 11 | OWS anchor.
wdInlineShapePicture | 3 | Picture.
wdInlineShapePictureBullet | 9 | Picture used as a bullet.
wdInlineShapePictureHorizontalLine | 7 | Picture with horizontal line.
wdInlineShapeScriptAnchor | 10 | Script anchor. Refers to anchor location for block of script stored with a document.
wdInlineShapeSmartArt | 15 | A SmartArt graphic.
wdInlineShapeWebVideo | 16 | A picture acting as a poster frame for a web video.


WdInsertCells Enumeration (Word)

 Copy code hover
[image]

WdInsertCells Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies where and what type of cells to add to an existing table.

Name | Value | Description
wdInsertCellsEntireColumn | 3 | Inserts an entire column to the left of the column that contains the selection.
wdInsertCellsEntireRow | 2 | Inserts an entire row above the row that contains the selection.
wdInsertCellsShiftDown | 1 | Inserts new cells above the selected cells.
wdInsertCellsShiftRight | 0 | Insert new cells to the left of the selected cells.


WdInsertedTextMark Enumeration (Word)

 Copy code hover
[image]

WdInsertedTextMark Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the formatting of text that is inserted while change tracking is enabled.

Name | Value | Description
wdInsertedTextMarkBold | 1 | Inserted text is displayed in bold.
wdInsertedTextMarkColorOnly | 5 | Inserted text is displayed in a specified color.
wdInsertedTextMarkDoubleUnderline | 4 | Inserted text is marked up by using double-underline characters.
wdInsertedTextMarkItalic | 2 | Inserted text is displayed in italic.
wdInsertedTextMarkNone | 0 | Inserted text is not marked up.
wdInsertedTextMarkStrikeThrough | 6 | Inserted text is marked up by using strikethrough characters.
wdInsertedTextMarkUnderline | 3 | Inserted text is underlined.
wdInsertedTextMarkDoubleStrikeThrough | 7 | Inserted text is marked up by using double-strikethrough characters.


WdInternationalIndex Enumeration (Word)

 Copy code hover
[image]

WdInternationalIndex Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies information specific to the current country/region and international settings.

Name | Value | Description
wd24HourClock | 21 | Returns True if you are using 24-hour time; returns False if you are using 12-hour time.
wdCurrencyCode | 20 | Returns the currency symbol ($ in U.S. English).
wdDateSeparator | 25 | Returns the date separator (/ in U.S. English).
wdDecimalSeparator | 18 | Returns the decimal separator (. in U.S. English).
wdInternationalAM | 22 | Returns the string used to indicate morning hours (for example, 10 A.M).
wdInternationalPM | 23 | Returns the string used to indicate afternoon and evening hours (for example, 2 P.M).
wdListSeparator | 17 | Returns the list separator (, in U.S. English).
wdProductLanguageID | 26 | Returns the language version of Word.
wdThousandsSeparator | 19 | Returns the thousands separator (, in U.S. English).
wdTimeSeparator | 24 | Returns the time separator (: in U.S. English).


WdJustificationMode Enumeration (Word)

 Copy code hover
[image]

WdJustificationMode Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the character spacing adjustment for a document.

Name | Value | Description
wdJustificationModeCompress | 1 | Compress.
wdJustificationModeCompressKana | 2 | Compress, using rules of the kana syllabaries, Hiragana and Katakana.
wdJustificationModeExpand | 0 | Expand.


WdKana Enumeration (Word)

 Copy code hover
[image]

WdKana Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the format of the selected Japanese text.

Name | Value | Description
wdKanaHiragana | 9 | The text is formatted as Hiragana.
wdKanaKatakana | 8 | The text is formatted as Katakana.


WdKey Enumeration (Word)

 Copy code hover
[image]

WdKey Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies a keyboard character. Although uppercase and lowercase characters are designated by using different values in a character encoding map, they share a single constant in this enumeration.

Name | Value | Description
wdKey0 | 48 | The 0 key.
wdKey1 | 49 | The 1 key.
wdKey2 | 50 | The 2 key.
wdKey3 | 51 | The 3 key.
wdKey4 | 52 | The 4 key.
wdKey5 | 53 | The 5 key.
wdKey6 | 54 | The 6 key.
wdKey7 | 55 | The 7 key.
wdKey8 | 56 | The 8 key.
wdKey9 | 57 | The 9 key.
wdKeyA | 65 | The A key.
wdKeyAlt | 1024 | The ALT key.
wdKeyB | 66 | The B key.
wdKeyBackSingleQuote | 192 | The ` key.
wdKeyBackSlash | 220 | The \ key.
wdKeyBackspace | 8 | The BACKSPACE key.
wdKeyC | 67 | The C key.
wdKeyCloseSquareBrace | 221 | The ] key.
wdKeyComma | 188 | The , key.
wdKeyCommand | 512 | The Windows command key or Macintosh COMMAND key.
wdKeyControl | 512 | The CTRL key.
wdKeyD | 68 | The D key.
wdKeyDelete | 46 | The DELETE key.
wdKeyE | 69 | The E key.
wdKeyEnd | 35 | The END key.
wdKeyEquals | 187 | The = key.
wdKeyEsc | 27 | The ESC key.
wdKeyF | 70 | The F key.
wdKeyF1 | 112 | The F1 key.
wdKeyF10 | 121 | The F10 key.
wdKeyF11 | 122 | The F11 key.
wdKeyF12 | 123 | The F12 key.
wdKeyF13 | 124 | The F13 key.
wdKeyF14 | 125 | The F14 key.
wdKeyF15 | 126 | The F15 key.
wdKeyF16 | 127 | The F16 key.
wdKeyF2 | 113 | The F2 key.
wdKeyF3 | 114 | The F3 key.
wdKeyF4 | 115 | The F4 key.
wdKeyF5 | 116 | The F5 key.
wdKeyF6 | 117 | The F6 key.
wdKeyF7 | 118 | The F7 key.
wdKeyF8 | 119 | The F8 key.
wdKeyF9 | 120 | The F9 key.
wdKeyG | 71 | The G key.
wdKeyH | 72 | The H key.
wdKeyHome | 36 | The HOME key.
wdKeyHyphen | 189 | The - key.
wdKeyI | 73 | The I key.
wdKeyInsert | 45 | The INSERT key.
wdKeyJ | 74 | The J key.
wdKeyK | 75 | The K key.
wdKeyL | 76 | The L key.
wdKeyM | 77 | The M key.
wdKeyN | 78 | The N key.
wdKeyNumeric0 | 96 | The 0 key.
wdKeyNumeric1 | 97 | The 1 key.
wdKeyNumeric2 | 98 | The 2 key.
wdKeyNumeric3 | 99 | The 3 key.
wdKeyNumeric4 | 100 | The 4 key.
wdKeyNumeric5 | 101 | The 5 key.
wdKeyNumeric5Special | 12 | .
wdKeyNumeric6 | 102 | The 6 key.
wdKeyNumeric7 | 103 | The 7 key.
wdKeyNumeric8 | 104 | The 8 key.
wdKeyNumeric9 | 105 | The 9 key.
wdKeyNumericAdd | 107 | The + key on the numeric keypad.
wdKeyNumericDecimal | 110 | The . key on the numeric keypad.
wdKeyNumericDivide | 111 | The / key on the numeric keypad.
wdKeyNumericMultiply | 106 | The * key on the numeric keypad.
wdKeyNumericSubtract | 109 | The - key on the numeric keypad.
wdKeyO | 79 | The O key.
wdKeyOpenSquareBrace | 219 | The [ key.
wdKeyOption | 1024 | The mouse option key or Macintosh OPTION key.
wdKeyP | 80 | The P key.
wdKeyPageDown | 34 | The PAGE DOWN key.
wdKeyPageUp | 33 | The PAGE UP key.
wdKeyPause | 19 | The PAUSE key.
wdKeyPeriod | 190 | The . key.
wdKeyQ | 81 | The Q key.
wdKeyR | 82 | The R key.
wdKeyReturn | 13 | The ENTER or RETURN key.
wdKeyS | 83 | The S key.
wdKeyScrollLock | 145 | The SCROLL LOCK key.
wdKeySemiColon | 186 | The ; key.
wdKeyShift | 256 | The SHIFT key.
wdKeySingleQuote | 222 | The ' key.
wdKeySlash | 191 | The / key.
wdKeySpacebar | 32 | The SPACEBAR key.
wdKeyT | 84 | The T key.
wdKeyTab | 9 | The TAB key.
wdKeyU | 85 | The U key.
wdKeyV | 86 | The V key.
wdKeyW | 87 | The W key.
wdKeyX | 88 | The X key.
wdKeyY | 89 | The Y key.
wdKeyZ | 90 | The Z key.
wdNoKey | 255 | No key.


WdKeyCategory Enumeration (Word)

 Copy code hover
[image]

WdKeyCategory Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the type of item assigned to the key binding.

Name | Value | Description
wdKeyCategoryAutoText | 4 | Key is assigned to autotext.
wdKeyCategoryCommand | 1 | Key is assigned to a command
wdKeyCategoryDisable | 0 | Key is disabled.
wdKeyCategoryFont | 3 | Key is assigned to a font.
wdKeyCategoryMacro | 2 | Key is assigned to a
wdKeyCategoryNil | -1 | Key is not assigned.
wdKeyCategoryPrefix | 7 | Key is assigned to a prefix.
wdKeyCategoryStyle | 5 | Key is assigned to a style.
wdKeyCategorySymbol | 6 | Key is assigned to a symbol.


WdLanguageID Enumeration (Word)

 Copy code hover
[image]

WdLanguageID Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the language to use.

Name | Value | Description
wdAfrikaans | 1078 | African language.
wdAlbanian | 1052 | Albanian language.
wdAmharic | 1118 | Amharic language.
wdArabic | 1025 | Arabic language.
wdArabicAlgeria | 5121 | Arabic Algerian language.
wdArabicBahrain | 15361 | Arabic Bahraini language.
wdArabicEgypt | 3073 | Arabic Egyptian language.
wdArabicIraq | 2049 | Arabic Iraqi language.
wdArabicJordan | 11265 | Arabic Jordanian language.
wdArabicKuwait | 13313 | Arabic Kuwaiti language.
wdArabicLebanon | 12289 | Arabic Lebanese language.
wdArabicLibya | 4097 | Arabic Libyan language.
wdArabicMorocco | 6145 | Arabic Moroccan language.
wdArabicOman | 8193 | Arabic Omani language.
wdArabicQatar | 16385 | Arabic Qatari language.
wdArabicSyria | 10241 | Arabic Syrian language.
wdArabicTunisia | 7169 | Arabic Tunisian language.
wdArabicUAE | 14337 | Arabic United Arab Emirates language.
wdArabicYemen | 9217 | Arabic Yemeni language.
wdArmenian | 1067 | Armenian language.
wdAssamese | 1101 | Assamese language.
wdAzeriCyrillic | 2092 | Azeri Cyrillic language.
wdAzeriLatin | 1068 | Azeri Latin language.
wdBasque | 1069 | Basque language.
wdBelgianDutch | 2067 | Belgian Dutch language.
wdBelgianFrench | 2060 | Belgian French language.
wdBengali | 1093 | Bengali language.
wdBulgarian | 1026 | Bulgarian language.
wdBurmese | 1109 | Burmese language.
wdByelorussian | 1059 | Byelorussian language.
wdCatalan | 1027 | Catalan language.
wdCherokee | 1116 | Cherokee language.
wdChineseHongKongSAR | 3076 | Chinese Hong Kong SAR language.
wdChineseMacaoSAR | 5124 | Chinese Macao SAR language.
wdChineseSingapore | 4100 | Chinese Singapore language.
wdCroatian | 1050 | Croatian language.
wdCzech | 1029 | Czech language.
wdDanish | 1030 | Danish language.
wdDivehi | 1125 | Divehi language.
wdDutch | 1043 | Dutch language.
wdEdo | 1126 | Edo language.
wdEnglishAUS | 3081 | Australian English language.
wdEnglishBelize | 10249 | Belize English language.
wdEnglishCanadian | 4105 | Canadian English language.
wdEnglishCaribbean | 9225 | Caribbean English language.
wdEnglishIndonesia | 14345 | Indonesian English language.
wdEnglishIreland | 6153 | Irish English language.
wdEnglishJamaica | 8201 | Jamaican English language.
wdEnglishNewZealand | 5129 | New Zealand English language.
wdEnglishPhilippines | 13321 | Filipino English language.
wdEnglishSouthAfrica | 7177 | South African English language.
wdEnglishTrinidadTobago | 11273 | Tobago Trinidad English language.
wdEnglishUK | 2057 | United Kingdom English language.
wdEnglishUS | 1033 | United States English language.
wdEnglishZimbabwe | 12297 | Zimbabwe English language.
wdEstonian | 1061 | Estonian language.
wdFaeroese | 1080 | Faeroese language.
wdFilipino | 1124 | Filipino language.
wdFinnish | 1035 | Finnish language.
wdFrench | 1036 | French language.
wdFrenchCameroon | 11276 | French Cameroon language.
wdFrenchCanadian | 3084 | French Canadian language.
wdFrenchCongoDRC | 9228 | French (Congo (DRC)) language.
wdFrenchCotedIvoire | 12300 | French Cote d'Ivoire language.
wdFrenchHaiti | 15372 | French Haiti language.
wdFrenchLuxembourg | 5132 | French Luxembourg language.
wdFrenchMali | 13324 | French Mali language.
wdFrenchMonaco | 6156 | French Monaco language.
wdFrenchMorocco | 14348 | French Morocco language.
wdFrenchReunion | 8204 | French Reunion language.
wdFrenchSenegal | 10252 | French Senegal language.
wdFrenchWestIndies | 7180 | French West Indies language.
wdFrisianNetherlands | 1122 | Frisian Netherlands language.
wdFulfulde | 1127 | Fulfulde language.
wdGaelicIreland | 2108 | Irish (Irish) language.
wdGaelicScotland | 1084 | Scottish Gaelic language.
wdGalician | 1110 | Galician language.
wdGeorgian | 1079 | Georgian language.
wdGerman | 1031 | German language.
wdGermanAustria | 3079 | German Austrian language.
wdGermanLiechtenstein | 5127 | German Liechtenstein language.
wdGermanLuxembourg | 4103 | German Luxembourg language.
wdGreek | 1032 | Greek language.
wdGuarani | 1140 | Guarani language.
wdGujarati | 1095 | Gujarati language.
wdHausa | 1128 | Hausa language.
wdHawaiian | 1141 | Hawaiian language.
wdHebrew | 1037 | Hebrew language.
wdHindi | 1081 | Hindi language.
wdHungarian | 1038 | Hungarian language.
wdIbibio | 1129 | Ibibio language.
wdIcelandic | 1039 | Icelandic language.
wdIgbo | 1136 | Igbo language.
wdIndonesian | 1057 | Indonesian language.
wdInuktitut | 1117 | Inuktitut language.
wdItalian | 1040 | Italian language.
wdJapanese | 1041 | Japanese language.
wdKannada | 1099 | Kannada language.
wdKanuri | 1137 | Kanuri language.
wdKashmiri | 1120 | Kashmiri language.
wdKazakh | 1087 | Kazakh language.
wdKhmer | 1107 | Khmer language.
wdKirghiz | 1088 | Kirghiz language.
wdKonkani | 1111 | Konkani language.
wdKorean | 1042 | Korean language.
wdKyrgyz | 1088 | Kyrgyz language.
wdLanguageNone | 0 | No specified language.
wdLao | 1108 | Lao language.
wdLatin | 1142 | Latin language.
wdLatvian | 1062 | Latvian language.
wdLithuanian | 1063 | Lithuanian language.
wdMacedonianFYROM | 1071 | Macedonian (FYROM) language.
wdMalayalam | 1100 | Malayalam language.
wdMalayBruneiDarussalam | 2110 | Malay Brunei Darussalam language.
wdMalaysian | 1086 | Malaysian language.
wdMaltese | 1082 | Maltese language.
wdManipuri | 1112 | Manipuri language.
wdMarathi | 1102 | Marathi language.
wdMexicanSpanish | 2058 | Mexican Spanish language.
wdMongolian | 1104 | Mongolian language.
wdNepali | 1121 | Nepali language.
wdNoProofing | 1024 | Disables proofing if the language ID identifies a language in which an object is grammatically validated using the Microsoft Word proofing tools.
wdNorwegianBokmol | 1044 | Norwegian Bokmol language.
wdNorwegianNynorsk | 2068 | Norwegian Nynorsk language.
wdOriya | 1096 | Oriya language.
wdOromo | 1138 | Oromo language.
wdPashto | 1123 | Pashto language.
wdPersian | 1065 | Persian language.
wdPolish | 1045 | Polish language.
wdPortuguese | 2070 | Portuguese language.
wdPortugueseBrazil | 1046 | Portuguese (Brazil) language.
wdPunjabi | 1094 | Punjabi language.
wdRhaetoRomanic | 1047 | Rhaeto Romanic language.
wdRomanian | 1048 | Romanian language.
wdRomanianMoldova | 2072 | Romanian Moldova language.
wdRussian | 1049 | Russian language.
wdRussianMoldova | 2073 | Russian Moldova language.
wdSamiLappish | 1083 | Sami Lappish language.
wdSanskrit | 1103 | Sanskrit language.
wdSerbianCyrillic | 3098 | Serbian Cyrillic language.
wdSerbianLatin | 2074 | Serbian Latin language.
wdSesotho | 1072 | Sesotho language.
wdSimplifiedChinese | 2052 | Simplified Chinese language.
wdSindhi | 1113 | Sindhi language.
wdSindhiPakistan | 2137 | Sindhi (Pakistan) language.
wdSinhalese | 1115 | Sinhalese language.
wdSlovak | 1051 | Slovakian language.
wdSlovenian | 1060 | Slovenian language.
wdSomali | 1143 | Somali language.
wdSorbian | 1070 | Sorbian language.
wdSpanish | 1034 | Spanish language.
wdSpanishArgentina | 11274 | Spanish Argentina language.
wdSpanishBolivia | 16394 | Spanish Bolivian language.
wdSpanishChile | 13322 | Spanish Chilean language.
wdSpanishColombia | 9226 | Spanish Colombian language.
wdSpanishCostaRica | 5130 | Spanish Costa Rican language.
wdSpanishDominicanRepublic | 7178 | Spanish Dominican Republic language.
wdSpanishEcuador | 12298 | Spanish Ecuadorian language.
wdSpanishElSalvador | 17418 | Spanish El Salvadorian language.
wdSpanishGuatemala | 4106 | Spanish Guatemala language.
wdSpanishHonduras | 18442 | Spanish Honduran language.
wdSpanishModernSort | 3082 | Spanish Modern Sort language.
wdSpanishNicaragua | 19466 | Spanish Nicaraguan language.
wdSpanishPanama | 6154 | Spanish Panamanian language.
wdSpanishParaguay | 15370 | Spanish Paraguayan language.
wdSpanishPeru | 10250 | Spanish Peruvian language.
wdSpanishPuertoRico | 20490 | Spanish Puerto Rican language.
wdSpanishUruguay | 14346 | Spanish Uruguayan language.
wdSpanishVenezuela | 8202 | Spanish Venezuelan language.
wdSutu | 1072 | Sutu language.
wdSwahili | 1089 | Swahili language.
wdSwedish | 1053 | Swedish language.
wdSwedishFinland | 2077 | Swedish Finnish language.
wdSwissFrench | 4108 | Swiss French language.
wdSwissGerman | 2055 | Swiss German language.
wdSwissItalian | 2064 | Swiss Italian language.
wdSyriac | 1114 | Syriac language.
wdTajik | 1064 | Tajik language.
wdTamazight | 1119 | Tamazight language.
wdTamazightLatin | 2143 | Tamazight Latin language.
wdTamil | 1097 | Tamil language.
wdTatar | 1092 | Tatar language.
wdTelugu | 1098 | Telugu language.
wdThai | 1054 | Thai language.
wdTibetan | 1105 | Tibetan language.
wdTigrignaEritrea | 2163 | Tigrigna Eritrea language.
wdTigrignaEthiopic | 1139 | Tigrigna Ethiopic language.
wdTraditionalChinese | 1028 | Traditional Chinese language.
wdTsonga | 1073 | Tsonga language.
wdTswana | 1074 | Tswana language.
wdTurkish | 1055 | Turkish language.
wdTurkmen | 1090 | Turkmen language.
wdUkrainian | 1058 | Ukrainian language.
wdUrdu | 1056 | Urdu language.
wdUzbekCyrillic | 2115 | Uzbek Cyrillic language.
wdUzbekLatin | 1091 | Uzbek Latin language.
wdVenda | 1075 | Venda language.
wdVietnamese | 1066 | Vietnamese language.
wdWelsh | 1106 | Welsh language.
wdXhosa | 1076 | Xhosa language.
wdYi | 1144 | Yi language.
wdYiddish | 1085 | Yiddish language.
wdYoruba | 1130 | Yoruba language.
wdZulu | 1077 | Zulu language.


WdLayoutMode Enumeration (Word)

 Copy code hover
[image]

WdLayoutMode Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies how text is laid out in the layout mode for the current document.

Name | Value | Description
wdLayoutModeDefault | 0 | No grid is used to lay out text.
wdLayoutModeGenko | 3 | Text is laid out on a grid; the user specifies the number of lines and the number of characters per line. As the user types, Microsoft Word automatically aligns characters with gridlines.
wdLayoutModeGrid | 1 | Text is laid out on a grid; the user specifies the number of lines and the number of characters per line. As the user types, Microsoft Word doesn't automatically align characters with gridlines.
wdLayoutModeLineGrid | 2 | Text is laid out on a grid; the user specifies the number of lines, but not the number of characters per line.


WdLetterheadLocation Enumeration (Word)

 Copy code hover
[image]

WdLetterheadLocation Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies a location to place letterhead in a letter created by the Letter Wizard.

Name | Value | Description
wdLetterBottom | 1 | At the bottom of the letter.
wdLetterLeft | 2 | To the left of the letter.
wdLetterRight | 3 | To the right of the letter.
wdLetterTop | 0 | At the top of the letter.


WdLetterStyle Enumeration (Word)

 Copy code hover
[image]

WdLetterStyle Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the layout of a letter created by the Letter Wizard.

Name | Value | Description
wdFullBlock | 0 | Full block.
wdModifiedBlock | 1 | Modified block.
wdSemiBlock | 2 | Semi-block.


WdLigatures Enumeration (Word)

 Copy code hover
[image]

WdLigatures Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the type of ligatures applied to a font.

Version Information

Version Added: Word 2010

Name | Value | Description
wdLigaturesAll | 15 | Applies all types of ligatures to the font.
wdLigaturesContextual | 2 | Applies contextual ligatures to the font. Contextual ligatures are often designed to enhance readability, but may also be solely ornamental. Contextual ligatures may also be contextual alternates.
wdLigaturesContextualDiscretional | 10 | Applies contextual and discretional ligatures to the font.
wdLigaturesContextualHistorical | 6 | Applies contextual and historical ligatures to the font.
wdLigaturesContextualHistoricalDiscretional | 14 | Applies contextual, historical, and discretional ligatures to a font.
wdLigaturesDiscretional | 8 | Applies discretional ligatures to the font. Discretional ligatures are most often designed to be ornamental at the discretion of the type developer.
wdLigaturesHistorical | 4 | Applies historical ligatures to the font. Historical ligatures are similar to standard ligatures in that they were originally intended to improve the readability of the font, but may look archaic to the modern reader.
wdLigaturesHistoricalDiscretional | 12 | Applies historical and discretional ligatures to the font.
wdLigaturesNone | 0 | Does not apply any ligatures to the font.
wdLigaturesStandard | 1 | Applies standard ligatures to the font. Standard ligatures are designed to enhance readability. Standard ligatures in Latin languages include "fi", "fl", and "ff", for example.
wdLigaturesStandardContextual | 3 | Applies standard and contextual ligatures to the font.
wdLigaturesStandardContextualDiscretional | 11 | Applies standard, contextual and discretional ligatures to the font.
wdLigaturesStandardContextualHistorical | 7 | Applies standard, contextual, and historical ligatures to the font.
wdLigaturesStandardDiscretional | 9 | Applies standard and discretional ligatures to the font.
wdLigaturesStandardHistorical | 5 | Applies standard and historical ligatures to the font.
wdLigaturesStandardHistoricalDiscretional | 13 | Applies standard historical and discretional ligatures to the font.

Remarks

A glyph is a visual representation of a character. Ligatures are two or more glyphs that are represented by what appears to the reader as a single character in order to create more readable or attractive text. Use the Font.Ligatures Property (Word) property to specify the ligatures to apply to a font in Word 2010.

Note Note

The order of preference when a combination of ligature types are applied differs by font and is not controlled by the Word 2010 application.


WdLineEndingType Enumeration (Word)

 Copy code hover
[image]

WdLineEndingType Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies how Microsoft Word marks the line and paragraph breaks in documents saved as text files.

Name | Value | Description
wdCRLF | 0 | Carriage return plus line feed.
wdCROnly | 1 | Carriage return only.
wdLFCR | 3 | Line feed plus carriage return.
wdLFOnly | 2 | Line feed only.
wdLSPS | 4 | Not supported.


WdLineSpacing Enumeration (Word)

 Copy code hover
[image]

WdLineSpacing Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies a line spacing format to be applied to a paragraph.

Name | Value | Description
wdLineSpace1pt5 | 1 | Space-and-a-half line spacing. Spacing is equivalent to the current font size plus 6 points.
wdLineSpaceAtLeast | 3 | Line spacing is always at least a specified amount. The amount is specified separately.
wdLineSpaceDouble | 2 | Double spaced.
wdLineSpaceExactly | 4 | Line spacing is only the exact maximum amount of space required. This setting commonly uses less space than single spacing.
wdLineSpaceMultiple | 5 | Line spacing determined by the number of lines indicated.
wdLineSpaceSingle | 0 | Single spaced. default


WdLineStyle Enumeration (Word)

 Copy code hover
[image]

WdLineStyle Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the border style for an object.

Name | Value | Description
wdLineStyleDashDot | 5 | A dash followed by a dot.
wdLineStyleDashDotDot | 6 | A dash followed by two dots.
wdLineStyleDashDotStroked | 20 | A dash followed by a dot stroke, thus rendering a border similar to a barber pole.
wdLineStyleDashLargeGap | 4 | A dash followed by a large gap.
wdLineStyleDashSmallGap | 3 | A dash followed by a small gap.
wdLineStyleDot | 2 | Dots.
wdLineStyleDouble | 7 | Double solid lines.
wdLineStyleDoubleWavy | 19 | Double wavy solid lines.
wdLineStyleEmboss3D | 21 | The border appears to have a 3-D embossed look.
wdLineStyleEngrave3D | 22 | The border appears to have a 3-D engraved look.
wdLineStyleInset | 24 | The border appears to be inset.
wdLineStyleNone | 0 | No border.
wdLineStyleOutset | 23 | The border appears to be outset.
wdLineStyleSingle | 1 | A single solid line.
wdLineStyleSingleWavy | 18 | A single wavy solid line.
wdLineStyleThickThinLargeGap | 16 | An internal single thick solid line surrounded by a single thin solid line with a large gap between them.
wdLineStyleThickThinMedGap | 13 | An internal single thick solid line surrounded by a single thin solid line with a medium gap between them.
wdLineStyleThickThinSmallGap | 10 | An internal single thick solid line surrounded by a single thin solid line with a small gap between them.
wdLineStyleThinThickLargeGap | 15 | An internal single thin solid line surrounded by a single thick solid line with a large gap between them.
wdLineStyleThinThickMedGap | 12 | An internal single thin solid line surrounded by a single thick solid line with a medium gap between them.
wdLineStyleThinThickSmallGap | 9 | An internal single thin solid line surrounded by a single thick solid line with a small gap between them.
wdLineStyleThinThickThinLargeGap | 17 | An internal single thin solid line surrounded by a single thick solid line surrounded by a single thin solid line with a large gap between all lines.
wdLineStyleThinThickThinMedGap | 14 | An internal single thin solid line surrounded by a single thick solid line surrounded by a single thin solid line with a medium gap between all lines.
wdLineStyleThinThickThinSmallGap | 11 | An internal single thin solid line surrounded by a single thick solid line surrounded by a single thin solid line with a small gap between all lines.
wdLineStyleTriple | 8 | Three solid thin lines.


WdLineType Enumeration (Word)

 Copy code hover
[image]

WdLineType Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies whether a line is a line of text or a table row.

Name | Value | Description
wdTableRow | 1 | A table row.
wdTextLine | 0 | A line of text in the body of the document.


WdLineWidth Enumeration (Word)

 Copy code hover
[image]

WdLineWidth Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the width of an object's border.

Name | Value | Description
wdLineWidth025pt | 2 | 0.25 point.
wdLineWidth050pt | 4 | 0.50 point.
wdLineWidth075pt | 6 | 0.75 point.
wdLineWidth100pt | 8 | 1.00 point. default.
wdLineWidth150pt | 12 | 1.50 points.
wdLineWidth225pt | 18 | 2.25 points.
wdLineWidth300pt | 24 | 3.00 points.
wdLineWidth450pt | 36 | 4.50 points.
wdLineWidth600pt | 48 | 6.00 points.


WdLinkType Enumeration (Word)

 Copy code hover
[image]

WdLinkType Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the type of link.

Name | Value | Description
wdLinkTypeChart | 8 | Microsoft Excel chart.
wdLinkTypeDDE | 6 | Dynamic Data Exchange.
wdLinkTypeDDEAuto | 7 | DDE automatic.
wdLinkTypeImport | 5 | Import file.
wdLinkTypeInclude | 4 | Include file.
wdLinkTypeOLE | 0 | OLE object.
wdLinkTypePicture | 1 | Picture.
wdLinkTypeReference | 3 | Reference library.
wdLinkTypeText | 2 | Text.


WdListApplyTo Enumeration (Word)

 Copy code hover
[image]

WdListApplyTo Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the portion of a list to which to apply a list template.

Name | Value | Description
wdListApplyToSelection | 2 | Selection.
wdListApplyToThisPointForward | 1 | From cursor insertion point to end of list.
wdListApplyToWholeList | 0 | Entire list.


WdListGalleryType Enumeration (Word)

 Copy code hover
[image]

WdListGalleryType Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the type of list from a list template gallery.

Name | Value | Description
wdBulletGallery | 1 | Bulleted list.
wdNumberGallery | 2 | Numbered list.
wdOutlineNumberGallery | 3 | Outline numbered list.


WdListLevelAlignment Enumeration (Word)

 Copy code hover
[image]

WdListLevelAlignment Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the alignment of a list level.

Name | Value | Description
wdListLevelAlignCenter | 1 | Center-aligned.
wdListLevelAlignLeft | 0 | Left-aligned.
wdListLevelAlignRight | 2 | Right-aligned.


WdListNumberStyle Enumeration (Word)

 Copy code hover
[image]

WdListNumberStyle Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the numeric style to apply to a list.

Name | Value | Description
wdListNumberStyleAiueo | 20 | Aiueo numeric style.
wdListNumberStyleAiueoHalfWidth | 12 | Aiueo half-width numeric style.
wdListNumberStyleArabic | 0 | Arabic numeric style.
wdListNumberStyleArabic1 | 46 | Arabic 1 numeric style.
wdListNumberStyleArabic2 | 48 | Arabic 2 numeric style.
wdListNumberStyleArabicFullWidth | 14 | Arabic full-width numeric style.
wdListNumberStyleArabicLZ | 22 | Arabic LZ numeric style.
wdListNumberStyleArabicLZ2 | 62 | Arabic LZ2 numeric style.
wdListNumberStyleArabicLZ3 | 63 | Arabic LZ3 numeric style.
wdListNumberStyleArabicLZ4 | 64 | Arabic LZ4 numeric style.
wdListNumberStyleBullet | 23 | Bullet style.
wdListNumberStyleCardinalText | 6 | Cardinal text style.
wdListNumberStyleChosung | 25 | Chosung style.
wdListNumberStyleGanada | 24 | Ganada style.
wdListNumberStyleGBNum1 | 26 | GB numeric 1 style.
wdListNumberStyleGBNum2 | 27 | GB numeric 2 style.
wdListNumberStyleGBNum3 | 28 | GB numeric 3 style.
wdListNumberStyleGBNum4 | 29 | GB numeric 4 style.
wdListNumberStyleHangul | 43 | Hanqul style.
wdListNumberStyleHanja | 44 | Hanja style.
wdListNumberStyleHanjaRead | 41 | Hanja Read style.
wdListNumberStyleHanjaReadDigit | 42 | Hanja Read Digit style.
wdListNumberStyleHebrew1 | 45 | Hebrew 1 style.
wdListNumberStyleHebrew2 | 47 | Hebrew 2 style.
wdListNumberStyleHindiArabic | 51 | Hindi Arabic style.
wdListNumberStyleHindiCardinalText | 52 | Hindi Cardinal text style.
wdListNumberStyleHindiLetter1 | 49 | Hindi letter 1 style.
wdListNumberStyleHindiLetter2 | 50 | Hindi letter 2 style.
wdListNumberStyleIroha | 21 | Iroha style.
wdListNumberStyleIrohaHalfWidth | 13 | Iroha half width style.
wdListNumberStyleKanji | 10 | Kanji style.
wdListNumberStyleKanjiDigit | 11 | Kanji Digit style.
wdListNumberStyleKanjiTraditional | 16 | Kanji traditional style.
wdListNumberStyleKanjiTraditional2 | 17 | Kanji traditional 2 style.
wdListNumberStyleLegal | 253 | Legal style.
wdListNumberStyleLegalLZ | 254 | Legal LZ style.
wdListNumberStyleLowercaseBulgarian | 67 | Lowercase Bulgarian style.
wdListNumberStyleLowercaseGreek | 60 | Lowercase Greek style.
wdListNumberStyleLowercaseLetter | 4 | Lowercase letter style.
wdListNumberStyleLowercaseRoman | 2 | Lowercase Roman style.
wdListNumberStyleLowercaseRussian | 58 | Lowercase Russian style.
wdListNumberStyleLowercaseTurkish | 65 | Lowercase Turkish style.
wdListNumberStyleNone | 255 | No style applied.
wdListNumberStyleNumberInCircle | 18 | Number in circle style.
wdListNumberStyleOrdinal | 5 | Ordinal style.
wdListNumberStyleOrdinalText | 7 | Ordinal text style.
wdListNumberStylePictureBullet | 249 | Picture bullet style.
wdListNumberStyleSimpChinNum1 | 37 | Simplified Chinese numeric 1 style.
wdListNumberStyleSimpChinNum2 | 38 | Simplified Chinese numeric 2 style.
wdListNumberStyleSimpChinNum3 | 39 | Simplified Chinese numeric 3 style.
wdListNumberStyleSimpChinNum4 | 40 | Simplified Chinese numeric 4 style.
wdListNumberStyleThaiArabic | 54 | Thai Arabic style.
wdListNumberStyleThaiCardinalText | 55 | Thai Cardinal text style.
wdListNumberStyleThaiLetter | 53 | Thai letter style.
wdListNumberStyleTradChinNum1 | 33 | Traditional Chinese numeric 1 style.
wdListNumberStyleTradChinNum2 | 34 | Traditional Chinese numeric 2 style.
wdListNumberStyleTradChinNum3 | 35 | Traditional Chinese numeric 3 style.
wdListNumberStyleTradChinNum4 | 36 | Traditional Chinese numeric 4 style.
wdListNumberStyleUppercaseBulgarian | 68 | Uppercase Bulgarian style.
wdListNumberStyleUppercaseGreek | 61 | Uppercase Greek style.
wdListNumberStyleUppercaseLetter | 3 | Uppercase letter style.
wdListNumberStyleUppercaseRoman | 1 | Uppercase Roman style.
wdListNumberStyleUppercaseRussian | 59 | Uppercase Russian style.
wdListNumberStyleUppercaseTurkish | 66 | Uppercase Turkish style.
wdListNumberStyleVietCardinalText | 56 | Vietnamese Cardinal text style.
wdListNumberStyleZodiac1 | 30 | Zodiac 1 style.
wdListNumberStyleZodiac2 | 31 | Zodiac 2 style.
wdListNumberStyleZodiac3 | 32 | Zodiac 3 style.


WdListType Enumeration (Word)

 Copy code hover
[image]

WdListType Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies a type of list.

Name | Value | Description
wdListBullet | 2 | Bulleted list.
wdListListNumOnly | 1 | ListNum fields that can be used in the body of a paragraph.
wdListMixedNumbering | 5 | Mixed numeric list.
wdListNoNumbering | 0 | List with no bullets, numbering, or outlining.
wdListOutlineNumbering | 4 | Outlined list.
wdListPictureBullet | 6 | Picture bulleted list.
wdListSimpleNumbering | 3 | Simple numeric list.


WdLockType Enumeration (Word)

 Copy code hover
[image]

WdLockType Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the type of lock for a CoAuthLock object.

Version Information

Version Added: Word 2010

Name | Value | Description
wdLockChanged | 3 | Specifies a placeholder lock. A placeholder lock indicates that another user has removed their lock from the range, but the current user has not updated their view of the document by saving.
wdLockEphemeral | 2 | Specifies an ephemeral lock. Word 2010 implicitly places an ephemeral lock on a range when a user begins editing a range in a document with co-authoring enabled.
wdLockNone | 0 | Reserved for future use.
wdLockReservation | 1 | Specifies a reservation lock. A reservation lock is explicitly created by a user through the Block Authors button on the Review tab in Word 2010.


WdMailerPriority Enumeration (Word)

 Copy code hover
[image]

WdMailerPriority Enumeration (Word)
Send feedback

Published: July 16, 2012

This enumeration has been deprecated and should not be used.

Name | Value | Description
wdPriorityHigh | 3 | Not supported.
wdPriorityLow | 2 | Not supported.
wdPriorityNormal | 1 | Not supported.


WdMailMergeActiveRecord Enumeration (Word)

 Copy code hover
[image]

WdMailMergeActiveRecord Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the active record in a mail merge result set.

Name | Value | Description
wdFirstDataSourceRecord | -6 | The first record in the data source.
wdFirstRecord | -4 | The first record in the result set.
wdLastDataSourceRecord | -7 | The last record in the data source.
wdLastRecord | -5 | The last record in the result set.
wdNextDataSourceRecord | -8 | The next record in the data source.
wdNextRecord | -2 | The next record in the result set.
wdNoActiveRecord | -1 | No active record.
wdPreviousDataSourceRecord | -9 | The previous record in the data source.
wdPreviousRecord | -3 | The previous record in the result set.


WdMailMergeComparison Enumeration (Word)

 Copy code hover
[image]

WdMailMergeComparison Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the type of comparison to use when a condition is added to a mail merge process.

Name | Value | Description
wdMergeIfEqual | 0 | A value is output if the mail merge field is equal to a value.
wdMergeIfGreaterThan | 3 | A value is output if the mail merge field is greater than a value.
wdMergeIfGreaterThanOrEqual | 5 | A value is output if the mail merge field is greater than or equal to a value.
wdMergeIfIsBlank | 6 | A value is output if the mail merge field is blank.
wdMergeIfIsNotBlank | 7 | A value is output if the mail merge field is not blank.
wdMergeIfLessThan | 2 | A value is output if the mail merge field is less than a value.
wdMergeIfLessThanOrEqual | 4 | A value is output if the mail merge field is less than or equal to a value.
wdMergeIfNotEqual | 1 | A value is output if the mail merge field is not equal to a value.


WdMailMergeDataSource Enumeration (Word)

 Copy code hover
[image]

WdMailMergeDataSource Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the data source for a mail merge operation.

Name | Value | Description
wdMergeInfoFromAccessDDE | 1 | From Microsoft Access using Dynamic Data Exchange (DDE).
wdMergeInfoFromExcelDDE | 2 | From Microsoft Excel using DDE.
wdMergeInfoFromMSQueryDDE | 3 | From MSQuery using DDE.
wdMergeInfoFromODBC | 4 | From an Open Database Connectivity (ODBC) connection.
wdMergeInfoFromODSO | 5 | From an Office Data Source Object (ODSO).
wdMergeInfoFromWord | 0 | From Microsoft Word.
wdNoMergeInfo | -1 | No merge information provided.


WdMailMergeDefaultRecord Enumeration (Word)

 Copy code hover
[image]

WdMailMergeDefaultRecord Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the default record to use in a mail merge process.

Name | Value | Description
wdDefaultFirstRecord | 1 | Use the first record in the result set as the default record.
wdDefaultLastRecord | -16 | Use the last record in the result set as the default record.


WdMailMergeDestination Enumeration (Word)

 Copy code hover
[image]

WdMailMergeDestination Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies a destination for mail merge results.

Name | Value | Description
wdSendToEmail | 2 | Send results to e-mail recipient.
wdSendToFax | 3 | Send results to fax recipient.
wdSendToNewDocument | 0 | Send results to a new Word document.
wdSendToPrinter | 1 | Send results to a printer.


WdMailMergeMailFormat Enumeration (Word)

 Copy code hover
[image]

WdMailMergeMailFormat Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the format to use when the mail merge destination is an e-mail message.

Name | Value | Description
wdMailFormatHTML | 1 | Sends mail merge e-mail documents using HTML format.
wdMailFormatPlainText | 0 | Sends mail merge e-mail documents using plain text.


WdMailMergeMainDocType Enumeration (Word)

 Copy code hover
[image]

WdMailMergeMainDocType Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies a type of mail merge document.

Name | Value | Description
wdCatalog | 3 | Catalog.
wdDirectory | 3 | Directory.
wdEMail | 4 | E-mail message.
wdEnvelopes | 2 | Envelope.
wdFax | 5 | Fax.
wdFormLetters | 0 | Form letter.
wdMailingLabels | 1 | Mailing label.
wdNotAMergeDocument | -1 | Not a merge document.


WdMailMergeState Enumeration (Word)

 Copy code hover
[image]

WdMailMergeState Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the state of a mail merge operation.

Name | Value | Description
wdDataSource | 5 | A data source with no main document.
wdMainAndDataSource | 2 | A main document with an attached data source.
wdMainAndHeader | 3 | A main document with an attached header source.
wdMainAndSourceAndHeader | 4 | A main document with attached data source and header source.
wdMainDocumentOnly | 1 | A main document with no data attached.
wdNormalDocument | 0 | Document is not involved in a mail merge operation.


WdMailSystem Enumeration (Word)

 Copy code hover
[image]

WdMailSystem Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the type of mail system.

Name | Value | Description
wdMAPI | 1 | Standard Messaging Application Programming Interface (MAPI) mail system.
wdMAPIandPowerTalk | 3 | Both a standard Messaging Application Programming Interface (MAPI) mail system and a PowerTalk mail system.
wdNoMailSystem | 0 | No mail system.
wdPowerTalk | 2 | PowerTalk mail system.


WdMappedDataFields Enumeration (Word)

 Copy code hover
[image]

WdMappedDataFields Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies a type of mapped data field.

Name | Value | Description
wdAddress1 | 10 | Address 1 field.
wdAddress2 | 11 | Address 2 field.
wdAddress3 | 29 | Address 3 field.
wdBusinessFax | 17 | Business fax field.
wdBusinessPhone | 16 | Business phone field.
wdCity | 12 | City field.
wdCompany | 9 | Company field.
wdCountryRegion | 15 | Country/region field.
wdCourtesyTitle | 2 | Courtesy title field.
wdDepartment | 30 | Department field.
wdEmailAddress | 20 | E-mail address field.
wdFirstName | 3 | First name field.
wdHomeFax | 19 | Home fax field.
wdHomePhone | 18 | Home phone field.
wdJobTitle | 8 | Job title field.
wdLastName | 5 | Last name field.
wdMiddleName | 4 | Middle name field.
wdNickname | 7 | Nickname field.
wdPostalCode | 14 | Postal code field.
wdRubyFirstName | 27 | Ruby first name field.
wdRubyLastName | 28 | Ruby last name field.
wdSpouseCourtesyTitle | 22 | Spouse/partner courtesy title field.
wdSpouseFirstName | 23 | Spouse/partner first name field.
wdSpouseLastName | 25 | Spouse/partner last name field.
wdSpouseMiddleName | 24 | Spouse/partner middle name field.
wdSpouseNickname | 26 | Spouse/partner nickname field.
wdState | 13 | State field.
wdSuffix | 6 | Suffix field.
wdUniqueIdentifier | 1 | Unique identifier field.
wdWebPageURL | 21 | Web page uniform resource locator (URL) field.


WdMeasurementUnits Enumeration (Word)

 Copy code hover
[image]

WdMeasurementUnits Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies a unit of measure to use.

Name | Value | Description
wdCentimeters | 1 | Centimeters.
wdInches | 0 | Inches.
wdMillimeters | 2 | Millimeters.
wdPicas | 4 | Picas (commonly used in traditional typewriter font spacing).
wdPoints | 3 | Points.


WdMergeFormatFrom Enumeration (Word)

 Copy code hover
[image]

WdMergeFormatFrom Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the document from which to retain formatting during a document compare function.

Version Information

Version Added: Word 2007

Name | Value | Description
wdMergeFormatFromOriginal | 0 | Retains formatting from the original document.
wdMergeFormatFromPrompt | 2 | Prompt the user for the document to use for formatting.
wdMergeFormatFromRevised | 1 | Retains formatting from the revised document.


WdMergeSubType Enumeration (Word)

 Copy code hover
[image]

WdMergeSubType Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the data source to be attached to the current document.

Name | Value | Description
wdMergeSubTypeAccess | 1 | Microsoft Access.
wdMergeSubTypeOAL | 2 | Office Address List.
wdMergeSubTypeOLEDBText | 5 | OLE database.
wdMergeSubTypeOLEDBWord | 3 | OLE database.
wdMergeSubTypeOther | 0 | Other type of data source.
wdMergeSubTypeOutlook | 6 | Microsoft Outlook.
wdMergeSubTypeWord | 7 | Microsoft Word.
wdMergeSubTypeWord2000 | 8 | Microsoft Word 2000.
wdMergeSubTypeWorks | 4 | Microsoft Works.


WdMergeTarget Enumeration (Word)

 Copy code hover
[image]

WdMergeTarget Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the target for a Compare and Merge Documents process.

Name | Value | Description
wdMergeTargetCurrent | 1 | Merge into current document.
wdMergeTargetNew | 2 | Merge into new document.
wdMergeTargetSelected | 0 | Merge into selected document.


WdMonthNames Enumeration (Word)

 Copy code hover
[image]

WdMonthNames Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the format in which to display month names.

Name | Value | Description
wdMonthNamesArabic | 0 | Arabic format.
wdMonthNamesEnglish | 1 | English format.
wdMonthNamesFrench | 2 | French format.


WdMoveFromTextMark Enumeration (Word)

 Copy code hover
[image]

WdMoveFromTextMark Enumeration (Word)
Send feedback

Published: July 16, 2012

Marks the moved-from text when text in a document with tracked changes is moved from one place to another.

Name | Value | Description
wdMoveFromTextMarkBold | 6 | Marks moved text with bold formatting.
wdMoveFromTextMarkCaret | 3 | Marks moved text with a caret.
wdMoveFromTextMarkColorOnly | 10 | Marks moved text with color only. Use the MoveFromTextColor property to set the color of moved text.
wdMoveFromTextMarkDoubleStrikeThrough | 1 | Marks moved text with a double strikethrough.
wdMoveFromTextMarkDoubleUnderline | 9 | Marks moved text with a double underline.
wdMoveFromTextMarkHidden | 0 | Hides moved text.
wdMoveFromTextMarkItalic | 7 | Marks moved text with italic formatting.
wdMoveFromTextMarkNone | 5 | No special formatting for moved text.
wdMoveFromTextMarkPound | 4 | Marks moved text with a pound (number) sign.
wdMoveFromTextMarkStrikeThrough | 2 | Marks moved text with a strikethrough.
wdMoveFromTextMarkUnderline | 8 | Underlines moved text.


WdMovementType Enumeration (Word)

 Copy code hover
[image]

WdMovementType Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the way the selection is moved.

Name | Value | Description
wdExtend | 1 | The end of the selection is extended to the end of the specified unit.
wdMove | 0 | The selection is collapsed to an insertion point and moved to the end of the specified unit. Default.


WdMoveToTextMark Enumeration (Word)

 Copy code hover
[image]

WdMoveToTextMark Enumeration (Word)
Send feedback

Published: July 16, 2012

Marks the moved-to text when text in a document with tracked changes is moved from one place to another.

Name | Value | Description
wdMoveToTextMarkBold | 1 | Marks moved text with bold formatting.
wdMoveToTextMarkColorOnly | 5 | Marks moved text with color only. Use the MoveToTextColor property to set the color of moved text.
wdMoveToTextMarkDoubleStrikeThrough | 7 | Moved text is marked with a double strikethrough.
wdMoveToTextMarkDoubleUnderline | 4 | Moved text is marked with a double underline.
wdMoveToTextMarkItalic | 2 | Marks moved text with italic formatting.
wdMoveToTextMarkNone | 0 | No special formatting for moved text.
wdMoveToTextMarkStrikeThrough | 6 | Moved text is marked with a strikethrough.
wdMoveToTextMarkUnderline | 3 | Underlines moved text.


WdMultipleWordConversionsMode Enumeration (Word)

 Copy code hover
[image]

WdMultipleWordConversionsMode Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the direction for conversion between Hangul and Hanja.

Name | Value | Description
wdHangulToHanja | 0 | Hangul to Hanja.
wdHanjaToHangul | 1 | Hanja to Hangul.


WdNewDocumentType Enumeration (Word)

 Copy code hover
[image]

WdNewDocumentType Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the type of new document to create.

Name | Value | Description
wdNewBlankDocument | 0 | Blank document.
wdNewEmailMessage | 2 | E-mail message.
wdNewFrameset | 3 | Frameset.
wdNewWebPage | 1 | Web page.
wdNewXMLDocument | 4 | XML document.


WdNoteNumberStyle Enumeration (Word)

 Copy code hover
[image]

WdNoteNumberStyle Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the number style to apply to endnotes, endnote options, footnotes, or footnote options.

Name | Value | Description
wdNoteNumberStyleArabic | 0 | Arabic number style.
wdNoteNumberStyleArabicFullWidth | 14 | Arabic full-width number style.
wdNoteNumberStyleArabicLetter1 | 46 | Arabic letter style 1.
wdNoteNumberStyleArabicLetter2 | 48 | Arabic letter style 2.
wdNoteNumberStyleHanjaRead | 41 | Hanja read number style.
wdNoteNumberStyleHanjaReadDigit | 42 | Hanja read digit number style.
wdNoteNumberStyleHebrewLetter1 | 45 | Hebrew letter style 1.
wdNoteNumberStyleHebrewLetter2 | 47 | Hebrew letter style 2.
wdNoteNumberStyleHindiArabic | 51 | Hindi Arabic number style.
wdNoteNumberStyleHindiCardinalText | 52 | Hindi Cardinal text style.
wdNoteNumberStyleHindiLetter1 | 49 | Hindi letter style 1.
wdNoteNumberStyleHindiLetter2 | 50 | Hindi letter style 2.
wdNoteNumberStyleKanji | 10 | Kanji number style.
wdNoteNumberStyleKanjiDigit | 11 | Kanji digit number style.
wdNoteNumberStyleKanjiTraditional | 16 | Kanji traditional number style.
wdNoteNumberStyleLowercaseLetter | 4 | Lowercase letter style.
wdNoteNumberStyleLowercaseRoman | 2 | Lowercase Roman number style.
wdNoteNumberStyleNumberInCircle | 18 | Number in circle number style.
wdNoteNumberStyleSimpChinNum1 | 37 | Simplified Chinese number style 1.
wdNoteNumberStyleSimpChinNum2 | 38 | Simplified Chinese number style 2.
wdNoteNumberStyleSymbol | 9 | Symbol number style.
wdNoteNumberStyleThaiArabic | 54 | Thai Arabic number style.
wdNoteNumberStyleThaiCardinalText | 55 | Thai Cardinal text style.
wdNoteNumberStyleThaiLetter | 53 | Thai letter style.
wdNoteNumberStyleTradChinNum1 | 33 | Traditional Chinese number style 1.
wdNoteNumberStyleTradChinNum2 | 34 | Traditional Chinese number style 2.
wdNoteNumberStyleUppercaseLetter | 3 | Uppercase letter style.
wdNoteNumberStyleUppercaseRoman | 1 | Uppercase Roman number style.
wdNoteNumberStyleVietCardinalText | 56 | Vietnamese Cardinal text style.


WdNumberForm Enumeration (Word)

 Copy code hover
[image]

WdNumberForm Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the number form setting for an OpenType font.

Version Information

Version Added: Word 2010

Name | Value | Description
wdNumberFormDefault | 0 | Applies the default number form for the font.
wdNumberFormLining | 1 | Applies the lining number form to the font.
wdNumberFormOldstyle | 2 | Applies the "old-style" number form to the font.


WdNumberingRule Enumeration (Word)

 Copy code hover
[image]

WdNumberingRule Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the numbering rule to apply.

Name | Value | Description
wdRestartContinuous | 0 | Numbers are assigned continuously.
wdRestartPage | 2 | Numbers are reset for each page.
wdRestartSection | 1 | Numbers are reset for each section.


WdNumberSpacing Enumeration (Word)

 Copy code hover
[image]

WdNumberSpacing Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the number spacing setting for an OpenType font.

Version Information

Version Added: Word 2010

Name | Value | Description
wdNumberSpacingDefault | 0 | Applies the default number spacing for the font.
wdNumberSpacingProportional | 1 | Applies proportional number spacing to the font.
wdNumberSpacingTabular | 2 | Applies tabular number spacing to the font.


WdNumberStyleWordBasicBiDi Enumeration (Word)

 Copy code hover
[image]

WdNumberStyleWordBasicBiDi Enumeration (Word)
Send feedback

Published: July 16, 2012

This enumeration has been deprecated and should not be used.

Name | Value | Description
wdCaptionNumberStyleBidiLetter1 | 49 | Not supported.
wdCaptionNumberStyleBidiLetter2 | 50 | Not supported.
wdListNumberStyleBidi1 | 49 | Not supported.
wdListNumberStyleBidi2 | 50 | Not supported.
wdNoteNumberStyleBidiLetter1 | 49 | Not supported.
wdNoteNumberStyleBidiLetter2 | 50 | Not supported.
wdPageNumberStyleBidiLetter1 | 49 | Not supported.
wdPageNumberStyleBidiLetter2 | 50 | Not supported.


WdNumberType Enumeration (Word)

 Copy code hover
[image]

WdNumberType Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the type of number.

Name | Value | Description
wdNumberAllNumbers | 3 | Default value for all other cases.
wdNumberListNum | 2 | Default value for LISTNUM fields.
wdNumberParagraph | 1 | Preset numbers you can add to paragraphs by selecting a template in the Bullets and Numbering dialog box.


WdOLEPlacement Enumeration (Word)

 Copy code hover
[image]

WdOLEPlacement Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the placement for an OLE object.

Name | Value | Description
wdFloatOverText | 1 | Float over text.
wdInLine | 0 | In line with text.


WdOLEType Enumeration (Word)

 Copy code hover
[image]

WdOLEType Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the type of an OLE object.

Name | Value | Description
wdOLEControl | 2 | OLE control.
wdOLEEmbed | 1 | Embedded OLE object.
wdOLELink | 0 | Linked OLE object.


WdOLEVerb Enumeration (Word)

 Copy code hover
[image]

WdOLEVerb Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the action associated with the verb that the OLE object should perform.

Name | Value | Description
wdOLEVerbDiscardUndoState | -6 | Forces the object to discard any undo state that it might be maintaining; note that the object remains active, however.
wdOLEVerbHide | -3 | Removes the object's user interface from view.
wdOLEVerbInPlaceActivate | -5 | Runs the object and installs its window, but doesn't install any user-interface tools.
wdOLEVerbOpen | -2 | Opens the object in a separate window.
wdOLEVerbPrimary | 0 | Performs the verb that is invoked when the user double-clicks the object.
wdOLEVerbShow | -1 | Shows the object to the user for editing or viewing. Use it to show a newly inserted object for initial editing.
wdOLEVerbUIActivate | -4 | Activates the object in place and displays any user-interface tools that the object needs, such as menus or toolbars.


WdOMathBreakBin Enumeration (Word)

 Copy code hover
[image]

WdOMathBreakBin Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies where Microsoft Word places binary operators when equations span two or more lines.

Version Information

Version Added: Word 2007

Name | Value | Description
wdOMathBreakBinAfter | 1 | Places the operator before a line break, at the end of the line.
wdOMathBreakBinBefore | 0 | Places the operator after a line break, at the beginning of the following line.
wdOMathBreakBinRepeat | 2 | Repeats the operator before a line break at the end of the line and after a line break at the beginning of the following line.


WdOMathBreakSub Enumeration (Word)

 Copy code hover
[image]

WdOMathBreakSub Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies how Microsoft Word handles a subtraction operator that falls before a line break.

Version Information

Version Added: Word 2007

Name | Value | Description
wdOMathBreakSubMinusMinus | 0 | Repeats a minus sign that ends before a line break at the beginning of the next line. Default.
wdOMathBreakSubMinusPlus | 2 | Inserts a minus sign at the end of the first line, before the line break, and a plus sign at the beginning of the following line, before the number.
wdOMathBreakSubPlusMinus | 1 | Inserts a plus sign at the end of the first line, before the line break, and a minus sign at the beginning of the following line, before the number.


WdOMathFracType Enumeration (Word)

 Copy code hover
[image]

WdOMathFracType Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the type of fraction bar.

Version Information

Version Added: Word 2007

Name | Value | Description
wdOMathFracBar | 0 | Normal fraction bar.
wdOMathFracLin | 3 | Show fraction inline.
wdOMathFracNoBar | 1 | No fraction bar.
wdOMathFracSkw | 2 | Skewed fraction bar.


WdOMathFunctionType Enumeration (Word)

 Copy code hover
[image]

WdOMathFunctionType Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the type of equation function.

Version Information

Version Added: Word 2007

Name | Value | Description
wdOMathFunctionAcc | 1 | Equation accent mark.
wdOMathFunctionBar | 2 | Equation fraction bar.
wdOMathFunctionBorderBox | 4 | Border box.
wdOMathFunctionBox | 3 | Box.
wdOMathFunctionDelim | 5 | Equation delimiters.
wdOMathFunctionEqArray | 6 | Equation array.
wdOMathFunctionFrac | 7 | Equation fraction.
wdOMathFunctionFunc | 8 | Equation function.
wdOMathFunctionGroupChar | 9 | Group character.
wdOMathFunctionLimLow | 10 | Equation lower limit.
wdOMathFunctionLimUpp | 11 | Equation upper limit.
wdOMathFunctionMat | 12 | Equation matrix.
wdOMathFunctionNary | 13 | Equation N-ary operator.
wdOMathFunctionNormalText | 21 | Equation normal text.
wdOMathFunctionPhantom | 14 | Equation phantom.
wdOMathFunctionRad | 16 | Equation base expression.
wdOMathFunctionScrPre | 15 | Scr pre.
wdOMathFunctionScrSub | 17 | Scr. sub.
wdOMathFunctionScrSubSup | 18 | Scr. sub sup.
wdOMathFunctionScrSup | 19 | Scr sup.
wdOMathFunctionText | 20 | Equation text.


WdOMathHorizAlignType Enumeration (Word)

 Copy code hover
[image]

WdOMathHorizAlignType Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the horizontal alignment for an equation.

Version Information

Version Added: Word 2007

Name | Value | Description
wdOMathHorizAlignCenter | 0 | Centered.
wdOMathHorizAlignLeft | 1 | Left alignment.
wdOMathHorizAlignRight | 2 | Right alignment.


WdOMathJc Enumeration (Word)

 Copy code hover
[image]

WdOMathJc Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the default justification for equations.

Version Information

Version Added: Word 2007

Name | Value | Description
wdOMathJcCenter | 2 | Center.
wdOMathJcCenterGroup | 1 | Center as a group.
wdOMathJcInline | 7 | Inline.
wdOMathJcLeft | 3 | Left.
wdOMathJcRight | 4 | Right.


WdOMathShapeType Enumeration (Word)

 Copy code hover
[image]

WdOMathShapeType Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the appearance of delimiters (parentheses, braces, brackets) in relationship to the content that they surround.

Version Information

Version Added: Word 2007

Name | Value | Description
wdOMathShapeCentered | 0 | Vertically centers delimiters around the entire height of the equation causing delimiters grow equally above and below their midpoint.
wdOMathShapeMatch | 1 | Matches the shape of the delimiters to the size of their contents.


WdOMathSpacingRule Enumeration (Word)

 Copy code hover
[image]

WdOMathSpacingRule Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies spacing for an equation.

Version Information

Version Added: Word 2007

Name | Value | Description
wdOMathSpacing1pt5 | 1 | One and half spaces for each line.
wdOMathSpacingDouble | 2 | Double spacing.
wdOMathSpacingExactly | 3 | Exact spacing measurement.
wdOMathSpacingMultiple | 4 | Custom spacing measurement.
wdOMathSpacingSingle | 0 | Single spacing.


WdOMathType Enumeration (Word)

 Copy code hover
[image]

WdOMathType Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the display format type of equation.

Version Information

Version Added: Word 2007

Name | Value | Description
wdOMathDisplay | 0 | Professional format.
wdOMathInline | 1 | Inline.


WdOMathVertAlignType Enumeration (Word)

 Copy code hover
[image]

WdOMathVertAlignType Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the vertical alignment of equations within the shape canvas or the line, for inline equations.

Version Information

Version Added: Word 2007

Name | Value | Description
wdOMathVertAlignBottom | 2 | Aligns the equation on the bottom of the shape canvas or line.
wdOMathVertAlignCenter | 0 | Vertically centers the equation in the shape canvas or line.
wdOMathVertAlignTop | 1 | Aligns the equation on the top of the shape canvas or line.


WdOpenFormat Enumeration (Word)

 Copy code hover
[image]

WdOpenFormat Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the format to use when opening a document.

Name | Value | Description
wdOpenFormatAllWord | 6 | A Microsoft Word format that is backward compatible with earlier versions of Word.
wdOpenFormatAuto | 0 | The existing format.
wdOpenFormatDocument | 1 | Word format.
wdOpenFormatEncodedText | 5 | Encoded text format.
wdOpenFormatRTF | 3 | Rich text format (RTF).
wdOpenFormatTemplate | 2 | As a Word template.
wdOpenFormatText | 4 | Unencoded text format.
wdOpenFormatOpenDocumentText | 18 (&H12) | OpenDocument Text format.
wdOpenFormatUnicodeText | 5 | Unicode text format.
wdOpenFormatWebPages | 7 | HTML format.
wdOpenFormatXML | 8 | XML format.
wdOpenFormatAllWordTemplates | 13 | Word template format.
wdOpenFormatDocument97 | 1 | Microsoft Word 97 document format.
wdOpenFormatTemplate97 | 2 | Word 97 template format.
wdOpenFormatXMLDocument | 9 | XML document format.
wdOpenFormatXMLDocumentSerialized | 14 | Open XML file format saved as a single XML file.
wdOpenFormatXMLDocumentMacroEnabled | 10 | XML document format with macros enabled.
wdOpenFormatXMLDocumentMacroEnabledSerialized | 15 | Open XML file format with macros enabled saved as a single XML file.
wdOpenFormatXMLTemplate | 11 | XML template format.
wdOpenFormatXMLTemplateSerialized | 16 (&H10) | Open XML template format saved as a XML single file.
wdOpenFormatXMLTemplateMacroEnabled | 12 | XML template format with macros enabled.
wdOpenFormatXMLTemplateMacroEnabledSerialized | 17 (&H11) | Open XML template format with macros enabled saved as a single XML file.


WdOrganizerObject Enumeration (Word)

 Copy code hover
[image]

WdOrganizerObject Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the type of object used by a delete, copy, or rename action.

Name | Value | Description
wdOrganizerObjectAutoText | 1 | An AutoText item.
wdOrganizerObjectCommandBars | 2 | A command bar item.
wdOrganizerObjectProjectItems | 3 | A project item.
wdOrganizerObjectStyles | 0 | A style item.


WdOrientation Enumeration (Word)

 Copy code hover
[image]

WdOrientation Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies a page layout orientation.

Name | Value | Description
wdOrientLandscape | 1 | Landscape orientation.
wdOrientPortrait | 0 | Portrait orientation.


WdOriginalFormat Enumeration (Word)

 Copy code hover
[image]

WdOriginalFormat Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the document format. This enumeration is commonly used when saving a document.

Name | Value | Description
wdOriginalDocumentFormat | 1 | Original document format.
wdPromptUser | 2 | Prompt user to select a document format.
wdWordDocument | 0 | Microsoft Word document format.


WdOutlineLevel Enumeration (Word)

 Copy code hover
[image]

WdOutlineLevel Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the outline level to apply to a paragraph.

Name | Value | Description
wdOutlineLevel1 | 1 | Outline level 1.
wdOutlineLevel2 | 2 | Outline level 2.
wdOutlineLevel3 | 3 | Outline level 3.
wdOutlineLevel4 | 4 | Outline level 4.
wdOutlineLevel5 | 5 | Outline level 5.
wdOutlineLevel6 | 6 | Outline level 6.
wdOutlineLevel7 | 7 | Outline level 7.
wdOutlineLevel8 | 8 | Outline level 8.
wdOutlineLevel9 | 9 | Outline level 9.
wdOutlineLevelBodyText | 10 | No outline level.


WdPageBorderArt Enumeration (Word)

 Copy code hover
[image]

WdPageBorderArt Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the graphical page border setting of a page.

Name | Value | Description
wdArtApples | 1 | An apple border.
wdArtArchedScallops | 97 | An arched scalloped border.
wdArtBabyPacifier | 70 | A baby pacifier border.
wdArtBabyRattle | 71 | A baby rattle border.
wdArtBalloons3Colors | 11 | Balloons in three colors as the border.
wdArtBalloonsHotAir | 12 | A hot air balloon border.
wdArtBasicBlackDashes | 155 | A basic black-dashed border.
wdArtBasicBlackDots | 156 | A basic black-dotted border.
wdArtBasicBlackSquares | 154 | A basic black squares border.
wdArtBasicThinLines | 151 | A basic thin-lines border.
wdArtBasicWhiteDashes | 152 | A basic white-dashed border.
wdArtBasicWhiteDots | 147 | A basic white-dotted border.
wdArtBasicWhiteSquares | 153 | A basic white squares border.
wdArtBasicWideInline | 150 | A basic wide inline border.
wdArtBasicWideMidline | 148 | A basic wide midline border.
wdArtBasicWideOutline | 149 | A basic wide outline border.
wdArtBats | 37 | A bats border.
wdArtBirds | 102 | A birds border.
wdArtBirdsFlight | 35 | A birds-in-flight border.
wdArtCabins | 72 | A cabins border.
wdArtCakeSlice | 3 | A cake slice border.
wdArtCandyCorn | 4 | A candy corn border.
wdArtCelticKnotwork | 99 | A Celtic knotwork border.
wdArtCertificateBanner | 158 | A certificate banner border.
wdArtChainLink | 128 | A chain-link border.
wdArtChampagneBottle | 6 | A champagne bottle border.
wdArtCheckedBarBlack | 145 | A checked-bar black border.
wdArtCheckedBarColor | 61 | A checked-bar colored border.
wdArtCheckered | 144 | A checkered border.
wdArtChristmasTree | 8 | A Christmas tree border.
wdArtCirclesLines | 91 | A circles-and-lines border.
wdArtCirclesRectangles | 140 | A circles-and-rectangles border.
wdArtClassicalWave | 56 | A classical wave border.
wdArtClocks | 27 | A clocks border.
wdArtCompass | 54 | A compass border.
wdArtConfetti | 31 | A confetti border.
wdArtConfettiGrays | 115 | A confetti border using shades of gray.
wdArtConfettiOutline | 116 | A confetti outline border.
wdArtConfettiStreamers | 14 | A confetti streamers border.
wdArtConfettiWhite | 117 | A confetti white border.
wdArtCornerTriangles | 141 | A triangles border.
wdArtCouponCutoutDashes | 163 | A coupon-cut-out dashes border.
wdArtCouponCutoutDots | 164 | A coupon-cut-out dots border.
wdArtCrazyMaze | 100 | A crazy maze border.
wdArtCreaturesButterfly | 32 | A butterfly border.
wdArtCreaturesFish | 34 | A fish border.
wdArtCreaturesInsects | 142 | An insect border.
wdArtCreaturesLadyBug | 33 | A ladybug border.
wdArtCrossStitch | 138 | A cross-stitch border.
wdArtCup | 67 | A cup border.
wdArtDecoArch | 89 | A deco arch border.
wdArtDecoArchColor | 50 | A deco arch colored border.
wdArtDecoBlocks | 90 | A deco blocks border.
wdArtDiamondsGray | 88 | A diamond border using shades of gray.
wdArtDoubleD | 55 | A double-D border.
wdArtDoubleDiamonds | 127 | A double-diamonds border.
wdArtEarth1 | 22 | An earth number 1 border.
wdArtEarth2 | 21 | An earth number 2 border.
wdArtEclipsingSquares1 | 101 | An eclipsing squares number 1 border.
wdArtEclipsingSquares2 | 86 | An eclipsing squares number 2 border.
wdArtEggsBlack | 66 | A black eggs border.
wdArtFans | 51 | A fans border.
wdArtFilm | 52 | A film border.
wdArtFirecrackers | 28 | A fire crackers border.
wdArtFlowersBlockPrint | 49 | A block flowers print border.
wdArtFlowersDaisies | 48 | A daisies border.
wdArtFlowersModern1 | 45 | A modern flowers number 1 border.
wdArtFlowersModern2 | 44 | A modern flowers number 2 border.
wdArtFlowersPansy | 43 | A pansy border.
wdArtFlowersRedRose | 39 | A red rose border.
wdArtFlowersRoses | 38 | A rose border.
wdArtFlowersTeacup | 103 | A teacup border.
wdArtFlowersTiny | 42 | A tiny flower border.
wdArtGems | 139 | A gems border.
wdArtGingerbreadMan | 69 | A gingerbread man border.
wdArtGradient | 122 | A gradient border.
wdArtHandmade1 | 159 | A handmade number 1 border.
wdArtHandmade2 | 160 | A handmade number 2 border.
wdArtHeartBalloon | 16 | A heart-balloon border.
wdArtHeartGray | 68 | A heart border in shades of gray.
wdArtHearts | 15 | A hearts border.
wdArtHeebieJeebies | 120 | A heebie-jeebies border.
wdArtHolly | 41 | A holly border.
wdArtHouseFunky | 73 | A funky house border.
wdArtHypnotic | 87 | An hypnotic border.
wdArtIceCreamCones | 5 | An ice cream cones border.
wdArtLightBulb | 121 | A light bulb border.
wdArtLightning1 | 53 | A lightning number 1 border.
wdArtLightning2 | 119 | A lightning number 2 border.
wdArtMapleLeaf | 81 | A maple leaf border.
wdArtMapleMuffins | 2 | A maple muffins border.
wdArtMapPins | 30 | A map pins border.
wdArtMarquee | 146 | A marquee border.
wdArtMarqueeToothed | 131 | A marquee toothed border.
wdArtMoons | 125 | A moons border.
wdArtMosaic | 118 | A mosaic border.
wdArtMusicNotes | 79 | A music notes border.
wdArtNorthwest | 104 | A northwest border.
wdArtOvals | 126 | An ovals border.
wdArtPackages | 26 | A packages border.
wdArtPalmsBlack | 80 | A black palms border.
wdArtPalmsColor | 10 | A colored palms border.
wdArtPaperClips | 82 | A paper clips border.
wdArtPapyrus | 92 | A papyrus border.
wdArtPartyFavor | 13 | A party favor border.
wdArtPartyGlass | 7 | A party glass border.
wdArtPencils | 25 | A pencils border.
wdArtPeople | 84 | A people border.
wdArtPeopleHats | 23 | A people-wearing-hats border.
wdArtPeopleWaving | 85 | A people-waving border.
wdArtPoinsettias | 40 | A poinsettias border.
wdArtPostageStamp | 135 | A postage stamp border.
wdArtPumpkin1 | 65 | A pumpkin number 1 border.
wdArtPushPinNote1 | 63 | A pushpin note number 1 border.
wdArtPushPinNote2 | 64 | A pushpin note number 2 border.
wdArtPyramids | 113 | A pyramids border.
wdArtPyramidsAbove | 114 | An external pyramids border.
wdArtQuadrants | 60 | A quadrants border.
wdArtRings | 29 | A rings border.
wdArtSafari | 98 | A safari border.
wdArtSawtooth | 133 | A saw-tooth border.
wdArtSawtoothGray | 134 | A saw-tooth border using shades of gray.
wdArtScaredCat | 36 | A scared cat border.
wdArtSeattle | 78 | A Seattle border.
wdArtShadowedSquares | 57 | A shadowed squared border.
wdArtSharksTeeth | 132 | A shark-tooth border.
wdArtShorebirdTracks | 83 | A shorebird tracks border.
wdArtSkyrocket | 77 | A sky rocket border.
wdArtSnowflakeFancy | 76 | A fancy snowflake border.
wdArtSnowflakes | 75 | A snowflake border.
wdArtSombrero | 24 | A sombrero border.
wdArtSouthwest | 105 | A southwest border.
wdArtStars | 19 | A stars border.
wdArtStars3D | 17 | A 3-D stars border.
wdArtStarsBlack | 74 | A black stars border.
wdArtStarsShadowed | 18 | A shadowed stars border.
wdArtStarsTop | 157 | A stars-on-top border.
wdArtSun | 20 | A sun border.
wdArtSwirligig | 62 | A swirling border.
wdArtTornPaper | 161 | A torn-paper border.
wdArtTornPaperBlack | 162 | A black torn-paper border.
wdArtTrees | 9 | A trees border.
wdArtTriangleParty | 123 | A triangle party border.
wdArtTriangles | 129 | A triangles border.
wdArtTribal1 | 130 | A tribal number 1 border.
wdArtTribal2 | 109 | A tribal number 2 border.
wdArtTribal3 | 108 | A tribal number 3 border.
wdArtTribal4 | 107 | A tribal number 4 border.
wdArtTribal5 | 110 | A tribal number 5 border.
wdArtTribal6 | 106 | A tribal number 6 border.
wdArtTwistedLines1 | 58 | A twisted lines number 1 border.
wdArtTwistedLines2 | 124 | A twisted lines number 2 border.
wdArtVine | 47 | A vine border.
wdArtWaveline | 59 | A wave-line border.
wdArtWeavingAngles | 96 | A weaving angle border.
wdArtWeavingBraid | 94 | A weaving braid border.
wdArtWeavingRibbon | 95 | A weaving ribbon border.
wdArtWeavingStrips | 136 | A weaving strips border.
wdArtWhiteFlowers | 46 | A white flower border.
wdArtWoodwork | 93 | A woodwork border.
wdArtXIllusions | 111 | An X illusion border.
wdArtZanyTriangles | 112 | A zany triangle border.
wdArtZigZag | 137 | A zigzag border.
wdArtZigZagStitch | 143 | A zigzag stitch border.


WdPageColor Enumeration (Word)

 Copy code hover
[image]

WdPageColor Enumeration (Word)
Send feedback

Published: July 16, 2012

Constants that represent background page color in reading mode, returned by and passed to View.PageColor.

Version information

Version Added: Word 2013

Members

Name | Value | Description
wdPageColorInverse | 2 | Inverse page color. Renders the document content in a manner that resembles high-contrast black, although not necessarily exactly so. Some figures are rendered in full color on a black background.
wdPageColorNone | 0 | No page color, the default. The page background is rendered in white. Any assigned page background colors are ignored.
wdPageColorSepia | 1 | Sepia page color, RGB (112, 66, 20) at 80% transparency. Makes no changes to the contents of the document.


WdPageFit Enumeration (Word)

 Copy code hover
[image]

WdPageFit Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the view setting for a page.

Name | Value | Description
wdPageFitBestFit | 2 | Best fit the page to the active window.
wdPageFitFullPage | 1 | View the full page.
wdPageFitNone | 0 | Do not adjust the view settings for the page.
wdPageFitTextFit | 3 | Best fit the text of the page to the active window.


WdPageNumberAlignment Enumeration (Word)

 Copy code hover
[image]

WdPageNumberAlignment Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the alignment to apply to page numbers.

Name | Value | Description
wdAlignPageNumberCenter | 1 | Centered.
wdAlignPageNumberInside | 3 | Left-aligned just inside the footer.
wdAlignPageNumberLeft | 0 | Left-aligned.
wdAlignPageNumberOutside | 4 | Right-aligned just outside the footer.
wdAlignPageNumberRight | 2 | Right-aligned.


WdPageNumberStyle Enumeration (Word)

 Copy code hover
[image]

WdPageNumberStyle Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the style to apply to page numbers.

Name | Value | Description
wdPageNumberStyleArabic | 0 | Arabic style.
wdPageNumberStyleArabicFullWidth | 14 | Arabic full width style.
wdPageNumberStyleArabicLetter1 | 46 | Arabic letter 1 style.
wdPageNumberStyleArabicLetter2 | 48 | Arabic letter 2 style.
wdPageNumberStyleHanjaRead | 41 | Hanja Read style.
wdPageNumberStyleHanjaReadDigit | 42 | Hanja Read Digit style.
wdPageNumberStyleHebrewLetter1 | 45 | Hebrew letter 1 style.
wdPageNumberStyleHebrewLetter2 | 47 | Hebrew letter 2 style.
wdPageNumberStyleHindiArabic | 51 | Hindi Arabic style.
wdPageNumberStyleHindiCardinalText | 52 | Hindi Cardinal text style.
wdPageNumberStyleHindiLetter1 | 49 | Hindi letter 1 style.
wdPageNumberStyleHindiLetter2 | 50 | Hindi letter 2 style.
wdPageNumberStyleKanji | 10 | Kanji style.
wdPageNumberStyleKanjiDigit | 11 | Kanji Digit style.
wdPageNumberStyleKanjiTraditional | 16 | Kanji traditional style.
wdPageNumberStyleLowercaseLetter | 4 | Lowercase letter style.
wdPageNumberStyleLowercaseRoman | 2 | Lowercase Roman style.
wdPageNumberStyleNumberInCircle | 18 | Number in circle style.
wdPageNumberStyleNumberInDash | 57 | Number in dash style.
wdPageNumberStyleSimpChinNum1 | 37 | Simplified Chinese number 1 style.
wdPageNumberStyleSimpChinNum2 | 38 | Simplified Chinese number 2 style.
wdPageNumberStyleThaiArabic | 54 | Thai Arabic style.
wdPageNumberStyleThaiCardinalText | 55 | Thai Cardinal Text style.
wdPageNumberStyleThaiLetter | 53 | Thai letter style.
wdPageNumberStyleTradChinNum1 | 33 | Traditional Chinese number 1 style.
wdPageNumberStyleTradChinNum2 | 34 | Traditional Chinese number 2 style.
wdPageNumberStyleUppercaseLetter | 3 | Uppercase letter style.
wdPageNumberStyleUppercaseRoman | 1 | Uppercase Roman style.
wdPageNumberStyleVietCardinalText | 56 | Vietnamese Cardinal text style.


WdPaperSize Enumeration (Word)

 Copy code hover
[image]

WdPaperSize Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies a paper size.

Name | Value | Description
wdPaper10x14 | 0 | 10 inches wide, 14 inches long.
wdPaper11x17 | 1 | Legal 11 inches wide, 17 inches long.
wdPaperA3 | 6 | A3 dimensions.
wdPaperA4 | 7 | A4 dimensions.
wdPaperA4Small | 8 | Small A4 dimensions.
wdPaperA5 | 9 | A5 dimensions.
wdPaperB4 | 10 | B4 dimensions.
wdPaperB5 | 11 | B5 dimensions.
wdPaperCSheet | 12 | C sheet dimensions.
wdPaperCustom | 41 | Custom paper size.
wdPaperDSheet | 13 | D sheet dimensions.
wdPaperEnvelope10 | 25 | Legal envelope, size 10.
wdPaperEnvelope11 | 26 | Envelope, size 11.
wdPaperEnvelope12 | 27 | Envelope, size 12.
wdPaperEnvelope14 | 28 | Envelope, size 14.
wdPaperEnvelope9 | 24 | Envelope, size 9.
wdPaperEnvelopeB4 | 29 | B4 envelope.
wdPaperEnvelopeB5 | 30 | B5 envelope.
wdPaperEnvelopeB6 | 31 | B6 envelope.
wdPaperEnvelopeC3 | 32 | C3 envelope.
wdPaperEnvelopeC4 | 33 | C4 envelope.
wdPaperEnvelopeC5 | 34 | C5 envelope.
wdPaperEnvelopeC6 | 35 | C6 envelope.
wdPaperEnvelopeC65 | 36 | C65 envelope.
wdPaperEnvelopeDL | 37 | DL envelope.
wdPaperEnvelopeItaly | 38 | Italian envelope.
wdPaperEnvelopeMonarch | 39 | Monarch envelope.
wdPaperEnvelopePersonal | 40 | Personal envelope.
wdPaperESheet | 14 | E sheet dimensions.
wdPaperExecutive | 5 | Executive dimensions.
wdPaperFanfoldLegalGerman | 15 | German legal fanfold dimensions.
wdPaperFanfoldStdGerman | 16 | German standard fanfold dimensions.
wdPaperFanfoldUS | 17 | United States fanfold dimensions.
wdPaperFolio | 18 | Folio dimensions.
wdPaperLedger | 19 | Ledger dimensions.
wdPaperLegal | 4 | Legal dimensions.
wdPaperLetter | 2 | Letter dimensions.
wdPaperLetterSmall | 3 | Small letter dimensions.
wdPaperNote | 20 | Note dimensions.
wdPaperQuarto | 21 | Quarto dimensions.
wdPaperStatement | 22 | Statement dimensions.
wdPaperTabloid | 23 | Tabloid dimensions.


WdPaperTray Enumeration (Word)

 Copy code hover
[image]

WdPaperTray Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies a printer paper tray.

Name | Value | Description
wdPrinterAutomaticSheetFeed | 7 | Automatic sheet feed.
wdPrinterDefaultBin | 0 | Default bin.
wdPrinterEnvelopeFeed | 5 | Envelope feed.
wdPrinterFormSource | 15 | Form source.
wdPrinterLargeCapacityBin | 11 | Large-capacity bin.
wdPrinterLargeFormatBin | 10 | Large-format bin.
wdPrinterLowerBin | 2 | Lower bin.
wdPrinterManualEnvelopeFeed | 6 | Manual envelope feed.
wdPrinterManualFeed | 4 | Manual feed.
wdPrinterMiddleBin | 3 | Middle bin.
wdPrinterOnlyBin | 1 | Printer's only bin.
wdPrinterPaperCassette | 14 | Paper cassette.
wdPrinterSmallFormatBin | 9 | Small-format bin.
wdPrinterTractorFeed | 8 | Tractor feed.
wdPrinterUpperBin | 1 | Upper bin.


WdParagraphAlignment Enumeration (Word)

 Copy code hover
[image]

WdParagraphAlignment Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the alignment of a paragraph.

Name | Value | Description
wdAlignParagraphCenter | 1 | Center-aligned.
wdAlignParagraphDistribute | 4 | Paragraph characters are distributed to fill the entire width of the paragraph.
wdAlignParagraphJustify | 3 | Fully justified.
wdAlignParagraphJustifyHi | 7 | Justified with a high character compression ratio.
wdAlignParagraphJustifyLow | 8 | Justified with a low character compression ratio.
wdAlignParagraphJustifyMed | 5 | Justified with a medium character compression ratio.
wdAlignParagraphLeft | 0 | Left-aligned.
wdAlignParagraphRight | 2 | Right-aligned.
wdAlignParagraphThaiJustify | 9 | Justified according to Thai formatting layout.


WdPartOfSpeech Enumeration (Word)

 Copy code hover
[image]

WdPartOfSpeech Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the part of speech that a word represents when returned by the Word thesaurus service.

Name | Value | Description
wdAdjective | 0 | An adjective.
wdAdverb | 2 | An adverb.
wdConjunction | 5 | A conjunction.
wdIdiom | 8 | An idiom.
wdInterjection | 7 | An interjection.
wdNoun | 1 | A noun.
wdOther | 9 | Some other part of speech.
wdPreposition | 6 | A preposition.
wdPronoun | 4 | A pronoun.
wdVerb | 3 | A verb.


WdPasteDataType Enumeration (Word)

 Copy code hover
[image]

WdPasteDataType Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the format for the Clipboard contents when they are inserted into a document.

Name | Value | Description
wdPasteBitmap | 4 | Bitmap.
wdPasteDeviceIndependentBitmap | 5 | Device-independent bitmap.
wdPasteEnhancedMetafile | 9 | Enhanced metafile.
wdPasteHTML | 10 | HTML.
wdPasteHyperlink | 7 | Hyperlink.
wdPasteMetafilePicture | 3 | Metafile picture.
wdPasteOLEObject | 0 | OLE object.
wdPasteRTF | 1 | Rich Text Format (RTF).
wdPasteShape | 8 | Shape.
wdPasteText | 2 | Text.


WdPasteOptions Enumeration (Word)

 Copy code hover
[image]

WdPasteOptions Enumeration (Word)
Send feedback

Published: July 16, 2012

Indicates how to paste copied text.

Name | Value | Description
wdKeepSourceFormatting | 0 | Keeps formatting from the source document.
wdKeepTextOnly | 2 | Keeps text only, without formatting.
wdMatchDestinationFormatting | 1 | Matches formatting to the destination document.
wdUseDestinationStyles | 3 | Matches formatting to the destination document using styles for formatting.


WdPhoneticGuideAlignmentType Enumeration (Word)

 Copy code hover
[image]

WdPhoneticGuideAlignmentType Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the alignment of phonetic text that is added to the specified range.

Name | Value | Description
wdPhoneticGuideAlignmentCenter | 0 | Microsoft Word centers phonetic text over the specified range. This is the default value.
wdPhoneticGuideAlignmentLeft | 3 | Word left-aligns phonetic text with the specified range.
wdPhoneticGuideAlignmentOneTwoOne | 2 | Word adjusts the inside and outside spacing of the phonetic text in a 1:2:1 ratio.
wdPhoneticGuideAlignmentRight | 4 | Word right-aligns phonetic text with the specified range.
wdPhoneticGuideAlignmentRightVertical | 5 | Word aligns the phonetic text on the right side of vertical text.
wdPhoneticGuideAlignmentZeroOneZero | 1 | Word adjusts the inside and outside spacing of the phonetic text in a 0:1:0 ratio.


WdPictureLinkType Enumeration (Word)

 Copy code hover
[image]

WdPictureLinkType Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies how a picture should be linked to a document.

Name | Value | Description
wdLinkDataInDoc | 1 | Embed the picture in the document.
wdLinkDataOnDisk | 2 | Link the picture to the document.
wdLinkNone | 0 | Do not link to or embed the picture in the document.


WdPortugueseReform Enumeration (Word)

 Copy code hover
[image]

WdPortugueseReform Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the mode for the Brazilian or European Portuguese spellers. Read/write.

Version Information

Version Added: Word 2010

Name | Value | Description
wdPortugueseBoth | 3 | Use both the pre-reform and post-reform spelling rules.
wdPortuguesePostReform | 2 | Use the post-reform spelling rules.
wdPortuguesePreReform | 1 | Use the pre-reform spelling rules.


WdPreferredWidthType Enumeration (Word)

 Copy code hover
[image]

WdPreferredWidthType Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the preferred unit of measure to use when measuring the width of an item.

Name | Value | Description
wdPreferredWidthAuto | 1 | Automatically select the unit of measure to use based on the current selection.
wdPreferredWidthPercent | 2 | Measure the current item width using a specified percentage.
wdPreferredWidthPoints | 3 | Measure the current item width using a specified number of points.


WdPrintOutItem Enumeration (Word)

 Copy code hover
[image]

WdPrintOutItem Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the item to print.

Name | Value | Description
wdPrintAutoTextEntries | 4 | Autotext entries in the current document.
wdPrintComments | 2 | Comments in the current document.
wdPrintDocumentContent | 0 | Current document content.
wdPrintDocumentWithMarkup | 7 | Current document content including markup.
wdPrintEnvelope | 6 | An envelope.
wdPrintKeyAssignments | 5 | Key assignments in the current document.
wdPrintMarkup | 2 | Markup in the current document.
wdPrintProperties | 1 | Properties in the current document.
wdPrintStyles | 3 | Styles in the current document.


WdPrintOutPages Enumeration (Word)

 Copy code hover
[image]

WdPrintOutPages Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the type of pages to print.

Name | Value | Description
wdPrintAllPages | 0 | All pages.
wdPrintEvenPagesOnly | 2 | Even-numbered pages only.
wdPrintOddPagesOnly | 1 | Odd-numbered pages only.


WdPrintOutRange Enumeration (Word)

 Copy code hover
[image]

WdPrintOutRange Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies a range to print.

Name | Value | Description
wdPrintAllDocument | 0 | The entire document.
wdPrintCurrentPage | 2 | The current page.
wdPrintFromTo | 3 | A specified range.
wdPrintRangeOfPages | 4 | A specified range of pages.
wdPrintSelection | 1 | The current selection.


WdProofreadingErrorType Enumeration (Word)

 Copy code hover
[image]

WdProofreadingErrorType Enumeration (Word)
Send feedback

Specifies the type of proofreading error returned by the Word proofreading process.

Name | Value | Description
wdGrammaticalError | 1 | Grammatical error.
wdSpellingError | 0 | Spelling error.


WdProtectedViewCloseReason Enumeration (Word)

 Copy code hover
[image]

WdProtectedViewCloseReason Enumeration (Word)
Send feedback

Specifies how the Protected View window was closed.

Version Information

Version Added: Word 2010

Name | Value | Description
wdProtectedViewCloseEdit | 1 | The window was closed when the user clicked the Enable Editing or Edit Anyway button while in Protected View.
wdProtectedViewCloseForced | 2 | The window was closed because the application shut it down forcefully or it stopped responding.
wdProtectedViewCloseNormal | 0 | The window was closed normally.


WdProtectionType Enumeration (Word)

 Copy code hover
[image]

WdProtectionType Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the type of protection applied to the current document.

Name | Value | Description
wdAllowOnlyComments | 1 | Allow only comments to be added to the document.
wdAllowOnlyFormFields | 2 | Allow content to be added to the document only through form fields.
wdAllowOnlyReading | 3 | Allow read-only access to the document.
wdAllowOnlyRevisions | 0 | Allow only revisions to be made to existing content.
wdNoProtection | -1 | Do not apply protection to the document.


WdReadingLayoutMargin Enumeration (Word)

 Copy code hover
[image]

WdReadingLayoutMargin Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies whether margins are visible or hidden when a document is viewed in Full Screen Reading view.

Name | Value | Description
wdAutomaticMargin | 0 | Shows the pages without margins.
wdFullMargin | 2 | Shows the pages with margins.
wdSuppressMargin | 1 | Microsoft Word determines automatically whether to show or hide the margins based on the available space.


WdReadingOrder Enumeration (Word)

 Copy code hover
[image]

WdReadingOrder Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the text flow and reading order of the document.

Name | Value | Description
wdReadingOrderLtr | 1 | Left-to-right reading order.
wdReadingOrderRtl | 0 | Right-to-left reading order.


WdRecoveryType Enumeration (Word)

 Copy code hover
[image]

WdRecoveryType Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the formatting to use when pasting the selected table cells.

Name | Value | Description
wdChart | 14 | Pastes a Microsoft Office Excel chart as an embedded OLE object.
wdChartLinked | 15 | Pastes an Excel chart and links it to the original Excel spreadsheet.
wdChartPicture | 13 | Pastes an Excel chart as a picture.
wdFormatOriginalFormatting | 16 | Preserves original formatting of the pasted material.
wdFormatPlainText | 22 | Pastes as plain, unformatted text.
wdFormatSurroundingFormattingWithEmphasis | 20 | Matches the formatting of the pasted text to the formatting of surrounding text.
wdListCombineWithExistingList | 24 | Merges a pasted list with neighboring lists.
wdListContinueNumbering | 7 | Continues numbering of a pasted list from the list in the document.
wdListDontMerge | 25 | Not supported.
wdListRestartNumbering | 8 | Restarts numbering of a pasted list.
wdPasteDefault | 0 | Not supported.
wdSingleCellTable | 6 | Pastes a single cell table as a separate table.
wdSingleCellText | 5 | Pastes a single cell as text.
wdTableAppendTable | 10 | Merges pasted cells into an existing table by inserting the pasted rows between the selected rows.
wdTableInsertAsRows | 11 | Inserts a pasted table as rows between two rows in the target table.
wdTableOriginalFormatting | 12 | Pastes an appended table without merging table styles.
wdTableOverwriteCells | 23 | Pastes table cells and overwrites existing table cells.
wdUseDestinationStylesRecovery | 19 | Uses the styles that are in use in the destination document.


WdRectangleType Enumeration (Word)

 Copy code hover
[image]

WdRectangleType Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the type of rectangle and the information it contains.

Name | Value | Description
wdLineBetweenColumnRectangle | 5 | Represents a region corresponding to a line that separates columns.
wdMarkupRectangle | 2 | Represents a space occupied by a comment balloon.
wdMarkupRectangleButton | 3 | Represents a space occupied by the more (...) indicator that appears in a comment balloon when there is additional text for the comment.
wdPageBorderRectangle | 4 | Represents a space occupied by a page border.
wdSelection | 6 | Represents a space occupied by a selection tool, for example the table selection tool in the upper left corner of a table or the anchor for an image.
wdShapeRectangle | 1 | Represents a space occupied by a shape.
wdSystem | 7 | Not applicable.
wdTextRectangle | 0 | Represents a space occupied by text.
wdDocumentControlRectangle | 13 | Represents space occupied by a content control, equation, or document building block in-document control.
wdMailNavArea | 12 | Represents space occupied by the e-mail message navigation buttons when reading e-mail in Microsoft Office Outlook.
wdMarkupRectangleArea | 8 | Represents space occupied for the presentation of revision balloons on the page. This space is only printed if you print using "Document Showing Markup" in the Print dialog box.
wdMarkupRectangleMoveMatch | 10 | Represents space occupied by the Go button used to find matching pairs of tracked moves in a document.
wdReadingModeNavigation | 9 | Represents space occupied by the page navigation buttons when reading a document in full page reading view.
wdReadingModePanningArea | 11 | Represents space occupied for page turning when reading a document in full page reading view.


WdReferenceKind Enumeration (Word)

 Copy code hover
[image]

WdReferenceKind Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the information to include in a cross-reference.

Name | Value | Description
wdContentText | -1 | Insert text value of the specified item. For example, insert text of the specified heading.
wdEndnoteNumber | 6 | Insert endnote reference mark.
wdEndnoteNumberFormatted | 17 | Insert formatted endnote reference mark.
wdEntireCaption | 2 | Insert label, number, and any additional caption of specified equation, figure, or table.
wdFootnoteNumber | 5 | Insert footnote reference mark.
wdFootnoteNumberFormatted | 16 | Insert formatted footnote reference mark.
wdNumberFullContext | -4 | Insert complete heading or paragraph number.
wdNumberNoContext | -3 | Insert heading or paragraph without its relative position in the outline numbered list.
wdNumberRelativeContext | -2 | Insert heading or paragraph with as much of its relative position in the outline numbered list as necessary to identify the item.
wdOnlyCaptionText | 4 | Insert only the caption text of the specified equation, figure, or table.
wdOnlyLabelAndNumber | 3 | Insert only the label and number of the specified equation, figure, or table.
wdPageNumber | 7 | Insert page number of specified item.
wdPosition | 15 | Insert the word "Above" or the word "Below" as appropriate.


WdReferenceType Enumeration (Word)

 Copy code hover
[image]

WdReferenceType Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the type of item to be cross referenced.

Name | Value | Description
wdRefTypeBookmark | 2 | Bookmark.
wdRefTypeEndnote | 4 | Endnote.
wdRefTypeFootnote | 3 | Footnote.
wdRefTypeHeading | 1 | Heading.
wdRefTypeNumberedItem | 0 | Numbered item.


WdRelativeHorizontalPosition Enumeration (Word)

 Copy code hover
[image]

WdRelativeHorizontalPosition Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies to what the horizontal position of a frame, a shape, or a group of rows is relative.

Name | Value | Description
wdRelativeHorizontalPositionCharacter | 3 | Relative to character.
wdRelativeHorizontalPositionColumn | 2 | Relative to column.
wdRelativeHorizontalPositionMargin | 0 | Relative to margin.
wdRelativeHorizontalPositionPage | 1 | Relative to page.
wdRelativeHorizontalPositionInnerMarginArea | 6 | Relative to inner margin area.
wdRelativeHorizontalPositionLeftMarginArea | 4 | Relative to left margin.
wdRelativeHorizontalPositionOuterMarginArea | 7 | Relative to outer margin area.
wdRelativeHorizontalPositionRightMarginArea | 5 | Relative to right margin.


WdRelativeHorizontalSize Enumeration (Word)

 Copy code hover
[image]

WdRelativeHorizontalSize Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the relative width of a shape using the value specified in the WidthRelative property for a Shape or ShapeRange object.

Name | Value | Description
wdRelativeHorizontalSizeInnerMarginArea | 4 | Width is relative to the size of the inside margin—to the size of the left margin for odd pages, and to the size of the right margin for even pages.
wdRelativeHorizontalSizeLeftMarginArea | 2 | Width is relative to the size of the left margin.
wdRelativeHorizontalSizeMargin | 0 | Width is relative to the space between the left margin and the right margin.
wdRelativeHorizontalSizeOuterMarginArea | 5 | Width is relative to the size of the outside margin—to the size of the right margin for odd pages, and to the size of the left margin for even pages.
wdRelativeHorizontalSizePage | 1 | Width is relative to the width of the page.
wdRelativeHorizontalSizeRightMarginArea | 3 | Width is relative to the width of the right margin.


WdRelativeVerticalPosition Enumeration (Word)

 Copy code hover
[image]

WdRelativeVerticalPosition Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies to what the vertical position of a frame, a shape, or a group of rows is relative.

Name | Value | Description
wdRelativeVerticalPositionLine | 3 | Relative to line.
wdRelativeVerticalPositionMargin | 0 | Relative to margin.
wdRelativeVerticalPositionPage | 1 | Relative to page.
wdRelativeVerticalPositionParagraph | 2 | Relative to paragraph.
wdRelativeVerticalPositionBottomMarginArea | 5 | Relative to bottom margin.
wdRelativeVerticalPositionInnerMarginArea | 6 | Relative to inner margin area.
wdRelativeVerticalPositionOuterMarginArea | 7 | Relative to outer margin area.
wdRelativeVerticalPositionTopMarginArea | 4 | Relative to top margin.


WdRelativeVerticalSize Enumeration (Word)

 Copy code hover
[image]

WdRelativeVerticalSize Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the relative height of a shape using the value specified in the HeightRelative property for a Shape or ShapeRange object.

Name | Value | Description
wdRelativeVerticalSizeBottomMarginArea | 3 | Height is relative to the size of the bottom margin.
wdRelativeVerticalSizeInnerMarginArea | 4 | Height is relative to the size of the inside margin—to the size of the top margin for odd pages, and to the size of the bottom margin for even pages.
wdRelativeVerticalSizeMargin | 0 | Height is relative to the space between the left margin and the right margin.
wdRelativeVerticalSizeOuterMarginArea | 5 | Height is relative to the size of the outside margin—to the size of the bottom margin for odd pages, and to the size of the top margin for even pages.
wdRelativeVerticalSizePage | 1 | Height is relative to the height of the page.
wdRelativeVerticalSizeTopMarginArea | 2 | Height is relative to the size of the top margin.


WdRelocate Enumeration (Word)

 Copy code hover
[image]

WdRelocate Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies where a paragraph should be relocated in relation to its current position.

Name | Value | Description
wdRelocateDown | 1 | Below the next visible paragraph.
wdRelocateUp | 0 | Above the previous visible paragraph.


WdRemoveDocInfoType Enumeration (Word)

 Copy code hover
[image]

WdRemoveDocInfoType Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the type of information to remove from a document.

Name | Value | Description
wdRDIAll | 99 | Removes all document information.
wdRDIComments | 1 | Removes document comments.
wdRDIContentType | 16 | Removes content type information.
wdRDIDocumentManagementPolicy | 15 | Removes document management policy information.
wdRDIDocumentProperties | 8 | Removes document properties.
wdRDIDocumentServerProperties | 14 | Removes document server properties.
wdRDIDocumentWorkspace | 10 | Removes document workspace information.
wdRDIEmailHeader | 5 | Removes e-mail header information.
wdRDIInkAnnotTations | 11 | Removes ink annotations.
wdRDIRemovePersonalInformation | 4 | Removes personal information.
wdRDIRevisions | 2 | Removes revision marks.
wdRDIRoutingSlip | 6 | Removes routing slip information.
wdRDISendForReview | 7 | Removes information stored when sending a document for review.
wdRDITemplate | 9 | Removes template information.
wdRDITaskpaneWebExtensions | 17 | Removes taskpane web extensions information.
wdRDIVersions | 3 | Removes document version information.


WdReplace Enumeration (Word)

 Copy code hover
[image]

WdReplace Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the number of replacements to be made when find and replace is used.

Name | Value | Description
wdReplaceAll | 2 | Replace all occurrences.
wdReplaceNone | 0 | Replace no occurrences.
wdReplaceOne | 1 | Replace the first occurrence encountered.


WdRevisedLinesMark Enumeration (Word)

 Copy code hover
[image]

WdRevisedLinesMark Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies where revisions are displayed when change tracking is enabled.

Name | Value | Description
wdRevisedLinesMarkLeftBorder | 1 | In the left border.
wdRevisedLinesMarkNone | 0 | Not displayed.
wdRevisedLinesMarkOutsideBorder | 3 | Outside the border.
wdRevisedLinesMarkRightBorder | 2 | In the right border.


WdRevisedPropertiesMark Enumeration (Word)

 Copy code hover
[image]

WdRevisedPropertiesMark Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies how revisions are displayed when change tracking is enabled.

Name | Value | Description
wdRevisedPropertiesMarkBold | 1 | In bold.
wdRevisedPropertiesMarkColorOnly | 5 | In the designated color.
wdRevisedPropertiesMarkDoubleStrikeThrough | 7 | Using double-strikethrough characters.
wdRevisedPropertiesMarkDoubleUnderline | 4 | With double-underline characters.
wdRevisedPropertiesMarkItalic | 2 | In italic.
wdRevisedPropertiesMarkNone | 0 | Using a special character.
wdRevisedPropertiesMarkStrikeThrough | 6 | Using strikethrough characters.
wdRevisedPropertiesMarkUnderline | 3 | In underline.


WdRevisionsBalloonMargin Enumeration (Word)

 Copy code hover
[image]

WdRevisionsBalloonMargin Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the margin where revision balloons should be displayed.

Name | Value | Description
wdLeftMargin | 0 | Left margin.
wdRightMargin | 1 | Right margin. default.


WdRevisionsBalloonPrintOrientation Enumeration (Word)

 Copy code hover
[image]

WdRevisionsBalloonPrintOrientation Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the orientation of revision and comment balloons when they are printed.

Name | Value | Description
wdBalloonPrintOrientationAuto | 0 | Microsoft Word automatically selects the orientation that keeps the zoom factor closest to 100%.
wdBalloonPrintOrientationForceLandscape | 2 | Word forces all sections to be printed in Landscape mode, regardless of original orientation, and prints the revision and comment balloons on the side opposite to the document text.
wdBalloonPrintOrientationPreserve | 1 | Word preserves the orientation of the original, uncommented document.


WdRevisionsBalloonWidthType Enumeration (Word)

 Copy code hover
[image]

WdRevisionsBalloonWidthType Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies how Microsoft Word measures the width of revision balloons.

Name | Value | Description
wdBalloonWidthPercent | 0 | Measured as a percentage of the width of the document.
wdBalloonWidthPoints | 1 | Measured in points.


WdRevisionsMarkup Enumeration (Word)

 Copy code hover
[image]

WdRevisionsMarkup Enumeration (Word)
Send feedback

Published: July 16, 2012

Constants that represent the extent of markup visible in the document, returned by and passed to the RevisionsFilter.Markup property.

Version information

Version Added: Word 2013

Members

Name | Value | Description
wdRevisionsMarkupAll | 2 | Displays the final document with all markup visible.
wdRevisionsMarkupNone | 0 | Displays the final document with no markup visible.
wdRevisionsMarkupSimple | 1 | Displays the final document in simple markup: with revisions incorporated, but with no markup visible.


WdRevisionsMode Enumeration (Word)

 Copy code hover
[image]

WdRevisionsMode Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies whether Microsoft Word displays balloons in the margin or inline with the document's text.

Name | Value | Description
wdBalloonRevisions | 0 | Displays revisions in balloons in the left or right margin.
wdInLineRevisions | 1 | Displays revisions within the text using strikethrough for deletions and underlining for insertions. This is the default setting for prior versions of Word.
wdMixedRevisions | 2 | Not supported.


WdRevisionsView Enumeration (Word)

 Copy code hover
[image]

WdRevisionsView Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies whether Word displays the original version of a document or a version with revisions and formatting changes applied.

Name | Value | Description
wdRevisionsViewFinal | 0 | Displays the document with formatting and content changes applied.
wdRevisionsViewOriginal | 1 | Displays the document before changes were made.


WdRevisionsWrap Enumeration (Word)

 Copy code hover
[image]

WdRevisionsWrap Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies how revision marks are displayed in the document.

Name | Value | Description
wdWrapAlways | 1 | Revisions are wrapped.
wdWrapAsk | 2 | Ask the user if revisions should be wrapped.
wdWrapNever | 0 | Never wrap revisions.


WdRevisionType Enumeration (Word)

 Copy code hover
[image]

WdRevisionType Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the type of a change that is marked with a revision mark.

Name | Value | Description
wdNoRevision | 0 | No revision.
wdRevisionCellDeletion | 17 | Table cell deleted.
wdRevisionCellInsertion | 16 | Table cell inserted.
wdRevisionCellMerge | 18 | Table cells merged.
wdRevisionCellSplit | 19 | This object, member, or enumeration is deprecated and is not intended to be used in your code.
wdRevisionConflict | 7 | Revision marked as a conflict.
wdRevisionConflictDelete | 21 | Deletion revision conflict in a co-authored document.
wdRevisionConflictInsert | 20 | Insertion revision conflict in a co-authored document
wdRevisionDelete | 2 | Deletion.
wdRevisionDisplayField | 5 | Field display changed.
wdRevisionInsert | 1 | Insertion.
wdRevisionMovedFrom | 14 | Content moved from.
wdRevisionMovedTo | 15 | Content moved to.
wdRevisionParagraphNumber | 4 | Paragraph number changed.
wdRevisionParagraphProperty | 10 | Paragraph property changed.
wdRevisionProperty | 3 | Property changed.
wdRevisionReconcile | 6 | Revision marked as reconciled conflict.
wdRevisionReplace | 9 | Replaced.
wdRevisionSectionProperty | 12 | Section property changed.
wdRevisionStyle | 8 | Style changed.
wdRevisionStyleDefinition | 13 | Style definition changed.
wdRevisionTableProperty | 11 | Table property changed.


WdRowAlignment Enumeration (Word)

 Copy code hover
[image]

WdRowAlignment Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies alignment for the content in selected rows.

Name | Value | Description
wdAlignRowCenter | 1 | Centered.
wdAlignRowLeft | 0 | Left-aligned. Default.
wdAlignRowRight | 2 | Right-aligned.


WdRowHeightRule Enumeration (Word)

 Copy code hover
[image]

WdRowHeightRule Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the rule for determining the height of the specified cells or rows.

Name | Value | Description
wdRowHeightAtLeast | 1 | The row height is at least a minimum specified value.
wdRowHeightAuto | 0 | The row height is adjusted to accommodate the tallest value in the row.
wdRowHeightExactly | 2 | The row height is an exact value.


WdRulerStyle Enumeration (Word)

 Copy code hover
[image]

WdRulerStyle Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the way Word adjusts the table when the left indent is changed.

Name | Value | Description
wdAdjustFirstColumn | 2 | Adjusts the left edge of the first column only, preserving the positions of the other columns and the right edge of the table.
wdAdjustNone | 0 | Adjusts the left edge of row or rows, preserving the width of all columns by shifting them to the left or right. This is the default value.
wdAdjustProportional | 1 | Adjusts the left edge of the first column, preserving the position of the right edge of the table by proportionally adjusting the widths of all the cells in the specified row or rows.
wdAdjustSameWidth | 3 | Adjusts the left edge of the first column, preserving the position of the right edge of the table by setting the widths of all the cells in the specified row or rows to the same value.


WdSalutationGender Enumeration (Word)

 Copy code hover
[image]

WdSalutationGender Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the gender to use in a salutation.

Name | Value | Description
wdGenderFemale | 0 | Female gender.
wdGenderMale | 1 | Male gender.
wdGenderNeutral | 2 | Neutral gender.
wdGenderUnknown | 3 | Unknown gender.


WdSalutationType Enumeration (Word)

 Copy code hover
[image]

WdSalutationType Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the type of salutation to use for a letter.

Name | Value | Description
wdSalutationBusiness | 2 | Business salutation
wdSalutationFormal | 1 | Format salutation.
wdSalutationInformal | 0 | Informal salutation.
wdSalutationOther | 3 | Custom salutation.


WdSaveFormat Enumeration (Word)

 Copy code hover
[image]

WdSaveFormat Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the format to use when saving a document.

Name | Value | Description
wdFormatDocument | 0 | Microsoft Office Word 97 - 2003 binary file format.
wdFormatDOSText | 4 | Microsoft DOS text format.
wdFormatDOSTextLineBreaks | 5 | Microsoft DOS text with line breaks preserved.
wdFormatEncodedText | 7 | Encoded text format.
wdFormatFilteredHTML | 10 | Filtered HTML format.
wdFormatFlatXML | 19 | Open XML file format saved as a single XML file.
wdFormatFlatXML | 20 | Open XML file format with macros enabled saved as a single XML file.
wdFormatFlatXMLTemplate | 21 | Open XML template format saved as a XML single file.
wdFormatFlatXMLTemplateMacroEnabled | 22 | Open XML template format with macros enabled saved as a single XML file.
wdFormatOpenDocumentText | 23 | OpenDocument Text format.
wdFormatHTML | 8 | Standard HTML format.
wdFormatRTF | 6 | Rich text format (RTF).
wdFormatStrictOpenXMLDocument | 24 | Strict Open XML document format.
wdFormatTemplate | 1 | Word template format.
wdFormatText | 2 | Microsoft Windows text format.
wdFormatTextLineBreaks | 3 | Windows text format with line breaks preserved.
wdFormatUnicodeText | 7 | Unicode text format.
wdFormatWebArchive | 9 | Web archive format.
wdFormatXML | 11 | Extensible Markup Language (XML) format.
wdFormatDocument97 | 0 | Microsoft Word 97 document format.
wdFormatDocumentDefault | 16 | Word default document file format. For Word 2010, this is the DOCX format.
wdFormatPDF | 17 | PDF format.
wdFormatTemplate97 | 1 | Word 97 template format.
wdFormatXMLDocument | 12 | XML document format.
wdFormatXMLDocumentMacroEnabled | 13 | XML document format with macros enabled.
wdFormatXMLTemplate | 14 | XML template format.
wdFormatXMLTemplateMacroEnabled | 15 | XML template format with macros enabled.
wdFormatXPS | 18 | XPS format.


WdSaveOptions Enumeration (Word)

 Copy code hover
[image]

WdSaveOptions Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies how pending changes should be handled.

Name | Value | Description
wdDoNotSaveChanges | 0 | Do not save pending changes.
wdPromptToSaveChanges | -2 | Prompt the user to save pending changes.
wdSaveChanges | -1 | Save pending changes automatically without prompting the user.


WdScrollbarType Enumeration (Word)

 Copy code hover
[image]

WdScrollbarType Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies when scroll bars are available for the specified frame when viewing its frames page in a Web browser.

Name | Value | Description
wdScrollbarTypeAuto | 0 | Scroll bars are available for the specified frame only if the contents are too large to fit in the allotted space.
wdScrollbarTypeNo | 2 | Scroll bars are never available for the specified frame.
wdScrollbarTypeYes | 1 | Scroll bars are always available for the specified frame.


WdSectionDirection Enumeration (Word)

 Copy code hover
[image]

WdSectionDirection Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies how Word displays the reading order and alignment for the specified sections.

Name | Value | Description
wdSectionDirectionLtr | 1 | Displays the section with left alignment and left-to-right reading order.
wdSectionDirectionRtl | 0 | Displays the section with right alignment and right-to-left reading order.


WdSectionStart Enumeration (Word)

 Copy code hover
[image]

WdSectionStart Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the type of section break for the specified item.

Name | Value | Description
wdSectionContinuous | 0 | Continuous section break.
wdSectionEvenPage | 3 | Even pages section break.
wdSectionNewColumn | 1 | New column section break.
wdSectionNewPage | 2 | New page section break.
wdSectionOddPage | 4 | Odd pages section break.


WdSeekView Enumeration (Word)

 Copy code hover
[image]

WdSeekView Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the document element to display in the print layout view.

Name | Value | Description
wdSeekCurrentPageFooter | 10 | The current page footer.
wdSeekCurrentPageHeader | 9 | The current page header.
wdSeekEndnotes | 8 | Endnotes.
wdSeekEvenPagesFooter | 6 | The even pages footer.
wdSeekEvenPagesHeader | 3 | The even pages header.
wdSeekFirstPageFooter | 5 | The first page footer.
wdSeekFirstPageHeader | 2 | The first page header.
wdSeekFootnotes | 7 | Footnotes.
wdSeekMainDocument | 0 | The main document.
wdSeekPrimaryFooter | 4 | The primary footer.
wdSeekPrimaryHeader | 1 | The primary header.


WdSelectionFlags Enumeration (Word)

 Copy code hover
[image]

WdSelectionFlags Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the properties of the selection.

Name | Value | Description
wdSelActive | 8 | The selection is the active selection.
wdSelAtEOL | 2 | The selection is at the end of the letter.
wdSelOvertype | 4 | The selection was overtyped.
wdSelReplace | 16 | The selection was replaced.
wdSelStartActive | 1 | The selection is at the start of the active document.


WdSelectionType Enumeration (Word)

 Copy code hover
[image]

WdSelectionType Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the type of selection.

Name | Value | Description
wdNoSelection | 0 | No selection.
wdSelectionBlock | 6 | A block selection.
wdSelectionColumn | 4 | A column selection.
wdSelectionFrame | 3 | A frame selection.
wdSelectionInlineShape | 7 | An inline shape selection.
wdSelectionIP | 1 | An inline paragraph selection.
wdSelectionNormal | 2 | A normal or user-defined selection.
wdSelectionRow | 5 | A row selection.
wdSelectionShape | 8 | A shape selection.


WdSeparatorType Enumeration (Word)

 Copy code hover
[image]

WdSeparatorType Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the type of separator to place between items.

Name | Value | Description
wdSeparatorColon | 2 | A colon.
wdSeparatorEmDash | 3 | An emphasized dash.
wdSeparatorEnDash | 4 | A standard dash.
wdSeparatorHyphen | 0 | A hyphen.
wdSeparatorPeriod | 1 | A period.


WdShapePosition Enumeration (Word)

 Copy code hover
[image]

WdShapePosition Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the relative position of the specified shape.

Name | Value | Description
wdShapeBottom | -999997 | At the bottom.
wdShapeCenter | -999995 | In the center.
wdShapeInside | -999994 | Inside the selected range.
wdShapeLeft | -999998 | On the left.
wdShapeOutside | -999993 | Outside the selected range.
wdShapeRight | -999996 | On the right.
wdShapeTop | -999999 | At the top.


WdShapePositionRelative Enumeration (Word)

 Copy code hover
[image]

WdShapePositionRelative Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies whether the LeftRelative or TopRelative property for a Shape or ShapeRange object is valid.

Name | Value | Description
wdShapePositionRelativeNone | -999999 | Specifies that the LeftRelative or TopRelative property is not currently valid, so the shape is positioned according to the value specified in the Left or Top property, respectively.


WdShapeSizeRelative Enumeration (Word)

 Copy code hover
[image]

WdShapeSizeRelative Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies whether the WidthRelative or HeightRelative property for a Shape or ShapeRange object is valid.

Name | Value | Description
wdShapeSizeRelativeNone | -999999 | Specifies that the WidthRelative or HeightRelative property is not currently valid, so the shape is positioned according to the value specified in the Left or Top property, respectively.


WdShowFilter Enumeration (Word)

 Copy code hover
[image]

WdShowFilter Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the styles and formatting to display in the Styles and Formatting task pane.

Name | Value | Description
wdShowFilterFormattingAvailable | 4 | All formatting available.
wdShowFilterFormattingInUse | 3 | All formatting in use.
wdShowFilterStylesAll | 2 | All styles.
wdShowFilterStylesAvailable | 0 | All styles available.
wdShowFilterStylesInUse | 1 | All styles in use.
wdShowFilterFormattingRecommended | 5 | Only recommended styles.


WdShowSourceDocuments Enumeration (Word)

 Copy code hover
[image]

WdShowSourceDocuments Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies how to display source documents when two documents are compared using the Word Compare functions.

Version Information

Version Added: Word 2007

Name | Value | Description
wdShowSourceDocumentsBoth | 3 | Shows both original and revised documents.
wdShowSourceDocumentsNone | 0 | Shows neither the original nor the revised documents for the source document used in a Compare function.
wdShowSourceDocumentsOriginal | 1 | Shows the original document only.
wdShowSourceDocumentsRevised | 2 | Shows the revised document only.


WdSmartTagControlType Enumeration (Word)

 Copy code hover
[image]

WdSmartTagControlType Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the type of control associated with a SmartTagAction object.

Name | Value | Description
wdControlActiveX | 13 | ActiveX control.
wdControlButton | 6 | Button.
wdControlCheckbox | 9 | Check box.
wdControlCombo | 12 | Combo box.
wdControlDocumentFragment | 14 | Document fragment.
wdControlDocumentFragmentURL | 15 | Document fragment URL.
wdControlHelp | 3 | Help.
wdControlHelpURL | 4 | Help URL.
wdControlImage | 8 | Image.
wdControlLabel | 7 | Label.
wdControlLink | 2 | Link.
wdControlListbox | 11 | List box.
wdControlRadioGroup | 16 | Radio group.
wdControlSeparator | 5 | Separator.
wdControlSmartTag | 1 | Smart tag.
wdControlTextbox | 10 | Text box.


WdSortFieldType Enumeration (Word)

 Copy code hover
[image]

WdSortFieldType Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the sort type to apply when sorting a column.

Name | Value | Description
wdSortFieldAlphanumeric | 0 | Alphanumeric order.
wdSortFieldDate | 2 | Date order.
wdSortFieldJapanJIS | 4 | Japanese JIS order.
wdSortFieldKoreaKS | 6 | Korean KS order.
wdSortFieldNumeric | 1 | Numeric order.
wdSortFieldStroke | 5 | Stroke order.
wdSortFieldSyllable | 3 | Syllable order.


WdSortOrder Enumeration (Word)

 Copy code hover
[image]

WdSortOrder Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the sort direction.

Name | Value | Description
wdSortOrderAscending | 0 | Ascending order. Default.
wdSortOrderDescending | 1 | Descending order.


WdSortSeparator Enumeration (Word)

 Copy code hover
[image]

WdSortSeparator Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the type of field separator.

Name | Value | Description
wdSortSeparateByCommas | 1 | Comma.
wdSortSeparateByDefaultTableSeparator | 2 | Default table separator.
wdSortSeparateByTabs | 0 | Tab.


WdSpanishSpeller Enumeration (Word)

 Copy code hover
[image]

WdSpanishSpeller Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the Spanish speller modes.

Version Information

Version Added: Word 2010

Name | Value | Description
wdSpanishTuteoAndVoseo | 1 | The Spanish spelling checker recognizes both tuteo and voseo verb forms.
wdSpanishTuteoOnly | 0 | The Spanish spelling checker recognizes only tuteo verb forms.
wdSpanishVoseoOnly | 2 | The Spanish spelling checker recognizes only voseo verb forms.


WdSpecialPane Enumeration (Word)

 Copy code hover
[image]

WdSpecialPane Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies an item to display in the active window pane.

Name | Value | Description
wdPaneComments | 15 | Selected comments.
wdPaneCurrentPageFooter | 17 | The page footer.
wdPaneCurrentPageHeader | 16 | The page header.
wdPaneEndnoteContinuationNotice | 12 | The endnote continuation notice.
wdPaneEndnoteContinuationSeparator | 13 | The endnote continuation separator.
wdPaneEndnotes | 8 | Endnotes.
wdPaneEndnoteSeparator | 14 | The endnote separator.
wdPaneEvenPagesFooter | 6 | The even pages footer.
wdPaneEvenPagesHeader | 3 | The even pages header.
wdPaneFirstPageFooter | 5 | The first page footer.
wdPaneFirstPageHeader | 2 | The first page header.
wdPaneFootnoteContinuationNotice | 9 | The footnote continuation notice.
wdPaneFootnoteContinuationSeparator | 10 | The footnote continuation separator.
wdPaneFootnotes | 7 | Footnotes.
wdPaneFootnoteSeparator | 11 | The footnote separator.
wdPaneNone | 0 | No display.
wdPanePrimaryFooter | 4 | The primary footer pane.
wdPanePrimaryHeader | 1 | The primary header pane.
wdPaneRevisions | 18 | The revisions pane.
wdPaneRevisionsHoriz | 19 | The revisions pane displays along the bottom of the document window.
wdPaneRevisionsVert | 20 | The revisions pane displays along the left side of the document window.


WdSpellingErrorType Enumeration (Word)

 Copy code hover
[image]

WdSpellingErrorType Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies a spelling error type.

Name | Value | Description
wdSpellingCapitalization | 2 | Capitalization error.
wdSpellingCorrect | 0 | Spelling is correct.
wdSpellingNotInDictionary | 1 | The word is not in the specified dictionary.


WdSpellingWordType Enumeration (Word)

 Copy code hover
[image]

WdSpellingWordType Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the way Microsoft Word makes spelling suggestions.

Name | Value | Description
wdAnagram | 2 | Anagram searching.
wdSpellword | 0 | Spellword searching.
wdWildcard | 1 | Wildcard searching.


WdStatistic Enumeration (Word)

 Copy code hover
[image]

WdStatistic Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies a statistic to return from a selection or item.

Name | Value | Description
wdStatisticCharacters | 3 | Count of characters.
wdStatisticCharactersWithSpaces | 5 | Count of characters including spaces.
wdStatisticFarEastCharacters | 6 | Count of characters for Asian languages.
wdStatisticLines | 1 | Count of lines.
wdStatisticPages | 2 | Count of pages.
wdStatisticParagraphs | 4 | Count of paragraphs.
wdStatisticWords | 0 | Count of words.


WdStoryType Enumeration (Word)

 Copy code hover
[image]

WdStoryType Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the story type of a selection or item.

Name | Value | Description
wdCommentsStory | 4 | Comments story.
wdEndnoteContinuationNoticeStory | 17 | Endnote continuation notice story.
wdEndnoteContinuationSeparatorStory | 16 | Endnote continuation separator story.
wdEndnoteSeparatorStory | 15 | Endnote separator story.
wdEndnotesStory | 3 | Endnotes story.
wdEvenPagesFooterStory | 8 | Even pages footer story.
wdEvenPagesHeaderStory | 6 | Even pages header story.
wdFirstPageFooterStory | 11 | First page footer story.
wdFirstPageHeaderStory | 10 | First page header story.
wdFootnoteContinuationNoticeStory | 14 | Footnote continuation notice story.
wdFootnoteContinuationSeparatorStory | 13 | Footnote continuation separator story.
wdFootnoteSeparatorStory | 12 | Footnote separator story.
wdFootnotesStory | 2 | Footnotes story.
wdMainTextStory | 1 | Main text story.
wdPrimaryFooterStory | 9 | Primary footer story.
wdPrimaryHeaderStory | 7 | Primary header story.
wdTextFrameStory | 5 | Text frame story.


WdStyleSheetLinkType Enumeration (Word)

 Copy code hover
[image]

WdStyleSheetLinkType Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies how to associate a style sheet with the document.

Name | Value | Description
wdStyleSheetLinkTypeImported | 1 | Imported internal style sheet.
wdStyleSheetLinkTypeLinked | 0 | Linked external style sheet.


WdStyleSheetPrecedence Enumeration (Word)

 Copy code hover
[image]

WdStyleSheetPrecedence Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the level of importance of a style sheet compared with other cascading style sheets attached to the Web document.

Name | Value | Description
wdStyleSheetPrecedenceHigher | -1 | Raise precedence.
wdStyleSheetPrecedenceHighest | 1 | Highest precedence.
wdStyleSheetPrecedenceLower | -2 | Lower precedence.
wdStyleSheetPrecedenceLowest | 0 | Lowest precedence.


WdStyleSort Enumeration (Word)

 Copy code hover
[image]

WdStyleSort Enumeration (Word)
Send feedback

Published: July 16, 2012

Indicates how to sort styles in the Styles task pane.

Name | Value | Description
wdStyleSortByBasedOn | 3 | Sorts styles based on the item indicated in the Sort Styles Based On option.
wdStyleSortByFont | 2 | Sorts styles based on the name of the font used.
wdStyleSortByName | 0 | Sorts styles alphabetically based on the name of the style.
wdStyleSortByType | 4 | Sorts styles based on whether the style is a paragraph style or character style.
wdStyleSortRecommended | 1 | Sorts styles based on whether they are recommended for use.


WdStyleType Enumeration (Word)

 Copy code hover
[image]

WdStyleType Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the style type to apply.

Name | Value | Description
wdStyleTypeCharacter | 2 | Body character style.
wdStyleTypeList | 4 | List style.
wdStyleTypeParagraph | 1 | Paragraph style.
wdStyleTypeTable | 3 | Table style.


WdStylisticSet Enumeration (Word)

 Copy code hover
[image]

WdStylisticSet Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the stylistic set to apply to the font.

Version Information

Version Added: Word 2010

Name | Value | Description
wdStylisticSet01 | 1 | First stylistic set for the specified font.
wdStylisticSet02 | 2 | Second stylistic set for the specified font.
wdStylisticSet03 | 4 | Third stylistic set for the specified font.
wdStylisticSet04 | 8 | Fourth stylistic set for the specified font.
wdStylisticSet05 | 16 | Fifth stylistic set for the specified font.
wdStylisticSet06 | 32 | Sixth stylistic set for the specified font.
wdStylisticSet07 | 64 | Seventh stylistic set for the specified font.
wdStylisticSet08 | 128 | Eighth stylistic set for the specified font.
wdStylisticSet09 | 256 | Ninth stylistic set for the specified font.
wdStylisticSet10 | 512 | Tenth stylistic set for the specified font.
wdStylisticSet11 | 1024 | Eleventh stylistic set for the specified font.
wdStylisticSet12 | 2048 | Twelfth stylistic set for the specified font.
wdStylisticSet13 | 4096 | Thirteenth stylistic set for the specified font.
wdStylisticSet14 | 8192 | Fourtheenth stylistic set for the specified font.
wdStylisticSet15 | 16384 | Fifthteenth stylistic set for the specified font.
wdStylisticSet16 | 32768 | Sixteenth stylistic set for the specified font.
wdStylisticSet17 | 65536 | Seventeenth stylistic set for the specified font.
wdStylisticSet18 | 131072 | Eighteenth stylistic set for the specified font.
wdStylisticSet19 | 262144 | Nineteenth stylistic set for the specified font.
wdStylisticSet20 | 524288 | Twentieth stylistic set for the specified font.
wdStylisticSetDefault | 0 | Default stylistic set for the specified font.

Remarks

Some OpenType fonts provide stylistic sets. A stylistic set defines a set of characters within the font that are intended to be used together, usually for the purpose of visual harmony, such as in headings. 20 stylistic sets are possible per font.

Note Note

Not all OpenType fonts provide stylistic sets. Setting a font's StylisticSet property to a WdStylisticSet constant that is not provided by the font has no effect.


WdSubscriberFormats Enumeration (Word)

 Copy code hover
[image]

WdSubscriberFormats Enumeration (Word)
Send feedback

Published: July 16, 2012

This enumeration has been deprecated and should not be used.

Name | Value | Description
wdSubscriberBestFormat | 0 | Not supported.
wdSubscriberPict | 4 | Not supported.
wdSubscriberRTF | 1 | Not supported.
wdSubscriberText | 2 | Not supported.


WdTabAlignment Enumeration (Word)

 Copy code hover
[image]

WdTabAlignment Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the tab stop alignment to apply.

Name | Value | Description
wdAlignTabBar | 4 | Bar-aligned.
wdAlignTabCenter | 1 | Center-aligned.
wdAlignTabDecimal | 3 | Decimal-aligned.
wdAlignTabLeft | 0 | Left-aligned.
wdAlignTabList | 6 | List-aligned.
wdAlignTabRight | 2 | Right-aligned.


WdTabLeader Enumeration (Word)

 Copy code hover
[image]

WdTabLeader Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the character to use as the leader with formatted tabs.

Name | Value | Description
wdTabLeaderDashes | 2 | Dashes.
wdTabLeaderDots | 1 | Dots.
wdTabLeaderHeavy | 4 | A heavy line.
wdTabLeaderLines | 3 | Double lines.
wdTabLeaderMiddleDot | 5 | A middle dot.
wdTabLeaderSpaces | 0 | Spaces. Default.


WdTableDirection Enumeration (Word)

 Copy code hover
[image]

WdTableDirection Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the direction in which Microsoft Word orders cells in the specified table or row.

Name | Value | Description
wdTableDirectionLtr | 1 | The selected rows are arranged with the first column in the leftmost position.
wdTableDirectionRtl | 0 | The selected rows are arranged with the first column in the rightmost position.


WdTableFieldSeparator Enumeration (Word)

 Copy code hover
[image]

WdTableFieldSeparator Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the character to use to separate text into cells when converting text to a table, or to delimit converted columns when converting a table to text (paragraph marks delimit converted rows).

Name | Value | Description
wdSeparateByCommas | 2 | A comma.
wdSeparateByDefaultListSeparator | 3 | The default list separator.
wdSeparateByParagraphs | 0 | Paragraph markers.
wdSeparateByTabs | 1 | A tab.


WdTableFormat Enumeration (Word)

 Copy code hover
[image]

WdTableFormat Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the predefined format to apply to a table.

Name | Value | Description
wdTableFormat3DEffects1 | 32 | 3-D effects format number 1.
wdTableFormat3DEffects2 | 33 | 3-D effects format number 2.
wdTableFormat3DEffects3 | 34 | 3-D effects format number 3.
wdTableFormatClassic1 | 4 | Classic format number 1.
wdTableFormatClassic2 | 5 | Classic format number 2.
wdTableFormatClassic3 | 6 | Classic format number 3.
wdTableFormatClassic4 | 7 | Classic format number 4.
wdTableFormatColorful1 | 8 | Colorful format number 1.
wdTableFormatColorful2 | 9 | Colorful format number 2.
wdTableFormatColorful3 | 10 | Colorful format number 3.
wdTableFormatColumns1 | 11 | Columns format number 1.
wdTableFormatColumns2 | 12 | Columns format number 2.
wdTableFormatColumns3 | 13 | Columns format number 3.
wdTableFormatColumns4 | 14 | Columns format number 4.
wdTableFormatColumns5 | 15 | Columns format number 5.
wdTableFormatContemporary | 35 | Contemporary format.
wdTableFormatElegant | 36 | Elegant format.
wdTableFormatGrid1 | 16 | Grid format number 1.
wdTableFormatGrid2 | 17 | Grid format number 2.
wdTableFormatGrid3 | 18 | Grid format number 3.
wdTableFormatGrid4 | 19 | Grid format number 4.
wdTableFormatGrid5 | 20 | Grid format number 5.
wdTableFormatGrid6 | 21 | Grid format number 6.
wdTableFormatGrid7 | 22 | Grid format number 7.
wdTableFormatGrid8 | 23 | Grid format number 8.
wdTableFormatList1 | 24 | List format number 1.
wdTableFormatList2 | 25 | List format number 2.
wdTableFormatList3 | 26 | List format number 3.
wdTableFormatList4 | 27 | List format number 4.
wdTableFormatList5 | 28 | List format number 5.
wdTableFormatList6 | 29 | List format number 6.
wdTableFormatList7 | 30 | List format number 7.
wdTableFormatList8 | 31 | List format number 8.
wdTableFormatNone | 0 | No formatting.
wdTableFormatProfessional | 37 | Professional format.
wdTableFormatSimple1 | 1 | Simple format number 1.
wdTableFormatSimple2 | 2 | Simple format number 2.
wdTableFormatSimple3 | 3 | Simple format number 3.
wdTableFormatSubtle1 | 38 | Subtle format number 1.
wdTableFormatSubtle2 | 39 | Subtle format number 2.
wdTableFormatWeb1 | 40 | Web format number 1.
wdTableFormatWeb2 | 41 | Web format number 2.
wdTableFormatWeb3 | 42 | Web format number 3.


WdTableFormatApply Enumeration (Word)

 Copy code hover
[image]

WdTableFormatApply Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies how table formatting should be applied.

Name | Value | Description
wdTableFormatApplyAutoFit | 16 | AutoFit.
wdTableFormatApplyBorders | 1 | Borders.
wdTableFormatApplyColor | 8 | Color.
wdTableFormatApplyFirstColumn | 128 | Apply AutoFormat to first column.
wdTableFormatApplyFont | 4 | Font.
wdTableFormatApplyHeadingRows | 32 | Apply AutoFormat to heading rows.
wdTableFormatApplyLastColumn | 256 | Apply AutoFormat to last column.
wdTableFormatApplyLastRow | 64 | Apply AutoFormat to last row.
wdTableFormatApplyShading | 2 | Shading.


WdTablePosition Enumeration (Word)

 Copy code hover
[image]

WdTablePosition Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the relative position of a table in the document.

Name | Value | Description
wdTableBottom | -999997 | At the bottom of the document.
wdTableCenter | -999995 | Centered.
wdTableInside | -999994 | Placed inside a range.
wdTableLeft | -999998 | Aligned to the left side of the document.
wdTableOutside | -999993 | Placed outside a range.
wdTableRight | -999996 | Aligned to the right side of the document.
wdTableTop | -999999 | At the top of the document.


WdTaskPanes Enumeration (Word)

 Copy code hover
[image]

WdTaskPanes Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the type of task pane.

Name | Value | Description
wdTaskPaneApplyStyles | 17 | Apply styles pane.
wdTaskPaneDocumentActions | 7 | Document actions pane.
wdTaskPaneDocumentProtection | 6 | Document protection pane.
wdTaskPaneFaxService | 11 | Fax service pane.
wdTaskPaneFormatting | 0 | Formatting pane.
wdTaskPaneHelp | 9 | Help pane.
wdTaskPaneMailMerge | 2 | Mail merge pane.
wdTaskPaneProofing | 20 | Proofing pane.
wdTaskPaneResearch | 10 | Research pane.
wdTaskPaneRevealFormatting | 1 | Reveal formatting codes pane.
wdTaskPaneRevPaneFlex | 22 | Revisions pane flex pane.
wdTaskPaneSearch | 4 | Search pane.
wdTaskPaneSignature | 14 | Signature pane.
wdTaskPaneStyleInspector | 15 | Style inspector pane.
wdTaskPaneThesaurus | 23 | Thesaurus pane.
wdTaskPaneTranslate | 3 | Translate pane.
wdTaskPaneXMLDocument | 12 | XML document pane.
wdTaskPaneXMLMapping | 21 | XML mapping pane.
wdTaskPaneXMLStructure | 5 | XML structure pane.


WdTCSCConverterDirection Enumeration (Word)

 Copy code hover
[image]

WdTCSCConverterDirection Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies how to convert between Traditional Chinese and Simplified Chinese.

Name | Value | Description
wdTCSCConverterDirectionAuto | 2 | Convert in the appropriate direction based on the detected language of the specified range.
wdTCSCConverterDirectionSCTC | 0 | Convert from Simplified Chinese to Traditional Chinese.
wdTCSCConverterDirectionTCSC | 1 | Convert from Traditional Chinese to Simplified Chinese.


WdTemplateType Enumeration (Word)

 Copy code hover
[image]

WdTemplateType Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the type of template.

Name | Value | Description
wdAttachedTemplate | 2 | An attached template.
wdGlobalTemplate | 1 | A global template.
wdNormalTemplate | 0 | The normal default template.


WdTextboxTightWrap Enumeration (Word)

 Copy code hover
[image]

WdTextboxTightWrap Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies how Microsoft Word tightly wraps text around text boxes.

Name | Value | Description
wdTightAll | 1 | Wraps text around the text box tightly to the contents of the text box on all lines.
wdTightFirstAndLastLines | 2 | Wraps text tightly only on first and last lines.
wdTightFirstLineOnly | 3 | Wraps text tightly only on the first line.
wdTightLastLineOnly | 4 | Wraps text tightly only on the last line.
wdTightNone | 0 | Does not wrap text tightly around the contents of a text box.

Remarks

Typically, text is wrapped to the extents of the text box, including any white space around its contents. These settings allow the surrounding text to wrap to the contents of the text box and not the extents of the text box itself.

Note Note

This setting works only if the text box is floating and has no border or fill set.


WdTextFormFieldType Enumeration (Word)

 Copy code hover
[image]

WdTextFormFieldType Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the text form field type.

Name | Value | Description
wdCalculationText | 5 | Calculation text field.
wdCurrentDateText | 3 | Current date text field.
wdCurrentTimeText | 4 | Current time text field.
wdDateText | 2 | Date text field.
wdNumberText | 1 | Number text field.
wdRegularText | 0 | Regular text field.


WdTextOrientation Enumeration (Word)

 Copy code hover
[image]

WdTextOrientation Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the text direction in a range or selection.

Name | Value | Description
wdTextOrientationDownward | 3 | Text flows downward on a slope.
wdTextOrientationHorizontal | 0 | Text flows horizontally. Default.
wdTextOrientationHorizontalRotatedFarEast | 4 | Text flows horizontally but from right to left to accommodate right-to-left languages.
wdTextOrientationUpward | 2 | Text flows upward on a slope.
wdTextOrientationVerticalFarEast | 1 | Text flows vertically and reads downward from the top, right to left.
wdTextOrientationVertical | 5 | Text flows vertically and reads downward from the top, left to right.


WdTextureIndex Enumeration (Word)

 Copy code hover
[image]

WdTextureIndex Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the shading texture to use for a selected item.

Name | Value | Description
wdTexture10Percent | 100 | 10 percent shading.
wdTexture12Pt5Percent | 125 | 12.5 percent shading.
wdTexture15Percent | 150 | 15 percent shading.
wdTexture17Pt5Percent | 175 | 17.5 percent shading.
wdTexture20Percent | 200 | 20 percent shading.
wdTexture22Pt5Percent | 225 | 22.5 percent shading.
wdTexture25Percent | 250 | 25 percent shading.
wdTexture27Pt5Percent | 275 | 27.5 percent shading.
wdTexture2Pt5Percent | 25 | 2.5 percent shading.
wdTexture30Percent | 300 | 30 percent shading.
wdTexture32Pt5Percent | 325 | 32.5 percent shading.
wdTexture35Percent | 350 | 35 percent shading.
wdTexture37Pt5Percent | 375 | 37.5 percent shading.
wdTexture40Percent | 400 | 40 percent shading.
wdTexture42Pt5Percent | 425 | 42.5 percent shading.
wdTexture45Percent | 450 | 45 percent shading.
wdTexture47Pt5Percent | 475 | 47.5 percent shading.
wdTexture50Percent | 500 | 50 percent shading.
wdTexture52Pt5Percent | 525 | 52.5 percent shading.
wdTexture55Percent | 550 | 55 percent shading.
wdTexture57Pt5Percent | 575 | 57.5 percent shading.
wdTexture5Percent | 50 | 5 percent shading.
wdTexture60Percent | 600 | 60 percent shading.
wdTexture62Pt5Percent | 625 | 62.5 percent shading.
wdTexture65Percent | 650 | 65 percent shading.
wdTexture67Pt5Percent | 675 | 67.5 percent shading.
wdTexture70Percent | 700 | 70 percent shading.
wdTexture72Pt5Percent | 725 | 72.5 percent shading.
wdTexture75Percent | 750 | 75 percent shading.
wdTexture77Pt5Percent | 775 | 77.5 percent shading.
wdTexture7Pt5Percent | 75 | 7.5 percent shading.
wdTexture80Percent | 800 | 80 percent shading.
wdTexture82Pt5Percent | 825 | 82.5 percent shading.
wdTexture85Percent | 850 | 85 percent shading.
wdTexture87Pt5Percent | 875 | 87.5 percent shading.
wdTexture90Percent | 900 | 90 percent shading.
wdTexture92Pt5Percent | 925 | 92.5 percent shading.
wdTexture95Percent | 950 | 95 percent shading.
wdTexture97Pt5Percent | 975 | 97.5 percent shading.
wdTextureCross | -11 | Horizontal cross shading.
wdTextureDarkCross | -5 | Dark horizontal cross shading.
wdTextureDarkDiagonalCross | -6 | Dark diagonal cross shading.
wdTextureDarkDiagonalDown | -3 | Dark diagonal down shading.
wdTextureDarkDiagonalUp | -4 | Dark diagonal up shading.
wdTextureDarkHorizontal | -1 | Dark horizontal shading.
wdTextureDarkVertical | -2 | Dark vertical shading.
wdTextureDiagonalCross | -12 | Diagonal cross shading.
wdTextureDiagonalDown | -9 | Diagonal down shading.
wdTextureDiagonalUp | -10 | Diagonal up shading.
wdTextureHorizontal | -7 | Horizontal shading.
wdTextureNone | 0 | No shading.
wdTextureSolid | 1000 | Solid shading.
wdTextureVertical | -8 | Vertical shading.


WdThemeColorIndex Enumeration (Word)

 Copy code hover
[image]

WdThemeColorIndex Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the theme colors for document themes.

Name | Value | Description
wdNotThemeColor | -1 | No color.
wdThemeColorAccent1 | 4 | Accent color 1.
wdThemeColorAccent2 | 5 | Accent color 2.
wdThemeColorAccent3 | 6 | Accent color 3.
wdThemeColorAccent4 | 7 | Accent color 4.
wdThemeColorAccent5 | 8 | Accent color 5.
wdThemeColorAccent6 | 9 | Accent color 6.
wdThemeColorBackground1 | 12 | Background color 1.
wdThemeColorBackground2 | 14 | Background color 2.
wdThemeColorHyperlink | 10 | Hyperlink color.
wdThemeColorHyperlinkFollowed | 11 | Followed hyperlink color.
wdThemeColorMainDark1 | 0 | Dark main color 1.
wdThemeColorMainDark2 | 2 | Dark main color 2.
wdThemeColorMainLight1 | 1 | Light main color 1.
wdThemeColorMainLight2 | 3 | Light main color 2.
wdThemeColorText1 | 13 | Text color 1.
wdThemeColorText2 | 15 | Text color 2.


WdToaFormat Enumeration (Word)

 Copy code hover
[image]

WdToaFormat Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the type of formatting to apply to the table of authorities in the active document.

Name | Value | Description
wdTOAClassic | 1 | Classic formatting.
wdTOADistinctive | 2 | Distinctive formatting.
wdTOAFormal | 3 | Formal formatting.
wdTOASimple | 4 | Simple formatting.
wdTOATemplate | 0 | Template formatting.


WdTocFormat Enumeration (Word)

 Copy code hover
[image]

WdTocFormat Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the type of formatting to apply to the table of contents in the active document.

Name | Value | Description
wdTOCClassic | 1 | Classic formatting.
wdTOCDistinctive | 2 | Distinctive formatting.
wdTOCFancy | 3 | Fancy formatting.
wdTOCFormal | 5 | Formal formatting.
wdTOCModern | 4 | Modern formatting.
wdTOCSimple | 6 | Simple formatting.
wdTOCTemplate | 0 | Template formatting.


WdTofFormat Enumeration (Word)

 Copy code hover
[image]

WdTofFormat Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the type of formatting to apply to the table of figures in the active document.

Name | Value | Description
wdTOFCentered | 3 | Centered formatting.
wdTOFClassic | 1 | Classic formatting.
wdTOFDistinctive | 2 | Distinctive formatting.
wdTOFFormal | 4 | Formal formatting.
wdTOFSimple | 5 | Simple formatting.
wdTOFTemplate | 0 | Template formatting.


WdTrailingCharacter Enumeration (Word)

 Copy code hover
[image]

WdTrailingCharacter Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the character inserted after the number for a numbered list item.

Name | Value | Description
wdTrailingNone | 2 | No character is inserted.
wdTrailingSpace | 1 | A space is inserted. Default.
wdTrailingTab | 0 | A tab is inserted.


WdTwoLinesInOneType Enumeration (Word)

 Copy code hover
[image]

WdTwoLinesInOneType Enumeration (Word)
Send feedback

Specifies the character to use to enclose two lines being written into one.

Name | Value | Description
wdTwoLinesInOneAngleBrackets | 4 | Enclose the lines using angle brackets.
wdTwoLinesInOneCurlyBrackets | 5 | Enclose the lines using curly brackets.
wdTwoLinesInOneNoBrackets | 1 | Use no enclosing character.
wdTwoLinesInOneNone | 0 | Restore the two lines of text written into one to two separate lines.
wdTwoLinesInOneParentheses | 2 | Enclose the lines using parentheses.
wdTwoLinesInOneSquareBrackets | 3 | Enclose the lines using square brackets.


WdUnderline Enumeration (Word)

 Copy code hover
[image]

WdUnderline Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the type of underline to apply.

Name | Value | Description
wdUnderlineDash | 7 | Dashes.
wdUnderlineDashHeavy | 23 | Heavy dashes.
wdUnderlineDashLong | 39 | Long dashes.
wdUnderlineDashLongHeavy | 55 | Long heavy dashes.
wdUnderlineDotDash | 9 | Alternating dots and dashes.
wdUnderlineDotDashHeavy | 25 | Alternating heavy dots and heavy dashes.
wdUnderlineDotDotDash | 10 | An alternating dot-dot-dash pattern.
wdUnderlineDotDotDashHeavy | 26 | An alternating heavy dot-dot-dash pattern.
wdUnderlineDotted | 4 | Dots.
wdUnderlineDottedHeavy | 20 | Heavy dots.
wdUnderlineDouble | 3 | A double line.
wdUnderlineNone | 0 | No underline.
wdUnderlineSingle | 1 | A single line. default.
wdUnderlineThick | 6 | A single thick line.
wdUnderlineWavy | 11 | A single wavy line.
wdUnderlineWavyDouble | 43 | A double wavy line.
wdUnderlineWavyHeavy | 27 | A heavy wavy line.
wdUnderlineWords | 2 | Underline individual words only.


WdUnits Enumeration (Word)

 Copy code hover
[image]

WdUnits Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies a unit of measure to use.

Name | Value | Description
wdCell | 12 | A cell.
wdCharacter | 1 | A character.
wdCharacterFormatting | 13 | Character formatting.
wdColumn | 9 | A column.
wdItem | 16 | The selected item.
wdLine | 5 | A line.
wdParagraph | 4 | A paragraph.
wdParagraphFormatting | 14 | Paragraph formatting.
wdRow | 10 | A row.
wdScreen | 7 | The screen dimensions.
wdSection | 8 | A section.
wdSentence | 3 | A sentence.
wdStory | 6 | A story.
wdTable | 15 | A table.
wdWindow | 11 | A window.
wdWord | 2 | A word.


WdUpdateStyleListBehavior Enumeration (Word)

 Copy code hover
[image]

WdUpdateStyleListBehavior Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the behavior Word 2010 should take when updating a style to match a selection that contains numbering or bullets.

Version Information

Version Added: Word 2010

Name | Value | Description
wdListBehaviorAddBulletsNumbering | 1 | Adds the numbering or bullets pattern of the selection to all paragraphs in the document that use the same style.
wdListBehaviorKeepPreviousPattern | 0 | Keeps the existing numbering or bullets pattern for all other paragraphs that use the same style and does not apply the numbering or bullets pattern of the selection.


WdUseFormattingFrom Enumeration (Word)

 Copy code hover
[image]

WdUseFormattingFrom Enumeration (Word)
Send feedback

Specifies a source to copy formatting from.

Name | Value | Description
wdFormattingFromCurrent | 0 | Copy source formatting from the current item.
wdFormattingFromPrompt | 2 | Prompt the user for formatting to use.
wdFormattingFromSelected | 1 | Copy source formatting from the current selection.


WdVerticalAlignment Enumeration (Word)

 Copy code hover
[image]

WdVerticalAlignment Enumeration (Word)
Send feedback

Specifies the type of vertical alignment to apply.

Name | Value | Description
wdAlignVerticalBottom | 3 | Bottom vertical alignment.
wdAlignVerticalCenter | 1 | Center vertical alignment.
wdAlignVerticalJustify | 2 | Justified vertical alignment.
wdAlignVerticalTop | 0 | Top vertical alignment.


WdViewType Enumeration (Word)

 Copy code hover
[image]

WdViewType Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the view type.

Name | Value | Description
wdMasterView | 5 | A master view.
wdNormalView | 1 | A normal view.
wdOutlineView | 2 | An outline view.
wdPrintPreview | 4 | A print preview view.
wdPrintView | 3 | A print view.
wdReadingView | 7 | A reading view.
wdWebView | 6 | A Web view.


WdVisualSelection Enumeration (Word)

 Copy code hover
[image]

WdVisualSelection Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the selection behavior based on visual cursor movement in a right-to-left language document.

Name | Value | Description
wdVisualSelectionBlock | 0 | All selected lines are the same width.
wdVisualSelectionContinuous | 1 | The selection wraps from line to line.


WdWindowState Enumeration (Word)

 Copy code hover
[image]

WdWindowState Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the state of the current document window or task window.

Name | Value | Description
wdWindowStateMaximize | 1 | Maximized.
wdWindowStateMinimize | 2 | Minimized.
wdWindowStateNormal | 0 | Normal.


WdWindowType Enumeration (Word)

 Copy code hover
[image]

WdWindowType Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the type of window.

Name | Value | Description
wdWindowDocument | 0 | A document window.
wdWindowTemplate | 1 | A template window.


WdWordDialog Enumeration (Word)

 Copy code hover
[image]

WdWordDialog Enumeration (Word)
Send feedback

Published: July 16, 2012

Indicates the Microsoft Word dialog boxes with which you can work and specifies arguments, if applicable, that you can use to get or set values in a dialog box.

Name | Value | Description
wdDialogBuildingBlockOrganizer | 2067 | (none)
wdDialogConnect | 420 | Drive, Path, Password
wdDialogConsistencyChecker | 1121 | (none)
wdDialogContentControlProperties | 2394 | (none)
wdDialogControlRun | 235 | Application
wdDialogConvertObject | 392 | IconNumber, ActivateAs, IconFileName, Caption, Class, DisplayIcon, Floating
wdDialogCopyFile | 300 | FileName, Directory
wdDialogCreateAutoText | 872 | (none)
wdDialogCreateSource | 1922 | (none)
wdDialogCSSLinks | 1261 | LinkStyles
wdDialogDocumentInspector | 1482 | (none)
wdDialogDocumentStatistics | 78 | FileName, Directory, Template, Title, Created, LastSaved, LastSavedBy, Revision, Time, Printed, Pages, Words, Characters, Paragraphs, Lines, FileSize
wdDialogDrawAlign | 634 | Horizontal, Vertical, RelativeTo
wdDialogDrawSnapToGrid | 633 | SnapToGrid, XGrid, YGrid, XOrigin, YOrigin, SnapToShapes, XGridDisplay, YGridDisplay, FollowMargins, ViewGridLines, DefineLineBasedOnGrid
wdDialogEditAutoText | 985 | Name, Context, InsertAs, Insert, Add, Define, InsertAsText, Delete, CompleteAT
wdDialogEditCreatePublisher | 732 | Macintosh-only. For information about this constant, consult the language reference Help included with Microsoft Office Macintosh Edition.
wdDialogEditFind | 112 | Find, Replace, Direction, MatchCase, WholeWord, PatternMatch, SoundsLike, FindNext, ReplaceOne, ReplaceAll, Format, Wrap, FindAllWordForms, MatchByte, FuzzyFind, Destination, CorrectEnd, MatchKashida, MatchDiacritics, MatchAlefHamza, MatchControl
wdDialogEditFrame | 458 | Wrap, WidthRule, FixedWidth, HeightRule, FixedHeight, PositionHorz, PositionHorzRel, DistFromText, PositionVert, PositionVertRel, DistVertFromText, MoveWithText, LockAnchor, RemoveFrame
wdDialogEditGoTo | 896 | Find, Replace, Direction, MatchCase, WholeWord, PatternMatch, SoundsLike, FindNext, ReplaceOne, ReplaceAll, Format, Wrap, FindAllWordForms, MatchByte, FuzzyFind, Destination, CorrectEnd, MatchKashida, MatchDiacritics, MatchAlefHamza, MatchControl
wdDialogEditGoToOld | 811 | (none)
wdDialogEditLinks | 124 | UpdateMode, Locked, SavePictureInDoc, UpdateNow, OpenSource, KillLink, Link, Application, Item, FileName, PreserveFormatLinkUpdate
wdDialogEditObject | 125 | Verb
wdDialogEditPasteSpecial | 111 | IconNumber, Link, DisplayIcon, Class, DataType, IconFileName, Caption, Floating
wdDialogEditPublishOptions | 735 | Macintosh-only. For information about this constant, consult the language reference Help included with Microsoft Office Macintosh Edition.
wdDialogEditReplace | 117 | Find, Replace, Direction, MatchCase, WholeWord, PatternMatch, SoundsLike, FindNext, ReplaceOne, ReplaceAll, Format, Wrap, FindAllWordForms, MatchByte, FuzzyFind, Destination, CorrectEnd, MatchKashida, MatchDiacritics, MatchAlefHamza, MatchControl
wdDialogEditStyle | 120 | (none)
wdDialogEditSubscribeOptions | 736 | Macintosh-only. For information about this constant, consult the language reference Help included with Microsoft Office Macintosh Edition.
wdDialogEditSubscribeTo | 733 | Macintosh-only. For information about this constant, consult the language reference Help included with Microsoft Office Macintosh Edition.
wdDialogEditTOACategory | 625 | Category, CategoryName
wdDialogEmailOptions | 863 | (none)
wdDialogFileDocumentLayout | 178 | Tab, PaperSize, TopMargin, BottomMargin, LeftMargin, RightMargin, Gutter, PageWidth, PageHeight, Orientation, FirstPage, OtherPages, VertAlign, ApplyPropsTo, Default, FacingPages, HeaderDistance, FooterDistance, SectionStart, OddAndEvenPages, DifferentFirstPage, Endnotes, LineNum, StartingNum, FromText, CountBy, NumMode, TwoOnOne, GutterPosition, LayoutMode, CharsLine, LinesPage, CharPitch, LinePitch, DocFontName, DocFontSize, PageColumns, TextFlow, FirstPageOnLeft, SectionType, RTLAlignment
wdDialogFileFind | 99 | SearchName, SearchPath, Name, SubDir, Title, Author, Keywords, Subject, Options, MatchCase, Text, PatternMatch, DateSavedFrom, DateSavedTo, SavedBy, DateCreatedFrom, DateCreatedTo, View, SortBy, ListBy, SelectedFile, Add, Delete, ShowFolders, MatchByte
wdDialogFileMacCustomPageSetupGX | 737 | Macintosh-only. For information about this constant, consult the language reference Help included with Microsoft Office Macintosh Edition.
wdDialogFileMacPageSetup | 685 | Macintosh-only. For information about this constant, consult the language reference Help included with Microsoft Office Macintosh Edition.
wdDialogFileMacPageSetupGX | 444 | Macintosh-only. For information about this constant, consult the language reference Help included with Microsoft Office Macintosh Edition.
wdDialogFileNew | 79 | Template, NewTemplate, DocumentType, Visible
wdDialogFileOpen | 80 | Name, ConfirmConversions, ReadOnly, LinkToSource, AddToMru, PasswordDoc, PasswordDot, Revert, WritePasswordDoc, WritePasswordDot, Connection, SQLStatement, SQLStatement1, Format, Encoding, Visible, OpenExclusive, OpenAndRepair, SubType, DocumentDirection, NoEncodingDialog, XMLTransform
wdDialogFilePageSetup | 178 | Tab, PaperSize, TopMargin, BottomMargin, LeftMargin, RightMargin, Gutter, PageWidth, PageHeight, Orientation, FirstPage, OtherPages, VertAlign, ApplyPropsTo, Default, FacingPages, HeaderDistance, FooterDistance, SectionStart, OddAndEvenPages, DifferentFirstPage, Endnotes, LineNum, StartingNum, FromText, CountBy, NumMode, TwoOnOne, GutterPosition, LayoutMode, CharsLine, LinesPage, CharPitch, LinePitch, DocFontName, DocFontSize, PageColumns, TextFlow, FirstPageOnLeft, SectionType, RTLAlignment, FolioPrint
wdDialogFilePrint | 88 | Background, AppendPrFile, Range, PrToFileName, From, To, Type, NumCopies, Pages, Order, PrintToFile, Collate, FileName, Printer, OutputPrinter, DuplexPrint, PrintZoomColumn, PrintZoomRow, PrintZoomPaperWidth, PrintZoomPaperHeight, ZoomPaper
wdDialogFilePrintOneCopy | 445 | Macintosh-only. For information about this constant, consult the language reference Help included with Microsoft Office Macintosh Edition.
wdDialogFilePrintSetup | 97 | Printer, Options, Network, DoNotSetAsSysDefault
wdDialogFileRoutingSlip | 624 | Subject, Message, AllAtOnce, ReturnWhenDone, TrackStatus, Protect, AddSlip, RouteDocument, AddRecipient, OldRecipient, ResetSlip, ClearSlip, ClearRecipients, Address
wdDialogFileSaveAs | 84 | Name, Format, LockAnnot, Password, AddToMru, WritePassword, RecommendReadOnly, EmbedFonts, NativePictureFormat, FormsData, SaveAsAOCELetter, WriteVersion, VersionDesc, InsertLineBreaks, AllowSubstitutions, LineEnding, AddBiDiMarks
wdDialogFileSaveVersion | 1007 | (none)
wdDialogFileSummaryInfo | 86 | Title, Subject, Author, Keywords, Comments, FileName, Directory, Template, CreateDate, LastSavedDate, LastSavedBy, RevisionNumber, EditTime, LastPrintedDate, NumPages, NumWords, NumChars, NumParas, NumLines, Update, FileSize
wdDialogFileVersions | 945 | AutoVersion, VersionDesc
wdDialogFitText | 983 | FitTextWidth
wdDialogFontSubstitution | 581 | UnavailableFont, SubstituteFont
wdDialogFormatAddrFonts | 103 | Points, Underline, Color, StrikeThrough, Superscript, Subscript, Hidden, SmallCaps, AllCaps, Spacing, Position, Kerning, KerningMin, Default, Tab, Font, Bold, Italic, DoubleStrikeThrough, Shadow, Outline, Emboss, Engrave, Scale, Animations, CharAccent, FontMajor, FontLowAnsi, FontHighAnsi, CharacterWidthGrid, ColorRGB, UnderlineColor, PointsBi, ColorBi, FontNameBi, BoldBi, ItalicBi, DiacColor
wdDialogFormatBordersAndShading | 189 | ApplyTo, Shadow, TopBorder, LeftBorder, BottomBorder, RightBorder, HorizBorder, VertBorder, TopColor, LeftColor, BottomColor, RightColor, HorizColor, VertColor, FromText, Shading, Foreground, Background, Tab, FineShading, TopStyle, LeftStyle, BottomStyle, RightStyle, HorizStyle, VertStyle, TopWeight, LeftWeight, BottomWeight, RightWeight, HorizWeight, VertWeight, BorderObjectType, BorderArtWeight, BorderArt, FromTextTop, FromTextBottom, FromTextLeft, FromTextRight, OffsetFrom, InFront, SurroundHeader, SurroundFooter, JoinBorder, LineColor, WhichPages, TL2BRBorder, TR2BLBorder, TL2BRColor, TR2BLColor, TL2BRStyle, TR2BLStyle, TL2BRWeight, TR2BLWeight, ForegroundRGB, BackgroundRGB, TopColorRGB, LeftColorRGB, BottomColorRGB, RightColorRGB, HorizColorRGB, VertColorRGB, TL2BRColorRGB, TR2BLColorRGB, LineColorRGB
wdDialogFormatBulletsAndNumbering | 824 | (none)
wdDialogFormatCallout | 610 | Type, Gap, Angle, Drop, Length, Border, AutoAttach, Accent
wdDialogFormatChangeCase | 322 | Type
wdDialogFormatColumns | 177 | Columns, ColumnNo, ColumnWidth, ColumnSpacing, EvenlySpaced, ApplyColsTo, ColLine, StartNewCol, FlowColumnsRtl
wdDialogFormatDefineStyleBorders | 185 | ApplyTo, Shadow, TopBorder, LeftBorder, BottomBorder, RightBorder, HorizBorder, VertBorder, TopColor, LeftColor, BottomColor, RightColor, HorizColor, VertColor, FromText, Shading, Foreground, Background, Tab, FineShading, TopStyle, LeftStyle, BottomStyle, RightStyle, HorizStyle, VertStyle, TopWeight, LeftWeight, BottomWeight, RightWeight, HorizWeight, VertWeight, BorderObjectType, BorderArtWeight, BorderArt, FromTextTop, FromTextBottom, FromTextLeft, FromTextRight, OffsetFrom, InFront, SurroundHeader, SurroundFooter, JoinBorder, LineColor, WhichPages, TL2BRBorder, TR2BLBorder, TL2BRColor, TR2BLColor, TL2BRStyle, TR2BLStyle, TL2BRWeight, TR2BLWeight, ForegroundRGB, BackgroundRGB, TopColorRGB, LeftColorRGB, BottomColorRGB, RightColorRGB, HorizColorRGB, VertColorRGB, TL2BRColorRGB, TR2BLColorRGB, LineColorRGB
wdDialogFormatDefineStyleFont | 181 | Points, Underline, Color, StrikeThrough, Superscript, Subscript, Hidden, SmallCaps, AllCaps, Spacing, Position, Kerning, KerningMin, Default, Tab, Font, Bold, Italic, DoubleStrikeThrough, Shadow, Outline, Emboss, Engrave, Scale, Animations, CharAccent, FontMajor, FontLowAnsi, FontHighAnsi, CharacterWidthGrid, ColorRGB, UnderlineColor, PointsBi, ColorBi, FontNameBi, BoldBi, ItalicBi, DiacColor
wdDialogFormatDefineStyleFrame | 184 | Wrap, WidthRule, FixedWidth, HeightRule, FixedHeight, PositionHorz, PositionHorzRel, DistFromText, PositionVert, PositionVertRel, DistVertFromText, MoveWithText, LockAnchor, RemoveFrame
wdDialogFormatDefineStyleLang | 186 | Language, CheckLanguage, Default, NoProof
wdDialogFormatDefineStylePara | 182 | LeftIndent, RightIndent, Before, After, LineSpacingRule, LineSpacing, Alignment, WidowControl, KeepWithNext, KeepTogether, PageBreak, NoLineNum, DontHyphen, Tab, FirstIndent, OutlineLevel, Kinsoku, WordWrap, OverflowPunct, TopLinePunct, AutoSpaceDE, LineHeightGrid, AutoSpaceDN, CharAlign, CharacterUnitLeftIndent, AdjustRight, CharacterUnitFirstIndent, CharacterUnitRightIndent, LineUnitBefore, LineUnitAfter, NoSpaceBetweenParagraphsOfSameStyle, OrientationBi
wdDialogFormatDefineStyleTabs | 183 | Position, DefTabs, Align, Leader, Set, Clear, ClearAll
wdDialogFormatDrawingObject | 960 | Left, PositionHorzRel, Top, PositionVertRel, LockAnchor, FloatOverText, LayoutInCell, WrapSide, TopDistanceFromText, BottomDistanceFromText, LeftDistanceFromText, RightDistanceFromText, Wrap, WordWrap, AutoSize, HRWidthType, HRHeight, HRNoshade, HRAlign, Text, AllowOverlap, HorizRule
wdDialogFormatDropCap | 488 | Position, Font, DropHeight, DistFromText
wdDialogFormatEncloseCharacters | 1162 | Style, Text, Enclosure
wdDialogFormatFont | 174 | Points, Underline, Color, StrikeThrough, Superscript, Subscript, Hidden, SmallCaps, AllCaps, Spacing, Position, Kerning, KerningMin, Default, Tab, Font, Bold, Italic, DoubleStrikeThrough, Shadow, Outline, Emboss, Engrave, Scale, Animations, CharAccent, FontMajor, FontLowAnsi, FontHighAnsi, CharacterWidthGrid, ColorRGB, UnderlineColor, PointsBi, ColorBi, FontNameBi, BoldBi, ItalicBi, DiacColor
wdDialogFormatFrame | 190 | Wrap, WidthRule, FixedWidth, HeightRule, FixedHeight, PositionHorz, PositionHorzRel, DistFromText, PositionVert, PositionVertRel, DistVertFromText, MoveWithText, LockAnchor, RemoveFrame
wdDialogFormatPageNumber | 298 | ChapterNumber, NumRestart, NumFormat, StartingNum, Level, Separator, DoubleQuote, PgNumberingStyle
wdDialogFormatParagraph | 175 | LeftIndent, RightIndent, Before, After, LineSpacingRule, LineSpacing, Alignment, WidowControl, KeepWithNext, KeepTogether, PageBreak, NoLineNum, DontHyphen, Tab, FirstIndent, OutlineLevel, Kinsoku, WordWrap, OverflowPunct, TopLinePunct, AutoSpaceDE, LineHeightGrid, AutoSpaceDN, CharAlign, CharacterUnitLeftIndent, AdjustRight, CharacterUnitFirstIndent, CharacterUnitRightIndent, LineUnitBefore, LineUnitAfter, NoSpaceBetweenParagraphsOfSameStyle, OrientationBi
wdDialogFormatPicture | 187 | SetSize, CropLeft, CropRight, CropTop, CropBottom, ScaleX, ScaleY, SizeX, SizeY
wdDialogFormatRetAddrFonts | 221 | Points, Underline, Color, StrikeThrough, Superscript, Subscript, Hidden, SmallCaps, AllCaps, Spacing, Position, Kerning, KerningMin, Default, Tab, Font, Bold, Italic, DoubleStrikeThrough, Shadow, Outline, Emboss, Engrave, Scale, Animations, CharAccent, FontMajor, FontLowAnsi, FontHighAnsi, CharacterWidthGrid, ColorRGB, UnderlineColor, PointsBi, ColorBi, FontNameBi, BoldBi, ItalicBi, DiacColor
wdDialogFormatSectionLayout | 176 | SectionStart, VertAlign, Endnotes, LineNum, StartingNum, FromText, CountBy, NumMode, SectionType
wdDialogFormatStyle | 180 | Name, Delete, Merge, NewName, BasedOn, NextStyle, Type, FileName, Source, AddToTemplate, Define, Rename, Apply, New, Link
wdDialogFormatStyleGallery | 505 | Template, Preview
wdDialogFormatStylesCustom | 1248 | (none)
wdDialogFormatTabs | 179 | Position, DefTabs, Align, Leader, Set, Clear, ClearAll
wdDialogFormatTheme | 855 | (none)
wdDialogFormattingRestrictions | 1427 | (none)
wdDialogFormFieldHelp | 361 | (none)
wdDialogFormFieldOptions | 353 | Entry, Exit, Name, Enable, TextType, TextWidth, TextDefault, TextFormat, CheckSize, CheckWidth, CheckDefault, Type, OwnHelp, HelpText, OwnStat, StatText, Calculate
wdDialogFrameSetProperties | 1074 | (none)
wdDialogHelpAbout | 9 | APPNAME, APPCOPYRIGHT, APPUSERNAME, APPORGANIZATION, APPSERIALNUMBER
wdDialogHelpWordPerfectHelp | 10 | WPCommand, HelpText, DemoGuidance
wdDialogHelpWordPerfectHelpOptions | 511 | CommandKeyHelp, DocNavKeys, MouseSimulation, DemoGuidance, DemoSpeed, HelpType
wdDialogHorizontalInVertical | 1160 | (none)
wdDialogIMESetDefault | 1094 | (none)
wdDialogInsertAddCaption | 402 | Name
wdDialogInsertAutoCaption | 359 | Clear, ClearAll, Object, Label, Position
wdDialogInsertBookmark | 168 | Name, SortBy, Add, Delete, Goto, Hidden
wdDialogInsertBreak | 159 | Type
wdDialogInsertCaption | 357 | Label, TitleAutoText, Title, Delete, Position, AutoCaption, ExcludeLabel
wdDialogInsertCaptionNumbering | 358 | Label, FormatNumber, ChapterNumber, Level, Separator, CapNumberingStyle
wdDialogInsertCrossReference | 367 | ReferenceType, ReferenceKind, ReferenceItem, InsertAsHyperLink, InsertPosition, SeparateNumbers, SeparatorCharacters
wdDialogInsertDatabase | 341 | Format, Style, LinkToSource, Connection, SQLStatement, SQLStatement1, PasswordDoc, PasswordDot, DataSource, From, To, IncludeFields, WritePasswordDoc, WritePasswordDot
wdDialogInsertDateTime | 165 | DateTimePic, InsertAsField, DbCharField, DateLanguage, CalendarType
wdDialogInsertField | 166 | Field
wdDialogInsertFile | 164 | Name, Range, ConfirmConversions, Link, Attachment
wdDialogInsertFootnote | 370 | Reference, NoteType, Symbol, FootNumberAs, EndNumberAs, FootnotesAt, EndnotesAt, FootNumberingStyle, EndNumberingStyle, FootStartingNum, FootRestartNum, EndStartingNum, EndRestartNum, ApplyPropsTo
wdDialogInsertFormField | 483 | Entry, Exit, Name, Enable, TextType, TextWidth, TextDefault, TextFormat, CheckSize, CheckWidth, CheckDefault, Type, OwnHelp, HelpText, OwnStat, StatText, Calculate
wdDialogInsertHyperlink | 925 | (none)
wdDialogInsertIndex | 170 | Outline, Fields, From, To, TableId, AddedStyles, Caption, HeadingSeparator, Replace, MarkEntry, AutoMark, MarkCitation, Type, RightAlignPageNumbers, Passim, KeepFormatting, Columns, Category, Label, ShowPageNumbers, AccentedLetters, Filter, SortBy, Leader, TOCUseHyperlinks, TOCHidePageNumInWeb, IndexLanguage, UseOutlineLevel
wdDialogInsertIndexAndTables | 473 | Outline, Fields, From, To, TableId, AddedStyles, Caption, HeadingSeparator, Replace, MarkEntry, AutoMark, MarkCitation, Type, RightAlignPageNumbers, Passim, KeepFormatting, Columns, Category, Label, ShowPageNumbers, AccentedLetters, Filter, SortBy, Leader, TOCUseHyperlinks, TOCHidePageNumInWeb, IndexLanguage, UseOutlineLevel
wdDialogInsertMergeField | 167 | MergeField, WordField
wdDialogInsertNumber | 812 | NumPic
wdDialogInsertObject | 172 | IconNumber, FileName, Link, DisplayIcon, Tab, Class, IconFileName, Caption, Floating
wdDialogInsertPageNumbers | 294 | Type, Position, FirstPage
wdDialogInsertPicture | 163 | Name, LinkToFile, New, FloatOverText
wdDialogInsertPlaceholder | 2348 | (none)
wdDialogInsertSource | 2120 | (none)
wdDialogInsertSubdocument | 583 | Name, ConfirmConversions, ReadOnly, LinkToSource, AddToMru, PasswordDoc, PasswordDot, Revert, WritePasswordDoc, WritePasswordDot, Connection, SQLStatement, SQLStatement1, Format, Encoding, Visible, OpenExclusive, OpenAndRepair, SubType, DocumentDirection, NoEncodingDialog, XMLTransform
wdDialogInsertSymbol | 162 | Font, Tab, CharNum, CharNumLow, Unicode, Hint
wdDialogInsertTableOfAuthorities | 471 | Outline, Fields, From, To, TableId, AddedStyles, Caption, HeadingSeparator, Replace, MarkEntry, AutoMark, MarkCitation, Type, RightAlignPageNumbers, Passim, KeepFormatting, Columns, Category, Label, ShowPageNumbers, AccentedLetters, Filter, SortBy, Leader, TOCUseHyperlinks, TOCHidePageNumInWeb, IndexLanguage, UseOutlineLevel
wdDialogInsertTableOfContents | 171 | Outline, Fields, From, To, TableId, AddedStyles, Caption, HeadingSeparator, Replace, MarkEntry, AutoMark, MarkCitation, Type, RightAlignPageNumbers, Passim, KeepFormatting, Columns, Category, Label, ShowPageNumbers, AccentedLetters, Filter, SortBy, Leader, TOCUseHyperlinks, TOCHidePageNumInWeb, IndexLanguage, UseOutlineLevel
wdDialogInsertTableOfFigures | 472 | Outline, Fields, From, To, TableId, AddedStyles, Caption, HeadingSeparator, Replace, MarkEntry, AutoMark, MarkCitation, Type, RightAlignPageNumbers, Passim, KeepFormatting, Columns, Category, Label, ShowPageNumbers, AccentedLetters, Filter, SortBy, Leader, TOCUseHyperlinks, TOCHidePageNumInWeb, IndexLanguage, UseOutlineLevel
wdDialogInsertWebComponent | 1324 | IconNumber, FileName, Link, DisplayIcon, Tab, Class, IconFileName, Caption, Floating
wdDialogLabelOptions | 1367 | (none)
wdDialogLetterWizard | 821 | SenderCity, DateFormat, IncludeHeaderFooter, LetterStyle, Letterhead, LetterheadLocation, LetterheadSize, RecipientName, RecipientAddress, Salutation, SalutationType, RecipientGender, RecipientReference, MailingInstructions, AttentionLine, LetterSubject, CCList, SenderName, ReturnAddress, Closing, SenderJobTitle, SenderCompany, SenderInitials, EnclosureNumber, PageDesign, InfoBlock, SenderGender, ReturnAddressSF, RecipientCode, SenderCode, SenderReference
wdDialogListCommands | 723 | ListType
wdDialogMailMerge | 676 | CheckErrors, Destination, MergeRecords, From, To, Suppression, MailMerge, QueryOptions, MailSubject, MailAsAttachment, MailAddress
wdDialogMailMergeCheck | 677 | CheckErrors
wdDialogMailMergeCreateDataSource | 642 | FileName, PasswordDoc, PasswordDot, HeaderRecord, MSQuery, SQLStatement, SQLStatement1, Connection, LinkToSource, WritePasswordDoc
wdDialogMailMergeCreateHeaderSource | 643 | FileName, PasswordDoc, PasswordDot, HeaderRecord, MSQuery, SQLStatement, SQLStatement1, Connection, LinkToSource, WritePasswordDoc
wdDialogMailMergeFieldMapping | 1304 | (none)
wdDialogMailMergeFindRecipient | 1326 | (none)
wdDialogMailMergeFindRecord | 569 | (none)
wdDialogMailMergeHelper | 680 | (none)
wdDialogMailMergeInsertAddressBlock | 1305 | (none)
wdDialogMailMergeInsertAsk | 4047 | (none)
wdDialogMailMergeInsertFields | 1307 | (none)
wdDialogMailMergeInsertFillIn | 4048 | (none)
wdDialogMailMergeInsertGreetingLine | 1306 | (none)
wdDialogMailMergeInsertIf | 4049 | (none)
wdDialogMailMergeInsertNextIf | 4053 | (none)
wdDialogMailMergeInsertSet | 4054 | (none)
wdDialogMailMergeInsertSkipIf | 4055 | (none)
wdDialogMailMergeOpenDataSource | 81 | (none)
wdDialogMailMergeOpenHeaderSource | 82 | (none)
wdDialogMailMergeQueryOptions | 681 | (none)
wdDialogMailMergeRecipients | 1308 | (none)
wdDialogMailMergeSetDocumentType | 1339 | (none)
wdDialogMailMergeUseAddressBook | 779 | (none)
wdDialogMarkCitation | 463 | (none)
wdDialogMarkIndexEntry | 169 | (none)
wdDialogMarkTableOfContentsEntry | 442 | (none)
wdDialogMyPermission | 1437 | (none)
wdDialogNewToolbar | 586 | (none)
wdDialogNoteOptions | 373 | (none)
wdDialogOMathRecognizedFunctions | 2165 | (none)
wdDialogOrganizer | 222 | (none)
wdDialogPermission | 1469 | (none)
wdDialogPhoneticGuide | 986 | (none)
wdDialogReviewAfmtRevisions | 570 | (none)
wdDialogSchemaLibrary | 1417 | (none)
wdDialogSearch | 1363 | (none)
wdDialogShowRepairs | 1381 | (none)
wdDialogSourceManager | 1920 | (none)
wdDialogStyleManagement | 1948 | (none)
wdDialogTableAutoFormat | 563 | (none)
wdDialogTableCellOptions | 1081 | (none)
wdDialogTableColumnWidth | 143 | (none)
wdDialogTableDeleteCells | 133 | (none)
wdDialogTableFormatCell | 612 | (none)
wdDialogTableFormula | 348 | (none)
wdDialogTableInsertCells | 130 | (none)
wdDialogTableInsertRow | 131 | (none)
wdDialogTableInsertTable | 129 | (none)
wdDialogTableOfCaptionsOptions | 551 | (none)
wdDialogTableOfContentsOptions | 470 | (none)
wdDialogTableProperties | 861 | (none)
wdDialogTableRowHeight | 142 | (none)
wdDialogTableSort | 199 | (none)
wdDialogTableSplitCells | 137 | (none)
wdDialogTableTableOptions | 1080 | (none)
wdDialogTableToText | 128 | (none)
wdDialogTableWrapping | 854 | (none)
wdDialogTCSCTranslator | 1156 | (none)
wdDialogTextToTable | 127 | (none)
wdDialogToolsAcceptRejectChanges | 506 | (none)
wdDialogToolsAdvancedSettings | 206 | (none)
wdDialogToolsAutoCorrect | 378 | (none)
wdDialogToolsAutoCorrectExceptions | 762 | (none)
wdDialogToolsAutoManager | 915 | (none)
wdDialogToolsAutoSummarize | 874 | (none)
wdDialogToolsBulletsNumbers | 196 | (none)
wdDialogToolsCompareDocuments | 198 | (none)
wdDialogToolsCreateDirectory | 833 | (none)
wdDialogToolsCreateEnvelope | 173 | (none)
wdDialogToolsCreateLabels | 489 | (none)
wdDialogToolsCustomize | 152 | (none)
wdDialogToolsCustomizeKeyboard | 432 | (none)
wdDialogToolsCustomizeMenuBar | 615 | (none)
wdDialogToolsCustomizeMenus | 433 | (none)
wdDialogToolsDictionary | 989 | (none)
wdDialogToolsEnvelopesAndLabels | 607 | (none)
wdDialogToolsGrammarSettings | 885 | (none)
wdDialogToolsHangulHanjaConversion | 784 | (none)
wdDialogToolsHighlightChanges | 197 | (none)
wdDialogToolsHyphenation | 195 | (none)
wdDialogToolsLanguage | 188 | (none)
wdDialogToolsMacro | 215 | (none)
wdDialogToolsMacroRecord | 214 | (none)
wdDialogToolsManageFields | 631 | (none)
wdDialogToolsMergeDocuments | 435 | (none)
wdDialogToolsOptions | 974 | (none)
wdDialogToolsOptionsAutoFormat | 959 | (none)
wdDialogToolsOptionsAutoFormatAsYouType | 778 | (none)
wdDialogToolsOptionsBidi | 1029 | (none)
wdDialogToolsOptionsCompatibility | 525 | (none)
wdDialogToolsOptionsEdit | 224 | (none)
wdDialogToolsOptionsEditCopyPaste | 1356 | (none)
wdDialogToolsOptionsFileLocations | 225 | (none)
wdDialogToolsOptionsFuzzy | 790 | (none)
wdDialogToolsOptionsGeneral | 203 | (none)
wdDialogToolsOptionsPrint | 208 | (none)
wdDialogToolsOptionsSave | 209 | (none)
wdDialogToolsOptionsSecurity | 1361 | (none)
wdDialogToolsOptionsSmartTag | 1395 | (none)
wdDialogToolsOptionsSpellingAndGrammar | 211 | (none)
wdDialogToolsOptionsTrackChanges | 386 | (none)
wdDialogToolsOptionsTypography | 739 | (none)
wdDialogToolsOptionsUserInfo | 213 | (none)
wdDialogToolsOptionsView | 204 | (none)
wdDialogToolsProtectDocument | 503 | (none)
wdDialogToolsProtectSection | 578 | (none)
wdDialogToolsRevisions | 197 | (none)
wdDialogToolsSpellingAndGrammar | 828 | (none)
wdDialogToolsTemplates | 87 | (none)
wdDialogToolsThesaurus | 194 | (none)
wdDialogToolsUnprotectDocument | 521 | (none)
wdDialogToolsWordCount | 228 | (none)
wdDialogTwoLinesInOne | 1161 | (none)
wdDialogUpdateTOC | 331 | (none)
wdDialogViewZoom | 577 | (none)
wdDialogWebOptions | 898 | (none)
wdDialogWindowActivate | 220 | (none)
wdDialogXMLElementAttributes | 1460 | (none)
wdDialogXMLOptions | 1425 | (none)


WdWordDialogTab Enumeration (Word)

 Copy code hover
[image]

WdWordDialogTab Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the active tab when the specified dialog box is displayed.

Name | Value | Description
wdDialogEmailOptionsTabQuoting | 1900002 | General tab of the E-mail Options dialog box.
wdDialogEmailOptionsTabSignature | 1900000 | E-mail Signature tab of the E-mail Options dialog box.
wdDialogEmailOptionsTabStationary | 1900001 | Personal Stationary tab of the E-mail Options dialog box.
wdDialogFilePageSetupTabCharsLines | 150004 | Margins tab of the Page Setup dialog box, with Apply To drop-down list active.
wdDialogFilePageSetupTabLayout | 150003 | Layout tab of the Page Setup dialog box.
wdDialogFilePageSetupTabMargins | 150000 | Margins tab of the Page Setup dialog box.
wdDialogFilePageSetupTabPaper | 150001 | Paper tab of the Page Setup dialog box.
wdDialogFormatBordersAndShadingTabBorders | 700000 | Borders tab of the Borders dialog box.
wdDialogFormatBordersAndShadingTabPageBorder | 700001 | Page Border tab of the Borders dialog box.
wdDialogFormatBordersAndShadingTabShading | 700002 | Shading tab of the Borders dialog box.
wdDialogFormatBulletsAndNumberingTabBulleted | 1500000 | Bulleted tab of the Bullets and Numbering dialog box.
wdDialogFormatBulletsAndNumberingTabNumbered | 1500001 | Numbered tab of the Bullets and Numbering dialog box.
wdDialogFormatBulletsAndNumberingTabOutlineNumbered | 1500002 | Outline Numbered tab of the Bullets and Numbering dialog box.
wdDialogFormatDrawingObjectTabColorsAndLines | 1200000 | Colors and Lines tab of the Format Drawing Object dialog box.
wdDialogFormatDrawingObjectTabHR | 1200007 | Colors and Lines tab of the Format Drawing Object dialog box.
wdDialogFormatDrawingObjectTabPicture | 1200004 | Picture tab of the Format Drawing Object dialog box.
wdDialogFormatDrawingObjectTabPosition | 1200002 | Position tab of the Format Drawing Object dialog box.
wdDialogFormatDrawingObjectTabSize | 1200001 | Size tab of the Format Drawing Object dialog box.
wdDialogFormatDrawingObjectTabTextbox | 1200005 | Textbox tab of the Format Drawing Object dialog box.
wdDialogFormatDrawingObjectTabWeb | 1200006 | Web tab of the Format Drawing Object dialog box.
wdDialogFormatDrawingObjectTabWrapping | 1200003 | Wrapping tab of the Format Drawing Object dialog box.
wdDialogFormatFontTabAnimation | 600002 | Animation tab of the Font dialog box.
wdDialogFormatFontTabCharacterSpacing | 600001 | Character Spacing tab of the Font dialog box.
wdDialogFormatFontTabFont | 600000 | Font tab of the Font dialog box.
wdDialogFormatParagraphTabIndentsAndSpacing | 1000000 | Indents and Spacing tab of the Paragraph dialog box.
wdDialogFormatParagraphTabTeisai | 1000002 | Line and Page Breaks tab of the Paragraph dialog box, with choices appropriate for Asian text.
wdDialogFormatParagraphTabTextFlow | 1000001 | Line and Page Breaks tab of the Paragraph dialog box.
wdDialogInsertIndexAndTablesTabIndex | 400000 | Index tab of the Index and Tables dialog box.
wdDialogInsertIndexAndTablesTabTableOfAuthorities | 400003 | Table of Authorities tab of the Index and Tables dialog box.
wdDialogInsertIndexAndTablesTabTableOfContents | 400001 | Table of Contents tab of the Index and Tables dialog box.
wdDialogInsertIndexAndTablesTabTableOfFigures | 400002 | Table of Figures tab of the Index and Tables dialog box.
wdDialogInsertSymbolTabSpecialCharacters | 200001 | Special Characters tab of the Symbol dialog box.
wdDialogInsertSymbolTabSymbols | 200000 | Symbols tab of the Symbol dialog box.
wdDialogLetterWizardTabLetterFormat | 1600000 | Letter Format tab of the Letter Wizard dialog box.
wdDialogLetterWizardTabOtherElements | 1600002 | Other Elements tab of the Letter Wizard dialog box.
wdDialogLetterWizardTabRecipientInfo | 1600001 | Recipient Info tab of the Letter Wizard dialog box.
wdDialogLetterWizardTabSenderInfo | 1600003 | Sender Info tab of the Letter Wizard dialog box.
wdDialogNoteOptionsTabAllEndnotes | 300001 | All Endnotes tab of the Note Options dialog box.
wdDialogNoteOptionsTabAllFootnotes | 300000 | All Footnotes tab of the Note Options dialog box.
wdDialogOrganizerTabAutoText | 500001 | AutoText tab of the Organizer dialog box.
wdDialogOrganizerTabCommandBars | 500002 | Command Bars tab of the Organizer dialog box.
wdDialogOrganizerTabMacros | 500003 | Macros tab of the Organizer dialog box.
wdDialogOrganizerTabStyles | 500000 | Styles tab of the Organizer dialog box.
wdDialogTablePropertiesTabCell | 1800003 | Cell tab of the Table Properties dialog box.
wdDialogTablePropertiesTabColumn | 1800002 | Column tab of the Table Properties dialog box.
wdDialogTablePropertiesTabRow | 1800001 | Row tab of the Table Properties dialog box.
wdDialogTablePropertiesTabTable | 1800000 | Table tab of the Table Properties dialog box.
wdDialogTemplates | 2100000 | Templates tab of the Templates and Add-ins dialog box.
wdDialogTemplatesLinkedCSS | 2100003 | Linked CSS tab of the Templates and Add-ins dialog box.
wdDialogTemplatesXMLExpansionPacks | 2100002 | XML Expansion Packs tab of the Templates and Add-ins dialog box.
wdDialogTemplatesXMLSchema | 2100001 | XML Schema tab of the Templates and Add-ins dialog box.
wdDialogToolsAutoCorrectExceptionsTabFirstLetter | 1400000 | First Letter tab of the AutoCorrect Exceptions dialog box.
wdDialogToolsAutoCorrectExceptionsTabHangulAndAlphabet | 1400002 | Hangul and Alphabet tab of the AutoCorrect Exceptions dialog box. Available only in multi-language versions.
wdDialogToolsAutoCorrectExceptionsTabIac | 1400003 | Other Corrections tab of the AutoCorrect Exceptions dialog box.
wdDialogToolsAutoCorrectExceptionsTabInitialCaps | 1400001 | Initial Caps tab of the AutoCorrect Exceptions dialog box.
wdDialogToolsAutoManagerTabAutoCorrect | 1700000 | AutoCorrect tab of the AutoCorrect dialog box.
wdDialogToolsAutoManagerTabAutoFormat | 1700003 | AutoFormat tab of the AutoCorrect dialog box.
wdDialogToolsAutoManagerTabAutoFormatAsYouType | 1700001 | Format As You Type tab of the AutoCorrect dialog box.
wdDialogToolsAutoManagerTabAutoText | 1700002 | AutoText tab of the AutoCorrect dialog box.
wdDialogToolsAutoManagerTabSmartTags | 1700004 | Smart Tags tab of the AutoCorrect dialog box.
wdDialogToolsEnvelopesAndLabelsTabEnvelopes | 800000 | Envelopes tab of the Envelopes and Labels dialog box.
wdDialogToolsEnvelopesAndLabelsTabLabels | 800001 | Labels tab of the Envelopes and Labels dialog box.
wdDialogToolsOptionsTabAcetate | 1266 | Not supported.
wdDialogToolsOptionsTabBidi | 1029 | Complex Scripts tab of the Options dialog box.
wdDialogToolsOptionsTabCompatibility | 525 | Compatibility tab of the Options dialog box.
wdDialogToolsOptionsTabEdit | 224 | Edit tab of the Options dialog box.
wdDialogToolsOptionsTabFileLocations | 225 | File Locations tab of the Options dialog box.
wdDialogToolsOptionsTabFuzzy | 790 | Not supported.
wdDialogToolsOptionsTabGeneral | 203 | General tab of the Options dialog box.
wdDialogToolsOptionsTabHangulHanjaConversion | 786 | Hangul Hanja Conversion tab of the Options dialog box.
wdDialogToolsOptionsTabPrint | 208 | Print tab of the Options dialog box.
wdDialogToolsOptionsTabProofread | 211 | Spelling and Grammar tab of the Options dialog box.
wdDialogToolsOptionsTabSave | 209 | Save tab of the Options dialog box.
wdDialogToolsOptionsTabSecurity | 1361 | Security tab of the Options dialog box.
wdDialogToolsOptionsTabTrackChanges | 386 | Track Changes tab of the Options dialog box.
wdDialogToolsOptionsTabTypography | 739 | Asian Typography tab of the Options dialog box.
wdDialogToolsOptionsTabUserInfo | 213 | User Information tab of the Options dialog box.
wdDialogToolsOptionsTabView | 204 | View tab of the Options dialog box.
wdDialogWebOptionsBrowsers | 2000000 | Browsers tab of the Web Options dialog box.
wdDialogWebOptionsEncoding | 2000003 | Encoding tab of the Web Options dialog box.
wdDialogWebOptionsFiles | 2000001 | Files tab of the Web Options dialog box.
wdDialogWebOptionsFonts | 2000004 | Fonts tab of the Web Options dialog box.
wdDialogWebOptionsGeneral | 2000000 | General tab of the Web Options dialog box.
wdDialogWebOptionsPictures | 2000002 | Pictures tab of the Web Options dialog box.
wdDialogStyleManagementTabEdit | 2200000 | Edit tab of the Style Management dialog box.
wdDialogStyleManagementTabRecommend | 2200001 | Recommend tab of the Style Management dialog box.
wdDialogStyleManagementTabRestrict | 2200002 | Restrict tab of the Style Management dialog box.


WdWrapSideType Enumeration (Word)

 Copy code hover
[image]

WdWrapSideType Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies whether the document text should wrap on both sides of the specified shape, on either the left or right side only, or on the side of the shape that is farthest from the page margin.

Name | Value | Description
wdWrapBoth | 0 | Both sides of the specified shape.
wdWrapLargest | 3 | Side of the shape that is farthest from the page margin.
wdWrapLeft | 1 | Left side of shape only.
wdWrapRight | 2 | Right side of shape only.


WdWrapType Enumeration (Word)

 Copy code hover
[image]

WdWrapType Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies how to wrap text around a shape.

Name | Value | Description
wdWrapInline | 7 | Places shapes in line with text.
wdWrapNone | 3 | Places shape in front of text. See also wdWrapFront.
wdWrapSquare | 0 | Wraps text around the shape. Line continuation is on the oposite side of the shape.
wdWrapThrough | 2 | Wraps text around the shape.
wdWrapTight | 1 | Wraps text close to the shape.
wdWrapTopBottom | 4 | Places text above and below the shape.
wdWrapBehind | 5 | Places shape behind text.
wdWrapFront | 6 | Places shape in front of text.

Remarks

Used with the Type property of the WrapFormat object. You can view what each wrap type looks like on the Text Wrapping tab of the Advanced Layout dialog box.

Note Note

wdWrapSquare, wdWrapTight, and wdWrapThrough all function in essentially the same way.


WdWrapTypeMerged Enumeration (Word)

 Copy code hover
[image]

WdWrapTypeMerged Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies how Microsoft Word wraps text around pictures.

Name | Value | Description
wdWrapMergeBehind | 3 | Behind text.
wdWrapMergeFront | 4 | In front of text.
wdWrapMergeInline | 0 | In line with text.
wdWrapMergeSquare | 1 | Square.
wdWrapMergeThrough | 5 | Through.
wdWrapMergeTight | 2 | Tight.
wdWrapMergeTopBottom | 6 | Top and bottom.


XlAxisCrosses Enumeration (Word)

 Copy code hover
[image]

XlAxisCrosses Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the point on the specified axis where the other axis crosses.

Version Information

Version Added: Word 2007

Name | Value | Description
xlAxisCrossesAutomatic | -4105 | Word sets the axis crossing point.
xlAxisCrossesCustom | -4114 | The CrossesAt property specifies the axis crossing point.
xlAxisCrossesMaximum | 2 | The axis crosses at the maximum value.
xlAxisCrossesMinimum | 4 | The axis crosses at the minimum value.


XlAxisGroup Enumeration (Word)

 Copy code hover
[image]

XlAxisGroup Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the type of axis group.

Version Information

Version Added: Word 2007

Name | Value | Description
xlPrimary | 1 | The primary axis group.
xlSecondary | 2 | The secondary axis group.


XlAxisType Enumeration (Word)

 Copy code hover
[image]

XlAxisType Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the axis type.

Version Information

Version Added: Word 2007

Name | Value | Description
xlCategory | 1 | Axis displays categories.
xlSeriesAxis | 3 | Axis displays data series.
xlValue | 2 | Axis displays values.


XlBackground Enumeration (Word)

 Copy code hover
[image]

XlBackground Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the background type for text in charts.

Version Information

Version Added: Word 2007

Name | Value | Description
xlBackgroundAutomatic | -4105 | Word controls the background.
xlBackgroundOpaque | 3 | An opaque background.
xlBackgroundTransparent | 2 | A transparent background.


XlBarShape Enumeration (Word)

 Copy code hover
[image]

XlBarShape Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the shape used with the 3-D bar or column chart.

Version Information

Version Added: Word 2007

Name | Value | Description
xlBox | 0 | A box.
xlConeToMax | 5 | A cone, truncated at the specified value.
xlConeToPoint | 4 | A cone, coming to a point at the specified value.
xlCylinder | 3 | A cylinder.
xlPyramidToMax | 2 | A pyramid, truncated at the specified value.
xlPyramidToPoint | 1 | A pyramid, coming to a point at the specified value.


XlBorderWeight Enumeration (Word)

 Copy code hover
[image]

XlBorderWeight Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the weight of the border around a range.

Version Information

Version Added: Word 2007

Name | Value | Description
xlHairline | 1 | A hairline border (thinnest border).
xlMedium | -4138 | A medium border.
xlThick | 4 | A thick border (widest border).
xlThin | 2 | A thin border.


XlCategoryLabelLevel Enumeration (Word)

 Copy code hover
[image]

XlCategoryLabelLevel Enumeration (Word)
Send feedback

Published: July 16, 2012

Constants that represent chart category-label levels, passed to and returned by the Chart.CategoryLabelLevel property.

Version information

Version Added: Word 2013

Members

Name | Value | Description
xlCategoryLabelLevelAll | -1 | Use all category label levels within range on the chart. The default.
xlCategoryLabelLevelCustom | -2 | Indicates literal data in the category labels.
xlCategoryLabelLevelNone | -3 | Use no category labels in the chart. Defaults to automatic indexed labels.


XlCategoryType Enumeration (Word)

 Copy code hover
[image]

XlCategoryType Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the type of the category axis.

Version Information

Version Added: Word 2007

Name | Value | Description
xlAutomaticScale | -4105 | Word controls the axis type.
xlCategoryScale | 2 | Axis groups data by an arbitrary set of categories.
xlTimeScale | 3 | Axis groups data on a time scale.


XlChartElementPosition Enumeration (Word)

 Copy code hover
[image]

XlChartElementPosition Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the position of the chart element.

Version Information

Version Added: Word 2007

Name | Value | Description
xlChartElementPositionAutomatic | -4105 | Automatically sets the position of the chart element.
xlChartElementPositionCustom | -4114 | Specifies a specific position for the chart element.


XlChartGallery Enumeration (Word)

 Copy code hover
[image]

XlChartGallery Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies a chart gallery.

Version Information

Version Added: Word 2007

Name | Value | Description
xlAnyGallery | 23 | Either of the galleries.
xlBuiltIn | 21 | The built-in gallery.
xlUserDefined | 22 | The user-defined gallery.


XlChartItem Enumeration (Word)

 Copy code hover
[image]

XlChartItem Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the type of the chart item.

Version Information

Version Added: Word 2007

Name | Value | Description
xlAxis | 21 | Axis.
xlAxisTitle | 17 | Axis title.
xlChartArea | 2 | Chart area.
xlChartTitle | 4 | Chart title.
xlCorners | 6 | Corners.
xlDataLabel | 0 | Data label.
xlDataTable | 7 | Data table.
xlDisplayUnitLabel | 30 | Display unit label.
xlDownBars | 20 | Down bars.
xlDropLines | 26 | Drop lines.
xlErrorBars | 9 | Error bars.
xlFloor | 23 | Floor.
xlHiLoLines | 25 | HiLo lines.
xlLeaderLines | 29 | Leader lines.
xlLegend | 24 | Legend.
xlLegendEntry | 12 | Legend entry.
xlLegendKey | 13 | Legend key.
xlMajorGridlines | 15 | Major gridlines.
xlMinorGridlines | 16 | Minor gridlines.
xlNothing | 28 | Nothing.
xlPivotChartDropZone | 32 | PivotChart drop zone.
xlPivotChartFieldButton | 31 | PivotChart field button.
xlPlotArea | 19 | Plot area.
xlRadarAxisLabels | 27 | Radar axis labels.
xlSeries | 3 | Series.
xlSeriesLines | 22 | Series lines.
xlShape | 14 | Shape.
xlTrendline | 8 | Trend line.
xlUpBars | 18 | Up bars.
xlWalls | 5 | Walls.
xlXErrorBars | 10 | X error bars.
xlYErrorBars | 11 | Y error bars.


XlChartPicturePlacement Enumeration (Word)

 Copy code hover
[image]

XlChartPicturePlacement Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the placement of a user-selected picture on a bar in a 3-D bar or column.

Version Information

Version Added: Word 2007

Name | Value | Description
xlAllFaces | 7 | Display on all faces.
xlEnd | 2 | Display on end.
xlEndSides | 3 | Display on end and sides.
xlFront | 4 | Display on front.
xlFrontEnd | 6 | Display on front and end.
xlFrontSides | 5 | Display on front and sides.
xlSides | 1 | Display on sides.


XlChartPictureType Enumeration (Word)

 Copy code hover
[image]

XlChartPictureType Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies how pictures are displayed on a column, bar picture chart, or legend key.

Version Information

Version Added: Word 2007

Name | Value | Description
xlStack | 2 | The picture is sized to repeat a maximum of 15 times in the longest stacked bar.
xlStackScale | 3 | The picture is sized to a specified number of units and repeated the length of the bar.
xlStretch | 1 | The picture is stretched the full length of the stacked bar.


XlChartSplitType Enumeration (Word)

 Copy code hover
[image]

XlChartSplitType Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the values displayed in the second chart in a pie chart or a bar of pie chart.

Version Information

Version Added: Word 2007

Name | Value | Description
xlSplitByCustomSplit | 4 | The second chart displays arbitrary slides.
xlSplitByPercentValue | 3 | The second chart displays values less than a percentage of the total value. The percentage is specified by the SplitValue property.
xlSplitByPosition | 1 | The second chart displays the smallest values in the data series. The number of values to display is specified by the SplitValue property.
xlSplitByValue | 2 | The second chart displays values less than the value specified by the SplitValue property.


XlColorIndex Enumeration (Word)

 Copy code hover
[image]

XlColorIndex Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the color of a selected feature, such as a border, font, or fill.

Version Information

Version Added: Word 2007

Name | Value | Description
xlColorIndexAutomatic | -4105 | Automatic color.
xlColorIndexNone | -4142 | No color.


XlConstants Enumeration (Word)

 Copy code hover
[image]

XlConstants Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies a miscellaneous constant in Microsoft Word.

Version Information

Version Added: Word 2007

Name | Value | Description
xl3DBar | -4099 | Three-dimensional bar chart group or series.
xl3DSurface | -4103 | Three-dimensional surface chart group or series.
xlAbove | 0 | The summary row is displayed above the specified range.
xlAutomatic | -4105 | Word applies automatic settings, such as a color or page number, to the specified object.
xlBar | 2 | Two-dimensional bar chart group or series.
xlBelow | 1 | The summary row is displayed below the specified range.
xlBoth | 1 | Display positive and negative error bars in the specified chart group or series.
xlBottom | -4107 | Bottom.
xlCenter | -4108 | Center.
xlChecker | 9 | Checker pattern.
xlCircle | 8 | Circle.
xlColumn | 3 | Columnar chart group or series.
xlCombination | -4111 | Combination.
xlCorner | 2 | Corner.
xlCrissCross | 16 | Criss-cross pattern.
xlCross | 4 | Cross pattern.
xlCustom | -4114 | Word applies custom settings, such as a color or error amount, to the specified object.
xlDefaultAutoFormat | -1 | Word applies default or automatic formatting.
xlDiamond | 2 | Diamond pattern.
xlDistributed | -4117 | Distributed.
xlFill | 5 | Fill.
xlFixedValue | 1 | Display error amounts as a fixed value.
xlGeneral | 1 | General.
xlGray16 | 17 | 16% gray pattern.
xlGray25 | -4124 | 25% gray pattern.
xlGray50 | -4125 | 50% gray pattern.
xlGray75 | -4126 | 75% gray pattern.
xlGray8 | 18 | 8% gray pattern.
xlGrid | 15 | Grid pattern.
xlHigh | -4127 | High.
xlInside | 2 | Inside.
xlJustify | -4130 | Justify.
xlLeft | -4131 | Left.
xlLightDown | 13 | Light down line pattern.
xlLightHorizontal | 11 | Light horizontal line pattern.
xlLightUp | 14 | Light up line pattern.
xlLightVertical | 12 | Light vertical line pattern.
xlLow | -4134 | Low.
xlMaximum | 2 | Maximum.
xlMinimum | 4 | Minimum.
xlMinusValues | 3 | Minus values.
xlNextToAxis | 4 | Next to axis.
xlNone | -4142 | Do not display error bars in the specified chart group or series.
xlOpaque | 3 | Opaque fill.
xlOutside | 3 | Outside.
xlPercent | 2 | Display error amounts as a percentage.
xlPlus | 9 | Display positive error bars in the specified chart group or series.
xlPlusValues | 2 | Plus values.
xlRight | -4152 | Right.
xlScale | 3 | Scale.
xlSemiGray75 | 10 | 75% semi-gray pattern.
xlShowLabel | 4 | Show label.
xlShowLabelAndPercent | 5 | Show label and percent.
xlShowPercent | 3 | Show percent.
xlShowValue | 2 | Show value.
xlSingle | 2 | Single line.
xlSolid | 1 | Solid pattern.
xlSquare | 1 | Square.
xlStar | 5 | Star.
xlStError | 4 | Display error amounts as a standard error.
xlTop | -4160 | Top.
xlTransparent | 2 | Transparent fill.
xlTriangle | 3 | Triangle.


XlCopyPictureFormat Enumeration (Word)

 Copy code hover
[image]

XlCopyPictureFormat Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the format of the picture being copied.

Version Information

Version Added: Word 2007

Name | Value | Description
xlBitmap | 2 | A bitmap (.bmp, .jpg, .gif).
xlPicture | -4147 | A drawn picture (.png, .wmf, .mix).


XlDataLabelPosition Enumeration (Word)

 Copy code hover
[image]

XlDataLabelPosition Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies where the data label is positioned.

Version Information

Version Added: Word 2007

Name | Value | Description
xlLabelPositionAbove | 0 | The data label is positioned above the data point.
xlLabelPositionBelow | 1 | The data label is positioned below the data point.
xlLabelPositionBestFit | 5 | Word sets the position of the data label.
xlLabelPositionCenter | -4108 | The data label is centered on the data point or is inside a bar or pie chart.
xlLabelPositionCustom | 7 | The data label is in a custom position.
xlLabelPositionInsideBase | 4 | The data label is positioned inside the data point at the bottom edge.
xlLabelPositionInsideEnd | 3 | The data label is positioned inside the data point at the top edge.
xlLabelPositionLeft | -4131 | The data label is positioned to the left of the data point.
xlLabelPositionMixed | 6 | Data labels are in multiple positions.
xlLabelPositionOutsideEnd | 2 | The data label is positioned outside the data point at the top edge.
xlLabelPositionRight | -4152 | The data label is positioned to the right of the data point.


XlDataLabelSeparator Enumeration (Word)

 Copy code hover
[image]

XlDataLabelSeparator Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the separator used with data labels.

Version Information

Version Added: Word 2007

Name | Value | Description
xlDataLabelSeparatorDefault | 1 | Word selects the separator.


XlDataLabelsType Enumeration (Word)

 Copy code hover
[image]

XlDataLabelsType Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the type of data label to apply.

Version Information

Version Added: Word 2007

Name | Value | Description
xlDataLabelsShowBubbleSizes | 6 | Show the size of the bubble in reference to the absolute value.
xlDataLabelsShowLabel | 4 | The category for the point.
xlDataLabelsShowLabelAndPercent | 5 | The percentage of the total, and the category for the point. Available only for pie charts and doughnut charts.
xlDataLabelsShowNone | -4142 | No data labels.
xlDataLabelsShowPercent | 3 | The percentage of the total. Available only for pie charts and doughnut charts.
xlDataLabelsShowValue | 2 | The default value for the point (assumed if this argument is not specified).


XlDisplayBlanksAs Enumeration (Word)

 Copy code hover
[image]

XlDisplayBlanksAs Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies how blank cells are plotted on a chart.

Version Information

Version Added: Word 2007

Name | Value | Description
xlInterpolated | 3 | Values are interpolated into the chart.
xlNotPlotted | 1 | Blank cells are not plotted.
xlZero | 2 | Blanks are plotted as zero.


XlDisplayUnit Enumeration (Word)

 Copy code hover
[image]

XlDisplayUnit Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the display unit label for an axis.

Version Information

Version Added: Word 2007

Name | Value | Description
xlHundredMillions | -8 | Hundreds of millions.
xlHundreds | -2 | Hundreds.
xlHundredThousands | -5 | Hundreds of thousands.
xlMillionMillions | -10 | Millions of millions.
xlMillions | -6 | Millions.
xlTenMillions | -7 | Tens of millions.
xlTenThousands | -4 | Tens of thousands.
xlThousandMillions | -9 | Thousands of millions.
xlThousands | -3 | Thousands.


XlEndStyleCap Enumeration (Word)

 Copy code hover
[image]

XlEndStyleCap Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the end style for error bars.

Version Information

Version Added: Word 2007

Name | Value | Description
xlCap | 1 | Caps are applied.
xlNoCap | 2 | No caps are applied.


XlErrorBarDirection Enumeration (Word)

 Copy code hover
[image]

XlErrorBarDirection Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies which axis values are to receive error bars.

Version Information

Version Added: Word 2007

Name | Value | Description
xlChartX | -4168 | Bars run parallel to the y-axis for x-axis values.
xlChartY | 1 | Bars run parallel to the x-axis for y-axis values.


XlErrorBarInclude Enumeration (Word)

 Copy code hover
[image]

XlErrorBarInclude Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies which error-bar parts to include.

Version Information

Version Added: Word 2007

Name | Value | Description
xlErrorBarIncludeBoth | 1 | Both the positive and negative error range.
xlErrorBarIncludeMinusValues | 3 | Only the negative error range.
xlErrorBarIncludeNone | -4142 | No error bar range.
xlErrorBarIncludePlusValues | 2 | Only the positive error range.


XlErrorBarType Enumeration (Word)

 Copy code hover
[image]

XlErrorBarType Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the range marked by error bars.

Version Information

Version Added: Word 2007

Name | Value | Description
xlErrorBarTypeCustom | -4114 | The range is set by fixed values or cell values.
xlErrorBarTypeFixedValue | 1 | Fixed-length error bars.
xlErrorBarTypePercent | 2 | The percentage of the range to be covered by the error bars.
xlErrorBarTypeStDev | -4155 | Shows the range for a specified number of standard deviations.
xlErrorBarTypeStError | 4 | Shows the standard error range.


XlHAlign Enumeration (Word)

 Copy code hover
[image]

XlHAlign Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the horizontal alignment for the object.

Version Information

Version Added: Word 2007

Name | Value | Description
xlHAlignCenter | -4108 | Center.
xlHAlignCenterAcrossSelection | 7 | Center across selection.
xlHAlignDistributed | -4117 | Distribute.
xlHAlignFill | 5 | Fill.
xlHAlignGeneral | 1 | Align according to data type.
xlHAlignJustify | -4130 | Justify.
xlHAlignLeft | -4131 | Left.
xlHAlignRight | -4152 | Right.


XlLegendPosition Enumeration (Word)

 Copy code hover
[image]

XlLegendPosition Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the position of the legend on a chart.

Version Information

Version Added: Word 2007

Name | Value | Description
xlLegendPositionBottom | -4107 | Below the chart.
xlLegendPositionCorner | 2 | In the upper-right corner of the chart border.
xlLegendPositionCustom | -4161 | A custom position.
xlLegendPositionLeft | -4131 | Left of the chart.
xlLegendPositionRight | -4152 | Right of the chart.
xlLegendPositionTop | -4160 | Above the chart.


XlLineStyle Enumeration (Word)

 Copy code hover
[image]

XlLineStyle Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the line style for the border.

Version Information

Version Added: Word 2007

Name | Value | Description
xlContinuous | 1 | A continuous line.
xlDash | -4115 | A dashed line.
xlDashDot | 4 | Alternating dashes and dots.
xlDashDotDot | 5 | A dash followed by two dots.
xlDot | -4118 | A dotted line.
xlDouble | -4119 | A double line.
xlLineStyleNone | -4142 | No line.
xlSlantDashDot | 13 | Slanted dashes.


XlMarkerStyle Enumeration (Word)

 Copy code hover
[image]

XlMarkerStyle Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the marker style for a point or series in a line chart, scatter chart, or radar chart.

Version Information

Version Added: Word 2007

Name | Value | Description
xlMarkerStyleAutomatic | -4105 | Automatic markers.
xlMarkerStyleCircle | 8 | Circular markers.
xlMarkerStyleDash | -4115 | Long bar markers.
xlMarkerStyleDiamond | 2 | Diamond-shaped markers.
xlMarkerStyleDot | -4118 | Short bar markers.
xlMarkerStyleNone | -4142 | No markers.
xlMarkerStylePicture | -4147 | Picture markers.
xlMarkerStylePlus | 9 | Square markers with a plus sign.
xlMarkerStyleSquare | 1 | Square markers.
xlMarkerStyleStar | 5 | Square markers with an asterisk.
xlMarkerStyleTriangle | 3 | Triangular markers.
xlMarkerStyleX | -4168 | Square markers with an X.


XlOrientation Enumeration (Word)

 Copy code hover
[image]

XlOrientation Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the text orientation.

Version Information

Version Added: Word 2007

Name | Value | Description
xlDownward | -4170 | Text runs downward.
xlHorizontal | -4128 | Text runs horizontally.
xlUpward | -4171 | Text runs upward.
xlVertical | -4166 | Text runs downward and is centered in the cell.


XlPattern Enumeration (Word)

 Copy code hover
[image]

XlPattern Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the interior pattern of a chart or interior object.

Version Information

Version Added: Word 2007

Name | Value | Description
xlPatternAutomatic | -4105 | Word controls the pattern.
xlPatternChecker | 9 | A checkerboard.
xlPatternCrissCross | 16 | Criss-crossed lines.
xlPatternDown | -4121 | Dark diagonal lines running from the upper left to the lower right.
xlPatternGray16 | 17 | 16% gray.
xlPatternGray25 | -4124 | 25% gray.
xlPatternGray50 | -4125 | 50% gray.
xlPatternGray75 | -4126 | 75% gray.
xlPatternGray8 | 18 | 8% gray.
xlPatternGrid | 15 | A grid.
xlPatternHorizontal | -4128 | Dark horizontal lines.
xlPatternLightDown | 13 | Light diagonal lines running from the upper left to the lower right.
xlPatternLightHorizontal | 11 | Light horizontal lines.
xlPatternLightUp | 14 | Light diagonal lines running from the lower left to the upper right.
xlPatternLightVertical | 12 | Light vertical bars.
xlPatternLinearGradient | 4000 | A linear gradient.
xlPatternNone | -4142 | No pattern.
xlPatternRectangularGradient | 4001 | A rectangular gradient.
xlPatternSemiGray75 | 10 | 75% dark moiré.
xlPatternSolid | 1 | A solid color.
xlPatternUp | -4162 | Dark diagonal lines running from the lower left to the upper right.
xlPatternVertical | -4166 | Dark vertical bars.


XlPictureAppearance Enumeration (Word)

 Copy code hover
[image]

XlPictureAppearance Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies how the picture should be copied.

Version Information

Version Added: Word 2007

Name | Value | Description
xlPrinter | 2 | The picture is copied as it will look when it is printed.
xlScreen | 1 | The picture is copied to resemble its display on the screen as closely as possible.


XlPieSliceIndex Enumeration (Word)

 Copy code hover
[image]

XlPieSliceIndex Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies which position on the slice to return the coordinate of.

Version Information

Version Added: Excel 2010

Name | Value | Description
xlCenterPoint | 5 | The center point of a pie slice.
xlInnerCenterPoint | 8 | The innermost center point of a doughnut slice.
xlInnerClockwisePoint | 7 | The innermost point of the most clockwise radius of a doughnut slice.
xlInnerCounterClockwisePoint | 9 | The innermost point of the most counterclockwise radius of a doughnut slice.
xlMidClockwiseRadiusPoint | 4 | The midpoint of the most clockwise radius of a slice.
xlMidCounterClockwiseRadiusPoint | 6 | The midpoint of the most counterclockwise radius of a slice.
xlOuterCenterPoint | 2 | The outer center point of the circumference of a slice.
xlOuterClockwisePoint | 3 | The outermost clockwise point of the circumference of a slice.
xlOuterCounterClockwisePoint | 1 | The outermost counterclockwise point of the circumference of a slice.


XlPieSliceLocation Enumeration (Word)

 Copy code hover
[image]

XlPieSliceLocation Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies which position on the slice to return the coordinate of.

Version Information

Version Added: Excel 2010

Name | Value | Description
xlCenterPoint | 5 | The center point of a pie slice.
xlInnerCenterPoint | 8 | The innermost center point of a doughnut slice.
xlInnerClockwisePoint | 7 | The innermost point of the most clockwise radius of a doughnut slice.
xlInnerCounterClockwisePoint | 9 | The innermost point of the most counterclockwise radius of a doughnut slice.
xlMidClockwiseRadiusPoint | 4 | The midpoint of the most clockwise radius of a slice.
xlMidCounterClockwiseRadiusPoint | 6 | The midpoint of the most counterclockwise radius of a slice.
xlOuterCenterPoint | 2 | The outer center point of the circumference of a slice.
xlOuterClockwisePoint | 3 | The outermost clockwise point of the circumference of a slice.
xlOuterCounterClockwisePoint | 1 | The outermost counterclockwise point of the circumference of a slice.


XlPivotFieldOrientation Enumeration (Word)

 Copy code hover
[image]

XlPivotFieldOrientation Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the location of the field in a PivotTable report.

Version Information

Version Added: Word 2007

Name | Value | Description
xlColumnField | 2 | A column field.
xlDataField | 4 | A data field.
xlHidden | 0 | A hidden field.
xlPageField | 3 | A page field.
xlRowField | 1 | A row field.


XlReadingOrder Enumeration (Word)

 Copy code hover
[image]

XlReadingOrder Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the reading order for the specified object.

Version Information

Version Added: Word 2007

Name | Value | Description
xlContext | -5002 | According to context.
xlLTR | -5003 | Left-to-right.
xlRTL | -5004 | Right-to-left.


XlRgbColor Enumeration (Word)

 Copy code hover
[image]

XlRgbColor Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the RGB color.

Version Information

Version Added: Word 2007

Name | Value | Description
xlAliceBlue | 16775408 | Alice Blue
xlAntiqueWhite | 14150650 | Antique White
xlAqua | 16776960 | Aqua
xlAquamarine | 13959039 | Aquamarine
xlAzure | 16777200 | Azure
xlBeige | 14480885 | Beige
xlBisque | 12903679 | Bisque
xlBlack | 0 | Black
xlBlanchedAlmond | 13495295 | Blanched Almond
xlBlue | 16711680 | Blue
xlBlueViolet | 14822282 | Blue Violet
xlBrown | 2763429 | Brown
xlBurlyWood | 8894686 | Burly Wood
xlCadetBlue | 10526303 | Cadet Blue
xlChartreuse | 65407 | Chartreuse
xlCoral | 5275647 | Coral
xlCornflowerBlue | 15570276 | Cornflower Blue
xlCornsilk | 14481663 | Cornsilk
xlCrimson | 3937500 | Crimson
xlDarkBlue | 9109504 | Dark Blue
xlDarkCyan | 9145088 | Dark Cyan
xlDarkGoldenrod | 755384 | Dark Goldenrod
xlDarkGray | 11119017 | Dark Gray
xlDarkGreen | 25600 | Dark Green
xlDarkGrey | 11119017 | Dark Grey
xlDarkKhaki | 7059389 | Dark Khaki
xlDarkMagenta | 9109643 | Dark Magenta
xlDarkOliveGreen | 3107669 | Dark Olive Green
xlDarkOrange | 36095 | Dark Orange
xlDarkOrchid | 13382297 | Dark Orchid
xlDarkRed | 139 | Dark Red
xlDarkSalmon | 8034025 | Dark Salmon
xlDarkSeaGreen | 9419919 | Dark Sea Green
xlDarkSlateBlue | 9125192 | Dark Slate Blue
xlDarkSlateGray | 5197615 | Dark Slate Gray
xlDarkSlateGrey | 5197615 | Dark Slate Grey
xlDarkTurquoise | 13749760 | Dark Turquoise
xlDarkViolet | 13828244 | Dark Violet
xlDeepPink | 9639167 | Deep Pink
xlDeepSkyBlue | 16760576 | Deep Sky Blue
xlDimGray | 6908265 | Dim Gray
xlDimGrey | 6908265 | Dim Grey
xlDodgerBlue | 16748574 | Dodger Blue
xlFireBrick | 2237106 | Fire Brick
xlFloralWhite | 15792895 | Floral White
xlForestGreen | 2263842 | Forest Green
xlFuchsia | 16711935 | Fuchsia
xlGainsboro | 14474460 | Gainsboro
xlGhostWhite | 16775416 | Ghost White
xlGold | 55295 | Gold
xlGoldenrod | 2139610 | Goldenrod
xlGray | 8421504 | Gray
xlGreen | 32768 | Green
xlGreenYellow | 3145645 | Green Yellow
xlGrey | 8421504 | Grey
xlHoneydew | 15794160 | Honeydew
xlHotPink | 11823615 | Hot Pink
xlIndianRed | 6053069 | Indian Red
xlIndigo | 8519755 | Indigo
xlIvory | 15794175 | Ivory
xlKhaki | 9234160 | Khaki
xlLavender | 16443110 | Lavender
xlLavenderBlush | 16118015 | Lavender Blush
xlLawnGreen | 64636 | Lawn Green
xlLemonChiffon | 13499135 | Lemon Chiffon
xlLightBlue | 15128749 | Light Blue
xlLightCoral | 8421616 | Light Coral
xlLightCyan | 9145088 | Light Cyan
xlLightGoldenrodYellow | 13826810 | LightGoldenrodYellow
xlLightGray | 13882323 | Light Gray
xlLightGreen | 9498256 | Light Green
xlLightGrey | 13882323 | Light Grey
xlLightPink | 12695295 | Light Pink
xlLightSalmon | 8036607 | Light Salmon
xlLightSeaGreen | 11186720 | Light Sea Green
xlLightSkyBlue | 16436871 | Light Sky Blue
xlLightSlateGray | 10061943 | Light Slate Gray
xlLightSlateGrey | 10061943 | Light Slate Grey
xlLightSteelBlue | 14599344 | Light Steel Blue
xlLightYellow | 14745599 | Light Yellow
xlLime | 65280 | Lime
xlLimeGreen | 3329330 | Lime Green
xlLinen | 15134970 | Linen
xlMaroon | 128 | Maroon
xlMediumAquamarine | 11206502 | Medium Aquamarine
xlMediumBlue | 13434880 | Medium Blue
xlMediumOrchid | 13850042 | Medium Orchid
xlMediumPurple | 14381203 | Medium Purple
xlMediumSeaGreen | 7451452 | Medium Sea Green
xlMediumSlateBlue | 15624315 | Medium Slate Blue
xlMediumSpringGreen | 10156544 | Medium Spring Green
xlMediumTurquoise | 13422920 | Medium Turquoise
xlMediumVioletRed | 8721863 | Medium Violet Red
xlMidnightBlue | 7346457 | Midnight Blue
xlMintCream | 16449525 | Mint Cream
xlMistyRose | 14804223 | Misty Rose
xlMoccasin | 11920639 | Moccasin
xlNavajoWhite | 11394815 | Navajo White
xlNavy | 8388608 | Navy
xlNavyBlue | 8388608 | Navy Blue
xlOldLace | 15136253 | Old Lace
xlOlive | 32896 | Olive
xlOliveDrab | 2330219 | Olive Drab
xlOrange | 42495 | Orange
xlOrangeRed | 17919 | Orange Red
xlOrchid | 14053594 | Orchid
xlPaleGoldenrod | 7071982 | Pale Goldenrod
xlPaleGreen | 10025880 | Pale Green
xlPaleTurquoise | 15658671 | Pale Turquoise
xlPaleVioletRed | 9662683 | Pale Violet Red
xlPapayaWhip | 14020607 | Papaya Whip
xlPeachPuff | 12180223 | Peach Puff
xlPeru | 4163021 | Peru
xlPink | 13353215 | Pink
xlPlum | 14524637 | Plum
xlPowderBlue | 15130800 | Powder Blue
xlPurple | 8388736 | Purple
xlRed | 255 | Red
xlRosyBrown | 9408444 | Rosy Brown
xlRoyalBlue | 14772545 | Royal Blue
xlSalmon | 7504122 | Salmon
xlSandyBrown | 6333684 | Sandy Brown
xlSeaGreen | 5737262 | Sea Green
xlSeashell | 15660543 | Seashell
xlSienna | 2970272 | Sienna
xlSilver | 12632256 | Silver
xlSkyBlue | 15453831 | Sky Blue
xlSlateBlue | 13458026 | Slate Blue
xlSlateGray | 9470064 | Slate Gray
xlSlateGrey | 9470064 | Slate Grey
xlSnow | 16448255 | Snow
xlSpringGreen | 8388352 | Spring Green
xlSteelBlue | 11829830 | Steel Blue
xlTan | 9221330 | Tan
xlTeal | 8421376 | Teal
xlThistle | 14204888 | Thistle
xlTomato | 4678655 | Tomato
xlTurquoise | 13688896 | Turquoise
xlViolet | 15631086 | Violet
xlWheat | 11788021 | Wheat
xlWhite | 16777215 | White
xlWhiteSmoke | 16119285 | White Smoke
xlYellow | 65535 | Yellow
xlYellowGreen | 3329434 | Yellow Green


XlRowCol Enumeration (Word)

 Copy code hover
[image]

XlRowCol Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies whether the values that correspond to a particular data series are in rows or columns.

Version Information

Version Added: Word 2007

Name | Value | Description
xlColumns | 2 | The data series is in a row.
xlRows | 1 | The data series is in a column.


XlScaleType Enumeration (Word)

 Copy code hover
[image]

XlScaleType Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the scale type of the value axis.

Version Information

Version Added: Word 2007

Name | Value | Description
xlScaleLinear | -4132 | A linear scale.
xlScaleLogarithmic | -4133 | A logarithmic scale.


XlSeriesNameLevel Enumeration (Word)

 Copy code hover
[image]

XlSeriesNameLevel Enumeration (Word)
Send feedback

Published: July 16, 2012

Series-name-level constants passed to and returned by the Chart.SeriesNameLevel property.

Version information

Version Added: Word 2013

Members

Name | Value | Description
xlSeriesNameLevelAll | -1 | Sets series names to all series name levels within range on the chart. The default.
xlSeriesNameLevelCustom | -2 | Indicates literal data in the series names.
xlSeriesNameLevelNone | -3 | Sets no series names in the chart.


XlSizeRepresents Enumeration (Word)

 Copy code hover
[image]

XlSizeRepresents Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies what the bubble size represents on a bubble chart.

Version Information

Version Added: Word 2007

Name | Value | Description
xlSizeIsArea | 1 | The area of the bubble.
xlSizeIsWidth | 2 | The width of the bubble.


XlTickLabelOrientation Enumeration (Word)

 Copy code hover
[image]

XlTickLabelOrientation Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the text orientation for tick-mark labels.

Version Information

Version Added: Word 2007

Name | Value | Description
xlTickLabelOrientationAutomatic | -4105 | The text orientation is set by Microsoft Word.
xlTickLabelOrientationDownward | -4170 | The text runs downward.
xlTickLabelOrientationHorizontal | -4128 | The characters run horizontally.
xlTickLabelOrientationUpward | -4171 | The text runs upward.
xlTickLabelOrientationVertical | -4166 | The characters run vertically.


XlTickLabelPosition Enumeration (Word)

 Copy code hover
[image]

XlTickLabelPosition Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the position of tick-mark labels on the specified axis.

Version Information

Version Added: Word 2007

Name | Value | Description
xlTickLabelPositionHigh | -4127 | The top or right side of the chart.
xlTickLabelPositionLow | -4134 | The bottom or left side of the chart.
xlTickLabelPositionNextToAxis | 4 | Next to the axis (where the axis is not at either side of the chart).
xlTickLabelPositionNone | -4142 | No tick marks.


XlTickMark Enumeration (Word)

 Copy code hover
[image]

XlTickMark Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the position of major and minor tick marks for an axis.

Version Information

Version Added: Word 2007

Name | Value | Description
xlTickMarkCross | 4 | Crosses the axis.
xlTickMarkInside | 2 | Inside the axis.
xlTickMarkNone | -4142 | No mark.
xlTickMarkOutside | 3 | Outside the axis.


XlTimeUnit Enumeration (Word)

 Copy code hover
[image]

XlTimeUnit Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the unit of time for chart axes and data series.

Version Information

Version Added: Word 2007

Name | Value | Description
xlDays | 0 | Days
xlMonths | 1 | Months
xlYears | 2 | Years


XlTrendlineType Enumeration (Word)

 Copy code hover
[image]

XlTrendlineType Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies how the trendline that smoothes out fluctuations in the data is calculated.

Version Information

Version Added: Word 2007

Name | Value | Description
xlExponential | 5 | Uses an equation to calculate the least squares fit through points (for example, y=ab^x) .
xlLinear | -4132 | Uses the linear equation y = mx + b to calculate the least squares fit through points.
xlLogarithmic | -4133 | Uses the equation y = c ln x + b to calculate the least squares fit through points.
xlMovingAvg | 6 | Uses a sequence of averages computed from parts of the data series. The number of points equals the total number of points in the series minus the number specified for the period.
xlPolynomial | 3 | Uses an equation to calculate the least squares fit through points (for example, y = ax^6 + bx^5 + cx^4 + dx^3 + ex^2 + fx + g).
xlPower | 4 | Uses an equation to calculate the least squares fit through points (for example, y = ax^b).


XlUnderlineStyle Enumeration (Word)

 Copy code hover
[image]

XlUnderlineStyle Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the type of underline that is applied to a font.

Version Information

Version Added: Word 2007

Name | Value | Description
xlUnderlineStyleDouble | -4119 | Double thick underline.
xlUnderlineStyleDoubleAccounting | 5 | Two thin underlines placed close together.
xlUnderlineStyleNone | -4142 | No underline.
xlUnderlineStyleSingle | 2 | Single underline.
xlUnderlineStyleSingleAccounting | 4 | Not supported.


XlVAlign Enumeration (Word)

 Copy code hover
[image]

XlVAlign Enumeration (Word)
Send feedback

Published: July 16, 2012

Specifies the vertical alignment for the object.

Version Information

Version Added: Word 2007

Name | Value | Description
xlVAlignBottom | -4107 | Bottom alignment.
xlVAlignCenter | -4108 | Center alignment.
xlVAlignDistributed | -4117 | Distributed alignment.
xlVAlignJustify | -4130 | Justified alignment.
xlVAlignTop | -4160 | Top alignment.


Office 2013 documentation copyright notice

 Copy code hover
[image]

Office 2013 documentation copyright notice
Send feedback

Published: July 16, 2012

This document is provided "as-is". Information and views expressed in this document, including URL and other Internet Web site references, may change without notice. You bear the risk of using it.

Some examples depicted herein are provided for illustration only and are fictitious. No real association or connection is intended or should be inferred.

This document does not provide you with any legal rights to any intellectual property in any Microsoft product. You may copy and use this document for your internal, reference purposes.

© 2013 Microsoft Corporation. All rights reserved.

Microsoft, Access, ActiveX, ClearType, Excel, FrontPage, InfoPath, IntelliSense, JScript, MSDN, MS-DOS, MSN, OneNote, Outlook, PowerPoint, SharePoint, Silverlight, SmartArt, SQL Server, Visio, Visual Basic, Visual C#, Visual C++, Visual Studio, Win32, Windows, Windows PowerShell, Windows Server, and Windows Vista are trademarks of the Microsoft group of companies.

All other trademarks are property of their respective owners.